diff --git a/chunk-HMDNYA55.js b/chunk-2XGFYKVF.js similarity index 90% rename from chunk-HMDNYA55.js rename to chunk-2XGFYKVF.js index 6ea5493b..83dde63d 100644 --- a/chunk-HMDNYA55.js +++ b/chunk-2XGFYKVF.js @@ -1,2 +1,2 @@ -import{_ as n}from"./chunk-5XJ3NODC.js";var r=n.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{let e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(i=>e.updateAttributes(i,{textAlign:t})).every(i=>i):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});export{r as TextAlign,r as default}; -//# sourceMappingURL=chunk-HMDNYA55.js.map +import{_ as n}from"./chunk-7OFBBPR7.js";var r=n.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:t=>{let e=t.style.textAlign||this.options.defaultAlignment;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:t=>t.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${t.textAlign}`}}}}]},addCommands(){return{setTextAlign:t=>({commands:e})=>this.options.alignments.includes(t)?this.options.types.map(i=>e.updateAttributes(i,{textAlign:t})).every(i=>i):!1,unsetTextAlign:()=>({commands:t})=>this.options.types.map(e=>t.resetAttributes(e,"textAlign")).every(e=>e)}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});export{r as TextAlign,r as default}; +//# sourceMappingURL=chunk-2XGFYKVF.js.map diff --git a/chunk-HMDNYA55.js.map b/chunk-2XGFYKVF.js.map similarity index 100% rename from chunk-HMDNYA55.js.map rename to chunk-2XGFYKVF.js.map diff --git a/chunk-2MGINT6C.js b/chunk-4FJ4CVJB.js similarity index 99% rename from chunk-2MGINT6C.js rename to chunk-4FJ4CVJB.js index 398df465..73fe1300 100644 --- a/chunk-2MGINT6C.js +++ b/chunk-4FJ4CVJB.js @@ -1,4 +1,4 @@ -import{a as Re,b as ai,d as hi,f as _i}from"./chunk-VI33G2S5.js";import{$a as vt,$b as rt,$c as Wn,$d as me,$f as Ni,B as en,Bc as ae,Ca as O,Cb as xt,Cc as wt,D as Te,Da as ft,Dc as Rn,Ea as j,Ec as Ln,Ed as ei,Fa as At,Fc as se,Fd as ni,Ga as ot,Gc as Ee,Gf as be,Ha as _t,Hb as re,Hc as ze,Hd as ii,I as nn,Ia as _,Ib as z,Ic as Ae,Id as oi,If as Be,Jb as _n,Jc as Hn,Jd as ri,Jf as Oi,Kb as et,Kc as Mt,Kf as ye,Lb as lt,Lc as ct,Lf as Pi,M as on,Mc as Ve,Md as Dt,Mf as Ti,Na as k,Nc as kt,Nd as si,Nf as ki,Oa as l,Oc as Bt,Of as Ii,Pa as D,Pc as jt,Pd as Le,Pf as Di,Q as ee,Qa as x,Qb as vn,Qc as le,Qd as qt,Qf as Si,R as rn,Ra as ke,Rc as Fn,Rd as He,Rf as Ei,S as gt,Sa as Ie,Sb as Cn,Sf as xe,Ta as De,Tb as bn,Tc as Nn,Td as li,Tf as zi,Ua as p,Ub as yn,Uc as Bn,Ud as ci,Uf as Ai,Va as m,Vc as ce,Vd as ui,Vf as Vi,Wa as w,Wb as xn,Wd as di,Wf as Ri,X as f,Xa as L,Xb as wn,Xc as jn,Xf as Li,Y as an,Ya as H,Yb as Rt,Yc as $t,Yf as Hi,Z as sn,Za as Tt,Zb as Lt,Zc as $n,Zf as Fi,_ as ln,_a as M,_b as Ht,_c as Un,_f as we,ab as mn,ac as Mn,ad as ue,ae as ge,ag as Bi,b as Xt,bb as v,bc as On,bd as Yn,be as Pt,cb as d,cc as Ft,cd as Qn,ce as he,db as W,dc as Pn,dd as Gn,de as pi,ea as g,eb as I,ec as Tn,ed as de,fa as h,fb as st,fc as Y,fd as Kn,fe as mi,g as tn,ga as cn,gb as Q,ge as gi,ha as it,hb as S,hc as kn,ib as E,ic as In,id as qn,ie as B,j as St,ja as ht,jb as J,jc as K,jd as It,je as fi,kb as b,kd as Ot,ke as fe,la as V,lb as ie,lc as dt,lf as vi,mb as P,mc as Dn,md as pe,me as _e,mf as Ci,nb as Ct,nc as Sn,nd as Zn,ne as ve,nf as Ne,oa as Et,ob as bt,oc as Kt,of as bi,p as ut,pb as yt,pc as Nt,pf as yi,qb as tt,qd as Xn,qe as Fe,qf as xi,qg as ji,ra as un,rb as oe,rd as Ut,rf as wi,sa as ne,sb as Vt,sc as En,sd as Z,sf as Ce,ta as dn,tb as gn,tf as Mi,ub as R,uc as zn,v as Jt,va as c,vb as U,vc as An,vd as Jn,w as te,wa as zt,wb as Se,wc as q,wd as ti,x as Gt,xb as hn,xc as Vn,yb as fn,yc as nt,za as pn,zb as G}from"./chunk-UQ26QW4E.js";import"./chunk-5XJ3NODC.js";function $i(n){if(n==="")return"";let i=0;for(let o=0;o{let r=new Date(n.year,n.month,1).getDay();return r>=i?r-i:se-(i-r)},To=({month:n,rowIndex:i,colIndex:r,firstDayOfWeek:t})=>{let e=i*se+r-Po(n,t)+1;return e>n.daysCount&&(e-=n.daysCount,n=n.append({month:1})),e<=0&&(n=n.append({month:-1}),e=n.daysCount+e),new ct(n.year,n.month,e)},ko=6,Wi=(()=>{let i=class i{constructor(){this.firstDayOfWeek=f(ue),this.currentMonth=null,this.currentSheet=[]}transform(t,e=!1){var a;if((a=this.currentMonth)!=null&&a.monthSame(t))return this.currentSheet;let o=[];for(let s=0;sA.yearA.year>X.year||A.month>X.month;if(!(T(y)&&!e)){if(N(y)&&!e)break;u.push(y)}}o.push(u)}return this.currentSheet=o.filter(s=>s.length),this.currentMonth=t,this.currentSheet}};i.\u0275fac=function(e){return new(e||i)},i.\u0275pipe=At({name:"tuiCalendarSheet",type:i,pure:!0});let n=i;return n})();var Yi=(()=>{let i=class i{constructor(){this.service=f(li)}transform(t){return this.service.format(t.valueOf())}};i.\u0275fac=function(e){return new(e||i)},i.\u0275pipe=At({name:"tuiFormatDate",type:i,pure:!0});let n=i;return n})();function Io(n){let i=n.length-1;return[n[i]||"",...n.slice(0,i)]}var Qi=(()=>{let i=class i{constructor(){this.firstDayOfWeekIndex=f(ue)}transform(t){return t.pipe(ut(Io),ut(e=>[...e.slice(this.firstDayOfWeekIndex),...e.slice(0,this.firstDayOfWeekIndex)]))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275pipe=At({name:"tuiOrderWeekDays",type:i,pure:!0});let n=i;return n})();var Do=["*"];function So(n,i){if(n&1){let r=M();L(0),p(1,"button",1),v("click",function(){g(r);let e=d();return h(e.onLeftClick())}),b(2),m(),p(3,"span",2),I(4),m(),p(5,"button",3),v("click",function(){g(r);let e=d();return h(e.onRightClick())}),b(6),m(),H()}if(n&2){let r=i.ngIf,t=d();c(),x("t-hidden",t.leftComputedDisabled),l("iconStart",t.icons.decrement)("tabIndex",t.focusable?0:-1),c(),P(" ",r[0]," "),c(3),x("t-hidden",t.rightComputedDisabled),l("iconStart",t.icons.increment)("tabIndex",t.focusable?0:-1),c(),P(" ",r[1]," ")}}var Gi=(()=>{let i=class i{constructor(){this.icons=f(Kn),this.spinTexts$=f(Qn),this.focusable=!0,this.disabled=!1,this.leftDisabled=!1,this.rightDisabled=!1,this.leftClick=new V,this.rightClick=new V}onLeftClick(){this.leftComputedDisabled||this.leftClick.emit()}onRightClick(){this.rightComputedDisabled||this.rightClick.emit()}get leftComputedDisabled(){return this.disabled||this.leftDisabled}get rightComputedDisabled(){return this.disabled||this.rightDisabled}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-spin-button"]],hostBindings:function(e,o){e&1&&v("mousedown.silent.prevent",function(){return 0})("keydown.arrowLeft.prevent",function(){return o.onLeftClick()})("keydown.arrowRight.prevent",function(){return o.onRightClick()})},inputs:{focusable:"focusable",disabled:"disabled",leftDisabled:"leftDisabled",rightDisabled:"rightDisabled"},outputs:{leftClick:"leftClick",rightClick:"rightClick"},ngContentSelectors:Do,decls:2,vars:3,consts:[[4,"ngIf"],["appearance","flat","automation-id","tui-spin-button__left","size","xs","tuiIconButton","","type","button",3,"click","iconStart","tabIndex"],[1,"t-content","t-calendar-title"],["appearance","flat","automation-id","tui-spin-button__right","size","xs","tuiIconButton","","type","button",3,"click","iconStart","tabIndex"]],template:function(e,o){e&1&&(W(),_(0,So,7,10,"ng-container",0),R(1,"async")),e&2&&l("ngIf",U(1,1,o.spinTexts$))},dependencies:[et,z,It],styles:["[_nghost-%COMP%]{display:flex;align-items:center;justify-content:space-between;font:var(--tui-font-text-l);text-align:center;font-weight:700}.t-hidden[_ngcontent-%COMP%]{visibility:hidden}.t-content[_ngcontent-%COMP%]{padding:0 .5rem}"],changeDetection:0});let n=i;return n})();var Eo=(n,i,r,t,e)=>[n,i,r,t,e];function zo(n,i){if(n&1&&w(0,"div",3),n&2){let r=i.$implicit;l("textContent",r)}}function Ao(n,i){if(n&1&&w(0,"div",11),n&2){let r=d().ngIf;D("background",(r==null?null:r[1])||"")}}function Vo(n,i){if(n&1&&(p(0,"div",10),w(1,"div",11),_(2,Ao,1,2,"div",12),m()),n&2){let r=i.ngIf;c(),D("background",r==null?null:r[0]),c(),l("ngIf",r.length>1)}}function Ro(n,i){if(n&1){let r=M();p(0,"div",8),R(1,"tuiMapper"),v("click",function(){g(r);let e=d().tuiLet,o=d(4);return h(o.onItemClick(e))})("tuiHoveredChange",function(e){g(r);let o=d().tuiLet,a=d(4);return h(a.onItemHovered(e&&o))}),b(2),_(3,Vo,3,3,"div",9),R(4,"tuiMapper"),m()}if(n&2){let r=d().tuiLet,t=d(4);x("t-cell_disabled",t.disabledItemHandler(r))("t-cell_today",t.itemIsToday(r))("t-cell_unavailable",t.itemIsUnavailable(r)),k("data-range",t.getItemRange(r))("data-type",Se(1,10,r,t.dayTypeHandler)),c(2),P(" ",r.day," "),c(),l("ngIf",fn(4,13,gn(19,Eo,r,t.toMarkers,t.itemIsToday(r),t.getItemRange(r),t.markerHandler)))}}function Lo(n,i){if(n&1&&(L(0),_(1,Ro,5,25,"div",7),H()),n&2){let r=i.tuiLet,t=d(4);c(),l("ngIf",r&&(!t.itemIsUnavailable(r)||t.showAdjacent))}}function Ho(n,i){if(n&1&&(L(0),_(1,Lo,2,1,"ng-container",2),H()),n&2){let r=i.$implicit,t=d().$implicit,e=d().tuiLet;c(),l("tuiLet",e[t]==null?null:e[t][r])}}function Fo(n,i){if(n&1&&(p(0,"div",5),_(1,Ho,2,1,"ng-container",6),m()),n&2){let r=i.$implicit,t=d().tuiLet;c(),l("tuiRepeatTimesOf",(t[r]==null?null:t[r].length)||0)}}function No(n,i){if(n&1&&(p(0,"div"),_(1,Fo,2,1,"div",4),m()),n&2){let r=i.tuiLet;c(),l("tuiRepeatTimesOf",r.length)}}function Bo(n,i){if(n&1&&(L(0),b(1),H()),n&2){let r=d();c(),P(" ",r.value.formattedYear," ")}}function jo(n,i){if(n&1){let r=M();p(0,"button",3),v("click",function(){g(r);let e=d();return h(e.onYearClick())}),b(1),m()}if(n&2){let r=d();c(),P(" ",r.value.formattedYear," ")}}function $o(n,i){if(n&1){let r=M();p(0,"div",4),v("click",function(){let e=g(r).tuiLet,o=d(3);return h(o.yearClick.emit(e))})("tuiHoveredChange",function(e){let o=g(r).tuiLet,a=d(3);return h(a.onItemHovered(e,o))}),b(1),m()}if(n&2){let r=i.tuiLet,t=d(3);x("t-cell_disabled",t.isDisabled(r))("t-cell_today",t.itemIsToday(r)),l("tuiScrollIntoView",t.scrollItemIntoView(r)),k("data-range",t.getItemRange(r)),c(),P(" ",r," ")}}function Uo(n,i){if(n&1&&(L(0),_(1,$o,2,7,"div",3),H()),n&2){let r=i.$implicit,t=d().$implicit,e=d();c(),l("tuiLet",e.getItem(t,r))}}function Wo(n,i){n&1&&(p(0,"div",1),_(1,Uo,2,1,"ng-container",2),m()),n&2&&(c(),l("tuiRepeatTimesOf",4))}function Yo(n,i){if(n&1){let r=M();p(0,"tui-scrollbar",2)(1,"tui-calendar-year",3),v("yearClick",function(e){g(r);let o=d();return h(o.onPickerYearClick(e))}),m()()}if(n&2){let r=d();c(),l("initialItem",r.month.year)("max",r.computedMax.year)("min",r.computedMin.year)("value",r.value)}}function Qo(n,i){if(n&1){let r=M();p(0,"tui-calendar-spin",4),v("valueChange",function(e){g(r);let o=d();return h(o.onPaginationValueChange(e))})("yearClick",function(){g(r);let e=d();return h(e.onPaginationYearClick())}),m(),p(1,"tui-calendar-sheet",5),R(2,"tuiMapper"),v("dayClick",function(e){g(r);let o=d();return h(o.onDayClick(e))})("hoveredItemChange",function(e){g(r);let o=d();return h(o.onHoveredItemChange(e))}),m()}if(n&2){let r=d();l("max",r.computedMaxViewedMonth)("min",r.computedMinViewedMonth)("value",r.month),c(),l("disabledItemHandler",hn(2,9,r.disabledItemHandler,r.disabledItemHandlerMapper,r.computedMin,r.computedMax))("hoveredItem",r.hoveredItem)("markerHandler",r.markerHandler)("month",r.month)("showAdjacent",r.showAdjacent)("value",r.value)}}var Go=(()=>{let i=class i{constructor(){this.today=ct.currentLocal(),this.unorderedWeekDays$=f(Gn),this.dayTypeHandler=f(Wn),this.month=Mt.currentLocal(),this.disabledItemHandler=wt,this.markerHandler=null,this.value=null,this.hoveredItem=null,this.showAdjacent=!0,this.hoveredItemChange=new V,this.dayClick=new V,this.toMarkers=(t,e,o,a)=>{if(e||["active","end","start"].includes(o||""))return null;let s=a==null?void 0:a(t);return s!=null&&s.length?s:null}}itemIsInterval(t){let{value:e,hoveredItem:o}=this;if(!(e instanceof kt))return!1;if(!e.isSingleDay)return e.from.daySameOrBefore(t)&&e.to.dayAfter(t);if(o===null)return!1;let a=kt.sort(e.from,o);return a.from.daySameOrBefore(t)&&a.to.dayAfter(t)}onItemHovered(t){this.updateHoveredItem(t||null)}getItemRange(t){let{value:e,hoveredItem:o}=this;if(e instanceof ct)return e.daySame(t)?"active":null;if(!e||!(e instanceof kt))return e!=null&&e.find(s=>s.daySame(t))?"active":null;let a=this.getRange(e,o);return e.isSingleDay&&a.isSingleDay&&e.from.daySame(t)?"active":a.from.daySame(t)?"start":a.to.daySame(t)?"end":a.from.dayBefore(t)&&a.to.dayAfter(t)?"middle":null}get isSingleDayRange(){return this.value instanceof kt&&this.value.isSingleDay}itemIsToday(t){return this.today.daySame(t)}itemIsUnavailable(t){return!this.month.monthSame(t)}onItemClick(t){this.dayClick.emit(t)}getRange(t,e){return t.isSingleDay?kt.sort(t.from,e??t.to):t}updateHoveredItem(t){Kt(this.hoveredItem,t,(e,o)=>e.daySame(o))||(this.hoveredItem=t,this.hoveredItemChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-calendar-sheet"]],hostVars:2,hostBindings:function(e,o){e&2&&x("_picking",o.isSingleDayRange)},inputs:{month:"month",disabledItemHandler:"disabledItemHandler",markerHandler:"markerHandler",value:"value",hoveredItem:"hoveredItem",showAdjacent:"showAdjacent"},outputs:{hoveredItemChange:"hoveredItemChange",dayClick:"dayClick"},decls:6,vars:9,consts:[[1,"t-row","t-row_weekday"],["class","t-cell",3,"textContent",4,"ngFor","ngForOf"],[4,"tuiLet"],[1,"t-cell",3,"textContent"],["automation-id","tui-calendar-sheet__row","class","t-row",4,"tuiRepeatTimes","tuiRepeatTimesOf"],["automation-id","tui-calendar-sheet__row",1,"t-row"],[4,"tuiRepeatTimes","tuiRepeatTimesOf"],["automation-id","tui-calendar-sheet__cell","class","t-cell",3,"t-cell_disabled","t-cell_today","t-cell_unavailable","click","tuiHoveredChange",4,"ngIf"],["automation-id","tui-calendar-sheet__cell",1,"t-cell",3,"click","tuiHoveredChange"],["class","t-dots",4,"ngIf"],[1,"t-dots"],[1,"t-dot"],["class","t-dot",3,"background",4,"ngIf"]],template:function(e,o){e&1&&(p(0,"div",0),_(1,zo,1,1,"div",1),R(2,"tuiOrderWeekDays"),R(3,"async"),m(),_(4,No,2,1,"div",2),R(5,"tuiCalendarSheet")),e&2&&(c(),l("ngForOf",U(3,4,U(2,2,o.unorderedWeekDays$))),c(3),l("tuiLet",Se(5,6,o.month,!0)))},dependencies:[lt,re,z,et,Wi,Le,qt,Re,Qi,He],styles:[`.t-row[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;font:var(--tui-font-text-m)}.t-row[_ngcontent-%COMP%]:last-child{justify-content:flex-start}.t-cell[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;line-height:2rem;isolation:isolate;cursor:pointer;overflow:hidden;border:.125rem solid transparent;box-sizing:border-box;-webkit-mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem));mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem))}.t-cell[_ngcontent-%COMP%]:first-child{border-inline-start-color:transparent!important}.t-cell[_ngcontent-%COMP%]:last-child{border-inline-end-color:transparent!important}.t-cell[_ngcontent-%COMP%]:before, .t-cell[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;bottom:0;right:0;content:"";z-index:-1;border-radius:var(--tui-radius-m)}.t-cell[_ngcontent-%COMP%]:after{-webkit-mask:url('data:image/svg+xml,') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat;mask:url('data:image/svg+xml,') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:first-child):before{border-start-start-radius:0;border-end-start-radius:0}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:last-child):before{border-start-end-radius:0;border-end-end-radius:0}.t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:not(:last-child):before{right:-1rem}.t-cell[data-range=start][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end][_ngcontent-%COMP%]:not(:first-child):before{left:-1rem}.t-cell[data-range=end][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active][_ngcontent-%COMP%]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);-webkit-mask:none;mask:none}.t-cell_disabled[_ngcontent-%COMP%]{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today[_ngcontent-%COMP%]{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell[_ngcontent-%COMP%]:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=end][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=active][_ngcontent-%COMP%]:hover:after{background:var(--tui-background-accent-1-hover)}}.t-cell[_ngcontent-%COMP%]{inline-size:2.25rem}[data-type=weekday][_ngcontent-%COMP%]{color:var(--tui-text-primary)}[data-type=weekend][_ngcontent-%COMP%]{color:var(--tui-text-negative)}.t-row[_ngcontent-%COMP%]{justify-content:flex-start}.t-row[_ngcontent-%COMP%]:first-child{justify-content:flex-end}.t-row_weekday[_ngcontent-%COMP%]{font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none}.t-cell_unavailable[_ngcontent-%COMP%]{opacity:var(--tui-disabled-opacity)}.t-dots[_ngcontent-%COMP%]{position:absolute;bottom:0;display:flex;justify-content:center;margin-top:-.5rem;padding-bottom:.25rem}.t-dot[_ngcontent-%COMP%]{display:inline-block;inline-size:.25rem;block-size:.25rem;border-radius:100%;margin:0 .0625rem}`],changeDetection:0});let n=i;return St([Nt],n.prototype,"getRange",null),n})(),Ko=(()=>{let i=class i{constructor(){this.value=Mt.currentLocal(),this.min=Bt,this.max=jt,this.valueChange=new V,this.yearClick=new V}onYearClick(){this.yearClick.next(this.value)}append(t){let e=this.value.append(t);this.min.monthSameOrAfter(e)?this.updateValue(this.min):this.updateValue(this.max.monthSameOrBefore(e)?this.max:e)}updateValue(t){this.value.monthSame(t)||(this.value=t,this.valueChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-calendar-spin"]],inputs:{value:"value",min:"min",max:"max"},outputs:{valueChange:"valueChange",yearClick:"yearClick"},decls:7,vars:10,consts:[["button",""],[3,"leftClick","rightClick","focusable","leftDisabled","rightDisabled"],[4,"ngIf","ngIfElse"],["id","year-btn","automation-id","tui-primitive-year-month-pagination__year-button","tabIndex","-1","tuiLink","","type","button",3,"click"]],template:function(e,o){if(e&1){let a=M();p(0,"tui-spin-button",1),v("leftClick",function(){return g(a),h(o.append({month:-1}))})("rightClick",function(){return g(a),h(o.append({month:1}))}),b(1),R(2,"tuiMonth"),R(3,"async"),_(4,Bo,2,1,"ng-container",2)(5,jo,2,1,"ng-template",null,0,G),m()}if(e&2){let a=J(6);l("focusable",!1)("leftDisabled",o.value.monthSameOrBefore(o.min))("rightDisabled",o.value.monthSameOrAfter(o.max)),c(),P(" ",U(3,8,U(2,6,o.value))," "),c(3),l("ngIf",o.min.year===o.max.year)("ngIfElse",a)}},dependencies:[et,z,Ot,ci,Gi],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0});let n=i;return n})(),Ki=100,qi=4,qo=(()=>{let i=class i{constructor(){this.hoveredItem=null,this.currentYear=Mt.currentLocal().year,this.value=null,this.initialItem=this.currentYear,this.min=Ee,this.max=ze,this.disabledItemHandler=wt,this.yearClick=new V}isDisabled(t){return this.max&&this.maxt||this.disabledItemHandler(t)}getItemRange(t){let{value:e,hoveredItem:o}=this;if(e instanceof Hn)return e.year===t?"active":null;if(Dn(e))return e===t?"active":null;if(!(e instanceof Ve))return e!=null&&e.find(C=>C.year===t)?"active":null;let a=this.isSingle?o:null,s=Math.min(e.from.year,a??e.to.year),u=Math.max(e.from.year,a??e.to.year);return s===u&&e.from.year===e.to.year&&s===t?"active":s===t?"start":u===t?"end":st?e:t}get calculatedMax(){let t=this.initialItem+Ki,e=this.max??ze;return e') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat;mask:url('data:image/svg+xml,') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:first-child):before{border-start-start-radius:0;border-end-start-radius:0}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:last-child):before{border-start-end-radius:0;border-end-end-radius:0}.t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:not(:last-child):before{right:-1rem}.t-cell[data-range=start][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end][_ngcontent-%COMP%]:not(:first-child):before{left:-1rem}.t-cell[data-range=end][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active][_ngcontent-%COMP%]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);-webkit-mask:none;mask:none}.t-cell_disabled[_ngcontent-%COMP%]{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today[_ngcontent-%COMP%]{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell[_ngcontent-%COMP%]:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=end][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=active][_ngcontent-%COMP%]:hover:after{background:var(--tui-background-accent-1-hover)}}[_nghost-%COMP%]{display:block;inline-size:16rem}.t-cell[_ngcontent-%COMP%]{inline-size:4rem;border-block-start-width:.5rem;border-block-end-width:.5rem}`],changeDetection:0});let n=i;return n})(),Wt=(()=>{let i=class i{constructor(){this.day=null,this.view="month",this.month=Mt.currentLocal(),this.disabledItemHandler=wt,this.min=Bt,this.max=jt,this.minViewedMonth=Bt,this.maxViewedMonth=jt,this.hoveredItem=null,this.showAdjacent=!0,this.markerHandler=null,this.dayClick=new V,this.monthChange=new V,this.hoveredItemChange=new V,this.disabledItemHandlerMapper=(t,e,o)=>a=>a.dayBefore(e)||a.dayAfter(o)||t(a)}set value(t){this.day=t,this.showAdjacent&&t instanceof ct&&t.daySameOrBefore(le)&&(this.month=t)}set initialView(t){this.view=t}get value(){return this.day}onPaginationValueChange(t){this.updateViewedMonth(t)}onDayClick(t){this.dayClick.emit(t)}onHoveredItemChange(t){this.updateHoveredDay(t)}get computedMin(){return this.min??Bt}get computedMax(){return this.max??jt}get computedMinViewedMonth(){let t=this.computedMin,e=this.minViewedMonth??Bt;return e.monthSameOrAfter(t)?e:t}get computedMaxViewedMonth(){let t=this.computedMax,e=this.maxViewedMonth??jt;return e.monthSameOrBefore(t)?e:t}get isInYearView(){return this.view==="year"}onPaginationYearClick(){this.view="year"}onPickerYearClick(t){this.view="month",this.updateViewedMonth(new Mt(t,this.month.month))}updateViewedMonth(t){this.month.monthSame(t)||(this.month=t,this.monthChange.emit(t))}updateHoveredDay(t){Kt(this.hoveredItem,t,(e,o)=>e.daySame(o))||(this.hoveredItem=t,this.hoveredItemChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-calendar"]],inputs:{month:"month",disabledItemHandler:"disabledItemHandler",min:"min",max:"max",minViewedMonth:"minViewedMonth",maxViewedMonth:"maxViewedMonth",hoveredItem:"hoveredItem",showAdjacent:"showAdjacent",markerHandler:"markerHandler",value:"value",initialView:"initialView"},outputs:{dayClick:"dayClick",monthChange:"monthChange",hoveredItemChange:"hoveredItemChange"},decls:3,vars:2,consts:[["calendar",""],["automation-id","tui-calendar__scrollbar","class","t-scrollbar",4,"ngIf","ngIfElse"],["automation-id","tui-calendar__scrollbar",1,"t-scrollbar"],["automation-id","tui-calendar__year",3,"yearClick","initialItem","max","min","value"],["automation-id","tui-calendar__pagination",1,"t-pagination",3,"valueChange","yearClick","max","min","value"],["automation-id","tui-calendar__calendar",3,"dayClick","hoveredItemChange","disabledItemHandler","hoveredItem","markerHandler","month","showAdjacent","value"]],template:function(e,o){if(e&1&&_(0,Yo,2,4,"tui-scrollbar",1)(1,Qo,3,14,"ng-template",null,0,G),e&2){let a=J(2);l("ngIf",o.isInYearView)("ngIfElse",a)}},dependencies:[z,Go,Ko,qo,Re,Dt],styles:["[_nghost-%COMP%]{display:block;min-block-size:18.25rem;inline-size:15.75rem;padding:1rem 1.125rem;box-sizing:content-box}.t-scrollbar[_ngcontent-%COMP%]{block-size:18.25rem;inline-size:16.875rem}.t-pagination[_ngcontent-%COMP%]{margin-bottom:1rem}"],changeDetection:0});let n=i;return n})();var Xo=["*"];function Jo(n,i){if(n&1&&(L(0),b(1),H()),n&2){let r=i.polymorpheusOutlet;c(),P(" ",r," ")}}function tr(n,i){if(n&1&&(p(0,"div",6),_(1,Jo,2,1,"ng-container",7),m()),n&2){let r=d(2);x("t-text_horizontal",r.isHorizontal),c(),l("polymorpheusOutlet",r.textContent)}}function er(n,i){if(n&1&&(p(0,"div",2),cn(),p(1,"svg",3),w(2,"circle",4),m(),_(3,tr,2,3,"div",5),m()),n&2){let r=d();x("t-loader_horizontal",r.isHorizontal)("t-loader_inherit-color",r.inheritColor),c(3),l("ngIf",r.textContent)}}var nr={size:"m",inheritColor:!1,overlay:!1},ir=K(nr);var Qt=(()=>{let i=class i{constructor(){this.isIOS=f(ni),this.options=f(ir),this.isApple=Ui(q())||this.isIOS,this.size=this.options.size,this.inheritColor=this.options.inheritColor,this.overlay=this.options.overlay,this.loading=!0}get isHorizontal(){return!pe(this.size)}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-loader"]],hostVars:3,hostBindings:function(e,o){e&2&&(k("data-size",o.size),x("_loading",o.loading))},inputs:{size:"size",inheritColor:"inheritColor",overlay:"overlay",textContent:"textContent",loading:[0,"showLoader","loading"]},ngContentSelectors:Xo,decls:3,vars:7,consts:[[1,"t-content",3,"disabled"],["class","t-loader",3,"t-loader_horizontal","t-loader_inherit-color",4,"ngIf"],[1,"t-loader"],["automation-id","tui-loader__loader","focusable","false","height","100%","width","100%",1,"t-icon"],["cx","50%","cy","50%",1,"t-circle"],["automation-id","tui-loader__text","class","t-text",3,"t-text_horizontal",4,"ngIf"],["automation-id","tui-loader__text",1,"t-text"],[4,"polymorpheusOutlet"]],template:function(e,o){e&1&&(W(),p(0,"fieldset",0),I(1),m(),_(2,er,4,5,"div",1)),e&2&&(x("t-content_has-overlay",o.overlay&&o.loading)("t-content_loading",o.loading),l("disabled",o.loading&&!o.isApple),k("inert",o.loading||null),c(2),l("ngIf",o.loading))},dependencies:[z,Z],styles:["[_nghost-%COMP%]{position:relative;display:flex;min-inline-size:1.5rem;--tui-thickness: calc(var(--t-diameter) / 12)}._loading[_nghost-%COMP%]{overflow:hidden}[data-size=xs][_nghost-%COMP%]{--t-diameter: .75em}[data-size=s][_nghost-%COMP%]{--t-diameter: 1em}[data-size=m][_nghost-%COMP%]{--t-diameter: 1.5em}[data-size=l][_nghost-%COMP%]{--t-diameter: 2.5em}[data-size=xl][_nghost-%COMP%]{--t-diameter: 3.5em}[data-size=xxl][_nghost-%COMP%]{--t-diameter: 5em}.t-content[_ngcontent-%COMP%]{z-index:0;min-inline-size:100%;block-size:100%;padding:0;margin:0;border:none}.t-content_has-overlay[_ngcontent-%COMP%]{opacity:.3}.t-content_loading[_ngcontent-%COMP%]{pointer-events:none}.t-loader[_ngcontent-%COMP%]{position:relative;left:-100%;display:flex;flex-direction:column;align-items:center;justify-content:center;min-inline-size:100%;min-block-size:var(--t-diameter);flex-shrink:0;align-self:center;color:var(--tui-text-primary);stroke:var(--tui-background-accent-1);animation:tuiFadeIn var(--tui-duration);font-size:1rem}.t-loader.t-loader_horizontal[_ngcontent-%COMP%]{flex-direction:row}.t-loader.t-loader_inherit-color[_ngcontent-%COMP%]{color:inherit;stroke:currentColor}.t-text[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:var(--tui-font-text-s);margin-top:1rem;color:inherit;max-inline-size:100%;text-align:center;stroke-width:0}.t-text_horizontal[_ngcontent-%COMP%]{margin:0 0 0 1rem}@keyframes _ngcontent-%COMP%_tuiLoaderRotate{0%{transform:rotate(-90deg)}50%{transform:rotate(-90deg) rotate(1turn)}to{transform:rotate(-90deg) rotate(3turn)}}.t-icon[_ngcontent-%COMP%]{display:block;inline-size:var(--t-diameter);block-size:var(--t-diameter);margin:.25rem calc(var(--t-diameter) / -2);border-radius:100%;overflow:hidden;animation:_ngcontent-%COMP%_tuiLoaderRotate 4s linear infinite}@supports (-webkit-hyphens: none){.t-icon[_ngcontent-%COMP%]{overflow:visible}}@keyframes _ngcontent-%COMP%_tuiLoaderDashOffset{0%{stroke-dashoffset:calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness)))}50%{stroke-dashoffset:calc(.05 * calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness))))}to{stroke-dashoffset:calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness)))}}.t-circle[_ngcontent-%COMP%]{r:calc(var(--t-diameter) / 2 - var(--tui-thickness));stroke-dasharray:calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness)));fill:none;stroke:inherit;stroke-width:max(var(--tui-thickness),1.5px);animation:_ngcontent-%COMP%_tuiLoaderDashOffset 4s linear infinite}"],changeDetection:0});let n=i;return n})();var rr=["wrapper"],ar=["*"];function sr(n,i){if(n&1&&(p(0,"tui-loader",4),Tt(1,5),m()),n&2){let r=d(2);l("overlay",!0)("showLoader",r.loading),c(),l("ngTemplateOutlet",r.content)}}function lr(n,i){if(n&1&&(L(0),I(1),_(2,sr,2,3,"tui-loader",3),H()),n&2){let r=d();c(2),l("ngIf",r.async)("ngIfElse",r.content)}}var $e=(()=>{let i=class i{};i.\u0275fac=function(e){return new(e||i)},i.\u0275dir=j({type:i,selectors:[["","tuiExpandContent",""]]});let n=i;return n})(),F={Idle:0,Loading:1,Prepared:2,Animated:3},cr=48;var Zi=(()=>{let i=class i{constructor(){this.cdr=f(xt),this.destroyRef=f(ht),this.state=F.Idle,this.content=null,this.expanded=null,this.async=!1}set expandedSetter(t){if(this.expanded===null){this.expanded=t;return}if(this.state!==F.Idle){this.expanded=t,this.state=F.Animated;return}this.expanded=t,this.retrigger(this.async&&t?F.Loading:F.Animated)}get contentVisible(){return this.expanded||this.state!==F.Idle}get overflow(){return this.state!==F.Idle}get loading(){return!!this.expanded&&this.async&&this.state===F.Loading}get height(){let{expanded:t,state:e,contentWrapper:o}=this;return t&&e===F.Prepared||!t&&e===F.Animated?0:o&&(!t&&e===F.Prepared||t&&e===F.Animated)?o.nativeElement.offsetHeight:o&&t&&e===F.Loading?Math.max(o.nativeElement.offsetHeight,cr):null}onTransitionEnd({propertyName:t,pseudoElement:e}){t==="opacity"&&!e&&this.state===F.Animated&&(this.state=F.Idle)}onExpandLoaded(t){t.stopPropagation(),this.state===F.Loading&&this.retrigger(F.Animated)}retrigger(t){this.state=F.Prepared,Jt(0).pipe(Y(this.destroyRef)).subscribe(()=>{this.state===F.Prepared&&(this.state=t,this.cdr.markForCheck())})}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-expand"]],contentQueries:function(e,o,a){if(e&1&&st(a,$e,5,zt),e&2){let s;S(s=E())&&(o.content=s.first)}},viewQuery:function(e,o){if(e&1&&Q(rr,5),e&2){let a;S(a=E())&&(o.contentWrapper=a.first)}},hostVars:9,hostBindings:function(e,o){e&1&&v("transitionend.self",function(s){return o.onTransitionEnd(s)})("tui-expand-loaded",function(s){return o.onExpandLoaded(s)}),e&2&&(k("aria-expanded",o.expanded),D("height",o.height,"px"),x("_loading",o.loading)("_overflow",o.overflow)("_expanded",o.expanded))},inputs:{async:"async",expandedSetter:[0,"expanded","expandedSetter"]},ngContentSelectors:ar,decls:3,vars:3,consts:[["wrapper",""],[1,"t-wrapper"],[4,"ngIf"],["size","l",3,"overlay","showLoader",4,"ngIf","ngIfElse"],["size","l",3,"overlay","showLoader"],[3,"ngTemplateOutlet"]],template:function(e,o){e&1&&(W(),p(0,"div",1,0),_(2,lr,3,2,"ng-container",2),m()),e&2&&(l("@tuiParentAnimation",void 0)("@.disabled",o.overflow),c(2),l("ngIf",o.contentVisible))},dependencies:[z,_n,Qt],styles:['[_nghost-%COMP%]{transition-property:opacity,height,visibility;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:block;opacity:0;transition-delay:1ms}._overflow[_nghost-%COMP%]{overflow:hidden}._expanded[_nghost-%COMP%]{opacity:1}._loading[_nghost-%COMP%]{opacity:.99}.t-wrapper[_ngcontent-%COMP%]:before, .t-wrapper[_ngcontent-%COMP%]:after{content:"";display:table}'],data:{animation:[vn]},changeDetection:0});let n=i;return n})();var dr=["*",[["","tuiAccordionItemContent","",5,"ng-template"]]],pr=["*","[tuiAccordionItemContent]:not(ng-template)"];function mr(n,i){if(n&1&&(L(0),w(1,"tui-icon",7),H()),n&2){let r=d();c(),l("tuiChevron",r.open)}}function gr(n,i){if(n&1&&(L(0),b(1),H()),n&2){let r=i.polymorpheusOutlet;c(),P(" ",r," ")}}function hr(n,i){if(n&1&&(p(0,"div",9),_(1,gr,2,1,"ng-container",10),m()),n&2){let r=d(2);c(),l("polymorpheusOutlet",r.lazyContent)}}function fr(n,i){if(n&1&&_(0,hr,2,1,"div",8),n&2){let r=d();l("ngIf",r.lazyContent)}}function _r(n,i){n&1&&(p(0,"div",11),I(1,1),m())}var Ue=(()=>{let i=class i extends Ut{};i.\u0275fac=(()=>{let t;return function(o){return(t||(t=it(i)))(o||i)}})(),i.\u0275dir=j({type:i,selectors:[["ng-template","tuiAccordionItemContent",""]],features:[ot]});let n=i;return n})(),vr=(()=>{let i=class i{};i.\u0275fac=function(e){return new(e||i)},i.\u0275dir=j({type:i,selectors:[["","tuiAccordionItemContent","",5,"ng-template"]]});let n=i;return n})(),We=(()=>{let i=class i{constructor(){this.cdr=f(xt),this.noPadding=!1,this.showArrow=!0,this.borders="all",this.size="m",this.disabled=!1,this.disableHover=!1,this.open=!1,this.async=!1,this.openChange=new V}close(){this.updateOpen(!1),this.cdr.markForCheck()}onRowToggle(){this.disabled||this.updateOpen(!this.open)}onItemKeyDownEsc(t){this.open&&(t.stopPropagation(),this.updateOpen(!1))}updateOpen(t){this.open!==t&&(this.open=t,this.openChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-accordion-item"]],contentQueries:function(e,o,a){if(e&1&&(st(a,vr,5),st(a,Ue,5)),e&2){let s;S(s=E())&&(o.eagerContent=s.first),S(s=E())&&(o.lazyContent=s.first)}},hostVars:8,hostBindings:function(e,o){e&2&&(k("data-borders",o.borders)("data-size",o.size),x("_no-padding",o.noPadding)("_has-arrow",o.showArrow)("_disabled",o.disabled))},inputs:{noPadding:"noPadding",showArrow:"showArrow",borders:"borders",size:"size",disabled:"disabled",disableHover:"disableHover",open:"open",async:"async"},outputs:{openChange:"openChange"},ngContentSelectors:pr,decls:8,vars:9,consts:[["automation-id","tui-accordion__item-wrapper",1,"t-wrapper"],["automation-id","tui-accordion__item-header","type","button",1,"t-header",3,"click","keydown.esc","disabled"],["automation-id","tui-accordion__item-title",1,"t-title"],[4,"ngIf"],[3,"async","expanded"],["tuiExpandContent",""],["class","t-content",4,"ngIf"],[1,"t-icon",3,"tuiChevron"],["automation-id","tui-accordion__item-content","class","t-content",4,"ngIf"],["automation-id","tui-accordion__item-content",1,"t-content"],[4,"polymorpheusOutlet"],[1,"t-content"]],template:function(e,o){e&1&&(W(dr),p(0,"div",0)(1,"button",1),v("click",function(){return o.onRowToggle()})("keydown.esc",function(s){return o.onItemKeyDownEsc(s)}),p(2,"span",2),I(3),m(),_(4,mr,2,1,"ng-container",3),m(),p(5,"tui-expand",4),_(6,fr,1,1,"ng-template",5)(7,_r,2,0,"div",6),m()()),e&2&&(c(),x("t-header_hoverable",!o.disableHover)("t-header_open",o.open),l("disabled",o.disabled),c(3),l("ngIf",o.showArrow),c(),l("async",o.async)("expanded",o.open),c(2),l("ngIf",o.eagerContent))},dependencies:[z,Z,vi,Zi,$e,B],styles:['[_nghost-%COMP%]{position:relative;display:block;overflow:hidden;border-radius:var(--tui-radius-l)}[data-borders=top-bottom][_nghost-%COMP%]{border-radius:0!important} tui-accordion{inline-size:100%}.t-wrapper[_ngcontent-%COMP%]{position:relative;border-radius:inherit}.t-wrapper[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";box-sizing:border-box;border-radius:inherit;border:1px solid var(--tui-border-normal);pointer-events:none}[_nghost-%COMP%]:not([data-borders]) .t-wrapper[_ngcontent-%COMP%]:after{border-width:0}[data-borders=all][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-width:1px}[data-borders=top-bottom][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-inline-start-width:0;border-inline-end-width:0}[data-borders=top][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-inline-start-width:0;border-inline-end-width:0;border-block-end-width:0}[data-borders=bottom][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-inline-start-width:0;border-inline-end-width:0;border-block-start-width:0}.t-header[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:flex;inline-size:100%;font:var(--tui-font-text-l);align-items:center;box-sizing:border-box;border-block-end:1px solid var(--tui-border-normal);min-block-size:var(--tui-height-l);padding:.75rem 1.25rem;color:var(--tui-text-primary);cursor:pointer;text-align:start;outline:none}.t-header[_ngcontent-%COMP%]:focus-visible{box-shadow:inset 0 0 0 2px var(--tui-border-focus)}[_nghost-%COMP%]:not([data-borders]) .t-header[_ngcontent-%COMP%]{border-block-end-width:0}._has-arrow[_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{padding-right:.75rem}[tuiTheme="dark"][_nghost-%COMP%] .t-header_open[_ngcontent-%COMP%], [tuiTheme="dark"] [_nghost-%COMP%] .t-header_open[_ngcontent-%COMP%]{background:var(--tui-background-neutral-1)}[data-size=s][_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{font:var(--tui-font-text-m);min-block-size:var(--tui-height-m);padding:.625rem .75rem .625rem 1rem}._no-padding[_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{padding-left:0;padding-right:0}._disabled[_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{cursor:default}.t-wrapper[_ngcontent-%COMP%]:hover > .t-header_hoverable[_ngcontent-%COMP%]{background:var(--tui-background-base-alt)}.t-title[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:0;flex-grow:1}._has-arrow[_nghost-%COMP%] .t-title[_ngcontent-%COMP%]{margin-right:.5rem}.t-icon[_ngcontent-%COMP%]{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;margin-left:auto;border-width:.25rem;color:var(--tui-text-tertiary)}[_nghost-%COMP%]:hover .t-icon[_ngcontent-%COMP%]{color:var(--tui-text-secondary)}.t-content[_ngcontent-%COMP%]{font:var(--tui-font-text-m);padding:1.25rem;overflow-wrap:break-word}[data-size=s][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{font:var(--tui-font-text-s);padding:1rem}'],changeDetection:0});let n=i;return n})(),Xi=(()=>{let i=class i{constructor(){this.destroyRef=f(ht),this.accordionItems=ae,this.closeOthers=!0;let t=f(ve);t.orientation="vertical",t.collapsed=!0}ngAfterContentInit(){let{accordionItems:t}=this,e=Bn(t),o=e.pipe(nn(),ut(([s,u])=>u.find(C=>!s.includes(C)&&C.open)),Gt(Sn));te(e.pipe(on(s=>te(...s.map(u=>u.openChange.pipe(Gt(Xt),ut(()=>u)))))),o).pipe(Gt(()=>this.closeOthers),Y(this.destroyRef)).subscribe(s=>{t.forEach(u=>{s!==u&&u.close()})})}};i.\u0275fac=function(e){return new(e||i)},i.\u0275dir=j({type:i,selectors:[["tui-accordion"]],contentQueries:function(e,o,a){if(e&1&&st(a,We,4),e&2){let s;S(s=E())&&(o.accordionItems=s)}},inputs:{closeOthers:"closeOthers"},features:[_t([{directive:ve,inputs:["rounded","rounded"]}])]});let n=i;return n})();var br=["type","checkbox","tuiCheckbox",""],yr={size:"m",appearance:n=>n.checked||n.indeterminate?"primary":"outline-grayscale",icons:{checked:"@tui.check",indeterminate:"@tui.minus"}},xr=K(yr);var Ji=(()=>{let i=class i{constructor(){this.appearance=f(nt),this.options=f(xr),this.resolver=de(),this.destroyRef=f(ht),this.el=q(),this.size=this.options.size,this.control=f(Lt,{optional:!0,self:!0})}ngOnInit(){var t;(t=this.control)!=null&&t.valueChanges&&Fn(this.control).pipe(Y(this.destroyRef)).subscribe(e=>{let o=this.control instanceof rt&&e===null?this.control.model:e;this.el.indeterminate=o===null})}ngDoCheck(){this.appearance.tuiAppearance=dt(this.options.appearance)?this.options.appearance:this.options.appearance(this.el)}getIcon(t){let e=this.options.icons[t],o=dt(e)?e:e(this.size);return o&&`url(${this.resolver(o)})`}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["input","type","checkbox","tuiCheckbox",""]],hostVars:8,hostBindings:function(e,o){e&2&&(vt("disabled",!o.control||o.control.disabled),k("data-size",o.size),D("--t-checked-icon",o.getIcon("checked"))("--t-indeterminate-icon",o.getIcon("indeterminate")),x("_readonly",!o.control))},inputs:{size:"size"},features:[_t([{directive:nt,inputs:["tuiAppearanceState","tuiAppearanceState","tuiAppearanceFocus","tuiAppearanceFocus"]},_e])],attrs:br,decls:0,vars:0,template:function(e,o){},styles:[`[tuiCheckbox]{--t-size: 1.5rem;--t-radius: var(--tui-radius-s);inline-size:var(--t-size);block-size:var(--t-size);border-radius:var(--t-radius);cursor:pointer;margin:0;flex-shrink:0}[tuiCheckbox]:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";background:currentColor;-webkit-mask:url('data:image/svg+xml,') center / 100%;mask:url('data:image/svg+xml,') center / 100%;transform:scale(0);transition:transform var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out}[tuiCheckbox]:disabled._readonly{opacity:1}[tuiCheckbox]:checked:before,[tuiCheckbox]:indeterminate:before{-webkit-mask-image:var(--t-checked-icon);mask-image:var(--t-checked-icon);transform:scale(1);transition:transform var(--tui-duration) ease-in-out,-webkit-mask 0s ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s ease-in-out,-webkit-mask 0s ease-in-out}[tuiCheckbox]:indeterminate:before{-webkit-mask-image:var(--t-indeterminate-icon);mask-image:var(--t-indeterminate-icon)}[tuiCheckbox][data-size=s]{--t-size: 1rem;--t-radius: var(--tui-radius-xs)} +import{a as Re,b as ai,d as hi,f as _i}from"./chunk-UU7DNZ47.js";import{$a as vt,$b as rt,$c as Wn,$d as me,$f as Ni,B as en,Bc as ae,Ca as O,Cb as xt,Cc as wt,D as Te,Da as ft,Dc as Rn,Ea as j,Ec as Ln,Ed as ei,Fa as At,Fc as se,Fd as ni,Ga as ot,Gc as Ee,Gf as be,Ha as _t,Hb as re,Hc as ze,Hd as ii,I as nn,Ia as _,Ib as z,Ic as Ae,Id as oi,If as Be,Jb as _n,Jc as Hn,Jd as ri,Jf as Oi,Kb as et,Kc as Mt,Kf as ye,Lb as lt,Lc as ct,Lf as Pi,M as on,Mc as Ve,Md as Dt,Mf as Ti,Na as k,Nc as kt,Nd as si,Nf as ki,Oa as l,Oc as Bt,Of as Ii,Pa as D,Pc as jt,Pd as Le,Pf as Di,Q as ee,Qa as x,Qb as vn,Qc as le,Qd as qt,Qf as Si,R as rn,Ra as ke,Rc as Fn,Rd as He,Rf as Ei,S as gt,Sa as Ie,Sb as Cn,Sf as xe,Ta as De,Tb as bn,Tc as Nn,Td as li,Tf as zi,Ua as p,Ub as yn,Uc as Bn,Ud as ci,Uf as Ai,Va as m,Vc as ce,Vd as ui,Vf as Vi,Wa as w,Wb as xn,Wd as di,Wf as Ri,X as f,Xa as L,Xb as wn,Xc as jn,Xf as Li,Y as an,Ya as H,Yb as Rt,Yc as $t,Yf as Hi,Z as sn,Za as Tt,Zb as Lt,Zc as $n,Zf as Fi,_ as ln,_a as M,_b as Ht,_c as Un,_f as we,ab as mn,ac as Mn,ad as ue,ae as ge,ag as Bi,b as Xt,bb as v,bc as On,bd as Yn,be as Pt,cb as d,cc as Ft,cd as Qn,ce as he,db as W,dc as Pn,dd as Gn,de as pi,ea as g,eb as I,ec as Tn,ed as de,fa as h,fb as st,fc as Y,fd as Kn,fe as mi,g as tn,ga as cn,gb as Q,ge as gi,ha as it,hb as S,hc as kn,ib as E,ic as In,id as qn,ie as B,j as St,ja as ht,jb as J,jc as K,jd as It,je as fi,kb as b,kd as Ot,ke as fe,la as V,lb as ie,lc as dt,lf as vi,mb as P,mc as Dn,md as pe,me as _e,mf as Ci,nb as Ct,nc as Sn,nd as Zn,ne as ve,nf as Ne,oa as Et,ob as bt,oc as Kt,of as bi,p as ut,pb as yt,pc as Nt,pf as yi,qb as tt,qd as Xn,qe as Fe,qf as xi,qg as ji,ra as un,rb as oe,rd as Ut,rf as wi,sa as ne,sb as Vt,sc as En,sd as Z,sf as Ce,ta as dn,tb as gn,tf as Mi,ub as R,uc as zn,v as Jt,va as c,vb as U,vc as An,vd as Jn,w as te,wa as zt,wb as Se,wc as q,wd as ti,x as Gt,xb as hn,xc as Vn,yb as fn,yc as nt,za as pn,zb as G}from"./chunk-7PCLFWKE.js";import"./chunk-7OFBBPR7.js";function $i(n){if(n==="")return"";let i=0;for(let o=0;o{let r=new Date(n.year,n.month,1).getDay();return r>=i?r-i:se-(i-r)},To=({month:n,rowIndex:i,colIndex:r,firstDayOfWeek:t})=>{let e=i*se+r-Po(n,t)+1;return e>n.daysCount&&(e-=n.daysCount,n=n.append({month:1})),e<=0&&(n=n.append({month:-1}),e=n.daysCount+e),new ct(n.year,n.month,e)},ko=6,Wi=(()=>{let i=class i{constructor(){this.firstDayOfWeek=f(ue),this.currentMonth=null,this.currentSheet=[]}transform(t,e=!1){var a;if((a=this.currentMonth)!=null&&a.monthSame(t))return this.currentSheet;let o=[];for(let s=0;sA.yearA.year>X.year||A.month>X.month;if(!(T(y)&&!e)){if(N(y)&&!e)break;u.push(y)}}o.push(u)}return this.currentSheet=o.filter(s=>s.length),this.currentMonth=t,this.currentSheet}};i.\u0275fac=function(e){return new(e||i)},i.\u0275pipe=At({name:"tuiCalendarSheet",type:i,pure:!0});let n=i;return n})();var Yi=(()=>{let i=class i{constructor(){this.service=f(li)}transform(t){return this.service.format(t.valueOf())}};i.\u0275fac=function(e){return new(e||i)},i.\u0275pipe=At({name:"tuiFormatDate",type:i,pure:!0});let n=i;return n})();function Io(n){let i=n.length-1;return[n[i]||"",...n.slice(0,i)]}var Qi=(()=>{let i=class i{constructor(){this.firstDayOfWeekIndex=f(ue)}transform(t){return t.pipe(ut(Io),ut(e=>[...e.slice(this.firstDayOfWeekIndex),...e.slice(0,this.firstDayOfWeekIndex)]))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275pipe=At({name:"tuiOrderWeekDays",type:i,pure:!0});let n=i;return n})();var Do=["*"];function So(n,i){if(n&1){let r=M();L(0),p(1,"button",1),v("click",function(){g(r);let e=d();return h(e.onLeftClick())}),b(2),m(),p(3,"span",2),I(4),m(),p(5,"button",3),v("click",function(){g(r);let e=d();return h(e.onRightClick())}),b(6),m(),H()}if(n&2){let r=i.ngIf,t=d();c(),x("t-hidden",t.leftComputedDisabled),l("iconStart",t.icons.decrement)("tabIndex",t.focusable?0:-1),c(),P(" ",r[0]," "),c(3),x("t-hidden",t.rightComputedDisabled),l("iconStart",t.icons.increment)("tabIndex",t.focusable?0:-1),c(),P(" ",r[1]," ")}}var Gi=(()=>{let i=class i{constructor(){this.icons=f(Kn),this.spinTexts$=f(Qn),this.focusable=!0,this.disabled=!1,this.leftDisabled=!1,this.rightDisabled=!1,this.leftClick=new V,this.rightClick=new V}onLeftClick(){this.leftComputedDisabled||this.leftClick.emit()}onRightClick(){this.rightComputedDisabled||this.rightClick.emit()}get leftComputedDisabled(){return this.disabled||this.leftDisabled}get rightComputedDisabled(){return this.disabled||this.rightDisabled}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-spin-button"]],hostBindings:function(e,o){e&1&&v("mousedown.silent.prevent",function(){return 0})("keydown.arrowLeft.prevent",function(){return o.onLeftClick()})("keydown.arrowRight.prevent",function(){return o.onRightClick()})},inputs:{focusable:"focusable",disabled:"disabled",leftDisabled:"leftDisabled",rightDisabled:"rightDisabled"},outputs:{leftClick:"leftClick",rightClick:"rightClick"},ngContentSelectors:Do,decls:2,vars:3,consts:[[4,"ngIf"],["appearance","flat","automation-id","tui-spin-button__left","size","xs","tuiIconButton","","type","button",3,"click","iconStart","tabIndex"],[1,"t-content","t-calendar-title"],["appearance","flat","automation-id","tui-spin-button__right","size","xs","tuiIconButton","","type","button",3,"click","iconStart","tabIndex"]],template:function(e,o){e&1&&(W(),_(0,So,7,10,"ng-container",0),R(1,"async")),e&2&&l("ngIf",U(1,1,o.spinTexts$))},dependencies:[et,z,It],styles:["[_nghost-%COMP%]{display:flex;align-items:center;justify-content:space-between;font:var(--tui-font-text-l);text-align:center;font-weight:700}.t-hidden[_ngcontent-%COMP%]{visibility:hidden}.t-content[_ngcontent-%COMP%]{padding:0 .5rem}"],changeDetection:0});let n=i;return n})();var Eo=(n,i,r,t,e)=>[n,i,r,t,e];function zo(n,i){if(n&1&&w(0,"div",3),n&2){let r=i.$implicit;l("textContent",r)}}function Ao(n,i){if(n&1&&w(0,"div",11),n&2){let r=d().ngIf;D("background",(r==null?null:r[1])||"")}}function Vo(n,i){if(n&1&&(p(0,"div",10),w(1,"div",11),_(2,Ao,1,2,"div",12),m()),n&2){let r=i.ngIf;c(),D("background",r==null?null:r[0]),c(),l("ngIf",r.length>1)}}function Ro(n,i){if(n&1){let r=M();p(0,"div",8),R(1,"tuiMapper"),v("click",function(){g(r);let e=d().tuiLet,o=d(4);return h(o.onItemClick(e))})("tuiHoveredChange",function(e){g(r);let o=d().tuiLet,a=d(4);return h(a.onItemHovered(e&&o))}),b(2),_(3,Vo,3,3,"div",9),R(4,"tuiMapper"),m()}if(n&2){let r=d().tuiLet,t=d(4);x("t-cell_disabled",t.disabledItemHandler(r))("t-cell_today",t.itemIsToday(r))("t-cell_unavailable",t.itemIsUnavailable(r)),k("data-range",t.getItemRange(r))("data-type",Se(1,10,r,t.dayTypeHandler)),c(2),P(" ",r.day," "),c(),l("ngIf",fn(4,13,gn(19,Eo,r,t.toMarkers,t.itemIsToday(r),t.getItemRange(r),t.markerHandler)))}}function Lo(n,i){if(n&1&&(L(0),_(1,Ro,5,25,"div",7),H()),n&2){let r=i.tuiLet,t=d(4);c(),l("ngIf",r&&(!t.itemIsUnavailable(r)||t.showAdjacent))}}function Ho(n,i){if(n&1&&(L(0),_(1,Lo,2,1,"ng-container",2),H()),n&2){let r=i.$implicit,t=d().$implicit,e=d().tuiLet;c(),l("tuiLet",e[t]==null?null:e[t][r])}}function Fo(n,i){if(n&1&&(p(0,"div",5),_(1,Ho,2,1,"ng-container",6),m()),n&2){let r=i.$implicit,t=d().tuiLet;c(),l("tuiRepeatTimesOf",(t[r]==null?null:t[r].length)||0)}}function No(n,i){if(n&1&&(p(0,"div"),_(1,Fo,2,1,"div",4),m()),n&2){let r=i.tuiLet;c(),l("tuiRepeatTimesOf",r.length)}}function Bo(n,i){if(n&1&&(L(0),b(1),H()),n&2){let r=d();c(),P(" ",r.value.formattedYear," ")}}function jo(n,i){if(n&1){let r=M();p(0,"button",3),v("click",function(){g(r);let e=d();return h(e.onYearClick())}),b(1),m()}if(n&2){let r=d();c(),P(" ",r.value.formattedYear," ")}}function $o(n,i){if(n&1){let r=M();p(0,"div",4),v("click",function(){let e=g(r).tuiLet,o=d(3);return h(o.yearClick.emit(e))})("tuiHoveredChange",function(e){let o=g(r).tuiLet,a=d(3);return h(a.onItemHovered(e,o))}),b(1),m()}if(n&2){let r=i.tuiLet,t=d(3);x("t-cell_disabled",t.isDisabled(r))("t-cell_today",t.itemIsToday(r)),l("tuiScrollIntoView",t.scrollItemIntoView(r)),k("data-range",t.getItemRange(r)),c(),P(" ",r," ")}}function Uo(n,i){if(n&1&&(L(0),_(1,$o,2,7,"div",3),H()),n&2){let r=i.$implicit,t=d().$implicit,e=d();c(),l("tuiLet",e.getItem(t,r))}}function Wo(n,i){n&1&&(p(0,"div",1),_(1,Uo,2,1,"ng-container",2),m()),n&2&&(c(),l("tuiRepeatTimesOf",4))}function Yo(n,i){if(n&1){let r=M();p(0,"tui-scrollbar",2)(1,"tui-calendar-year",3),v("yearClick",function(e){g(r);let o=d();return h(o.onPickerYearClick(e))}),m()()}if(n&2){let r=d();c(),l("initialItem",r.month.year)("max",r.computedMax.year)("min",r.computedMin.year)("value",r.value)}}function Qo(n,i){if(n&1){let r=M();p(0,"tui-calendar-spin",4),v("valueChange",function(e){g(r);let o=d();return h(o.onPaginationValueChange(e))})("yearClick",function(){g(r);let e=d();return h(e.onPaginationYearClick())}),m(),p(1,"tui-calendar-sheet",5),R(2,"tuiMapper"),v("dayClick",function(e){g(r);let o=d();return h(o.onDayClick(e))})("hoveredItemChange",function(e){g(r);let o=d();return h(o.onHoveredItemChange(e))}),m()}if(n&2){let r=d();l("max",r.computedMaxViewedMonth)("min",r.computedMinViewedMonth)("value",r.month),c(),l("disabledItemHandler",hn(2,9,r.disabledItemHandler,r.disabledItemHandlerMapper,r.computedMin,r.computedMax))("hoveredItem",r.hoveredItem)("markerHandler",r.markerHandler)("month",r.month)("showAdjacent",r.showAdjacent)("value",r.value)}}var Go=(()=>{let i=class i{constructor(){this.today=ct.currentLocal(),this.unorderedWeekDays$=f(Gn),this.dayTypeHandler=f(Wn),this.month=Mt.currentLocal(),this.disabledItemHandler=wt,this.markerHandler=null,this.value=null,this.hoveredItem=null,this.showAdjacent=!0,this.hoveredItemChange=new V,this.dayClick=new V,this.toMarkers=(t,e,o,a)=>{if(e||["active","end","start"].includes(o||""))return null;let s=a==null?void 0:a(t);return s!=null&&s.length?s:null}}itemIsInterval(t){let{value:e,hoveredItem:o}=this;if(!(e instanceof kt))return!1;if(!e.isSingleDay)return e.from.daySameOrBefore(t)&&e.to.dayAfter(t);if(o===null)return!1;let a=kt.sort(e.from,o);return a.from.daySameOrBefore(t)&&a.to.dayAfter(t)}onItemHovered(t){this.updateHoveredItem(t||null)}getItemRange(t){let{value:e,hoveredItem:o}=this;if(e instanceof ct)return e.daySame(t)?"active":null;if(!e||!(e instanceof kt))return e!=null&&e.find(s=>s.daySame(t))?"active":null;let a=this.getRange(e,o);return e.isSingleDay&&a.isSingleDay&&e.from.daySame(t)?"active":a.from.daySame(t)?"start":a.to.daySame(t)?"end":a.from.dayBefore(t)&&a.to.dayAfter(t)?"middle":null}get isSingleDayRange(){return this.value instanceof kt&&this.value.isSingleDay}itemIsToday(t){return this.today.daySame(t)}itemIsUnavailable(t){return!this.month.monthSame(t)}onItemClick(t){this.dayClick.emit(t)}getRange(t,e){return t.isSingleDay?kt.sort(t.from,e??t.to):t}updateHoveredItem(t){Kt(this.hoveredItem,t,(e,o)=>e.daySame(o))||(this.hoveredItem=t,this.hoveredItemChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-calendar-sheet"]],hostVars:2,hostBindings:function(e,o){e&2&&x("_picking",o.isSingleDayRange)},inputs:{month:"month",disabledItemHandler:"disabledItemHandler",markerHandler:"markerHandler",value:"value",hoveredItem:"hoveredItem",showAdjacent:"showAdjacent"},outputs:{hoveredItemChange:"hoveredItemChange",dayClick:"dayClick"},decls:6,vars:9,consts:[[1,"t-row","t-row_weekday"],["class","t-cell",3,"textContent",4,"ngFor","ngForOf"],[4,"tuiLet"],[1,"t-cell",3,"textContent"],["automation-id","tui-calendar-sheet__row","class","t-row",4,"tuiRepeatTimes","tuiRepeatTimesOf"],["automation-id","tui-calendar-sheet__row",1,"t-row"],[4,"tuiRepeatTimes","tuiRepeatTimesOf"],["automation-id","tui-calendar-sheet__cell","class","t-cell",3,"t-cell_disabled","t-cell_today","t-cell_unavailable","click","tuiHoveredChange",4,"ngIf"],["automation-id","tui-calendar-sheet__cell",1,"t-cell",3,"click","tuiHoveredChange"],["class","t-dots",4,"ngIf"],[1,"t-dots"],[1,"t-dot"],["class","t-dot",3,"background",4,"ngIf"]],template:function(e,o){e&1&&(p(0,"div",0),_(1,zo,1,1,"div",1),R(2,"tuiOrderWeekDays"),R(3,"async"),m(),_(4,No,2,1,"div",2),R(5,"tuiCalendarSheet")),e&2&&(c(),l("ngForOf",U(3,4,U(2,2,o.unorderedWeekDays$))),c(3),l("tuiLet",Se(5,6,o.month,!0)))},dependencies:[lt,re,z,et,Wi,Le,qt,Re,Qi,He],styles:[`.t-row[_ngcontent-%COMP%]{display:flex;justify-content:flex-start;font:var(--tui-font-text-m)}.t-row[_ngcontent-%COMP%]:last-child{justify-content:flex-start}.t-cell[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;line-height:2rem;isolation:isolate;cursor:pointer;overflow:hidden;border:.125rem solid transparent;box-sizing:border-box;-webkit-mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem));mask:linear-gradient(transparent calc(50% - 1rem),#000 calc(50% - 1rem),#000 calc(50% + 1rem),transparent calc(50% + 1rem))}.t-cell[_ngcontent-%COMP%]:first-child{border-inline-start-color:transparent!important}.t-cell[_ngcontent-%COMP%]:last-child{border-inline-end-color:transparent!important}.t-cell[_ngcontent-%COMP%]:before, .t-cell[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;bottom:0;right:0;content:"";z-index:-1;border-radius:var(--tui-radius-m)}.t-cell[_ngcontent-%COMP%]:after{-webkit-mask:url('data:image/svg+xml,') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat;mask:url('data:image/svg+xml,') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:first-child):before{border-start-start-radius:0;border-end-start-radius:0}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:last-child):before{border-start-end-radius:0;border-end-end-radius:0}.t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:not(:last-child):before{right:-1rem}.t-cell[data-range=start][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end][_ngcontent-%COMP%]:not(:first-child):before{left:-1rem}.t-cell[data-range=end][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active][_ngcontent-%COMP%]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);-webkit-mask:none;mask:none}.t-cell_disabled[_ngcontent-%COMP%]{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today[_ngcontent-%COMP%]{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell[_ngcontent-%COMP%]:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=end][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=active][_ngcontent-%COMP%]:hover:after{background:var(--tui-background-accent-1-hover)}}.t-cell[_ngcontent-%COMP%]{inline-size:2.25rem}[data-type=weekday][_ngcontent-%COMP%]{color:var(--tui-text-primary)}[data-type=weekend][_ngcontent-%COMP%]{color:var(--tui-text-negative)}.t-row[_ngcontent-%COMP%]{justify-content:flex-start}.t-row[_ngcontent-%COMP%]:first-child{justify-content:flex-end}.t-row_weekday[_ngcontent-%COMP%]{font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none}.t-cell_unavailable[_ngcontent-%COMP%]{opacity:var(--tui-disabled-opacity)}.t-dots[_ngcontent-%COMP%]{position:absolute;bottom:0;display:flex;justify-content:center;margin-top:-.5rem;padding-bottom:.25rem}.t-dot[_ngcontent-%COMP%]{display:inline-block;inline-size:.25rem;block-size:.25rem;border-radius:100%;margin:0 .0625rem}`],changeDetection:0});let n=i;return St([Nt],n.prototype,"getRange",null),n})(),Ko=(()=>{let i=class i{constructor(){this.value=Mt.currentLocal(),this.min=Bt,this.max=jt,this.valueChange=new V,this.yearClick=new V}onYearClick(){this.yearClick.next(this.value)}append(t){let e=this.value.append(t);this.min.monthSameOrAfter(e)?this.updateValue(this.min):this.updateValue(this.max.monthSameOrBefore(e)?this.max:e)}updateValue(t){this.value.monthSame(t)||(this.value=t,this.valueChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-calendar-spin"]],inputs:{value:"value",min:"min",max:"max"},outputs:{valueChange:"valueChange",yearClick:"yearClick"},decls:7,vars:10,consts:[["button",""],[3,"leftClick","rightClick","focusable","leftDisabled","rightDisabled"],[4,"ngIf","ngIfElse"],["id","year-btn","automation-id","tui-primitive-year-month-pagination__year-button","tabIndex","-1","tuiLink","","type","button",3,"click"]],template:function(e,o){if(e&1){let a=M();p(0,"tui-spin-button",1),v("leftClick",function(){return g(a),h(o.append({month:-1}))})("rightClick",function(){return g(a),h(o.append({month:1}))}),b(1),R(2,"tuiMonth"),R(3,"async"),_(4,Bo,2,1,"ng-container",2)(5,jo,2,1,"ng-template",null,0,G),m()}if(e&2){let a=J(6);l("focusable",!1)("leftDisabled",o.value.monthSameOrBefore(o.min))("rightDisabled",o.value.monthSameOrAfter(o.max)),c(),P(" ",U(3,8,U(2,6,o.value))," "),c(3),l("ngIf",o.min.year===o.max.year)("ngIfElse",a)}},dependencies:[et,z,Ot,ci,Gi],styles:["[_nghost-%COMP%]{display:block}"],changeDetection:0});let n=i;return n})(),Ki=100,qi=4,qo=(()=>{let i=class i{constructor(){this.hoveredItem=null,this.currentYear=Mt.currentLocal().year,this.value=null,this.initialItem=this.currentYear,this.min=Ee,this.max=ze,this.disabledItemHandler=wt,this.yearClick=new V}isDisabled(t){return this.max&&this.maxt||this.disabledItemHandler(t)}getItemRange(t){let{value:e,hoveredItem:o}=this;if(e instanceof Hn)return e.year===t?"active":null;if(Dn(e))return e===t?"active":null;if(!(e instanceof Ve))return e!=null&&e.find(C=>C.year===t)?"active":null;let a=this.isSingle?o:null,s=Math.min(e.from.year,a??e.to.year),u=Math.max(e.from.year,a??e.to.year);return s===u&&e.from.year===e.to.year&&s===t?"active":s===t?"start":u===t?"end":st?e:t}get calculatedMax(){let t=this.initialItem+Ki,e=this.max??ze;return e') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat;mask:url('data:image/svg+xml,') right / .75rem 100% no-repeat,linear-gradient(#000,#000) left / calc(100% - .7rem) 100% no-repeat}.t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range][_ngcontent-%COMP%]:before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1)}._picking[_nghost-%COMP%] .t-cell[data-range=middle][_ngcontent-%COMP%]{border-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:first-child):before{border-start-start-radius:0;border-end-start-radius:0}.t-cell[data-range=middle][_ngcontent-%COMP%]:not(:last-child):before{border-start-end-radius:0;border-end-end-radius:0}.t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=start][_ngcontent-%COMP%]{border-inline-end-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:not(:last-child):before{right:-1rem}.t-cell[data-range=start][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1)}.t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1);color:var(--tui-text-primary-on-accent-1)}._picking[_nghost-%COMP%] .t-cell[data-range=end][_ngcontent-%COMP%]{border-inline-start-color:var(--tui-background-neutral-1-hover)}.t-cell[data-range=end][_ngcontent-%COMP%]:not(:first-child):before{left:-1rem}.t-cell[data-range=end][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);transform:scaleX(-1)}.t-cell[data-range=active][_ngcontent-%COMP%]{color:var(--tui-text-primary-on-accent-1)}.t-cell[data-range=active][_ngcontent-%COMP%]:after{background:var(--tui-background-accent-1);-webkit-mask:none;mask:none}.t-cell_disabled[_ngcontent-%COMP%]{opacity:var(--tui-disabled-opacity);pointer-events:none}.t-cell_today[_ngcontent-%COMP%]{text-decoration:underline;text-underline-offset:.25rem}@media (hover: hover) and (pointer: fine){.t-cell[_ngcontent-%COMP%]:hover:not([data-range=start]):not([data-range=end]):before{background:var(--tui-background-neutral-1-hover)}.t-cell[data-range=start][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=end][_ngcontent-%COMP%]:hover:after, .t-cell[data-range=active][_ngcontent-%COMP%]:hover:after{background:var(--tui-background-accent-1-hover)}}[_nghost-%COMP%]{display:block;inline-size:16rem}.t-cell[_ngcontent-%COMP%]{inline-size:4rem;border-block-start-width:.5rem;border-block-end-width:.5rem}`],changeDetection:0});let n=i;return n})(),Wt=(()=>{let i=class i{constructor(){this.day=null,this.view="month",this.month=Mt.currentLocal(),this.disabledItemHandler=wt,this.min=Bt,this.max=jt,this.minViewedMonth=Bt,this.maxViewedMonth=jt,this.hoveredItem=null,this.showAdjacent=!0,this.markerHandler=null,this.dayClick=new V,this.monthChange=new V,this.hoveredItemChange=new V,this.disabledItemHandlerMapper=(t,e,o)=>a=>a.dayBefore(e)||a.dayAfter(o)||t(a)}set value(t){this.day=t,this.showAdjacent&&t instanceof ct&&t.daySameOrBefore(le)&&(this.month=t)}set initialView(t){this.view=t}get value(){return this.day}onPaginationValueChange(t){this.updateViewedMonth(t)}onDayClick(t){this.dayClick.emit(t)}onHoveredItemChange(t){this.updateHoveredDay(t)}get computedMin(){return this.min??Bt}get computedMax(){return this.max??jt}get computedMinViewedMonth(){let t=this.computedMin,e=this.minViewedMonth??Bt;return e.monthSameOrAfter(t)?e:t}get computedMaxViewedMonth(){let t=this.computedMax,e=this.maxViewedMonth??jt;return e.monthSameOrBefore(t)?e:t}get isInYearView(){return this.view==="year"}onPaginationYearClick(){this.view="year"}onPickerYearClick(t){this.view="month",this.updateViewedMonth(new Mt(t,this.month.month))}updateViewedMonth(t){this.month.monthSame(t)||(this.month=t,this.monthChange.emit(t))}updateHoveredDay(t){Kt(this.hoveredItem,t,(e,o)=>e.daySame(o))||(this.hoveredItem=t,this.hoveredItemChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-calendar"]],inputs:{month:"month",disabledItemHandler:"disabledItemHandler",min:"min",max:"max",minViewedMonth:"minViewedMonth",maxViewedMonth:"maxViewedMonth",hoveredItem:"hoveredItem",showAdjacent:"showAdjacent",markerHandler:"markerHandler",value:"value",initialView:"initialView"},outputs:{dayClick:"dayClick",monthChange:"monthChange",hoveredItemChange:"hoveredItemChange"},decls:3,vars:2,consts:[["calendar",""],["automation-id","tui-calendar__scrollbar","class","t-scrollbar",4,"ngIf","ngIfElse"],["automation-id","tui-calendar__scrollbar",1,"t-scrollbar"],["automation-id","tui-calendar__year",3,"yearClick","initialItem","max","min","value"],["automation-id","tui-calendar__pagination",1,"t-pagination",3,"valueChange","yearClick","max","min","value"],["automation-id","tui-calendar__calendar",3,"dayClick","hoveredItemChange","disabledItemHandler","hoveredItem","markerHandler","month","showAdjacent","value"]],template:function(e,o){if(e&1&&_(0,Yo,2,4,"tui-scrollbar",1)(1,Qo,3,14,"ng-template",null,0,G),e&2){let a=J(2);l("ngIf",o.isInYearView)("ngIfElse",a)}},dependencies:[z,Go,Ko,qo,Re,Dt],styles:["[_nghost-%COMP%]{display:block;min-block-size:18.25rem;inline-size:15.75rem;padding:1rem 1.125rem;box-sizing:content-box}.t-scrollbar[_ngcontent-%COMP%]{block-size:18.25rem;inline-size:16.875rem}.t-pagination[_ngcontent-%COMP%]{margin-bottom:1rem}"],changeDetection:0});let n=i;return n})();var Xo=["*"];function Jo(n,i){if(n&1&&(L(0),b(1),H()),n&2){let r=i.polymorpheusOutlet;c(),P(" ",r," ")}}function tr(n,i){if(n&1&&(p(0,"div",6),_(1,Jo,2,1,"ng-container",7),m()),n&2){let r=d(2);x("t-text_horizontal",r.isHorizontal),c(),l("polymorpheusOutlet",r.textContent)}}function er(n,i){if(n&1&&(p(0,"div",2),cn(),p(1,"svg",3),w(2,"circle",4),m(),_(3,tr,2,3,"div",5),m()),n&2){let r=d();x("t-loader_horizontal",r.isHorizontal)("t-loader_inherit-color",r.inheritColor),c(3),l("ngIf",r.textContent)}}var nr={size:"m",inheritColor:!1,overlay:!1},ir=K(nr);var Qt=(()=>{let i=class i{constructor(){this.isIOS=f(ni),this.options=f(ir),this.isApple=Ui(q())||this.isIOS,this.size=this.options.size,this.inheritColor=this.options.inheritColor,this.overlay=this.options.overlay,this.loading=!0}get isHorizontal(){return!pe(this.size)}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-loader"]],hostVars:3,hostBindings:function(e,o){e&2&&(k("data-size",o.size),x("_loading",o.loading))},inputs:{size:"size",inheritColor:"inheritColor",overlay:"overlay",textContent:"textContent",loading:[0,"showLoader","loading"]},ngContentSelectors:Xo,decls:3,vars:7,consts:[[1,"t-content",3,"disabled"],["class","t-loader",3,"t-loader_horizontal","t-loader_inherit-color",4,"ngIf"],[1,"t-loader"],["automation-id","tui-loader__loader","focusable","false","height","100%","width","100%",1,"t-icon"],["cx","50%","cy","50%",1,"t-circle"],["automation-id","tui-loader__text","class","t-text",3,"t-text_horizontal",4,"ngIf"],["automation-id","tui-loader__text",1,"t-text"],[4,"polymorpheusOutlet"]],template:function(e,o){e&1&&(W(),p(0,"fieldset",0),I(1),m(),_(2,er,4,5,"div",1)),e&2&&(x("t-content_has-overlay",o.overlay&&o.loading)("t-content_loading",o.loading),l("disabled",o.loading&&!o.isApple),k("inert",o.loading||null),c(2),l("ngIf",o.loading))},dependencies:[z,Z],styles:["[_nghost-%COMP%]{position:relative;display:flex;min-inline-size:1.5rem;--tui-thickness: calc(var(--t-diameter) / 12)}._loading[_nghost-%COMP%]{overflow:hidden}[data-size=xs][_nghost-%COMP%]{--t-diameter: .75em}[data-size=s][_nghost-%COMP%]{--t-diameter: 1em}[data-size=m][_nghost-%COMP%]{--t-diameter: 1.5em}[data-size=l][_nghost-%COMP%]{--t-diameter: 2.5em}[data-size=xl][_nghost-%COMP%]{--t-diameter: 3.5em}[data-size=xxl][_nghost-%COMP%]{--t-diameter: 5em}.t-content[_ngcontent-%COMP%]{z-index:0;min-inline-size:100%;block-size:100%;padding:0;margin:0;border:none}.t-content_has-overlay[_ngcontent-%COMP%]{opacity:.3}.t-content_loading[_ngcontent-%COMP%]{pointer-events:none}.t-loader[_ngcontent-%COMP%]{position:relative;left:-100%;display:flex;flex-direction:column;align-items:center;justify-content:center;min-inline-size:100%;min-block-size:var(--t-diameter);flex-shrink:0;align-self:center;color:var(--tui-text-primary);stroke:var(--tui-background-accent-1);animation:tuiFadeIn var(--tui-duration);font-size:1rem}.t-loader.t-loader_horizontal[_ngcontent-%COMP%]{flex-direction:row}.t-loader.t-loader_inherit-color[_ngcontent-%COMP%]{color:inherit;stroke:currentColor}.t-text[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font:var(--tui-font-text-s);margin-top:1rem;color:inherit;max-inline-size:100%;text-align:center;stroke-width:0}.t-text_horizontal[_ngcontent-%COMP%]{margin:0 0 0 1rem}@keyframes _ngcontent-%COMP%_tuiLoaderRotate{0%{transform:rotate(-90deg)}50%{transform:rotate(-90deg) rotate(1turn)}to{transform:rotate(-90deg) rotate(3turn)}}.t-icon[_ngcontent-%COMP%]{display:block;inline-size:var(--t-diameter);block-size:var(--t-diameter);margin:.25rem calc(var(--t-diameter) / -2);border-radius:100%;overflow:hidden;animation:_ngcontent-%COMP%_tuiLoaderRotate 4s linear infinite}@supports (-webkit-hyphens: none){.t-icon[_ngcontent-%COMP%]{overflow:visible}}@keyframes _ngcontent-%COMP%_tuiLoaderDashOffset{0%{stroke-dashoffset:calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness)))}50%{stroke-dashoffset:calc(.05 * calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness))))}to{stroke-dashoffset:calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness)))}}.t-circle[_ngcontent-%COMP%]{r:calc(var(--t-diameter) / 2 - var(--tui-thickness));stroke-dasharray:calc(2 * 3.14159265 * calc(var(--t-diameter) / 2 - var(--tui-thickness)));fill:none;stroke:inherit;stroke-width:max(var(--tui-thickness),1.5px);animation:_ngcontent-%COMP%_tuiLoaderDashOffset 4s linear infinite}"],changeDetection:0});let n=i;return n})();var rr=["wrapper"],ar=["*"];function sr(n,i){if(n&1&&(p(0,"tui-loader",4),Tt(1,5),m()),n&2){let r=d(2);l("overlay",!0)("showLoader",r.loading),c(),l("ngTemplateOutlet",r.content)}}function lr(n,i){if(n&1&&(L(0),I(1),_(2,sr,2,3,"tui-loader",3),H()),n&2){let r=d();c(2),l("ngIf",r.async)("ngIfElse",r.content)}}var $e=(()=>{let i=class i{};i.\u0275fac=function(e){return new(e||i)},i.\u0275dir=j({type:i,selectors:[["","tuiExpandContent",""]]});let n=i;return n})(),F={Idle:0,Loading:1,Prepared:2,Animated:3},cr=48;var Zi=(()=>{let i=class i{constructor(){this.cdr=f(xt),this.destroyRef=f(ht),this.state=F.Idle,this.content=null,this.expanded=null,this.async=!1}set expandedSetter(t){if(this.expanded===null){this.expanded=t;return}if(this.state!==F.Idle){this.expanded=t,this.state=F.Animated;return}this.expanded=t,this.retrigger(this.async&&t?F.Loading:F.Animated)}get contentVisible(){return this.expanded||this.state!==F.Idle}get overflow(){return this.state!==F.Idle}get loading(){return!!this.expanded&&this.async&&this.state===F.Loading}get height(){let{expanded:t,state:e,contentWrapper:o}=this;return t&&e===F.Prepared||!t&&e===F.Animated?0:o&&(!t&&e===F.Prepared||t&&e===F.Animated)?o.nativeElement.offsetHeight:o&&t&&e===F.Loading?Math.max(o.nativeElement.offsetHeight,cr):null}onTransitionEnd({propertyName:t,pseudoElement:e}){t==="opacity"&&!e&&this.state===F.Animated&&(this.state=F.Idle)}onExpandLoaded(t){t.stopPropagation(),this.state===F.Loading&&this.retrigger(F.Animated)}retrigger(t){this.state=F.Prepared,Jt(0).pipe(Y(this.destroyRef)).subscribe(()=>{this.state===F.Prepared&&(this.state=t,this.cdr.markForCheck())})}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-expand"]],contentQueries:function(e,o,a){if(e&1&&st(a,$e,5,zt),e&2){let s;S(s=E())&&(o.content=s.first)}},viewQuery:function(e,o){if(e&1&&Q(rr,5),e&2){let a;S(a=E())&&(o.contentWrapper=a.first)}},hostVars:9,hostBindings:function(e,o){e&1&&v("transitionend.self",function(s){return o.onTransitionEnd(s)})("tui-expand-loaded",function(s){return o.onExpandLoaded(s)}),e&2&&(k("aria-expanded",o.expanded),D("height",o.height,"px"),x("_loading",o.loading)("_overflow",o.overflow)("_expanded",o.expanded))},inputs:{async:"async",expandedSetter:[0,"expanded","expandedSetter"]},ngContentSelectors:ar,decls:3,vars:3,consts:[["wrapper",""],[1,"t-wrapper"],[4,"ngIf"],["size","l",3,"overlay","showLoader",4,"ngIf","ngIfElse"],["size","l",3,"overlay","showLoader"],[3,"ngTemplateOutlet"]],template:function(e,o){e&1&&(W(),p(0,"div",1,0),_(2,lr,3,2,"ng-container",2),m()),e&2&&(l("@tuiParentAnimation",void 0)("@.disabled",o.overflow),c(2),l("ngIf",o.contentVisible))},dependencies:[z,_n,Qt],styles:['[_nghost-%COMP%]{transition-property:opacity,height,visibility;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:block;opacity:0;transition-delay:1ms}._overflow[_nghost-%COMP%]{overflow:hidden}._expanded[_nghost-%COMP%]{opacity:1}._loading[_nghost-%COMP%]{opacity:.99}.t-wrapper[_ngcontent-%COMP%]:before, .t-wrapper[_ngcontent-%COMP%]:after{content:"";display:table}'],data:{animation:[vn]},changeDetection:0});let n=i;return n})();var dr=["*",[["","tuiAccordionItemContent","",5,"ng-template"]]],pr=["*","[tuiAccordionItemContent]:not(ng-template)"];function mr(n,i){if(n&1&&(L(0),w(1,"tui-icon",7),H()),n&2){let r=d();c(),l("tuiChevron",r.open)}}function gr(n,i){if(n&1&&(L(0),b(1),H()),n&2){let r=i.polymorpheusOutlet;c(),P(" ",r," ")}}function hr(n,i){if(n&1&&(p(0,"div",9),_(1,gr,2,1,"ng-container",10),m()),n&2){let r=d(2);c(),l("polymorpheusOutlet",r.lazyContent)}}function fr(n,i){if(n&1&&_(0,hr,2,1,"div",8),n&2){let r=d();l("ngIf",r.lazyContent)}}function _r(n,i){n&1&&(p(0,"div",11),I(1,1),m())}var Ue=(()=>{let i=class i extends Ut{};i.\u0275fac=(()=>{let t;return function(o){return(t||(t=it(i)))(o||i)}})(),i.\u0275dir=j({type:i,selectors:[["ng-template","tuiAccordionItemContent",""]],features:[ot]});let n=i;return n})(),vr=(()=>{let i=class i{};i.\u0275fac=function(e){return new(e||i)},i.\u0275dir=j({type:i,selectors:[["","tuiAccordionItemContent","",5,"ng-template"]]});let n=i;return n})(),We=(()=>{let i=class i{constructor(){this.cdr=f(xt),this.noPadding=!1,this.showArrow=!0,this.borders="all",this.size="m",this.disabled=!1,this.disableHover=!1,this.open=!1,this.async=!1,this.openChange=new V}close(){this.updateOpen(!1),this.cdr.markForCheck()}onRowToggle(){this.disabled||this.updateOpen(!this.open)}onItemKeyDownEsc(t){this.open&&(t.stopPropagation(),this.updateOpen(!1))}updateOpen(t){this.open!==t&&(this.open=t,this.openChange.emit(t))}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-accordion-item"]],contentQueries:function(e,o,a){if(e&1&&(st(a,vr,5),st(a,Ue,5)),e&2){let s;S(s=E())&&(o.eagerContent=s.first),S(s=E())&&(o.lazyContent=s.first)}},hostVars:8,hostBindings:function(e,o){e&2&&(k("data-borders",o.borders)("data-size",o.size),x("_no-padding",o.noPadding)("_has-arrow",o.showArrow)("_disabled",o.disabled))},inputs:{noPadding:"noPadding",showArrow:"showArrow",borders:"borders",size:"size",disabled:"disabled",disableHover:"disableHover",open:"open",async:"async"},outputs:{openChange:"openChange"},ngContentSelectors:pr,decls:8,vars:9,consts:[["automation-id","tui-accordion__item-wrapper",1,"t-wrapper"],["automation-id","tui-accordion__item-header","type","button",1,"t-header",3,"click","keydown.esc","disabled"],["automation-id","tui-accordion__item-title",1,"t-title"],[4,"ngIf"],[3,"async","expanded"],["tuiExpandContent",""],["class","t-content",4,"ngIf"],[1,"t-icon",3,"tuiChevron"],["automation-id","tui-accordion__item-content","class","t-content",4,"ngIf"],["automation-id","tui-accordion__item-content",1,"t-content"],[4,"polymorpheusOutlet"],[1,"t-content"]],template:function(e,o){e&1&&(W(dr),p(0,"div",0)(1,"button",1),v("click",function(){return o.onRowToggle()})("keydown.esc",function(s){return o.onItemKeyDownEsc(s)}),p(2,"span",2),I(3),m(),_(4,mr,2,1,"ng-container",3),m(),p(5,"tui-expand",4),_(6,fr,1,1,"ng-template",5)(7,_r,2,0,"div",6),m()()),e&2&&(c(),x("t-header_hoverable",!o.disableHover)("t-header_open",o.open),l("disabled",o.disabled),c(3),l("ngIf",o.showArrow),c(),l("async",o.async)("expanded",o.open),c(2),l("ngIf",o.eagerContent))},dependencies:[z,Z,vi,Zi,$e,B],styles:['[_nghost-%COMP%]{position:relative;display:block;overflow:hidden;border-radius:var(--tui-radius-l)}[data-borders=top-bottom][_nghost-%COMP%]{border-radius:0!important} tui-accordion{inline-size:100%}.t-wrapper[_ngcontent-%COMP%]{position:relative;border-radius:inherit}.t-wrapper[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";box-sizing:border-box;border-radius:inherit;border:1px solid var(--tui-border-normal);pointer-events:none}[_nghost-%COMP%]:not([data-borders]) .t-wrapper[_ngcontent-%COMP%]:after{border-width:0}[data-borders=all][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-width:1px}[data-borders=top-bottom][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-inline-start-width:0;border-inline-end-width:0}[data-borders=top][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-inline-start-width:0;border-inline-end-width:0;border-block-end-width:0}[data-borders=bottom][_nghost-%COMP%] .t-wrapper[_ngcontent-%COMP%]:after{border-inline-start-width:0;border-inline-end-width:0;border-block-start-width:0}.t-header[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:flex;inline-size:100%;font:var(--tui-font-text-l);align-items:center;box-sizing:border-box;border-block-end:1px solid var(--tui-border-normal);min-block-size:var(--tui-height-l);padding:.75rem 1.25rem;color:var(--tui-text-primary);cursor:pointer;text-align:start;outline:none}.t-header[_ngcontent-%COMP%]:focus-visible{box-shadow:inset 0 0 0 2px var(--tui-border-focus)}[_nghost-%COMP%]:not([data-borders]) .t-header[_ngcontent-%COMP%]{border-block-end-width:0}._has-arrow[_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{padding-right:.75rem}[tuiTheme="dark"][_nghost-%COMP%] .t-header_open[_ngcontent-%COMP%], [tuiTheme="dark"] [_nghost-%COMP%] .t-header_open[_ngcontent-%COMP%]{background:var(--tui-background-neutral-1)}[data-size=s][_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{font:var(--tui-font-text-m);min-block-size:var(--tui-height-m);padding:.625rem .75rem .625rem 1rem}._no-padding[_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{padding-left:0;padding-right:0}._disabled[_nghost-%COMP%] .t-header[_ngcontent-%COMP%]{cursor:default}.t-wrapper[_ngcontent-%COMP%]:hover > .t-header_hoverable[_ngcontent-%COMP%]{background:var(--tui-background-base-alt)}.t-title[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-right:0;flex-grow:1}._has-arrow[_nghost-%COMP%] .t-title[_ngcontent-%COMP%]{margin-right:.5rem}.t-icon[_ngcontent-%COMP%]{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;margin-left:auto;border-width:.25rem;color:var(--tui-text-tertiary)}[_nghost-%COMP%]:hover .t-icon[_ngcontent-%COMP%]{color:var(--tui-text-secondary)}.t-content[_ngcontent-%COMP%]{font:var(--tui-font-text-m);padding:1.25rem;overflow-wrap:break-word}[data-size=s][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{font:var(--tui-font-text-s);padding:1rem}'],changeDetection:0});let n=i;return n})(),Xi=(()=>{let i=class i{constructor(){this.destroyRef=f(ht),this.accordionItems=ae,this.closeOthers=!0;let t=f(ve);t.orientation="vertical",t.collapsed=!0}ngAfterContentInit(){let{accordionItems:t}=this,e=Bn(t),o=e.pipe(nn(),ut(([s,u])=>u.find(C=>!s.includes(C)&&C.open)),Gt(Sn));te(e.pipe(on(s=>te(...s.map(u=>u.openChange.pipe(Gt(Xt),ut(()=>u)))))),o).pipe(Gt(()=>this.closeOthers),Y(this.destroyRef)).subscribe(s=>{t.forEach(u=>{s!==u&&u.close()})})}};i.\u0275fac=function(e){return new(e||i)},i.\u0275dir=j({type:i,selectors:[["tui-accordion"]],contentQueries:function(e,o,a){if(e&1&&st(a,We,4),e&2){let s;S(s=E())&&(o.accordionItems=s)}},inputs:{closeOthers:"closeOthers"},features:[_t([{directive:ve,inputs:["rounded","rounded"]}])]});let n=i;return n})();var br=["type","checkbox","tuiCheckbox",""],yr={size:"m",appearance:n=>n.checked||n.indeterminate?"primary":"outline-grayscale",icons:{checked:"@tui.check",indeterminate:"@tui.minus"}},xr=K(yr);var Ji=(()=>{let i=class i{constructor(){this.appearance=f(nt),this.options=f(xr),this.resolver=de(),this.destroyRef=f(ht),this.el=q(),this.size=this.options.size,this.control=f(Lt,{optional:!0,self:!0})}ngOnInit(){var t;(t=this.control)!=null&&t.valueChanges&&Fn(this.control).pipe(Y(this.destroyRef)).subscribe(e=>{let o=this.control instanceof rt&&e===null?this.control.model:e;this.el.indeterminate=o===null})}ngDoCheck(){this.appearance.tuiAppearance=dt(this.options.appearance)?this.options.appearance:this.options.appearance(this.el)}getIcon(t){let e=this.options.icons[t],o=dt(e)?e:e(this.size);return o&&`url(${this.resolver(o)})`}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["input","type","checkbox","tuiCheckbox",""]],hostVars:8,hostBindings:function(e,o){e&2&&(vt("disabled",!o.control||o.control.disabled),k("data-size",o.size),D("--t-checked-icon",o.getIcon("checked"))("--t-indeterminate-icon",o.getIcon("indeterminate")),x("_readonly",!o.control))},inputs:{size:"size"},features:[_t([{directive:nt,inputs:["tuiAppearanceState","tuiAppearanceState","tuiAppearanceFocus","tuiAppearanceFocus"]},_e])],attrs:br,decls:0,vars:0,template:function(e,o){},styles:[`[tuiCheckbox]{--t-size: 1.5rem;--t-radius: var(--tui-radius-s);inline-size:var(--t-size);block-size:var(--t-size);border-radius:var(--t-radius);cursor:pointer;margin:0;flex-shrink:0}[tuiCheckbox]:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";background:currentColor;-webkit-mask:url('data:image/svg+xml,') center / 100%;mask:url('data:image/svg+xml,') center / 100%;transform:scale(0);transition:transform var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out}[tuiCheckbox]:disabled._readonly{opacity:1}[tuiCheckbox]:checked:before,[tuiCheckbox]:indeterminate:before{-webkit-mask-image:var(--t-checked-icon);mask-image:var(--t-checked-icon);transform:scale(1);transition:transform var(--tui-duration) ease-in-out,-webkit-mask 0s ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s ease-in-out;transition:transform var(--tui-duration) ease-in-out,mask 0s ease-in-out,-webkit-mask 0s ease-in-out}[tuiCheckbox]:indeterminate:before{-webkit-mask-image:var(--t-indeterminate-icon);mask-image:var(--t-indeterminate-icon)}[tuiCheckbox][data-size=s]{--t-size: 1rem;--t-radius: var(--tui-radius-xs)} `],encapsulation:2,changeDetection:0});let n=i;return n})();var wr=["type","checkbox","tuiSwitch",""],Mr={showIcons:!0,size:"m",icon:"@tui.check",appearance:n=>n.checked?"primary":"secondary"},Or=K(Mr);var to=(()=>{let i=class i{constructor(){this.appearance=f(nt),this.resolver=de(),this.options=f(Or),this.el=q(),this.control=f(Lt,{self:!0,optional:!0}),this.size=this.options.size,this.showIcons=this.options.showIcons}ngDoCheck(){this.appearance.tuiAppearance=this.options.appearance(this.el)}get icon(){let{options:t,resolver:e,size:o}=this,a=dt(t.icon)?t.icon:t.icon(o);return this.showIcons&&a?`url(${e(a)})`:null}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["input","type","checkbox","tuiSwitch",""]],hostAttrs:["role","switch"],hostVars:6,hostBindings:function(e,o){e&2&&(vt("disabled",!o.control||o.control.disabled),k("data-size",o.size),D("--t-checked-icon",o.icon),x("_readonly",!o.control))},inputs:{size:"size",showIcons:"showIcons"},features:[_t([{directive:nt,inputs:["tuiAppearanceState","tuiAppearanceState","tuiAppearanceFocus","tuiAppearanceFocus"]},_e])],attrs:wr,decls:0,vars:0,template:function(e,o){},styles:[`[tuiSwitch]{transition-property:background,box-shadow;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;inline-size:3rem;block-size:1.5rem;border-radius:2rem;overflow:hidden;cursor:pointer;margin:0;flex-shrink:0;color:#fff!important}[tuiSwitch][data-size=s]{block-size:1rem;inline-size:2rem}[tuiSwitch][data-size=s]:before{inline-size:1rem;transform:translate(-1rem);-webkit-mask-size:.75rem;mask-size:.75rem}[tuiSwitch][data-size=s]:after{inline-size:1rem;box-shadow:-2.625rem 0 0 .5rem var(--tui-background-base);outline-width:.167rem;transform:scale(.375)}[tuiSwitch][data-size=s]:checked:after{transform:scale(.375) translate(2.625rem)}[tuiSwitch]:checked:before{transform:none}[tuiSwitch]:checked:after{transform:scale(.33333) translate(4.5rem)}[tuiSwitch]:disabled._readonly{opacity:1}[tuiSwitch]:before,[tuiSwitch]:after{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:"";position:absolute;block-size:100%;inline-size:1.5rem}[tuiSwitch]:before{display:var(--t-checked-icon, none);background:currentColor;-webkit-mask:var(--t-checked-icon) no-repeat center;mask:var(--t-checked-icon) no-repeat center;-webkit-mask-size:1rem;mask-size:1rem;transform:translate(-1.5rem)}[tuiSwitch]:after{right:0;border-radius:100%;transform:scale(.33333);box-shadow:-4.5rem 0 0 .75rem var(--tui-background-base);outline:.375rem solid var(--tui-background-neutral-2-pressed);outline-offset:var(--t-checked-icon, 20rem)} `],encapsulation:2,changeDetection:0});let n=i;return n})();function Pr(n,i,r){let t=Math.min(Number(r),Math.max(Number(i),Number(n)));return n instanceof Date?new Date(t):t}function Tr(n){return n.replaceAll(/\W/g,"").length}var no=n=>{var i,r,t,e,o,a;return{day:(r=(i=n.match(/d/g))===null||i===void 0?void 0:i.length)!==null&&r!==void 0?r:0,month:(e=(t=n.match(/m/g))===null||t===void 0?void 0:t.length)!==null&&e!==void 0?e:0,year:(a=(o=n.match(/y/g))===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0}};function kr(n){return{day:String(n.getDate()).padStart(2,"0"),month:String(n.getMonth()+1).padStart(2,"0"),year:String(n.getFullYear()).padStart(4,"0"),hours:String(n.getHours()).padStart(2,"0"),minutes:String(n.getMinutes()).padStart(2,"0"),seconds:String(n.getSeconds()).padStart(2,"0"),milliseconds:String(n.getMilliseconds()).padStart(3,"0")}}function Ir(n,i){return n.length!/^0+$/.exec(r))}function io(n,i,r){let t=Tr(i);return n.replace(r,"").match(new RegExp(`(\\D*\\d[^\\d\\s]*){1,${t}}`,"g"))||[]}function Ge(n,i){let r=i.replaceAll(/[^dmy]/g,""),t=n.replaceAll(/\D+/g,""),e={day:t.slice(r.indexOf("d"),r.lastIndexOf("d")+1),month:t.slice(r.indexOf("m"),r.lastIndexOf("m")+1),year:t.slice(r.indexOf("y"),r.lastIndexOf("y")+1)};return Object.fromEntries(Object.entries(e).filter(([o,a])=>!!a).sort(([o],[a])=>i.toLowerCase().indexOf(o.slice(0,1))>i.toLowerCase().indexOf(a.slice(0,1))?1:-1))}function Dr(n,i){var r,t,e,o,a,s,u;let C=((r=n.year)===null||r===void 0?void 0:r.length)===2?`20${n.year}`:n.year,y=new Date(Number(C??"0"),Number((t=n.month)!==null&&t!==void 0?t:"1")-1,Number((e=n.day)!==null&&e!==void 0?e:"1"),Number((o=i==null?void 0:i.hours)!==null&&o!==void 0?o:"0"),Number((a=i==null?void 0:i.minutes)!==null&&a!==void 0?a:"0"),Number((s=i==null?void 0:i.seconds)!==null&&s!==void 0?s:"0"),Number((u=i==null?void 0:i.milliseconds)!==null&&u!==void 0?u:"0"));return y.setFullYear(Number(C??"0")),y}var oo=", ";function Zt({day:n,month:i,year:r,hours:t,minutes:e,seconds:o,milliseconds:a},{dateMode:s,dateTimeSeparator:u=oo,timeMode:C}){var y;let T=((y=s.match(/y/g))===null||y===void 0?void 0:y.length)===2?r==null?void 0:r.slice(-2):r;return(s+(C?u+C:"")).replaceAll(/d+/g,n??"").replaceAll(/m+/g,i??"").replaceAll(/y+/g,T??"").replaceAll(/H+/g,t??"").replaceAll("MSS",a??"").replaceAll(/M+/g,e??"").replaceAll(/S+/g,o??"").replaceAll(/^\D+/g,"").replaceAll(/\D+$/g,"")}var ro={day:31,month:12,year:9999};var Sr=new Date("0001-01-01"),Er=new Date("9999-12-31");var ao="\xA0";var kc=new RegExp(`[${ao}APM]+$`,"g"),Ic=new RegExp(`${ao}[AP]M$`,"g"),zr=[":","."];function Ar({dateString:n,dateModeTemplate:i,dateSegmentsSeparator:r,offset:t,selection:[e,o]}){let a=Ge(n,i),s=Object.entries(a),u={};for(let[T,N]of s){let A=Zt(u,{dateMode:i}),X=ro[T],pt=A.length&&r.length,at=t+A.length+pt+no(i)[T],mt=at>=e&&at===o;if(mt&&Number(N)>Number(X))return{validatedDateString:"",updatedSelection:[e,o]};if(mt&&Number(N)<1)return{validatedDateString:"",updatedSelection:[e,o]};u[T]=N}let C=Zt(u,{dateMode:i}),y=C.length-n.length;return{validatedDateString:C,updatedSelection:[e+y,o+y]}}var so=/[\\^$.*+?()[\]{}|]/g,Vr=new RegExp(so.source);function lo(n){return n&&Vr.test(n)?n.replaceAll(so,String.raw`\$&`):n}var Rr=/^0+$/;function Qe(n,i,r=0){let t=n.padEnd(i.length,"0");if(Number(t)<=Number(i))return{validatedSegmentValue:n,prefixedZeroesCount:r};if(t.endsWith("0"))return Qe(`0${n.slice(0,i.length-1)}`,i,r+1);let e=n.slice(0,i.length-1);return Rr.exec(e)?{validatedSegmentValue:"",prefixedZeroesCount:r}:Qe(`${e}0`,i,r)}function eo(n){return n.replaceAll(/[0-9]/g,i=>String.fromCharCode(i.charCodeAt(0)-65248))}function Lr({dateModeTemplate:n,dateSegmentSeparator:i,splitFn:r,uniteFn:t}){return({value:e,selection:o})=>{var a;let[s,u]=o,{dateStrings:C,restPart:y=""}=r(e),T=[],N=0;C.forEach(X=>{let pt=Ge(X,n),mt=Object.entries(pt).reduce((Pe,[Je,wo])=>{let{validatedSegmentValue:Mo,prefixedZeroesCount:Oo}=Qe(wo,`${ro[Je]}`);return N+=Oo,Object.assign(Object.assign({},Pe),{[Je]:Mo})},{});T.push(Zt(mt,{dateMode:n}))});let A=t(T,e)+(!((a=C[C.length-1])===null||a===void 0)&&a.endsWith(i)?i:"")+y;return N&&A.slice(u+N,u+N+i.length)===i&&(N+=i.length),{selection:[s+N,u+N],value:A}}}function Hr(){return({elementState:n,data:i})=>{let{value:r,selection:t}=n;return{elementState:{selection:t,value:eo(r)},data:eo(i)}}}var Dc=new RegExp(`[${zr.map(lo).join("")}]$`);function Fr(n,i){let r=no(i);return Object.fromEntries(Object.entries(n).map(([t,e])=>{let o=r[t];return[t,e.length===o&&/^0+$/.exec(e)?"1".padStart(o,"0"):e]}))}function Nr({dateModeTemplate:n,min:i=Sr,max:r=Er,rangeSeparator:t="",dateSegmentSeparator:e="."}){return({value:o,selection:a})=>{let s=t&&o.endsWith(t),u=io(o,n,t),C="";for(let y of u){C+=C?t:"";let T=Ge(y,n);if(!Ir(y,n)){let X=Fr(T,n),pt=Zt(X,{dateMode:n}),at=y.endsWith(e)?e:"";C+=pt+at;continue}let N=Dr(T),A=Pr(N,i,r);C+=Zt(kr(A),{dateMode:n})}return{selection:a,value:C+(s?t:"")}}}function Br({dateModeTemplate:n,dateSegmentsSeparator:i,rangeSeparator:r="",dateTimeSeparator:t=oo}){return({elementState:e,data:o})=>{var a;let s=r?new RegExp(`${r}|-`):t,u=o.split(s),C=o.includes(t)?[(a=u[0])!==null&&a!==void 0?a:""]:u;if(C.every(y=>y.trim().split(/\D/).filter(Boolean).length===n.split(i).length)){let y=C.map(T=>jr(T,n,i)).join(r);return{elementState:e,data:`${y}${o.includes(t)&&t+u[1]||""}`}}return{elementState:e,data:o}}}function jr(n,i,r){let t=n.split(/\D/).filter(Boolean),e=i.split(r);return t.map((a,s)=>{var u,C;return s===e.length-1?a:a.padStart((C=(u=e[s])===null||u===void 0?void 0:u.length)!==null&&C!==void 0?C:0,"0")}).join(r)}function $r({dateModeTemplate:n,dateSegmentsSeparator:i,rangeSeparator:r=""}){return({elementState:t,data:e})=>{let{value:o,selection:a}=t;if(e===i)return{elementState:t,data:a[0]===o.length?e:""};let s=e.replaceAll(new RegExp(`[^\\d${lo(i)}${r}]`,"g"),"");if(!s)return{elementState:t,data:""};let[u,C]=a,y=C+e.length,T=o.slice(0,u)+s+o.slice(y),N=io(T,n,r),A="",X=!!r&&T.includes(r);for(let at of N){let{validatedDateString:mt,updatedSelection:Pe}=Ar({dateString:at,dateModeTemplate:n,dateSegmentsSeparator:i,offset:A.length,selection:[u,y]});if(at&&!mt)return{elementState:t,data:""};y=Pe[1],A+=X&&!A?mt+r:mt}let pt=A.slice(u,y);return{elementState:{selection:a,value:A.slice(0,u)+pt.split(i).map(at=>"0".repeat(at.length)).join(i)+A.slice(y)},data:pt}}}function Ur(){return({elementState:n},i)=>{let{value:r,selection:t}=n;if(!r||Wr(r,t))return{elementState:n};let[e,o]=t,a=r.slice(e,o).replaceAll(/\d/g,"0"),s=r.slice(0,e)+a+r.slice(o);return a.replaceAll(/\D/g,"")?i==="validation"||i==="insert"&&e===o?{elementState:{selection:t,value:s}}:{elementState:{selection:i==="deleteBackward"||i==="insert"?[e,e]:[o,o],value:s}}:{elementState:n}}}function Wr(n,[i,r]){return r===n.length}function co({mode:n,separator:i=".",max:r,min:t}){let e=n.split("/").join(i);return Object.assign(Object.assign({},Ce),{mask:Array.from(e).map(o=>i.includes(o)?o:/\d/),overwriteMode:"replace",preprocessors:[Hr(),Ur(),Br({dateModeTemplate:e,dateSegmentsSeparator:i}),$r({dateModeTemplate:e,dateSegmentsSeparator:i})],postprocessors:[Lr({dateModeTemplate:e,dateSegmentSeparator:i,splitFn:o=>({dateStrings:[o]}),uniteFn:([o=""])=>o}),Nr({min:t,max:r,dateModeTemplate:e,dateSegmentSeparator:i})]})}var Yr=["type","range","tuiSlider",""];var Qr=7;function uo(n,i){let r=n.findIndex((o,a)=>a&&i(o)),t=n[r-1]||n[0],e=n[r]||n[n.length-1]||[0,0];return[t,e]}function Gr(n,i){let[[r,t],[e,o]]=uo(i,([u,C])=>n<=u),a=(n-r)/(e-r),s=(o-t)*a+t;return Tn(s,Qr)}function Kr(n,i){let[[r,t],[e,o]]=uo(i,([s,u])=>n<=u),a=(n-t)/(o-t)||0;return(e-r)*a+r}var qr={size:"m",trackColor:"var(--tui-background-neutral-2)"},Zr=K(qr);var Ke=(()=>{let i=class i{constructor(){var t;this.injector=f(ln),this.control=f(Lt,{self:!0,optional:!0}),this.options=f(Zr),this.size=this.options.size,this.segments=1,this.el=q(),this.control instanceof rt&&((t=this.control.valueChanges)==null||t.pipe(ce(),en(1)).subscribe())}get valueRatio(){return(this.value-this.min)/(this.max-this.min)||0}get min(){return Number(this.el.min)}get max(){return Number(this.el.max||100)}get value(){return!this.hasKeySteps&&this.control instanceof rt?this.control.viewModel:Number(this.el.value)||0}set value(t){this.el.value=`${t}`}get hasKeySteps(){return!!this.injector.get(Xr,null)}get segmentWidth(){return 100/Math.max(1,this.segments)}get step(){return Number(this.el.step)||1}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["input","type","range","tuiSlider",""]],hostVars:7,hostBindings:function(e,o){e&1&&v("input",function(){return 0}),e&2&&(k("data-size",o.size),D("--tui-slider-track-color",o.options.trackColor)("--tui-slider-segment-width",o.segmentWidth,"%")("--tui-slider-fill-ratio",o.valueRatio))},inputs:{size:"size",segments:"segments"},attrs:Yr,decls:0,vars:0,template:function(e,o){},styles:['[_nghost-%COMP%]{position:relative;display:block;inline-size:100%;color:var(--tui-background-accent-1);cursor:pointer;-webkit-appearance:none;appearance:none;block-size:.125rem;padding:.4375rem 0;background-color:transparent;background-clip:content-box;outline:none;border-radius:var(--tui-radius-m)}[_nghost-%COMP%]:active{cursor:ew-resize}[_nghost-%COMP%]:disabled{opacity:var(--tui-disabled-opacity);cursor:auto}[data-size=s][_nghost-%COMP%]:not(:disabled):before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:.25rem;left:calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * .5rem);inline-size:.5rem;block-size:.5rem;border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));content:"";cursor:ew-resize;background:currentColor;opacity:0}[data-size=s][_nghost-%COMP%]:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}[data-size=m][_nghost-%COMP%]:not(:disabled):before{transition-property:transform,opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:absolute;top:.125rem;left:calc(var(--tui-slider-fill-ratio) * 100% - var(--tui-slider-fill-ratio) * .75rem);inline-size:.75rem;block-size:.75rem;border-radius:50%;transform:var(--tui-slider-thumb-transform, scale(1));content:"";cursor:ew-resize;background:currentColor;opacity:0}[data-size=m][_nghost-%COMP%]:active:before{opacity:.2;transform:var(--tui-slider-thumb-transform, scale(1)) scale(2.33)}[_nghost-%COMP%]::-webkit-slider-container{border-radius:inherit}[data-size=m][_nghost-%COMP%]::-webkit-slider-runnable-track{block-size:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .5rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width)),linear-gradient(to right,currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio)));background-position-x:0,.25rem,0;background-size:calc(100% - .75rem),calc(100% - .75rem),auto}[data-size=s][_nghost-%COMP%]::-webkit-slider-runnable-track{block-size:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .375rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width)),linear-gradient(to right,currentColor calc(100% * var(--tui-slider-fill-ratio)),transparent calc(100% * var(--tui-slider-fill-ratio)));background-position-x:0,.125rem,0;background-size:calc(100% - .5rem),calc(100% - .5rem),auto}[data-size=m][_nghost-%COMP%]::-moz-range-track{block-size:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .5rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width));background-position-x:0,.25rem;background-size:calc(100% - .75rem)}[data-size=s][_nghost-%COMP%]::-moz-range-track{block-size:.125rem;border-radius:inherit;background-repeat:no-repeat;background-color:var(--tui-slider-track-color);background-image:linear-gradient(to right,currentColor 0px .375rem,transparent .25rem),repeating-linear-gradient(to right,var(--tui-text-tertiary) 0 .25rem,transparent 0 var(--tui-slider-segment-width));background-position-x:0,.125rem;background-size:calc(100% - .5rem)}[data-size=m][_nghost-%COMP%]::-webkit-slider-thumb{-webkit-transition-property:transform;transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:.75rem;inline-size:.75rem;box-sizing:content-box;background-clip:content-box;border:.125rem solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1));margin-top:-.4375rem}:not(:disabled)[data-size=m][_nghost-%COMP%]::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled)[data-size=m][_nghost-%COMP%]::-webkit-slider-thumb:hover, :active:not(:disabled)[data-size=m][_nghost-%COMP%]::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:focus-visible[data-size=m][_nghost-%COMP%]::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}[data-size=s][_nghost-%COMP%]::-webkit-slider-thumb{-webkit-transition-property:transform;transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:.5rem;inline-size:.5rem;box-sizing:content-box;background-clip:content-box;border:.25rem solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1));margin-top:-.4375rem}:not(:disabled)[data-size=s][_nghost-%COMP%]::-webkit-slider-thumb{cursor:ew-resize}:not(:disabled)[data-size=s][_nghost-%COMP%]::-webkit-slider-thumb:hover, :active:not(:disabled)[data-size=s][_nghost-%COMP%]::-webkit-slider-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.5)}:focus-visible[data-size=s][_nghost-%COMP%]::-webkit-slider-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}[data-size=m][_nghost-%COMP%]::-moz-range-thumb{-moz-transition-property:transform;transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:.75rem;inline-size:.75rem;box-sizing:content-box;background-clip:content-box;border:.125rem solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled)[data-size=m][_nghost-%COMP%]::-moz-range-thumb{cursor:ew-resize}:not(:disabled)[data-size=m][_nghost-%COMP%]::-moz-range-thumb:hover, :active:not(:disabled)[data-size=m][_nghost-%COMP%]::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.333)}:focus-visible[data-size=m][_nghost-%COMP%]::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}[data-size=s][_nghost-%COMP%]::-moz-range-thumb{-moz-transition-property:transform;transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;isolation:isolate;-webkit-appearance:none;appearance:none;background-color:currentColor;box-shadow:none;border-radius:50%;block-size:.5rem;inline-size:.5rem;box-sizing:content-box;background-clip:content-box;border:.25rem solid transparent;border-inline-start:0;border-inline-end:0;transform:var(--tui-slider-thumb-transform, scale(1))}:not(:disabled)[data-size=s][_nghost-%COMP%]::-moz-range-thumb{cursor:ew-resize}:not(:disabled)[data-size=s][_nghost-%COMP%]::-moz-range-thumb:hover, :active:not(:disabled)[data-size=s][_nghost-%COMP%]::-moz-range-thumb{transform:var(--tui-slider-thumb-transform, scale(1)) scale(1.5)}:focus-visible[data-size=s][_nghost-%COMP%]::-moz-range-thumb{box-shadow:0 0 0 2px inset var(--tui-border-focus)}[_nghost-%COMP%]::-moz-range-progress{border-radius:inherit}[_nghost-%COMP%]::-moz-range-progress{block-size:.125rem;background:currentColor;border-start-end-radius:0;border-end-end-radius:0}'],changeDetection:0});let n=i;return St([Nt],n.prototype,"hasKeySteps",null),n})(),Xr=(()=>{let i=class i extends ui{constructor(){super(...arguments),this.slider=f(ee(()=>Ke))}writeValue(t){if(t===null)return;let e=Pn(t,this.min,this.max);this.slider.value=this.transformToNativeValue(e)}get min(){return this.keySteps[0][1]}get max(){var t;return((t=this.keySteps[this.keySteps.length-1])==null?void 0:t[1])??0}updateControlValue(){this.onChange(Gr(this.slider.valueRatio*100,this.keySteps))}transformToNativeValue(t){let{min:e,max:o}=this.slider;return Kr(t,this.keySteps)*(o-e)/100+e}};i.\u0275fac=(()=>{let t;return function(o){return(t||(t=it(i)))(o||i)}})(),i.\u0275dir=j({type:i,selectors:[["input","tuiSlider","","keySteps",""]],hostVars:4,hostBindings:function(e,o){e&1&&v("blur",function(){return o.onTouched()})("input",function(){return o.updateControlValue()})("change",function(){return o.updateControlValue()}),e&2&&(vt("disabled",o.disabled()),k("aria-valuenow",o.value())("aria-valuemin",o.min)("aria-valuemax",o.max))},inputs:{keySteps:"keySteps"},features:[tt([ii(0)]),ot]});let n=i;return n})();var Jr=[[["img"]],[["tui-svg"],["tui-icon"]],"*",[["","tuiButton",""]],[["","tuiLink",""]]],ta=["img","tui-svg,tui-icon","*","[tuiButton]","[tuiLink]"];function ea(n,i){if(n&1){let r=M();p(0,"button",10),v("click",function(){g(r);let e=d();return h(e.close.emit())}),b(1),R(2,"async"),m()}if(n&2){let r=d();D("border-radius",100,"%"),l("iconStart",r.icons.close),c(),P(" ",U(2,4,r.closeWord$),` `)}}function na(n,i){if(n&1&&(w(0,"span",11),R(1,"tuiFormatDate"),R(2,"async")),n&2){let r=d();l("textContent",r.isString(r.timestamp)?r.timestamp:U(2,3,U(1,1,r.timestamp)))}}function ia(n,i){if(n&1&&w(0,"img",8),n&2){let r=d(2);l("src",r.context.image,dn)}}function oa(n,i){if(n&1&&w(0,"tui-icon",9),n&2){let r=d(2);D("color",r.context.iconColor),l("icon",r.context.icon)}}function ra(n,i){if(n&1&&w(0,"div",10),n&2){let r=i.polymorpheusOutlet;l("innerHTML",r,ne)}}function aa(n,i){if(n&1){let r=M();p(0,"button",11),v("click",function(){g(r);let e=d(2);return h(e.context.$implicit.next(e.context.buttons[0]||""))}),b(1),m()}if(n&2){let r=d(2);c(),P(" ",r.context.buttons[0]," ")}}function sa(n,i){if(n&1){let r=M();p(0,"button",12),v("click",function(){g(r);let e=d(2);return h(e.context.$implicit.next(e.context.buttons[e.context.buttons.length-1]||""))}),b(1),m()}if(n&2){let r=d(2);c(),P(" ",r.context.buttons[r.context.buttons.length-1]," ")}}function la(n,i){if(n&1){let r=M();p(0,"tui-push",2),v("close",function(){g(r);let e=d();return h(e.context.$implicit.complete())}),_(1,ia,1,1,"img",3)(2,oa,1,3,"tui-icon",4)(3,ra,1,1,"div",5)(4,aa,2,1,"button",6)(5,sa,2,1,"button",7),m()}if(n&2){let r=d();l("heading",r.context.heading)("timestamp",r.context.timestamp)("type",r.context.type),c(),l("ngIf",r.context.image),c(),l("ngIf",r.context.icon),c(),l("polymorpheusOutlet",r.context.content)("polymorpheusOutletContext",r.context),c(),l("ngIf",r.context.buttons.length>1),c(),l("ngIf",r.context.buttons.length)}}function ca(n,i){n&1&&Tt(0)}function ua(n,i){if(n&1&&_(0,ca,1,0,"ng-container",13),n&2){let r=d();l("polymorpheusOutlet",r.context.content)}}var qe=(()=>{let i=class i{constructor(){this.isString=dt,this.closeWord$=f(Yn),this.icons=f($t),this.heading="",this.type="",this.timestamp="",this.close=new V}};i.\u0275fac=function(e){return new(e||i)},i.\u0275cmp=O({type:i,selectors:[["tui-push"]],inputs:{heading:"heading",type:"type",timestamp:"timestamp"},outputs:{close:"close"},features:[tt([qn({size:"s",appearance:"secondary"})])],ngContentSelectors:ta,decls:17,vars:4,consts:[[1,"t-image"],["appearance","","size","xs","tuiIconButton","","type","button","class","t-close",3,"iconStart","border-radius","click",4,"ngIf"],[1,"t-top"],[1,"t-icon"],["class","t-time",3,"textContent",4,"ngIf"],["automation-id","tui-push__heading",1,"t-heading"],[1,"t-content"],[1,"t-actions"],[1,"t-button"],[1,"t-link"],["appearance","","size","xs","tuiIconButton","","type","button",1,"t-close",3,"click","iconStart"],[1,"t-time",3,"textContent"]],template:function(e,o){e&1&&(W(Jr),p(0,"div",0),I(1),m(),_(2,ea,3,6,"button",1),p(3,"div",2)(4,"span",3),I(5,1),m(),b(6),_(7,na,3,5,"span",4),m(),p(8,"h3",5),b(9),m(),p(10,"div",6),I(11,2),m(),p(12,"div",7)(13,"span",8),I(14,3),m(),p(15,"span",9),I(16,4),m()()),e&2&&(c(2),l("ngIf",o.close.observed),c(4),P(" ",o.type," "),c(),l("ngIf",o.timestamp),c(2),P(" ",o.heading,` @@ -7,4 +7,4 @@ import{a as Re,b as ai,d as hi,f as _i}from"./chunk-VI33G2S5.js";import{$a as vt `),m(),_(26,gs,8,0,"ng-template",null,1,G)(28,hs,7,0,"tui-push",18),w(29,"br"),p(30,"tui-accordion"),Ie(31,_s,3,2,"tui-accordion-item",19,ke),m()}if(e&2){let a=J(6);c(4),l("tuiHintContent",a)("tuiTextfieldLabelOutside",!0),Ct("ngModel",o.tags),c(5),Ct("ngModel",o.date),c(2),l("tuiDropdownOpen",!1)("value",o.date),c(2),De(o.labels),c(4),l("showIcons",!0),Ct("ngModel",o.notification),c(2),l("max",140),Ct("ngModel",o.slider),c(2),D("border-radius",100,"%"),c(),D("border-radius",100,"%"),c(),D("border-radius",100,"%"),c(),l("tools",o.builtInTools),Ct("ngModel",o.editor),c(4),l("tuiPush",o.notification),c(3),De(o.questions)}},dependencies:[lt,Ft,Rt,Mn,wn,Ht,On,rt,We,Xi,Ue,It,Wt,Ji,he,ji,fe,B,_o,fo,Oe,xo,yo,fi,Ot,qe,Ze,Ke,to,xe,Si],styles:[`.title{font-size:3.5rem;line-height:4.0625rem;margin:0}.t-overlay{display:none!important}.flex{display:flex;margin-bottom:1.5625rem}.date{inline-size:18rem;margin-right:2.8125rem}.calendar{box-shadow:var(var(--tui-shadow-small) -medium);border-radius:var(--tui-radius-m);border:.0625rem solid var(--tui-background-neutral-1-hover);margin-top:.25rem;inline-size:18rem;box-sizing:border-box;block-size:auto}.controls{flex:1;margin-left:2.8125rem}.icons{display:flex;justify-content:space-between}.button[data-size],.error[data-size]{transition-property:color,background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;background:var(--tui-background-base-alt);color:var(--tui-background-accent-1)}.button[data-size]:hover,.error[data-size]:hover,.button[data-size]:active,.error[data-size]:active{background:var(--tui-background-neutral-1-hover);color:var(--tui-background-accent-1-hover)}.error[data-size]{color:var(--tui-text-negative)}.error[data-size]:hover,.error[data-size]:active{color:var(--tui-text-negative-hover)}tui-dialog[data-appearance=call][data-size]{border-radius:.25rem;inline-size:25rem;padding:0;border:none;margin:1.25rem auto}tui-dialog[data-appearance=call][data-size]>.t-content{padding:.5rem 1rem;box-shadow:0 0 .1875rem #1f1f1f;--border-width: .1875rem}tui-dialog[data-appearance=call][data-size]>.t-content:after{content:"";position:absolute;top:calc(-1 * var(--border-width));left:calc(-1 * var(--border-width));z-index:-1;inline-size:calc(100% + var(--border-width) * 2);block-size:calc(100% + var(--border-width) * 2);background:linear-gradient(60deg,#5f86f2,#a65ff2,#f25fd0,#f25f61,#f2cb5f,#abf25f,#5ff281,#5ff2f0);background-size:300% 300%;background-position:0 50%;border-radius:calc(2 * var(--border-width));animation:moveGradient 4s alternate infinite}tui-dialog[data-appearance=call][data-size]>.t-filler,tui-dialog[data-appearance=call][data-size]:after{display:none}tui-dialog[data-appearance=call][data-size] .call{display:flex;align-items:center;justify-content:space-between}tui-dialog[data-appearance=call][data-size] .person{display:flex;align-items:center;gap:.625rem}tui-dialog[data-appearance=call][data-size] .person img{inline-size:2.25rem;border-radius:.625rem;border:.0625rem solid var(--tui-border-hover)}tui-dialog[data-appearance=call][data-size] .missed,tui-dialog[data-appearance=call][data-size] .income{border-radius:50%;color:#fff}tui-dialog[data-appearance=call][data-size] .missed[data-appearance=custom]{background:#d23a47;transform:rotate(135deg)}tui-dialog[data-appearance=call][data-size] .income[data-appearance=custom]{background:#27bb64}tui-dialog[data-appearance=call][data-size] .buttons{display:flex;gap:.625rem}.label{display:flex}@keyframes moveGradient{50%{background-position:100% 50%}} /*# sourceMappingURL=home.component-5Z7J7IY4.css.map */ `],encapsulation:2,changeDetection:0});let n=i;return n})();export{Vp as default}; -//# sourceMappingURL=chunk-2MGINT6C.js.map +//# sourceMappingURL=chunk-4FJ4CVJB.js.map diff --git a/chunk-2MGINT6C.js.map b/chunk-4FJ4CVJB.js.map similarity index 100% rename from chunk-2MGINT6C.js.map rename to chunk-4FJ4CVJB.js.map diff --git a/chunk-5XJ3NODC.js.map b/chunk-5XJ3NODC.js.map deleted file mode 100644 index d5e25997..00000000 --- a/chunk-5XJ3NODC.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["node_modules/orderedmap/dist/index.js","node_modules/prosemirror-model/dist/index.js","node_modules/prosemirror-transform/dist/index.js","node_modules/prosemirror-state/dist/index.js","node_modules/prosemirror-view/dist/index.js","node_modules/w3c-keyname/index.js","node_modules/prosemirror-keymap/dist/index.js","node_modules/prosemirror-commands/dist/index.js","node_modules/prosemirror-schema-list/dist/index.js","node_modules/@tiptap/core/dist/index.js"],"sourcesContent":["// ::- Persistent data structure representing an ordered mapping from\n// strings to values, with some convenient update methods.\nfunction OrderedMap(content) {\n this.content = content;\n}\nOrderedMap.prototype = {\n constructor: OrderedMap,\n find: function (key) {\n for (var i = 0; i < this.content.length; i += 2) if (this.content[i] === key) return i;\n return -1;\n },\n // :: (string) → ?any\n // Retrieve the value stored under `key`, or return undefined when\n // no such key exists.\n get: function (key) {\n var found = this.find(key);\n return found == -1 ? undefined : this.content[found + 1];\n },\n // :: (string, any, ?string) → OrderedMap\n // Create a new map by replacing the value of `key` with a new\n // value, or adding a binding to the end of the map. If `newKey` is\n // given, the key of the binding will be replaced with that key.\n update: function (key, value, newKey) {\n var self = newKey && newKey != key ? this.remove(newKey) : this;\n var found = self.find(key),\n content = self.content.slice();\n if (found == -1) {\n content.push(newKey || key, value);\n } else {\n content[found + 1] = value;\n if (newKey) content[found] = newKey;\n }\n return new OrderedMap(content);\n },\n // :: (string) → OrderedMap\n // Return a map with the given key removed, if it existed.\n remove: function (key) {\n var found = this.find(key);\n if (found == -1) return this;\n var content = this.content.slice();\n content.splice(found, 2);\n return new OrderedMap(content);\n },\n // :: (string, any) → OrderedMap\n // Add a new key to the start of the map.\n addToStart: function (key, value) {\n return new OrderedMap([key, value].concat(this.remove(key).content));\n },\n // :: (string, any) → OrderedMap\n // Add a new key to the end of the map.\n addToEnd: function (key, value) {\n var content = this.remove(key).content.slice();\n content.push(key, value);\n return new OrderedMap(content);\n },\n // :: (string, string, any) → OrderedMap\n // Add a key after the given key. If `place` is not found, the new\n // key is added to the end.\n addBefore: function (place, key, value) {\n var without = this.remove(key),\n content = without.content.slice();\n var found = without.find(place);\n content.splice(found == -1 ? content.length : found, 0, key, value);\n return new OrderedMap(content);\n },\n // :: ((key: string, value: any))\n // Call the given function for each key/value pair in the map, in\n // order.\n forEach: function (f) {\n for (var i = 0; i < this.content.length; i += 2) f(this.content[i], this.content[i + 1]);\n },\n // :: (union) → OrderedMap\n // Create a new map by prepending the keys in this map that don't\n // appear in `map` before the keys in `map`.\n prepend: function (map) {\n map = OrderedMap.from(map);\n if (!map.size) return this;\n return new OrderedMap(map.content.concat(this.subtract(map).content));\n },\n // :: (union) → OrderedMap\n // Create a new map by appending the keys in this map that don't\n // appear in `map` after the keys in `map`.\n append: function (map) {\n map = OrderedMap.from(map);\n if (!map.size) return this;\n return new OrderedMap(this.subtract(map).content.concat(map.content));\n },\n // :: (union) → OrderedMap\n // Create a map containing all the keys in this map that don't\n // appear in `map`.\n subtract: function (map) {\n var result = this;\n map = OrderedMap.from(map);\n for (var i = 0; i < map.content.length; i += 2) result = result.remove(map.content[i]);\n return result;\n },\n // :: () → Object\n // Turn ordered map into a plain object.\n toObject: function () {\n var result = {};\n this.forEach(function (key, value) {\n result[key] = value;\n });\n return result;\n },\n // :: number\n // The amount of keys in this map.\n get size() {\n return this.content.length >> 1;\n }\n};\n\n// :: (?union) → OrderedMap\n// Return a map with the given content. If null, create an empty\n// map. If given an ordered map, return that map itself. If given an\n// object, create a map from the object's properties.\nOrderedMap.from = function (value) {\n if (value instanceof OrderedMap) return value;\n var content = [];\n if (value) for (var prop in value) content.push(prop, value[prop]);\n return new OrderedMap(content);\n};\nexport default OrderedMap;","import OrderedMap from 'orderedmap';\nfunction findDiffStart(a, b, pos) {\n for (let i = 0;; i++) {\n if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;\n let childA = a.child(i),\n childB = b.child(i);\n if (childA == childB) {\n pos += childA.nodeSize;\n continue;\n }\n if (!childA.sameMarkup(childB)) return pos;\n if (childA.isText && childA.text != childB.text) {\n for (let j = 0; childA.text[j] == childB.text[j]; j++) pos++;\n return pos;\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffStart(childA.content, childB.content, pos + 1);\n if (inner != null) return inner;\n }\n pos += childA.nodeSize;\n }\n}\nfunction findDiffEnd(a, b, posA, posB) {\n for (let iA = a.childCount, iB = b.childCount;;) {\n if (iA == 0 || iB == 0) return iA == iB ? null : {\n a: posA,\n b: posB\n };\n let childA = a.child(--iA),\n childB = b.child(--iB),\n size = childA.nodeSize;\n if (childA == childB) {\n posA -= size;\n posB -= size;\n continue;\n }\n if (!childA.sameMarkup(childB)) return {\n a: posA,\n b: posB\n };\n if (childA.isText && childA.text != childB.text) {\n let same = 0,\n minSize = Math.min(childA.text.length, childB.text.length);\n while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {\n same++;\n posA--;\n posB--;\n }\n return {\n a: posA,\n b: posB\n };\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);\n if (inner) return inner;\n }\n posA -= size;\n posB -= size;\n }\n}\n\n/**\nA fragment represents a node's collection of child nodes.\n\nLike nodes, fragments are persistent data structures, and you\nshould not mutate them or their content. Rather, you create new\ninstances whenever needed. The API tries to make this easy.\n*/\nclass Fragment {\n /**\n @internal\n */\n constructor(\n /**\n The child nodes in this fragment.\n */\n content, size) {\n this.content = content;\n this.size = size || 0;\n if (size == null) for (let i = 0; i < content.length; i++) this.size += content[i].nodeSize;\n }\n /**\n Invoke a callback for all descendant nodes between the given two\n positions (relative to start of this fragment). Doesn't descend\n into a node when the callback returns `false`.\n */\n nodesBetween(from, to, f, nodeStart = 0, parent) {\n for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i],\n end = pos + child.nodeSize;\n if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {\n let start = pos + 1;\n child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);\n }\n pos = end;\n }\n }\n /**\n Call the given callback for every descendant node. `pos` will be\n relative to the start of the fragment. The callback may return\n `false` to prevent traversal of a given node's children.\n */\n descendants(f) {\n this.nodesBetween(0, this.size, f);\n }\n /**\n Extract the text between `from` and `to`. See the same method on\n [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).\n */\n textBetween(from, to, blockSeparator, leafText) {\n let text = \"\",\n first = true;\n this.nodesBetween(from, to, (node, pos) => {\n let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos) : !node.isLeaf ? \"\" : leafText ? typeof leafText === \"function\" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : \"\";\n if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {\n if (first) first = false;else text += blockSeparator;\n }\n text += nodeText;\n }, 0);\n return text;\n }\n /**\n Create a new fragment containing the combined content of this\n fragment and the other.\n */\n append(other) {\n if (!other.size) return this;\n if (!this.size) return other;\n let last = this.lastChild,\n first = other.firstChild,\n content = this.content.slice(),\n i = 0;\n if (last.isText && last.sameMarkup(first)) {\n content[content.length - 1] = last.withText(last.text + first.text);\n i = 1;\n }\n for (; i < other.content.length; i++) content.push(other.content[i]);\n return new Fragment(content, this.size + other.size);\n }\n /**\n Cut out the sub-fragment between the two given positions.\n */\n cut(from, to = this.size) {\n if (from == 0 && to == this.size) return this;\n let result = [],\n size = 0;\n if (to > from) for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i],\n end = pos + child.nodeSize;\n if (end > from) {\n if (pos < from || end > to) {\n if (child.isText) child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));else child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));\n }\n result.push(child);\n size += child.nodeSize;\n }\n pos = end;\n }\n return new Fragment(result, size);\n }\n /**\n @internal\n */\n cutByIndex(from, to) {\n if (from == to) return Fragment.empty;\n if (from == 0 && to == this.content.length) return this;\n return new Fragment(this.content.slice(from, to));\n }\n /**\n Create a new fragment in which the node at the given index is\n replaced by the given node.\n */\n replaceChild(index, node) {\n let current = this.content[index];\n if (current == node) return this;\n let copy = this.content.slice();\n let size = this.size + node.nodeSize - current.nodeSize;\n copy[index] = node;\n return new Fragment(copy, size);\n }\n /**\n Create a new fragment by prepending the given node to this\n fragment.\n */\n addToStart(node) {\n return new Fragment([node].concat(this.content), this.size + node.nodeSize);\n }\n /**\n Create a new fragment by appending the given node to this\n fragment.\n */\n addToEnd(node) {\n return new Fragment(this.content.concat(node), this.size + node.nodeSize);\n }\n /**\n Compare this fragment to another one.\n */\n eq(other) {\n if (this.content.length != other.content.length) return false;\n for (let i = 0; i < this.content.length; i++) if (!this.content[i].eq(other.content[i])) return false;\n return true;\n }\n /**\n The first child of the fragment, or `null` if it is empty.\n */\n get firstChild() {\n return this.content.length ? this.content[0] : null;\n }\n /**\n The last child of the fragment, or `null` if it is empty.\n */\n get lastChild() {\n return this.content.length ? this.content[this.content.length - 1] : null;\n }\n /**\n The number of child nodes in this fragment.\n */\n get childCount() {\n return this.content.length;\n }\n /**\n Get the child node at the given index. Raise an error when the\n index is out of range.\n */\n child(index) {\n let found = this.content[index];\n if (!found) throw new RangeError(\"Index \" + index + \" out of range for \" + this);\n return found;\n }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) {\n return this.content[index] || null;\n }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) {\n for (let i = 0, p = 0; i < this.content.length; i++) {\n let child = this.content[i];\n f(child, p, i);\n p += child.nodeSize;\n }\n }\n /**\n Find the first position at which this fragment and another\n fragment differ, or `null` if they are the same.\n */\n findDiffStart(other, pos = 0) {\n return findDiffStart(this, other, pos);\n }\n /**\n Find the first position, searching from the end, at which this\n fragment and the given fragment differ, or `null` if they are\n the same. Since this position will not be the same in both\n nodes, an object with two separate positions is returned.\n */\n findDiffEnd(other, pos = this.size, otherPos = other.size) {\n return findDiffEnd(this, other, pos, otherPos);\n }\n /**\n Find the index and inner offset corresponding to a given relative\n position in this fragment. The result object will be reused\n (overwritten) the next time the function is called. @internal\n */\n findIndex(pos, round = -1) {\n if (pos == 0) return retIndex(0, pos);\n if (pos == this.size) return retIndex(this.content.length, pos);\n if (pos > this.size || pos < 0) throw new RangeError(`Position ${pos} outside of fragment (${this})`);\n for (let i = 0, curPos = 0;; i++) {\n let cur = this.child(i),\n end = curPos + cur.nodeSize;\n if (end >= pos) {\n if (end == pos || round > 0) return retIndex(i + 1, end);\n return retIndex(i, curPos);\n }\n curPos = end;\n }\n }\n /**\n Return a debugging string that describes this fragment.\n */\n toString() {\n return \"<\" + this.toStringInner() + \">\";\n }\n /**\n @internal\n */\n toStringInner() {\n return this.content.join(\", \");\n }\n /**\n Create a JSON-serializeable representation of this fragment.\n */\n toJSON() {\n return this.content.length ? this.content.map(n => n.toJSON()) : null;\n }\n /**\n Deserialize a fragment from its JSON representation.\n */\n static fromJSON(schema, value) {\n if (!value) return Fragment.empty;\n if (!Array.isArray(value)) throw new RangeError(\"Invalid input for Fragment.fromJSON\");\n return new Fragment(value.map(schema.nodeFromJSON));\n }\n /**\n Build a fragment from an array of nodes. Ensures that adjacent\n text nodes with the same marks are joined together.\n */\n static fromArray(array) {\n if (!array.length) return Fragment.empty;\n let joined,\n size = 0;\n for (let i = 0; i < array.length; i++) {\n let node = array[i];\n size += node.nodeSize;\n if (i && node.isText && array[i - 1].sameMarkup(node)) {\n if (!joined) joined = array.slice(0, i);\n joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);\n } else if (joined) {\n joined.push(node);\n }\n }\n return new Fragment(joined || array, size);\n }\n /**\n Create a fragment from something that can be interpreted as a\n set of nodes. For `null`, it returns the empty fragment. For a\n fragment, the fragment itself. For a node or array of nodes, a\n fragment containing those nodes.\n */\n static from(nodes) {\n if (!nodes) return Fragment.empty;\n if (nodes instanceof Fragment) return nodes;\n if (Array.isArray(nodes)) return this.fromArray(nodes);\n if (nodes.attrs) return new Fragment([nodes], nodes.nodeSize);\n throw new RangeError(\"Can not convert \" + nodes + \" to a Fragment\" + (nodes.nodesBetween ? \" (looks like multiple versions of prosemirror-model were loaded)\" : \"\"));\n }\n}\n/**\nAn empty fragment. Intended to be reused whenever a node doesn't\ncontain anything (rather than allocating a new empty fragment for\neach leaf node).\n*/\nFragment.empty = new Fragment([], 0);\nconst found = {\n index: 0,\n offset: 0\n};\nfunction retIndex(index, offset) {\n found.index = index;\n found.offset = offset;\n return found;\n}\nfunction compareDeep(a, b) {\n if (a === b) return true;\n if (!(a && typeof a == \"object\") || !(b && typeof b == \"object\")) return false;\n let array = Array.isArray(a);\n if (Array.isArray(b) != array) return false;\n if (array) {\n if (a.length != b.length) return false;\n for (let i = 0; i < a.length; i++) if (!compareDeep(a[i], b[i])) return false;\n } else {\n for (let p in a) if (!(p in b) || !compareDeep(a[p], b[p])) return false;\n for (let p in b) if (!(p in a)) return false;\n }\n return true;\n}\n\n/**\nA mark is a piece of information that can be attached to a node,\nsuch as it being emphasized, in code font, or a link. It has a\ntype and optionally a set of attributes that provide further\ninformation (such as the target of the link). Marks are created\nthrough a `Schema`, which controls which types exist and which\nattributes they have.\n*/\nlet Mark = /*#__PURE__*/(() => {\n class Mark {\n /**\n @internal\n */\n constructor(\n /**\n The type of this mark.\n */\n type,\n /**\n The attributes associated with this mark.\n */\n attrs) {\n this.type = type;\n this.attrs = attrs;\n }\n /**\n Given a set of marks, create a new set which contains this one as\n well, in the right position. If this mark is already in the set,\n the set itself is returned. If any marks that are set to be\n [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,\n those are replaced by this one.\n */\n addToSet(set) {\n let copy,\n placed = false;\n for (let i = 0; i < set.length; i++) {\n let other = set[i];\n if (this.eq(other)) return set;\n if (this.type.excludes(other.type)) {\n if (!copy) copy = set.slice(0, i);\n } else if (other.type.excludes(this.type)) {\n return set;\n } else {\n if (!placed && other.type.rank > this.type.rank) {\n if (!copy) copy = set.slice(0, i);\n copy.push(this);\n placed = true;\n }\n if (copy) copy.push(other);\n }\n }\n if (!copy) copy = set.slice();\n if (!placed) copy.push(this);\n return copy;\n }\n /**\n Remove this mark from the given set, returning a new set. If this\n mark is not in the set, the set itself is returned.\n */\n removeFromSet(set) {\n for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return set.slice(0, i).concat(set.slice(i + 1));\n return set;\n }\n /**\n Test whether this mark is in the given set of marks.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return true;\n return false;\n }\n /**\n Test whether this mark has the same type and attributes as\n another mark.\n */\n eq(other) {\n return this == other || this.type == other.type && compareDeep(this.attrs, other.attrs);\n }\n /**\n Convert this mark to a JSON-serializeable representation.\n */\n toJSON() {\n let obj = {\n type: this.type.name\n };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n return obj;\n }\n /**\n Deserialize a mark from JSON.\n */\n static fromJSON(schema, json) {\n if (!json) throw new RangeError(\"Invalid input for Mark.fromJSON\");\n let type = schema.marks[json.type];\n if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);\n let mark = type.create(json.attrs);\n type.checkAttrs(mark.attrs);\n return mark;\n }\n /**\n Test whether two sets of marks are identical.\n */\n static sameSet(a, b) {\n if (a == b) return true;\n if (a.length != b.length) return false;\n for (let i = 0; i < a.length; i++) if (!a[i].eq(b[i])) return false;\n return true;\n }\n /**\n Create a properly sorted mark set from null, a single mark, or an\n unsorted array of marks.\n */\n static setFrom(marks) {\n if (!marks || Array.isArray(marks) && marks.length == 0) return Mark.none;\n if (marks instanceof Mark) return [marks];\n let copy = marks.slice();\n copy.sort((a, b) => a.type.rank - b.type.rank);\n return copy;\n }\n }\n /**\n The empty set of marks.\n */\n Mark.none = [];\n\n /**\n Error type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when\n given an invalid replacement.\n */\n return Mark;\n})();\nclass ReplaceError extends Error {}\n/*\nReplaceError = function(this: any, message: string) {\n let err = Error.call(this, message)\n ;(err as any).__proto__ = ReplaceError.prototype\n return err\n} as any\n\nReplaceError.prototype = Object.create(Error.prototype)\nReplaceError.prototype.constructor = ReplaceError\nReplaceError.prototype.name = \"ReplaceError\"\n*/\n/**\nA slice represents a piece cut out of a larger document. It\nstores not only a fragment, but also the depth up to which nodes on\nboth side are ‘open’ (cut through).\n*/\nclass Slice {\n /**\n Create a slice. When specifying a non-zero open depth, you must\n make sure that there are nodes of at least that depth at the\n appropriate side of the fragment—i.e. if the fragment is an\n empty paragraph node, `openStart` and `openEnd` can't be greater\n than 1.\n \n It is not necessary for the content of open nodes to conform to\n the schema's content constraints, though it should be a valid\n start/end/middle for such a node, depending on which sides are\n open.\n */\n constructor(\n /**\n The slice's content.\n */\n content,\n /**\n The open depth at the start of the fragment.\n */\n openStart,\n /**\n The open depth at the end.\n */\n openEnd) {\n this.content = content;\n this.openStart = openStart;\n this.openEnd = openEnd;\n }\n /**\n The size this slice would add when inserted into a document.\n */\n get size() {\n return this.content.size - this.openStart - this.openEnd;\n }\n /**\n @internal\n */\n insertAt(pos, fragment) {\n let content = insertInto(this.content, pos + this.openStart, fragment);\n return content && new Slice(content, this.openStart, this.openEnd);\n }\n /**\n @internal\n */\n removeBetween(from, to) {\n return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);\n }\n /**\n Tests whether this slice is equal to another slice.\n */\n eq(other) {\n return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;\n }\n /**\n @internal\n */\n toString() {\n return this.content + \"(\" + this.openStart + \",\" + this.openEnd + \")\";\n }\n /**\n Convert a slice to a JSON-serializable representation.\n */\n toJSON() {\n if (!this.content.size) return null;\n let json = {\n content: this.content.toJSON()\n };\n if (this.openStart > 0) json.openStart = this.openStart;\n if (this.openEnd > 0) json.openEnd = this.openEnd;\n return json;\n }\n /**\n Deserialize a slice from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json) return Slice.empty;\n let openStart = json.openStart || 0,\n openEnd = json.openEnd || 0;\n if (typeof openStart != \"number\" || typeof openEnd != \"number\") throw new RangeError(\"Invalid input for Slice.fromJSON\");\n return new Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);\n }\n /**\n Create a slice from a fragment by taking the maximum possible\n open value on both side of the fragment.\n */\n static maxOpen(fragment, openIsolating = true) {\n let openStart = 0,\n openEnd = 0;\n for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) openStart++;\n for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild) openEnd++;\n return new Slice(fragment, openStart, openEnd);\n }\n}\n/**\nThe empty slice.\n*/\nSlice.empty = new Slice(Fragment.empty, 0, 0);\nfunction removeRange(content, from, to) {\n let {\n index,\n offset\n } = content.findIndex(from),\n child = content.maybeChild(index);\n let {\n index: indexTo,\n offset: offsetTo\n } = content.findIndex(to);\n if (offset == from || child.isText) {\n if (offsetTo != to && !content.child(indexTo).isText) throw new RangeError(\"Removing non-flat range\");\n return content.cut(0, from).append(content.cut(to));\n }\n if (index != indexTo) throw new RangeError(\"Removing non-flat range\");\n return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));\n}\nfunction insertInto(content, dist, insert, parent) {\n let {\n index,\n offset\n } = content.findIndex(dist),\n child = content.maybeChild(index);\n if (offset == dist || child.isText) {\n if (parent && !parent.canReplace(index, index, insert)) return null;\n return content.cut(0, dist).append(insert).append(content.cut(dist));\n }\n let inner = insertInto(child.content, dist - offset - 1, insert);\n return inner && content.replaceChild(index, child.copy(inner));\n}\nfunction replace($from, $to, slice) {\n if (slice.openStart > $from.depth) throw new ReplaceError(\"Inserted content deeper than insertion position\");\n if ($from.depth - slice.openStart != $to.depth - slice.openEnd) throw new ReplaceError(\"Inconsistent open depths\");\n return replaceOuter($from, $to, slice, 0);\n}\nfunction replaceOuter($from, $to, slice, depth) {\n let index = $from.index(depth),\n node = $from.node(depth);\n if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {\n let inner = replaceOuter($from, $to, slice, depth + 1);\n return node.copy(node.content.replaceChild(index, inner));\n } else if (!slice.content.size) {\n return close(node, replaceTwoWay($from, $to, depth));\n } else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) {\n // Simple, flat case\n let parent = $from.parent,\n content = parent.content;\n return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));\n } else {\n let {\n start,\n end\n } = prepareSliceForReplace(slice, $from);\n return close(node, replaceThreeWay($from, start, end, $to, depth));\n }\n}\nfunction checkJoin(main, sub) {\n if (!sub.type.compatibleContent(main.type)) throw new ReplaceError(\"Cannot join \" + sub.type.name + \" onto \" + main.type.name);\n}\nfunction joinable($before, $after, depth) {\n let node = $before.node(depth);\n checkJoin(node, $after.node(depth));\n return node;\n}\nfunction addNode(child, target) {\n let last = target.length - 1;\n if (last >= 0 && child.isText && child.sameMarkup(target[last])) target[last] = child.withText(target[last].text + child.text);else target.push(child);\n}\nfunction addRange($start, $end, depth, target) {\n let node = ($end || $start).node(depth);\n let startIndex = 0,\n endIndex = $end ? $end.index(depth) : node.childCount;\n if ($start) {\n startIndex = $start.index(depth);\n if ($start.depth > depth) {\n startIndex++;\n } else if ($start.textOffset) {\n addNode($start.nodeAfter, target);\n startIndex++;\n }\n }\n for (let i = startIndex; i < endIndex; i++) addNode(node.child(i), target);\n if ($end && $end.depth == depth && $end.textOffset) addNode($end.nodeBefore, target);\n}\nfunction close(node, content) {\n node.type.checkContent(content);\n return node.copy(content);\n}\nfunction replaceThreeWay($from, $start, $end, $to, depth) {\n let openStart = $from.depth > depth && joinable($from, $start, depth + 1);\n let openEnd = $to.depth > depth && joinable($end, $to, depth + 1);\n let content = [];\n addRange(null, $from, depth, content);\n if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {\n checkJoin(openStart, openEnd);\n addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);\n } else {\n if (openStart) addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);\n addRange($start, $end, depth, content);\n if (openEnd) addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction replaceTwoWay($from, $to, depth) {\n let content = [];\n addRange(null, $from, depth, content);\n if ($from.depth > depth) {\n let type = joinable($from, $to, depth + 1);\n addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction prepareSliceForReplace(slice, $along) {\n let extra = $along.depth - slice.openStart,\n parent = $along.node(extra);\n let node = parent.copy(slice.content);\n for (let i = extra - 1; i >= 0; i--) node = $along.node(i).copy(Fragment.from(node));\n return {\n start: node.resolveNoCache(slice.openStart + extra),\n end: node.resolveNoCache(node.content.size - slice.openEnd - extra)\n };\n}\n\n/**\nYou can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more\ninformation about it. Objects of this class represent such a\nresolved position, providing various pieces of context\ninformation, and some helper methods.\n\nThroughout this interface, methods that take an optional `depth`\nparameter will interpret undefined as `this.depth` and negative\nnumbers as `this.depth + value`.\n*/\nclass ResolvedPos {\n /**\n @internal\n */\n constructor(\n /**\n The position that was resolved.\n */\n pos,\n /**\n @internal\n */\n path,\n /**\n The offset this position has into its parent node.\n */\n parentOffset) {\n this.pos = pos;\n this.path = path;\n this.parentOffset = parentOffset;\n this.depth = path.length / 3 - 1;\n }\n /**\n @internal\n */\n resolveDepth(val) {\n if (val == null) return this.depth;\n if (val < 0) return this.depth + val;\n return val;\n }\n /**\n The parent node that the position points into. Note that even if\n a position points into a text node, that node is not considered\n the parent—text nodes are ‘flat’ in this model, and have no content.\n */\n get parent() {\n return this.node(this.depth);\n }\n /**\n The root node in which the position was resolved.\n */\n get doc() {\n return this.node(0);\n }\n /**\n The ancestor node at the given level. `p.node(p.depth)` is the\n same as `p.parent`.\n */\n node(depth) {\n return this.path[this.resolveDepth(depth) * 3];\n }\n /**\n The index into the ancestor at the given level. If this points\n at the 3rd node in the 2nd paragraph on the top level, for\n example, `p.index(0)` is 1 and `p.index(1)` is 2.\n */\n index(depth) {\n return this.path[this.resolveDepth(depth) * 3 + 1];\n }\n /**\n The index pointing after this position into the ancestor at the\n given level.\n */\n indexAfter(depth) {\n depth = this.resolveDepth(depth);\n return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);\n }\n /**\n The (absolute) position at the start of the node at the given\n level.\n */\n start(depth) {\n depth = this.resolveDepth(depth);\n return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n }\n /**\n The (absolute) position at the end of the node at the given\n level.\n */\n end(depth) {\n depth = this.resolveDepth(depth);\n return this.start(depth) + this.node(depth).content.size;\n }\n /**\n The (absolute) position directly before the wrapping node at the\n given level, or, when `depth` is `this.depth + 1`, the original\n position.\n */\n before(depth) {\n depth = this.resolveDepth(depth);\n if (!depth) throw new RangeError(\"There is no position before the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];\n }\n /**\n The (absolute) position directly after the wrapping node at the\n given level, or the original position when `depth` is `this.depth + 1`.\n */\n after(depth) {\n depth = this.resolveDepth(depth);\n if (!depth) throw new RangeError(\"There is no position after the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;\n }\n /**\n When this position points into a text node, this returns the\n distance between the position and the start of the text node.\n Will be zero for positions that point between nodes.\n */\n get textOffset() {\n return this.pos - this.path[this.path.length - 1];\n }\n /**\n Get the node directly after the position, if any. If the position\n points into a text node, only the part of that node after the\n position is returned.\n */\n get nodeAfter() {\n let parent = this.parent,\n index = this.index(this.depth);\n if (index == parent.childCount) return null;\n let dOff = this.pos - this.path[this.path.length - 1],\n child = parent.child(index);\n return dOff ? parent.child(index).cut(dOff) : child;\n }\n /**\n Get the node directly before the position, if any. If the\n position points into a text node, only the part of that node\n before the position is returned.\n */\n get nodeBefore() {\n let index = this.index(this.depth);\n let dOff = this.pos - this.path[this.path.length - 1];\n if (dOff) return this.parent.child(index).cut(0, dOff);\n return index == 0 ? null : this.parent.child(index - 1);\n }\n /**\n Get the position at the given index in the parent node at the\n given depth (which defaults to `this.depth`).\n */\n posAtIndex(index, depth) {\n depth = this.resolveDepth(depth);\n let node = this.path[depth * 3],\n pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n for (let i = 0; i < index; i++) pos += node.child(i).nodeSize;\n return pos;\n }\n /**\n Get the marks at this position, factoring in the surrounding\n marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the\n position is at the start of a non-empty node, the marks of the\n node after it (if any) are returned.\n */\n marks() {\n let parent = this.parent,\n index = this.index();\n // In an empty parent, return the empty array\n if (parent.content.size == 0) return Mark.none;\n // When inside a text node, just return the text node's marks\n if (this.textOffset) return parent.child(index).marks;\n let main = parent.maybeChild(index - 1),\n other = parent.maybeChild(index);\n // If the `after` flag is true of there is no node before, make\n // the node after this position the main reference.\n if (!main) {\n let tmp = main;\n main = other;\n other = tmp;\n }\n // Use all marks in the main node, except those that have\n // `inclusive` set to false and are not present in the other node.\n let marks = main.marks;\n for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks))) marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n Get the marks after the current position, if any, except those\n that are non-inclusive and not present at position `$end`. This\n is mostly useful for getting the set of marks to preserve after a\n deletion. Will return `null` if this position is at the end of\n its parent node or its parent node isn't a textblock (in which\n case no marks should be preserved).\n */\n marksAcross($end) {\n let after = this.parent.maybeChild(this.index());\n if (!after || !after.isInline) return null;\n let marks = after.marks,\n next = $end.parent.maybeChild($end.index());\n for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks))) marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n The depth up to which this position and the given (non-resolved)\n position share the same parent nodes.\n */\n sharedDepth(pos) {\n for (let depth = this.depth; depth > 0; depth--) if (this.start(depth) <= pos && this.end(depth) >= pos) return depth;\n return 0;\n }\n /**\n Returns a range based on the place where this position and the\n given position diverge around block content. If both point into\n the same textblock, for example, a range around that textblock\n will be returned. If they point into different blocks, the range\n around those blocks in their shared ancestor is returned. You can\n pass in an optional predicate that will be called with a parent\n node to see if a range into that parent is acceptable.\n */\n blockRange(other = this, pred) {\n if (other.pos < this.pos) return other.blockRange(this);\n for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--) if (other.pos <= this.end(d) && (!pred || pred(this.node(d)))) return new NodeRange(this, other, d);\n return null;\n }\n /**\n Query whether the given position shares the same parent node.\n */\n sameParent(other) {\n return this.pos - this.parentOffset == other.pos - other.parentOffset;\n }\n /**\n Return the greater of this and the given position.\n */\n max(other) {\n return other.pos > this.pos ? other : this;\n }\n /**\n Return the smaller of this and the given position.\n */\n min(other) {\n return other.pos < this.pos ? other : this;\n }\n /**\n @internal\n */\n toString() {\n let str = \"\";\n for (let i = 1; i <= this.depth; i++) str += (str ? \"/\" : \"\") + this.node(i).type.name + \"_\" + this.index(i - 1);\n return str + \":\" + this.parentOffset;\n }\n /**\n @internal\n */\n static resolve(doc, pos) {\n if (!(pos >= 0 && pos <= doc.content.size)) throw new RangeError(\"Position \" + pos + \" out of range\");\n let path = [];\n let start = 0,\n parentOffset = pos;\n for (let node = doc;;) {\n let {\n index,\n offset\n } = node.content.findIndex(parentOffset);\n let rem = parentOffset - offset;\n path.push(node, index, start + offset);\n if (!rem) break;\n node = node.child(index);\n if (node.isText) break;\n parentOffset = rem - 1;\n start += offset + 1;\n }\n return new ResolvedPos(pos, path, parentOffset);\n }\n /**\n @internal\n */\n static resolveCached(doc, pos) {\n let cache = resolveCache.get(doc);\n if (cache) {\n for (let i = 0; i < cache.elts.length; i++) {\n let elt = cache.elts[i];\n if (elt.pos == pos) return elt;\n }\n } else {\n resolveCache.set(doc, cache = new ResolveCache());\n }\n let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);\n cache.i = (cache.i + 1) % resolveCacheSize;\n return result;\n }\n}\nclass ResolveCache {\n constructor() {\n this.elts = [];\n this.i = 0;\n }\n}\nconst resolveCacheSize = 12,\n resolveCache = new WeakMap();\n/**\nRepresents a flat range of content, i.e. one that starts and\nends in the same node.\n*/\nclass NodeRange {\n /**\n Construct a node range. `$from` and `$to` should point into the\n same node until at least the given `depth`, since a node range\n denotes an adjacent set of nodes in a single parent node.\n */\n constructor(\n /**\n A resolved position along the start of the content. May have a\n `depth` greater than this object's `depth` property, since\n these are the positions that were used to compute the range,\n not re-resolved positions directly at its boundaries.\n */\n $from,\n /**\n A position along the end of the content. See\n caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from).\n */\n $to,\n /**\n The depth of the node that this range points into.\n */\n depth) {\n this.$from = $from;\n this.$to = $to;\n this.depth = depth;\n }\n /**\n The position at the start of the range.\n */\n get start() {\n return this.$from.before(this.depth + 1);\n }\n /**\n The position at the end of the range.\n */\n get end() {\n return this.$to.after(this.depth + 1);\n }\n /**\n The parent node that the range points into.\n */\n get parent() {\n return this.$from.node(this.depth);\n }\n /**\n The start index of the range in the parent node.\n */\n get startIndex() {\n return this.$from.index(this.depth);\n }\n /**\n The end index of the range in the parent node.\n */\n get endIndex() {\n return this.$to.indexAfter(this.depth);\n }\n}\nconst emptyAttrs = Object.create(null);\n/**\nThis class represents a node in the tree that makes up a\nProseMirror document. So a document is an instance of `Node`, with\nchildren that are also instances of `Node`.\n\nNodes are persistent data structures. Instead of changing them, you\ncreate new ones with the content you want. Old ones keep pointing\nat the old document shape. This is made cheaper by sharing\nstructure between the old and new data as much as possible, which a\ntree shape like this (without back pointers) makes easy.\n\n**Do not** directly mutate the properties of a `Node` object. See\n[the guide](/docs/guide/#doc) for more information.\n*/\nclass Node {\n /**\n @internal\n */\n constructor(\n /**\n The type of node that this is.\n */\n type,\n /**\n An object mapping attribute names to values. The kind of\n attributes allowed and required are\n [determined](https://prosemirror.net/docs/ref/#model.NodeSpec.attrs) by the node type.\n */\n attrs,\n // A fragment holding the node's children.\n content,\n /**\n The marks (things like whether it is emphasized or part of a\n link) applied to this node.\n */\n marks = Mark.none) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.content = content || Fragment.empty;\n }\n /**\n The array of this node's child nodes.\n */\n get children() {\n return this.content.content;\n }\n /**\n The size of this node, as defined by the integer-based [indexing\n scheme](/docs/guide/#doc.indexing). For text nodes, this is the\n amount of characters. For other leaf nodes, it is one. For\n non-leaf nodes, it is the size of the content plus two (the\n start and end token).\n */\n get nodeSize() {\n return this.isLeaf ? 1 : 2 + this.content.size;\n }\n /**\n The number of children that the node has.\n */\n get childCount() {\n return this.content.childCount;\n }\n /**\n Get the child node at the given index. Raises an error when the\n index is out of range.\n */\n child(index) {\n return this.content.child(index);\n }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) {\n return this.content.maybeChild(index);\n }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) {\n this.content.forEach(f);\n }\n /**\n Invoke a callback for all descendant nodes recursively between\n the given two positions that are relative to start of this\n node's content. The callback is invoked with the node, its\n position relative to the original node (method receiver),\n its parent node, and its child index. When the callback returns\n false for a given node, that node's children will not be\n recursed over. The last parameter can be used to specify a\n starting position to count from.\n */\n nodesBetween(from, to, f, startPos = 0) {\n this.content.nodesBetween(from, to, f, startPos, this);\n }\n /**\n Call the given callback for every descendant node. Doesn't\n descend into a node when the callback returns `false`.\n */\n descendants(f) {\n this.nodesBetween(0, this.content.size, f);\n }\n /**\n Concatenates all the text nodes found in this fragment and its\n children.\n */\n get textContent() {\n return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, \"\");\n }\n /**\n Get all text between positions `from` and `to`. When\n `blockSeparator` is given, it will be inserted to separate text\n from different block nodes. If `leafText` is given, it'll be\n inserted for every non-text leaf node encountered, otherwise\n [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.\n */\n textBetween(from, to, blockSeparator, leafText) {\n return this.content.textBetween(from, to, blockSeparator, leafText);\n }\n /**\n Returns this node's first child, or `null` if there are no\n children.\n */\n get firstChild() {\n return this.content.firstChild;\n }\n /**\n Returns this node's last child, or `null` if there are no\n children.\n */\n get lastChild() {\n return this.content.lastChild;\n }\n /**\n Test whether two nodes represent the same piece of document.\n */\n eq(other) {\n return this == other || this.sameMarkup(other) && this.content.eq(other.content);\n }\n /**\n Compare the markup (type, attributes, and marks) of this node to\n those of another. Returns `true` if both have the same markup.\n */\n sameMarkup(other) {\n return this.hasMarkup(other.type, other.attrs, other.marks);\n }\n /**\n Check whether this node's markup correspond to the given type,\n attributes, and marks.\n */\n hasMarkup(type, attrs, marks) {\n return this.type == type && compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) && Mark.sameSet(this.marks, marks || Mark.none);\n }\n /**\n Create a new node with the same markup as this node, containing\n the given content (or empty, if no content is given).\n */\n copy(content = null) {\n if (content == this.content) return this;\n return new Node(this.type, this.attrs, content, this.marks);\n }\n /**\n Create a copy of this node, with the given set of marks instead\n of the node's own marks.\n */\n mark(marks) {\n return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);\n }\n /**\n Create a copy of this node with only the content between the\n given positions. If `to` is not given, it defaults to the end of\n the node.\n */\n cut(from, to = this.content.size) {\n if (from == 0 && to == this.content.size) return this;\n return this.copy(this.content.cut(from, to));\n }\n /**\n Cut out the part of the document between the given positions, and\n return it as a `Slice` object.\n */\n slice(from, to = this.content.size, includeParents = false) {\n if (from == to) return Slice.empty;\n let $from = this.resolve(from),\n $to = this.resolve(to);\n let depth = includeParents ? 0 : $from.sharedDepth(to);\n let start = $from.start(depth),\n node = $from.node(depth);\n let content = node.content.cut($from.pos - start, $to.pos - start);\n return new Slice(content, $from.depth - depth, $to.depth - depth);\n }\n /**\n Replace the part of the document between the given positions with\n the given slice. The slice must 'fit', meaning its open sides\n must be able to connect to the surrounding content, and its\n content nodes must be valid children for the node they are placed\n into. If any of this is violated, an error of type\n [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.\n */\n replace(from, to, slice) {\n return replace(this.resolve(from), this.resolve(to), slice);\n }\n /**\n Find the node directly after the given position.\n */\n nodeAt(pos) {\n for (let node = this;;) {\n let {\n index,\n offset\n } = node.content.findIndex(pos);\n node = node.maybeChild(index);\n if (!node) return null;\n if (offset == pos || node.isText) return node;\n pos -= offset + 1;\n }\n }\n /**\n Find the (direct) child node after the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childAfter(pos) {\n let {\n index,\n offset\n } = this.content.findIndex(pos);\n return {\n node: this.content.maybeChild(index),\n index,\n offset\n };\n }\n /**\n Find the (direct) child node before the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childBefore(pos) {\n if (pos == 0) return {\n node: null,\n index: 0,\n offset: 0\n };\n let {\n index,\n offset\n } = this.content.findIndex(pos);\n if (offset < pos) return {\n node: this.content.child(index),\n index,\n offset\n };\n let node = this.content.child(index - 1);\n return {\n node,\n index: index - 1,\n offset: offset - node.nodeSize\n };\n }\n /**\n Resolve the given position in the document, returning an\n [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.\n */\n resolve(pos) {\n return ResolvedPos.resolveCached(this, pos);\n }\n /**\n @internal\n */\n resolveNoCache(pos) {\n return ResolvedPos.resolve(this, pos);\n }\n /**\n Test whether a given mark or mark type occurs in this document\n between the two given positions.\n */\n rangeHasMark(from, to, type) {\n let found = false;\n if (to > from) this.nodesBetween(from, to, node => {\n if (type.isInSet(node.marks)) found = true;\n return !found;\n });\n return found;\n }\n /**\n True when this is a block (non-inline node)\n */\n get isBlock() {\n return this.type.isBlock;\n }\n /**\n True when this is a textblock node, a block node with inline\n content.\n */\n get isTextblock() {\n return this.type.isTextblock;\n }\n /**\n True when this node allows inline content.\n */\n get inlineContent() {\n return this.type.inlineContent;\n }\n /**\n True when this is an inline node (a text node or a node that can\n appear among text).\n */\n get isInline() {\n return this.type.isInline;\n }\n /**\n True when this is a text node.\n */\n get isText() {\n return this.type.isText;\n }\n /**\n True when this is a leaf node.\n */\n get isLeaf() {\n return this.type.isLeaf;\n }\n /**\n True when this is an atom, i.e. when it does not have directly\n editable content. This is usually the same as `isLeaf`, but can\n be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)\n on a node's spec (typically used when the node is displayed as\n an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).\n */\n get isAtom() {\n return this.type.isAtom;\n }\n /**\n Return a string representation of this node for debugging\n purposes.\n */\n toString() {\n if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);\n let name = this.type.name;\n if (this.content.size) name += \"(\" + this.content.toStringInner() + \")\";\n return wrapMarks(this.marks, name);\n }\n /**\n Get the content match in this node at the given index.\n */\n contentMatchAt(index) {\n let match = this.type.contentMatch.matchFragment(this.content, 0, index);\n if (!match) throw new Error(\"Called contentMatchAt on a node with invalid content\");\n return match;\n }\n /**\n Test whether replacing the range between `from` and `to` (by\n child index) with the given replacement fragment (which defaults\n to the empty fragment) would leave the node's content valid. You\n can optionally pass `start` and `end` indices into the\n replacement fragment.\n */\n canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {\n let one = this.contentMatchAt(from).matchFragment(replacement, start, end);\n let two = one && one.matchFragment(this.content, to);\n if (!two || !two.validEnd) return false;\n for (let i = start; i < end; i++) if (!this.type.allowsMarks(replacement.child(i).marks)) return false;\n return true;\n }\n /**\n Test whether replacing the range `from` to `to` (by index) with\n a node of the given type would leave the node's content valid.\n */\n canReplaceWith(from, to, type, marks) {\n if (marks && !this.type.allowsMarks(marks)) return false;\n let start = this.contentMatchAt(from).matchType(type);\n let end = start && start.matchFragment(this.content, to);\n return end ? end.validEnd : false;\n }\n /**\n Test whether the given node's content could be appended to this\n node. If that node is empty, this will only return true if there\n is at least one node type that can appear in both nodes (to avoid\n merging completely incompatible nodes).\n */\n canAppend(other) {\n if (other.content.size) return this.canReplace(this.childCount, this.childCount, other.content);else return this.type.compatibleContent(other.type);\n }\n /**\n Check whether this node and its descendants conform to the\n schema, and raise an exception when they do not.\n */\n check() {\n this.type.checkContent(this.content);\n this.type.checkAttrs(this.attrs);\n let copy = Mark.none;\n for (let i = 0; i < this.marks.length; i++) {\n let mark = this.marks[i];\n mark.type.checkAttrs(mark.attrs);\n copy = mark.addToSet(copy);\n }\n if (!Mark.sameSet(copy, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m => m.type.name)}`);\n this.content.forEach(node => node.check());\n }\n /**\n Return a JSON-serializeable representation of this node.\n */\n toJSON() {\n let obj = {\n type: this.type.name\n };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n if (this.content.size) obj.content = this.content.toJSON();\n if (this.marks.length) obj.marks = this.marks.map(n => n.toJSON());\n return obj;\n }\n /**\n Deserialize a node from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json) throw new RangeError(\"Invalid input for Node.fromJSON\");\n let marks = undefined;\n if (json.marks) {\n if (!Array.isArray(json.marks)) throw new RangeError(\"Invalid mark data for Node.fromJSON\");\n marks = json.marks.map(schema.markFromJSON);\n }\n if (json.type == \"text\") {\n if (typeof json.text != \"string\") throw new RangeError(\"Invalid text node in JSON\");\n return schema.text(json.text, marks);\n }\n let content = Fragment.fromJSON(schema, json.content);\n let node = schema.nodeType(json.type).create(json.attrs, content, marks);\n node.type.checkAttrs(node.attrs);\n return node;\n }\n}\nNode.prototype.text = undefined;\nclass TextNode extends Node {\n /**\n @internal\n */\n constructor(type, attrs, content, marks) {\n super(type, attrs, null, marks);\n if (!content) throw new RangeError(\"Empty text nodes are not allowed\");\n this.text = content;\n }\n toString() {\n if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);\n return wrapMarks(this.marks, JSON.stringify(this.text));\n }\n get textContent() {\n return this.text;\n }\n textBetween(from, to) {\n return this.text.slice(from, to);\n }\n get nodeSize() {\n return this.text.length;\n }\n mark(marks) {\n return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);\n }\n withText(text) {\n if (text == this.text) return this;\n return new TextNode(this.type, this.attrs, text, this.marks);\n }\n cut(from = 0, to = this.text.length) {\n if (from == 0 && to == this.text.length) return this;\n return this.withText(this.text.slice(from, to));\n }\n eq(other) {\n return this.sameMarkup(other) && this.text == other.text;\n }\n toJSON() {\n let base = super.toJSON();\n base.text = this.text;\n return base;\n }\n}\nfunction wrapMarks(marks, str) {\n for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + \"(\" + str + \")\";\n return str;\n}\n\n/**\nInstances of this class represent a match state of a node type's\n[content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to\nfind out whether further content matches here, and whether a given\nposition is a valid end of the node.\n*/\nclass ContentMatch {\n /**\n @internal\n */\n constructor(\n /**\n True when this match state represents a valid end of the node.\n */\n validEnd) {\n this.validEnd = validEnd;\n /**\n @internal\n */\n this.next = [];\n /**\n @internal\n */\n this.wrapCache = [];\n }\n /**\n @internal\n */\n static parse(string, nodeTypes) {\n let stream = new TokenStream(string, nodeTypes);\n if (stream.next == null) return ContentMatch.empty;\n let expr = parseExpr(stream);\n if (stream.next) stream.err(\"Unexpected trailing text\");\n let match = dfa(nfa(expr));\n checkForDeadEnds(match, stream);\n return match;\n }\n /**\n Match a node type, returning a match after that node if\n successful.\n */\n matchType(type) {\n for (let i = 0; i < this.next.length; i++) if (this.next[i].type == type) return this.next[i].next;\n return null;\n }\n /**\n Try to match a fragment. Returns the resulting match when\n successful.\n */\n matchFragment(frag, start = 0, end = frag.childCount) {\n let cur = this;\n for (let i = start; cur && i < end; i++) cur = cur.matchType(frag.child(i).type);\n return cur;\n }\n /**\n @internal\n */\n get inlineContent() {\n return this.next.length != 0 && this.next[0].type.isInline;\n }\n /**\n Get the first matching node type at this match position that can\n be generated.\n */\n get defaultType() {\n for (let i = 0; i < this.next.length; i++) {\n let {\n type\n } = this.next[i];\n if (!(type.isText || type.hasRequiredAttrs())) return type;\n }\n return null;\n }\n /**\n @internal\n */\n compatible(other) {\n for (let i = 0; i < this.next.length; i++) for (let j = 0; j < other.next.length; j++) if (this.next[i].type == other.next[j].type) return true;\n return false;\n }\n /**\n Try to match the given fragment, and if that fails, see if it can\n be made to match by inserting nodes in front of it. When\n successful, return a fragment of inserted nodes (which may be\n empty if nothing had to be inserted). When `toEnd` is true, only\n return a fragment if the resulting match goes to the end of the\n content expression.\n */\n fillBefore(after, toEnd = false, startIndex = 0) {\n let seen = [this];\n function search(match, types) {\n let finished = match.matchFragment(after, startIndex);\n if (finished && (!toEnd || finished.validEnd)) return Fragment.from(types.map(tp => tp.createAndFill()));\n for (let i = 0; i < match.next.length; i++) {\n let {\n type,\n next\n } = match.next[i];\n if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {\n seen.push(next);\n let found = search(next, types.concat(type));\n if (found) return found;\n }\n }\n return null;\n }\n return search(this, []);\n }\n /**\n Find a set of wrapping node types that would allow a node of the\n given type to appear at this position. The result may be empty\n (when it fits directly) and will be null when no such wrapping\n exists.\n */\n findWrapping(target) {\n for (let i = 0; i < this.wrapCache.length; i += 2) if (this.wrapCache[i] == target) return this.wrapCache[i + 1];\n let computed = this.computeWrapping(target);\n this.wrapCache.push(target, computed);\n return computed;\n }\n /**\n @internal\n */\n computeWrapping(target) {\n let seen = Object.create(null),\n active = [{\n match: this,\n type: null,\n via: null\n }];\n while (active.length) {\n let current = active.shift(),\n match = current.match;\n if (match.matchType(target)) {\n let result = [];\n for (let obj = current; obj.type; obj = obj.via) result.push(obj.type);\n return result.reverse();\n }\n for (let i = 0; i < match.next.length; i++) {\n let {\n type,\n next\n } = match.next[i];\n if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {\n active.push({\n match: type.contentMatch,\n type,\n via: current\n });\n seen[type.name] = true;\n }\n }\n }\n return null;\n }\n /**\n The number of outgoing edges this node has in the finite\n automaton that describes the content expression.\n */\n get edgeCount() {\n return this.next.length;\n }\n /**\n Get the _n_​th outgoing edge from this node in the finite\n automaton that describes the content expression.\n */\n edge(n) {\n if (n >= this.next.length) throw new RangeError(`There's no ${n}th edge in this content match`);\n return this.next[n];\n }\n /**\n @internal\n */\n toString() {\n let seen = [];\n function scan(m) {\n seen.push(m);\n for (let i = 0; i < m.next.length; i++) if (seen.indexOf(m.next[i].next) == -1) scan(m.next[i].next);\n }\n scan(this);\n return seen.map((m, i) => {\n let out = i + (m.validEnd ? \"*\" : \" \") + \" \";\n for (let i = 0; i < m.next.length; i++) out += (i ? \", \" : \"\") + m.next[i].type.name + \"->\" + seen.indexOf(m.next[i].next);\n return out;\n }).join(\"\\n\");\n }\n}\n/**\n@internal\n*/\nContentMatch.empty = new ContentMatch(true);\nclass TokenStream {\n constructor(string, nodeTypes) {\n this.string = string;\n this.nodeTypes = nodeTypes;\n this.inline = null;\n this.pos = 0;\n this.tokens = string.split(/\\s*(?=\\b|\\W|$)/);\n if (this.tokens[this.tokens.length - 1] == \"\") this.tokens.pop();\n if (this.tokens[0] == \"\") this.tokens.shift();\n }\n get next() {\n return this.tokens[this.pos];\n }\n eat(tok) {\n return this.next == tok && (this.pos++ || true);\n }\n err(str) {\n throw new SyntaxError(str + \" (in content expression '\" + this.string + \"')\");\n }\n}\nfunction parseExpr(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSeq(stream));\n } while (stream.eat(\"|\"));\n return exprs.length == 1 ? exprs[0] : {\n type: \"choice\",\n exprs\n };\n}\nfunction parseExprSeq(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSubscript(stream));\n } while (stream.next && stream.next != \")\" && stream.next != \"|\");\n return exprs.length == 1 ? exprs[0] : {\n type: \"seq\",\n exprs\n };\n}\nfunction parseExprSubscript(stream) {\n let expr = parseExprAtom(stream);\n for (;;) {\n if (stream.eat(\"+\")) expr = {\n type: \"plus\",\n expr\n };else if (stream.eat(\"*\")) expr = {\n type: \"star\",\n expr\n };else if (stream.eat(\"?\")) expr = {\n type: \"opt\",\n expr\n };else if (stream.eat(\"{\")) expr = parseExprRange(stream, expr);else break;\n }\n return expr;\n}\nfunction parseNum(stream) {\n if (/\\D/.test(stream.next)) stream.err(\"Expected number, got '\" + stream.next + \"'\");\n let result = Number(stream.next);\n stream.pos++;\n return result;\n}\nfunction parseExprRange(stream, expr) {\n let min = parseNum(stream),\n max = min;\n if (stream.eat(\",\")) {\n if (stream.next != \"}\") max = parseNum(stream);else max = -1;\n }\n if (!stream.eat(\"}\")) stream.err(\"Unclosed braced range\");\n return {\n type: \"range\",\n min,\n max,\n expr\n };\n}\nfunction resolveName(stream, name) {\n let types = stream.nodeTypes,\n type = types[name];\n if (type) return [type];\n let result = [];\n for (let typeName in types) {\n let type = types[typeName];\n if (type.isInGroup(name)) result.push(type);\n }\n if (result.length == 0) stream.err(\"No node type or group '\" + name + \"' found\");\n return result;\n}\nfunction parseExprAtom(stream) {\n if (stream.eat(\"(\")) {\n let expr = parseExpr(stream);\n if (!stream.eat(\")\")) stream.err(\"Missing closing paren\");\n return expr;\n } else if (!/\\W/.test(stream.next)) {\n let exprs = resolveName(stream, stream.next).map(type => {\n if (stream.inline == null) stream.inline = type.isInline;else if (stream.inline != type.isInline) stream.err(\"Mixing inline and block content\");\n return {\n type: \"name\",\n value: type\n };\n });\n stream.pos++;\n return exprs.length == 1 ? exprs[0] : {\n type: \"choice\",\n exprs\n };\n } else {\n stream.err(\"Unexpected token '\" + stream.next + \"'\");\n }\n}\n// Construct an NFA from an expression as returned by the parser. The\n// NFA is represented as an array of states, which are themselves\n// arrays of edges, which are `{term, to}` objects. The first state is\n// the entry state and the last node is the success state.\n//\n// Note that unlike typical NFAs, the edge ordering in this one is\n// significant, in that it is used to contruct filler content when\n// necessary.\nfunction nfa(expr) {\n let nfa = [[]];\n connect(compile(expr, 0), node());\n return nfa;\n function node() {\n return nfa.push([]) - 1;\n }\n function edge(from, to, term) {\n let edge = {\n term,\n to\n };\n nfa[from].push(edge);\n return edge;\n }\n function connect(edges, to) {\n edges.forEach(edge => edge.to = to);\n }\n function compile(expr, from) {\n if (expr.type == \"choice\") {\n return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);\n } else if (expr.type == \"seq\") {\n for (let i = 0;; i++) {\n let next = compile(expr.exprs[i], from);\n if (i == expr.exprs.length - 1) return next;\n connect(next, from = node());\n }\n } else if (expr.type == \"star\") {\n let loop = node();\n edge(from, loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n } else if (expr.type == \"plus\") {\n let loop = node();\n connect(compile(expr.expr, from), loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n } else if (expr.type == \"opt\") {\n return [edge(from)].concat(compile(expr.expr, from));\n } else if (expr.type == \"range\") {\n let cur = from;\n for (let i = 0; i < expr.min; i++) {\n let next = node();\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n if (expr.max == -1) {\n connect(compile(expr.expr, cur), cur);\n } else {\n for (let i = expr.min; i < expr.max; i++) {\n let next = node();\n edge(cur, next);\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n }\n return [edge(cur)];\n } else if (expr.type == \"name\") {\n return [edge(from, undefined, expr.value)];\n } else {\n throw new Error(\"Unknown expr type\");\n }\n }\n}\nfunction cmp(a, b) {\n return b - a;\n}\n// Get the set of nodes reachable by null edges from `node`. Omit\n// nodes with only a single null-out-edge, since they may lead to\n// needless duplicated nodes.\nfunction nullFrom(nfa, node) {\n let result = [];\n scan(node);\n return result.sort(cmp);\n function scan(node) {\n let edges = nfa[node];\n if (edges.length == 1 && !edges[0].term) return scan(edges[0].to);\n result.push(node);\n for (let i = 0; i < edges.length; i++) {\n let {\n term,\n to\n } = edges[i];\n if (!term && result.indexOf(to) == -1) scan(to);\n }\n }\n}\n// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set\n// of state objects (`ContentMatch` instances) with transitions\n// between them.\nfunction dfa(nfa) {\n let labeled = Object.create(null);\n return explore(nullFrom(nfa, 0));\n function explore(states) {\n let out = [];\n states.forEach(node => {\n nfa[node].forEach(({\n term,\n to\n }) => {\n if (!term) return;\n let set;\n for (let i = 0; i < out.length; i++) if (out[i][0] == term) set = out[i][1];\n nullFrom(nfa, to).forEach(node => {\n if (!set) out.push([term, set = []]);\n if (set.indexOf(node) == -1) set.push(node);\n });\n });\n });\n let state = labeled[states.join(\",\")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);\n for (let i = 0; i < out.length; i++) {\n let states = out[i][1].sort(cmp);\n state.next.push({\n type: out[i][0],\n next: labeled[states.join(\",\")] || explore(states)\n });\n }\n return state;\n }\n}\nfunction checkForDeadEnds(match, stream) {\n for (let i = 0, work = [match]; i < work.length; i++) {\n let state = work[i],\n dead = !state.validEnd,\n nodes = [];\n for (let j = 0; j < state.next.length; j++) {\n let {\n type,\n next\n } = state.next[j];\n nodes.push(type.name);\n if (dead && !(type.isText || type.hasRequiredAttrs())) dead = false;\n if (work.indexOf(next) == -1) work.push(next);\n }\n if (dead) stream.err(\"Only non-generatable nodes (\" + nodes.join(\", \") + \") in a required position (see https://prosemirror.net/docs/guide/#generatable)\");\n }\n}\n\n// For node types where all attrs have a default value (or which don't\n// have any attributes), build up a single reusable default attribute\n// object, and use it for all nodes that don't specify specific\n// attributes.\nfunction defaultAttrs(attrs) {\n let defaults = Object.create(null);\n for (let attrName in attrs) {\n let attr = attrs[attrName];\n if (!attr.hasDefault) return null;\n defaults[attrName] = attr.default;\n }\n return defaults;\n}\nfunction computeAttrs(attrs, value) {\n let built = Object.create(null);\n for (let name in attrs) {\n let given = value && value[name];\n if (given === undefined) {\n let attr = attrs[name];\n if (attr.hasDefault) given = attr.default;else throw new RangeError(\"No value supplied for attribute \" + name);\n }\n built[name] = given;\n }\n return built;\n}\nfunction checkAttrs(attrs, values, type, name) {\n for (let name in values) if (!(name in attrs)) throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);\n for (let name in attrs) {\n let attr = attrs[name];\n if (attr.validate) attr.validate(values[name]);\n }\n}\nfunction initAttrs(typeName, attrs) {\n let result = Object.create(null);\n if (attrs) for (let name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);\n return result;\n}\n/**\nNode types are objects allocated once per `Schema` and used to\n[tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information\nabout the node type, such as its name and what kind of node it\nrepresents.\n*/\nclass NodeType {\n /**\n @internal\n */\n constructor(\n /**\n The name the node type has in this schema.\n */\n name,\n /**\n A link back to the `Schema` the node type belongs to.\n */\n schema,\n /**\n The spec that this type is based on\n */\n spec) {\n this.name = name;\n this.schema = schema;\n this.spec = spec;\n /**\n The set of marks allowed in this node. `null` means all marks\n are allowed.\n */\n this.markSet = null;\n this.groups = spec.group ? spec.group.split(\" \") : [];\n this.attrs = initAttrs(name, spec.attrs);\n this.defaultAttrs = defaultAttrs(this.attrs);\n this.contentMatch = null;\n this.inlineContent = null;\n this.isBlock = !(spec.inline || name == \"text\");\n this.isText = name == \"text\";\n }\n /**\n True if this is an inline type.\n */\n get isInline() {\n return !this.isBlock;\n }\n /**\n True if this is a textblock type, a block that contains inline\n content.\n */\n get isTextblock() {\n return this.isBlock && this.inlineContent;\n }\n /**\n True for node types that allow no content.\n */\n get isLeaf() {\n return this.contentMatch == ContentMatch.empty;\n }\n /**\n True when this node is an atom, i.e. when it does not have\n directly editable content.\n */\n get isAtom() {\n return this.isLeaf || !!this.spec.atom;\n }\n /**\n Return true when this node type is part of the given\n [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).\n */\n isInGroup(group) {\n return this.groups.indexOf(group) > -1;\n }\n /**\n The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.\n */\n get whitespace() {\n return this.spec.whitespace || (this.spec.code ? \"pre\" : \"normal\");\n }\n /**\n Tells you whether this node type has any required attributes.\n */\n hasRequiredAttrs() {\n for (let n in this.attrs) if (this.attrs[n].isRequired) return true;\n return false;\n }\n /**\n Indicates whether this node allows some of the same content as\n the given node type.\n */\n compatibleContent(other) {\n return this == other || this.contentMatch.compatible(other.contentMatch);\n }\n /**\n @internal\n */\n computeAttrs(attrs) {\n if (!attrs && this.defaultAttrs) return this.defaultAttrs;else return computeAttrs(this.attrs, attrs);\n }\n /**\n Create a `Node` of this type. The given attributes are\n checked and defaulted (you can pass `null` to use the type's\n defaults entirely, if no required attributes exist). `content`\n may be a `Fragment`, a node, an array of nodes, or\n `null`. Similarly `marks` may be `null` to default to the empty\n set of marks.\n */\n create(attrs = null, content, marks) {\n if (this.isText) throw new Error(\"NodeType.create can't construct text nodes\");\n return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content\n against the node type's content restrictions, and throw an error\n if it doesn't match.\n */\n createChecked(attrs = null, content, marks) {\n content = Fragment.from(content);\n this.checkContent(content);\n return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is\n necessary to add nodes to the start or end of the given fragment\n to make it fit the node. If no fitting wrapping can be found,\n return null. Note that, due to the fact that required nodes can\n always be created, this will always succeed if you pass null or\n `Fragment.empty` as content.\n */\n createAndFill(attrs = null, content, marks) {\n attrs = this.computeAttrs(attrs);\n content = Fragment.from(content);\n if (content.size) {\n let before = this.contentMatch.fillBefore(content);\n if (!before) return null;\n content = before.append(content);\n }\n let matched = this.contentMatch.matchFragment(content);\n let after = matched && matched.fillBefore(Fragment.empty, true);\n if (!after) return null;\n return new Node(this, attrs, content.append(after), Mark.setFrom(marks));\n }\n /**\n Returns true if the given fragment is valid content for this node\n type.\n */\n validContent(content) {\n let result = this.contentMatch.matchFragment(content);\n if (!result || !result.validEnd) return false;\n for (let i = 0; i < content.childCount; i++) if (!this.allowsMarks(content.child(i).marks)) return false;\n return true;\n }\n /**\n Throws a RangeError if the given fragment is not valid content for this\n node type.\n @internal\n */\n checkContent(content) {\n if (!this.validContent(content)) throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"node\", this.name);\n }\n /**\n Check whether the given mark type is allowed in this node.\n */\n allowsMarkType(markType) {\n return this.markSet == null || this.markSet.indexOf(markType) > -1;\n }\n /**\n Test whether the given set of marks are allowed in this node.\n */\n allowsMarks(marks) {\n if (this.markSet == null) return true;\n for (let i = 0; i < marks.length; i++) if (!this.allowsMarkType(marks[i].type)) return false;\n return true;\n }\n /**\n Removes the marks that are not allowed in this node from the given set.\n */\n allowedMarks(marks) {\n if (this.markSet == null) return marks;\n let copy;\n for (let i = 0; i < marks.length; i++) {\n if (!this.allowsMarkType(marks[i].type)) {\n if (!copy) copy = marks.slice(0, i);\n } else if (copy) {\n copy.push(marks[i]);\n }\n }\n return !copy ? marks : copy.length ? copy : Mark.none;\n }\n /**\n @internal\n */\n static compile(nodes, schema) {\n let result = Object.create(null);\n nodes.forEach((name, spec) => result[name] = new NodeType(name, schema, spec));\n let topType = schema.spec.topNode || \"doc\";\n if (!result[topType]) throw new RangeError(\"Schema is missing its top node type ('\" + topType + \"')\");\n if (!result.text) throw new RangeError(\"Every schema needs a 'text' type\");\n for (let _ in result.text.attrs) throw new RangeError(\"The text node type should not have attributes\");\n return result;\n }\n}\nfunction validateType(typeName, attrName, type) {\n let types = type.split(\"|\");\n return value => {\n let name = value === null ? \"null\" : typeof value;\n if (types.indexOf(name) < 0) throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);\n };\n}\n// Attribute descriptors\nclass Attribute {\n constructor(typeName, attrName, options) {\n this.hasDefault = Object.prototype.hasOwnProperty.call(options, \"default\");\n this.default = options.default;\n this.validate = typeof options.validate == \"string\" ? validateType(typeName, attrName, options.validate) : options.validate;\n }\n get isRequired() {\n return !this.hasDefault;\n }\n}\n// Marks\n/**\nLike nodes, marks (which are associated with nodes to signify\nthings like emphasis or being part of a link) are\n[tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are\ninstantiated once per `Schema`.\n*/\nclass MarkType {\n /**\n @internal\n */\n constructor(\n /**\n The name of the mark type.\n */\n name,\n /**\n @internal\n */\n rank,\n /**\n The schema that this mark type instance is part of.\n */\n schema,\n /**\n The spec on which the type is based.\n */\n spec) {\n this.name = name;\n this.rank = rank;\n this.schema = schema;\n this.spec = spec;\n this.attrs = initAttrs(name, spec.attrs);\n this.excluded = null;\n let defaults = defaultAttrs(this.attrs);\n this.instance = defaults ? new Mark(this, defaults) : null;\n }\n /**\n Create a mark of this type. `attrs` may be `null` or an object\n containing only some of the mark's attributes. The others, if\n they have defaults, will be added.\n */\n create(attrs = null) {\n if (!attrs && this.instance) return this.instance;\n return new Mark(this, computeAttrs(this.attrs, attrs));\n }\n /**\n @internal\n */\n static compile(marks, schema) {\n let result = Object.create(null),\n rank = 0;\n marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));\n return result;\n }\n /**\n When there is a mark of this type in the given set, a new set\n without it is returned. Otherwise, the input set is returned.\n */\n removeFromSet(set) {\n for (var i = 0; i < set.length; i++) if (set[i].type == this) {\n set = set.slice(0, i).concat(set.slice(i + 1));\n i--;\n }\n return set;\n }\n /**\n Tests whether there is a mark of this type in the given set.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++) if (set[i].type == this) return set[i];\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"mark\", this.name);\n }\n /**\n Queries whether a given mark type is\n [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.\n */\n excludes(other) {\n return this.excluded.indexOf(other) > -1;\n }\n}\n/**\nA document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark\ntype](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may\noccur in conforming documents, and provides functionality for\ncreating and deserializing such documents.\n\nWhen given, the type parameters provide the names of the nodes and\nmarks in this schema.\n*/\nclass Schema {\n /**\n Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).\n */\n constructor(spec) {\n /**\n The [linebreak\n replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined\n in this schema, if any.\n */\n this.linebreakReplacement = null;\n /**\n An object for storing whatever values modules may want to\n compute and cache per schema. (If you want to store something\n in it, try to use property names unlikely to clash.)\n */\n this.cached = Object.create(null);\n let instanceSpec = this.spec = {};\n for (let prop in spec) instanceSpec[prop] = spec[prop];\n instanceSpec.nodes = OrderedMap.from(spec.nodes), instanceSpec.marks = OrderedMap.from(spec.marks || {}), this.nodes = NodeType.compile(this.spec.nodes, this);\n this.marks = MarkType.compile(this.spec.marks, this);\n let contentExprCache = Object.create(null);\n for (let prop in this.nodes) {\n if (prop in this.marks) throw new RangeError(prop + \" can not be both a node and a mark\");\n let type = this.nodes[prop],\n contentExpr = type.spec.content || \"\",\n markExpr = type.spec.marks;\n type.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n type.inlineContent = type.contentMatch.inlineContent;\n if (type.spec.linebreakReplacement) {\n if (this.linebreakReplacement) throw new RangeError(\"Multiple linebreak nodes defined\");\n if (!type.isInline || !type.isLeaf) throw new RangeError(\"Linebreak replacement nodes must be inline leaf nodes\");\n this.linebreakReplacement = type;\n }\n type.markSet = markExpr == \"_\" ? null : markExpr ? gatherMarks(this, markExpr.split(\" \")) : markExpr == \"\" || !type.inlineContent ? [] : null;\n }\n for (let prop in this.marks) {\n let type = this.marks[prop],\n excl = type.spec.excludes;\n type.excluded = excl == null ? [type] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n }\n this.nodeFromJSON = this.nodeFromJSON.bind(this);\n this.markFromJSON = this.markFromJSON.bind(this);\n this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n this.cached.wrappings = Object.create(null);\n }\n /**\n Create a node in this schema. The `type` may be a string or a\n `NodeType` instance. Attributes will be extended with defaults,\n `content` may be a `Fragment`, `null`, a `Node`, or an array of\n nodes.\n */\n node(type, attrs = null, content, marks) {\n if (typeof type == \"string\") type = this.nodeType(type);else if (!(type instanceof NodeType)) throw new RangeError(\"Invalid node type: \" + type);else if (type.schema != this) throw new RangeError(\"Node type from different schema used (\" + type.name + \")\");\n return type.createChecked(attrs, content, marks);\n }\n /**\n Create a text node in the schema. Empty text nodes are not\n allowed.\n */\n text(text, marks) {\n let type = this.nodes.text;\n return new TextNode(type, type.defaultAttrs, text, Mark.setFrom(marks));\n }\n /**\n Create a mark with the given type and attributes.\n */\n mark(type, attrs) {\n if (typeof type == \"string\") type = this.marks[type];\n return type.create(attrs);\n }\n /**\n Deserialize a node from its JSON representation. This method is\n bound.\n */\n nodeFromJSON(json) {\n return Node.fromJSON(this, json);\n }\n /**\n Deserialize a mark from its JSON representation. This method is\n bound.\n */\n markFromJSON(json) {\n return Mark.fromJSON(this, json);\n }\n /**\n @internal\n */\n nodeType(name) {\n let found = this.nodes[name];\n if (!found) throw new RangeError(\"Unknown node type: \" + name);\n return found;\n }\n}\nfunction gatherMarks(schema, marks) {\n let found = [];\n for (let i = 0; i < marks.length; i++) {\n let name = marks[i],\n mark = schema.marks[name],\n ok = mark;\n if (mark) {\n found.push(mark);\n } else {\n for (let prop in schema.marks) {\n let mark = schema.marks[prop];\n if (name == \"_\" || mark.spec.group && mark.spec.group.split(\" \").indexOf(name) > -1) found.push(ok = mark);\n }\n }\n if (!ok) throw new SyntaxError(\"Unknown mark type: '\" + marks[i] + \"'\");\n }\n return found;\n}\nfunction isTagRule(rule) {\n return rule.tag != null;\n}\nfunction isStyleRule(rule) {\n return rule.style != null;\n}\n/**\nA DOM parser represents a strategy for parsing DOM content into a\nProseMirror document conforming to a given schema. Its behavior is\ndefined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).\n*/\nclass DOMParser {\n /**\n Create a parser that targets the given schema, using the given\n parsing rules.\n */\n constructor(\n /**\n The schema into which the parser parses.\n */\n schema,\n /**\n The set of [parse rules](https://prosemirror.net/docs/ref/#model.ParseRule) that the parser\n uses, in order of precedence.\n */\n rules) {\n this.schema = schema;\n this.rules = rules;\n /**\n @internal\n */\n this.tags = [];\n /**\n @internal\n */\n this.styles = [];\n let matchedStyles = this.matchedStyles = [];\n rules.forEach(rule => {\n if (isTagRule(rule)) {\n this.tags.push(rule);\n } else if (isStyleRule(rule)) {\n let prop = /[^=]*/.exec(rule.style)[0];\n if (matchedStyles.indexOf(prop) < 0) matchedStyles.push(prop);\n this.styles.push(rule);\n }\n });\n // Only normalize list elements when lists in the schema can't directly contain themselves\n this.normalizeLists = !this.tags.some(r => {\n if (!/^(ul|ol)\\b/.test(r.tag) || !r.node) return false;\n let node = schema.nodes[r.node];\n return node.contentMatch.matchType(node);\n });\n }\n /**\n Parse a document from the content of a DOM node.\n */\n parse(dom, options = {}) {\n let context = new ParseContext(this, options, false);\n context.addAll(dom, Mark.none, options.from, options.to);\n return context.finish();\n }\n /**\n Parses the content of the given DOM node, like\n [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of\n options. But unlike that method, which produces a whole node,\n this one returns a slice that is open at the sides, meaning that\n the schema constraints aren't applied to the start of nodes to\n the left of the input and the end of nodes at the end.\n */\n parseSlice(dom, options = {}) {\n let context = new ParseContext(this, options, true);\n context.addAll(dom, Mark.none, options.from, options.to);\n return Slice.maxOpen(context.finish());\n }\n /**\n @internal\n */\n matchTag(dom, context, after) {\n for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {\n let rule = this.tags[i];\n if (matches(dom, rule.tag) && (rule.namespace === undefined || dom.namespaceURI == rule.namespace) && (!rule.context || context.matchesContext(rule.context))) {\n if (rule.getAttrs) {\n let result = rule.getAttrs(dom);\n if (result === false) continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n }\n /**\n @internal\n */\n matchStyle(prop, value, context, after) {\n for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {\n let rule = this.styles[i],\n style = rule.style;\n if (style.indexOf(prop) != 0 || rule.context && !context.matchesContext(rule.context) ||\n // Test that the style string either precisely matches the prop,\n // or has an '=' sign after the prop, followed by the given\n // value.\n style.length > prop.length && (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value)) continue;\n if (rule.getAttrs) {\n let result = rule.getAttrs(value);\n if (result === false) continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n /**\n @internal\n */\n static schemaRules(schema) {\n let result = [];\n function insert(rule) {\n let priority = rule.priority == null ? 50 : rule.priority,\n i = 0;\n for (; i < result.length; i++) {\n let next = result[i],\n nextPriority = next.priority == null ? 50 : next.priority;\n if (nextPriority < priority) break;\n }\n result.splice(i, 0, rule);\n }\n for (let name in schema.marks) {\n let rules = schema.marks[name].spec.parseDOM;\n if (rules) rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.mark || rule.ignore || rule.clearMark)) rule.mark = name;\n });\n }\n for (let name in schema.nodes) {\n let rules = schema.nodes[name].spec.parseDOM;\n if (rules) rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.node || rule.ignore || rule.mark)) rule.node = name;\n });\n }\n return result;\n }\n /**\n Construct a DOM parser using the parsing rules listed in a\n schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by\n [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority).\n */\n static fromSchema(schema) {\n return schema.cached.domParser || (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));\n }\n}\nconst blockTags = {\n address: true,\n article: true,\n aside: true,\n blockquote: true,\n canvas: true,\n dd: true,\n div: true,\n dl: true,\n fieldset: true,\n figcaption: true,\n figure: true,\n footer: true,\n form: true,\n h1: true,\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n header: true,\n hgroup: true,\n hr: true,\n li: true,\n noscript: true,\n ol: true,\n output: true,\n p: true,\n pre: true,\n section: true,\n table: true,\n tfoot: true,\n ul: true\n};\nconst ignoreTags = {\n head: true,\n noscript: true,\n object: true,\n script: true,\n style: true,\n title: true\n};\nconst listTags = {\n ol: true,\n ul: true\n};\n// Using a bitfield for node context options\nconst OPT_PRESERVE_WS = 1,\n OPT_PRESERVE_WS_FULL = 2,\n OPT_OPEN_LEFT = 4;\nfunction wsOptionsFor(type, preserveWhitespace, base) {\n if (preserveWhitespace != null) return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === \"full\" ? OPT_PRESERVE_WS_FULL : 0);\n return type && type.whitespace == \"pre\" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;\n}\nclass NodeContext {\n constructor(type, attrs, marks, solid, match, options) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.solid = solid;\n this.options = options;\n this.content = [];\n // Marks applied to the node's children\n this.activeMarks = Mark.none;\n this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);\n }\n findWrapping(node) {\n if (!this.match) {\n if (!this.type) return [];\n let fill = this.type.contentMatch.fillBefore(Fragment.from(node));\n if (fill) {\n this.match = this.type.contentMatch.matchFragment(fill);\n } else {\n let start = this.type.contentMatch,\n wrap;\n if (wrap = start.findWrapping(node.type)) {\n this.match = start;\n return wrap;\n } else {\n return null;\n }\n }\n }\n return this.match.findWrapping(node.type);\n }\n finish(openEnd) {\n if (!(this.options & OPT_PRESERVE_WS)) {\n // Strip trailing whitespace\n let last = this.content[this.content.length - 1],\n m;\n if (last && last.isText && (m = /[ \\t\\r\\n\\u000c]+$/.exec(last.text))) {\n let text = last;\n if (last.text.length == m[0].length) this.content.pop();else this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));\n }\n }\n let content = Fragment.from(this.content);\n if (!openEnd && this.match) content = content.append(this.match.fillBefore(Fragment.empty, true));\n return this.type ? this.type.create(this.attrs, content, this.marks) : content;\n }\n inlineContext(node) {\n if (this.type) return this.type.inlineContent;\n if (this.content.length) return this.content[0].isInline;\n return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());\n }\n}\nclass ParseContext {\n constructor(\n // The parser we are using.\n parser,\n // The options passed to this parse.\n options, isOpen) {\n this.parser = parser;\n this.options = options;\n this.isOpen = isOpen;\n this.open = 0;\n this.localPreserveWS = false;\n let topNode = options.topNode,\n topContext;\n let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);\n if (topNode) topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);else if (isOpen) topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);else topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);\n this.nodes = [topContext];\n this.find = options.findPositions;\n this.needsBlock = false;\n }\n get top() {\n return this.nodes[this.open];\n }\n // Add a DOM node to the content. Text is inserted as text node,\n // otherwise, the node is passed to `addElement` or, if it has a\n // `style` attribute, `addElementWithStyles`.\n addDOM(dom, marks) {\n if (dom.nodeType == 3) this.addTextNode(dom, marks);else if (dom.nodeType == 1) this.addElement(dom, marks);\n }\n addTextNode(dom, marks) {\n let value = dom.nodeValue;\n let top = this.top,\n preserveWS = top.options & OPT_PRESERVE_WS_FULL ? \"full\" : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;\n if (preserveWS === \"full\" || top.inlineContext(dom) || /[^ \\t\\r\\n\\u000c]/.test(value)) {\n if (!preserveWS) {\n value = value.replace(/[ \\t\\r\\n\\u000c]+/g, \" \");\n // If this starts with whitespace, and there is no node before it, or\n // a hard break, or a text node that ends with whitespace, strip the\n // leading space.\n if (/^[ \\t\\r\\n\\u000c]/.test(value) && this.open == this.nodes.length - 1) {\n let nodeBefore = top.content[top.content.length - 1];\n let domNodeBefore = dom.previousSibling;\n if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == 'BR' || nodeBefore.isText && /[ \\t\\r\\n\\u000c]$/.test(nodeBefore.text)) value = value.slice(1);\n }\n } else if (preserveWS !== \"full\") {\n value = value.replace(/\\r?\\n|\\r/g, \" \");\n } else {\n value = value.replace(/\\r\\n?/g, \"\\n\");\n }\n if (value) this.insertNode(this.parser.schema.text(value), marks);\n this.findInText(dom);\n } else {\n this.findInside(dom);\n }\n }\n // Try to find a handler for the given tag and use that to parse. If\n // none is found, the element's content nodes are added directly.\n addElement(dom, marks, matchAfter) {\n let outerWS = this.localPreserveWS,\n top = this.top;\n if (dom.tagName == \"PRE\" || /pre/.test(dom.style && dom.style.whiteSpace)) this.localPreserveWS = true;\n let name = dom.nodeName.toLowerCase(),\n ruleID;\n if (listTags.hasOwnProperty(name) && this.parser.normalizeLists) normalizeList(dom);\n let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));\n out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {\n this.findInside(dom);\n this.ignoreFallback(dom, marks);\n } else if (!rule || rule.skip || rule.closeParent) {\n if (rule && rule.closeParent) this.open = Math.max(0, this.open - 1);else if (rule && rule.skip.nodeType) dom = rule.skip;\n let sync,\n oldNeedsBlock = this.needsBlock;\n if (blockTags.hasOwnProperty(name)) {\n if (top.content.length && top.content[0].isInline && this.open) {\n this.open--;\n top = this.top;\n }\n sync = true;\n if (!top.type) this.needsBlock = true;\n } else if (!dom.firstChild) {\n this.leafFallback(dom, marks);\n break out;\n }\n let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);\n if (innerMarks) this.addAll(dom, innerMarks);\n if (sync) this.sync(top);\n this.needsBlock = oldNeedsBlock;\n } else {\n let innerMarks = this.readStyles(dom, marks);\n if (innerMarks) this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : undefined);\n }\n this.localPreserveWS = outerWS;\n }\n // Called for leaf DOM nodes that would otherwise be ignored\n leafFallback(dom, marks) {\n if (dom.nodeName == \"BR\" && this.top.type && this.top.type.inlineContent) this.addTextNode(dom.ownerDocument.createTextNode(\"\\n\"), marks);\n }\n // Called for ignored nodes\n ignoreFallback(dom, marks) {\n // Ignored BR nodes should at least create an inline context\n if (dom.nodeName == \"BR\" && (!this.top.type || !this.top.type.inlineContent)) this.findPlace(this.parser.schema.text(\"-\"), marks);\n }\n // Run any style parser associated with the node's styles. Either\n // return an updated array of marks, or null to indicate some of the\n // styles had a rule with `ignore` set.\n readStyles(dom, marks) {\n let styles = dom.style;\n // Because many properties will only show up in 'normalized' form\n // in `style.item` (i.e. text-decoration becomes\n // text-decoration-line, text-decoration-color, etc), we directly\n // query the styles mentioned in our rules instead of iterating\n // over the items.\n if (styles && styles.length) for (let i = 0; i < this.parser.matchedStyles.length; i++) {\n let name = this.parser.matchedStyles[i],\n value = styles.getPropertyValue(name);\n if (value) for (let after = undefined;;) {\n let rule = this.parser.matchStyle(name, value, this, after);\n if (!rule) break;\n if (rule.ignore) return null;\n if (rule.clearMark) marks = marks.filter(m => !rule.clearMark(m));else marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));\n if (rule.consuming === false) after = rule;else break;\n }\n }\n return marks;\n }\n // Look up a handler for the given node. If none are found, return\n // false. Otherwise, apply it, use its return value to drive the way\n // the node's content is wrapped, and return true.\n addElementByRule(dom, rule, marks, continueAfter) {\n let sync, nodeType;\n if (rule.node) {\n nodeType = this.parser.schema.nodes[rule.node];\n if (!nodeType.isLeaf) {\n let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);\n if (inner) {\n sync = true;\n marks = inner;\n }\n } else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {\n this.leafFallback(dom, marks);\n }\n } else {\n let markType = this.parser.schema.marks[rule.mark];\n marks = marks.concat(markType.create(rule.attrs));\n }\n let startIn = this.top;\n if (nodeType && nodeType.isLeaf) {\n this.findInside(dom);\n } else if (continueAfter) {\n this.addElement(dom, marks, continueAfter);\n } else if (rule.getContent) {\n this.findInside(dom);\n rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks));\n } else {\n let contentDOM = dom;\n if (typeof rule.contentElement == \"string\") contentDOM = dom.querySelector(rule.contentElement);else if (typeof rule.contentElement == \"function\") contentDOM = rule.contentElement(dom);else if (rule.contentElement) contentDOM = rule.contentElement;\n this.findAround(dom, contentDOM, true);\n this.addAll(contentDOM, marks);\n this.findAround(dom, contentDOM, false);\n }\n if (sync && this.sync(startIn)) this.open--;\n }\n // Add all child nodes between `startIndex` and `endIndex` (or the\n // whole node, if not given). If `sync` is passed, use it to\n // synchronize after every block element.\n addAll(parent, marks, startIndex, endIndex) {\n let index = startIndex || 0;\n for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {\n this.findAtPoint(parent, index);\n this.addDOM(dom, marks);\n }\n this.findAtPoint(parent, index);\n }\n // Try to find a way to fit the given node type into the current\n // context. May add intermediate wrappers and/or leave non-solid\n // nodes that we're in.\n findPlace(node, marks) {\n let route, sync;\n for (let depth = this.open; depth >= 0; depth--) {\n let cx = this.nodes[depth];\n let found = cx.findWrapping(node);\n if (found && (!route || route.length > found.length)) {\n route = found;\n sync = cx;\n if (!found.length) break;\n }\n if (cx.solid) break;\n }\n if (!route) return null;\n this.sync(sync);\n for (let i = 0; i < route.length; i++) marks = this.enterInner(route[i], null, marks, false);\n return marks;\n }\n // Try to insert the given node, adjusting the context when needed.\n insertNode(node, marks) {\n if (node.isInline && this.needsBlock && !this.top.type) {\n let block = this.textblockFromContext();\n if (block) marks = this.enterInner(block, null, marks);\n }\n let innerMarks = this.findPlace(node, marks);\n if (innerMarks) {\n this.closeExtra();\n let top = this.top;\n if (top.match) top.match = top.match.matchType(node.type);\n let nodeMarks = Mark.none;\n for (let m of innerMarks.concat(node.marks)) if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type)) nodeMarks = m.addToSet(nodeMarks);\n top.content.push(node.mark(nodeMarks));\n return true;\n }\n return false;\n }\n // Try to start a node of the given type, adjusting the context when\n // necessary.\n enter(type, attrs, marks, preserveWS) {\n let innerMarks = this.findPlace(type.create(attrs), marks);\n if (innerMarks) innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);\n return innerMarks;\n }\n // Open a node of the given type\n enterInner(type, attrs, marks, solid = false, preserveWS) {\n this.closeExtra();\n let top = this.top;\n top.match = top.match && top.match.matchType(type);\n let options = wsOptionsFor(type, preserveWS, top.options);\n if (top.options & OPT_OPEN_LEFT && top.content.length == 0) options |= OPT_OPEN_LEFT;\n let applyMarks = Mark.none;\n marks = marks.filter(m => {\n if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {\n applyMarks = m.addToSet(applyMarks);\n return false;\n }\n return true;\n });\n this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));\n this.open++;\n return marks;\n }\n // Make sure all nodes above this.open are finished and added to\n // their parents\n closeExtra(openEnd = false) {\n let i = this.nodes.length - 1;\n if (i > this.open) {\n for (; i > this.open; i--) this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));\n this.nodes.length = this.open + 1;\n }\n }\n finish() {\n this.open = 0;\n this.closeExtra(this.isOpen);\n return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));\n }\n sync(to) {\n for (let i = this.open; i >= 0; i--) {\n if (this.nodes[i] == to) {\n this.open = i;\n return true;\n } else if (this.localPreserveWS) {\n this.nodes[i].options |= OPT_PRESERVE_WS;\n }\n }\n return false;\n }\n get currentPos() {\n this.closeExtra();\n let pos = 0;\n for (let i = this.open; i >= 0; i--) {\n let content = this.nodes[i].content;\n for (let j = content.length - 1; j >= 0; j--) pos += content[j].nodeSize;\n if (i) pos++;\n }\n return pos;\n }\n findAtPoint(parent, offset) {\n if (this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == parent && this.find[i].offset == offset) this.find[i].pos = this.currentPos;\n }\n }\n findInside(parent) {\n if (this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) this.find[i].pos = this.currentPos;\n }\n }\n findAround(parent, content, before) {\n if (parent != content && this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {\n let pos = content.compareDocumentPosition(this.find[i].node);\n if (pos & (before ? 2 : 4)) this.find[i].pos = this.currentPos;\n }\n }\n }\n findInText(textNode) {\n if (this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == textNode) this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);\n }\n }\n // Determines whether the given context string matches this context.\n matchesContext(context) {\n if (context.indexOf(\"|\") > -1) return context.split(/\\s*\\|\\s*/).some(this.matchesContext, this);\n let parts = context.split(\"/\");\n let option = this.options.context;\n let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);\n let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);\n let match = (i, depth) => {\n for (; i >= 0; i--) {\n let part = parts[i];\n if (part == \"\") {\n if (i == parts.length - 1 || i == 0) continue;\n for (; depth >= minDepth; depth--) if (match(i - 1, depth)) return true;\n return false;\n } else {\n let next = depth > 0 || depth == 0 && useRoot ? this.nodes[depth].type : option && depth >= minDepth ? option.node(depth - minDepth).type : null;\n if (!next || next.name != part && !next.isInGroup(part)) return false;\n depth--;\n }\n }\n return true;\n };\n return match(parts.length - 1, this.open);\n }\n textblockFromContext() {\n let $context = this.options.context;\n if ($context) for (let d = $context.depth; d >= 0; d--) {\n let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;\n if (deflt && deflt.isTextblock && deflt.defaultAttrs) return deflt;\n }\n for (let name in this.parser.schema.nodes) {\n let type = this.parser.schema.nodes[name];\n if (type.isTextblock && type.defaultAttrs) return type;\n }\n }\n}\n// Kludge to work around directly nested list nodes produced by some\n// tools and allowed by browsers to mean that the nested list is\n// actually part of the list item above it.\nfunction normalizeList(dom) {\n for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {\n let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;\n if (name && listTags.hasOwnProperty(name) && prevItem) {\n prevItem.appendChild(child);\n child = prevItem;\n } else if (name == \"li\") {\n prevItem = child;\n } else if (name) {\n prevItem = null;\n }\n }\n}\n// Apply a CSS selector.\nfunction matches(dom, selector) {\n return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);\n}\nfunction copy(obj) {\n let copy = {};\n for (let prop in obj) copy[prop] = obj[prop];\n return copy;\n}\n// Used when finding a mark at the top level of a fragment parse.\n// Checks whether it would be reasonable to apply a given mark type to\n// a given node, by looking at the way the mark occurs in the schema.\nfunction markMayApply(markType, nodeType) {\n let nodes = nodeType.schema.nodes;\n for (let name in nodes) {\n let parent = nodes[name];\n if (!parent.allowsMarkType(markType)) continue;\n let seen = [],\n scan = match => {\n seen.push(match);\n for (let i = 0; i < match.edgeCount; i++) {\n let {\n type,\n next\n } = match.edge(i);\n if (type == nodeType) return true;\n if (seen.indexOf(next) < 0 && scan(next)) return true;\n }\n };\n if (scan(parent.contentMatch)) return true;\n }\n}\n\n/**\nA DOM serializer knows how to convert ProseMirror nodes and\nmarks of various types to DOM nodes.\n*/\nclass DOMSerializer {\n /**\n Create a serializer. `nodes` should map node names to functions\n that take a node and return a description of the corresponding\n DOM. `marks` does the same for mark names, but also gets an\n argument that tells it whether the mark's content is block or\n inline content (for typical use, it'll always be inline). A mark\n serializer may be `null` to indicate that marks of that type\n should not be serialized.\n */\n constructor(\n /**\n The node serialization functions.\n */\n nodes,\n /**\n The mark serialization functions.\n */\n marks) {\n this.nodes = nodes;\n this.marks = marks;\n }\n /**\n Serialize the content of this fragment to a DOM fragment. When\n not in the browser, the `document` option, containing a DOM\n document, should be passed so that the serializer can create\n nodes.\n */\n serializeFragment(fragment, options = {}, target) {\n if (!target) target = doc(options).createDocumentFragment();\n let top = target,\n active = [];\n fragment.forEach(node => {\n if (active.length || node.marks.length) {\n let keep = 0,\n rendered = 0;\n while (keep < active.length && rendered < node.marks.length) {\n let next = node.marks[rendered];\n if (!this.marks[next.type.name]) {\n rendered++;\n continue;\n }\n if (!next.eq(active[keep][0]) || next.type.spec.spanning === false) break;\n keep++;\n rendered++;\n }\n while (keep < active.length) top = active.pop()[1];\n while (rendered < node.marks.length) {\n let add = node.marks[rendered++];\n let markDOM = this.serializeMark(add, node.isInline, options);\n if (markDOM) {\n active.push([add, top]);\n top.appendChild(markDOM.dom);\n top = markDOM.contentDOM || markDOM.dom;\n }\n }\n }\n top.appendChild(this.serializeNodeInner(node, options));\n });\n return target;\n }\n /**\n @internal\n */\n serializeNodeInner(node, options) {\n let {\n dom,\n contentDOM\n } = renderSpec(doc(options), this.nodes[node.type.name](node), null, node.attrs);\n if (contentDOM) {\n if (node.isLeaf) throw new RangeError(\"Content hole not allowed in a leaf node spec\");\n this.serializeFragment(node.content, options, contentDOM);\n }\n return dom;\n }\n /**\n Serialize this node to a DOM node. This can be useful when you\n need to serialize a part of a document, as opposed to the whole\n document. To serialize a whole document, use\n [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on\n its [content](https://prosemirror.net/docs/ref/#model.Node.content).\n */\n serializeNode(node, options = {}) {\n let dom = this.serializeNodeInner(node, options);\n for (let i = node.marks.length - 1; i >= 0; i--) {\n let wrap = this.serializeMark(node.marks[i], node.isInline, options);\n if (wrap) {\n (wrap.contentDOM || wrap.dom).appendChild(dom);\n dom = wrap.dom;\n }\n }\n return dom;\n }\n /**\n @internal\n */\n serializeMark(mark, inline, options = {}) {\n let toDOM = this.marks[mark.type.name];\n return toDOM && renderSpec(doc(options), toDOM(mark, inline), null, mark.attrs);\n }\n static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {\n return renderSpec(doc, structure, xmlNS, blockArraysIn);\n }\n /**\n Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)\n properties in a schema's node and mark specs.\n */\n static fromSchema(schema) {\n return schema.cached.domSerializer || (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));\n }\n /**\n Gather the serializers in a schema's node specs into an object.\n This can be useful as a base to build a custom serializer from.\n */\n static nodesFromSchema(schema) {\n let result = gatherToDOM(schema.nodes);\n if (!result.text) result.text = node => node.text;\n return result;\n }\n /**\n Gather the serializers in a schema's mark specs into an object.\n */\n static marksFromSchema(schema) {\n return gatherToDOM(schema.marks);\n }\n}\nfunction gatherToDOM(obj) {\n let result = {};\n for (let name in obj) {\n let toDOM = obj[name].spec.toDOM;\n if (toDOM) result[name] = toDOM;\n }\n return result;\n}\nfunction doc(options) {\n return options.document || window.document;\n}\nconst suspiciousAttributeCache = new WeakMap();\nfunction suspiciousAttributes(attrs) {\n let value = suspiciousAttributeCache.get(attrs);\n if (value === undefined) suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));\n return value;\n}\nfunction suspiciousAttributesInner(attrs) {\n let result = null;\n function scan(value) {\n if (value && typeof value == \"object\") {\n if (Array.isArray(value)) {\n if (typeof value[0] == \"string\") {\n if (!result) result = [];\n result.push(value);\n } else {\n for (let i = 0; i < value.length; i++) scan(value[i]);\n }\n } else {\n for (let prop in value) scan(value[prop]);\n }\n }\n }\n scan(attrs);\n return result;\n}\nfunction renderSpec(doc, structure, xmlNS, blockArraysIn) {\n if (typeof structure == \"string\") return {\n dom: doc.createTextNode(structure)\n };\n if (structure.nodeType != null) return {\n dom: structure\n };\n if (structure.dom && structure.dom.nodeType != null) return structure;\n let tagName = structure[0],\n suspicious;\n if (typeof tagName != \"string\") throw new RangeError(\"Invalid array passed to renderSpec\");\n if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1) throw new RangeError(\"Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.\");\n let space = tagName.indexOf(\" \");\n if (space > 0) {\n xmlNS = tagName.slice(0, space);\n tagName = tagName.slice(space + 1);\n }\n let contentDOM;\n let dom = xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName);\n let attrs = structure[1],\n start = 1;\n if (attrs && typeof attrs == \"object\" && attrs.nodeType == null && !Array.isArray(attrs)) {\n start = 2;\n for (let name in attrs) if (attrs[name] != null) {\n let space = name.indexOf(\" \");\n if (space > 0) dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);else dom.setAttribute(name, attrs[name]);\n }\n }\n for (let i = start; i < structure.length; i++) {\n let child = structure[i];\n if (child === 0) {\n if (i < structure.length - 1 || i > start) throw new RangeError(\"Content hole must be the only child of its parent node\");\n return {\n dom,\n contentDOM: dom\n };\n } else {\n let {\n dom: inner,\n contentDOM: innerContent\n } = renderSpec(doc, child, xmlNS, blockArraysIn);\n dom.appendChild(inner);\n if (innerContent) {\n if (contentDOM) throw new RangeError(\"Multiple content holes\");\n contentDOM = innerContent;\n }\n }\n }\n return {\n dom,\n contentDOM\n };\n}\nexport { ContentMatch, DOMParser, DOMSerializer, Fragment, Mark, MarkType, Node, NodeRange, NodeType, ReplaceError, ResolvedPos, Schema, Slice };","import { ReplaceError, Slice, Fragment, MarkType, Mark } from 'prosemirror-model';\n\n// Recovery values encode a range index and an offset. They are\n// represented as numbers, because tons of them will be created when\n// mapping, for example, a large number of decorations. The number's\n// lower 16 bits provide the index, the remaining bits the offset.\n//\n// Note: We intentionally don't use bit shift operators to en- and\n// decode these, since those clip to 32 bits, which we might in rare\n// cases want to overflow. A 64-bit float can represent 48-bit\n// integers precisely.\nconst lower16 = 0xffff;\nconst factor16 = Math.pow(2, 16);\nfunction makeRecover(index, offset) {\n return index + offset * factor16;\n}\nfunction recoverIndex(value) {\n return value & lower16;\n}\nfunction recoverOffset(value) {\n return (value - (value & lower16)) / factor16;\n}\nconst DEL_BEFORE = 1,\n DEL_AFTER = 2,\n DEL_ACROSS = 4,\n DEL_SIDE = 8;\n/**\nAn object representing a mapped position with extra\ninformation.\n*/\nclass MapResult {\n /**\n @internal\n */\n constructor(\n /**\n The mapped version of the position.\n */\n pos,\n /**\n @internal\n */\n delInfo,\n /**\n @internal\n */\n recover) {\n this.pos = pos;\n this.delInfo = delInfo;\n this.recover = recover;\n }\n /**\n Tells you whether the position was deleted, that is, whether the\n step removed the token on the side queried (via the `assoc`)\n argument from the document.\n */\n get deleted() {\n return (this.delInfo & DEL_SIDE) > 0;\n }\n /**\n Tells you whether the token before the mapped position was deleted.\n */\n get deletedBefore() {\n return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0;\n }\n /**\n True when the token after the mapped position was deleted.\n */\n get deletedAfter() {\n return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;\n }\n /**\n Tells whether any of the steps mapped through deletes across the\n position (including both the token before and after the\n position).\n */\n get deletedAcross() {\n return (this.delInfo & DEL_ACROSS) > 0;\n }\n}\n/**\nA map describing the deletions and insertions made by a step, which\ncan be used to find the correspondence between positions in the\npre-step version of a document and the same position in the\npost-step version.\n*/\nclass StepMap {\n /**\n Create a position map. The modifications to the document are\n represented as an array of numbers, in which each group of three\n represents a modified chunk as `[start, oldSize, newSize]`.\n */\n constructor(\n /**\n @internal\n */\n ranges,\n /**\n @internal\n */\n inverted = false) {\n this.ranges = ranges;\n this.inverted = inverted;\n if (!ranges.length && StepMap.empty) return StepMap.empty;\n }\n /**\n @internal\n */\n recover(value) {\n let diff = 0,\n index = recoverIndex(value);\n if (!this.inverted) for (let i = 0; i < index; i++) diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];\n return this.ranges[index * 3] + diff + recoverOffset(value);\n }\n mapResult(pos, assoc = 1) {\n return this._map(pos, assoc, false);\n }\n map(pos, assoc = 1) {\n return this._map(pos, assoc, true);\n }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let diff = 0,\n oldIndex = this.inverted ? 2 : 1,\n newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) break;\n let oldSize = this.ranges[i + oldIndex],\n newSize = this.ranges[i + newIndex],\n end = start + oldSize;\n if (pos <= end) {\n let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;\n let result = start + diff + (side < 0 ? 0 : newSize);\n if (simple) return result;\n let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);\n let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;\n if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;\n return new MapResult(result, del, recover);\n }\n diff += newSize - oldSize;\n }\n return simple ? pos + diff : new MapResult(pos + diff, 0, null);\n }\n /**\n @internal\n */\n touches(pos, recover) {\n let diff = 0,\n index = recoverIndex(recover);\n let oldIndex = this.inverted ? 2 : 1,\n newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) break;\n let oldSize = this.ranges[i + oldIndex],\n end = start + oldSize;\n if (pos <= end && i == index * 3) return true;\n diff += this.ranges[i + newIndex] - oldSize;\n }\n return false;\n }\n /**\n Calls the given function on each of the changed ranges included in\n this map.\n */\n forEach(f) {\n let oldIndex = this.inverted ? 2 : 1,\n newIndex = this.inverted ? 1 : 2;\n for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i],\n oldStart = start - (this.inverted ? diff : 0),\n newStart = start + (this.inverted ? 0 : diff);\n let oldSize = this.ranges[i + oldIndex],\n newSize = this.ranges[i + newIndex];\n f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n diff += newSize - oldSize;\n }\n }\n /**\n Create an inverted version of this map. The result can be used to\n map positions in the post-step document to the pre-step document.\n */\n invert() {\n return new StepMap(this.ranges, !this.inverted);\n }\n /**\n @internal\n */\n toString() {\n return (this.inverted ? \"-\" : \"\") + JSON.stringify(this.ranges);\n }\n /**\n Create a map that moves all positions by offset `n` (which may be\n negative). This can be useful when applying steps meant for a\n sub-document to a larger document, or vice-versa.\n */\n static offset(n) {\n return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);\n }\n}\n/**\nA StepMap that contains no changed ranges.\n*/\nStepMap.empty = new StepMap([]);\n/**\nA mapping represents a pipeline of zero or more [step\nmaps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly\nhandling mapping positions through a series of steps in which some\nsteps are inverted versions of earlier steps. (This comes up when\n‘[rebasing](/docs/guide/#transform.rebasing)’ steps for\ncollaboration or history management.)\n*/\nclass Mapping {\n /**\n Create a new mapping with the given position maps.\n */\n constructor(\n /**\n The step maps in this mapping.\n */\n maps = [],\n /**\n @internal\n */\n mirror,\n /**\n The starting position in the `maps` array, used when `map` or\n `mapResult` is called.\n */\n from = 0,\n /**\n The end position in the `maps` array.\n */\n to = maps.length) {\n this.maps = maps;\n this.mirror = mirror;\n this.from = from;\n this.to = to;\n }\n /**\n Create a mapping that maps only through a part of this one.\n */\n slice(from = 0, to = this.maps.length) {\n return new Mapping(this.maps, this.mirror, from, to);\n }\n /**\n @internal\n */\n copy() {\n return new Mapping(this.maps.slice(), this.mirror && this.mirror.slice(), this.from, this.to);\n }\n /**\n Add a step map to the end of this mapping. If `mirrors` is\n given, it should be the index of the step map that is the mirror\n image of this one.\n */\n appendMap(map, mirrors) {\n this.to = this.maps.push(map);\n if (mirrors != null) this.setMirror(this.maps.length - 1, mirrors);\n }\n /**\n Add all the step maps in a given mapping to this one (preserving\n mirroring information).\n */\n appendMapping(mapping) {\n for (let i = 0, startSize = this.maps.length; i < mapping.maps.length; i++) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);\n }\n }\n /**\n Finds the offset of the step map that mirrors the map at the\n given offset, in this mapping (as per the second argument to\n `appendMap`).\n */\n getMirror(n) {\n if (this.mirror) for (let i = 0; i < this.mirror.length; i++) if (this.mirror[i] == n) return this.mirror[i + (i % 2 ? -1 : 1)];\n }\n /**\n @internal\n */\n setMirror(n, m) {\n if (!this.mirror) this.mirror = [];\n this.mirror.push(n, m);\n }\n /**\n Append the inverse of the given mapping to this one.\n */\n appendMappingInverted(mapping) {\n for (let i = mapping.maps.length - 1, totalSize = this.maps.length + mapping.maps.length; i >= 0; i--) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);\n }\n }\n /**\n Create an inverted version of this mapping.\n */\n invert() {\n let inverse = new Mapping();\n inverse.appendMappingInverted(this);\n return inverse;\n }\n /**\n Map a position through this mapping.\n */\n map(pos, assoc = 1) {\n if (this.mirror) return this._map(pos, assoc, true);\n for (let i = this.from; i < this.to; i++) pos = this.maps[i].map(pos, assoc);\n return pos;\n }\n /**\n Map a position through this mapping, returning a mapping\n result.\n */\n mapResult(pos, assoc = 1) {\n return this._map(pos, assoc, false);\n }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let delInfo = 0;\n for (let i = this.from; i < this.to; i++) {\n let map = this.maps[i],\n result = map.mapResult(pos, assoc);\n if (result.recover != null) {\n let corr = this.getMirror(i);\n if (corr != null && corr > i && corr < this.to) {\n i = corr;\n pos = this.maps[corr].recover(result.recover);\n continue;\n }\n }\n delInfo |= result.delInfo;\n pos = result.pos;\n }\n return simple ? pos : new MapResult(pos, delInfo, null);\n }\n}\nconst stepsByID = Object.create(null);\n/**\nA step object represents an atomic change. It generally applies\nonly to the document it was created for, since the positions\nstored in it will only make sense for that document.\n\nNew steps are defined by creating classes that extend `Step`,\noverriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`\nmethods, and registering your class with a unique\nJSON-serialization identifier using\n[`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).\n*/\nclass Step {\n /**\n Get the step map that represents the changes made by this step,\n and which can be used to transform between positions in the old\n and the new document.\n */\n getMap() {\n return StepMap.empty;\n }\n /**\n Try to merge this step with another one, to be applied directly\n after it. Returns the merged step when possible, null if the\n steps can't be merged.\n */\n merge(other) {\n return null;\n }\n /**\n Deserialize a step from its JSON representation. Will call\n through to the step class' own implementation of this method.\n */\n static fromJSON(schema, json) {\n if (!json || !json.stepType) throw new RangeError(\"Invalid input for Step.fromJSON\");\n let type = stepsByID[json.stepType];\n if (!type) throw new RangeError(`No step type ${json.stepType} defined`);\n return type.fromJSON(schema, json);\n }\n /**\n To be able to serialize steps to JSON, each step needs a string\n ID to attach to its JSON representation. Use this method to\n register an ID for your step classes. Try to pick something\n that's unlikely to clash with steps from other modules.\n */\n static jsonID(id, stepClass) {\n if (id in stepsByID) throw new RangeError(\"Duplicate use of step JSON ID \" + id);\n stepsByID[id] = stepClass;\n stepClass.prototype.jsonID = id;\n return stepClass;\n }\n}\n/**\nThe result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a\nnew document or a failure value.\n*/\nclass StepResult {\n /**\n @internal\n */\n constructor(\n /**\n The transformed document, if successful.\n */\n doc,\n /**\n The failure message, if unsuccessful.\n */\n failed) {\n this.doc = doc;\n this.failed = failed;\n }\n /**\n Create a successful step result.\n */\n static ok(doc) {\n return new StepResult(doc, null);\n }\n /**\n Create a failed step result.\n */\n static fail(message) {\n return new StepResult(null, message);\n }\n /**\n Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given\n arguments. Create a successful result if it succeeds, and a\n failed one if it throws a `ReplaceError`.\n */\n static fromReplace(doc, from, to, slice) {\n try {\n return StepResult.ok(doc.replace(from, to, slice));\n } catch (e) {\n if (e instanceof ReplaceError) return StepResult.fail(e.message);\n throw e;\n }\n }\n}\nfunction mapFragment(fragment, f, parent) {\n let mapped = [];\n for (let i = 0; i < fragment.childCount; i++) {\n let child = fragment.child(i);\n if (child.content.size) child = child.copy(mapFragment(child.content, f, child));\n if (child.isInline) child = f(child, parent, i);\n mapped.push(child);\n }\n return Fragment.fromArray(mapped);\n}\n/**\nAdd a mark to all inline content between two positions.\n*/\nclass AddMarkStep extends Step {\n /**\n Create a mark step.\n */\n constructor(\n /**\n The start of the marked range.\n */\n from,\n /**\n The end of the marked range.\n */\n to,\n /**\n The mark to add.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to),\n $from = doc.resolve(this.from);\n let parent = $from.node($from.sharedDepth(this.to));\n let slice = new Slice(mapFragment(oldSlice.content, (node, parent) => {\n if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type)) return node;\n return node.mark(this.mark.addToSet(node.marks));\n }, parent), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new RemoveMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) return null;\n return new AddMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return {\n stepType: \"addMark\",\n mark: this.mark.toJSON(),\n from: this.from,\n to: this.to\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\") throw new RangeError(\"Invalid input for AddMarkStep.fromJSON\");\n return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addMark\", AddMarkStep);\n/**\nRemove a mark from all inline content between two positions.\n*/\nclass RemoveMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The start of the unmarked range.\n */\n from,\n /**\n The end of the unmarked range.\n */\n to,\n /**\n The mark to remove.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to);\n let slice = new Slice(mapFragment(oldSlice.content, node => {\n return node.mark(this.mark.removeFromSet(node.marks));\n }, doc), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new AddMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) return null;\n return new RemoveMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return {\n stepType: \"removeMark\",\n mark: this.mark.toJSON(),\n from: this.from,\n to: this.to\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\") throw new RangeError(\"Invalid input for RemoveMarkStep.fromJSON\");\n return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeMark\", RemoveMarkStep);\n/**\nAdd a mark to a specific node.\n*/\nclass AddNodeMarkStep extends Step {\n /**\n Create a node mark step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos,\n /**\n The mark to add.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node) return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (node) {\n let newSet = this.mark.addToSet(node.marks);\n if (newSet.length == node.marks.length) {\n for (let i = 0; i < node.marks.length; i++) if (!node.marks[i].isInSet(newSet)) return new AddNodeMarkStep(this.pos, node.marks[i]);\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n }\n return new RemoveNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return {\n stepType: \"addNodeMark\",\n pos: this.pos,\n mark: this.mark.toJSON()\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\") throw new RangeError(\"Invalid input for AddNodeMarkStep.fromJSON\");\n return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addNodeMark\", AddNodeMarkStep);\n/**\nRemove a mark from a specific node.\n*/\nclass RemoveNodeMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos,\n /**\n The mark to remove.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node) return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node || !this.mark.isInSet(node.marks)) return this;\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return {\n stepType: \"removeNodeMark\",\n pos: this.pos,\n mark: this.mark.toJSON()\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\") throw new RangeError(\"Invalid input for RemoveNodeMarkStep.fromJSON\");\n return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeNodeMark\", RemoveNodeMarkStep);\n\n/**\nReplace a part of the document with a slice of new content.\n*/\nclass ReplaceStep extends Step {\n /**\n The given `slice` should fit the 'gap' between `from` and\n `to`—the depths must line up, and the surrounding nodes must be\n able to be joined with the open sides of the slice. When\n `structure` is true, the step will fail if the content between\n from and to is not just a sequence of closing and then opening\n tokens (this is to guard against rebased replace steps\n overwriting something they weren't supposed to).\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from,\n /**\n The end position of the replaced range.\n */\n to,\n /**\n The slice to insert.\n */\n slice,\n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.slice = slice;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && contentBetween(doc, this.from, this.to)) return StepResult.fail(\"Structure replace would overwrite content\");\n return StepResult.fromReplace(doc, this.from, this.to, this.slice);\n }\n getMap() {\n return new StepMap([this.from, this.to - this.from, this.slice.size]);\n }\n invert(doc) {\n return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n if (from.deletedAcross && to.deletedAcross) return null;\n return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice);\n }\n merge(other) {\n if (!(other instanceof ReplaceStep) || other.structure || this.structure) return null;\n if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);\n return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);\n } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);\n return new ReplaceStep(other.from, this.to, slice, this.structure);\n } else {\n return null;\n }\n }\n toJSON() {\n let json = {\n stepType: \"replace\",\n from: this.from,\n to: this.to\n };\n if (this.slice.size) json.slice = this.slice.toJSON();\n if (this.structure) json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\") throw new RangeError(\"Invalid input for ReplaceStep.fromJSON\");\n return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);\n }\n}\nStep.jsonID(\"replace\", ReplaceStep);\n/**\nReplace a part of the document with a slice of content, but\npreserve a range of the replaced content by moving it into the\nslice.\n*/\nclass ReplaceAroundStep extends Step {\n /**\n Create a replace-around step with the given range and gap.\n `insert` should be the point in the slice into which the content\n of the gap should be moved. `structure` has the same meaning as\n it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from,\n /**\n The end position of the replaced range.\n */\n to,\n /**\n The start of preserved range.\n */\n gapFrom,\n /**\n The end of preserved range.\n */\n gapTo,\n /**\n The slice to insert.\n */\n slice,\n /**\n The position in the slice where the preserved range should be\n inserted.\n */\n insert,\n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.gapFrom = gapFrom;\n this.gapTo = gapTo;\n this.slice = slice;\n this.insert = insert;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to))) return StepResult.fail(\"Structure gap-replace would overwrite content\");\n let gap = doc.slice(this.gapFrom, this.gapTo);\n if (gap.openStart || gap.openEnd) return StepResult.fail(\"Gap is not a flat range\");\n let inserted = this.slice.insertAt(this.insert, gap.content);\n if (!inserted) return StepResult.fail(\"Content does not fit in gap\");\n return StepResult.fromReplace(doc, this.from, this.to, inserted);\n }\n getMap() {\n return new StepMap([this.from, this.gapFrom - this.from, this.insert, this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);\n }\n invert(doc) {\n let gap = this.gapTo - this.gapFrom;\n return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);\n let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);\n if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;\n return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);\n }\n toJSON() {\n let json = {\n stepType: \"replaceAround\",\n from: this.from,\n to: this.to,\n gapFrom: this.gapFrom,\n gapTo: this.gapTo,\n insert: this.insert\n };\n if (this.slice.size) json.slice = this.slice.toJSON();\n if (this.structure) json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\" || typeof json.gapFrom != \"number\" || typeof json.gapTo != \"number\" || typeof json.insert != \"number\") throw new RangeError(\"Invalid input for ReplaceAroundStep.fromJSON\");\n return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);\n }\n}\nStep.jsonID(\"replaceAround\", ReplaceAroundStep);\nfunction contentBetween(doc, from, to) {\n let $from = doc.resolve(from),\n dist = to - from,\n depth = $from.depth;\n while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {\n depth--;\n dist--;\n }\n if (dist > 0) {\n let next = $from.node(depth).maybeChild($from.indexAfter(depth));\n while (dist > 0) {\n if (!next || next.isLeaf) return true;\n next = next.firstChild;\n dist--;\n }\n }\n return false;\n}\nfunction addMark(tr, from, to, mark) {\n let removed = [],\n added = [];\n let removing, adding;\n tr.doc.nodesBetween(from, to, (node, pos, parent) => {\n if (!node.isInline) return;\n let marks = node.marks;\n if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {\n let start = Math.max(pos, from),\n end = Math.min(pos + node.nodeSize, to);\n let newSet = mark.addToSet(marks);\n for (let i = 0; i < marks.length; i++) {\n if (!marks[i].isInSet(newSet)) {\n if (removing && removing.to == start && removing.mark.eq(marks[i])) removing.to = end;else removed.push(removing = new RemoveMarkStep(start, end, marks[i]));\n }\n }\n if (adding && adding.to == start) adding.to = end;else added.push(adding = new AddMarkStep(start, end, mark));\n }\n });\n removed.forEach(s => tr.step(s));\n added.forEach(s => tr.step(s));\n}\nfunction removeMark(tr, from, to, mark) {\n let matched = [],\n step = 0;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isInline) return;\n step++;\n let toRemove = null;\n if (mark instanceof MarkType) {\n let set = node.marks,\n found;\n while (found = mark.isInSet(set)) {\n (toRemove || (toRemove = [])).push(found);\n set = found.removeFromSet(set);\n }\n } else if (mark) {\n if (mark.isInSet(node.marks)) toRemove = [mark];\n } else {\n toRemove = node.marks;\n }\n if (toRemove && toRemove.length) {\n let end = Math.min(pos + node.nodeSize, to);\n for (let i = 0; i < toRemove.length; i++) {\n let style = toRemove[i],\n found;\n for (let j = 0; j < matched.length; j++) {\n let m = matched[j];\n if (m.step == step - 1 && style.eq(matched[j].style)) found = m;\n }\n if (found) {\n found.to = end;\n found.step = step;\n } else {\n matched.push({\n style,\n from: Math.max(pos, from),\n to: end,\n step\n });\n }\n }\n }\n });\n matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));\n}\nfunction clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {\n let node = tr.doc.nodeAt(pos);\n let replSteps = [],\n cur = pos + 1;\n for (let i = 0; i < node.childCount; i++) {\n let child = node.child(i),\n end = cur + child.nodeSize;\n let allowed = match.matchType(child.type);\n if (!allowed) {\n replSteps.push(new ReplaceStep(cur, end, Slice.empty));\n } else {\n match = allowed;\n for (let j = 0; j < child.marks.length; j++) if (!parentType.allowsMarkType(child.marks[j].type)) tr.step(new RemoveMarkStep(cur, end, child.marks[j]));\n if (clearNewlines && child.isText && parentType.whitespace != \"pre\") {\n let m,\n newline = /\\r?\\n|\\r/g,\n slice;\n while (m = newline.exec(child.text)) {\n if (!slice) slice = new Slice(Fragment.from(parentType.schema.text(\" \", parentType.allowedMarks(child.marks))), 0, 0);\n replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));\n }\n }\n }\n cur = end;\n }\n if (!match.validEnd) {\n let fill = match.fillBefore(Fragment.empty, true);\n tr.replace(cur, cur, new Slice(fill, 0, 0));\n }\n for (let i = replSteps.length - 1; i >= 0; i--) tr.step(replSteps[i]);\n}\nfunction canCut(node, start, end) {\n return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));\n}\n/**\nTry to find a target depth to which the content in the given range\ncan be lifted. Will not go across\n[isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.\n*/\nfunction liftTarget(range) {\n let parent = range.parent;\n let content = parent.content.cutByIndex(range.startIndex, range.endIndex);\n for (let depth = range.depth;; --depth) {\n let node = range.$from.node(depth);\n let index = range.$from.index(depth),\n endIndex = range.$to.indexAfter(depth);\n if (depth < range.depth && node.canReplace(index, endIndex, content)) return depth;\n if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) break;\n }\n return null;\n}\nfunction lift(tr, range, target) {\n let {\n $from,\n $to,\n depth\n } = range;\n let gapStart = $from.before(depth + 1),\n gapEnd = $to.after(depth + 1);\n let start = gapStart,\n end = gapEnd;\n let before = Fragment.empty,\n openStart = 0;\n for (let d = depth, splitting = false; d > target; d--) if (splitting || $from.index(d) > 0) {\n splitting = true;\n before = Fragment.from($from.node(d).copy(before));\n openStart++;\n } else {\n start--;\n }\n let after = Fragment.empty,\n openEnd = 0;\n for (let d = depth, splitting = false; d > target; d--) if (splitting || $to.after(d + 1) < $to.end(d)) {\n splitting = true;\n after = Fragment.from($to.node(d).copy(after));\n openEnd++;\n } else {\n end++;\n }\n tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));\n}\n/**\nTry to find a valid way to wrap the content in the given range in a\nnode of the given type. May introduce extra nodes around and inside\nthe wrapper node, if necessary. Returns null if no valid wrapping\ncould be found. When `innerRange` is given, that range's content is\nused as the content to fit into the wrapping, instead of the\ncontent of `range`.\n*/\nfunction findWrapping(range, nodeType, attrs = null, innerRange = range) {\n let around = findWrappingOutside(range, nodeType);\n let inner = around && findWrappingInside(innerRange, nodeType);\n if (!inner) return null;\n return around.map(withAttrs).concat({\n type: nodeType,\n attrs\n }).concat(inner.map(withAttrs));\n}\nfunction withAttrs(type) {\n return {\n type,\n attrs: null\n };\n}\nfunction findWrappingOutside(range, type) {\n let {\n parent,\n startIndex,\n endIndex\n } = range;\n let around = parent.contentMatchAt(startIndex).findWrapping(type);\n if (!around) return null;\n let outer = around.length ? around[0] : type;\n return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;\n}\nfunction findWrappingInside(range, type) {\n let {\n parent,\n startIndex,\n endIndex\n } = range;\n let inner = parent.child(startIndex);\n let inside = type.contentMatch.findWrapping(inner.type);\n if (!inside) return null;\n let lastType = inside.length ? inside[inside.length - 1] : type;\n let innerMatch = lastType.contentMatch;\n for (let i = startIndex; innerMatch && i < endIndex; i++) innerMatch = innerMatch.matchType(parent.child(i).type);\n if (!innerMatch || !innerMatch.validEnd) return null;\n return inside;\n}\nfunction wrap(tr, range, wrappers) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--) {\n if (content.size) {\n let match = wrappers[i].type.contentMatch.matchFragment(content);\n if (!match || !match.validEnd) throw new RangeError(\"Wrapper type given to Transform.wrap does not form valid content of its parent wrapper\");\n }\n content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n }\n let start = range.start,\n end = range.end;\n tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));\n}\nfunction setBlockType(tr, from, to, type, attrs) {\n if (!type.isTextblock) throw new RangeError(\"Type given to setBlockType should be a textblock\");\n let mapFrom = tr.steps.length;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n let attrsHere = typeof attrs == \"function\" ? attrs(node) : attrs;\n if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {\n let convertNewlines = null;\n if (type.schema.linebreakReplacement) {\n let pre = type.whitespace == \"pre\",\n supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);\n if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;\n }\n // Ensure all markup that isn't allowed in the new node type is cleared\n if (convertNewlines === false) replaceLinebreaks(tr, node, pos, mapFrom);\n clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);\n let mapping = tr.mapping.slice(mapFrom);\n let startM = mapping.map(pos, 1),\n endM = mapping.map(pos + node.nodeSize, 1);\n tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));\n if (convertNewlines === true) replaceNewlines(tr, node, pos, mapFrom);\n return false;\n }\n });\n}\nfunction replaceNewlines(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.isText) {\n let m,\n newline = /\\r?\\n|\\r/g;\n while (m = newline.exec(child.text)) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);\n tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());\n }\n }\n });\n}\nfunction replaceLinebreaks(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.type == child.type.schema.linebreakReplacement) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);\n tr.replaceWith(start, start + 1, node.type.schema.text(\"\\n\"));\n }\n });\n}\nfunction canChangeType(doc, pos, type) {\n let $pos = doc.resolve(pos),\n index = $pos.index();\n return $pos.parent.canReplaceWith(index, index + 1, type);\n}\n/**\nChange the type, attributes, and/or marks of the node at `pos`.\nWhen `type` isn't given, the existing node type is preserved,\n*/\nfunction setNodeMarkup(tr, pos, type, attrs, marks) {\n let node = tr.doc.nodeAt(pos);\n if (!node) throw new RangeError(\"No node at given position\");\n if (!type) type = node.type;\n let newNode = type.create(attrs, null, marks || node.marks);\n if (node.isLeaf) return tr.replaceWith(pos, pos + node.nodeSize, newNode);\n if (!type.validContent(node.content)) throw new RangeError(\"Invalid content for node type \" + type.name);\n tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));\n}\n/**\nCheck whether splitting at the given position is allowed.\n*/\nfunction canSplit(doc, pos, depth = 1, typesAfter) {\n let $pos = doc.resolve(pos),\n base = $pos.depth - depth;\n let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;\n for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n let node = $pos.node(d),\n index = $pos.index(d);\n if (node.type.spec.isolating) return false;\n let rest = node.content.cutByIndex(index, node.childCount);\n let overrideChild = typesAfter && typesAfter[i + 1];\n if (overrideChild) rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));\n let after = typesAfter && typesAfter[i] || node;\n if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest)) return false;\n }\n let index = $pos.indexAfter(base);\n let baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n}\nfunction split(tr, pos, depth = 1, typesAfter) {\n let $pos = tr.doc.resolve(pos),\n before = Fragment.empty,\n after = Fragment.empty;\n for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {\n before = Fragment.from($pos.node(d).copy(before));\n let typeAfter = typesAfter && typesAfter[i];\n after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));\n }\n tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));\n}\n/**\nTest whether the blocks before and after a given position can be\njoined.\n*/\nfunction canJoin(doc, pos) {\n let $pos = doc.resolve(pos),\n index = $pos.index();\n return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);\n}\nfunction canAppendWithSubstitutedLinebreaks(a, b) {\n if (!b.content.size) a.type.compatibleContent(b.type);\n let match = a.contentMatchAt(a.childCount);\n let {\n linebreakReplacement\n } = a.type.schema;\n for (let i = 0; i < b.childCount; i++) {\n let child = b.child(i);\n let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;\n match = match.matchType(type);\n if (!match) return false;\n if (!a.type.allowsMarks(child.marks)) return false;\n }\n return match.validEnd;\n}\nfunction joinable(a, b) {\n return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));\n}\n/**\nFind an ancestor of the given position that can be joined to the\nblock before (or after if `dir` is positive). Returns the joinable\npoint, if any.\n*/\nfunction joinPoint(doc, pos, dir = -1) {\n let $pos = doc.resolve(pos);\n for (let d = $pos.depth;; d--) {\n let before,\n after,\n index = $pos.index(d);\n if (d == $pos.depth) {\n before = $pos.nodeBefore;\n after = $pos.nodeAfter;\n } else if (dir > 0) {\n before = $pos.node(d + 1);\n index++;\n after = $pos.node(d).maybeChild(index);\n } else {\n before = $pos.node(d).maybeChild(index - 1);\n after = $pos.node(d + 1);\n }\n if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index, index + 1)) return pos;\n if (d == 0) break;\n pos = dir < 0 ? $pos.before(d) : $pos.after(d);\n }\n}\nfunction join(tr, pos, depth) {\n let convertNewlines = null;\n let {\n linebreakReplacement\n } = tr.doc.type.schema;\n let $before = tr.doc.resolve(pos - depth),\n beforeType = $before.node().type;\n if (linebreakReplacement && beforeType.inlineContent) {\n let pre = beforeType.whitespace == \"pre\";\n let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);\n if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;\n }\n let mapFrom = tr.steps.length;\n if (convertNewlines === false) {\n let $after = tr.doc.resolve(pos + depth);\n replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);\n }\n if (beforeType.inlineContent) clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);\n let mapping = tr.mapping.slice(mapFrom),\n start = mapping.map(pos - depth);\n tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));\n if (convertNewlines === true) {\n let $full = tr.doc.resolve(start);\n replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);\n }\n return tr;\n}\n/**\nTry to find a point where a node of the given type can be inserted\nnear `pos`, by searching up the node hierarchy when `pos` itself\nisn't a valid place but is at the start or end of a node. Return\nnull if no position was found.\n*/\nfunction insertPoint(doc, pos, nodeType) {\n let $pos = doc.resolve(pos);\n if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) return pos;\n if ($pos.parentOffset == 0) for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.index(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.before(d + 1);\n if (index > 0) return null;\n }\n if ($pos.parentOffset == $pos.parent.content.size) for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.indexAfter(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.after(d + 1);\n if (index < $pos.node(d).childCount) return null;\n }\n return null;\n}\n/**\nFinds a position at or around the given position where the given\nslice can be inserted. Will look at parent nodes' nearest boundary\nand try there, even if the original position wasn't directly at the\nstart or end of that node. Returns null when no position was found.\n*/\nfunction dropPoint(doc, pos, slice) {\n let $pos = doc.resolve(pos);\n if (!slice.content.size) return pos;\n let content = slice.content;\n for (let i = 0; i < slice.openStart; i++) content = content.firstChild.content;\n for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {\n for (let d = $pos.depth; d >= 0; d--) {\n let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;\n let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);\n let parent = $pos.node(d),\n fits = false;\n if (pass == 1) {\n fits = parent.canReplace(insertPos, insertPos, content);\n } else {\n let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);\n fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);\n }\n if (fits) return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);\n }\n }\n return null;\n}\n\n/**\n‘Fit’ a slice into a given position in the document, producing a\n[step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if\nthere's no meaningful way to insert the slice here, or inserting it\nwould be a no-op (an empty slice over an empty range).\n*/\nfunction replaceStep(doc, from, to = from, slice = Slice.empty) {\n if (from == to && !slice.size) return null;\n let $from = doc.resolve(from),\n $to = doc.resolve(to);\n // Optimization -- avoid work if it's obvious that it's not needed.\n if (fitsTrivially($from, $to, slice)) return new ReplaceStep(from, to, slice);\n return new Fitter($from, $to, slice).fit();\n}\nfunction fitsTrivially($from, $to, slice) {\n return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);\n}\n// Algorithm for 'placing' the elements of a slice into a gap:\n//\n// We consider the content of each node that is open to the left to be\n// independently placeable. I.e. in , when the\n// paragraph on the left is open, \"foo\" can be placed (somewhere on\n// the left side of the replacement gap) independently from p(\"bar\").\n//\n// This class tracks the state of the placement progress in the\n// following properties:\n//\n// - `frontier` holds a stack of `{type, match}` objects that\n// represent the open side of the replacement. It starts at\n// `$from`, then moves forward as content is placed, and is finally\n// reconciled with `$to`.\n//\n// - `unplaced` is a slice that represents the content that hasn't\n// been placed yet.\n//\n// - `placed` is a fragment of placed content. Its open-start value\n// is implicit in `$from`, and its open-end value in `frontier`.\nclass Fitter {\n constructor($from, $to, unplaced) {\n this.$from = $from;\n this.$to = $to;\n this.unplaced = unplaced;\n this.frontier = [];\n this.placed = Fragment.empty;\n for (let i = 0; i <= $from.depth; i++) {\n let node = $from.node(i);\n this.frontier.push({\n type: node.type,\n match: node.contentMatchAt($from.indexAfter(i))\n });\n }\n for (let i = $from.depth; i > 0; i--) this.placed = Fragment.from($from.node(i).copy(this.placed));\n }\n get depth() {\n return this.frontier.length - 1;\n }\n fit() {\n // As long as there's unplaced content, try to place some of it.\n // If that fails, either increase the open score of the unplaced\n // slice, or drop nodes from it, and then try again.\n while (this.unplaced.size) {\n let fit = this.findFittable();\n if (fit) this.placeNodes(fit);else this.openMore() || this.dropNode();\n }\n // When there's inline content directly after the frontier _and_\n // directly after `this.$to`, we must generate a `ReplaceAround`\n // step that pulls that content into the node after the frontier.\n // That means the fitting must be done to the end of the textblock\n // node after `this.$to`, not `this.$to` itself.\n let moveInline = this.mustMoveInline(),\n placedSize = this.placed.size - this.depth - this.$from.depth;\n let $from = this.$from,\n $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));\n if (!$to) return null;\n // If closing to `$to` succeeded, create a step\n let content = this.placed,\n openStart = $from.depth,\n openEnd = $to.depth;\n while (openStart && openEnd && content.childCount == 1) {\n // Normalize by dropping open parent nodes\n content = content.firstChild.content;\n openStart--;\n openEnd--;\n }\n let slice = new Slice(content, openStart, openEnd);\n if (moveInline > -1) return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);\n if (slice.size || $from.pos != this.$to.pos)\n // Don't generate no-op steps\n return new ReplaceStep($from.pos, $to.pos, slice);\n return null;\n }\n // Find a position on the start spine of `this.unplaced` that has\n // content that can be moved somewhere on the frontier. Returns two\n // depths, one for the slice and one for the frontier.\n findFittable() {\n let startDepth = this.unplaced.openStart;\n for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {\n let node = cur.firstChild;\n if (cur.childCount > 1) openEnd = 0;\n if (node.type.spec.isolating && openEnd <= d) {\n startDepth = d;\n break;\n }\n cur = node.content;\n }\n // Only try wrapping nodes (pass 2) after finding a place without\n // wrapping failed.\n for (let pass = 1; pass <= 2; pass++) {\n for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {\n let fragment,\n parent = null;\n if (sliceDepth) {\n parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;\n fragment = parent.content;\n } else {\n fragment = this.unplaced.content;\n }\n let first = fragment.firstChild;\n for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {\n let {\n type,\n match\n } = this.frontier[frontierDepth],\n wrap,\n inject = null;\n // In pass 1, if the next node matches, or there is no next\n // node but the parents look compatible, we've found a\n // place.\n if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false)) : parent && type.compatibleContent(parent.type))) return {\n sliceDepth,\n frontierDepth,\n parent,\n inject\n };\n // In pass 2, look for a set of wrapping nodes that make\n // `first` fit here.\n else if (pass == 2 && first && (wrap = match.findWrapping(first.type))) return {\n sliceDepth,\n frontierDepth,\n parent,\n wrap\n };\n // Don't continue looking further up if the parent node\n // would fit here.\n if (parent && match.matchType(parent.type)) break;\n }\n }\n }\n }\n openMore() {\n let {\n content,\n openStart,\n openEnd\n } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (!inner.childCount || inner.firstChild.isLeaf) return false;\n this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));\n return true;\n }\n dropNode() {\n let {\n content,\n openStart,\n openEnd\n } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (inner.childCount <= 1 && openStart > 0) {\n let openAtEnd = content.size - openStart <= openStart + inner.size;\n this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);\n } else {\n this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);\n }\n }\n // Move content from the unplaced slice at `sliceDepth` to the\n // frontier node at `frontierDepth`. Close that frontier node when\n // applicable.\n placeNodes({\n sliceDepth,\n frontierDepth,\n parent,\n inject,\n wrap\n }) {\n while (this.depth > frontierDepth) this.closeFrontierNode();\n if (wrap) for (let i = 0; i < wrap.length; i++) this.openFrontierNode(wrap[i]);\n let slice = this.unplaced,\n fragment = parent ? parent.content : slice.content;\n let openStart = slice.openStart - sliceDepth;\n let taken = 0,\n add = [];\n let {\n match,\n type\n } = this.frontier[frontierDepth];\n if (inject) {\n for (let i = 0; i < inject.childCount; i++) add.push(inject.child(i));\n match = match.matchFragment(inject);\n }\n // Computes the amount of (end) open nodes at the end of the\n // fragment. When 0, the parent is open, but no more. When\n // negative, nothing is open.\n let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);\n // Scan over the fragment, fitting as many child nodes as\n // possible.\n while (taken < fragment.childCount) {\n let next = fragment.child(taken),\n matches = match.matchType(next.type);\n if (!matches) break;\n taken++;\n if (taken > 1 || openStart == 0 || next.content.size) {\n // Drop empty open nodes\n match = matches;\n add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));\n }\n }\n let toEnd = taken == fragment.childCount;\n if (!toEnd) openEndCount = -1;\n this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));\n this.frontier[frontierDepth].match = match;\n // If the parent types match, and the entire node was moved, and\n // it's not open, close this frontier node right away.\n if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) this.closeFrontierNode();\n // Add new frontier nodes for any open nodes at the end.\n for (let i = 0, cur = fragment; i < openEndCount; i++) {\n let node = cur.lastChild;\n this.frontier.push({\n type: node.type,\n match: node.contentMatchAt(node.childCount)\n });\n cur = node.content;\n }\n // Update `this.unplaced`. Drop the entire node from which we\n // placed it we got to its end, otherwise just drop the placed\n // nodes.\n this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);\n }\n mustMoveInline() {\n if (!this.$to.parent.isTextblock) return -1;\n let top = this.frontier[this.depth],\n level;\n if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth) return -1;\n let {\n depth\n } = this.$to,\n after = this.$to.after(depth);\n while (depth > 1 && after == this.$to.end(--depth)) ++after;\n return after;\n }\n findCloseLevel($to) {\n scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {\n let {\n match,\n type\n } = this.frontier[i];\n let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));\n let fit = contentAfterFits($to, i, type, match, dropInner);\n if (!fit) continue;\n for (let d = i - 1; d >= 0; d--) {\n let {\n match,\n type\n } = this.frontier[d];\n let matches = contentAfterFits($to, d, type, match, true);\n if (!matches || matches.childCount) continue scan;\n }\n return {\n depth: i,\n fit,\n move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to\n };\n }\n }\n close($to) {\n let close = this.findCloseLevel($to);\n if (!close) return null;\n while (this.depth > close.depth) this.closeFrontierNode();\n if (close.fit.childCount) this.placed = addToFragment(this.placed, close.depth, close.fit);\n $to = close.move;\n for (let d = close.depth + 1; d <= $to.depth; d++) {\n let node = $to.node(d),\n add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));\n this.openFrontierNode(node.type, node.attrs, add);\n }\n return $to;\n }\n openFrontierNode(type, attrs = null, content) {\n let top = this.frontier[this.depth];\n top.match = top.match.matchType(type);\n this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));\n this.frontier.push({\n type,\n match: type.contentMatch\n });\n }\n closeFrontierNode() {\n let open = this.frontier.pop();\n let add = open.match.fillBefore(Fragment.empty, true);\n if (add.childCount) this.placed = addToFragment(this.placed, this.frontier.length, add);\n }\n}\nfunction dropFromFragment(fragment, depth, count) {\n if (depth == 0) return fragment.cutByIndex(count, fragment.childCount);\n return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));\n}\nfunction addToFragment(fragment, depth, content) {\n if (depth == 0) return fragment.append(content);\n return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));\n}\nfunction contentAt(fragment, depth) {\n for (let i = 0; i < depth; i++) fragment = fragment.firstChild.content;\n return fragment;\n}\nfunction closeNodeStart(node, openStart, openEnd) {\n if (openStart <= 0) return node;\n let frag = node.content;\n if (openStart > 1) frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));\n if (openStart > 0) {\n frag = node.type.contentMatch.fillBefore(frag).append(frag);\n if (openEnd <= 0) frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true));\n }\n return node.copy(frag);\n}\nfunction contentAfterFits($to, depth, type, match, open) {\n let node = $to.node(depth),\n index = open ? $to.indexAfter(depth) : $to.index(depth);\n if (index == node.childCount && !type.compatibleContent(node.type)) return null;\n let fit = match.fillBefore(node.content, true, index);\n return fit && !invalidMarks(type, node.content, index) ? fit : null;\n}\nfunction invalidMarks(type, fragment, start) {\n for (let i = start; i < fragment.childCount; i++) if (!type.allowsMarks(fragment.child(i).marks)) return true;\n return false;\n}\nfunction definesContent(type) {\n return type.spec.defining || type.spec.definingForContent;\n}\nfunction replaceRange(tr, from, to, slice) {\n if (!slice.size) return tr.deleteRange(from, to);\n let $from = tr.doc.resolve(from),\n $to = tr.doc.resolve(to);\n if (fitsTrivially($from, $to, slice)) return tr.step(new ReplaceStep(from, to, slice));\n let targetDepths = coveredDepths($from, tr.doc.resolve(to));\n // Can't replace the whole document, so remove 0 if it's present\n if (targetDepths[targetDepths.length - 1] == 0) targetDepths.pop();\n // Negative numbers represent not expansion over the whole node at\n // that depth, but replacing from $from.before(-D) to $to.pos.\n let preferredTarget = -($from.depth + 1);\n targetDepths.unshift(preferredTarget);\n // This loop picks a preferred target depth, if one of the covering\n // depths is not outside of a defining node, and adds negative\n // depths for any depth that has $from at its start and does not\n // cross a defining node.\n for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {\n let spec = $from.node(d).type.spec;\n if (spec.defining || spec.definingAsContext || spec.isolating) break;\n if (targetDepths.indexOf(d) > -1) preferredTarget = d;else if ($from.before(d) == pos) targetDepths.splice(1, 0, -d);\n }\n // Try to fit each possible depth of the slice into each possible\n // target depth, starting with the preferred depths.\n let preferredTargetIndex = targetDepths.indexOf(preferredTarget);\n let leftNodes = [],\n preferredDepth = slice.openStart;\n for (let content = slice.content, i = 0;; i++) {\n let node = content.firstChild;\n leftNodes.push(node);\n if (i == slice.openStart) break;\n content = node.content;\n }\n // Back up preferredDepth to cover defining textblocks directly\n // above it, possibly skipping a non-defining textblock.\n for (let d = preferredDepth - 1; d >= 0; d--) {\n let leftNode = leftNodes[d],\n def = definesContent(leftNode.type);\n if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) preferredDepth = d;else if (def || !leftNode.type.isTextblock) break;\n }\n for (let j = slice.openStart; j >= 0; j--) {\n let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);\n let insert = leftNodes[openDepth];\n if (!insert) continue;\n for (let i = 0; i < targetDepths.length; i++) {\n // Loop over possible expansion levels, starting with the\n // preferred one\n let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length],\n expand = true;\n if (targetDepth < 0) {\n expand = false;\n targetDepth = -targetDepth;\n }\n let parent = $from.node(targetDepth - 1),\n index = $from.index(targetDepth - 1);\n if (parent.canReplaceWith(index, index, insert.type, insert.marks)) return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));\n }\n }\n let startSteps = tr.steps.length;\n for (let i = targetDepths.length - 1; i >= 0; i--) {\n tr.replace(from, to, slice);\n if (tr.steps.length > startSteps) break;\n let depth = targetDepths[i];\n if (depth < 0) continue;\n from = $from.before(depth);\n to = $to.after(depth);\n }\n}\nfunction closeFragment(fragment, depth, oldOpen, newOpen, parent) {\n if (depth < oldOpen) {\n let first = fragment.firstChild;\n fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));\n }\n if (depth > newOpen) {\n let match = parent.contentMatchAt(0);\n let start = match.fillBefore(fragment).append(fragment);\n fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));\n }\n return fragment;\n}\nfunction replaceRangeWith(tr, from, to, node) {\n if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {\n let point = insertPoint(tr.doc, from, node.type);\n if (point != null) from = to = point;\n }\n tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));\n}\nfunction deleteRange(tr, from, to) {\n let $from = tr.doc.resolve(from),\n $to = tr.doc.resolve(to);\n let covered = coveredDepths($from, $to);\n for (let i = 0; i < covered.length; i++) {\n let depth = covered[i],\n last = i == covered.length - 1;\n if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd) return tr.delete($from.start(depth), $to.end(depth));\n if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) return tr.delete($from.before(depth), $to.after(depth));\n }\n for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {\n if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1))) return tr.delete($from.before(d), to);\n }\n tr.delete(from, to);\n}\n// Returns an array of all depths for which $from - $to spans the\n// whole content of the nodes at that depth.\nfunction coveredDepths($from, $to) {\n let result = [],\n minDepth = Math.min($from.depth, $to.depth);\n for (let d = minDepth; d >= 0; d--) {\n let start = $from.start(d);\n if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating) break;\n if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1) result.push(d);\n }\n return result;\n}\n\n/**\nUpdate an attribute in a specific node.\n*/\nclass AttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos,\n /**\n The attribute to set.\n */\n attr,\n // The attribute's new value.\n value) {\n super();\n this.pos = pos;\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node) return StepResult.fail(\"No node at attribute step's position\");\n let attrs = Object.create(null);\n for (let name in node.attrs) attrs[name] = node.attrs[name];\n attrs[this.attr] = this.value;\n let updated = node.type.create(attrs, null, node.marks);\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);\n }\n toJSON() {\n return {\n stepType: \"attr\",\n pos: this.pos,\n attr: this.attr,\n value: this.value\n };\n }\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\" || typeof json.attr != \"string\") throw new RangeError(\"Invalid input for AttrStep.fromJSON\");\n return new AttrStep(json.pos, json.attr, json.value);\n }\n}\nStep.jsonID(\"attr\", AttrStep);\n/**\nUpdate an attribute in the doc node.\n*/\nclass DocAttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The attribute to set.\n */\n attr,\n // The attribute's new value.\n value) {\n super();\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let attrs = Object.create(null);\n for (let name in doc.attrs) attrs[name] = doc.attrs[name];\n attrs[this.attr] = this.value;\n let updated = doc.type.create(attrs, doc.content, doc.marks);\n return StepResult.ok(updated);\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new DocAttrStep(this.attr, doc.attrs[this.attr]);\n }\n map(mapping) {\n return this;\n }\n toJSON() {\n return {\n stepType: \"docAttr\",\n attr: this.attr,\n value: this.value\n };\n }\n static fromJSON(schema, json) {\n if (typeof json.attr != \"string\") throw new RangeError(\"Invalid input for DocAttrStep.fromJSON\");\n return new DocAttrStep(json.attr, json.value);\n }\n}\nStep.jsonID(\"docAttr\", DocAttrStep);\n\n/**\n@internal\n*/\nlet TransformError = class extends Error {};\nTransformError = function TransformError(message) {\n let err = Error.call(this, message);\n err.__proto__ = TransformError.prototype;\n return err;\n};\nTransformError.prototype = Object.create(Error.prototype);\nTransformError.prototype.constructor = TransformError;\nTransformError.prototype.name = \"TransformError\";\n/**\nAbstraction to build up and track an array of\n[steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.\n\nMost transforming methods return the `Transform` object itself, so\nthat they can be chained.\n*/\nclass Transform {\n /**\n Create a transform that starts with the given document.\n */\n constructor(\n /**\n The current document (the result of applying the steps in the\n transform).\n */\n doc) {\n this.doc = doc;\n /**\n The steps in this transform.\n */\n this.steps = [];\n /**\n The documents before each of the steps.\n */\n this.docs = [];\n /**\n A mapping with the maps for each of the steps in this transform.\n */\n this.mapping = new Mapping();\n }\n /**\n The starting document.\n */\n get before() {\n return this.docs.length ? this.docs[0] : this.doc;\n }\n /**\n Apply a new step in this transform, saving the result. Throws an\n error when the step fails.\n */\n step(step) {\n let result = this.maybeStep(step);\n if (result.failed) throw new TransformError(result.failed);\n return this;\n }\n /**\n Try to apply a step in this transformation, ignoring it if it\n fails. Returns the step result.\n */\n maybeStep(step) {\n let result = step.apply(this.doc);\n if (!result.failed) this.addStep(step, result.doc);\n return result;\n }\n /**\n True when the document has been changed (when there are any\n steps).\n */\n get docChanged() {\n return this.steps.length > 0;\n }\n /**\n @internal\n */\n addStep(step, doc) {\n this.docs.push(this.doc);\n this.steps.push(step);\n this.mapping.appendMap(step.getMap());\n this.doc = doc;\n }\n /**\n Replace the part of the document between `from` and `to` with the\n given `slice`.\n */\n replace(from, to = from, slice = Slice.empty) {\n let step = replaceStep(this.doc, from, to, slice);\n if (step) this.step(step);\n return this;\n }\n /**\n Replace the given range with the given content, which may be a\n fragment, node, or array of nodes.\n */\n replaceWith(from, to, content) {\n return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));\n }\n /**\n Delete the content between the given positions.\n */\n delete(from, to) {\n return this.replace(from, to, Slice.empty);\n }\n /**\n Insert the given content at the given position.\n */\n insert(pos, content) {\n return this.replaceWith(pos, pos, content);\n }\n /**\n Replace a range of the document with a given slice, using\n `from`, `to`, and the slice's\n [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather\n than fixed start and end points. This method may grow the\n replaced area or close open nodes in the slice in order to get a\n fit that is more in line with WYSIWYG expectations, by dropping\n fully covered parent nodes of the replaced region when they are\n marked [non-defining as\n context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an\n open parent node from the slice that _is_ marked as [defining\n its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).\n \n This is the method, for example, to handle paste. The similar\n [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more\n primitive tool which will _not_ move the start and end of its given\n range, and is useful in situations where you need more precise\n control over what happens.\n */\n replaceRange(from, to, slice) {\n replaceRange(this, from, to, slice);\n return this;\n }\n /**\n Replace the given range with a node, but use `from` and `to` as\n hints, rather than precise positions. When from and to are the same\n and are at the start or end of a parent node in which the given\n node doesn't fit, this method may _move_ them out towards a parent\n that does allow the given node to be placed. When the given range\n completely covers a parent node, this method may completely replace\n that parent node.\n */\n replaceRangeWith(from, to, node) {\n replaceRangeWith(this, from, to, node);\n return this;\n }\n /**\n Delete the given range, expanding it to cover fully covered\n parent nodes until a valid replace is found.\n */\n deleteRange(from, to) {\n deleteRange(this, from, to);\n return this;\n }\n /**\n Split the content in the given range off from its parent, if there\n is sibling content before or after it, and move it up the tree to\n the depth specified by `target`. You'll probably want to use\n [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make\n sure the lift is valid.\n */\n lift(range, target) {\n lift(this, range, target);\n return this;\n }\n /**\n Join the blocks around the given position. If depth is 2, their\n last and first siblings are also joined, and so on.\n */\n join(pos, depth = 1) {\n join(this, pos, depth);\n return this;\n }\n /**\n Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.\n The wrappers are assumed to be valid in this position, and should\n probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).\n */\n wrap(range, wrappers) {\n wrap(this, range, wrappers);\n return this;\n }\n /**\n Set the type of all textblocks (partly) between `from` and `to` to\n the given node type with the given attributes.\n */\n setBlockType(from, to = from, type, attrs = null) {\n setBlockType(this, from, to, type, attrs);\n return this;\n }\n /**\n Change the type, attributes, and/or marks of the node at `pos`.\n When `type` isn't given, the existing node type is preserved,\n */\n setNodeMarkup(pos, type, attrs = null, marks) {\n setNodeMarkup(this, pos, type, attrs, marks);\n return this;\n }\n /**\n Set a single attribute on a given node to a new value.\n The `pos` addresses the document content. Use `setDocAttribute`\n to set attributes on the document itself.\n */\n setNodeAttribute(pos, attr, value) {\n this.step(new AttrStep(pos, attr, value));\n return this;\n }\n /**\n Set a single attribute on the document to a new value.\n */\n setDocAttribute(attr, value) {\n this.step(new DocAttrStep(attr, value));\n return this;\n }\n /**\n Add a mark to the node at position `pos`.\n */\n addNodeMark(pos, mark) {\n this.step(new AddNodeMarkStep(pos, mark));\n return this;\n }\n /**\n Remove a mark (or a mark of the given type) from the node at\n position `pos`.\n */\n removeNodeMark(pos, mark) {\n if (!(mark instanceof Mark)) {\n let node = this.doc.nodeAt(pos);\n if (!node) throw new RangeError(\"No node at position \" + pos);\n mark = mark.isInSet(node.marks);\n if (!mark) return this;\n }\n this.step(new RemoveNodeMarkStep(pos, mark));\n return this;\n }\n /**\n Split the node at the given position, and optionally, if `depth` is\n greater than one, any number of nodes above that. By default, the\n parts split off will inherit the node type of the original node.\n This can be changed by passing an array of types and attributes to\n use after the split.\n */\n split(pos, depth = 1, typesAfter) {\n split(this, pos, depth, typesAfter);\n return this;\n }\n /**\n Add the given mark to the inline content between `from` and `to`.\n */\n addMark(from, to, mark) {\n addMark(this, from, to, mark);\n return this;\n }\n /**\n Remove marks from inline nodes between `from` and `to`. When\n `mark` is a single mark, remove precisely that mark. When it is\n a mark type, remove all marks of that type. When it is null,\n remove all marks of any type.\n */\n removeMark(from, to, mark) {\n removeMark(this, from, to, mark);\n return this;\n }\n /**\n Removes all marks and nodes from the content of the node at\n `pos` that don't match the given new parent node type. Accepts\n an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as\n third argument.\n */\n clearIncompatible(pos, parentType, match) {\n clearIncompatible(this, pos, parentType, match);\n return this;\n }\n}\nexport { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, TransformError, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep };","import { Slice, Fragment, Mark, Node } from 'prosemirror-model';\nimport { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';\nconst classesById = Object.create(null);\n/**\nSuperclass for editor selections. Every selection type should\nextend this. Should not be instantiated directly.\n*/\nclass Selection {\n /**\n Initialize a selection with the head and anchor and ranges. If no\n ranges are given, constructs a single range across `$anchor` and\n `$head`.\n */\n constructor(\n /**\n The resolved anchor of the selection (the side that stays in\n place when the selection is modified).\n */\n $anchor,\n /**\n The resolved head of the selection (the side that moves when\n the selection is modified).\n */\n $head, ranges) {\n this.$anchor = $anchor;\n this.$head = $head;\n this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];\n }\n /**\n The selection's anchor, as an unresolved position.\n */\n get anchor() {\n return this.$anchor.pos;\n }\n /**\n The selection's head.\n */\n get head() {\n return this.$head.pos;\n }\n /**\n The lower bound of the selection's main range.\n */\n get from() {\n return this.$from.pos;\n }\n /**\n The upper bound of the selection's main range.\n */\n get to() {\n return this.$to.pos;\n }\n /**\n The resolved lower bound of the selection's main range.\n */\n get $from() {\n return this.ranges[0].$from;\n }\n /**\n The resolved upper bound of the selection's main range.\n */\n get $to() {\n return this.ranges[0].$to;\n }\n /**\n Indicates whether the selection contains any content.\n */\n get empty() {\n let ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) if (ranges[i].$from.pos != ranges[i].$to.pos) return false;\n return true;\n }\n /**\n Get the content of this selection as a slice.\n */\n content() {\n return this.$from.doc.slice(this.from, this.to, true);\n }\n /**\n Replace the selection with a slice or, if no slice is given,\n delete the selection. Will append to the given transaction.\n */\n replace(tr, content = Slice.empty) {\n // Put the new selection at the position after the inserted\n // content. When that ended in an inline node, search backwards,\n // to get the position after that node. If not, search forward.\n let lastNode = content.content.lastChild,\n lastParent = null;\n for (let i = 0; i < content.openEnd; i++) {\n lastParent = lastNode;\n lastNode = lastNode.lastChild;\n }\n let mapFrom = tr.steps.length,\n ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i],\n mapping = tr.mapping.slice(mapFrom);\n tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n if (i == 0) selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);\n }\n }\n /**\n Replace the selection with the given node, appending the changes\n to the given transaction.\n */\n replaceWith(tr, node) {\n let mapFrom = tr.steps.length,\n ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i],\n mapping = tr.mapping.slice(mapFrom);\n let from = mapping.map($from.pos),\n to = mapping.map($to.pos);\n if (i) {\n tr.deleteRange(from, to);\n } else {\n tr.replaceRangeWith(from, to, node);\n selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);\n }\n }\n }\n /**\n Find a valid cursor or leaf node selection starting at the given\n position and searching back if `dir` is negative, and forward if\n positive. When `textOnly` is true, only consider cursor\n selections. Will return null when no valid selection position is\n found.\n */\n static findFrom($pos, dir, textOnly = false) {\n let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);\n if (inner) return inner;\n for (let depth = $pos.depth - 1; depth >= 0; depth--) {\n let found = dir < 0 ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);\n if (found) return found;\n }\n return null;\n }\n /**\n Find a valid cursor or leaf node selection near the given\n position. Searches forward first by default, but if `bias` is\n negative, it will search backwards first.\n */\n static near($pos, bias = 1) {\n return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));\n }\n /**\n Find the cursor or leaf node selection closest to the start of\n the given document. Will return an\n [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position\n exists.\n */\n static atStart(doc) {\n return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);\n }\n /**\n Find the cursor or leaf node selection closest to the end of the\n given document.\n */\n static atEnd(doc) {\n return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);\n }\n /**\n Deserialize the JSON representation of a selection. Must be\n implemented for custom classes (as a static class method).\n */\n static fromJSON(doc, json) {\n if (!json || !json.type) throw new RangeError(\"Invalid input for Selection.fromJSON\");\n let cls = classesById[json.type];\n if (!cls) throw new RangeError(`No selection type ${json.type} defined`);\n return cls.fromJSON(doc, json);\n }\n /**\n To be able to deserialize selections from JSON, custom selection\n classes must register themselves with an ID string, so that they\n can be disambiguated. Try to pick something that's unlikely to\n clash with classes from other modules.\n */\n static jsonID(id, selectionClass) {\n if (id in classesById) throw new RangeError(\"Duplicate use of selection JSON ID \" + id);\n classesById[id] = selectionClass;\n selectionClass.prototype.jsonID = id;\n return selectionClass;\n }\n /**\n Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,\n which is a value that can be mapped without having access to a\n current document, and later resolved to a real selection for a\n given document again. (This is used mostly by the history to\n track and restore old selections.) The default implementation of\n this method just converts the selection to a text selection and\n returns the bookmark for that.\n */\n getBookmark() {\n return TextSelection.between(this.$anchor, this.$head).getBookmark();\n }\n}\nSelection.prototype.visible = true;\n/**\nRepresents a selected range in a document.\n*/\nclass SelectionRange {\n /**\n Create a range.\n */\n constructor(\n /**\n The lower bound of the range.\n */\n $from,\n /**\n The upper bound of the range.\n */\n $to) {\n this.$from = $from;\n this.$to = $to;\n }\n}\nlet warnedAboutTextSelection = false;\nfunction checkTextSelection($pos) {\n if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {\n warnedAboutTextSelection = true;\n console[\"warn\"](\"TextSelection endpoint not pointing into a node with inline content (\" + $pos.parent.type.name + \")\");\n }\n}\n/**\nA text selection represents a classical editor selection, with a\nhead (the moving side) and anchor (immobile side), both of which\npoint into textblock nodes. It can be empty (a regular cursor\nposition).\n*/\nclass TextSelection extends Selection {\n /**\n Construct a text selection between the given points.\n */\n constructor($anchor, $head = $anchor) {\n checkTextSelection($anchor);\n checkTextSelection($head);\n super($anchor, $head);\n }\n /**\n Returns a resolved position if this is a cursor selection (an\n empty text selection), and null otherwise.\n */\n get $cursor() {\n return this.$anchor.pos == this.$head.pos ? this.$head : null;\n }\n map(doc, mapping) {\n let $head = doc.resolve(mapping.map(this.head));\n if (!$head.parent.inlineContent) return Selection.near($head);\n let $anchor = doc.resolve(mapping.map(this.anchor));\n return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);\n }\n replace(tr, content = Slice.empty) {\n super.replace(tr, content);\n if (content == Slice.empty) {\n let marks = this.$from.marksAcross(this.$to);\n if (marks) tr.ensureMarks(marks);\n }\n }\n eq(other) {\n return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;\n }\n getBookmark() {\n return new TextBookmark(this.anchor, this.head);\n }\n toJSON() {\n return {\n type: \"text\",\n anchor: this.anchor,\n head: this.head\n };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\" || typeof json.head != \"number\") throw new RangeError(\"Invalid input for TextSelection.fromJSON\");\n return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n }\n /**\n Create a text selection from non-resolved positions.\n */\n static create(doc, anchor, head = anchor) {\n let $anchor = doc.resolve(anchor);\n return new this($anchor, head == anchor ? $anchor : doc.resolve(head));\n }\n /**\n Return a text selection that spans the given positions or, if\n they aren't text positions, find a text selection near them.\n `bias` determines whether the method searches forward (default)\n or backwards (negative number) first. Will fall back to calling\n [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document\n doesn't contain a valid text position.\n */\n static between($anchor, $head, bias) {\n let dPos = $anchor.pos - $head.pos;\n if (!bias || dPos) bias = dPos >= 0 ? 1 : -1;\n if (!$head.parent.inlineContent) {\n let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);\n if (found) $head = found.$head;else return Selection.near($head, bias);\n }\n if (!$anchor.parent.inlineContent) {\n if (dPos == 0) {\n $anchor = $head;\n } else {\n $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;\n if ($anchor.pos < $head.pos != dPos < 0) $anchor = $head;\n }\n }\n return new TextSelection($anchor, $head);\n }\n}\nSelection.jsonID(\"text\", TextSelection);\nclass TextBookmark {\n constructor(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n }\n map(mapping) {\n return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));\n }\n resolve(doc) {\n return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));\n }\n}\n/**\nA node selection is a selection that points at a single node. All\nnodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the\ntarget of a node selection. In such a selection, `from` and `to`\npoint directly before and after the selected node, `anchor` equals\n`from`, and `head` equals `to`..\n*/\nclass NodeSelection extends Selection {\n /**\n Create a node selection. Does not verify the validity of its\n argument.\n */\n constructor($pos) {\n let node = $pos.nodeAfter;\n let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n super($pos, $end);\n this.node = node;\n }\n map(doc, mapping) {\n let {\n deleted,\n pos\n } = mapping.mapResult(this.anchor);\n let $pos = doc.resolve(pos);\n if (deleted) return Selection.near($pos);\n return new NodeSelection($pos);\n }\n content() {\n return new Slice(Fragment.from(this.node), 0, 0);\n }\n eq(other) {\n return other instanceof NodeSelection && other.anchor == this.anchor;\n }\n toJSON() {\n return {\n type: \"node\",\n anchor: this.anchor\n };\n }\n getBookmark() {\n return new NodeBookmark(this.anchor);\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\") throw new RangeError(\"Invalid input for NodeSelection.fromJSON\");\n return new NodeSelection(doc.resolve(json.anchor));\n }\n /**\n Create a node selection from non-resolved positions.\n */\n static create(doc, from) {\n return new NodeSelection(doc.resolve(from));\n }\n /**\n Determines whether the given node may be selected as a node\n selection.\n */\n static isSelectable(node) {\n return !node.isText && node.type.spec.selectable !== false;\n }\n}\nNodeSelection.prototype.visible = false;\nSelection.jsonID(\"node\", NodeSelection);\nclass NodeBookmark {\n constructor(anchor) {\n this.anchor = anchor;\n }\n map(mapping) {\n let {\n deleted,\n pos\n } = mapping.mapResult(this.anchor);\n return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);\n }\n resolve(doc) {\n let $pos = doc.resolve(this.anchor),\n node = $pos.nodeAfter;\n if (node && NodeSelection.isSelectable(node)) return new NodeSelection($pos);\n return Selection.near($pos);\n }\n}\n/**\nA selection type that represents selecting the whole document\n(which can not necessarily be expressed with a text selection, when\nthere are for example leaf block nodes at the start or end of the\ndocument).\n*/\nclass AllSelection extends Selection {\n /**\n Create an all-selection over the given document.\n */\n constructor(doc) {\n super(doc.resolve(0), doc.resolve(doc.content.size));\n }\n replace(tr, content = Slice.empty) {\n if (content == Slice.empty) {\n tr.delete(0, tr.doc.content.size);\n let sel = Selection.atStart(tr.doc);\n if (!sel.eq(tr.selection)) tr.setSelection(sel);\n } else {\n super.replace(tr, content);\n }\n }\n toJSON() {\n return {\n type: \"all\"\n };\n }\n /**\n @internal\n */\n static fromJSON(doc) {\n return new AllSelection(doc);\n }\n map(doc) {\n return new AllSelection(doc);\n }\n eq(other) {\n return other instanceof AllSelection;\n }\n getBookmark() {\n return AllBookmark;\n }\n}\nSelection.jsonID(\"all\", AllSelection);\nconst AllBookmark = {\n map() {\n return this;\n },\n resolve(doc) {\n return new AllSelection(doc);\n }\n};\n// FIXME we'll need some awareness of text direction when scanning for selections\n// Try to find a selection inside the given node. `pos` points at the\n// position where the search starts. When `text` is true, only return\n// text selections.\nfunction findSelectionIn(doc, node, pos, index, dir, text = false) {\n if (node.inlineContent) return TextSelection.create(doc, pos);\n for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {\n let child = node.child(i);\n if (!child.isAtom) {\n let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);\n if (inner) return inner;\n } else if (!text && NodeSelection.isSelectable(child)) {\n return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));\n }\n pos += child.nodeSize * dir;\n }\n return null;\n}\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n let last = tr.steps.length - 1;\n if (last < startLen) return;\n let step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return;\n let map = tr.mapping.maps[last],\n end;\n map.forEach((_from, _to, _newFrom, newTo) => {\n if (end == null) end = newTo;\n });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\nconst UPDATED_SEL = 1,\n UPDATED_MARKS = 2,\n UPDATED_SCROLL = 4;\n/**\nAn editor state transaction, which can be applied to a state to\ncreate an updated state. Use\n[`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.\n\nTransactions track changes to the document (they are a subclass of\n[`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,\nlike selection updates and adjustments of the set of [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store\nmetadata properties in a transaction, which are extra pieces of\ninformation that client code or plugins can use to describe what a\ntransaction represents, so that they can update their [own\nstate](https://prosemirror.net/docs/ref/#state.StateField) accordingly.\n\nThe [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata\nproperties: it will attach a property `\"pointer\"` with the value\n`true` to selection transactions directly caused by mouse or touch\ninput, a `\"composition\"` property holding an ID identifying the\ncomposition that caused it to transactions caused by composed DOM\ninput, and a `\"uiEvent\"` property of that may be `\"paste\"`,\n`\"cut\"`, or `\"drop\"`.\n*/\nclass Transaction extends Transform {\n /**\n @internal\n */\n constructor(state) {\n super(state.doc);\n // The step count for which the current selection is valid.\n this.curSelectionFor = 0;\n // Bitfield to track which aspects of the state were updated by\n // this transaction.\n this.updated = 0;\n // Object used to store metadata properties for the transaction.\n this.meta = Object.create(null);\n this.time = Date.now();\n this.curSelection = state.selection;\n this.storedMarks = state.storedMarks;\n }\n /**\n The transaction's current selection. This defaults to the editor\n selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the\n transaction, but can be overwritten with\n [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).\n */\n get selection() {\n if (this.curSelectionFor < this.steps.length) {\n this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));\n this.curSelectionFor = this.steps.length;\n }\n return this.curSelection;\n }\n /**\n Update the transaction's current selection. Will determine the\n selection that the editor gets when the transaction is applied.\n */\n setSelection(selection) {\n if (selection.$from.doc != this.doc) throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this;\n }\n /**\n Whether the selection was explicitly updated by this transaction.\n */\n get selectionSet() {\n return (this.updated & UPDATED_SEL) > 0;\n }\n /**\n Set the current stored marks.\n */\n setStoredMarks(marks) {\n this.storedMarks = marks;\n this.updated |= UPDATED_MARKS;\n return this;\n }\n /**\n Make sure the current stored marks or, if that is null, the marks\n at the selection, match the given set of marks. Does nothing if\n this is already the case.\n */\n ensureMarks(marks) {\n if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks)) this.setStoredMarks(marks);\n return this;\n }\n /**\n Add a mark to the set of stored marks.\n */\n addStoredMark(mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Remove a mark or mark type from the set of stored marks.\n */\n removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Whether the stored marks were explicitly set for this transaction.\n */\n get storedMarksSet() {\n return (this.updated & UPDATED_MARKS) > 0;\n }\n /**\n @internal\n */\n addStep(step, doc) {\n super.addStep(step, doc);\n this.updated = this.updated & ~UPDATED_MARKS;\n this.storedMarks = null;\n }\n /**\n Update the timestamp for the transaction.\n */\n setTime(time) {\n this.time = time;\n return this;\n }\n /**\n Replace the current selection with the given slice.\n */\n replaceSelection(slice) {\n this.selection.replace(this, slice);\n return this;\n }\n /**\n Replace the selection with the given node. When `inheritMarks` is\n true and the content is inline, it inherits the marks from the\n place where it is inserted.\n */\n replaceSelectionWith(node, inheritMarks = true) {\n let selection = this.selection;\n if (inheritMarks) node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to) || Mark.none));\n selection.replaceWith(this, node);\n return this;\n }\n /**\n Delete the selection.\n */\n deleteSelection() {\n this.selection.replace(this);\n return this;\n }\n /**\n Replace the given range, or the selection if no range is given,\n with a text node containing the given string.\n */\n insertText(text, from, to) {\n let schema = this.doc.type.schema;\n if (from == null) {\n if (!text) return this.deleteSelection();\n return this.replaceSelectionWith(schema.text(text), true);\n } else {\n if (to == null) to = from;\n to = to == null ? from : to;\n if (!text) return this.deleteRange(from, to);\n let marks = this.storedMarks;\n if (!marks) {\n let $from = this.doc.resolve(from);\n marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));\n }\n this.replaceRangeWith(from, to, schema.text(text, marks));\n if (!this.selection.empty) this.setSelection(Selection.near(this.selection.$to));\n return this;\n }\n }\n /**\n Store a metadata property in this transaction, keyed either by\n name or by plugin.\n */\n setMeta(key, value) {\n this.meta[typeof key == \"string\" ? key : key.key] = value;\n return this;\n }\n /**\n Retrieve a metadata property for a given name or plugin.\n */\n getMeta(key) {\n return this.meta[typeof key == \"string\" ? key : key.key];\n }\n /**\n Returns true if this transaction doesn't contain any metadata,\n and can thus safely be extended.\n */\n get isGeneric() {\n for (let _ in this.meta) return false;\n return true;\n }\n /**\n Indicate that the editor should scroll the selection into view\n when updated to the state produced by this transaction.\n */\n scrollIntoView() {\n this.updated |= UPDATED_SCROLL;\n return this;\n }\n /**\n True when this transaction has had `scrollIntoView` called on it.\n */\n get scrolledIntoView() {\n return (this.updated & UPDATED_SCROLL) > 0;\n }\n}\nfunction bind(f, self) {\n return !self || !f ? f : f.bind(self);\n}\nclass FieldDesc {\n constructor(name, desc, self) {\n this.name = name;\n this.init = bind(desc.init, self);\n this.apply = bind(desc.apply, self);\n }\n}\nconst baseFields = [new FieldDesc(\"doc\", {\n init(config) {\n return config.doc || config.schema.topNodeType.createAndFill();\n },\n apply(tr) {\n return tr.doc;\n }\n}), new FieldDesc(\"selection\", {\n init(config, instance) {\n return config.selection || Selection.atStart(instance.doc);\n },\n apply(tr) {\n return tr.selection;\n }\n}), new FieldDesc(\"storedMarks\", {\n init(config) {\n return config.storedMarks || null;\n },\n apply(tr, _marks, _old, state) {\n return state.selection.$cursor ? tr.storedMarks : null;\n }\n}), new FieldDesc(\"scrollToSelection\", {\n init() {\n return 0;\n },\n apply(tr, prev) {\n return tr.scrolledIntoView ? prev + 1 : prev;\n }\n})];\n// Object wrapping the part of a state object that stays the same\n// across transactions. Stored in the state's `config` property.\nclass Configuration {\n constructor(schema, plugins) {\n this.schema = schema;\n this.plugins = [];\n this.pluginsByKey = Object.create(null);\n this.fields = baseFields.slice();\n if (plugins) plugins.forEach(plugin => {\n if (this.pluginsByKey[plugin.key]) throw new RangeError(\"Adding different instances of a keyed plugin (\" + plugin.key + \")\");\n this.plugins.push(plugin);\n this.pluginsByKey[plugin.key] = plugin;\n if (plugin.spec.state) this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));\n });\n }\n}\n/**\nThe state of a ProseMirror editor is represented by an object of\nthis type. A state is a persistent data structure—it isn't\nupdated, but rather a new state value is computed from an old one\nusing the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.\n\nA state holds a number of built-in fields, and plugins can\n[define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.\n*/\nclass EditorState {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n config) {\n this.config = config;\n }\n /**\n The schema of the state's document.\n */\n get schema() {\n return this.config.schema;\n }\n /**\n The plugins that are active in this state.\n */\n get plugins() {\n return this.config.plugins;\n }\n /**\n Apply the given transaction to produce a new state.\n */\n apply(tr) {\n return this.applyTransaction(tr).state;\n }\n /**\n @internal\n */\n filterTransaction(tr, ignore = -1) {\n for (let i = 0; i < this.config.plugins.length; i++) if (i != ignore) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this)) return false;\n }\n return true;\n }\n /**\n Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that\n returns the precise transactions that were applied (which might\n be influenced by the [transaction\n hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of\n plugins) along with the new state.\n */\n applyTransaction(rootTr) {\n if (!this.filterTransaction(rootTr)) return {\n state: this,\n transactions: []\n };\n let trs = [rootTr],\n newState = this.applyInner(rootTr),\n seen = null;\n // This loop repeatedly gives plugins a chance to respond to\n // transactions as new transactions are added, making sure to only\n // pass the transactions the plugin did not see before.\n for (;;) {\n let haveNew = false;\n for (let i = 0; i < this.config.plugins.length; i++) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.appendTransaction) {\n let n = seen ? seen[i].n : 0,\n oldState = seen ? seen[i].state : this;\n let tr = n < trs.length && plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);\n if (tr && newState.filterTransaction(tr, i)) {\n tr.setMeta(\"appendedTransaction\", rootTr);\n if (!seen) {\n seen = [];\n for (let j = 0; j < this.config.plugins.length; j++) seen.push(j < i ? {\n state: newState,\n n: trs.length\n } : {\n state: this,\n n: 0\n });\n }\n trs.push(tr);\n newState = newState.applyInner(tr);\n haveNew = true;\n }\n if (seen) seen[i] = {\n state: newState,\n n: trs.length\n };\n }\n }\n if (!haveNew) return {\n state: newState,\n transactions: trs\n };\n }\n }\n /**\n @internal\n */\n applyInner(tr) {\n if (!tr.before.eq(this.doc)) throw new RangeError(\"Applying a mismatched transaction\");\n let newInstance = new EditorState(this.config),\n fields = this.config.fields;\n for (let i = 0; i < fields.length; i++) {\n let field = fields[i];\n newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);\n }\n return newInstance;\n }\n /**\n Start a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.\n */\n get tr() {\n return new Transaction(this);\n }\n /**\n Create a new state.\n */\n static create(config) {\n let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);\n let instance = new EditorState($config);\n for (let i = 0; i < $config.fields.length; i++) instance[$config.fields[i].name] = $config.fields[i].init(config, instance);\n return instance;\n }\n /**\n Create a new state based on this one, but with an adjusted set\n of active plugins. State fields that exist in both sets of\n plugins are kept unchanged. Those that no longer exist are\n dropped, and those that are new are initialized using their\n [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new\n configuration object..\n */\n reconfigure(config) {\n let $config = new Configuration(this.schema, config.plugins);\n let fields = $config.fields,\n instance = new EditorState($config);\n for (let i = 0; i < fields.length; i++) {\n let name = fields[i].name;\n instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);\n }\n return instance;\n }\n /**\n Serialize this state to JSON. If you want to serialize the state\n of plugins, pass an object mapping property names to use in the\n resulting JSON object to plugin objects. The argument may also be\n a string or number, in which case it is ignored, to support the\n way `JSON.stringify` calls `toString` methods.\n */\n toJSON(pluginFields) {\n let result = {\n doc: this.doc.toJSON(),\n selection: this.selection.toJSON()\n };\n if (this.storedMarks) result.storedMarks = this.storedMarks.map(m => m.toJSON());\n if (pluginFields && typeof pluginFields == 'object') for (let prop in pluginFields) {\n if (prop == \"doc\" || prop == \"selection\") throw new RangeError(\"The JSON fields `doc` and `selection` are reserved\");\n let plugin = pluginFields[prop],\n state = plugin.spec.state;\n if (state && state.toJSON) result[prop] = state.toJSON.call(plugin, this[plugin.key]);\n }\n return result;\n }\n /**\n Deserialize a JSON representation of a state. `config` should\n have at least a `schema` field, and should contain array of\n plugins to initialize the state with. `pluginFields` can be used\n to deserialize the state of plugins, by associating plugin\n instances with the property names they use in the JSON object.\n */\n static fromJSON(config, json, pluginFields) {\n if (!json) throw new RangeError(\"Invalid input for EditorState.fromJSON\");\n if (!config.schema) throw new RangeError(\"Required config field 'schema' missing\");\n let $config = new Configuration(config.schema, config.plugins);\n let instance = new EditorState($config);\n $config.fields.forEach(field => {\n if (field.name == \"doc\") {\n instance.doc = Node.fromJSON(config.schema, json.doc);\n } else if (field.name == \"selection\") {\n instance.selection = Selection.fromJSON(instance.doc, json.selection);\n } else if (field.name == \"storedMarks\") {\n if (json.storedMarks) instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);\n } else {\n if (pluginFields) for (let prop in pluginFields) {\n let plugin = pluginFields[prop],\n state = plugin.spec.state;\n if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {\n instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);\n return;\n }\n }\n instance[field.name] = field.init(config, instance);\n }\n });\n return instance;\n }\n}\nfunction bindProps(obj, self, target) {\n for (let prop in obj) {\n let val = obj[prop];\n if (val instanceof Function) val = val.bind(self);else if (prop == \"handleDOMEvents\") val = bindProps(val, self, {});\n target[prop] = val;\n }\n return target;\n}\n/**\nPlugins bundle functionality that can be added to an editor.\nThey are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and\nmay influence that state and the view that contains it.\n*/\nclass Plugin {\n /**\n Create a plugin.\n */\n constructor(\n /**\n The plugin's [spec object](https://prosemirror.net/docs/ref/#state.PluginSpec).\n */\n spec) {\n this.spec = spec;\n /**\n The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.\n */\n this.props = {};\n if (spec.props) bindProps(spec.props, this, this.props);\n this.key = spec.key ? spec.key.key : createKey(\"plugin\");\n }\n /**\n Extract the plugin's state field from an editor state.\n */\n getState(state) {\n return state[this.key];\n }\n}\nconst keys = Object.create(null);\nfunction createKey(name) {\n if (name in keys) return name + \"$\" + ++keys[name];\n keys[name] = 0;\n return name + \"$\";\n}\n/**\nA key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way\nthat makes it possible to find them, given an editor state.\nAssigning a key does mean only one plugin of that type can be\nactive in a state.\n*/\nclass PluginKey {\n /**\n Create a plugin key.\n */\n constructor(name = \"key\") {\n this.key = createKey(name);\n }\n /**\n Get the active plugin with this key, if any, from an editor\n state.\n */\n get(state) {\n return state.config.pluginsByKey[this.key];\n }\n /**\n Get the plugin's state from an editor state.\n */\n getState(state) {\n return state[this.key];\n }\n}\nexport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };","import { TextSelection, NodeSelection, AllSelection, Selection } from 'prosemirror-state';\nimport { DOMSerializer, Fragment, Mark, Slice, DOMParser } from 'prosemirror-model';\nimport { dropPoint } from 'prosemirror-transform';\nconst domIndex = function (node) {\n for (var index = 0;; index++) {\n node = node.previousSibling;\n if (!node) return index;\n }\n};\nconst parentNode = function (node) {\n let parent = node.assignedSlot || node.parentNode;\n return parent && parent.nodeType == 11 ? parent.host : parent;\n};\nlet reusedRange = null;\n// Note that this will always return the same range, because DOM range\n// objects are every expensive, and keep slowing down subsequent DOM\n// updates, for some reason.\nconst textRange = function (node, from, to) {\n let range = reusedRange || (reusedRange = document.createRange());\n range.setEnd(node, to == null ? node.nodeValue.length : to);\n range.setStart(node, from || 0);\n return range;\n};\nconst clearReusedRange = function () {\n reusedRange = null;\n};\n// Scans forward and backward through DOM positions equivalent to the\n// given one to see if the two are in the same place (i.e. after a\n// text node vs at the end of that text node)\nconst isEquivalentPosition = function (node, off, targetNode, targetOff) {\n return targetNode && (scanFor(node, off, targetNode, targetOff, -1) || scanFor(node, off, targetNode, targetOff, 1));\n};\nconst atomElements = /^(img|br|input|textarea|hr)$/i;\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n for (;;) {\n if (node == targetNode && off == targetOff) return true;\n if (off == (dir < 0 ? 0 : nodeSize(node))) {\n let parent = node.parentNode;\n if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == \"false\") return false;\n off = domIndex(node) + (dir < 0 ? 0 : 1);\n node = parent;\n } else if (node.nodeType == 1) {\n node = node.childNodes[off + (dir < 0 ? -1 : 0)];\n if (node.contentEditable == \"false\") return false;\n off = dir < 0 ? nodeSize(node) : 0;\n } else {\n return false;\n }\n }\n}\nfunction nodeSize(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction textNodeBefore$1(node, offset) {\n for (;;) {\n if (node.nodeType == 3 && offset) return node;\n if (node.nodeType == 1 && offset > 0) {\n if (node.contentEditable == \"false\") return null;\n node = node.childNodes[offset - 1];\n offset = nodeSize(node);\n } else if (node.parentNode && !hasBlockDesc(node)) {\n offset = domIndex(node);\n node = node.parentNode;\n } else {\n return null;\n }\n }\n}\nfunction textNodeAfter$1(node, offset) {\n for (;;) {\n if (node.nodeType == 3 && offset < node.nodeValue.length) return node;\n if (node.nodeType == 1 && offset < node.childNodes.length) {\n if (node.contentEditable == \"false\") return null;\n node = node.childNodes[offset];\n offset = 0;\n } else if (node.parentNode && !hasBlockDesc(node)) {\n offset = domIndex(node) + 1;\n node = node.parentNode;\n } else {\n return null;\n }\n }\n}\nfunction isOnEdge(node, offset, parent) {\n for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {\n if (node == parent) return true;\n let index = domIndex(node);\n node = node.parentNode;\n if (!node) return false;\n atStart = atStart && index == 0;\n atEnd = atEnd && index == nodeSize(node);\n }\n}\nfunction hasBlockDesc(dom) {\n let desc;\n for (let cur = dom; cur; cur = cur.parentNode) if (desc = cur.pmViewDesc) break;\n return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom);\n}\n// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n// (isCollapsed inappropriately returns true in shadow dom)\nconst selectionCollapsed = function (domSel) {\n return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);\n};\nfunction keyEvent(keyCode, key) {\n let event = document.createEvent(\"Event\");\n event.initEvent(\"keydown\", true, true);\n event.keyCode = keyCode;\n event.key = event.code = key;\n return event;\n}\nfunction deepActiveElement(doc) {\n let elt = doc.activeElement;\n while (elt && elt.shadowRoot) elt = elt.shadowRoot.activeElement;\n return elt;\n}\nfunction caretFromPoint(doc, x, y) {\n if (doc.caretPositionFromPoint) {\n try {\n // Firefox throws for this call in hard-to-predict circumstances (#994)\n let pos = doc.caretPositionFromPoint(x, y);\n // Clip the offset, because Chrome will return a text offset\n // into nodes, which can't be treated as a regular DOM\n // offset\n if (pos) return {\n node: pos.offsetNode,\n offset: Math.min(nodeSize(pos.offsetNode), pos.offset)\n };\n } catch (_) {}\n }\n if (doc.caretRangeFromPoint) {\n let range = doc.caretRangeFromPoint(x, y);\n if (range) return {\n node: range.startContainer,\n offset: Math.min(nodeSize(range.startContainer), range.startOffset)\n };\n }\n}\nconst nav = typeof navigator != \"undefined\" ? navigator : null;\nconst doc = typeof document != \"undefined\" ? document : null;\nconst agent = nav && nav.userAgent || \"\";\nconst ie_edge = /Edge\\/(\\d+)/.exec(agent);\nconst ie_upto10 = /MSIE \\d/.exec(agent);\nconst ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(agent);\nconst ie = !!(ie_upto10 || ie_11up || ie_edge);\nconst ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;\nconst gecko = !ie && /gecko\\/(\\d+)/i.test(agent);\ngecko && +(/Firefox\\/(\\d+)/.exec(agent) || [0, 0])[1];\nconst _chrome = !ie && /Chrome\\/(\\d+)/.exec(agent);\nconst chrome = !!_chrome;\nconst chrome_version = _chrome ? +_chrome[1] : 0;\nconst safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);\n// Is true for both iOS and iPadOS for convenience\nconst ios = safari && (/Mobile\\/\\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);\nconst mac = ios || (nav ? /Mac/.test(nav.platform) : false);\nconst windows = nav ? /Win/.test(nav.platform) : false;\nconst android = /Android \\d/.test(agent);\nconst webkit = !!doc && \"webkitFontSmoothing\" in doc.documentElement.style;\nconst webkit_version = webkit ? +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;\nfunction windowRect(doc) {\n let vp = doc.defaultView && doc.defaultView.visualViewport;\n if (vp) return {\n left: 0,\n right: vp.width,\n top: 0,\n bottom: vp.height\n };\n return {\n left: 0,\n right: doc.documentElement.clientWidth,\n top: 0,\n bottom: doc.documentElement.clientHeight\n };\n}\nfunction getSide(value, side) {\n return typeof value == \"number\" ? value : value[side];\n}\nfunction clientRect(node) {\n let rect = node.getBoundingClientRect();\n // Adjust for elements with style \"transform: scale()\"\n let scaleX = rect.width / node.offsetWidth || 1;\n let scaleY = rect.height / node.offsetHeight || 1;\n // Make sure scrollbar width isn't included in the rectangle\n return {\n left: rect.left,\n right: rect.left + node.clientWidth * scaleX,\n top: rect.top,\n bottom: rect.top + node.clientHeight * scaleY\n };\n}\nfunction scrollRectIntoView(view, rect, startDOM) {\n let scrollThreshold = view.someProp(\"scrollThreshold\") || 0,\n scrollMargin = view.someProp(\"scrollMargin\") || 5;\n let doc = view.dom.ownerDocument;\n for (let parent = startDOM || view.dom;; parent = parentNode(parent)) {\n if (!parent) break;\n if (parent.nodeType != 1) continue;\n let elt = parent;\n let atTop = elt == doc.body;\n let bounding = atTop ? windowRect(doc) : clientRect(elt);\n let moveX = 0,\n moveY = 0;\n if (rect.top < bounding.top + getSide(scrollThreshold, \"top\")) moveY = -(bounding.top - rect.top + getSide(scrollMargin, \"top\"));else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, \"bottom\")) moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, \"top\") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, \"bottom\");\n if (rect.left < bounding.left + getSide(scrollThreshold, \"left\")) moveX = -(bounding.left - rect.left + getSide(scrollMargin, \"left\"));else if (rect.right > bounding.right - getSide(scrollThreshold, \"right\")) moveX = rect.right - bounding.right + getSide(scrollMargin, \"right\");\n if (moveX || moveY) {\n if (atTop) {\n doc.defaultView.scrollBy(moveX, moveY);\n } else {\n let startX = elt.scrollLeft,\n startY = elt.scrollTop;\n if (moveY) elt.scrollTop += moveY;\n if (moveX) elt.scrollLeft += moveX;\n let dX = elt.scrollLeft - startX,\n dY = elt.scrollTop - startY;\n rect = {\n left: rect.left - dX,\n top: rect.top - dY,\n right: rect.right - dX,\n bottom: rect.bottom - dY\n };\n }\n }\n if (atTop || /^(fixed|sticky)$/.test(getComputedStyle(parent).position)) break;\n }\n}\n// Store the scroll position of the editor's parent nodes, along with\n// the top position of an element near the top of the editor, which\n// will be used to make sure the visible viewport remains stable even\n// when the size of the content above changes.\nfunction storeScrollPos(view) {\n let rect = view.dom.getBoundingClientRect(),\n startY = Math.max(0, rect.top);\n let refDOM, refTop;\n for (let x = (rect.left + rect.right) / 2, y = startY + 1; y < Math.min(innerHeight, rect.bottom); y += 5) {\n let dom = view.root.elementFromPoint(x, y);\n if (!dom || dom == view.dom || !view.dom.contains(dom)) continue;\n let localRect = dom.getBoundingClientRect();\n if (localRect.top >= startY - 20) {\n refDOM = dom;\n refTop = localRect.top;\n break;\n }\n }\n return {\n refDOM: refDOM,\n refTop: refTop,\n stack: scrollStack(view.dom)\n };\n}\nfunction scrollStack(dom) {\n let stack = [],\n doc = dom.ownerDocument;\n for (let cur = dom; cur; cur = parentNode(cur)) {\n stack.push({\n dom: cur,\n top: cur.scrollTop,\n left: cur.scrollLeft\n });\n if (dom == doc) break;\n }\n return stack;\n}\n// Reset the scroll position of the editor's parent nodes to that what\n// it was before, when storeScrollPos was called.\nfunction resetScrollPos({\n refDOM,\n refTop,\n stack\n}) {\n let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;\n restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);\n}\nfunction restoreScrollStack(stack, dTop) {\n for (let i = 0; i < stack.length; i++) {\n let {\n dom,\n top,\n left\n } = stack[i];\n if (dom.scrollTop != top + dTop) dom.scrollTop = top + dTop;\n if (dom.scrollLeft != left) dom.scrollLeft = left;\n }\n}\nlet preventScrollSupported = null;\n// Feature-detects support for .focus({preventScroll: true}), and uses\n// a fallback kludge when not supported.\nfunction focusPreventScroll(dom) {\n if (dom.setActive) return dom.setActive(); // in IE\n if (preventScrollSupported) return dom.focus(preventScrollSupported);\n let stored = scrollStack(dom);\n dom.focus(preventScrollSupported == null ? {\n get preventScroll() {\n preventScrollSupported = {\n preventScroll: true\n };\n return true;\n }\n } : undefined);\n if (!preventScrollSupported) {\n preventScrollSupported = false;\n restoreScrollStack(stored, 0);\n }\n}\nfunction findOffsetInNode(node, coords) {\n let closest,\n dxClosest = 2e8,\n coordsClosest,\n offset = 0;\n let rowBot = coords.top,\n rowTop = coords.top;\n let firstBelow, coordsBelow;\n for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {\n let rects;\n if (child.nodeType == 1) rects = child.getClientRects();else if (child.nodeType == 3) rects = textRange(child).getClientRects();else continue;\n for (let i = 0; i < rects.length; i++) {\n let rect = rects[i];\n if (rect.top <= rowBot && rect.bottom >= rowTop) {\n rowBot = Math.max(rect.bottom, rowBot);\n rowTop = Math.min(rect.top, rowTop);\n let dx = rect.left > coords.left ? rect.left - coords.left : rect.right < coords.left ? coords.left - rect.right : 0;\n if (dx < dxClosest) {\n closest = child;\n dxClosest = dx;\n coordsClosest = dx && closest.nodeType == 3 ? {\n left: rect.right < coords.left ? rect.right : rect.left,\n top: coords.top\n } : coords;\n if (child.nodeType == 1 && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);\n continue;\n }\n } else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {\n firstBelow = child;\n coordsBelow = {\n left: Math.max(rect.left, Math.min(rect.right, coords.left)),\n top: rect.top\n };\n }\n if (!closest && (coords.left >= rect.right && coords.top >= rect.top || coords.left >= rect.left && coords.top >= rect.bottom)) offset = childIndex + 1;\n }\n }\n if (!closest && firstBelow) {\n closest = firstBelow;\n coordsClosest = coordsBelow;\n dxClosest = 0;\n }\n if (closest && closest.nodeType == 3) return findOffsetInText(closest, coordsClosest);\n if (!closest || dxClosest && closest.nodeType == 1) return {\n node,\n offset\n };\n return findOffsetInNode(closest, coordsClosest);\n}\nfunction findOffsetInText(node, coords) {\n let len = node.nodeValue.length;\n let range = document.createRange();\n for (let i = 0; i < len; i++) {\n range.setEnd(node, i + 1);\n range.setStart(node, i);\n let rect = singleRect(range, 1);\n if (rect.top == rect.bottom) continue;\n if (inRect(coords, rect)) return {\n node,\n offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0)\n };\n }\n return {\n node,\n offset: 0\n };\n}\nfunction inRect(coords, rect) {\n return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 && coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1;\n}\nfunction targetKludge(dom, coords) {\n let parent = dom.parentNode;\n if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left) return parent;\n return dom;\n}\nfunction posFromElement(view, elt, coords) {\n let {\n node,\n offset\n } = findOffsetInNode(elt, coords),\n bias = -1;\n if (node.nodeType == 1 && !node.firstChild) {\n let rect = node.getBoundingClientRect();\n bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;\n }\n return view.docView.posFromDOM(node, offset, bias);\n}\nfunction posFromCaret(view, node, offset, coords) {\n // Browser (in caretPosition/RangeFromPoint) will agressively\n // normalize towards nearby inline nodes. Since we are interested in\n // positions between block nodes too, we first walk up the hierarchy\n // of nodes to see if there are block nodes that the coordinates\n // fall outside of. If so, we take the position before/after that\n // block. If not, we call `posFromDOM` on the raw node/offset.\n let outsideBlock = -1;\n for (let cur = node, sawBlock = false;;) {\n if (cur == view.dom) break;\n let desc = view.docView.nearestDesc(cur, true);\n if (!desc) return null;\n if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM)) {\n let rect = desc.dom.getBoundingClientRect();\n if (desc.node.isBlock && desc.parent) {\n // Only apply the horizontal test to the innermost block. Vertical for any parent.\n if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore;else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter;\n sawBlock = true;\n }\n if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {\n // If we are inside a leaf, return the side of the leaf closer to the coords\n let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;\n return before ? desc.posBefore : desc.posAfter;\n }\n }\n cur = desc.dom.parentNode;\n }\n return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node, offset, -1);\n}\nfunction elementFromPoint(element, coords, box) {\n let len = element.childNodes.length;\n if (len && box.top < box.bottom) {\n for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {\n let child = element.childNodes[i];\n if (child.nodeType == 1) {\n let rects = child.getClientRects();\n for (let j = 0; j < rects.length; j++) {\n let rect = rects[j];\n if (inRect(coords, rect)) return elementFromPoint(child, coords, rect);\n }\n }\n if ((i = (i + 1) % len) == startI) break;\n }\n }\n return element;\n}\n// Given an x,y position on the editor, get the position in the document.\nfunction posAtCoords(view, coords) {\n let doc = view.dom.ownerDocument,\n node,\n offset = 0;\n let caret = caretFromPoint(doc, coords.left, coords.top);\n if (caret) ({\n node,\n offset\n } = caret);\n let elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);\n let pos;\n if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {\n let box = view.dom.getBoundingClientRect();\n if (!inRect(coords, box)) return null;\n elt = elementFromPoint(view.dom, coords, box);\n if (!elt) return null;\n }\n // Safari's caretRangeFromPoint returns nonsense when on a draggable element\n if (safari) {\n for (let p = elt; node && p; p = parentNode(p)) if (p.draggable) node = undefined;\n }\n elt = targetKludge(elt, coords);\n if (node) {\n if (gecko && node.nodeType == 1) {\n // Firefox will sometimes return offsets into nodes, which\n // have no actual children, from caretPositionFromPoint (#953)\n offset = Math.min(offset, node.childNodes.length);\n // It'll also move the returned position before image nodes,\n // even if those are behind it.\n if (offset < node.childNodes.length) {\n let next = node.childNodes[offset],\n box;\n if (next.nodeName == \"IMG\" && (box = next.getBoundingClientRect()).right <= coords.left && box.bottom > coords.top) offset++;\n }\n }\n let prev;\n // When clicking above the right side of an uneditable node, Chrome will report a cursor position after that node.\n if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == \"false\" && prev.getBoundingClientRect().top >= coords.top) offset--;\n // Suspiciously specific kludge to work around caret*FromPoint\n // never returning a position at the end of the document\n if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;\n // Ignore positions directly after a BR, since caret*FromPoint\n // 'round up' positions that would be more accurately placed\n // before the BR node.\n else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != \"BR\") pos = posFromCaret(view, node, offset, coords);\n }\n if (pos == null) pos = posFromElement(view, elt, coords);\n let desc = view.docView.nearestDesc(elt, true);\n return {\n pos,\n inside: desc ? desc.posAtStart - desc.border : -1\n };\n}\nfunction nonZero(rect) {\n return rect.top < rect.bottom || rect.left < rect.right;\n}\nfunction singleRect(target, bias) {\n let rects = target.getClientRects();\n if (rects.length) {\n let first = rects[bias < 0 ? 0 : rects.length - 1];\n if (nonZero(first)) return first;\n }\n return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect();\n}\nconst BIDI = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n// Given a position in the document model, get a bounding box of the\n// character at that position, relative to the window.\nfunction coordsAtPos(view, pos, side) {\n let {\n node,\n offset,\n atom\n } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);\n let supportEmptyRange = webkit || gecko;\n if (node.nodeType == 3) {\n // These browsers support querying empty text ranges. Prefer that in\n // bidi context or when at the end of a node.\n if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {\n let rect = singleRect(textRange(node, offset, offset), side);\n // Firefox returns bad results (the position before the space)\n // when querying a position directly after line-broken\n // whitespace. Detect this situation and and kludge around it\n if (gecko && offset && /\\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {\n let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);\n if (rectBefore.top == rect.top) {\n let rectAfter = singleRect(textRange(node, offset, offset + 1), -1);\n if (rectAfter.top != rect.top) return flattenV(rectAfter, rectAfter.left < rectBefore.left);\n }\n }\n return rect;\n } else {\n let from = offset,\n to = offset,\n takeSide = side < 0 ? 1 : -1;\n if (side < 0 && !offset) {\n to++;\n takeSide = -1;\n } else if (side >= 0 && offset == node.nodeValue.length) {\n from--;\n takeSide = 1;\n } else if (side < 0) {\n from--;\n } else {\n to++;\n }\n return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);\n }\n }\n let $dom = view.state.doc.resolve(pos - (atom || 0));\n // Return a horizontal line in block context\n if (!$dom.parent.inlineContent) {\n if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n let before = node.childNodes[offset - 1];\n if (before.nodeType == 1) return flattenH(before.getBoundingClientRect(), false);\n }\n if (atom == null && offset < nodeSize(node)) {\n let after = node.childNodes[offset];\n if (after.nodeType == 1) return flattenH(after.getBoundingClientRect(), true);\n }\n return flattenH(node.getBoundingClientRect(), side >= 0);\n }\n // Inline, not in text node (this is not Bidi-safe)\n if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n let before = node.childNodes[offset - 1];\n let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1))\n // BR nodes tend to only return the rectangle before them.\n // Only use them if they are the last element in their parent\n : before.nodeType == 1 && (before.nodeName != \"BR\" || !before.nextSibling) ? before : null;\n if (target) return flattenV(singleRect(target, 1), false);\n }\n if (atom == null && offset < nodeSize(node)) {\n let after = node.childNodes[offset];\n while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) after = after.nextSibling;\n let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null;\n if (target) return flattenV(singleRect(target, -1), true);\n }\n // All else failed, just try to get a rectangle for the target node\n return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);\n}\nfunction flattenV(rect, left) {\n if (rect.width == 0) return rect;\n let x = left ? rect.left : rect.right;\n return {\n top: rect.top,\n bottom: rect.bottom,\n left: x,\n right: x\n };\n}\nfunction flattenH(rect, top) {\n if (rect.height == 0) return rect;\n let y = top ? rect.top : rect.bottom;\n return {\n top: y,\n bottom: y,\n left: rect.left,\n right: rect.right\n };\n}\nfunction withFlushedState(view, state, f) {\n let viewState = view.state,\n active = view.root.activeElement;\n if (viewState != state) view.updateState(state);\n if (active != view.dom) view.focus();\n try {\n return f();\n } finally {\n if (viewState != state) view.updateState(viewState);\n if (active != view.dom && active) active.focus();\n }\n}\n// Whether vertical position motion in a given direction\n// from a position would leave a text block.\nfunction endOfTextblockVertical(view, state, dir) {\n let sel = state.selection;\n let $pos = dir == \"up\" ? sel.$from : sel.$to;\n return withFlushedState(view, state, () => {\n let {\n node: dom\n } = view.docView.domFromPos($pos.pos, dir == \"up\" ? -1 : 1);\n for (;;) {\n let nearest = view.docView.nearestDesc(dom, true);\n if (!nearest) break;\n if (nearest.node.isBlock) {\n dom = nearest.contentDOM || nearest.dom;\n break;\n }\n dom = nearest.dom.parentNode;\n }\n let coords = coordsAtPos(view, $pos.pos, 1);\n for (let child = dom.firstChild; child; child = child.nextSibling) {\n let boxes;\n if (child.nodeType == 1) boxes = child.getClientRects();else if (child.nodeType == 3) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();else continue;\n for (let i = 0; i < boxes.length; i++) {\n let box = boxes[i];\n if (box.bottom > box.top + 1 && (dir == \"up\" ? coords.top - box.top > (box.bottom - coords.top) * 2 : box.bottom - coords.bottom > (coords.bottom - box.top) * 2)) return false;\n }\n }\n return true;\n });\n}\nconst maybeRTL = /[\\u0590-\\u08ac]/;\nfunction endOfTextblockHorizontal(view, state, dir) {\n let {\n $head\n } = state.selection;\n if (!$head.parent.isTextblock) return false;\n let offset = $head.parentOffset,\n atStart = !offset,\n atEnd = offset == $head.parent.content.size;\n let sel = view.domSelection();\n if (!sel) return $head.pos == $head.start() || $head.pos == $head.end();\n // If the textblock is all LTR, or the browser doesn't support\n // Selection.modify (Edge), fall back to a primitive approach\n if (!maybeRTL.test($head.parent.textContent) || !sel.modify) return dir == \"left\" || dir == \"backward\" ? atStart : atEnd;\n return withFlushedState(view, state, () => {\n // This is a huge hack, but appears to be the best we can\n // currently do: use `Selection.modify` to move the selection by\n // one character, and see if that moves the cursor out of the\n // textblock (or doesn't move it at all, when at the start/end of\n // the document).\n let {\n focusNode: oldNode,\n focusOffset: oldOff,\n anchorNode,\n anchorOffset\n } = view.domSelectionRange();\n let oldBidiLevel = sel.caretBidiLevel // Only for Firefox\n ;\n sel.modify(\"move\", dir, \"character\");\n let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;\n let {\n focusNode: newNode,\n focusOffset: newOff\n } = view.domSelectionRange();\n let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff;\n // Restore the previous selection\n try {\n sel.collapse(anchorNode, anchorOffset);\n if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) sel.extend(oldNode, oldOff);\n } catch (_) {}\n if (oldBidiLevel != null) sel.caretBidiLevel = oldBidiLevel;\n return result;\n });\n}\nlet cachedState = null;\nlet cachedDir = null;\nlet cachedResult = false;\nfunction endOfTextblock(view, state, dir) {\n if (cachedState == state && cachedDir == dir) return cachedResult;\n cachedState = state;\n cachedDir = dir;\n return cachedResult = dir == \"up\" || dir == \"down\" ? endOfTextblockVertical(view, state, dir) : endOfTextblockHorizontal(view, state, dir);\n}\n\n// View descriptions are data structures that describe the DOM that is\n// used to represent the editor's content. They are used for:\n//\n// - Incremental redrawing when the document changes\n//\n// - Figuring out what part of the document a given DOM position\n// corresponds to\n//\n// - Wiring in custom implementations of the editing interface for a\n// given node\n//\n// They form a doubly-linked mutable tree, starting at `view.docView`.\nconst NOT_DIRTY = 0,\n CHILD_DIRTY = 1,\n CONTENT_DIRTY = 2,\n NODE_DIRTY = 3;\n// Superclass for the various kinds of descriptions. Defines their\n// basic structure and shared methods.\nclass ViewDesc {\n constructor(parent, children, dom,\n // This is the node that holds the child views. It may be null for\n // descs that don't have children.\n contentDOM) {\n this.parent = parent;\n this.children = children;\n this.dom = dom;\n this.contentDOM = contentDOM;\n this.dirty = NOT_DIRTY;\n // An expando property on the DOM node provides a link back to its\n // description.\n dom.pmViewDesc = this;\n }\n // Used to check whether a given description corresponds to a\n // widget/mark/node.\n matchesWidget(widget) {\n return false;\n }\n matchesMark(mark) {\n return false;\n }\n matchesNode(node, outerDeco, innerDeco) {\n return false;\n }\n matchesHack(nodeName) {\n return false;\n }\n // When parsing in-editor content (in domchange.js), we allow\n // descriptions to determine the parse rules that should be used to\n // parse them.\n parseRule() {\n return null;\n }\n // Used by the editor's event handler to ignore events that come\n // from certain descs.\n stopEvent(event) {\n return false;\n }\n // The size of the content represented by this desc.\n get size() {\n let size = 0;\n for (let i = 0; i < this.children.length; i++) size += this.children[i].size;\n return size;\n }\n // For block nodes, this represents the space taken up by their\n // start/end tokens.\n get border() {\n return 0;\n }\n destroy() {\n this.parent = undefined;\n if (this.dom.pmViewDesc == this) this.dom.pmViewDesc = undefined;\n for (let i = 0; i < this.children.length; i++) this.children[i].destroy();\n }\n posBeforeChild(child) {\n for (let i = 0, pos = this.posAtStart;; i++) {\n let cur = this.children[i];\n if (cur == child) return pos;\n pos += cur.size;\n }\n }\n get posBefore() {\n return this.parent.posBeforeChild(this);\n }\n get posAtStart() {\n return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;\n }\n get posAfter() {\n return this.posBefore + this.size;\n }\n get posAtEnd() {\n return this.posAtStart + this.size - 2 * this.border;\n }\n localPosFromDOM(dom, offset, bias) {\n // If the DOM position is in the content, use the child desc after\n // it to figure out a position.\n if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {\n if (bias < 0) {\n let domBefore, desc;\n if (dom == this.contentDOM) {\n domBefore = dom.childNodes[offset - 1];\n } else {\n while (dom.parentNode != this.contentDOM) dom = dom.parentNode;\n domBefore = dom.previousSibling;\n }\n while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) domBefore = domBefore.previousSibling;\n return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart;\n } else {\n let domAfter, desc;\n if (dom == this.contentDOM) {\n domAfter = dom.childNodes[offset];\n } else {\n while (dom.parentNode != this.contentDOM) dom = dom.parentNode;\n domAfter = dom.nextSibling;\n }\n while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this)) domAfter = domAfter.nextSibling;\n return domAfter ? this.posBeforeChild(desc) : this.posAtEnd;\n }\n }\n // Otherwise, use various heuristics, falling back on the bias\n // parameter, to determine whether to return the position at the\n // start or at the end of this view desc.\n let atEnd;\n if (dom == this.dom && this.contentDOM) {\n atEnd = offset > domIndex(this.contentDOM);\n } else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {\n atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;\n } else if (this.dom.firstChild) {\n if (offset == 0) for (let search = dom;; search = search.parentNode) {\n if (search == this.dom) {\n atEnd = false;\n break;\n }\n if (search.previousSibling) break;\n }\n if (atEnd == null && offset == dom.childNodes.length) for (let search = dom;; search = search.parentNode) {\n if (search == this.dom) {\n atEnd = true;\n break;\n }\n if (search.nextSibling) break;\n }\n }\n return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart;\n }\n nearestDesc(dom, onlyNodes = false) {\n for (let first = true, cur = dom; cur; cur = cur.parentNode) {\n let desc = this.getDesc(cur),\n nodeDOM;\n if (desc && (!onlyNodes || desc.node)) {\n // If dom is outside of this desc's nodeDOM, don't count it.\n if (first && (nodeDOM = desc.nodeDOM) && !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom)) first = false;else return desc;\n }\n }\n }\n getDesc(dom) {\n let desc = dom.pmViewDesc;\n for (let cur = desc; cur; cur = cur.parent) if (cur == this) return desc;\n }\n posFromDOM(dom, offset, bias) {\n for (let scan = dom; scan; scan = scan.parentNode) {\n let desc = this.getDesc(scan);\n if (desc) return desc.localPosFromDOM(dom, offset, bias);\n }\n return -1;\n }\n // Find the desc for the node after the given pos, if any. (When a\n // parent node overrode rendering, there might not be one.)\n descAt(pos) {\n for (let i = 0, offset = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (offset == pos && end != offset) {\n while (!child.border && child.children.length) child = child.children[0];\n return child;\n }\n if (pos < end) return child.descAt(pos - offset - child.border);\n offset = end;\n }\n }\n domFromPos(pos, side) {\n if (!this.contentDOM) return {\n node: this.dom,\n offset: 0,\n atom: pos + 1\n };\n // First find the position in the child array\n let i = 0,\n offset = 0;\n for (let curPos = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = curPos + child.size;\n if (end > pos || child instanceof TrailingHackViewDesc) {\n offset = pos - curPos;\n break;\n }\n curPos = end;\n }\n // If this points into the middle of a child, call through\n if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side);\n // Go back if there were any zero-length widgets with side >= 0 before this point\n for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--) {}\n // Scan towards the first useable node\n if (side <= 0) {\n let prev,\n enter = true;\n for (;; i--, enter = false) {\n prev = i ? this.children[i - 1] : null;\n if (!prev || prev.dom.parentNode == this.contentDOM) break;\n }\n if (prev && side && enter && !prev.border && !prev.domAtom) return prev.domFromPos(prev.size, side);\n return {\n node: this.contentDOM,\n offset: prev ? domIndex(prev.dom) + 1 : 0\n };\n } else {\n let next,\n enter = true;\n for (;; i++, enter = false) {\n next = i < this.children.length ? this.children[i] : null;\n if (!next || next.dom.parentNode == this.contentDOM) break;\n }\n if (next && enter && !next.border && !next.domAtom) return next.domFromPos(0, side);\n return {\n node: this.contentDOM,\n offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length\n };\n }\n }\n // Used to find a DOM range in a single parent for a given changed\n // range.\n parseRange(from, to, base = 0) {\n if (this.children.length == 0) return {\n node: this.contentDOM,\n from,\n to,\n fromOffset: 0,\n toOffset: this.contentDOM.childNodes.length\n };\n let fromOffset = -1,\n toOffset = -1;\n for (let offset = base, i = 0;; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (fromOffset == -1 && from <= end) {\n let childBase = offset + child.border;\n // FIXME maybe descend mark views to parse a narrower range?\n if (from >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM)) return child.parseRange(from, to, childBase);\n from = offset;\n for (let j = i; j > 0; j--) {\n let prev = this.children[j - 1];\n if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {\n fromOffset = domIndex(prev.dom) + 1;\n break;\n }\n from -= prev.size;\n }\n if (fromOffset == -1) fromOffset = 0;\n }\n if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {\n to = end;\n for (let j = i + 1; j < this.children.length; j++) {\n let next = this.children[j];\n if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {\n toOffset = domIndex(next.dom);\n break;\n }\n to += next.size;\n }\n if (toOffset == -1) toOffset = this.contentDOM.childNodes.length;\n break;\n }\n offset = end;\n }\n return {\n node: this.contentDOM,\n from,\n to,\n fromOffset,\n toOffset\n };\n }\n emptyChildAt(side) {\n if (this.border || !this.contentDOM || !this.children.length) return false;\n let child = this.children[side < 0 ? 0 : this.children.length - 1];\n return child.size == 0 || child.emptyChildAt(side);\n }\n domAfterPos(pos) {\n let {\n node,\n offset\n } = this.domFromPos(pos, 0);\n if (node.nodeType != 1 || offset == node.childNodes.length) throw new RangeError(\"No node after pos \" + pos);\n return node.childNodes[offset];\n }\n // View descs are responsible for setting any selection that falls\n // entirely inside of them, so that custom implementations can do\n // custom things with the selection. Note that this falls apart when\n // a selection starts in such a node and ends in another, in which\n // case we just use whatever domFromPos produces as a best effort.\n setSelection(anchor, head, view, force = false) {\n // If the selection falls entirely in a child, give it to that child\n let from = Math.min(anchor, head),\n to = Math.max(anchor, head);\n for (let i = 0, offset = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (from > offset && to < end) return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force);\n offset = end;\n }\n let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);\n let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);\n let domSel = view.root.getSelection();\n let selRange = view.domSelectionRange();\n let brKludge = false;\n // On Firefox, using Selection.collapse to put the cursor after a\n // BR node for some reason doesn't always work (#1073). On Safari,\n // the cursor sometimes inexplicable visually lags behind its\n // reported position in such situations (#1092).\n if ((gecko || safari) && anchor == head) {\n let {\n node,\n offset\n } = anchorDOM;\n if (node.nodeType == 3) {\n brKludge = !!(offset && node.nodeValue[offset - 1] == \"\\n\");\n // Issue #1128\n if (brKludge && offset == node.nodeValue.length) {\n for (let scan = node, after; scan; scan = scan.parentNode) {\n if (after = scan.nextSibling) {\n if (after.nodeName == \"BR\") anchorDOM = headDOM = {\n node: after.parentNode,\n offset: domIndex(after) + 1\n };\n break;\n }\n let desc = scan.pmViewDesc;\n if (desc && desc.node && desc.node.isBlock) break;\n }\n }\n } else {\n let prev = node.childNodes[offset - 1];\n brKludge = prev && (prev.nodeName == \"BR\" || prev.contentEditable == \"false\");\n }\n }\n // Firefox can act strangely when the selection is in front of an\n // uneditable node. See #1163 and https://bugzilla.mozilla.org/show_bug.cgi?id=1709536\n if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {\n let after = selRange.focusNode.childNodes[selRange.focusOffset];\n if (after && after.contentEditable == \"false\") force = true;\n }\n if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset)) return;\n // Selection.extend can be used to create an 'inverted' selection\n // (one where the focus is before the anchor), but not all\n // browsers support it yet.\n let domSelExtended = false;\n if ((domSel.extend || anchor == head) && !brKludge) {\n domSel.collapse(anchorDOM.node, anchorDOM.offset);\n try {\n if (anchor != head) domSel.extend(headDOM.node, headDOM.offset);\n domSelExtended = true;\n } catch (_) {\n // In some cases with Chrome the selection is empty after calling\n // collapse, even when it should be valid. This appears to be a bug, but\n // it is difficult to isolate. If this happens fallback to the old path\n // without using extend.\n // Similarly, this could crash on Safari if the editor is hidden, and\n // there was no selection.\n }\n }\n if (!domSelExtended) {\n if (anchor > head) {\n let tmp = anchorDOM;\n anchorDOM = headDOM;\n headDOM = tmp;\n }\n let range = document.createRange();\n range.setEnd(headDOM.node, headDOM.offset);\n range.setStart(anchorDOM.node, anchorDOM.offset);\n domSel.removeAllRanges();\n domSel.addRange(range);\n }\n }\n ignoreMutation(mutation) {\n return !this.contentDOM && mutation.type != \"selection\";\n }\n get contentLost() {\n return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);\n }\n // Remove a subtree of the element tree that has been touched\n // by a DOM change, so that the next update will redraw it.\n markDirty(from, to) {\n for (let offset = 0, i = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (offset == end ? from <= end && to >= offset : from < end && to > offset) {\n let startInside = offset + child.border,\n endInside = end - child.border;\n if (from >= startInside && to <= endInside) {\n this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;\n if (from == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM)) child.dirty = NODE_DIRTY;else child.markDirty(from - startInside, to - startInside);\n return;\n } else {\n child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY;\n }\n }\n offset = end;\n }\n this.dirty = CONTENT_DIRTY;\n }\n markParentsDirty() {\n let level = 1;\n for (let node = this.parent; node; node = node.parent, level++) {\n let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;\n if (node.dirty < dirty) node.dirty = dirty;\n }\n }\n get domAtom() {\n return false;\n }\n get ignoreForCoords() {\n return false;\n }\n isText(text) {\n return false;\n }\n}\n// A widget desc represents a widget decoration, which is a DOM node\n// drawn between the document nodes.\nclass WidgetViewDesc extends ViewDesc {\n constructor(parent, widget, view, pos) {\n let self,\n dom = widget.type.toDOM;\n if (typeof dom == \"function\") dom = dom(view, () => {\n if (!self) return pos;\n if (self.parent) return self.parent.posBeforeChild(self);\n });\n if (!widget.type.spec.raw) {\n if (dom.nodeType != 1) {\n let wrap = document.createElement(\"span\");\n wrap.appendChild(dom);\n dom = wrap;\n }\n dom.contentEditable = \"false\";\n dom.classList.add(\"ProseMirror-widget\");\n }\n super(parent, [], dom, null);\n this.widget = widget;\n this.widget = widget;\n self = this;\n }\n matchesWidget(widget) {\n return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type);\n }\n parseRule() {\n return {\n ignore: true\n };\n }\n stopEvent(event) {\n let stop = this.widget.spec.stopEvent;\n return stop ? stop(event) : false;\n }\n ignoreMutation(mutation) {\n return mutation.type != \"selection\" || this.widget.spec.ignoreSelection;\n }\n destroy() {\n this.widget.type.destroy(this.dom);\n super.destroy();\n }\n get domAtom() {\n return true;\n }\n get side() {\n return this.widget.type.side;\n }\n}\nclass CompositionViewDesc extends ViewDesc {\n constructor(parent, dom, textDOM, text) {\n super(parent, [], dom, null);\n this.textDOM = textDOM;\n this.text = text;\n }\n get size() {\n return this.text.length;\n }\n localPosFromDOM(dom, offset) {\n if (dom != this.textDOM) return this.posAtStart + (offset ? this.size : 0);\n return this.posAtStart + offset;\n }\n domFromPos(pos) {\n return {\n node: this.textDOM,\n offset: pos\n };\n }\n ignoreMutation(mut) {\n return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue;\n }\n}\n// A mark desc represents a mark. May have multiple children,\n// depending on how the mark is split. Note that marks are drawn using\n// a fixed nesting order, for simplicity and predictability, so in\n// some cases they will be split more often than would appear\n// necessary.\nclass MarkViewDesc extends ViewDesc {\n constructor(parent, mark, dom, contentDOM, spec) {\n super(parent, [], dom, contentDOM);\n this.mark = mark;\n this.spec = spec;\n }\n static create(parent, mark, inline, view) {\n let custom = view.nodeViews[mark.type.name];\n let spec = custom && custom(mark, view, inline);\n if (!spec || !spec.dom) spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline), null, mark.attrs);\n return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom, spec);\n }\n parseRule() {\n if (this.dirty & NODE_DIRTY || this.mark.type.spec.reparseInView) return null;\n return {\n mark: this.mark.type.name,\n attrs: this.mark.attrs,\n contentElement: this.contentDOM\n };\n }\n matchesMark(mark) {\n return this.dirty != NODE_DIRTY && this.mark.eq(mark);\n }\n markDirty(from, to) {\n super.markDirty(from, to);\n // Move dirty info to nearest node view\n if (this.dirty != NOT_DIRTY) {\n let parent = this.parent;\n while (!parent.node) parent = parent.parent;\n if (parent.dirty < this.dirty) parent.dirty = this.dirty;\n this.dirty = NOT_DIRTY;\n }\n }\n slice(from, to, view) {\n let copy = MarkViewDesc.create(this.parent, this.mark, true, view);\n let nodes = this.children,\n size = this.size;\n if (to < size) nodes = replaceNodes(nodes, to, size, view);\n if (from > 0) nodes = replaceNodes(nodes, 0, from, view);\n for (let i = 0; i < nodes.length; i++) nodes[i].parent = copy;\n copy.children = nodes;\n return copy;\n }\n ignoreMutation(mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n }\n destroy() {\n if (this.spec.destroy) this.spec.destroy();\n super.destroy();\n }\n}\n// Node view descs are the main, most common type of view desc, and\n// correspond to an actual node in the document. Unlike mark descs,\n// they populate their child array themselves.\nclass NodeViewDesc extends ViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {\n super(parent, [], dom, contentDOM);\n this.node = node;\n this.outerDeco = outerDeco;\n this.innerDeco = innerDeco;\n this.nodeDOM = nodeDOM;\n }\n // By default, a node is rendered using the `toDOM` method from the\n // node type spec. But client code can use the `nodeViews` spec to\n // supply a custom node view, which can influence various aspects of\n // the way the node works.\n //\n // (Using subclassing for this was intentionally decided against,\n // since it'd require exposing a whole slew of finicky\n // implementation details to the user code that they probably will\n // never need.)\n static create(parent, node, outerDeco, innerDeco, view, pos) {\n let custom = view.nodeViews[node.type.name],\n descObj;\n let spec = custom && custom(node, view, () => {\n // (This is a function that allows the custom view to find its\n // own position)\n if (!descObj) return pos;\n if (descObj.parent) return descObj.parent.posBeforeChild(descObj);\n }, outerDeco, innerDeco);\n let dom = spec && spec.dom,\n contentDOM = spec && spec.contentDOM;\n if (node.isText) {\n if (!dom) dom = document.createTextNode(node.text);else if (dom.nodeType != 3) throw new RangeError(\"Text must be rendered as a DOM text node\");\n } else if (!dom) {\n let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);\n ({\n dom,\n contentDOM\n } = spec);\n }\n if (!contentDOM && !node.isText && dom.nodeName != \"BR\") {\n // Chrome gets confused by
\n if (!dom.hasAttribute(\"contenteditable\")) dom.contentEditable = \"false\";\n if (node.type.spec.draggable) dom.draggable = true;\n }\n let nodeDOM = dom;\n dom = applyOuterDeco(dom, outerDeco, node);\n if (spec) return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1);else if (node.isText) return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view);else return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1);\n }\n parseRule() {\n // Experimental kludge to allow opt-in re-parsing of nodes\n if (this.node.type.spec.reparseInView) return null;\n // FIXME the assumption that this can always return the current\n // attrs means that if the user somehow manages to change the\n // attrs in the dom, that won't be picked up. Not entirely sure\n // whether this is a problem\n let rule = {\n node: this.node.type.name,\n attrs: this.node.attrs\n };\n if (this.node.type.whitespace == \"pre\") rule.preserveWhitespace = \"full\";\n if (!this.contentDOM) {\n rule.getContent = () => this.node.content;\n } else if (!this.contentLost) {\n rule.contentElement = this.contentDOM;\n } else {\n // Chrome likes to randomly recreate parent nodes when\n // backspacing things. When that happens, this tries to find the\n // new parent.\n for (let i = this.children.length - 1; i >= 0; i--) {\n let child = this.children[i];\n if (this.dom.contains(child.dom.parentNode)) {\n rule.contentElement = child.dom.parentNode;\n break;\n }\n }\n if (!rule.contentElement) rule.getContent = () => Fragment.empty;\n }\n return rule;\n }\n matchesNode(node, outerDeco, innerDeco) {\n return this.dirty == NOT_DIRTY && node.eq(this.node) && sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco);\n }\n get size() {\n return this.node.nodeSize;\n }\n get border() {\n return this.node.isLeaf ? 0 : 1;\n }\n // Syncs `this.children` to match `this.node.content` and the local\n // decorations, possibly introducing nesting for marks. Then, in a\n // separate step, syncs the DOM inside `this.contentDOM` to\n // `this.children`.\n updateChildren(view, pos) {\n let inline = this.node.inlineContent,\n off = pos;\n let composition = view.composing ? this.localCompositionInfo(view, pos) : null;\n let localComposition = composition && composition.pos > -1 ? composition : null;\n let compositionInChild = composition && composition.pos < 0;\n let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);\n iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {\n if (widget.spec.marks) updater.syncToMarks(widget.spec.marks, inline, view);else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i == this.node.childCount ? Mark.none : this.node.child(i).marks, inline, view);\n // If the next node is a desc matching this widget, reuse it,\n // otherwise insert the widget as a new view desc.\n updater.placeWidget(widget, view, off);\n }, (child, outerDeco, innerDeco, i) => {\n // Make sure the wrapping mark descs match the node's marks.\n updater.syncToMarks(child.marks, inline, view);\n // Try several strategies for drawing this node\n let compIndex;\n if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ;else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) ;else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off)) ;else {\n // Add it as a new view\n updater.addNode(child, outerDeco, innerDeco, view, off);\n }\n off += child.nodeSize;\n });\n // Drop all remaining descs after the current position.\n updater.syncToMarks([], inline, view);\n if (this.node.isTextblock) updater.addTextblockHacks();\n updater.destroyRest();\n // Sync the DOM if anything changed\n if (updater.changed || this.dirty == CONTENT_DIRTY) {\n // May have to protect focused DOM from being changed if a composition is active\n if (localComposition) this.protectLocalComposition(view, localComposition);\n renderDescs(this.contentDOM, this.children, view);\n if (ios) iosHacks(this.dom);\n }\n }\n localCompositionInfo(view, pos) {\n // Only do something if both the selection and a focused text node\n // are inside of this node\n let {\n from,\n to\n } = view.state.selection;\n if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) return null;\n let textNode = view.input.compositionNode;\n if (!textNode || !this.dom.contains(textNode.parentNode)) return null;\n if (this.node.inlineContent) {\n // Find the text in the focused node in the node, stop if it's not\n // there (may have been modified through other means, in which\n // case it should overwritten)\n let text = textNode.nodeValue;\n let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);\n return textPos < 0 ? null : {\n node: textNode,\n pos: textPos,\n text\n };\n } else {\n return {\n node: textNode,\n pos: -1,\n text: \"\"\n };\n }\n }\n protectLocalComposition(view, {\n node,\n pos,\n text\n }) {\n // The node is already part of a local view desc, leave it there\n if (this.getDesc(node)) return;\n // Create a composition view for the orphaned nodes\n let topNode = node;\n for (;; topNode = topNode.parentNode) {\n if (topNode.parentNode == this.contentDOM) break;\n while (topNode.previousSibling) topNode.parentNode.removeChild(topNode.previousSibling);\n while (topNode.nextSibling) topNode.parentNode.removeChild(topNode.nextSibling);\n if (topNode.pmViewDesc) topNode.pmViewDesc = undefined;\n }\n let desc = new CompositionViewDesc(this, topNode, node, text);\n view.input.compositionNodes.push(desc);\n // Patch up this.children to contain the composition view\n this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);\n }\n // If this desc must be updated to match the given node decoration,\n // do so and return true.\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY || !node.sameMarkup(this.node)) return false;\n this.updateInner(node, outerDeco, innerDeco, view);\n return true;\n }\n updateInner(node, outerDeco, innerDeco, view) {\n this.updateOuterDeco(outerDeco);\n this.node = node;\n this.innerDeco = innerDeco;\n if (this.contentDOM) this.updateChildren(view, this.posAtStart);\n this.dirty = NOT_DIRTY;\n }\n updateOuterDeco(outerDeco) {\n if (sameOuterDeco(outerDeco, this.outerDeco)) return;\n let needsWrap = this.nodeDOM.nodeType != 1;\n let oldDOM = this.dom;\n this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));\n if (this.dom != oldDOM) {\n oldDOM.pmViewDesc = undefined;\n this.dom.pmViewDesc = this;\n }\n this.outerDeco = outerDeco;\n }\n // Mark this node as being the selected node.\n selectNode() {\n if (this.nodeDOM.nodeType == 1) this.nodeDOM.classList.add(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) this.dom.draggable = true;\n }\n // Remove selected node marking from this node.\n deselectNode() {\n if (this.nodeDOM.nodeType == 1) {\n this.nodeDOM.classList.remove(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) this.dom.removeAttribute(\"draggable\");\n }\n }\n get domAtom() {\n return this.node.isAtom;\n }\n}\n// Create a view desc for the top-level document node, to be exported\n// and used by the view class.\nfunction docViewDesc(doc, outerDeco, innerDeco, dom, view) {\n applyOuterDeco(dom, outerDeco, doc);\n let docView = new NodeViewDesc(undefined, doc, outerDeco, innerDeco, dom, dom, dom, view, 0);\n if (docView.contentDOM) docView.updateChildren(view, 0);\n return docView;\n}\nclass TextViewDesc extends NodeViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {\n super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view, 0);\n }\n parseRule() {\n let skip = this.nodeDOM.parentNode;\n while (skip && skip != this.dom && !skip.pmIsDeco) skip = skip.parentNode;\n return {\n skip: skip || true\n };\n }\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY || this.dirty != NOT_DIRTY && !this.inParent() || !node.sameMarkup(this.node)) return false;\n this.updateOuterDeco(outerDeco);\n if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {\n this.nodeDOM.nodeValue = node.text;\n if (view.trackWrites == this.nodeDOM) view.trackWrites = null;\n }\n this.node = node;\n this.dirty = NOT_DIRTY;\n return true;\n }\n inParent() {\n let parentDOM = this.parent.contentDOM;\n for (let n = this.nodeDOM; n; n = n.parentNode) if (n == parentDOM) return true;\n return false;\n }\n domFromPos(pos) {\n return {\n node: this.nodeDOM,\n offset: pos\n };\n }\n localPosFromDOM(dom, offset, bias) {\n if (dom == this.nodeDOM) return this.posAtStart + Math.min(offset, this.node.text.length);\n return super.localPosFromDOM(dom, offset, bias);\n }\n ignoreMutation(mutation) {\n return mutation.type != \"characterData\" && mutation.type != \"selection\";\n }\n slice(from, to, view) {\n let node = this.node.cut(from, to),\n dom = document.createTextNode(node.text);\n return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);\n }\n markDirty(from, to) {\n super.markDirty(from, to);\n if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length)) this.dirty = NODE_DIRTY;\n }\n get domAtom() {\n return false;\n }\n isText(text) {\n return this.node.text == text;\n }\n}\n// A dummy desc used to tag trailing BR or IMG nodes created to work\n// around contentEditable terribleness.\nclass TrailingHackViewDesc extends ViewDesc {\n parseRule() {\n return {\n ignore: true\n };\n }\n matchesHack(nodeName) {\n return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName;\n }\n get domAtom() {\n return true;\n }\n get ignoreForCoords() {\n return this.dom.nodeName == \"IMG\";\n }\n}\n// A separate subclass is used for customized node views, so that the\n// extra checks only have to be made for nodes that are actually\n// customized.\nclass CustomNodeViewDesc extends NodeViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {\n super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);\n this.spec = spec;\n }\n // A custom `update` method gets to decide whether the update goes\n // through. If it does, and there's a `contentDOM` node, our logic\n // updates the children.\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY) return false;\n if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {\n let result = this.spec.update(node, outerDeco, innerDeco);\n if (result) this.updateInner(node, outerDeco, innerDeco, view);\n return result;\n } else if (!this.contentDOM && !node.isLeaf) {\n return false;\n } else {\n return super.update(node, outerDeco, innerDeco, view);\n }\n }\n selectNode() {\n this.spec.selectNode ? this.spec.selectNode() : super.selectNode();\n }\n deselectNode() {\n this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();\n }\n setSelection(anchor, head, view, force) {\n this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root) : super.setSelection(anchor, head, view, force);\n }\n destroy() {\n if (this.spec.destroy) this.spec.destroy();\n super.destroy();\n }\n stopEvent(event) {\n return this.spec.stopEvent ? this.spec.stopEvent(event) : false;\n }\n ignoreMutation(mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n }\n}\n// Sync the content of the given DOM node with the nodes associated\n// with the given array of view descs, recursing into mark descs\n// because this should sync the subtree for a whole node at a time.\nfunction renderDescs(parentDOM, descs, view) {\n let dom = parentDOM.firstChild,\n written = false;\n for (let i = 0; i < descs.length; i++) {\n let desc = descs[i],\n childDOM = desc.dom;\n if (childDOM.parentNode == parentDOM) {\n while (childDOM != dom) {\n dom = rm(dom);\n written = true;\n }\n dom = dom.nextSibling;\n } else {\n written = true;\n parentDOM.insertBefore(childDOM, dom);\n }\n if (desc instanceof MarkViewDesc) {\n let pos = dom ? dom.previousSibling : parentDOM.lastChild;\n renderDescs(desc.contentDOM, desc.children, view);\n dom = pos ? pos.nextSibling : parentDOM.firstChild;\n }\n }\n while (dom) {\n dom = rm(dom);\n written = true;\n }\n if (written && view.trackWrites == parentDOM) view.trackWrites = null;\n}\nconst OuterDecoLevel = function (nodeName) {\n if (nodeName) this.nodeName = nodeName;\n};\nOuterDecoLevel.prototype = Object.create(null);\nconst noDeco = [new OuterDecoLevel()];\nfunction computeOuterDeco(outerDeco, node, needsWrap) {\n if (outerDeco.length == 0) return noDeco;\n let top = needsWrap ? noDeco[0] : new OuterDecoLevel(),\n result = [top];\n for (let i = 0; i < outerDeco.length; i++) {\n let attrs = outerDeco[i].type.attrs;\n if (!attrs) continue;\n if (attrs.nodeName) result.push(top = new OuterDecoLevel(attrs.nodeName));\n for (let name in attrs) {\n let val = attrs[name];\n if (val == null) continue;\n if (needsWrap && result.length == 1) result.push(top = new OuterDecoLevel(node.isInline ? \"span\" : \"div\"));\n if (name == \"class\") top.class = (top.class ? top.class + \" \" : \"\") + val;else if (name == \"style\") top.style = (top.style ? top.style + \";\" : \"\") + val;else if (name != \"nodeName\") top[name] = val;\n }\n }\n return result;\n}\nfunction patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {\n // Shortcut for trivial case\n if (prevComputed == noDeco && curComputed == noDeco) return nodeDOM;\n let curDOM = nodeDOM;\n for (let i = 0; i < curComputed.length; i++) {\n let deco = curComputed[i],\n prev = prevComputed[i];\n if (i) {\n let parent;\n if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM && (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) {\n curDOM = parent;\n } else {\n parent = document.createElement(deco.nodeName);\n parent.pmIsDeco = true;\n parent.appendChild(curDOM);\n prev = noDeco[0];\n curDOM = parent;\n }\n }\n patchAttributes(curDOM, prev || noDeco[0], deco);\n }\n return curDOM;\n}\nfunction patchAttributes(dom, prev, cur) {\n for (let name in prev) if (name != \"class\" && name != \"style\" && name != \"nodeName\" && !(name in cur)) dom.removeAttribute(name);\n for (let name in cur) if (name != \"class\" && name != \"style\" && name != \"nodeName\" && cur[name] != prev[name]) dom.setAttribute(name, cur[name]);\n if (prev.class != cur.class) {\n let prevList = prev.class ? prev.class.split(\" \").filter(Boolean) : [];\n let curList = cur.class ? cur.class.split(\" \").filter(Boolean) : [];\n for (let i = 0; i < prevList.length; i++) if (curList.indexOf(prevList[i]) == -1) dom.classList.remove(prevList[i]);\n for (let i = 0; i < curList.length; i++) if (prevList.indexOf(curList[i]) == -1) dom.classList.add(curList[i]);\n if (dom.classList.length == 0) dom.removeAttribute(\"class\");\n }\n if (prev.style != cur.style) {\n if (prev.style) {\n let prop = /\\s*([\\w\\-\\xa1-\\uffff]+)\\s*:(?:\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|\\(.*?\\)|[^;])*/g,\n m;\n while (m = prop.exec(prev.style)) dom.style.removeProperty(m[1]);\n }\n if (cur.style) dom.style.cssText += cur.style;\n }\n}\nfunction applyOuterDeco(dom, deco, node) {\n return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));\n}\nfunction sameOuterDeco(a, b) {\n if (a.length != b.length) return false;\n for (let i = 0; i < a.length; i++) if (!a[i].type.eq(b[i].type)) return false;\n return true;\n}\n// Remove a DOM node and return its next sibling.\nfunction rm(dom) {\n let next = dom.nextSibling;\n dom.parentNode.removeChild(dom);\n return next;\n}\n// Helper class for incrementally updating a tree of mark descs and\n// the widget and node descs inside of them.\nclass ViewTreeUpdater {\n constructor(top, lock, view) {\n this.lock = lock;\n this.view = view;\n // Index into `this.top`'s child array, represents the current\n // update position.\n this.index = 0;\n // When entering a mark, the current top and index are pushed\n // onto this.\n this.stack = [];\n // Tracks whether anything was changed\n this.changed = false;\n this.top = top;\n this.preMatch = preMatch(top.node.content, top);\n }\n // Destroy and remove the children between the given indices in\n // `this.top`.\n destroyBetween(start, end) {\n if (start == end) return;\n for (let i = start; i < end; i++) this.top.children[i].destroy();\n this.top.children.splice(start, end - start);\n this.changed = true;\n }\n // Destroy all remaining children in `this.top`.\n destroyRest() {\n this.destroyBetween(this.index, this.top.children.length);\n }\n // Sync the current stack of mark descs with the given array of\n // marks, reusing existing mark descs when possible.\n syncToMarks(marks, inline, view) {\n let keep = 0,\n depth = this.stack.length >> 1;\n let maxKeep = Math.min(depth, marks.length);\n while (keep < maxKeep && (keep == depth - 1 ? this.top : this.stack[keep + 1 << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false) keep++;\n while (keep < depth) {\n this.destroyRest();\n this.top.dirty = NOT_DIRTY;\n this.index = this.stack.pop();\n this.top = this.stack.pop();\n depth--;\n }\n while (depth < marks.length) {\n this.stack.push(this.top, this.index + 1);\n let found = -1;\n for (let i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n let next = this.top.children[i];\n if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {\n found = i;\n break;\n }\n }\n if (found > -1) {\n if (found > this.index) {\n this.changed = true;\n this.destroyBetween(this.index, found);\n }\n this.top = this.top.children[this.index];\n } else {\n let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n this.top.children.splice(this.index, 0, markDesc);\n this.top = markDesc;\n this.changed = true;\n }\n this.index = 0;\n depth++;\n }\n }\n // Try to find a node desc matching the given data. Skip over it and\n // return true when successful.\n findNodeMatch(node, outerDeco, innerDeco, index) {\n let found = -1,\n targetDesc;\n if (index >= this.preMatch.index && (targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top && targetDesc.matchesNode(node, outerDeco, innerDeco)) {\n found = this.top.children.indexOf(targetDesc, this.index);\n } else {\n for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {\n let child = this.top.children[i];\n if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {\n found = i;\n break;\n }\n }\n }\n if (found < 0) return false;\n this.destroyBetween(this.index, found);\n this.index++;\n return true;\n }\n updateNodeAt(node, outerDeco, innerDeco, index, view) {\n let child = this.top.children[index];\n if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM) child.dirty = CONTENT_DIRTY;\n if (!child.update(node, outerDeco, innerDeco, view)) return false;\n this.destroyBetween(this.index, index);\n this.index++;\n return true;\n }\n findIndexWithChild(domNode) {\n for (;;) {\n let parent = domNode.parentNode;\n if (!parent) return -1;\n if (parent == this.top.contentDOM) {\n let desc = domNode.pmViewDesc;\n if (desc) for (let i = this.index; i < this.top.children.length; i++) {\n if (this.top.children[i] == desc) return i;\n }\n return -1;\n }\n domNode = parent;\n }\n }\n // Try to update the next node, if any, to the given data. Checks\n // pre-matches to avoid overwriting nodes that could still be used.\n updateNextNode(node, outerDeco, innerDeco, view, index, pos) {\n for (let i = this.index; i < this.top.children.length; i++) {\n let next = this.top.children[i];\n if (next instanceof NodeViewDesc) {\n let preMatch = this.preMatch.matched.get(next);\n if (preMatch != null && preMatch != index) return false;\n let nextDOM = next.dom,\n updated;\n // Can't update if nextDOM is or contains this.lock, except if\n // it's a text node whose content already matches the new text\n // and whose decorations match the new ones.\n let locked = this.isLocked(nextDOM) && !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text && next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));\n if (!locked && next.update(node, outerDeco, innerDeco, view)) {\n this.destroyBetween(this.index, i);\n if (next.dom != nextDOM) this.changed = true;\n this.index++;\n return true;\n } else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {\n this.destroyBetween(this.index, i);\n this.top.children[this.index] = updated;\n if (updated.contentDOM) {\n updated.dirty = CONTENT_DIRTY;\n updated.updateChildren(view, pos + 1);\n updated.dirty = NOT_DIRTY;\n }\n this.changed = true;\n this.index++;\n return true;\n }\n break;\n }\n }\n return false;\n }\n // When a node with content is replaced by a different node with\n // identical content, move over its children.\n recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {\n if (next.dirty || node.isAtom || !next.children.length || !next.node.content.eq(node.content) || !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco)) return null;\n let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n if (wrapper.contentDOM) {\n wrapper.children = next.children;\n next.children = [];\n for (let ch of wrapper.children) ch.parent = wrapper;\n }\n next.destroy();\n return wrapper;\n }\n // Insert the node as a newly created node desc.\n addNode(node, outerDeco, innerDeco, view, pos) {\n let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n if (desc.contentDOM) desc.updateChildren(view, pos + 1);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n placeWidget(widget, view, pos) {\n let next = this.index < this.top.children.length ? this.top.children[this.index] : null;\n if (next && next.matchesWidget(widget) && (widget == next.widget || !next.widget.type.toDOM.parentNode)) {\n this.index++;\n } else {\n let desc = new WidgetViewDesc(this.top, widget, view, pos);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n }\n // Make sure a textblock looks and behaves correctly in\n // contentEditable.\n addTextblockHacks() {\n let lastChild = this.top.children[this.index - 1],\n parent = this.top;\n while (lastChild instanceof MarkViewDesc) {\n parent = lastChild;\n lastChild = parent.children[parent.children.length - 1];\n }\n if (!lastChild ||\n // Empty textblock\n !(lastChild instanceof TextViewDesc) || /\\n$/.test(lastChild.node.text) || this.view.requiresGeckoHackNode && /\\s$/.test(lastChild.node.text)) {\n // Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)\n if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == \"false\") this.addHackNode(\"IMG\", parent);\n this.addHackNode(\"BR\", this.top);\n }\n }\n addHackNode(nodeName, parent) {\n if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {\n this.index++;\n } else {\n let dom = document.createElement(nodeName);\n if (nodeName == \"IMG\") {\n dom.className = \"ProseMirror-separator\";\n dom.alt = \"\";\n }\n if (nodeName == \"BR\") dom.className = \"ProseMirror-trailingBreak\";\n let hack = new TrailingHackViewDesc(this.top, [], dom, null);\n if (parent != this.top) parent.children.push(hack);else parent.children.splice(this.index++, 0, hack);\n this.changed = true;\n }\n }\n isLocked(node) {\n return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));\n }\n}\n// Iterate from the end of the fragment and array of descs to find\n// directly matching ones, in order to avoid overeagerly reusing those\n// for other nodes. Returns the fragment index of the first node that\n// is part of the sequence of matched nodes at the end of the\n// fragment.\nfunction preMatch(frag, parentDesc) {\n let curDesc = parentDesc,\n descI = curDesc.children.length;\n let fI = frag.childCount,\n matched = new Map(),\n matches = [];\n outer: while (fI > 0) {\n let desc;\n for (;;) {\n if (descI) {\n let next = curDesc.children[descI - 1];\n if (next instanceof MarkViewDesc) {\n curDesc = next;\n descI = next.children.length;\n } else {\n desc = next;\n descI--;\n break;\n }\n } else if (curDesc == parentDesc) {\n break outer;\n } else {\n // FIXME\n descI = curDesc.parent.children.indexOf(curDesc);\n curDesc = curDesc.parent;\n }\n }\n let node = desc.node;\n if (!node) continue;\n if (node != frag.child(fI - 1)) break;\n --fI;\n matched.set(desc, fI);\n matches.push(desc);\n }\n return {\n index: fI,\n matched,\n matches: matches.reverse()\n };\n}\nfunction compareSide(a, b) {\n return a.type.side - b.type.side;\n}\n// This function abstracts iterating over the nodes and decorations in\n// a fragment. Calls `onNode` for each node, with its local and child\n// decorations. Splits text nodes when there is a decoration starting\n// or ending inside of them. Calls `onWidget` for each widget.\nfunction iterDeco(parent, deco, onWidget, onNode) {\n let locals = deco.locals(parent),\n offset = 0;\n // Simple, cheap variant for when there are no local decorations\n if (locals.length == 0) {\n for (let i = 0; i < parent.childCount; i++) {\n let child = parent.child(i);\n onNode(child, locals, deco.forChild(offset, child), i);\n offset += child.nodeSize;\n }\n return;\n }\n let decoIndex = 0,\n active = [],\n restNode = null;\n for (let parentIndex = 0;;) {\n let widget, widgets;\n while (decoIndex < locals.length && locals[decoIndex].to == offset) {\n let next = locals[decoIndex++];\n if (next.widget) {\n if (!widget) widget = next;else (widgets || (widgets = [widget])).push(next);\n }\n }\n if (widget) {\n if (widgets) {\n widgets.sort(compareSide);\n for (let i = 0; i < widgets.length; i++) onWidget(widgets[i], parentIndex, !!restNode);\n } else {\n onWidget(widget, parentIndex, !!restNode);\n }\n }\n let child, index;\n if (restNode) {\n index = -1;\n child = restNode;\n restNode = null;\n } else if (parentIndex < parent.childCount) {\n index = parentIndex;\n child = parent.child(parentIndex++);\n } else {\n break;\n }\n for (let i = 0; i < active.length; i++) if (active[i].to <= offset) active.splice(i--, 1);\n while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset) active.push(locals[decoIndex++]);\n let end = offset + child.nodeSize;\n if (child.isText) {\n let cutAt = end;\n if (decoIndex < locals.length && locals[decoIndex].from < cutAt) cutAt = locals[decoIndex].from;\n for (let i = 0; i < active.length; i++) if (active[i].to < cutAt) cutAt = active[i].to;\n if (cutAt < end) {\n restNode = child.cut(cutAt - offset);\n child = child.cut(0, cutAt - offset);\n end = cutAt;\n index = -1;\n }\n } else {\n while (decoIndex < locals.length && locals[decoIndex].to < end) decoIndex++;\n }\n let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice();\n onNode(child, outerDeco, deco.forChild(offset, child), index);\n offset = end;\n }\n}\n// List markers in Mobile Safari will mysteriously disappear\n// sometimes. This works around that.\nfunction iosHacks(dom) {\n if (dom.nodeName == \"UL\" || dom.nodeName == \"OL\") {\n let oldCSS = dom.style.cssText;\n dom.style.cssText = oldCSS + \"; list-style: square !important\";\n window.getComputedStyle(dom).listStyle;\n dom.style.cssText = oldCSS;\n }\n}\n// Find a piece of text in an inline fragment, overlapping from-to\nfunction findTextInFragment(frag, text, from, to) {\n for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {\n let child = frag.child(i++),\n childStart = pos;\n pos += child.nodeSize;\n if (!child.isText) continue;\n let str = child.text;\n while (i < frag.childCount) {\n let next = frag.child(i++);\n pos += next.nodeSize;\n if (!next.isText) break;\n str += next.text;\n }\n if (pos >= from) {\n if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text) return to - text.length;\n let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;\n if (found >= 0 && found + text.length + childStart >= from) return childStart + found;\n if (from == to && str.length >= to + text.length - childStart && str.slice(to - childStart, to - childStart + text.length) == text) return to;\n }\n }\n return -1;\n}\n// Replace range from-to in an array of view descs with replacement\n// (may be null to just delete). This goes very much against the grain\n// of the rest of this code, which tends to create nodes with the\n// right shape in one go, rather than messing with them after\n// creation, but is necessary in the composition hack.\nfunction replaceNodes(nodes, from, to, view, replacement) {\n let result = [];\n for (let i = 0, off = 0; i < nodes.length; i++) {\n let child = nodes[i],\n start = off,\n end = off += child.size;\n if (start >= to || end <= from) {\n result.push(child);\n } else {\n if (start < from) result.push(child.slice(0, from - start, view));\n if (replacement) {\n result.push(replacement);\n replacement = undefined;\n }\n if (end > to) result.push(child.slice(to - start, child.size, view));\n }\n }\n return result;\n}\nfunction selectionFromDOM(view, origin = null) {\n let domSel = view.domSelectionRange(),\n doc = view.state.doc;\n if (!domSel.focusNode) return null;\n let nearestDesc = view.docView.nearestDesc(domSel.focusNode),\n inWidget = nearestDesc && nearestDesc.size == 0;\n let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);\n if (head < 0) return null;\n let $head = doc.resolve(head),\n anchor,\n selection;\n if (selectionCollapsed(domSel)) {\n anchor = head;\n while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent;\n let nearestDescNode = nearestDesc.node;\n if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {\n let pos = nearestDesc.posBefore;\n selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));\n }\n } else {\n if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {\n let min = head,\n max = head;\n for (let i = 0; i < domSel.rangeCount; i++) {\n let range = domSel.getRangeAt(i);\n min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));\n max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));\n }\n if (min < 0) return null;\n [anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];\n $head = doc.resolve(head);\n } else {\n anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);\n }\n if (anchor < 0) return null;\n }\n let $anchor = doc.resolve(anchor);\n if (!selection) {\n let bias = origin == \"pointer\" || view.state.selection.head < $head.pos && !inWidget ? 1 : -1;\n selection = selectionBetween(view, $anchor, $head, bias);\n }\n return selection;\n}\nfunction editorOwnsSelection(view) {\n return view.editable ? view.hasFocus() : hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom);\n}\nfunction selectionToDOM(view, force = false) {\n let sel = view.state.selection;\n syncNodeSelection(view, sel);\n if (!editorOwnsSelection(view)) return;\n // The delayed drag selection causes issues with Cell Selections\n // in Safari. And the drag selection delay is to workarond issues\n // which only present in Chrome.\n if (!force && view.input.mouseDown && view.input.mouseDown.allowDefault && chrome) {\n let domSel = view.domSelectionRange(),\n curSel = view.domObserver.currentSelection;\n if (domSel.anchorNode && curSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)) {\n view.input.mouseDown.delayedSelectionSync = true;\n view.domObserver.setCurSelection();\n return;\n }\n }\n view.domObserver.disconnectSelection();\n if (view.cursorWrapper) {\n selectCursorWrapper(view);\n } else {\n let {\n anchor,\n head\n } = sel,\n resetEditableFrom,\n resetEditableTo;\n if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {\n if (!sel.$from.parent.inlineContent) resetEditableFrom = temporarilyEditableNear(view, sel.from);\n if (!sel.empty && !sel.$from.parent.inlineContent) resetEditableTo = temporarilyEditableNear(view, sel.to);\n }\n view.docView.setSelection(anchor, head, view, force);\n if (brokenSelectBetweenUneditable) {\n if (resetEditableFrom) resetEditable(resetEditableFrom);\n if (resetEditableTo) resetEditable(resetEditableTo);\n }\n if (sel.visible) {\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n } else {\n view.dom.classList.add(\"ProseMirror-hideselection\");\n if (\"onselectionchange\" in document) removeClassOnSelectionChange(view);\n }\n }\n view.domObserver.setCurSelection();\n view.domObserver.connectSelection();\n}\n// Kludge to work around Webkit not allowing a selection to start/end\n// between non-editable block nodes. We briefly make something\n// editable, set the selection, then set it uneditable again.\nconst brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63;\nfunction temporarilyEditableNear(view, pos) {\n let {\n node,\n offset\n } = view.docView.domFromPos(pos, 0);\n let after = offset < node.childNodes.length ? node.childNodes[offset] : null;\n let before = offset ? node.childNodes[offset - 1] : null;\n if (safari && after && after.contentEditable == \"false\") return setEditable(after);\n if ((!after || after.contentEditable == \"false\") && (!before || before.contentEditable == \"false\")) {\n if (after) return setEditable(after);else if (before) return setEditable(before);\n }\n}\nfunction setEditable(element) {\n element.contentEditable = \"true\";\n if (safari && element.draggable) {\n element.draggable = false;\n element.wasDraggable = true;\n }\n return element;\n}\nfunction resetEditable(element) {\n element.contentEditable = \"false\";\n if (element.wasDraggable) {\n element.draggable = true;\n element.wasDraggable = null;\n }\n}\nfunction removeClassOnSelectionChange(view) {\n let doc = view.dom.ownerDocument;\n doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n let domSel = view.domSelectionRange();\n let node = domSel.anchorNode,\n offset = domSel.anchorOffset;\n doc.addEventListener(\"selectionchange\", view.input.hideSelectionGuard = () => {\n if (domSel.anchorNode != node || domSel.anchorOffset != offset) {\n doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n setTimeout(() => {\n if (!editorOwnsSelection(view) || view.state.selection.visible) view.dom.classList.remove(\"ProseMirror-hideselection\");\n }, 20);\n }\n });\n}\nfunction selectCursorWrapper(view) {\n let domSel = view.domSelection(),\n range = document.createRange();\n if (!domSel) return;\n let node = view.cursorWrapper.dom,\n img = node.nodeName == \"IMG\";\n if (img) range.setStart(node.parentNode, domIndex(node) + 1);else range.setStart(node, 0);\n range.collapse(true);\n domSel.removeAllRanges();\n domSel.addRange(range);\n // Kludge to kill 'control selection' in IE11 when selecting an\n // invisible cursor wrapper, since that would result in those weird\n // resize handles and a selection that considers the absolutely\n // positioned wrapper, rather than the root editable node, the\n // focused element.\n if (!img && !view.state.selection.visible && ie && ie_version <= 11) {\n node.disabled = true;\n node.disabled = false;\n }\n}\nfunction syncNodeSelection(view, sel) {\n if (sel instanceof NodeSelection) {\n let desc = view.docView.descAt(sel.from);\n if (desc != view.lastSelectedViewDesc) {\n clearNodeSelection(view);\n if (desc) desc.selectNode();\n view.lastSelectedViewDesc = desc;\n }\n } else {\n clearNodeSelection(view);\n }\n}\n// Clear all DOM statefulness of the last node selection.\nfunction clearNodeSelection(view) {\n if (view.lastSelectedViewDesc) {\n if (view.lastSelectedViewDesc.parent) view.lastSelectedViewDesc.deselectNode();\n view.lastSelectedViewDesc = undefined;\n }\n}\nfunction selectionBetween(view, $anchor, $head, bias) {\n return view.someProp(\"createSelectionBetween\", f => f(view, $anchor, $head)) || TextSelection.between($anchor, $head, bias);\n}\nfunction hasFocusAndSelection(view) {\n if (view.editable && !view.hasFocus()) return false;\n return hasSelection(view);\n}\nfunction hasSelection(view) {\n let sel = view.domSelectionRange();\n if (!sel.anchorNode) return false;\n try {\n // Firefox will raise 'permission denied' errors when accessing\n // properties of `sel.anchorNode` when it's in a generated CSS\n // element.\n return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) && (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));\n } catch (_) {\n return false;\n }\n}\nfunction anchorInRightPlace(view) {\n let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);\n let domSel = view.domSelectionRange();\n return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset);\n}\nfunction moveSelectionBlock(state, dir) {\n let {\n $anchor,\n $head\n } = state.selection;\n let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);\n let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;\n return $start && Selection.findFrom($start, dir);\n}\nfunction apply(view, sel) {\n view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());\n return true;\n}\nfunction selectHorizontally(view, dir, mods) {\n let sel = view.state.selection;\n if (sel instanceof TextSelection) {\n if (mods.indexOf(\"s\") > -1) {\n let {\n $head\n } = sel,\n node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;\n if (!node || node.isText || !node.isLeaf) return false;\n let $newHead = view.state.doc.resolve($head.pos + node.nodeSize * (dir < 0 ? -1 : 1));\n return apply(view, new TextSelection(sel.$anchor, $newHead));\n } else if (!sel.empty) {\n return false;\n } else if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) {\n let next = moveSelectionBlock(view.state, dir);\n if (next && next instanceof NodeSelection) return apply(view, next);\n return false;\n } else if (!(mac && mods.indexOf(\"m\") > -1)) {\n let $head = sel.$head,\n node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter,\n desc;\n if (!node || node.isText) return false;\n let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;\n if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) return false;\n if (NodeSelection.isSelectable(node)) {\n return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));\n } else if (webkit) {\n // Chrome and Safari will introduce extra pointless cursor\n // positions around inline uneditable nodes, so we have to\n // take over and move the cursor past them (#937)\n return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));\n } else {\n return false;\n }\n }\n } else if (sel instanceof NodeSelection && sel.node.isInline) {\n return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));\n } else {\n let next = moveSelectionBlock(view.state, dir);\n if (next) return apply(view, next);\n return false;\n }\n}\nfunction nodeLen(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction isIgnorable(dom, dir) {\n let desc = dom.pmViewDesc;\n return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != \"BR\");\n}\nfunction skipIgnoredNodes(view, dir) {\n return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);\n}\n// Make sure the cursor isn't directly after one or more ignored\n// nodes, which will confuse the browser's cursor motion logic.\nfunction skipIgnoredNodesBefore(view) {\n let sel = view.domSelectionRange();\n let node = sel.focusNode,\n offset = sel.focusOffset;\n if (!node) return;\n let moveNode,\n moveOffset,\n force = false;\n // Gecko will do odd things when the selection is directly in front\n // of a non-editable node, so in that case, move it into the next\n // node if possible. Issue prosemirror/prosemirror#832.\n if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1)) force = true;\n for (;;) {\n if (offset > 0) {\n if (node.nodeType != 1) {\n break;\n } else {\n let before = node.childNodes[offset - 1];\n if (isIgnorable(before, -1)) {\n moveNode = node;\n moveOffset = --offset;\n } else if (before.nodeType == 3) {\n node = before;\n offset = node.nodeValue.length;\n } else break;\n }\n } else if (isBlockNode(node)) {\n break;\n } else {\n let prev = node.previousSibling;\n while (prev && isIgnorable(prev, -1)) {\n moveNode = node.parentNode;\n moveOffset = domIndex(prev);\n prev = prev.previousSibling;\n }\n if (!prev) {\n node = node.parentNode;\n if (node == view.dom) break;\n offset = 0;\n } else {\n node = prev;\n offset = nodeLen(node);\n }\n }\n }\n if (force) setSelFocus(view, node, offset);else if (moveNode) setSelFocus(view, moveNode, moveOffset);\n}\n// Make sure the cursor isn't directly before one or more ignored\n// nodes.\nfunction skipIgnoredNodesAfter(view) {\n let sel = view.domSelectionRange();\n let node = sel.focusNode,\n offset = sel.focusOffset;\n if (!node) return;\n let len = nodeLen(node);\n let moveNode, moveOffset;\n for (;;) {\n if (offset < len) {\n if (node.nodeType != 1) break;\n let after = node.childNodes[offset];\n if (isIgnorable(after, 1)) {\n moveNode = node;\n moveOffset = ++offset;\n } else break;\n } else if (isBlockNode(node)) {\n break;\n } else {\n let next = node.nextSibling;\n while (next && isIgnorable(next, 1)) {\n moveNode = next.parentNode;\n moveOffset = domIndex(next) + 1;\n next = next.nextSibling;\n }\n if (!next) {\n node = node.parentNode;\n if (node == view.dom) break;\n offset = len = 0;\n } else {\n node = next;\n offset = 0;\n len = nodeLen(node);\n }\n }\n }\n if (moveNode) setSelFocus(view, moveNode, moveOffset);\n}\nfunction isBlockNode(dom) {\n let desc = dom.pmViewDesc;\n return desc && desc.node && desc.node.isBlock;\n}\nfunction textNodeAfter(node, offset) {\n while (node && offset == node.childNodes.length && !hasBlockDesc(node)) {\n offset = domIndex(node) + 1;\n node = node.parentNode;\n }\n while (node && offset < node.childNodes.length) {\n let next = node.childNodes[offset];\n if (next.nodeType == 3) return next;\n if (next.nodeType == 1 && next.contentEditable == \"false\") break;\n node = next;\n offset = 0;\n }\n}\nfunction textNodeBefore(node, offset) {\n while (node && !offset && !hasBlockDesc(node)) {\n offset = domIndex(node);\n node = node.parentNode;\n }\n while (node && offset) {\n let next = node.childNodes[offset - 1];\n if (next.nodeType == 3) return next;\n if (next.nodeType == 1 && next.contentEditable == \"false\") break;\n node = next;\n offset = node.childNodes.length;\n }\n}\nfunction setSelFocus(view, node, offset) {\n if (node.nodeType != 3) {\n let before, after;\n if (after = textNodeAfter(node, offset)) {\n node = after;\n offset = 0;\n } else if (before = textNodeBefore(node, offset)) {\n node = before;\n offset = before.nodeValue.length;\n }\n }\n let sel = view.domSelection();\n if (!sel) return;\n if (selectionCollapsed(sel)) {\n let range = document.createRange();\n range.setEnd(node, offset);\n range.setStart(node, offset);\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (sel.extend) {\n sel.extend(node, offset);\n }\n view.domObserver.setCurSelection();\n let {\n state\n } = view;\n // If no state update ends up happening, reset the selection.\n setTimeout(() => {\n if (view.state == state) selectionToDOM(view);\n }, 50);\n}\nfunction findDirection(view, pos) {\n let $pos = view.state.doc.resolve(pos);\n if (!(chrome || windows) && $pos.parent.inlineContent) {\n let coords = view.coordsAtPos(pos);\n if (pos > $pos.start()) {\n let before = view.coordsAtPos(pos - 1);\n let mid = (before.top + before.bottom) / 2;\n if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1) return before.left < coords.left ? \"ltr\" : \"rtl\";\n }\n if (pos < $pos.end()) {\n let after = view.coordsAtPos(pos + 1);\n let mid = (after.top + after.bottom) / 2;\n if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1) return after.left > coords.left ? \"ltr\" : \"rtl\";\n }\n }\n let computed = getComputedStyle(view.dom).direction;\n return computed == \"rtl\" ? \"rtl\" : \"ltr\";\n}\n// Check whether vertical selection motion would involve node\n// selections. If so, apply it (if not, the result is left to the\n// browser)\nfunction selectVertically(view, dir, mods) {\n let sel = view.state.selection;\n if (sel instanceof TextSelection && !sel.empty || mods.indexOf(\"s\") > -1) return false;\n if (mac && mods.indexOf(\"m\") > -1) return false;\n let {\n $from,\n $to\n } = sel;\n if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? \"up\" : \"down\")) {\n let next = moveSelectionBlock(view.state, dir);\n if (next && next instanceof NodeSelection) return apply(view, next);\n }\n if (!$from.parent.inlineContent) {\n let side = dir < 0 ? $from : $to;\n let beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir);\n return beyond ? apply(view, beyond) : false;\n }\n return false;\n}\nfunction stopNativeHorizontalDelete(view, dir) {\n if (!(view.state.selection instanceof TextSelection)) return true;\n let {\n $head,\n $anchor,\n empty\n } = view.state.selection;\n if (!$head.sameParent($anchor)) return true;\n if (!empty) return false;\n if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) return true;\n let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);\n if (nextNode && !nextNode.isText) {\n let tr = view.state.tr;\n if (dir < 0) tr.delete($head.pos - nextNode.nodeSize, $head.pos);else tr.delete($head.pos, $head.pos + nextNode.nodeSize);\n view.dispatch(tr);\n return true;\n }\n return false;\n}\nfunction switchEditable(view, node, state) {\n view.domObserver.stop();\n node.contentEditable = state;\n view.domObserver.start();\n}\n// Issue #867 / #1090 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821\n// In which Safari (and at some point in the past, Chrome) does really\n// wrong things when the down arrow is pressed when the cursor is\n// directly at the start of a textblock and has an uneditable node\n// after it\nfunction safariDownArrowBug(view) {\n if (!safari || view.state.selection.$head.parentOffset > 0) return false;\n let {\n focusNode,\n focusOffset\n } = view.domSelectionRange();\n if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == \"false\") {\n let child = focusNode.firstChild;\n switchEditable(view, child, \"true\");\n setTimeout(() => switchEditable(view, child, \"false\"), 20);\n }\n return false;\n}\n// A backdrop key mapping used to make sure we always suppress keys\n// that have a dangerous default effect, even if the commands they are\n// bound to return false, and to make sure that cursor-motion keys\n// find a cursor (as opposed to a node selection) when pressed. For\n// cursor-motion keys, the code in the handlers also takes care of\n// block selections.\nfunction getMods(event) {\n let result = \"\";\n if (event.ctrlKey) result += \"c\";\n if (event.metaKey) result += \"m\";\n if (event.altKey) result += \"a\";\n if (event.shiftKey) result += \"s\";\n return result;\n}\nfunction captureKeyDown(view, event) {\n let code = event.keyCode,\n mods = getMods(event);\n if (code == 8 || mac && code == 72 && mods == \"c\") {\n // Backspace, Ctrl-h on Mac\n return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1);\n } else if (code == 46 && !event.shiftKey || mac && code == 68 && mods == \"c\") {\n // Delete, Ctrl-d on Mac\n return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1);\n } else if (code == 13 || code == 27) {\n // Enter, Esc\n return true;\n } else if (code == 37 || mac && code == 66 && mods == \"c\") {\n // Left arrow, Ctrl-b on Mac\n let dir = code == 37 ? findDirection(view, view.state.selection.from) == \"ltr\" ? -1 : 1 : -1;\n return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n } else if (code == 39 || mac && code == 70 && mods == \"c\") {\n // Right arrow, Ctrl-f on Mac\n let dir = code == 39 ? findDirection(view, view.state.selection.from) == \"ltr\" ? 1 : -1 : 1;\n return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n } else if (code == 38 || mac && code == 80 && mods == \"c\") {\n // Up arrow, Ctrl-p on Mac\n return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1);\n } else if (code == 40 || mac && code == 78 && mods == \"c\") {\n // Down arrow, Ctrl-n on Mac\n return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1);\n } else if (mods == (mac ? \"m\" : \"c\") && (code == 66 || code == 73 || code == 89 || code == 90)) {\n // Mod-[biyz]\n return true;\n }\n return false;\n}\nfunction serializeForClipboard(view, slice) {\n view.someProp(\"transformCopied\", f => {\n slice = f(slice, view);\n });\n let context = [],\n {\n content,\n openStart,\n openEnd\n } = slice;\n while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {\n openStart--;\n openEnd--;\n let node = content.firstChild;\n context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);\n content = node.content;\n }\n let serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema);\n let doc = detachedDoc(),\n wrap = doc.createElement(\"div\");\n wrap.appendChild(serializer.serializeFragment(content, {\n document: doc\n }));\n let firstChild = wrap.firstChild,\n needsWrap,\n wrappers = 0;\n while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n for (let i = needsWrap.length - 1; i >= 0; i--) {\n let wrapper = doc.createElement(needsWrap[i]);\n while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);\n wrap.appendChild(wrapper);\n wrappers++;\n }\n firstChild = wrap.firstChild;\n }\n if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute(\"data-pm-slice\", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : \"\"} ${JSON.stringify(context)}`);\n let text = view.someProp(\"clipboardTextSerializer\", f => f(slice, view)) || slice.content.textBetween(0, slice.content.size, \"\\n\\n\");\n return {\n dom: wrap,\n text,\n slice\n };\n}\n// Read a slice of content from the clipboard (or drop data).\nfunction parseFromClipboard(view, text, html, plainText, $context) {\n let inCode = $context.parent.type.spec.code;\n let dom, slice;\n if (!html && !text) return null;\n let asText = text && (plainText || inCode || !html);\n if (asText) {\n view.someProp(\"transformPastedText\", f => {\n text = f(text, inCode || plainText, view);\n });\n if (inCode) return text ? new Slice(Fragment.from(view.state.schema.text(text.replace(/\\r\\n?/g, \"\\n\"))), 0, 0) : Slice.empty;\n let parsed = view.someProp(\"clipboardTextParser\", f => f(text, $context, plainText, view));\n if (parsed) {\n slice = parsed;\n } else {\n let marks = $context.marks();\n let {\n schema\n } = view.state,\n serializer = DOMSerializer.fromSchema(schema);\n dom = document.createElement(\"div\");\n text.split(/(?:\\r\\n?|\\n)+/).forEach(block => {\n let p = dom.appendChild(document.createElement(\"p\"));\n if (block) p.appendChild(serializer.serializeNode(schema.text(block, marks)));\n });\n }\n } else {\n view.someProp(\"transformPastedHTML\", f => {\n html = f(html, view);\n });\n dom = readHTML(html);\n if (webkit) restoreReplacedSpaces(dom);\n }\n let contextNode = dom && dom.querySelector(\"[data-pm-slice]\");\n let sliceData = contextNode && /^(\\d+) (\\d+)(?: -(\\d+))? (.*)/.exec(contextNode.getAttribute(\"data-pm-slice\") || \"\");\n if (sliceData && sliceData[3]) for (let i = +sliceData[3]; i > 0; i--) {\n let child = dom.firstChild;\n while (child && child.nodeType != 1) child = child.nextSibling;\n if (!child) break;\n dom = child;\n }\n if (!slice) {\n let parser = view.someProp(\"clipboardParser\") || view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n slice = parser.parseSlice(dom, {\n preserveWhitespace: !!(asText || sliceData),\n context: $context,\n ruleFromNode(dom) {\n if (dom.nodeName == \"BR\" && !dom.nextSibling && dom.parentNode && !inlineParents.test(dom.parentNode.nodeName)) return {\n ignore: true\n };\n return null;\n }\n });\n }\n if (sliceData) {\n slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);\n } else {\n // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent\n slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), true);\n if (slice.openStart || slice.openEnd) {\n let openStart = 0,\n openEnd = 0;\n for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) {}\n for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) {}\n slice = closeSlice(slice, openStart, openEnd);\n }\n }\n view.someProp(\"transformPasted\", f => {\n slice = f(slice, view);\n });\n return slice;\n}\nconst inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;\n// Takes a slice parsed with parseSlice, which means there hasn't been\n// any content-expression checking done on the top nodes, tries to\n// find a parent node in the current context that might fit the nodes,\n// and if successful, rebuilds the slice so that it fits into that parent.\n//\n// This addresses the problem that Transform.replace expects a\n// coherent slice, and will fail to place a set of siblings that don't\n// fit anywhere in the schema.\nfunction normalizeSiblings(fragment, $context) {\n if (fragment.childCount < 2) return fragment;\n for (let d = $context.depth; d >= 0; d--) {\n let parent = $context.node(d);\n let match = parent.contentMatchAt($context.index(d));\n let lastWrap,\n result = [];\n fragment.forEach(node => {\n if (!result) return;\n let wrap = match.findWrapping(node.type),\n inLast;\n if (!wrap) return result = null;\n if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) {\n result[result.length - 1] = inLast;\n } else {\n if (result.length) result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);\n let wrapped = withWrappers(node, wrap);\n result.push(wrapped);\n match = match.matchType(wrapped.type);\n lastWrap = wrap;\n }\n });\n if (result) return Fragment.from(result);\n }\n return fragment;\n}\nfunction withWrappers(node, wrap, from = 0) {\n for (let i = wrap.length - 1; i >= from; i--) node = wrap[i].create(null, Fragment.from(node));\n return node;\n}\n// Used to group adjacent nodes wrapped in similar parents by\n// normalizeSiblings into the same parent node\nfunction addToSibling(wrap, lastWrap, node, sibling, depth) {\n if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {\n let inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);\n if (inner) return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));\n let match = sibling.contentMatchAt(sibling.childCount);\n if (match.matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1])) return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node, wrap, depth + 1))));\n }\n}\nfunction closeRight(node, depth) {\n if (depth == 0) return node;\n let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));\n let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n return node.copy(fragment.append(fill));\n}\nfunction closeRange(fragment, side, from, to, depth, openEnd) {\n let node = side < 0 ? fragment.firstChild : fragment.lastChild,\n inner = node.content;\n if (fragment.childCount > 1) openEnd = 0;\n if (depth < to - 1) inner = closeRange(inner, side, from, to, depth + 1, openEnd);\n if (depth >= from) inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true));\n return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));\n}\nfunction closeSlice(slice, openStart, openEnd) {\n if (openStart < slice.openStart) slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);\n if (openEnd < slice.openEnd) slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);\n return slice;\n}\n// Trick from jQuery -- some elements must be wrapped in other\n// elements for innerHTML to work. I.e. if you do `div.innerHTML =\n// \"..\"` the table cells are ignored.\nconst wrapMap = {\n thead: [\"table\"],\n tbody: [\"table\"],\n tfoot: [\"table\"],\n caption: [\"table\"],\n colgroup: [\"table\"],\n col: [\"table\", \"colgroup\"],\n tr: [\"table\", \"tbody\"],\n td: [\"table\", \"tbody\", \"tr\"],\n th: [\"table\", \"tbody\", \"tr\"]\n};\nlet _detachedDoc = null;\nfunction detachedDoc() {\n return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument(\"title\"));\n}\nlet _policy = null;\nfunction maybeWrapTrusted(html) {\n let trustedTypes = window.trustedTypes;\n if (!trustedTypes) return html;\n // With the require-trusted-types-for CSP, Chrome will block\n // innerHTML, even on a detached document. This wraps the string in\n // a way that makes the browser allow us to use its parser again.\n if (!_policy) _policy = trustedTypes.createPolicy(\"ProseMirrorClipboard\", {\n createHTML: s => s\n });\n return _policy.createHTML(html);\n}\nfunction readHTML(html) {\n let metas = /^(\\s*]*>)*/.exec(html);\n if (metas) html = html.slice(metas[0].length);\n let elt = detachedDoc().createElement(\"div\");\n let firstTag = /<([a-z][^>\\s]+)/i.exec(html),\n wrap;\n if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()]) html = wrap.map(n => \"<\" + n + \">\").join(\"\") + html + wrap.map(n => \"\").reverse().join(\"\");\n elt.innerHTML = maybeWrapTrusted(html);\n if (wrap) for (let i = 0; i < wrap.length; i++) elt = elt.querySelector(wrap[i]) || elt;\n return elt;\n}\n// Webkit browsers do some hard-to-predict replacement of regular\n// spaces with non-breaking spaces when putting content on the\n// clipboard. This tries to convert such non-breaking spaces (which\n// will be wrapped in a plain span on Chrome, a span with class\n// Apple-converted-space on Safari) back to regular spaces.\nfunction restoreReplacedSpaces(dom) {\n let nodes = dom.querySelectorAll(chrome ? \"span:not([class]):not([style])\" : \"span.Apple-converted-space\");\n for (let i = 0; i < nodes.length; i++) {\n let node = nodes[i];\n if (node.childNodes.length == 1 && node.textContent == \"\\u00a0\" && node.parentNode) node.parentNode.replaceChild(dom.ownerDocument.createTextNode(\" \"), node);\n }\n}\nfunction addContext(slice, context) {\n if (!slice.size) return slice;\n let schema = slice.content.firstChild.type.schema,\n array;\n try {\n array = JSON.parse(context);\n } catch (e) {\n return slice;\n }\n let {\n content,\n openStart,\n openEnd\n } = slice;\n for (let i = array.length - 2; i >= 0; i -= 2) {\n let type = schema.nodes[array[i]];\n if (!type || type.hasRequiredAttrs()) break;\n content = Fragment.from(type.create(array[i + 1], content));\n openStart++;\n openEnd++;\n }\n return new Slice(content, openStart, openEnd);\n}\n\n// A collection of DOM events that occur within the editor, and callback functions\n// to invoke when the event fires.\nconst handlers = {};\nconst editHandlers = {};\nconst passiveHandlers = {\n touchstart: true,\n touchmove: true\n};\nclass InputState {\n constructor() {\n this.shiftKey = false;\n this.mouseDown = null;\n this.lastKeyCode = null;\n this.lastKeyCodeTime = 0;\n this.lastClick = {\n time: 0,\n x: 0,\n y: 0,\n type: \"\"\n };\n this.lastSelectionOrigin = null;\n this.lastSelectionTime = 0;\n this.lastIOSEnter = 0;\n this.lastIOSEnterFallbackTimeout = -1;\n this.lastFocus = 0;\n this.lastTouch = 0;\n this.lastAndroidDelete = 0;\n this.composing = false;\n this.compositionNode = null;\n this.composingTimeout = -1;\n this.compositionNodes = [];\n this.compositionEndedAt = -2e8;\n this.compositionID = 1;\n // Set to a composition ID when there are pending changes at compositionend\n this.compositionPendingChanges = 0;\n this.domChangeCount = 0;\n this.eventHandlers = Object.create(null);\n this.hideSelectionGuard = null;\n }\n}\nfunction initInput(view) {\n for (let event in handlers) {\n let handler = handlers[event];\n view.dom.addEventListener(event, view.input.eventHandlers[event] = event => {\n if (eventBelongsToView(view, event) && !runCustomHandler(view, event) && (view.editable || !(event.type in editHandlers))) handler(view, event);\n }, passiveHandlers[event] ? {\n passive: true\n } : undefined);\n }\n // On Safari, for reasons beyond my understanding, adding an input\n // event handler makes an issue where the composition vanishes when\n // you press enter go away.\n if (safari) view.dom.addEventListener(\"input\", () => null);\n ensureListeners(view);\n}\nfunction setSelectionOrigin(view, origin) {\n view.input.lastSelectionOrigin = origin;\n view.input.lastSelectionTime = Date.now();\n}\nfunction destroyInput(view) {\n view.domObserver.stop();\n for (let type in view.input.eventHandlers) view.dom.removeEventListener(type, view.input.eventHandlers[type]);\n clearTimeout(view.input.composingTimeout);\n clearTimeout(view.input.lastIOSEnterFallbackTimeout);\n}\nfunction ensureListeners(view) {\n view.someProp(\"handleDOMEvents\", currentHandlers => {\n for (let type in currentHandlers) if (!view.input.eventHandlers[type]) view.dom.addEventListener(type, view.input.eventHandlers[type] = event => runCustomHandler(view, event));\n });\n}\nfunction runCustomHandler(view, event) {\n return view.someProp(\"handleDOMEvents\", handlers => {\n let handler = handlers[event.type];\n return handler ? handler(view, event) || event.defaultPrevented : false;\n });\n}\nfunction eventBelongsToView(view, event) {\n if (!event.bubbles) return true;\n if (event.defaultPrevented) return false;\n for (let node = event.target; node != view.dom; node = node.parentNode) if (!node || node.nodeType == 11 || node.pmViewDesc && node.pmViewDesc.stopEvent(event)) return false;\n return true;\n}\nfunction dispatchEvent(view, event) {\n if (!runCustomHandler(view, event) && handlers[event.type] && (view.editable || !(event.type in editHandlers))) handlers[event.type](view, event);\n}\neditHandlers.keydown = (view, _event) => {\n let event = _event;\n view.input.shiftKey = event.keyCode == 16 || event.shiftKey;\n if (inOrNearComposition(view, event)) return;\n view.input.lastKeyCode = event.keyCode;\n view.input.lastKeyCodeTime = Date.now();\n // Suppress enter key events on Chrome Android, because those tend\n // to be part of a confused sequence of composition events fired,\n // and handling them eagerly tends to corrupt the input.\n if (android && chrome && event.keyCode == 13) return;\n if (event.keyCode != 229) view.domObserver.forceFlush();\n // On iOS, if we preventDefault enter key presses, the virtual\n // keyboard gets confused. So the hack here is to set a flag that\n // makes the DOM change code recognize that what just happens should\n // be replaced by whatever the Enter key handlers do.\n if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {\n let now = Date.now();\n view.input.lastIOSEnter = now;\n view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {\n if (view.input.lastIOSEnter == now) {\n view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")));\n view.input.lastIOSEnter = 0;\n }\n }, 200);\n } else if (view.someProp(\"handleKeyDown\", f => f(view, event)) || captureKeyDown(view, event)) {\n event.preventDefault();\n } else {\n setSelectionOrigin(view, \"key\");\n }\n};\neditHandlers.keyup = (view, event) => {\n if (event.keyCode == 16) view.input.shiftKey = false;\n};\neditHandlers.keypress = (view, _event) => {\n let event = _event;\n if (inOrNearComposition(view, event) || !event.charCode || event.ctrlKey && !event.altKey || mac && event.metaKey) return;\n if (view.someProp(\"handleKeyPress\", f => f(view, event))) {\n event.preventDefault();\n return;\n }\n let sel = view.state.selection;\n if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {\n let text = String.fromCharCode(event.charCode);\n if (!/[\\r\\n]/.test(text) && !view.someProp(\"handleTextInput\", f => f(view, sel.$from.pos, sel.$to.pos, text))) view.dispatch(view.state.tr.insertText(text).scrollIntoView());\n event.preventDefault();\n }\n};\nfunction eventCoords(event) {\n return {\n left: event.clientX,\n top: event.clientY\n };\n}\nfunction isNear(event, click) {\n let dx = click.x - event.clientX,\n dy = click.y - event.clientY;\n return dx * dx + dy * dy < 100;\n}\nfunction runHandlerOnContext(view, propName, pos, inside, event) {\n if (inside == -1) return false;\n let $pos = view.state.doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n if (view.someProp(propName, f => i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true) : f(view, pos, $pos.node(i), $pos.before(i), event, false))) return true;\n }\n return false;\n}\nfunction updateSelection(view, selection, origin) {\n if (!view.focused) view.focus();\n if (view.state.selection.eq(selection)) return;\n let tr = view.state.tr.setSelection(selection);\n if (origin == \"pointer\") tr.setMeta(\"pointer\", true);\n view.dispatch(tr);\n}\nfunction selectClickedLeaf(view, inside) {\n if (inside == -1) return false;\n let $pos = view.state.doc.resolve(inside),\n node = $pos.nodeAfter;\n if (node && node.isAtom && NodeSelection.isSelectable(node)) {\n updateSelection(view, new NodeSelection($pos), \"pointer\");\n return true;\n }\n return false;\n}\nfunction selectClickedNode(view, inside) {\n if (inside == -1) return false;\n let sel = view.state.selection,\n selectedNode,\n selectAt;\n if (sel instanceof NodeSelection) selectedNode = sel.node;\n let $pos = view.state.doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n if (NodeSelection.isSelectable(node)) {\n if (selectedNode && sel.$from.depth > 0 && i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos) selectAt = $pos.before(sel.$from.depth);else selectAt = $pos.before(i);\n break;\n }\n }\n if (selectAt != null) {\n updateSelection(view, NodeSelection.create(view.state.doc, selectAt), \"pointer\");\n return true;\n } else {\n return false;\n }\n}\nfunction handleSingleClick(view, pos, inside, event, selectNode) {\n return runHandlerOnContext(view, \"handleClickOn\", pos, inside, event) || view.someProp(\"handleClick\", f => f(view, pos, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside));\n}\nfunction handleDoubleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleDoubleClickOn\", pos, inside, event) || view.someProp(\"handleDoubleClick\", f => f(view, pos, event));\n}\nfunction handleTripleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleTripleClickOn\", pos, inside, event) || view.someProp(\"handleTripleClick\", f => f(view, pos, event)) || defaultTripleClick(view, inside, event);\n}\nfunction defaultTripleClick(view, inside, event) {\n if (event.button != 0) return false;\n let doc = view.state.doc;\n if (inside == -1) {\n if (doc.inlineContent) {\n updateSelection(view, TextSelection.create(doc, 0, doc.content.size), \"pointer\");\n return true;\n }\n return false;\n }\n let $pos = doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n let nodePos = $pos.before(i);\n if (node.inlineContent) updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), \"pointer\");else if (NodeSelection.isSelectable(node)) updateSelection(view, NodeSelection.create(doc, nodePos), \"pointer\");else continue;\n return true;\n }\n}\nfunction forceDOMFlush(view) {\n return endComposition(view);\n}\nconst selectNodeModifier = mac ? \"metaKey\" : \"ctrlKey\";\nhandlers.mousedown = (view, _event) => {\n let event = _event;\n view.input.shiftKey = event.shiftKey;\n let flushed = forceDOMFlush(view);\n let now = Date.now(),\n type = \"singleClick\";\n if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier]) {\n if (view.input.lastClick.type == \"singleClick\") type = \"doubleClick\";else if (view.input.lastClick.type == \"doubleClick\") type = \"tripleClick\";\n }\n view.input.lastClick = {\n time: now,\n x: event.clientX,\n y: event.clientY,\n type\n };\n let pos = view.posAtCoords(eventCoords(event));\n if (!pos) return;\n if (type == \"singleClick\") {\n if (view.input.mouseDown) view.input.mouseDown.done();\n view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);\n } else if ((type == \"doubleClick\" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {\n event.preventDefault();\n } else {\n setSelectionOrigin(view, \"pointer\");\n }\n};\nclass MouseDown {\n constructor(view, pos, event, flushed) {\n this.view = view;\n this.pos = pos;\n this.event = event;\n this.flushed = flushed;\n this.delayedSelectionSync = false;\n this.mightDrag = null;\n this.startDoc = view.state.doc;\n this.selectNode = !!event[selectNodeModifier];\n this.allowDefault = event.shiftKey;\n let targetNode, targetPos;\n if (pos.inside > -1) {\n targetNode = view.state.doc.nodeAt(pos.inside);\n targetPos = pos.inside;\n } else {\n let $pos = view.state.doc.resolve(pos.pos);\n targetNode = $pos.parent;\n targetPos = $pos.depth ? $pos.before() : 0;\n }\n const target = flushed ? null : event.target;\n const targetDesc = target ? view.docView.nearestDesc(target, true) : null;\n this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;\n let {\n selection\n } = view.state;\n if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos) this.mightDrag = {\n node: targetNode,\n pos: targetPos,\n addAttr: !!(this.target && !this.target.draggable),\n setUneditable: !!(this.target && gecko && !this.target.hasAttribute(\"contentEditable\"))\n };\n if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) this.target.draggable = true;\n if (this.mightDrag.setUneditable) setTimeout(() => {\n if (this.view.input.mouseDown == this) this.target.setAttribute(\"contentEditable\", \"false\");\n }, 20);\n this.view.domObserver.start();\n }\n view.root.addEventListener(\"mouseup\", this.up = this.up.bind(this));\n view.root.addEventListener(\"mousemove\", this.move = this.move.bind(this));\n setSelectionOrigin(view, \"pointer\");\n }\n done() {\n this.view.root.removeEventListener(\"mouseup\", this.up);\n this.view.root.removeEventListener(\"mousemove\", this.move);\n if (this.mightDrag && this.target) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) this.target.removeAttribute(\"draggable\");\n if (this.mightDrag.setUneditable) this.target.removeAttribute(\"contentEditable\");\n this.view.domObserver.start();\n }\n if (this.delayedSelectionSync) setTimeout(() => selectionToDOM(this.view));\n this.view.input.mouseDown = null;\n }\n up(event) {\n this.done();\n if (!this.view.dom.contains(event.target)) return;\n let pos = this.pos;\n if (this.view.state.doc != this.startDoc) pos = this.view.posAtCoords(eventCoords(event));\n this.updateAllowDefault(event);\n if (this.allowDefault || !pos) {\n setSelectionOrigin(this.view, \"pointer\");\n } else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {\n event.preventDefault();\n } else if (event.button == 0 && (this.flushed ||\n // Safari ignores clicks on draggable elements\n safari && this.mightDrag && !this.mightDrag.node.isAtom ||\n // Chrome will sometimes treat a node selection as a\n // cursor, but still report that the node is selected\n // when asked through getSelection. You'll then get a\n // situation where clicking at the point where that\n // (hidden) cursor is doesn't change the selection, and\n // thus doesn't get a reaction from ProseMirror. This\n // works around that.\n chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {\n updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), \"pointer\");\n event.preventDefault();\n } else {\n setSelectionOrigin(this.view, \"pointer\");\n }\n }\n move(event) {\n this.updateAllowDefault(event);\n setSelectionOrigin(this.view, \"pointer\");\n if (event.buttons == 0) this.done();\n }\n updateAllowDefault(event) {\n if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 || Math.abs(this.event.y - event.clientY) > 4)) this.allowDefault = true;\n }\n}\nhandlers.touchstart = view => {\n view.input.lastTouch = Date.now();\n forceDOMFlush(view);\n setSelectionOrigin(view, \"pointer\");\n};\nhandlers.touchmove = view => {\n view.input.lastTouch = Date.now();\n setSelectionOrigin(view, \"pointer\");\n};\nhandlers.contextmenu = view => forceDOMFlush(view);\nfunction inOrNearComposition(view, event) {\n if (view.composing) return true;\n // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.\n // On Japanese input method editors (IMEs), the Enter key is used to confirm character\n // selection. On Safari, when Enter is pressed, compositionend and keydown events are\n // emitted. The keydown event triggers newline insertion, which we don't want.\n // This method returns true if the keydown event should be ignored.\n // We only ignore it once, as pressing Enter a second time *should* insert a newline.\n // Furthermore, the keydown event timestamp must be close to the compositionEndedAt timestamp.\n // This guards against the case where compositionend is triggered without the keyboard\n // (e.g. character confirmation may be done with the mouse), and keydown is triggered\n // afterwards- we wouldn't want to ignore the keydown event in this case.\n if (safari && Math.abs(event.timeStamp - view.input.compositionEndedAt) < 500) {\n view.input.compositionEndedAt = -2e8;\n return true;\n }\n return false;\n}\n// Drop active composition after 5 seconds of inactivity on Android\nconst timeoutComposition = android ? 5000 : -1;\neditHandlers.compositionstart = editHandlers.compositionupdate = view => {\n if (!view.composing) {\n view.domObserver.flush();\n let {\n state\n } = view,\n $pos = state.selection.$to;\n if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false))) {\n // Need to wrap the cursor in mark nodes different from the ones in the DOM context\n view.markCursor = view.state.storedMarks || $pos.marks();\n endComposition(view, true);\n view.markCursor = null;\n } else {\n endComposition(view, !state.selection.empty);\n // In firefox, if the cursor is after but outside a marked node,\n // the inserted text won't inherit the marks. So this moves it\n // inside if necessary.\n if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {\n let sel = view.domSelectionRange();\n for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {\n let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];\n if (!before) break;\n if (before.nodeType == 3) {\n let sel = view.domSelection();\n if (sel) sel.collapse(before, before.nodeValue.length);\n break;\n } else {\n node = before;\n offset = -1;\n }\n }\n }\n }\n view.input.composing = true;\n }\n scheduleComposeEnd(view, timeoutComposition);\n};\neditHandlers.compositionend = (view, event) => {\n if (view.composing) {\n view.input.composing = false;\n view.input.compositionEndedAt = event.timeStamp;\n view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;\n view.input.compositionNode = null;\n if (view.input.compositionPendingChanges) Promise.resolve().then(() => view.domObserver.flush());\n view.input.compositionID++;\n scheduleComposeEnd(view, 20);\n }\n};\nfunction scheduleComposeEnd(view, delay) {\n clearTimeout(view.input.composingTimeout);\n if (delay > -1) view.input.composingTimeout = setTimeout(() => endComposition(view), delay);\n}\nfunction clearComposition(view) {\n if (view.composing) {\n view.input.composing = false;\n view.input.compositionEndedAt = timestampFromCustomEvent();\n }\n while (view.input.compositionNodes.length > 0) view.input.compositionNodes.pop().markParentsDirty();\n}\nfunction findCompositionNode(view) {\n let sel = view.domSelectionRange();\n if (!sel.focusNode) return null;\n let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);\n let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);\n if (textBefore && textAfter && textBefore != textAfter) {\n let descAfter = textAfter.pmViewDesc,\n lastChanged = view.domObserver.lastChangedTextNode;\n if (textBefore == lastChanged || textAfter == lastChanged) return lastChanged;\n if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {\n return textAfter;\n } else if (view.input.compositionNode == textAfter) {\n let descBefore = textBefore.pmViewDesc;\n if (!(!descBefore || !descBefore.isText(textBefore.nodeValue))) return textAfter;\n }\n }\n return textBefore || textAfter;\n}\nfunction timestampFromCustomEvent() {\n let event = document.createEvent(\"Event\");\n event.initEvent(\"event\", true, true);\n return event.timeStamp;\n}\n/**\n@internal\n*/\nfunction endComposition(view, restarting = false) {\n if (android && view.domObserver.flushingSoon >= 0) return;\n view.domObserver.forceFlush();\n clearComposition(view);\n if (restarting || view.docView && view.docView.dirty) {\n let sel = selectionFromDOM(view);\n if (sel && !sel.eq(view.state.selection)) view.dispatch(view.state.tr.setSelection(sel));else if ((view.markCursor || restarting) && !view.state.selection.empty) view.dispatch(view.state.tr.deleteSelection());else view.updateState(view.state);\n return true;\n }\n return false;\n}\nfunction captureCopy(view, dom) {\n // The extra wrapper is somehow necessary on IE/Edge to prevent the\n // content from being mangled when it is put onto the clipboard\n if (!view.dom.parentNode) return;\n let wrap = view.dom.parentNode.appendChild(document.createElement(\"div\"));\n wrap.appendChild(dom);\n wrap.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n let sel = getSelection(),\n range = document.createRange();\n range.selectNodeContents(dom);\n // Done because IE will fire a selectionchange moving the selection\n // to its start when removeAllRanges is called and the editor still\n // has focus (which will mess up the editor's selection state).\n view.dom.blur();\n sel.removeAllRanges();\n sel.addRange(range);\n setTimeout(() => {\n if (wrap.parentNode) wrap.parentNode.removeChild(wrap);\n view.focus();\n }, 50);\n}\n// This is very crude, but unfortunately both these browsers _pretend_\n// that they have a clipboard API—all the objects and methods are\n// there, they just don't work, and they are hard to test.\nconst brokenClipboardAPI = ie && ie_version < 15 || ios && webkit_version < 604;\nhandlers.copy = editHandlers.cut = (view, _event) => {\n let event = _event;\n let sel = view.state.selection,\n cut = event.type == \"cut\";\n if (sel.empty) return;\n // IE and Edge's clipboard interface is completely broken\n let data = brokenClipboardAPI ? null : event.clipboardData;\n let slice = sel.content(),\n {\n dom,\n text\n } = serializeForClipboard(view, slice);\n if (data) {\n event.preventDefault();\n data.clearData();\n data.setData(\"text/html\", dom.innerHTML);\n data.setData(\"text/plain\", text);\n } else {\n captureCopy(view, dom);\n }\n if (cut) view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta(\"uiEvent\", \"cut\"));\n};\nfunction sliceSingleNode(slice) {\n return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;\n}\nfunction capturePaste(view, event) {\n if (!view.dom.parentNode) return;\n let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code;\n let target = view.dom.parentNode.appendChild(document.createElement(plainText ? \"textarea\" : \"div\"));\n if (!plainText) target.contentEditable = \"true\";\n target.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n target.focus();\n let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n setTimeout(() => {\n view.focus();\n if (target.parentNode) target.parentNode.removeChild(target);\n if (plainText) doPaste(view, target.value, null, plain, event);else doPaste(view, target.textContent, target.innerHTML, plain, event);\n }, 50);\n}\nfunction doPaste(view, text, html, preferPlain, event) {\n let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);\n if (view.someProp(\"handlePaste\", f => f(view, event, slice || Slice.empty))) return true;\n if (!slice) return false;\n let singleNode = sliceSingleNode(slice);\n let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice);\n view.dispatch(tr.scrollIntoView().setMeta(\"paste\", true).setMeta(\"uiEvent\", \"paste\"));\n return true;\n}\nfunction getText(clipboardData) {\n let text = clipboardData.getData(\"text/plain\") || clipboardData.getData(\"Text\");\n if (text) return text;\n let uris = clipboardData.getData(\"text/uri-list\");\n return uris ? uris.replace(/\\r?\\n/g, \" \") : \"\";\n}\neditHandlers.paste = (view, _event) => {\n let event = _event;\n // Handling paste from JavaScript during composition is very poorly\n // handled by browsers, so as a dodgy but preferable kludge, we just\n // let the browser do its native thing there, except on Android,\n // where the editor is almost always composing.\n if (view.composing && !android) return;\n let data = brokenClipboardAPI ? null : event.clipboardData;\n let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n if (data && doPaste(view, getText(data), data.getData(\"text/html\"), plain, event)) event.preventDefault();else capturePaste(view, event);\n};\nclass Dragging {\n constructor(slice, move, node) {\n this.slice = slice;\n this.move = move;\n this.node = node;\n }\n}\nconst dragCopyModifier = mac ? \"altKey\" : \"ctrlKey\";\nhandlers.dragstart = (view, _event) => {\n let event = _event;\n let mouseDown = view.input.mouseDown;\n if (mouseDown) mouseDown.done();\n if (!event.dataTransfer) return;\n let sel = view.state.selection;\n let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));\n let node;\n if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ;else if (mouseDown && mouseDown.mightDrag) {\n node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);\n } else if (event.target && event.target.nodeType == 1) {\n let desc = view.docView.nearestDesc(event.target, true);\n if (desc && desc.node.type.spec.draggable && desc != view.docView) node = NodeSelection.create(view.state.doc, desc.posBefore);\n }\n let draggedSlice = (node || view.state.selection).content();\n let {\n dom,\n text,\n slice\n } = serializeForClipboard(view, draggedSlice);\n // Pre-120 Chrome versions clear files when calling `clearData` (#1472)\n if (!event.dataTransfer.files.length || !chrome || chrome_version > 120) event.dataTransfer.clearData();\n event.dataTransfer.setData(brokenClipboardAPI ? \"Text\" : \"text/html\", dom.innerHTML);\n // See https://github.com/ProseMirror/prosemirror/issues/1156\n event.dataTransfer.effectAllowed = \"copyMove\";\n if (!brokenClipboardAPI) event.dataTransfer.setData(\"text/plain\", text);\n view.dragging = new Dragging(slice, !event[dragCopyModifier], node);\n};\nhandlers.dragend = view => {\n let dragging = view.dragging;\n window.setTimeout(() => {\n if (view.dragging == dragging) view.dragging = null;\n }, 50);\n};\neditHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();\neditHandlers.drop = (view, _event) => {\n let event = _event;\n let dragging = view.dragging;\n view.dragging = null;\n if (!event.dataTransfer) return;\n let eventPos = view.posAtCoords(eventCoords(event));\n if (!eventPos) return;\n let $mouse = view.state.doc.resolve(eventPos.pos);\n let slice = dragging && dragging.slice;\n if (slice) {\n view.someProp(\"transformPasted\", f => {\n slice = f(slice, view);\n });\n } else {\n slice = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData(\"text/html\"), false, $mouse);\n }\n let move = !!(dragging && !event[dragCopyModifier]);\n if (view.someProp(\"handleDrop\", f => f(view, event, slice || Slice.empty, move))) {\n event.preventDefault();\n return;\n }\n if (!slice) return;\n event.preventDefault();\n let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;\n if (insertPos == null) insertPos = $mouse.pos;\n let tr = view.state.tr;\n if (move) {\n let {\n node\n } = dragging;\n if (node) node.replace(tr);else tr.deleteSelection();\n }\n let pos = tr.mapping.map(insertPos);\n let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;\n let beforeInsert = tr.doc;\n if (isNode) tr.replaceRangeWith(pos, pos, slice.content.firstChild);else tr.replaceRange(pos, pos, slice);\n if (tr.doc.eq(beforeInsert)) return;\n let $pos = tr.doc.resolve(pos);\n if (isNode && NodeSelection.isSelectable(slice.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) {\n tr.setSelection(new NodeSelection($pos));\n } else {\n let end = tr.mapping.map(insertPos);\n tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);\n tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));\n }\n view.focus();\n view.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n};\nhandlers.focus = view => {\n view.input.lastFocus = Date.now();\n if (!view.focused) {\n view.domObserver.stop();\n view.dom.classList.add(\"ProseMirror-focused\");\n view.domObserver.start();\n view.focused = true;\n setTimeout(() => {\n if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange())) selectionToDOM(view);\n }, 20);\n }\n};\nhandlers.blur = (view, _event) => {\n let event = _event;\n if (view.focused) {\n view.domObserver.stop();\n view.dom.classList.remove(\"ProseMirror-focused\");\n view.domObserver.start();\n if (event.relatedTarget && view.dom.contains(event.relatedTarget)) view.domObserver.currentSelection.clear();\n view.focused = false;\n }\n};\nhandlers.beforeinput = (view, _event) => {\n let event = _event;\n // We should probably do more with beforeinput events, but support\n // is so spotty that I'm still waiting to see where they are going.\n // Very specific hack to deal with backspace sometimes failing on\n // Chrome Android when after an uneditable node.\n if (chrome && android && event.inputType == \"deleteContentBackward\") {\n view.domObserver.flushSoon();\n let {\n domChangeCount\n } = view.input;\n setTimeout(() => {\n if (view.input.domChangeCount != domChangeCount) return; // Event already had some effect\n // This bug tends to close the virtual keyboard, so we refocus\n view.dom.blur();\n view.focus();\n if (view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\")))) return;\n let {\n $cursor\n } = view.state.selection;\n // Crude approximation of backspace behavior when no command handled it\n if ($cursor && $cursor.pos > 0) view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());\n }, 50);\n }\n};\n// Make sure all handlers get registered\nfor (let prop in editHandlers) handlers[prop] = editHandlers[prop];\nfunction compareObjs(a, b) {\n if (a == b) return true;\n for (let p in a) if (a[p] !== b[p]) return false;\n for (let p in b) if (!(p in a)) return false;\n return true;\n}\nclass WidgetType {\n constructor(toDOM, spec) {\n this.toDOM = toDOM;\n this.spec = spec || noSpec;\n this.side = this.spec.side || 0;\n }\n map(mapping, span, offset, oldOffset) {\n let {\n pos,\n deleted\n } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);\n return deleted ? null : new Decoration(pos - offset, pos - offset, this);\n }\n valid() {\n return true;\n }\n eq(other) {\n return this == other || other instanceof WidgetType && (this.spec.key && this.spec.key == other.spec.key || this.toDOM == other.toDOM && compareObjs(this.spec, other.spec));\n }\n destroy(node) {\n if (this.spec.destroy) this.spec.destroy(node);\n }\n}\nclass InlineType {\n constructor(attrs, spec) {\n this.attrs = attrs;\n this.spec = spec || noSpec;\n }\n map(mapping, span, offset, oldOffset) {\n let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;\n let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;\n return from >= to ? null : new Decoration(from, to, this);\n }\n valid(_, span) {\n return span.from < span.to;\n }\n eq(other) {\n return this == other || other instanceof InlineType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);\n }\n static is(span) {\n return span.type instanceof InlineType;\n }\n destroy() {}\n}\nclass NodeType {\n constructor(attrs, spec) {\n this.attrs = attrs;\n this.spec = spec || noSpec;\n }\n map(mapping, span, offset, oldOffset) {\n let from = mapping.mapResult(span.from + oldOffset, 1);\n if (from.deleted) return null;\n let to = mapping.mapResult(span.to + oldOffset, -1);\n if (to.deleted || to.pos <= from.pos) return null;\n return new Decoration(from.pos - offset, to.pos - offset, this);\n }\n valid(node, span) {\n let {\n index,\n offset\n } = node.content.findIndex(span.from),\n child;\n return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;\n }\n eq(other) {\n return this == other || other instanceof NodeType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);\n }\n destroy() {}\n}\n/**\nDecoration objects can be provided to the view through the\n[`decorations` prop](https://prosemirror.net/docs/ref/#view.EditorProps.decorations). They come in\nseveral variants—see the static members of this class for details.\n*/\nclass Decoration {\n /**\n @internal\n */\n constructor(\n /**\n The start position of the decoration.\n */\n from,\n /**\n The end position. Will be the same as `from` for [widget\n decorations](https://prosemirror.net/docs/ref/#view.Decoration^widget).\n */\n to,\n /**\n @internal\n */\n type) {\n this.from = from;\n this.to = to;\n this.type = type;\n }\n /**\n @internal\n */\n copy(from, to) {\n return new Decoration(from, to, this.type);\n }\n /**\n @internal\n */\n eq(other, offset = 0) {\n return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to;\n }\n /**\n @internal\n */\n map(mapping, offset, oldOffset) {\n return this.type.map(mapping, this, offset, oldOffset);\n }\n /**\n Creates a widget decoration, which is a DOM node that's shown in\n the document at the given position. It is recommended that you\n delay rendering the widget by passing a function that will be\n called when the widget is actually drawn in a view, but you can\n also directly pass a DOM node. `getPos` can be used to find the\n widget's current document position.\n */\n static widget(pos, toDOM, spec) {\n return new Decoration(pos, pos, new WidgetType(toDOM, spec));\n }\n /**\n Creates an inline decoration, which adds the given attributes to\n each inline node between `from` and `to`.\n */\n static inline(from, to, attrs, spec) {\n return new Decoration(from, to, new InlineType(attrs, spec));\n }\n /**\n Creates a node decoration. `from` and `to` should point precisely\n before and after a node in the document. That node, and only that\n node, will receive the given attributes.\n */\n static node(from, to, attrs, spec) {\n return new Decoration(from, to, new NodeType(attrs, spec));\n }\n /**\n The spec provided when creating this decoration. Can be useful\n if you've stored extra information in that object.\n */\n get spec() {\n return this.type.spec;\n }\n /**\n @internal\n */\n get inline() {\n return this.type instanceof InlineType;\n }\n /**\n @internal\n */\n get widget() {\n return this.type instanceof WidgetType;\n }\n}\nconst none = [],\n noSpec = {};\n/**\nA collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such\na way that the drawing algorithm can efficiently use and compare\nthem. This is a persistent data structure—it is not modified,\nupdates create a new value.\n*/\nclass DecorationSet {\n /**\n @internal\n */\n constructor(local, children) {\n this.local = local.length ? local : none;\n this.children = children.length ? children : none;\n }\n /**\n Create a set of decorations, using the structure of the given\n document. This will consume (modify) the `decorations` array, so\n you must make a copy if you want need to preserve that.\n */\n static create(doc, decorations) {\n return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty;\n }\n /**\n Find all decorations in this set which touch the given range\n (including decorations that start or end directly at the\n boundaries) and match the given predicate on their spec. When\n `start` and `end` are omitted, all decorations in the set are\n considered. When `predicate` isn't given, all decorations are\n assumed to match.\n */\n find(start, end, predicate) {\n let result = [];\n this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);\n return result;\n }\n findInner(start, end, result, offset, predicate) {\n for (let i = 0; i < this.local.length; i++) {\n let span = this.local[i];\n if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec))) result.push(span.copy(span.from + offset, span.to + offset));\n }\n for (let i = 0; i < this.children.length; i += 3) {\n if (this.children[i] < end && this.children[i + 1] > start) {\n let childOff = this.children[i] + 1;\n this.children[i + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);\n }\n }\n }\n /**\n Map the set of decorations in response to a change in the\n document.\n */\n map(mapping, doc, options) {\n if (this == empty || mapping.maps.length == 0) return this;\n return this.mapInner(mapping, doc, 0, 0, options || noSpec);\n }\n /**\n @internal\n */\n mapInner(mapping, node, offset, oldOffset, options) {\n let newLocal;\n for (let i = 0; i < this.local.length; i++) {\n let mapped = this.local[i].map(mapping, offset, oldOffset);\n if (mapped && mapped.type.valid(node, mapped)) (newLocal || (newLocal = [])).push(mapped);else if (options.onRemove) options.onRemove(this.local[i].spec);\n }\n if (this.children.length) return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);else return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;\n }\n /**\n Add the given array of decorations to the ones in the set,\n producing a new set. Consumes the `decorations` array. Needs\n access to the current document to create the appropriate tree\n structure.\n */\n add(doc, decorations) {\n if (!decorations.length) return this;\n if (this == empty) return DecorationSet.create(doc, decorations);\n return this.addInner(doc, decorations, 0);\n }\n addInner(doc, decorations, offset) {\n let children,\n childIndex = 0;\n doc.forEach((childNode, childOffset) => {\n let baseOffset = childOffset + offset,\n found;\n if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) return;\n if (!children) children = this.children.slice();\n while (childIndex < children.length && children[childIndex] < childOffset) childIndex += 3;\n if (children[childIndex] == childOffset) children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1);else children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec));\n childIndex += 3;\n });\n let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);\n for (let i = 0; i < local.length; i++) if (!local[i].type.valid(doc, local[i])) local.splice(i--, 1);\n return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);\n }\n /**\n Create a new set that contains the decorations in this set, minus\n the ones in the given array.\n */\n remove(decorations) {\n if (decorations.length == 0 || this == empty) return this;\n return this.removeInner(decorations, 0);\n }\n removeInner(decorations, offset) {\n let children = this.children,\n local = this.local;\n for (let i = 0; i < children.length; i += 3) {\n let found;\n let from = children[i] + offset,\n to = children[i + 1] + offset;\n for (let j = 0, span; j < decorations.length; j++) if (span = decorations[j]) {\n if (span.from > from && span.to < to) {\n decorations[j] = null;\n (found || (found = [])).push(span);\n }\n }\n if (!found) continue;\n if (children == this.children) children = this.children.slice();\n let removed = children[i + 2].removeInner(found, from + 1);\n if (removed != empty) {\n children[i + 2] = removed;\n } else {\n children.splice(i, 3);\n i -= 3;\n }\n }\n if (local.length) for (let i = 0, span; i < decorations.length; i++) if (span = decorations[i]) {\n for (let j = 0; j < local.length; j++) if (local[j].eq(span, offset)) {\n if (local == this.local) local = this.local.slice();\n local.splice(j--, 1);\n }\n }\n if (children == this.children && local == this.local) return this;\n return local.length || children.length ? new DecorationSet(local, children) : empty;\n }\n forChild(offset, node) {\n if (this == empty) return this;\n if (node.isLeaf) return DecorationSet.empty;\n let child, local;\n for (let i = 0; i < this.children.length; i += 3) if (this.children[i] >= offset) {\n if (this.children[i] == offset) child = this.children[i + 2];\n break;\n }\n let start = offset + 1,\n end = start + node.content.size;\n for (let i = 0; i < this.local.length; i++) {\n let dec = this.local[i];\n if (dec.from < end && dec.to > start && dec.type instanceof InlineType) {\n let from = Math.max(start, dec.from) - start,\n to = Math.min(end, dec.to) - start;\n if (from < to) (local || (local = [])).push(dec.copy(from, to));\n }\n }\n if (local) {\n let localSet = new DecorationSet(local.sort(byPos), none);\n return child ? new DecorationGroup([localSet, child]) : localSet;\n }\n return child || empty;\n }\n /**\n @internal\n */\n eq(other) {\n if (this == other) return true;\n if (!(other instanceof DecorationSet) || this.local.length != other.local.length || this.children.length != other.children.length) return false;\n for (let i = 0; i < this.local.length; i++) if (!this.local[i].eq(other.local[i])) return false;\n for (let i = 0; i < this.children.length; i += 3) if (this.children[i] != other.children[i] || this.children[i + 1] != other.children[i + 1] || !this.children[i + 2].eq(other.children[i + 2])) return false;\n return true;\n }\n /**\n @internal\n */\n locals(node) {\n return removeOverlap(this.localsInner(node));\n }\n /**\n @internal\n */\n localsInner(node) {\n if (this == empty) return none;\n if (node.inlineContent || !this.local.some(InlineType.is)) return this.local;\n let result = [];\n for (let i = 0; i < this.local.length; i++) {\n if (!(this.local[i].type instanceof InlineType)) result.push(this.local[i]);\n }\n return result;\n }\n forEachSet(f) {\n f(this);\n }\n}\n/**\nThe empty set of decorations.\n*/\nDecorationSet.empty = new DecorationSet([], []);\n/**\n@internal\n*/\nDecorationSet.removeOverlap = removeOverlap;\nconst empty = DecorationSet.empty;\n// An abstraction that allows the code dealing with decorations to\n// treat multiple DecorationSet objects as if it were a single object\n// with (a subset of) the same interface.\nclass DecorationGroup {\n constructor(members) {\n this.members = members;\n }\n map(mapping, doc) {\n const mappedDecos = this.members.map(member => member.map(mapping, doc, noSpec));\n return DecorationGroup.from(mappedDecos);\n }\n forChild(offset, child) {\n if (child.isLeaf) return DecorationSet.empty;\n let found = [];\n for (let i = 0; i < this.members.length; i++) {\n let result = this.members[i].forChild(offset, child);\n if (result == empty) continue;\n if (result instanceof DecorationGroup) found = found.concat(result.members);else found.push(result);\n }\n return DecorationGroup.from(found);\n }\n eq(other) {\n if (!(other instanceof DecorationGroup) || other.members.length != this.members.length) return false;\n for (let i = 0; i < this.members.length; i++) if (!this.members[i].eq(other.members[i])) return false;\n return true;\n }\n locals(node) {\n let result,\n sorted = true;\n for (let i = 0; i < this.members.length; i++) {\n let locals = this.members[i].localsInner(node);\n if (!locals.length) continue;\n if (!result) {\n result = locals;\n } else {\n if (sorted) {\n result = result.slice();\n sorted = false;\n }\n for (let j = 0; j < locals.length; j++) result.push(locals[j]);\n }\n }\n return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none;\n }\n // Create a group for the given array of decoration sets, or return\n // a single set when possible.\n static from(members) {\n switch (members.length) {\n case 0:\n return empty;\n case 1:\n return members[0];\n default:\n return new DecorationGroup(members.every(m => m instanceof DecorationSet) ? members : members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));\n }\n }\n forEachSet(f) {\n for (let i = 0; i < this.members.length; i++) this.members[i].forEachSet(f);\n }\n}\nfunction mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {\n let children = oldChildren.slice();\n // Mark the children that are directly touched by changes, and\n // move those that are after the changes.\n for (let i = 0, baseOffset = oldOffset; i < mapping.maps.length; i++) {\n let moved = 0;\n mapping.maps[i].forEach((oldStart, oldEnd, newStart, newEnd) => {\n let dSize = newEnd - newStart - (oldEnd - oldStart);\n for (let i = 0; i < children.length; i += 3) {\n let end = children[i + 1];\n if (end < 0 || oldStart > end + baseOffset - moved) continue;\n let start = children[i] + baseOffset - moved;\n if (oldEnd >= start) {\n children[i + 1] = oldStart <= start ? -2 : -1;\n } else if (oldStart >= baseOffset && dSize) {\n children[i] += dSize;\n children[i + 1] += dSize;\n }\n }\n moved += dSize;\n });\n baseOffset = mapping.maps[i].map(baseOffset, -1);\n }\n // Find the child nodes that still correspond to a single node,\n // recursively call mapInner on them and update their positions.\n let mustRebuild = false;\n for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {\n // Touched nodes\n if (children[i + 1] == -2) {\n mustRebuild = true;\n children[i + 1] = -1;\n continue;\n }\n let from = mapping.map(oldChildren[i] + oldOffset),\n fromLocal = from - offset;\n if (fromLocal < 0 || fromLocal >= node.content.size) {\n mustRebuild = true;\n continue;\n }\n // Must read oldChildren because children was tagged with -1\n let to = mapping.map(oldChildren[i + 1] + oldOffset, -1),\n toLocal = to - offset;\n let {\n index,\n offset: childOffset\n } = node.content.findIndex(fromLocal);\n let childNode = node.maybeChild(index);\n if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {\n let mapped = children[i + 2].mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options);\n if (mapped != empty) {\n children[i] = fromLocal;\n children[i + 1] = toLocal;\n children[i + 2] = mapped;\n } else {\n children[i + 1] = -2;\n mustRebuild = true;\n }\n } else {\n mustRebuild = true;\n }\n }\n // Remaining children must be collected and rebuilt into the appropriate structure\n if (mustRebuild) {\n let decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options);\n let built = buildTree(decorations, node, 0, options);\n newLocal = built.local;\n for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {\n children.splice(i, 3);\n i -= 3;\n }\n for (let i = 0, j = 0; i < built.children.length; i += 3) {\n let from = built.children[i];\n while (j < children.length && children[j] < from) j += 3;\n children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);\n }\n }\n return new DecorationSet(newLocal.sort(byPos), children);\n}\nfunction moveSpans(spans, offset) {\n if (!offset || !spans.length) return spans;\n let result = [];\n for (let i = 0; i < spans.length; i++) {\n let span = spans[i];\n result.push(new Decoration(span.from + offset, span.to + offset, span.type));\n }\n return result;\n}\nfunction mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {\n // Gather all decorations from the remaining marked children\n function gather(set, oldOffset) {\n for (let i = 0; i < set.local.length; i++) {\n let mapped = set.local[i].map(mapping, offset, oldOffset);\n if (mapped) decorations.push(mapped);else if (options.onRemove) options.onRemove(set.local[i].spec);\n }\n for (let i = 0; i < set.children.length; i += 3) gather(set.children[i + 2], set.children[i] + oldOffset + 1);\n }\n for (let i = 0; i < children.length; i += 3) if (children[i + 1] == -1) gather(children[i + 2], oldChildren[i] + oldOffset + 1);\n return decorations;\n}\nfunction takeSpansForNode(spans, node, offset) {\n if (node.isLeaf) return null;\n let end = offset + node.nodeSize,\n found = null;\n for (let i = 0, span; i < spans.length; i++) {\n if ((span = spans[i]) && span.from > offset && span.to < end) {\n (found || (found = [])).push(span);\n spans[i] = null;\n }\n }\n return found;\n}\nfunction withoutNulls(array) {\n let result = [];\n for (let i = 0; i < array.length; i++) if (array[i] != null) result.push(array[i]);\n return result;\n}\n// Build up a tree that corresponds to a set of decorations. `offset`\n// is a base offset that should be subtracted from the `from` and `to`\n// positions in the spans (so that we don't have to allocate new spans\n// for recursive calls).\nfunction buildTree(spans, node, offset, options) {\n let children = [],\n hasNulls = false;\n node.forEach((childNode, localStart) => {\n let found = takeSpansForNode(spans, childNode, localStart + offset);\n if (found) {\n hasNulls = true;\n let subtree = buildTree(found, childNode, offset + localStart + 1, options);\n if (subtree != empty) children.push(localStart, localStart + childNode.nodeSize, subtree);\n }\n });\n let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);\n for (let i = 0; i < locals.length; i++) if (!locals[i].type.valid(node, locals[i])) {\n if (options.onRemove) options.onRemove(locals[i].spec);\n locals.splice(i--, 1);\n }\n return locals.length || children.length ? new DecorationSet(locals, children) : empty;\n}\n// Used to sort decorations so that ones with a low start position\n// come first, and within a set with the same start position, those\n// with an smaller end position come first.\nfunction byPos(a, b) {\n return a.from - b.from || a.to - b.to;\n}\n// Scan a sorted array of decorations for partially overlapping spans,\n// and split those so that only fully overlapping spans are left (to\n// make subsequent rendering easier). Will return the input array if\n// no partially overlapping spans are found (the common case).\nfunction removeOverlap(spans) {\n let working = spans;\n for (let i = 0; i < working.length - 1; i++) {\n let span = working[i];\n if (span.from != span.to) for (let j = i + 1; j < working.length; j++) {\n let next = working[j];\n if (next.from == span.from) {\n if (next.to != span.to) {\n if (working == spans) working = spans.slice();\n // Followed by a partially overlapping larger span. Split that\n // span.\n working[j] = next.copy(next.from, span.to);\n insertAhead(working, j + 1, next.copy(span.to, next.to));\n }\n continue;\n } else {\n if (next.from < span.to) {\n if (working == spans) working = spans.slice();\n // The end of this one overlaps with a subsequent span. Split\n // this one.\n working[i] = span.copy(span.from, next.from);\n insertAhead(working, j, span.copy(next.from, span.to));\n }\n break;\n }\n }\n }\n return working;\n}\nfunction insertAhead(array, i, deco) {\n while (i < array.length && byPos(deco, array[i]) > 0) i++;\n array.splice(i, 0, deco);\n}\n// Get the decorations associated with the current props of a view.\nfunction viewDecorations(view) {\n let found = [];\n view.someProp(\"decorations\", f => {\n let result = f(view.state);\n if (result && result != empty) found.push(result);\n });\n if (view.cursorWrapper) found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco]));\n return DecorationGroup.from(found);\n}\nconst observeOptions = {\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n attributes: true,\n attributeOldValue: true,\n subtree: true\n};\n// IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified\nconst useCharData = ie && ie_version <= 11;\nclass SelectionState {\n constructor() {\n this.anchorNode = null;\n this.anchorOffset = 0;\n this.focusNode = null;\n this.focusOffset = 0;\n }\n set(sel) {\n this.anchorNode = sel.anchorNode;\n this.anchorOffset = sel.anchorOffset;\n this.focusNode = sel.focusNode;\n this.focusOffset = sel.focusOffset;\n }\n clear() {\n this.anchorNode = this.focusNode = null;\n }\n eq(sel) {\n return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset && sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset;\n }\n}\nclass DOMObserver {\n constructor(view, handleDOMChange) {\n this.view = view;\n this.handleDOMChange = handleDOMChange;\n this.queue = [];\n this.flushingSoon = -1;\n this.observer = null;\n this.currentSelection = new SelectionState();\n this.onCharData = null;\n this.suppressingSelectionUpdates = false;\n this.lastChangedTextNode = null;\n this.observer = window.MutationObserver && new window.MutationObserver(mutations => {\n for (let i = 0; i < mutations.length; i++) this.queue.push(mutations[i]);\n // IE11 will sometimes (on backspacing out a single character\n // text node after a BR node) call the observer callback\n // before actually updating the DOM, which will cause\n // ProseMirror to miss the change (see #930)\n if (ie && ie_version <= 11 && mutations.some(m => m.type == \"childList\" && m.removedNodes.length || m.type == \"characterData\" && m.oldValue.length > m.target.nodeValue.length)) this.flushSoon();else this.flush();\n });\n if (useCharData) {\n this.onCharData = e => {\n this.queue.push({\n target: e.target,\n type: \"characterData\",\n oldValue: e.prevValue\n });\n this.flushSoon();\n };\n }\n this.onSelectionChange = this.onSelectionChange.bind(this);\n }\n flushSoon() {\n if (this.flushingSoon < 0) this.flushingSoon = window.setTimeout(() => {\n this.flushingSoon = -1;\n this.flush();\n }, 20);\n }\n forceFlush() {\n if (this.flushingSoon > -1) {\n window.clearTimeout(this.flushingSoon);\n this.flushingSoon = -1;\n this.flush();\n }\n }\n start() {\n if (this.observer) {\n this.observer.takeRecords();\n this.observer.observe(this.view.dom, observeOptions);\n }\n if (this.onCharData) this.view.dom.addEventListener(\"DOMCharacterDataModified\", this.onCharData);\n this.connectSelection();\n }\n stop() {\n if (this.observer) {\n let take = this.observer.takeRecords();\n if (take.length) {\n for (let i = 0; i < take.length; i++) this.queue.push(take[i]);\n window.setTimeout(() => this.flush(), 20);\n }\n this.observer.disconnect();\n }\n if (this.onCharData) this.view.dom.removeEventListener(\"DOMCharacterDataModified\", this.onCharData);\n this.disconnectSelection();\n }\n connectSelection() {\n this.view.dom.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange);\n }\n disconnectSelection() {\n this.view.dom.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange);\n }\n suppressSelectionUpdates() {\n this.suppressingSelectionUpdates = true;\n setTimeout(() => this.suppressingSelectionUpdates = false, 50);\n }\n onSelectionChange() {\n if (!hasFocusAndSelection(this.view)) return;\n if (this.suppressingSelectionUpdates) return selectionToDOM(this.view);\n // Deletions on IE11 fire their events in the wrong order, giving\n // us a selection change event before the DOM changes are\n // reported.\n if (ie && ie_version <= 11 && !this.view.state.selection.empty) {\n let sel = this.view.domSelectionRange();\n // Selection.isCollapsed isn't reliable on IE\n if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset)) return this.flushSoon();\n }\n this.flush();\n }\n setCurSelection() {\n this.currentSelection.set(this.view.domSelectionRange());\n }\n ignoreSelectionChange(sel) {\n if (!sel.focusNode) return true;\n let ancestors = new Set(),\n container;\n for (let scan = sel.focusNode; scan; scan = parentNode(scan)) ancestors.add(scan);\n for (let scan = sel.anchorNode; scan; scan = parentNode(scan)) if (ancestors.has(scan)) {\n container = scan;\n break;\n }\n let desc = container && this.view.docView.nearestDesc(container);\n if (desc && desc.ignoreMutation({\n type: \"selection\",\n target: container.nodeType == 3 ? container.parentNode : container\n })) {\n this.setCurSelection();\n return true;\n }\n }\n pendingRecords() {\n if (this.observer) for (let mut of this.observer.takeRecords()) this.queue.push(mut);\n return this.queue;\n }\n flush() {\n let {\n view\n } = this;\n if (!view.docView || this.flushingSoon > -1) return;\n let mutations = this.pendingRecords();\n if (mutations.length) this.queue = [];\n let sel = view.domSelectionRange();\n let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);\n let from = -1,\n to = -1,\n typeOver = false,\n added = [];\n if (view.editable) {\n for (let i = 0; i < mutations.length; i++) {\n let result = this.registerMutation(mutations[i], added);\n if (result) {\n from = from < 0 ? result.from : Math.min(result.from, from);\n to = to < 0 ? result.to : Math.max(result.to, to);\n if (result.typeOver) typeOver = true;\n }\n }\n }\n if (gecko && added.length) {\n let brs = added.filter(n => n.nodeName == \"BR\");\n if (brs.length == 2) {\n let [a, b] = brs;\n if (a.parentNode && a.parentNode.parentNode == b.parentNode) b.remove();else a.remove();\n } else {\n let {\n focusNode\n } = this.currentSelection;\n for (let br of brs) {\n let parent = br.parentNode;\n if (parent && parent.nodeName == \"LI\" && (!focusNode || blockParent(view, focusNode) != parent)) br.remove();\n }\n }\n }\n let readSel = null;\n // If it looks like the browser has reset the selection to the\n // start of the document after focus, restore the selection from\n // the state\n if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {\n view.input.lastFocus = 0;\n selectionToDOM(view);\n this.currentSelection.set(sel);\n view.scrollToSelection();\n } else if (from > -1 || newSel) {\n if (from > -1) {\n view.docView.markDirty(from, to);\n checkCSS(view);\n }\n this.handleDOMChange(from, to, typeOver, added);\n if (view.docView && view.docView.dirty) view.updateState(view.state);else if (!this.currentSelection.eq(sel)) selectionToDOM(view);\n this.currentSelection.set(sel);\n }\n }\n registerMutation(mut, added) {\n // Ignore mutations inside nodes that were already noted as inserted\n if (added.indexOf(mut.target) > -1) return null;\n let desc = this.view.docView.nearestDesc(mut.target);\n if (mut.type == \"attributes\" && (desc == this.view.docView || mut.attributeName == \"contenteditable\" ||\n // Firefox sometimes fires spurious events for null/empty styles\n mut.attributeName == \"style\" && !mut.oldValue && !mut.target.getAttribute(\"style\"))) return null;\n if (!desc || desc.ignoreMutation(mut)) return null;\n if (mut.type == \"childList\") {\n for (let i = 0; i < mut.addedNodes.length; i++) {\n let node = mut.addedNodes[i];\n added.push(node);\n if (node.nodeType == 3) this.lastChangedTextNode = node;\n }\n if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return {\n from: desc.posBefore,\n to: desc.posAfter\n };\n let prev = mut.previousSibling,\n next = mut.nextSibling;\n if (ie && ie_version <= 11 && mut.addedNodes.length) {\n // IE11 gives us incorrect next/prev siblings for some\n // insertions, so if there are added nodes, recompute those\n for (let i = 0; i < mut.addedNodes.length; i++) {\n let {\n previousSibling,\n nextSibling\n } = mut.addedNodes[i];\n if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) prev = previousSibling;\n if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) next = nextSibling;\n }\n }\n let fromOffset = prev && prev.parentNode == mut.target ? domIndex(prev) + 1 : 0;\n let from = desc.localPosFromDOM(mut.target, fromOffset, -1);\n let toOffset = next && next.parentNode == mut.target ? domIndex(next) : mut.target.childNodes.length;\n let to = desc.localPosFromDOM(mut.target, toOffset, 1);\n return {\n from,\n to\n };\n } else if (mut.type == \"attributes\") {\n return {\n from: desc.posAtStart - desc.border,\n to: desc.posAtEnd + desc.border\n };\n } else {\n // \"characterData\"\n this.lastChangedTextNode = mut.target;\n return {\n from: desc.posAtStart,\n to: desc.posAtEnd,\n // An event was generated for a text change that didn't change\n // any text. Mark the dom change to fall back to assuming the\n // selection was typed over with an identical value if it can't\n // find another change.\n typeOver: mut.target.nodeValue == mut.oldValue\n };\n }\n }\n}\nlet cssChecked = new WeakMap();\nlet cssCheckWarned = false;\nfunction checkCSS(view) {\n if (cssChecked.has(view)) return;\n cssChecked.set(view, null);\n if (['normal', 'nowrap', 'pre-line'].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) {\n view.requiresGeckoHackNode = gecko;\n if (cssCheckWarned) return;\n console[\"warn\"](\"ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.\");\n cssCheckWarned = true;\n }\n}\nfunction rangeToSelectionRange(view, range) {\n let anchorNode = range.startContainer,\n anchorOffset = range.startOffset;\n let focusNode = range.endContainer,\n focusOffset = range.endOffset;\n let currentAnchor = view.domAtPos(view.state.selection.anchor);\n // Since such a range doesn't distinguish between anchor and head,\n // use a heuristic that flips it around if its end matches the\n // current anchor.\n if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset)) [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];\n return {\n anchorNode,\n anchorOffset,\n focusNode,\n focusOffset\n };\n}\n// Used to work around a Safari Selection/shadow DOM bug\n// Based on https://github.com/codemirror/dev/issues/414 fix\nfunction safariShadowSelectionRange(view, selection) {\n if (selection.getComposedRanges) {\n let range = selection.getComposedRanges(view.root)[0];\n if (range) return rangeToSelectionRange(view, range);\n }\n let found;\n function read(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n found = event.getTargetRanges()[0];\n }\n // Because Safari (at least in 2018-2022) doesn't provide regular\n // access to the selection inside a shadowRoot, we have to perform a\n // ridiculous hack to get at it—using `execCommand` to trigger a\n // `beforeInput` event so that we can read the target range from the\n // event.\n view.dom.addEventListener(\"beforeinput\", read, true);\n document.execCommand(\"indent\");\n view.dom.removeEventListener(\"beforeinput\", read, true);\n return found ? rangeToSelectionRange(view, found) : null;\n}\nfunction blockParent(view, node) {\n for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) {\n let desc = view.docView.nearestDesc(p, true);\n if (desc && desc.node.isBlock) return p;\n }\n return null;\n}\n\n// Note that all referencing and parsing is done with the\n// start-of-operation selection and document, since that's the one\n// that the DOM represents. If any changes came in in the meantime,\n// the modification is mapped over those before it is applied, in\n// readDOMChange.\nfunction parseBetween(view, from_, to_) {\n let {\n node: parent,\n fromOffset,\n toOffset,\n from,\n to\n } = view.docView.parseRange(from_, to_);\n let domSel = view.domSelectionRange();\n let find;\n let anchor = domSel.anchorNode;\n if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {\n find = [{\n node: anchor,\n offset: domSel.anchorOffset\n }];\n if (!selectionCollapsed(domSel)) find.push({\n node: domSel.focusNode,\n offset: domSel.focusOffset\n });\n }\n // Work around issue in Chrome where backspacing sometimes replaces\n // the deleted content with a random BR node (issues #799, #831)\n if (chrome && view.input.lastKeyCode === 8) {\n for (let off = toOffset; off > fromOffset; off--) {\n let node = parent.childNodes[off - 1],\n desc = node.pmViewDesc;\n if (node.nodeName == \"BR\" && !desc) {\n toOffset = off;\n break;\n }\n if (!desc || desc.size) break;\n }\n }\n let startDoc = view.state.doc;\n let parser = view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n let $from = startDoc.resolve(from);\n let sel = null,\n doc = parser.parse(parent, {\n topNode: $from.parent,\n topMatch: $from.parent.contentMatchAt($from.index()),\n topOpen: true,\n from: fromOffset,\n to: toOffset,\n preserveWhitespace: $from.parent.type.whitespace == \"pre\" ? \"full\" : true,\n findPositions: find,\n ruleFromNode,\n context: $from\n });\n if (find && find[0].pos != null) {\n let anchor = find[0].pos,\n head = find[1] && find[1].pos;\n if (head == null) head = anchor;\n sel = {\n anchor: anchor + from,\n head: head + from\n };\n }\n return {\n doc,\n sel,\n from,\n to\n };\n}\nfunction ruleFromNode(dom) {\n let desc = dom.pmViewDesc;\n if (desc) {\n return desc.parseRule();\n } else if (dom.nodeName == \"BR\" && dom.parentNode) {\n // Safari replaces the list item or table cell with a BR\n // directly in the list node (?!) if you delete the last\n // character in a list item or table cell (#708, #862)\n if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {\n let skip = document.createElement(\"div\");\n skip.appendChild(document.createElement(\"li\"));\n return {\n skip\n };\n } else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {\n return {\n ignore: true\n };\n }\n } else if (dom.nodeName == \"IMG\" && dom.getAttribute(\"mark-placeholder\")) {\n return {\n ignore: true\n };\n }\n return null;\n}\nconst isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;\nfunction readDOMChange(view, from, to, typeOver, addedNodes) {\n let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);\n view.input.compositionPendingChanges = 0;\n if (from < 0) {\n let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;\n let newSel = selectionFromDOM(view, origin);\n if (newSel && !view.state.selection.eq(newSel)) {\n if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) return;\n let tr = view.state.tr.setSelection(newSel);\n if (origin == \"pointer\") tr.setMeta(\"pointer\", true);else if (origin == \"key\") tr.scrollIntoView();\n if (compositionID) tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr);\n }\n return;\n }\n let $before = view.state.doc.resolve(from);\n let shared = $before.sharedDepth(to);\n from = $before.before(shared + 1);\n to = view.state.doc.resolve(to).after(shared + 1);\n let sel = view.state.selection;\n let parse = parseBetween(view, from, to);\n let doc = view.state.doc,\n compare = doc.slice(parse.from, parse.to);\n let preferredPos, preferredSide;\n // Prefer anchoring to end when Backspace is pressed\n if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {\n preferredPos = view.state.selection.to;\n preferredSide = \"end\";\n } else {\n preferredPos = view.state.selection.from;\n preferredSide = \"start\";\n }\n view.input.lastKeyCode = null;\n let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);\n if (change) view.input.domChangeCount++;\n if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some(n => n.nodeType == 1 && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n view.input.lastIOSEnter = 0;\n return;\n }\n if (!change) {\n if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) && !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {\n change = {\n start: sel.from,\n endA: sel.to,\n endB: sel.to\n };\n } else {\n if (parse.sel) {\n let sel = resolveSelection(view, view.state.doc, parse.sel);\n if (sel && !sel.eq(view.state.selection)) {\n let tr = view.state.tr.setSelection(sel);\n if (compositionID) tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr);\n }\n }\n return;\n }\n }\n // Handle the case where overwriting a selection by typing matches\n // the start or end of the selected content, creating a change\n // that's smaller than what was actually overwritten.\n if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {\n if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse.from) {\n change.start = view.state.selection.from;\n } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 && view.state.selection.to <= parse.to) {\n change.endB += view.state.selection.to - change.endA;\n change.endA = view.state.selection.to;\n }\n }\n // IE11 will insert a non-breaking space _ahead_ of the space after\n // the cursor space when adding a space before another space. When\n // that happened, adjust the change to cover the space instead.\n if (ie && ie_version <= 11 && change.endB == change.start + 1 && change.endA == change.start && change.start > parse.from && parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == \" \\u00a0\") {\n change.start--;\n change.endA--;\n change.endB--;\n }\n let $from = parse.doc.resolveNoCache(change.start - parse.from);\n let $to = parse.doc.resolveNoCache(change.endB - parse.from);\n let $fromA = doc.resolve(change.start);\n let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;\n let nextSel;\n // If this looks like the effect of pressing Enter (or was recorded\n // as being an iOS enter press), just dispatch an Enter key instead.\n if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some(n => n.nodeName == \"DIV\" || n.nodeName == \"P\")) || !inlineChange && $from.pos < parse.doc.content.size && !$from.sameParent($to) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head == $to.pos) && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n view.input.lastIOSEnter = 0;\n return;\n }\n // Same for backspace\n if (view.state.selection.anchor > change.start && looksLikeBackspace(doc, change.start, change.endA, $from, $to) && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\")))) {\n if (android && chrome) view.domObserver.suppressSelectionUpdates(); // #820\n return;\n }\n // Chrome Android will occasionally, during composition, delete the\n // entire composition and then immediately insert it again. This is\n // used to detect that situation.\n if (chrome && android && change.endB == change.start) view.input.lastAndroidDelete = Date.now();\n // This tries to detect Android virtual keyboard\n // enter-and-pick-suggestion action. That sometimes (see issue\n // #1059) first fires a DOM mutation, before moving the selection to\n // the newly created block. And then, because ProseMirror cleans up\n // the DOM selection, it gives up moving the selection entirely,\n // leaving the cursor in the wrong place. When that happens, we drop\n // the new paragraph from the initial change, and fire a simulated\n // enter key afterwards.\n if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth && parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {\n change.endB -= 2;\n $to = parse.doc.resolveNoCache(change.endB - parse.from);\n setTimeout(() => {\n view.someProp(\"handleKeyDown\", function (f) {\n return f(view, keyEvent(13, \"Enter\"));\n });\n }, 20);\n }\n let chFrom = change.start,\n chTo = change.endA;\n let tr, storedMarks, markChange;\n if (inlineChange) {\n if ($from.pos == $to.pos) {\n // Deletion\n // IE11 sometimes weirdly moves the DOM selection around after\n // backspacing out the first element in a textblock\n if (ie && ie_version <= 11 && $from.parentOffset == 0) {\n view.domObserver.suppressSelectionUpdates();\n setTimeout(() => selectionToDOM(view), 20);\n }\n tr = view.state.tr.delete(chFrom, chTo);\n storedMarks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));\n } else if (\n // Adding or removing a mark\n change.endA == change.endB && (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))) {\n tr = view.state.tr;\n if (markChange.type == \"add\") tr.addMark(chFrom, chTo, markChange.mark);else tr.removeMark(chFrom, chTo, markChange.mark);\n } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {\n // Both positions in the same text node -- simply insert text\n let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);\n if (view.someProp(\"handleTextInput\", f => f(view, chFrom, chTo, text))) return;\n tr = view.state.tr.insertText(text, chFrom, chTo);\n }\n }\n if (!tr) tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));\n if (parse.sel) {\n let sel = resolveSelection(view, tr.doc, parse.sel);\n // Chrome Android will sometimes, during composition, report the\n // selection in the wrong place. If it looks like that is\n // happening, don't update the selection.\n // Edge just doesn't move the cursor forward when you start typing\n // in an empty block or between br nodes.\n if (sel && !(chrome && android && view.composing && sel.empty && (change.start != change.endB || view.input.lastAndroidDelete < Date.now() - 100) && (sel.head == chFrom || sel.head == tr.mapping.map(chTo) - 1) || ie && sel.empty && sel.head == chFrom)) tr.setSelection(sel);\n }\n if (storedMarks) tr.ensureMarks(storedMarks);\n if (compositionID) tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr.scrollIntoView());\n}\nfunction resolveSelection(view, doc, parsedSel) {\n if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) return null;\n return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head));\n}\n// Given two same-length, non-empty fragments of inline content,\n// determine whether the first could be created from the second by\n// removing or adding a single mark type.\nfunction isMarkChange(cur, prev) {\n let curMarks = cur.firstChild.marks,\n prevMarks = prev.firstChild.marks;\n let added = curMarks,\n removed = prevMarks,\n type,\n mark,\n update;\n for (let i = 0; i < prevMarks.length; i++) added = prevMarks[i].removeFromSet(added);\n for (let i = 0; i < curMarks.length; i++) removed = curMarks[i].removeFromSet(removed);\n if (added.length == 1 && removed.length == 0) {\n mark = added[0];\n type = \"add\";\n update = node => node.mark(mark.addToSet(node.marks));\n } else if (added.length == 0 && removed.length == 1) {\n mark = removed[0];\n type = \"remove\";\n update = node => node.mark(mark.removeFromSet(node.marks));\n } else {\n return null;\n }\n let updated = [];\n for (let i = 0; i < prev.childCount; i++) updated.push(update(prev.child(i)));\n if (Fragment.from(updated).eq(cur)) return {\n mark,\n type\n };\n}\nfunction looksLikeBackspace(old, start, end, $newStart, $newEnd) {\n if (\n // The content must have shrunk\n end - start <= $newEnd.pos - $newStart.pos ||\n // newEnd must point directly at or after the end of the block that newStart points into\n skipClosingAndOpening($newStart, true, false) < $newEnd.pos) return false;\n let $start = old.resolve(start);\n // Handle the case where, rather than joining blocks, the change just removed an entire block\n if (!$newStart.parent.isTextblock) {\n let after = $start.nodeAfter;\n return after != null && end == start + after.nodeSize;\n }\n // Start must be at the end of a block\n if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock) return false;\n let $next = old.resolve(skipClosingAndOpening($start, true, true));\n // The next textblock must start before end and end near it\n if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) return false;\n // The fragments after the join point must match\n return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);\n}\nfunction skipClosingAndOpening($pos, fromEnd, mayOpen) {\n let depth = $pos.depth,\n end = fromEnd ? $pos.end() : $pos.pos;\n while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {\n depth--;\n end++;\n fromEnd = false;\n }\n if (mayOpen) {\n let next = $pos.node(depth).maybeChild($pos.indexAfter(depth));\n while (next && !next.isLeaf) {\n next = next.firstChild;\n end++;\n }\n }\n return end;\n}\nfunction findDiff(a, b, pos, preferredPos, preferredSide) {\n let start = a.findDiffStart(b, pos);\n if (start == null) return null;\n let {\n a: endA,\n b: endB\n } = a.findDiffEnd(b, pos + a.size, pos + b.size);\n if (preferredSide == \"end\") {\n let adjust = Math.max(0, start - Math.min(endA, endB));\n preferredPos -= endA + adjust - start;\n }\n if (endA < start && a.size < b.size) {\n let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;\n start -= move;\n if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1))) start += move ? 1 : -1;\n endB = start + (endB - endA);\n endA = start;\n } else if (endB < start) {\n let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;\n start -= move;\n if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1))) start += move ? 1 : -1;\n endA = start + (endA - endB);\n endB = start;\n }\n return {\n start,\n endA,\n endB\n };\n}\nfunction isSurrogatePair(str) {\n if (str.length != 2) return false;\n let a = str.charCodeAt(0),\n b = str.charCodeAt(1);\n return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;\n}\n\n/**\n@internal\n*/\nconst __serializeForClipboard = serializeForClipboard;\n/**\n@internal\n*/\nconst __parseFromClipboard = parseFromClipboard;\n/**\n@internal\n*/\nconst __endComposition = endComposition;\n/**\nAn editor view manages the DOM structure that represents an\neditable document. Its state and behavior are determined by its\n[props](https://prosemirror.net/docs/ref/#view.DirectEditorProps).\n*/\nclass EditorView {\n /**\n Create a view. `place` may be a DOM node that the editor should\n be appended to, a function that will place it into the document,\n or an object whose `mount` property holds the node to use as the\n document container. If it is `null`, the editor will not be\n added to the document.\n */\n constructor(place, props) {\n this._root = null;\n /**\n @internal\n */\n this.focused = false;\n /**\n Kludge used to work around a Chrome bug @internal\n */\n this.trackWrites = null;\n this.mounted = false;\n /**\n @internal\n */\n this.markCursor = null;\n /**\n @internal\n */\n this.cursorWrapper = null;\n /**\n @internal\n */\n this.lastSelectedViewDesc = undefined;\n /**\n @internal\n */\n this.input = new InputState();\n this.prevDirectPlugins = [];\n this.pluginViews = [];\n /**\n Holds `true` when a hack node is needed in Firefox to prevent the\n [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)\n @internal\n */\n this.requiresGeckoHackNode = false;\n /**\n When editor content is being dragged, this object contains\n information about the dragged slice and whether it is being\n copied or moved. At any other time, it is null.\n */\n this.dragging = null;\n this._props = props;\n this.state = props.state;\n this.directPlugins = props.plugins || [];\n this.directPlugins.forEach(checkStateComponent);\n this.dispatch = this.dispatch.bind(this);\n this.dom = place && place.mount || document.createElement(\"div\");\n if (place) {\n if (place.appendChild) place.appendChild(this.dom);else if (typeof place == \"function\") place(this.dom);else if (place.mount) this.mounted = true;\n }\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n this.nodeViews = buildNodeViews(this);\n this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);\n this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));\n this.domObserver.start();\n initInput(this);\n this.updatePluginViews();\n }\n /**\n Holds `true` when a\n [composition](https://w3c.github.io/uievents/#events-compositionevents)\n is active.\n */\n get composing() {\n return this.input.composing;\n }\n /**\n The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).\n */\n get props() {\n if (this._props.state != this.state) {\n let prev = this._props;\n this._props = {};\n for (let name in prev) this._props[name] = prev[name];\n this._props.state = this.state;\n }\n return this._props;\n }\n /**\n Update the view's props. Will immediately cause an update to\n the DOM.\n */\n update(props) {\n if (props.handleDOMEvents != this._props.handleDOMEvents) ensureListeners(this);\n let prevProps = this._props;\n this._props = props;\n if (props.plugins) {\n props.plugins.forEach(checkStateComponent);\n this.directPlugins = props.plugins;\n }\n this.updateStateInner(props.state, prevProps);\n }\n /**\n Update the view by updating existing props object with the object\n given as argument. Equivalent to `view.update(Object.assign({},\n view.props, props))`.\n */\n setProps(props) {\n let updated = {};\n for (let name in this._props) updated[name] = this._props[name];\n updated.state = this.state;\n for (let name in props) updated[name] = props[name];\n this.update(updated);\n }\n /**\n Update the editor's `state` prop, without touching any of the\n other props.\n */\n updateState(state) {\n this.updateStateInner(state, this._props);\n }\n updateStateInner(state, prevProps) {\n var _a;\n let prev = this.state,\n redraw = false,\n updateSel = false;\n // When stored marks are added, stop composition, so that they can\n // be displayed.\n if (state.storedMarks && this.composing) {\n clearComposition(this);\n updateSel = true;\n }\n this.state = state;\n let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins;\n if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) {\n let nodeViews = buildNodeViews(this);\n if (changedNodeViews(nodeViews, this.nodeViews)) {\n this.nodeViews = nodeViews;\n redraw = true;\n }\n }\n if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) {\n ensureListeners(this);\n }\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n let innerDeco = viewDecorations(this),\n outerDeco = computeDocDeco(this);\n let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? \"reset\" : state.scrollToSelection > prev.scrollToSelection ? \"to selection\" : \"preserve\";\n let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);\n if (updateDoc || !state.selection.eq(prev.selection)) updateSel = true;\n let oldScrollPos = scroll == \"preserve\" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);\n if (updateSel) {\n this.domObserver.stop();\n // Work around an issue in Chrome, IE, and Edge where changing\n // the DOM around an active selection puts it into a broken\n // state where the thing the user sees differs from the\n // selection reported by the Selection object (#710, #973,\n // #1011, #1013, #1035).\n let forceSelUpdate = updateDoc && (ie || chrome) && !this.composing && !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);\n if (updateDoc) {\n // If the node that the selection points into is written to,\n // Chrome sometimes starts misreporting the selection, so this\n // tracks that and forces a selection reset when our update\n // did write to the node.\n let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;\n if (this.composing) this.input.compositionNode = findCompositionNode(this);\n if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {\n this.docView.updateOuterDeco(outerDeco);\n this.docView.destroy();\n this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);\n }\n if (chromeKludge && !this.trackWrites) forceSelUpdate = true;\n }\n // Work around for an issue where an update arriving right between\n // a DOM selection change and the \"selectionchange\" event for it\n // can cause a spurious DOM selection update, disrupting mouse\n // drag selection.\n if (forceSelUpdate || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && anchorInRightPlace(this))) {\n selectionToDOM(this, forceSelUpdate);\n } else {\n syncNodeSelection(this, state.selection);\n this.domObserver.setCurSelection();\n }\n this.domObserver.start();\n }\n this.updatePluginViews(prev);\n if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc)) this.updateDraggedNode(this.dragging, prev);\n if (scroll == \"reset\") {\n this.dom.scrollTop = 0;\n } else if (scroll == \"to selection\") {\n this.scrollToSelection();\n } else if (oldScrollPos) {\n resetScrollPos(oldScrollPos);\n }\n }\n /**\n @internal\n */\n scrollToSelection() {\n let startDOM = this.domSelectionRange().focusNode;\n if (this.someProp(\"handleScrollToSelection\", f => f(this))) ;else if (this.state.selection instanceof NodeSelection) {\n let target = this.docView.domAfterPos(this.state.selection.from);\n if (target.nodeType == 1) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);\n } else {\n scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);\n }\n }\n destroyPluginViews() {\n let view;\n while (view = this.pluginViews.pop()) if (view.destroy) view.destroy();\n }\n updatePluginViews(prevState) {\n if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {\n this.prevDirectPlugins = this.directPlugins;\n this.destroyPluginViews();\n for (let i = 0; i < this.directPlugins.length; i++) {\n let plugin = this.directPlugins[i];\n if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));\n }\n for (let i = 0; i < this.state.plugins.length; i++) {\n let plugin = this.state.plugins[i];\n if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));\n }\n } else {\n for (let i = 0; i < this.pluginViews.length; i++) {\n let pluginView = this.pluginViews[i];\n if (pluginView.update) pluginView.update(this, prevState);\n }\n }\n }\n updateDraggedNode(dragging, prev) {\n let sel = dragging.node,\n found = -1;\n if (this.state.doc.nodeAt(sel.from) == sel.node) {\n found = sel.from;\n } else {\n let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);\n let moved = movedPos > 0 && this.state.doc.nodeAt(movedPos);\n if (moved == sel.node) found = movedPos;\n }\n this.dragging = new Dragging(dragging.slice, dragging.move, found < 0 ? undefined : NodeSelection.create(this.state.doc, found));\n }\n someProp(propName, f) {\n let prop = this._props && this._props[propName],\n value;\n if (prop != null && (value = f ? f(prop) : prop)) return value;\n for (let i = 0; i < this.directPlugins.length; i++) {\n let prop = this.directPlugins[i].props[propName];\n if (prop != null && (value = f ? f(prop) : prop)) return value;\n }\n let plugins = this.state.plugins;\n if (plugins) for (let i = 0; i < plugins.length; i++) {\n let prop = plugins[i].props[propName];\n if (prop != null && (value = f ? f(prop) : prop)) return value;\n }\n }\n /**\n Query whether the view has focus.\n */\n hasFocus() {\n // Work around IE not handling focus correctly if resize handles are shown.\n // If the cursor is inside an element with resize handles, activeElement\n // will be that element instead of this.dom.\n if (ie) {\n // If activeElement is within this.dom, and there are no other elements\n // setting `contenteditable` to false in between, treat it as focused.\n let node = this.root.activeElement;\n if (node == this.dom) return true;\n if (!node || !this.dom.contains(node)) return false;\n while (node && this.dom != node && this.dom.contains(node)) {\n if (node.contentEditable == 'false') return false;\n node = node.parentElement;\n }\n return true;\n }\n return this.root.activeElement == this.dom;\n }\n /**\n Focus the editor.\n */\n focus() {\n this.domObserver.stop();\n if (this.editable) focusPreventScroll(this.dom);\n selectionToDOM(this);\n this.domObserver.start();\n }\n /**\n Get the document root in which the editor exists. This will\n usually be the top-level `document`, but might be a [shadow\n DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)\n root if the editor is inside one.\n */\n get root() {\n let cached = this._root;\n if (cached == null) for (let search = this.dom.parentNode; search; search = search.parentNode) {\n if (search.nodeType == 9 || search.nodeType == 11 && search.host) {\n if (!search.getSelection) Object.getPrototypeOf(search).getSelection = () => search.ownerDocument.getSelection();\n return this._root = search;\n }\n }\n return cached || document;\n }\n /**\n When an existing editor view is moved to a new document or\n shadow tree, call this to make it recompute its root.\n */\n updateRoot() {\n this._root = null;\n }\n /**\n Given a pair of viewport coordinates, return the document\n position that corresponds to them. May return null if the given\n coordinates aren't inside of the editor. When an object is\n returned, its `pos` property is the position nearest to the\n coordinates, and its `inside` property holds the position of the\n inner node that the position falls inside of, or -1 if it is at\n the top level, not in any node.\n */\n posAtCoords(coords) {\n return posAtCoords(this, coords);\n }\n /**\n Returns the viewport rectangle at a given document position.\n `left` and `right` will be the same number, as this returns a\n flat cursor-ish rectangle. If the position is between two things\n that aren't directly adjacent, `side` determines which element\n is used. When < 0, the element before the position is used,\n otherwise the element after.\n */\n coordsAtPos(pos, side = 1) {\n return coordsAtPos(this, pos, side);\n }\n /**\n Find the DOM position that corresponds to the given document\n position. When `side` is negative, find the position as close as\n possible to the content before the position. When positive,\n prefer positions close to the content after the position. When\n zero, prefer as shallow a position as possible.\n \n Note that you should **not** mutate the editor's internal DOM,\n only inspect it (and even that is usually not necessary).\n */\n domAtPos(pos, side = 0) {\n return this.docView.domFromPos(pos, side);\n }\n /**\n Find the DOM node that represents the document node after the\n given position. May return `null` when the position doesn't point\n in front of a node or if the node is inside an opaque node view.\n \n This is intended to be able to call things like\n `getBoundingClientRect` on that DOM node. Do **not** mutate the\n editor DOM directly, or add styling this way, since that will be\n immediately overriden by the editor as it redraws the node.\n */\n nodeDOM(pos) {\n let desc = this.docView.descAt(pos);\n return desc ? desc.nodeDOM : null;\n }\n /**\n Find the document position that corresponds to a given DOM\n position. (Whenever possible, it is preferable to inspect the\n document structure directly, rather than poking around in the\n DOM, but sometimes—for example when interpreting an event\n target—you don't have a choice.)\n \n The `bias` parameter can be used to influence which side of a DOM\n node to use when the position is inside a leaf node.\n */\n posAtDOM(node, offset, bias = -1) {\n let pos = this.docView.posFromDOM(node, offset, bias);\n if (pos == null) throw new RangeError(\"DOM position not inside the editor\");\n return pos;\n }\n /**\n Find out whether the selection is at the end of a textblock when\n moving in a given direction. When, for example, given `\"left\"`,\n it will return true if moving left from the current cursor\n position would leave that position's parent textblock. Will apply\n to the view's current state by default, but it is possible to\n pass a different state.\n */\n endOfTextblock(dir, state) {\n return endOfTextblock(this, state || this.state, dir);\n }\n /**\n Run the editor's paste logic with the given HTML string. The\n `event`, if given, will be passed to the\n [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.\n */\n pasteHTML(html, event) {\n return doPaste(this, \"\", html, false, event || new ClipboardEvent(\"paste\"));\n }\n /**\n Run the editor's paste logic with the given plain-text input.\n */\n pasteText(text, event) {\n return doPaste(this, text, null, true, event || new ClipboardEvent(\"paste\"));\n }\n /**\n Removes the editor from the DOM and destroys all [node\n views](https://prosemirror.net/docs/ref/#view.NodeView).\n */\n destroy() {\n if (!this.docView) return;\n destroyInput(this);\n this.destroyPluginViews();\n if (this.mounted) {\n this.docView.update(this.state.doc, [], viewDecorations(this), this);\n this.dom.textContent = \"\";\n } else if (this.dom.parentNode) {\n this.dom.parentNode.removeChild(this.dom);\n }\n this.docView.destroy();\n this.docView = null;\n clearReusedRange();\n }\n /**\n This is true when the view has been\n [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be\n used anymore).\n */\n get isDestroyed() {\n return this.docView == null;\n }\n /**\n Used for testing.\n */\n dispatchEvent(event) {\n return dispatchEvent(this, event);\n }\n /**\n Dispatch a transaction. Will call\n [`dispatchTransaction`](https://prosemirror.net/docs/ref/#view.DirectEditorProps.dispatchTransaction)\n when given, and otherwise defaults to applying the transaction to\n the current state and calling\n [`updateState`](https://prosemirror.net/docs/ref/#view.EditorView.updateState) with the result.\n This method is bound to the view instance, so that it can be\n easily passed around.\n */\n dispatch(tr) {\n let dispatchTransaction = this._props.dispatchTransaction;\n if (dispatchTransaction) dispatchTransaction.call(this, tr);else this.updateState(this.state.apply(tr));\n }\n /**\n @internal\n */\n domSelectionRange() {\n let sel = this.domSelection();\n if (!sel) return {\n focusNode: null,\n focusOffset: 0,\n anchorNode: null,\n anchorOffset: 0\n };\n return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;\n }\n /**\n @internal\n */\n domSelection() {\n return this.root.getSelection();\n }\n}\nfunction computeDocDeco(view) {\n let attrs = Object.create(null);\n attrs.class = \"ProseMirror\";\n attrs.contenteditable = String(view.editable);\n view.someProp(\"attributes\", value => {\n if (typeof value == \"function\") value = value(view.state);\n if (value) for (let attr in value) {\n if (attr == \"class\") attrs.class += \" \" + value[attr];else if (attr == \"style\") attrs.style = (attrs.style ? attrs.style + \";\" : \"\") + value[attr];else if (!attrs[attr] && attr != \"contenteditable\" && attr != \"nodeName\") attrs[attr] = String(value[attr]);\n }\n });\n if (!attrs.translate) attrs.translate = \"no\";\n return [Decoration.node(0, view.state.doc.content.size, attrs)];\n}\nfunction updateCursorWrapper(view) {\n if (view.markCursor) {\n let dom = document.createElement(\"img\");\n dom.className = \"ProseMirror-separator\";\n dom.setAttribute(\"mark-placeholder\", \"true\");\n dom.setAttribute(\"alt\", \"\");\n view.cursorWrapper = {\n dom,\n deco: Decoration.widget(view.state.selection.from, dom, {\n raw: true,\n marks: view.markCursor\n })\n };\n } else {\n view.cursorWrapper = null;\n }\n}\nfunction getEditable(view) {\n return !view.someProp(\"editable\", value => value(view.state) === false);\n}\nfunction selectionContextChanged(sel1, sel2) {\n let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));\n return sel1.$anchor.start(depth) != sel2.$anchor.start(depth);\n}\nfunction buildNodeViews(view) {\n let result = Object.create(null);\n function add(obj) {\n for (let prop in obj) if (!Object.prototype.hasOwnProperty.call(result, prop)) result[prop] = obj[prop];\n }\n view.someProp(\"nodeViews\", add);\n view.someProp(\"markViews\", add);\n return result;\n}\nfunction changedNodeViews(a, b) {\n let nA = 0,\n nB = 0;\n for (let prop in a) {\n if (a[prop] != b[prop]) return true;\n nA++;\n }\n for (let _ in b) nB++;\n return nA != nB;\n}\nfunction checkStateComponent(plugin) {\n if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction) throw new RangeError(\"Plugins passed directly to the view must not have a state component\");\n}\nexport { Decoration, DecorationSet, EditorView, __endComposition, __parseFromClipboard, __serializeForClipboard };","export var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\"\n};\nexport var shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \":\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\"\n};\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform);\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i);\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i;\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32);\n shift[i] = String.fromCharCode(i);\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code];\nexport function keyName(event) {\n // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.\n // On IE, shift effect is never included in `.key`.\n var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == \"Unidentified\";\n var name = !ignoreKey && event.key || (event.shiftKey ? shift : base)[event.keyCode] || event.key || \"Unidentified\";\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\";\n if (name == \"Del\") name = \"Delete\";\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\";\n if (name == \"Up\") name = \"ArrowUp\";\n if (name == \"Right\") name = \"ArrowRight\";\n if (name == \"Down\") name = \"ArrowDown\";\n return name;\n}","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : false;\nfunction normalizeKeyName(name) {\n let parts = name.split(/-(?!$)/),\n result = parts[parts.length - 1];\n if (result == \"Space\") result = \" \";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; i++) {\n let mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) meta = true;else if (/^a(lt)?$/i.test(mod)) alt = true;else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;else if (/^s(hift)?$/i.test(mod)) shift = true;else if (/^mod$/i.test(mod)) {\n if (mac) meta = true;else ctrl = true;\n } else throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt) result = \"Alt-\" + result;\n if (ctrl) result = \"Ctrl-\" + result;\n if (meta) result = \"Meta-\" + result;\n if (shift) result = \"Shift-\" + result;\n return result;\n}\nfunction normalize(map) {\n let copy = Object.create(null);\n for (let prop in map) copy[normalizeKeyName(prop)] = map[prop];\n return copy;\n}\nfunction modifiers(name, event, shift = true) {\n if (event.altKey) name = \"Alt-\" + name;\n if (event.ctrlKey) name = \"Ctrl-\" + name;\n if (event.metaKey) name = \"Meta-\" + name;\n if (shift && event.shiftKey) name = \"Shift-\" + name;\n return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n return new Plugin({\n props: {\n handleKeyDown: keydownHandler(bindings)\n }\n });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n let map = normalize(bindings);\n return function (view, event) {\n let name = keyName(event),\n baseName,\n direct = map[modifiers(name, event)];\n if (direct && direct(view.state, view.dispatch, view)) return true;\n // A character key\n if (name.length == 1 && name != \" \") {\n if (event.shiftKey) {\n // In case the name was already modified by shift, try looking\n // it up without its shift modifier\n let noShift = map[modifiers(name, event, false)];\n if (noShift && noShift(view.state, view.dispatch, view)) return true;\n }\n if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) && (baseName = base[event.keyCode]) && baseName != name) {\n // Try falling back to the keyCode when there's a modifier\n // active or the character produced isn't ASCII, and our table\n // produces a different name from the the keyCode. See #668,\n // #1060\n let fromCode = map[modifiers(baseName, event)];\n if (fromCode && fromCode(view.state, view.dispatch, view)) return true;\n }\n }\n return false;\n };\n}\nexport { keydownHandler, keymap };","import { liftTarget, replaceStep, ReplaceStep, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { NodeSelection, Selection, TextSelection, AllSelection, SelectionRange } from 'prosemirror-state';\n\n/**\nDelete the selection, if there is one.\n*/\nconst deleteSelection = (state, dispatch) => {\n if (state.selection.empty) return false;\n if (dispatch) dispatch(state.tr.deleteSelection().scrollIntoView());\n return true;\n};\nfunction atBlockStart(state, view) {\n let {\n $cursor\n } = state.selection;\n if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state) : $cursor.parentOffset > 0)) return null;\n return $cursor;\n}\n/**\nIf the selection is empty and at the start of a textblock, try to\nreduce the distance between that block and the one before it—if\nthere's a block directly before it that can be joined, join them.\nIf not, try to move the selected block closer to the next one in\nthe document structure by lifting it out of its parent or moving it\ninto a parent of the previous block. Will use the view for accurate\n(bidi-aware) start-of-textblock detection if given.\n*/\nconst joinBackward = (state, dispatch, view) => {\n let $cursor = atBlockStart(state, view);\n if (!$cursor) return false;\n let $cut = findCutBefore($cursor);\n // If there is no node before this, try to lift\n if (!$cut) {\n let range = $cursor.blockRange(),\n target = range && liftTarget(range);\n if (target == null) return false;\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n }\n let before = $cut.nodeBefore;\n // Apply the joining algorithm\n if (deleteBarrier(state, $cut, dispatch, -1)) return true;\n // If the node below has no content and the node above is\n // selectable, delete the node below and select the one above.\n if ($cursor.parent.content.size == 0 && (textblockAt(before, \"end\") || NodeSelection.isSelectable(before))) {\n for (let depth = $cursor.depth;; depth--) {\n let delStep = replaceStep(state.doc, $cursor.before(depth), $cursor.after(depth), Slice.empty);\n if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n if (dispatch) {\n let tr = state.tr.step(delStep);\n tr.setSelection(textblockAt(before, \"end\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1) : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n if (depth == 1 || $cursor.node(depth - 1).childCount > 1) break;\n }\n }\n // If the node before is an atom, delete it\n if (before.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView());\n return true;\n }\n return false;\n};\n/**\nA more limited form of [`joinBackward`]($commands.joinBackward)\nthat only tries to join the current textblock to the one before\nit, if the cursor is at the start of a textblock.\n*/\nconst joinTextblockBackward = (state, dispatch, view) => {\n let $cursor = atBlockStart(state, view);\n if (!$cursor) return false;\n let $cut = findCutBefore($cursor);\n return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\n/**\nA more limited form of [`joinForward`]($commands.joinForward)\nthat only tries to join the current textblock to the one after\nit, if the cursor is at the end of a textblock.\n*/\nconst joinTextblockForward = (state, dispatch, view) => {\n let $cursor = atBlockEnd(state, view);\n if (!$cursor) return false;\n let $cut = findCutAfter($cursor);\n return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\nfunction joinTextblocksAround(state, $cut, dispatch) {\n let before = $cut.nodeBefore,\n beforeText = before,\n beforePos = $cut.pos - 1;\n for (; !beforeText.isTextblock; beforePos--) {\n if (beforeText.type.spec.isolating) return false;\n let child = beforeText.lastChild;\n if (!child) return false;\n beforeText = child;\n }\n let after = $cut.nodeAfter,\n afterText = after,\n afterPos = $cut.pos + 1;\n for (; !afterText.isTextblock; afterPos++) {\n if (afterText.type.spec.isolating) return false;\n let child = afterText.firstChild;\n if (!child) return false;\n afterText = child;\n }\n let step = replaceStep(state.doc, beforePos, afterPos, Slice.empty);\n if (!step || step.from != beforePos || step instanceof ReplaceStep && step.slice.size >= afterPos - beforePos) return false;\n if (dispatch) {\n let tr = state.tr.step(step);\n tr.setSelection(TextSelection.create(tr.doc, beforePos));\n dispatch(tr.scrollIntoView());\n }\n return true;\n}\nfunction textblockAt(node, side, only = false) {\n for (let scan = node; scan; scan = side == \"start\" ? scan.firstChild : scan.lastChild) {\n if (scan.isTextblock) return true;\n if (only && scan.childCount != 1) return false;\n }\n return false;\n}\n/**\nWhen the selection is empty and at the start of a textblock, select\nthe node before that textblock, if possible. This is intended to be\nbound to keys like backspace, after\n[`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward) or other deleting\ncommands, as a fall-back behavior when the schema doesn't allow\ndeletion at the selected point.\n*/\nconst selectNodeBackward = (state, dispatch, view) => {\n let {\n $head,\n empty\n } = state.selection,\n $cut = $head;\n if (!empty) return false;\n if ($head.parent.isTextblock) {\n if (view ? !view.endOfTextblock(\"backward\", state) : $head.parentOffset > 0) return false;\n $cut = findCutBefore($head);\n }\n let node = $cut && $cut.nodeBefore;\n if (!node || !NodeSelection.isSelectable(node)) return false;\n if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView());\n return true;\n};\nfunction findCutBefore($pos) {\n if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {\n if ($pos.index(i) > 0) return $pos.doc.resolve($pos.before(i + 1));\n if ($pos.node(i).type.spec.isolating) break;\n }\n return null;\n}\nfunction atBlockEnd(state, view) {\n let {\n $cursor\n } = state.selection;\n if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state) : $cursor.parentOffset < $cursor.parent.content.size)) return null;\n return $cursor;\n}\n/**\nIf the selection is empty and the cursor is at the end of a\ntextblock, try to reduce or remove the boundary between that block\nand the one after it, either by joining them or by moving the other\nblock closer to this one in the tree structure. Will use the view\nfor accurate start-of-textblock detection if given.\n*/\nconst joinForward = (state, dispatch, view) => {\n let $cursor = atBlockEnd(state, view);\n if (!$cursor) return false;\n let $cut = findCutAfter($cursor);\n // If there is no node after this, there's nothing to do\n if (!$cut) return false;\n let after = $cut.nodeAfter;\n // Try the joining algorithm\n if (deleteBarrier(state, $cut, dispatch, 1)) return true;\n // If the node above has no content and the node below is\n // selectable, delete the node above and select the one below.\n if ($cursor.parent.content.size == 0 && (textblockAt(after, \"start\") || NodeSelection.isSelectable(after))) {\n let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty);\n if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n if (dispatch) {\n let tr = state.tr.step(delStep);\n tr.setSelection(textblockAt(after, \"start\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1) : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n }\n // If the next node is an atom, delete it\n if (after.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView());\n return true;\n }\n return false;\n};\n/**\nWhen the selection is empty and at the end of a textblock, select\nthe node coming after that textblock, if possible. This is intended\nto be bound to keys like delete, after\n[`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward) and similar deleting\ncommands, to provide a fall-back behavior when the schema doesn't\nallow deletion at the selected point.\n*/\nconst selectNodeForward = (state, dispatch, view) => {\n let {\n $head,\n empty\n } = state.selection,\n $cut = $head;\n if (!empty) return false;\n if ($head.parent.isTextblock) {\n if (view ? !view.endOfTextblock(\"forward\", state) : $head.parentOffset < $head.parent.content.size) return false;\n $cut = findCutAfter($head);\n }\n let node = $cut && $cut.nodeAfter;\n if (!node || !NodeSelection.isSelectable(node)) return false;\n if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView());\n return true;\n};\nfunction findCutAfter($pos) {\n if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {\n let parent = $pos.node(i);\n if ($pos.index(i) + 1 < parent.childCount) return $pos.doc.resolve($pos.after(i + 1));\n if (parent.type.spec.isolating) break;\n }\n return null;\n}\n/**\nJoin the selected block or, if there is a text selection, the\nclosest ancestor block of the selection that can be joined, with\nthe sibling above it.\n*/\nconst joinUp = (state, dispatch) => {\n let sel = state.selection,\n nodeSel = sel instanceof NodeSelection,\n point;\n if (nodeSel) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.from)) return false;\n point = sel.from;\n } else {\n point = joinPoint(state.doc, sel.from, -1);\n if (point == null) return false;\n }\n if (dispatch) {\n let tr = state.tr.join(point);\n if (nodeSel) tr.setSelection(NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nJoin the selected block, or the closest ancestor of the selection\nthat can be joined, with the sibling after it.\n*/\nconst joinDown = (state, dispatch) => {\n let sel = state.selection,\n point;\n if (sel instanceof NodeSelection) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.to)) return false;\n point = sel.to;\n } else {\n point = joinPoint(state.doc, sel.to, 1);\n if (point == null) return false;\n }\n if (dispatch) dispatch(state.tr.join(point).scrollIntoView());\n return true;\n};\n/**\nLift the selected block, or the closest ancestor block of the\nselection that can be lifted, out of its parent node.\n*/\nconst lift = (state, dispatch) => {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to),\n target = range && liftTarget(range);\n if (target == null) return false;\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n};\n/**\nIf the selection is in a node whose type has a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, replace the\nselection with a newline character.\n*/\nconst newlineInCode = (state, dispatch) => {\n let {\n $head,\n $anchor\n } = state.selection;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;\n if (dispatch) dispatch(state.tr.insertText(\"\\n\").scrollIntoView());\n return true;\n};\nfunction defaultBlockAt(match) {\n for (let i = 0; i < match.edgeCount; i++) {\n let {\n type\n } = match.edge(i);\n if (type.isTextblock && !type.hasRequiredAttrs()) return type;\n }\n return null;\n}\n/**\nWhen the selection is in a node with a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, create a\ndefault block after the code block, and move the cursor there.\n*/\nconst exitCode = (state, dispatch) => {\n let {\n $head,\n $anchor\n } = state.selection;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;\n let above = $head.node(-1),\n after = $head.indexAfter(-1),\n type = defaultBlockAt(above.contentMatchAt(after));\n if (!type || !above.canReplaceWith(after, after, type)) return false;\n if (dispatch) {\n let pos = $head.after(),\n tr = state.tr.replaceWith(pos, pos, type.createAndFill());\n tr.setSelection(Selection.near(tr.doc.resolve(pos), 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nIf a block node is selected, create an empty paragraph before (if\nit is its parent's first child) or after it.\n*/\nconst createParagraphNear = (state, dispatch) => {\n let sel = state.selection,\n {\n $from,\n $to\n } = sel;\n if (sel instanceof AllSelection || $from.parent.inlineContent || $to.parent.inlineContent) return false;\n let type = defaultBlockAt($to.parent.contentMatchAt($to.indexAfter()));\n if (!type || !type.isTextblock) return false;\n if (dispatch) {\n let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;\n let tr = state.tr.insert(side, type.createAndFill());\n tr.setSelection(TextSelection.create(tr.doc, side + 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nIf the cursor is in an empty textblock that can be lifted, lift the\nblock.\n*/\nconst liftEmptyBlock = (state, dispatch) => {\n let {\n $cursor\n } = state.selection;\n if (!$cursor || $cursor.parent.content.size) return false;\n if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {\n let before = $cursor.before();\n if (canSplit(state.doc, before)) {\n if (dispatch) dispatch(state.tr.split(before).scrollIntoView());\n return true;\n }\n }\n let range = $cursor.blockRange(),\n target = range && liftTarget(range);\n if (target == null) return false;\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n};\n/**\nCreate a variant of [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock) that uses\na custom function to determine the type of the newly split off block.\n*/\nfunction splitBlockAs(splitNode) {\n return (state, dispatch) => {\n let {\n $from,\n $to\n } = state.selection;\n if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {\n if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) return false;\n if (dispatch) dispatch(state.tr.split($from.pos).scrollIntoView());\n return true;\n }\n if (!$from.depth) return false;\n let types = [];\n let splitDepth,\n deflt,\n atEnd = false,\n atStart = false;\n for (let d = $from.depth;; d--) {\n let node = $from.node(d);\n if (node.isBlock) {\n atEnd = $from.end(d) == $from.pos + ($from.depth - d);\n atStart = $from.start(d) == $from.pos - ($from.depth - d);\n deflt = defaultBlockAt($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));\n let splitType = splitNode && splitNode($to.parent, atEnd, $from);\n types.unshift(splitType || (atEnd && deflt ? {\n type: deflt\n } : null));\n splitDepth = d;\n break;\n } else {\n if (d == 1) return false;\n types.unshift(null);\n }\n }\n let tr = state.tr;\n if (state.selection instanceof TextSelection || state.selection instanceof AllSelection) tr.deleteSelection();\n let splitPos = tr.mapping.map($from.pos);\n let can = canSplit(tr.doc, splitPos, types.length, types);\n if (!can) {\n types[0] = deflt ? {\n type: deflt\n } : null;\n can = canSplit(tr.doc, splitPos, types.length, types);\n }\n tr.split(splitPos, types.length, types);\n if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {\n let first = tr.mapping.map($from.before(splitDepth)),\n $first = tr.doc.resolve(first);\n if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);\n }\n if (dispatch) dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nSplit the parent block of the selection. If the selection is a text\nselection, also delete its content.\n*/\nconst splitBlock = splitBlockAs();\n/**\nActs like [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock), but without\nresetting the set of active marks at the cursor.\n*/\nconst splitBlockKeepMarks = (state, dispatch) => {\n return splitBlock(state, dispatch && (tr => {\n let marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n if (marks) tr.ensureMarks(marks);\n dispatch(tr);\n }));\n};\n/**\nMove the selection to the node wrapping the current selection, if\nany. (Will not select the document node.)\n*/\nconst selectParentNode = (state, dispatch) => {\n let {\n $from,\n to\n } = state.selection,\n pos;\n let same = $from.sharedDepth(to);\n if (same == 0) return false;\n pos = $from.before(same);\n if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos)));\n return true;\n};\n/**\nSelect the whole document.\n*/\nconst selectAll = (state, dispatch) => {\n if (dispatch) dispatch(state.tr.setSelection(new AllSelection(state.doc)));\n return true;\n};\nfunction joinMaybeClear(state, $pos, dispatch) {\n let before = $pos.nodeBefore,\n after = $pos.nodeAfter,\n index = $pos.index();\n if (!before || !after || !before.type.compatibleContent(after.type)) return false;\n if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {\n if (dispatch) dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView());\n return true;\n }\n if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos))) return false;\n if (dispatch) dispatch(state.tr.join($pos.pos).scrollIntoView());\n return true;\n}\nfunction deleteBarrier(state, $cut, dispatch, dir) {\n let before = $cut.nodeBefore,\n after = $cut.nodeAfter,\n conn,\n match;\n let isolated = before.type.spec.isolating || after.type.spec.isolating;\n if (!isolated && joinMaybeClear(state, $cut, dispatch)) return true;\n let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);\n if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) {\n if (dispatch) {\n let end = $cut.pos + after.nodeSize,\n wrap = Fragment.empty;\n for (let i = conn.length - 1; i >= 0; i--) wrap = Fragment.from(conn[i].create(null, wrap));\n wrap = Fragment.from(before.copy(wrap));\n let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap, 1, 0), conn.length, true));\n let $joinAt = tr.doc.resolve(end + 2 * conn.length);\n if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr.doc, $joinAt.pos)) tr.join($joinAt.pos);\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let selAfter = after.type.spec.isolating || dir > 0 && isolated ? null : Selection.findFrom($cut, 1);\n let range = selAfter && selAfter.$from.blockRange(selAfter.$to),\n target = range && liftTarget(range);\n if (target != null && target >= $cut.depth) {\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n }\n if (canDelAfter && textblockAt(after, \"start\", true) && textblockAt(before, \"end\")) {\n let at = before,\n wrap = [];\n for (;;) {\n wrap.push(at);\n if (at.isTextblock) break;\n at = at.lastChild;\n }\n let afterText = after,\n afterDepth = 1;\n for (; !afterText.isTextblock; afterText = afterText.firstChild) afterDepth++;\n if (at.canReplace(at.childCount, at.childCount, afterText.content)) {\n if (dispatch) {\n let end = Fragment.empty;\n for (let i = wrap.length - 1; i >= 0; i--) end = Fragment.from(wrap[i].copy(end));\n let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap.length, 0), 0, true));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n }\n return false;\n}\nfunction selectTextblockSide(side) {\n return function (state, dispatch) {\n let sel = state.selection,\n $pos = side < 0 ? sel.$from : sel.$to;\n let depth = $pos.depth;\n while ($pos.node(depth).isInline) {\n if (!depth) return false;\n depth--;\n }\n if (!$pos.node(depth).isTextblock) return false;\n if (dispatch) dispatch(state.tr.setSelection(TextSelection.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));\n return true;\n };\n}\n/**\nMoves the cursor to the start of current text block.\n*/\nconst selectTextblockStart = selectTextblockSide(-1);\n/**\nMoves the cursor to the end of current text block.\n*/\nconst selectTextblockEnd = selectTextblockSide(1);\n// Parameterized commands\n/**\nWrap the selection in a node of the given type with the given\nattributes.\n*/\nfunction wrapIn(nodeType, attrs = null) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to),\n wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping) return false;\n if (dispatch) dispatch(state.tr.wrap(range, wrapping).scrollIntoView());\n return true;\n };\n}\n/**\nReturns a command that tries to set the selected textblocks to the\ngiven node type with the given attributes.\n*/\nfunction setBlockType(nodeType, attrs = null) {\n return function (state, dispatch) {\n let applicable = false;\n for (let i = 0; i < state.selection.ranges.length && !applicable; i++) {\n let {\n $from: {\n pos: from\n },\n $to: {\n pos: to\n }\n } = state.selection.ranges[i];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (applicable) return false;\n if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) return;\n if (node.type == nodeType) {\n applicable = true;\n } else {\n let $pos = state.doc.resolve(pos),\n index = $pos.index();\n applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);\n }\n });\n }\n if (!applicable) return false;\n if (dispatch) {\n let tr = state.tr;\n for (let i = 0; i < state.selection.ranges.length; i++) {\n let {\n $from: {\n pos: from\n },\n $to: {\n pos: to\n }\n } = state.selection.ranges[i];\n tr.setBlockType(from, to, nodeType, attrs);\n }\n dispatch(tr.scrollIntoView());\n }\n return true;\n };\n}\nfunction markApplies(doc, ranges, type, enterAtoms) {\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i];\n let can = $from.depth == 0 ? doc.inlineContent && doc.type.allowsMarkType(type) : false;\n doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (can || !enterAtoms && node.isAtom && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos) return false;\n can = node.inlineContent && node.type.allowsMarkType(type);\n });\n if (can) return true;\n }\n return false;\n}\nfunction removeInlineAtoms(ranges) {\n let result = [];\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i];\n $from.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (node.isAtom && node.content.size && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos) {\n if (pos + 1 > $from.pos) result.push(new SelectionRange($from, $from.doc.resolve(pos + 1)));\n $from = $from.doc.resolve(pos + 1 + node.content.size);\n return false;\n }\n });\n if ($from.pos < $to.pos) result.push(new SelectionRange($from, $to));\n }\n return result;\n}\n/**\nCreate a command function that toggles the given mark with the\ngiven attributes. Will return `false` when the current selection\ndoesn't support that mark. This will remove the mark if any marks\nof that type exist in the selection, or add it otherwise. If the\nselection is empty, this applies to the [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks) instead of a range of the\ndocument.\n*/\nfunction toggleMark(markType, attrs = null, options) {\n let removeWhenPresent = (options && options.removeWhenPresent) !== false;\n let enterAtoms = (options && options.enterInlineAtoms) !== false;\n return function (state, dispatch) {\n let {\n empty,\n $cursor,\n ranges\n } = state.selection;\n if (empty && !$cursor || !markApplies(state.doc, ranges, markType, enterAtoms)) return false;\n if (dispatch) {\n if ($cursor) {\n if (markType.isInSet(state.storedMarks || $cursor.marks())) dispatch(state.tr.removeStoredMark(markType));else dispatch(state.tr.addStoredMark(markType.create(attrs)));\n } else {\n let add,\n tr = state.tr;\n if (!enterAtoms) ranges = removeInlineAtoms(ranges);\n if (removeWhenPresent) {\n add = !ranges.some(r => state.doc.rangeHasMark(r.$from.pos, r.$to.pos, markType));\n } else {\n add = !ranges.every(r => {\n let missing = false;\n tr.doc.nodesBetween(r.$from.pos, r.$to.pos, (node, pos, parent) => {\n if (missing) return false;\n missing = !markType.isInSet(node.marks) && !!parent && parent.type.allowsMarkType(markType) && !(node.isText && /^\\s*$/.test(node.textBetween(Math.max(0, r.$from.pos - pos), Math.min(node.nodeSize, r.$to.pos - pos))));\n });\n return !missing;\n });\n }\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i];\n if (!add) {\n tr.removeMark($from.pos, $to.pos, markType);\n } else {\n let from = $from.pos,\n to = $to.pos,\n start = $from.nodeAfter,\n end = $to.nodeBefore;\n let spaceStart = start && start.isText ? /^\\s*/.exec(start.text)[0].length : 0;\n let spaceEnd = end && end.isText ? /\\s*$/.exec(end.text)[0].length : 0;\n if (from + spaceStart < to) {\n from += spaceStart;\n to -= spaceEnd;\n }\n tr.addMark(from, to, markType.create(attrs));\n }\n }\n dispatch(tr.scrollIntoView());\n }\n }\n return true;\n };\n}\nfunction wrapDispatchForJoin(dispatch, isJoinable) {\n return tr => {\n if (!tr.isGeneric) return dispatch(tr);\n let ranges = [];\n for (let i = 0; i < tr.mapping.maps.length; i++) {\n let map = tr.mapping.maps[i];\n for (let j = 0; j < ranges.length; j++) ranges[j] = map.map(ranges[j]);\n map.forEach((_s, _e, from, to) => ranges.push(from, to));\n }\n // Figure out which joinable points exist inside those ranges,\n // by checking all node boundaries in their parent nodes.\n let joinable = [];\n for (let i = 0; i < ranges.length; i += 2) {\n let from = ranges[i],\n to = ranges[i + 1];\n let $from = tr.doc.resolve(from),\n depth = $from.sharedDepth(to),\n parent = $from.node(depth);\n for (let index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {\n let after = parent.maybeChild(index);\n if (!after) break;\n if (index && joinable.indexOf(pos) == -1) {\n let before = parent.child(index - 1);\n if (before.type == after.type && isJoinable(before, after)) joinable.push(pos);\n }\n pos += after.nodeSize;\n }\n }\n // Join the joinable points\n joinable.sort((a, b) => a - b);\n for (let i = joinable.length - 1; i >= 0; i--) {\n if (canJoin(tr.doc, joinable[i])) tr.join(joinable[i]);\n }\n dispatch(tr);\n };\n}\n/**\nWrap a command so that, when it produces a transform that causes\ntwo joinable nodes to end up next to each other, those are joined.\nNodes are considered joinable when they are of the same type and\nwhen the `isJoinable` predicate returns true for them or, if an\narray of strings was passed, if their node type name is in that\narray.\n*/\nfunction autoJoin(command, isJoinable) {\n let canJoin = Array.isArray(isJoinable) ? node => isJoinable.indexOf(node.type.name) > -1 : isJoinable;\n return (state, dispatch, view) => command(state, dispatch && wrapDispatchForJoin(dispatch, canJoin), view);\n}\n/**\nCombine a number of command functions into a single function (which\ncalls them one by one until one returns true).\n*/\nfunction chainCommands(...commands) {\n return function (state, dispatch, view) {\n for (let i = 0; i < commands.length; i++) if (commands[i](state, dispatch, view)) return true;\n return false;\n };\n}\nlet backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);\nlet del = chainCommands(deleteSelection, joinForward, selectNodeForward);\n/**\nA basic keymap containing bindings not specific to any schema.\nBinds the following keys (when multiple commands are listed, they\nare chained with [`chainCommands`](https://prosemirror.net/docs/ref/#commands.chainCommands)):\n\n* **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`\n* **Mod-Enter** to `exitCode`\n* **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`\n* **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-a** to `selectAll`\n*/\nconst pcBaseKeymap = {\n \"Enter\": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),\n \"Mod-Enter\": exitCode,\n \"Backspace\": backspace,\n \"Mod-Backspace\": backspace,\n \"Shift-Backspace\": backspace,\n \"Delete\": del,\n \"Mod-Delete\": del,\n \"Mod-a\": selectAll\n};\n/**\nA copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,\n**Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and\n**Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like\nCtrl-Delete.\n*/\nconst macBaseKeymap = {\n \"Ctrl-h\": pcBaseKeymap[\"Backspace\"],\n \"Alt-Backspace\": pcBaseKeymap[\"Mod-Backspace\"],\n \"Ctrl-d\": pcBaseKeymap[\"Delete\"],\n \"Ctrl-Alt-Backspace\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-Delete\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-d\": pcBaseKeymap[\"Mod-Delete\"],\n \"Ctrl-a\": selectTextblockStart,\n \"Ctrl-e\": selectTextblockEnd\n};\nfor (let key in pcBaseKeymap) macBaseKeymap[key] = pcBaseKeymap[key];\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform)\n// @ts-ignore\n: typeof os != \"undefined\" && os.platform ? os.platform() == \"darwin\" : false;\n/**\nDepending on the detected platform, this will hold\n[`pcBasekeymap`](https://prosemirror.net/docs/ref/#commands.pcBaseKeymap) or\n[`macBaseKeymap`](https://prosemirror.net/docs/ref/#commands.macBaseKeymap).\n*/\nconst baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinTextblockBackward, joinTextblockForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, setBlockType, splitBlock, splitBlockAs, splitBlockKeepMarks, toggleMark, wrapIn };","import { findWrapping, ReplaceAroundStep, canSplit, liftTarget, canJoin } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice } from 'prosemirror-model';\nimport { Selection } from 'prosemirror-state';\nconst olDOM = [\"ol\", 0],\n ulDOM = [\"ul\", 0],\n liDOM = [\"li\", 0];\n/**\nAn ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single\nattribute, `order`, which determines the number at which the list\nstarts counting, and defaults to 1. Represented as an `
    `\nelement.\n*/\nconst orderedList = {\n attrs: {\n order: {\n default: 1,\n validate: \"number\"\n }\n },\n parseDOM: [{\n tag: \"ol\",\n getAttrs(dom) {\n return {\n order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1\n };\n }\n }],\n toDOM(node) {\n return node.attrs.order == 1 ? olDOM : [\"ol\", {\n start: node.attrs.order\n }, 0];\n }\n};\n/**\nA bullet list node spec, represented in the DOM as `
      `.\n*/\nconst bulletList = {\n parseDOM: [{\n tag: \"ul\"\n }],\n toDOM() {\n return ulDOM;\n }\n};\n/**\nA list item (`
    • `) spec.\n*/\nconst listItem = {\n parseDOM: [{\n tag: \"li\"\n }],\n toDOM() {\n return liDOM;\n },\n defining: true\n};\nfunction add(obj, props) {\n let copy = {};\n for (let prop in obj) copy[prop] = obj[prop];\n for (let prop in props) copy[prop] = props[prop];\n return copy;\n}\n/**\nConvenience function for adding list-related node types to a map\nspecifying the nodes for a schema. Adds\n[`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `\"ordered_list\"`,\n[`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `\"bullet_list\"`, and\n[`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `\"list_item\"`.\n\n`itemContent` determines the content expression for the list items.\nIf you want the commands defined in this module to apply to your\nlist structure, it should have a shape like `\"paragraph block*\"` or\n`\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\ngiven to assign a group name to the list node types, for example\n`\"block\"`.\n*/\nfunction addListNodes(nodes, itemContent, listGroup) {\n return nodes.append({\n ordered_list: add(orderedList, {\n content: \"list_item+\",\n group: listGroup\n }),\n bullet_list: add(bulletList, {\n content: \"list_item+\",\n group: listGroup\n }),\n list_item: add(listItem, {\n content: itemContent\n })\n });\n}\n/**\nReturns a command function that wraps the selection in a list with\nthe given type an attributes. If `dispatch` is null, only return a\nvalue to indicate whether this is possible, but don't actually\nperform the change.\n*/\nfunction wrapInList(listType, attrs = null) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to);\n if (!range) return false;\n let tr = dispatch ? state.tr : null;\n if (!wrapRangeInList(tr, range, listType, attrs)) return false;\n if (dispatch) dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nTry to wrap the given node range in a list of the given type.\nReturn `true` when this is possible, `false` otherwise. When `tr`\nis non-null, the wrapping is added to that transaction. When it is\n`null`, the function only queries whether the wrapping is\npossible.\n*/\nfunction wrapRangeInList(tr, range, listType, attrs = null) {\n let doJoin = false,\n outerRange = range,\n doc = range.$from.doc;\n // This is at the top of an existing list item\n if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n // Don't do anything if this is the top of the list\n if (range.$from.index(range.depth - 1) == 0) return false;\n let $insert = doc.resolve(range.start - 2);\n outerRange = new NodeRange($insert, $insert, range.depth);\n if (range.endIndex < range.parent.childCount) range = new NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);\n doJoin = true;\n }\n let wrap = findWrapping(outerRange, listType, attrs, range);\n if (!wrap) return false;\n if (tr) doWrapInList(tr, range, wrap, doJoin, listType);\n return true;\n}\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--) content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));\n let found = 0;\n for (let i = 0; i < wrappers.length; i++) if (wrappers[i].type == listType) found = i + 1;\n let splitDepth = wrappers.length - found;\n let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0),\n parent = range.parent;\n for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {\n if (!first && canSplit(tr.doc, splitPos, splitDepth)) {\n tr.split(splitPos, splitDepth);\n splitPos += 2 * splitDepth;\n }\n splitPos += parent.child(i).nodeSize;\n }\n return tr;\n}\n/**\nBuild a command that splits a non-empty textblock at the top level\nof a list item by also splitting that list item.\n*/\nfunction splitListItem(itemType, itemAttrs) {\n return function (state, dispatch) {\n let {\n $from,\n $to,\n node\n } = state.selection;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;\n let grandParent = $from.node(-1);\n if (grandParent.type != itemType) return false;\n if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 3 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1) return false;\n if (dispatch) {\n let wrap = Fragment.empty;\n let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--) wrap = Fragment.from($from.node(d).copy(wrap));\n let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n // Add a second list item with an empty default start node\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n let start = $from.before($from.depth - (depthBefore - 1));\n let tr = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n let sel = -1;\n tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {\n if (sel > -1) return false;\n if (node.isTextblock && node.content.size == 0) sel = pos + 1;\n });\n if (sel > -1) tr.setSelection(Selection.near(tr.doc.resolve(sel)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n let tr = state.tr.delete($from.pos, $to.pos);\n let types = nextType ? [itemAttrs ? {\n type: itemType,\n attrs: itemAttrs\n } : null, {\n type: nextType\n }] : undefined;\n if (!canSplit(tr.doc, $from.pos, 2, types)) return false;\n if (dispatch) dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/**\nActs like [`splitListItem`](https://prosemirror.net/docs/ref/#schema-list.splitListItem), but\nwithout resetting the set of active marks at the cursor.\n*/\nfunction splitListItemKeepMarks(itemType, itemAttrs) {\n let split = splitListItem(itemType, itemAttrs);\n return (state, dispatch) => {\n return split(state, dispatch && (tr => {\n let marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n if (marks) tr.ensureMarks(marks);\n dispatch(tr);\n }));\n };\n}\n/**\nCreate a command to lift the list item around the selection up into\na wrapping list.\n*/\nfunction liftListItem(itemType) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range) return false;\n if (!dispatch) return true;\n if ($from.node(range.depth - 1).type == itemType)\n // Inside a parent list\n return liftToOuterList(state, dispatch, itemType, range);else\n // Outer list node\n return liftOutOfList(state, dispatch, range);\n };\n}\nfunction liftToOuterList(state, dispatch, itemType, range) {\n let tr = state.tr,\n end = range.end,\n endOfList = range.$to.end(range.depth);\n if (end < endOfList) {\n // There are siblings after the lifted items, which must become\n // children of the last item\n tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n }\n const target = liftTarget(range);\n if (target == null) return false;\n tr.lift(range, target);\n let after = tr.mapping.map(end, -1) - 1;\n if (canJoin(tr.doc, after)) tr.join(after);\n dispatch(tr.scrollIntoView());\n return true;\n}\nfunction liftOutOfList(state, dispatch, range) {\n let tr = state.tr,\n list = range.parent;\n // Merge the list items into a single big item\n for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n pos -= list.child(i).nodeSize;\n tr.delete(pos - 1, pos + 1);\n }\n let $start = tr.doc.resolve(range.start),\n item = $start.nodeAfter;\n if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize) return false;\n let atStart = range.startIndex == 0,\n atEnd = range.endIndex == list.childCount;\n let parent = $start.node(-1),\n indexBefore = $start.index(-1);\n if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list)))) return false;\n let start = $start.pos,\n end = start + item.nodeSize;\n // Strip off the surrounding list. At the sides where we're not at\n // the end of the list, the existing list is closed. At sides where\n // this is the end, it is overwritten to its end.\n tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n dispatch(tr.scrollIntoView());\n return true;\n}\n/**\nCreate a command to sink the list item around the selection down\ninto an inner list.\n*/\nfunction sinkListItem(itemType) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range) return false;\n let startIndex = range.startIndex;\n if (startIndex == 0) return false;\n let parent = range.parent,\n nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type != itemType) return false;\n if (dispatch) {\n let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n let inner = Fragment.from(nestedBefore ? itemType.create() : null);\n let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);\n let before = range.start,\n after = range.end;\n dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true)).scrollIntoView());\n }\n return true;\n };\n}\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, splitListItemKeepMarks, wrapInList, wrapRangeInList };","import { Plugin, PluginKey, TextSelection, Selection, NodeSelection, EditorState } from '@tiptap/pm/state';\nimport { EditorView } from '@tiptap/pm/view';\nimport { keymap } from '@tiptap/pm/keymap';\nimport { Schema, DOMSerializer, Fragment, Node as Node$1, DOMParser, Slice } from '@tiptap/pm/model';\nimport { liftTarget, ReplaceStep, ReplaceAroundStep, joinPoint, Transform, canSplit, canJoin, findWrapping } from '@tiptap/pm/transform';\nimport { createParagraphNear as createParagraphNear$1, deleteSelection as deleteSelection$1, exitCode as exitCode$1, joinUp as joinUp$1, joinDown as joinDown$1, joinBackward as joinBackward$1, joinForward as joinForward$1, joinTextblockBackward as joinTextblockBackward$1, joinTextblockForward as joinTextblockForward$1, lift as lift$1, liftEmptyBlock as liftEmptyBlock$1, newlineInCode as newlineInCode$1, selectNodeBackward as selectNodeBackward$1, selectNodeForward as selectNodeForward$1, selectParentNode as selectParentNode$1, selectTextblockEnd as selectTextblockEnd$1, selectTextblockStart as selectTextblockStart$1, setBlockType, wrapIn as wrapIn$1 } from '@tiptap/pm/commands';\nimport { liftListItem as liftListItem$1, sinkListItem as sinkListItem$1, wrapInList as wrapInList$1 } from '@tiptap/pm/schema-list';\n\n/**\n * Takes a Transaction & Editor State and turns it into a chainable state object\n * @param config The transaction and state to create the chainable state from\n * @returns A chainable Editor state object\n */\nfunction createChainableState(config) {\n const {\n state,\n transaction\n } = config;\n let {\n selection\n } = transaction;\n let {\n doc\n } = transaction;\n let {\n storedMarks\n } = transaction;\n return {\n ...state,\n apply: state.apply.bind(state),\n applyTransaction: state.applyTransaction.bind(state),\n plugins: state.plugins,\n schema: state.schema,\n reconfigure: state.reconfigure.bind(state),\n toJSON: state.toJSON.bind(state),\n get storedMarks() {\n return storedMarks;\n },\n get selection() {\n return selection;\n },\n get doc() {\n return doc;\n },\n get tr() {\n selection = transaction.selection;\n doc = transaction.doc;\n storedMarks = transaction.storedMarks;\n return transaction;\n }\n };\n}\nclass CommandManager {\n constructor(props) {\n this.editor = props.editor;\n this.rawCommands = this.editor.extensionManager.commands;\n this.customState = props.state;\n }\n get hasCustomState() {\n return !!this.customState;\n }\n get state() {\n return this.customState || this.editor.state;\n }\n get commands() {\n const {\n rawCommands,\n editor,\n state\n } = this;\n const {\n view\n } = editor;\n const {\n tr\n } = state;\n const props = this.buildProps(tr);\n return Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n const method = (...args) => {\n const callback = command(...args)(props);\n if (!tr.getMeta('preventDispatch') && !this.hasCustomState) {\n view.dispatch(tr);\n }\n return callback;\n };\n return [name, method];\n }));\n }\n get chain() {\n return () => this.createChain();\n }\n get can() {\n return () => this.createCan();\n }\n createChain(startTr, shouldDispatch = true) {\n const {\n rawCommands,\n editor,\n state\n } = this;\n const {\n view\n } = editor;\n const callbacks = [];\n const hasStartTransaction = !!startTr;\n const tr = startTr || state.tr;\n const run = () => {\n if (!hasStartTransaction && shouldDispatch && !tr.getMeta('preventDispatch') && !this.hasCustomState) {\n view.dispatch(tr);\n }\n return callbacks.every(callback => callback === true);\n };\n const chain = {\n ...Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n const chainedCommand = (...args) => {\n const props = this.buildProps(tr, shouldDispatch);\n const callback = command(...args)(props);\n callbacks.push(callback);\n return chain;\n };\n return [name, chainedCommand];\n })),\n run\n };\n return chain;\n }\n createCan(startTr) {\n const {\n rawCommands,\n state\n } = this;\n const dispatch = false;\n const tr = startTr || state.tr;\n const props = this.buildProps(tr, dispatch);\n const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n return [name, (...args) => command(...args)({\n ...props,\n dispatch: undefined\n })];\n }));\n return {\n ...formattedCommands,\n chain: () => this.createChain(tr, dispatch)\n };\n }\n buildProps(tr, shouldDispatch = true) {\n const {\n rawCommands,\n editor,\n state\n } = this;\n const {\n view\n } = editor;\n const props = {\n tr,\n editor,\n view,\n state: createChainableState({\n state,\n transaction: tr\n }),\n dispatch: shouldDispatch ? () => undefined : undefined,\n chain: () => this.createChain(tr, shouldDispatch),\n can: () => this.createCan(tr),\n get commands() {\n return Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n return [name, (...args) => command(...args)(props)];\n }));\n }\n };\n return props;\n }\n}\nclass EventEmitter {\n constructor() {\n this.callbacks = {};\n }\n on(event, fn) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n this.callbacks[event].push(fn);\n return this;\n }\n emit(event, ...args) {\n const callbacks = this.callbacks[event];\n if (callbacks) {\n callbacks.forEach(callback => callback.apply(this, args));\n }\n return this;\n }\n off(event, fn) {\n const callbacks = this.callbacks[event];\n if (callbacks) {\n if (fn) {\n this.callbacks[event] = callbacks.filter(callback => callback !== fn);\n } else {\n delete this.callbacks[event];\n }\n }\n return this;\n }\n once(event, fn) {\n const onceFn = (...args) => {\n this.off(event, onceFn);\n fn.apply(this, args);\n };\n return this.on(event, onceFn);\n }\n removeAllListeners() {\n this.callbacks = {};\n }\n}\n\n/**\n * Returns a field from an extension\n * @param extension The Tiptap extension\n * @param field The field, for example `renderHTML` or `priority`\n * @param context The context object that should be passed as `this` into the function\n * @returns The field value\n */\nfunction getExtensionField(extension, field, context) {\n if (extension.config[field] === undefined && extension.parent) {\n return getExtensionField(extension.parent, field, context);\n }\n if (typeof extension.config[field] === 'function') {\n const value = extension.config[field].bind({\n ...context,\n parent: extension.parent ? getExtensionField(extension.parent, field, context) : null\n });\n return value;\n }\n return extension.config[field];\n}\nfunction splitExtensions(extensions) {\n const baseExtensions = extensions.filter(extension => extension.type === 'extension');\n const nodeExtensions = extensions.filter(extension => extension.type === 'node');\n const markExtensions = extensions.filter(extension => extension.type === 'mark');\n return {\n baseExtensions,\n nodeExtensions,\n markExtensions\n };\n}\n\n/**\n * Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.\n * @param extensions List of extensions\n */\nfunction getAttributesFromExtensions(extensions) {\n const extensionAttributes = [];\n const {\n nodeExtensions,\n markExtensions\n } = splitExtensions(extensions);\n const nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];\n const defaultAttribute = {\n default: null,\n rendered: true,\n renderHTML: null,\n parseHTML: null,\n keepOnSplit: true,\n isRequired: false\n };\n extensions.forEach(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n extensions: nodeAndMarkExtensions\n };\n const addGlobalAttributes = getExtensionField(extension, 'addGlobalAttributes', context);\n if (!addGlobalAttributes) {\n return;\n }\n const globalAttributes = addGlobalAttributes();\n globalAttributes.forEach(globalAttribute => {\n globalAttribute.types.forEach(type => {\n Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {\n extensionAttributes.push({\n type,\n name,\n attribute: {\n ...defaultAttribute,\n ...attribute\n }\n });\n });\n });\n });\n });\n nodeAndMarkExtensions.forEach(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const addAttributes = getExtensionField(extension, 'addAttributes', context);\n if (!addAttributes) {\n return;\n }\n // TODO: remove `as Attributes`\n const attributes = addAttributes();\n Object.entries(attributes).forEach(([name, attribute]) => {\n const mergedAttr = {\n ...defaultAttribute,\n ...attribute\n };\n if (typeof (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === 'function') {\n mergedAttr.default = mergedAttr.default();\n }\n if ((mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.isRequired) && (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === undefined) {\n delete mergedAttr.default;\n }\n extensionAttributes.push({\n type: extension.name,\n name,\n attribute: mergedAttr\n });\n });\n });\n return extensionAttributes;\n}\nfunction getNodeType(nameOrType, schema) {\n if (typeof nameOrType === 'string') {\n if (!schema.nodes[nameOrType]) {\n throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n }\n return schema.nodes[nameOrType];\n }\n return nameOrType;\n}\nfunction mergeAttributes(...objects) {\n return objects.filter(item => !!item).reduce((items, item) => {\n const mergedAttributes = {\n ...items\n };\n Object.entries(item).forEach(([key, value]) => {\n const exists = mergedAttributes[key];\n if (!exists) {\n mergedAttributes[key] = value;\n return;\n }\n if (key === 'class') {\n const valueClasses = value ? value.split(' ') : [];\n const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(' ') : [];\n const insertClasses = valueClasses.filter(valueClass => !existingClasses.includes(valueClass));\n mergedAttributes[key] = [...existingClasses, ...insertClasses].join(' ');\n } else if (key === 'style') {\n const newStyles = value ? value.split(';').map(style => style.trim()).filter(Boolean) : [];\n const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(';').map(style => style.trim()).filter(Boolean) : [];\n const styleMap = new Map();\n existingStyles.forEach(style => {\n const [property, val] = style.split(':').map(part => part.trim());\n styleMap.set(property, val);\n });\n newStyles.forEach(style => {\n const [property, val] = style.split(':').map(part => part.trim());\n styleMap.set(property, val);\n });\n mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join('; ');\n } else {\n mergedAttributes[key] = value;\n }\n });\n return mergedAttributes;\n }, {});\n}\nfunction getRenderedAttributes(nodeOrMark, extensionAttributes) {\n return extensionAttributes.filter(attribute => attribute.type === nodeOrMark.type.name).filter(item => item.attribute.rendered).map(item => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: nodeOrMark.attrs[item.name]\n };\n }\n return item.attribute.renderHTML(nodeOrMark.attrs) || {};\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n\n/**\n * Optionally calls `value` as a function.\n * Otherwise it is returned directly.\n * @param value Function or any value.\n * @param context Optional context to bind to function.\n * @param props Optional props to pass to function.\n */\nfunction callOrReturn(value, context = undefined, ...props) {\n if (isFunction(value)) {\n if (context) {\n return value.bind(context)(...props);\n }\n return value(...props);\n }\n return value;\n}\nfunction isEmptyObject(value = {}) {\n return Object.keys(value).length === 0 && value.constructor === Object;\n}\nfunction fromString(value) {\n if (typeof value !== 'string') {\n return value;\n }\n if (value.match(/^[+-]?(?:\\d*\\.)?\\d+$/)) {\n return Number(value);\n }\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n return value;\n}\n\n/**\n * This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).\n * Cancels when `getAttrs` returned `false`.\n * @param parseRule ProseMirror ParseRule\n * @param extensionAttributes List of attributes to inject\n */\nfunction injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {\n if ('style' in parseRule) {\n return parseRule;\n }\n return {\n ...parseRule,\n getAttrs: node => {\n const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;\n if (oldAttributes === false) {\n return false;\n }\n const newAttributes = extensionAttributes.reduce((items, item) => {\n const value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));\n if (value === null || value === undefined) {\n return items;\n }\n return {\n ...items,\n [item.name]: value\n };\n }, {});\n return {\n ...oldAttributes,\n ...newAttributes\n };\n }\n };\n}\nfunction cleanUpSchemaItem(data) {\n return Object.fromEntries(\n // @ts-ignore\n Object.entries(data).filter(([key, value]) => {\n if (key === 'attrs' && isEmptyObject(value)) {\n return false;\n }\n return value !== null && value !== undefined;\n }));\n}\n/**\n * Creates a new Prosemirror schema based on the given extensions.\n * @param extensions An array of Tiptap extensions\n * @param editor The editor instance\n * @returns A Prosemirror schema\n */\nfunction getSchemaByResolvedExtensions(extensions, editor) {\n var _a;\n const allAttributes = getAttributesFromExtensions(extensions);\n const {\n nodeExtensions,\n markExtensions\n } = splitExtensions(extensions);\n const topNode = (_a = nodeExtensions.find(extension => getExtensionField(extension, 'topNode'))) === null || _a === void 0 ? void 0 : _a.name;\n const nodes = Object.fromEntries(nodeExtensions.map(extension => {\n const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name);\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor\n };\n const extraNodeFields = extensions.reduce((fields, e) => {\n const extendNodeSchema = getExtensionField(e, 'extendNodeSchema', context);\n return {\n ...fields,\n ...(extendNodeSchema ? extendNodeSchema(extension) : {})\n };\n }, {});\n const schema = cleanUpSchemaItem({\n ...extraNodeFields,\n content: callOrReturn(getExtensionField(extension, 'content', context)),\n marks: callOrReturn(getExtensionField(extension, 'marks', context)),\n group: callOrReturn(getExtensionField(extension, 'group', context)),\n inline: callOrReturn(getExtensionField(extension, 'inline', context)),\n atom: callOrReturn(getExtensionField(extension, 'atom', context)),\n selectable: callOrReturn(getExtensionField(extension, 'selectable', context)),\n draggable: callOrReturn(getExtensionField(extension, 'draggable', context)),\n code: callOrReturn(getExtensionField(extension, 'code', context)),\n whitespace: callOrReturn(getExtensionField(extension, 'whitespace', context)),\n linebreakReplacement: callOrReturn(getExtensionField(extension, 'linebreakReplacement', context)),\n defining: callOrReturn(getExtensionField(extension, 'defining', context)),\n isolating: callOrReturn(getExtensionField(extension, 'isolating', context)),\n attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {\n var _a;\n return [extensionAttribute.name, {\n default: (_a = extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) === null || _a === void 0 ? void 0 : _a.default\n }];\n }))\n });\n const parseHTML = callOrReturn(getExtensionField(extension, 'parseHTML', context));\n if (parseHTML) {\n schema.parseDOM = parseHTML.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n }\n const renderHTML = getExtensionField(extension, 'renderHTML', context);\n if (renderHTML) {\n schema.toDOM = node => renderHTML({\n node,\n HTMLAttributes: getRenderedAttributes(node, extensionAttributes)\n });\n }\n const renderText = getExtensionField(extension, 'renderText', context);\n if (renderText) {\n schema.toText = renderText;\n }\n return [extension.name, schema];\n }));\n const marks = Object.fromEntries(markExtensions.map(extension => {\n const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name);\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor\n };\n const extraMarkFields = extensions.reduce((fields, e) => {\n const extendMarkSchema = getExtensionField(e, 'extendMarkSchema', context);\n return {\n ...fields,\n ...(extendMarkSchema ? extendMarkSchema(extension) : {})\n };\n }, {});\n const schema = cleanUpSchemaItem({\n ...extraMarkFields,\n inclusive: callOrReturn(getExtensionField(extension, 'inclusive', context)),\n excludes: callOrReturn(getExtensionField(extension, 'excludes', context)),\n group: callOrReturn(getExtensionField(extension, 'group', context)),\n spanning: callOrReturn(getExtensionField(extension, 'spanning', context)),\n code: callOrReturn(getExtensionField(extension, 'code', context)),\n attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {\n var _a;\n return [extensionAttribute.name, {\n default: (_a = extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) === null || _a === void 0 ? void 0 : _a.default\n }];\n }))\n });\n const parseHTML = callOrReturn(getExtensionField(extension, 'parseHTML', context));\n if (parseHTML) {\n schema.parseDOM = parseHTML.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n }\n const renderHTML = getExtensionField(extension, 'renderHTML', context);\n if (renderHTML) {\n schema.toDOM = mark => renderHTML({\n mark,\n HTMLAttributes: getRenderedAttributes(mark, extensionAttributes)\n });\n }\n return [extension.name, schema];\n }));\n return new Schema({\n topNode,\n nodes,\n marks\n });\n}\n\n/**\n * Tries to get a node or mark type by its name.\n * @param name The name of the node or mark type\n * @param schema The Prosemiror schema to search in\n * @returns The node or mark type, or null if it doesn't exist\n */\nfunction getSchemaTypeByName(name, schema) {\n return schema.nodes[name] || schema.marks[name] || null;\n}\nfunction isExtensionRulesEnabled(extension, enabled) {\n if (Array.isArray(enabled)) {\n return enabled.some(enabledExtension => {\n const name = typeof enabledExtension === 'string' ? enabledExtension : enabledExtension.name;\n return name === extension.name;\n });\n }\n return enabled;\n}\nfunction getHTMLFromFragment(fragment, schema) {\n const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);\n const temporaryDocument = document.implementation.createHTMLDocument();\n const container = temporaryDocument.createElement('div');\n container.appendChild(documentFragment);\n return container.innerHTML;\n}\n\n/**\n * Returns the text content of a resolved prosemirror position\n * @param $from The resolved position to get the text content from\n * @param maxMatch The maximum number of characters to match\n * @returns The text content\n */\nconst getTextContentFromNodes = ($from, maxMatch = 500) => {\n let textBefore = '';\n const sliceEndPos = $from.parentOffset;\n $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {\n var _a, _b;\n const chunk = ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {\n node,\n pos,\n parent,\n index\n })) || node.textContent || '%leaf%';\n textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));\n });\n return textBefore;\n};\nfunction isRegExp(value) {\n return Object.prototype.toString.call(value) === '[object RegExp]';\n}\nclass InputRule {\n constructor(config) {\n this.find = config.find;\n this.handler = config.handler;\n }\n}\nconst inputRuleMatcherHandler = (text, find) => {\n if (isRegExp(find)) {\n return find.exec(text);\n }\n const inputRuleMatch = find(text);\n if (!inputRuleMatch) {\n return null;\n }\n const result = [inputRuleMatch.text];\n result.index = inputRuleMatch.index;\n result.input = text;\n result.data = inputRuleMatch.data;\n if (inputRuleMatch.replaceWith) {\n if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {\n console.warn('[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\".');\n }\n result.push(inputRuleMatch.replaceWith);\n }\n return result;\n};\nfunction run$1(config) {\n var _a;\n const {\n editor,\n from,\n to,\n text,\n rules,\n plugin\n } = config;\n const {\n view\n } = editor;\n if (view.composing) {\n return false;\n }\n const $from = view.state.doc.resolve(from);\n if (\n // check for code node\n $from.parent.type.spec.code\n // check for code mark\n || !!((_a = $from.nodeBefore || $from.nodeAfter) === null || _a === void 0 ? void 0 : _a.marks.find(mark => mark.type.spec.code))) {\n return false;\n }\n let matched = false;\n const textBefore = getTextContentFromNodes($from) + text;\n rules.forEach(rule => {\n if (matched) {\n return;\n }\n const match = inputRuleMatcherHandler(textBefore, rule.find);\n if (!match) {\n return;\n }\n const tr = view.state.tr;\n const state = createChainableState({\n state: view.state,\n transaction: tr\n });\n const range = {\n from: from - (match[0].length - text.length),\n to\n };\n const {\n commands,\n chain,\n can\n } = new CommandManager({\n editor,\n state\n });\n const handler = rule.handler({\n state,\n range,\n match,\n commands,\n chain,\n can\n });\n // stop if there are no changes\n if (handler === null || !tr.steps.length) {\n return;\n }\n // store transform as meta data\n // so we can undo input rules within the `undoInputRules` command\n tr.setMeta(plugin, {\n transform: tr,\n from,\n to,\n text\n });\n view.dispatch(tr);\n matched = true;\n });\n return matched;\n}\n/**\n * Create an input rules plugin. When enabled, it will cause text\n * input that matches any of the given rules to trigger the rule’s\n * action.\n */\nfunction inputRulesPlugin(props) {\n const {\n editor,\n rules\n } = props;\n const plugin = new Plugin({\n state: {\n init() {\n return null;\n },\n apply(tr, prev, state) {\n const stored = tr.getMeta(plugin);\n if (stored) {\n return stored;\n }\n // if InputRule is triggered by insertContent()\n const simulatedInputMeta = tr.getMeta('applyInputRules');\n const isSimulatedInput = !!simulatedInputMeta;\n if (isSimulatedInput) {\n setTimeout(() => {\n let {\n text\n } = simulatedInputMeta;\n if (typeof text === 'string') {\n text = text;\n } else {\n text = getHTMLFromFragment(Fragment.from(text), state.schema);\n }\n const {\n from\n } = simulatedInputMeta;\n const to = from + text.length;\n run$1({\n editor,\n from,\n to,\n text,\n rules,\n plugin\n });\n });\n }\n return tr.selectionSet || tr.docChanged ? null : prev;\n }\n },\n props: {\n handleTextInput(view, from, to, text) {\n return run$1({\n editor,\n from,\n to,\n text,\n rules,\n plugin\n });\n },\n handleDOMEvents: {\n compositionend: view => {\n setTimeout(() => {\n const {\n $cursor\n } = view.state.selection;\n if ($cursor) {\n run$1({\n editor,\n from: $cursor.pos,\n to: $cursor.pos,\n text: '',\n rules,\n plugin\n });\n }\n });\n return false;\n }\n },\n // add support for input rules to trigger on enter\n // this is useful for example for code blocks\n handleKeyDown(view, event) {\n if (event.key !== 'Enter') {\n return false;\n }\n const {\n $cursor\n } = view.state.selection;\n if ($cursor) {\n return run$1({\n editor,\n from: $cursor.pos,\n to: $cursor.pos,\n text: '\\n',\n rules,\n plugin\n });\n }\n return false;\n }\n },\n // @ts-ignore\n isInputRules: true\n });\n return plugin;\n}\n\n// see: https://github.com/mesqueeb/is-what/blob/88d6e4ca92fb2baab6003c54e02eedf4e729e5ab/src/index.ts\nfunction getType(value) {\n return Object.prototype.toString.call(value).slice(8, -1);\n}\nfunction isPlainObject(value) {\n if (getType(value) !== 'Object') {\n return false;\n }\n return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;\n}\nfunction mergeDeep(target, source) {\n const output = {\n ...target\n };\n if (isPlainObject(target) && isPlainObject(source)) {\n Object.keys(source).forEach(key => {\n if (isPlainObject(source[key]) && isPlainObject(target[key])) {\n output[key] = mergeDeep(target[key], source[key]);\n } else {\n output[key] = source[key];\n }\n });\n }\n return output;\n}\n\n/**\n * The Mark class is used to create custom mark extensions.\n * @see https://tiptap.dev/api/extensions#create-a-new-extension\n */\nclass Mark {\n constructor(config = {}) {\n this.type = 'mark';\n this.name = 'mark';\n this.parent = null;\n this.child = null;\n this.config = {\n name: this.name,\n defaultOptions: {}\n };\n this.config = {\n ...this.config,\n ...config\n };\n this.name = this.config.name;\n if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${this.name}\".`);\n }\n // TODO: remove `addOptions` fallback\n this.options = this.config.defaultOptions;\n if (this.config.addOptions) {\n this.options = callOrReturn(getExtensionField(this, 'addOptions', {\n name: this.name\n }));\n }\n this.storage = callOrReturn(getExtensionField(this, 'addStorage', {\n name: this.name,\n options: this.options\n })) || {};\n }\n static create(config = {}) {\n return new Mark(config);\n }\n configure(options = {}) {\n // return a new instance so we can use the same extension\n // with different calls of `configure`\n const extension = this.extend({\n ...this.config,\n addOptions: () => {\n return mergeDeep(this.options, options);\n }\n });\n // Always preserve the current name\n extension.name = this.name;\n // Set the parent to be our parent\n extension.parent = this.parent;\n return extension;\n }\n extend(extendedConfig = {}) {\n const extension = new Mark(extendedConfig);\n extension.parent = this;\n this.child = extension;\n extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;\n if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${extension.name}\".`);\n }\n extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {\n name: extension.name\n }));\n extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {\n name: extension.name,\n options: extension.options\n }));\n return extension;\n }\n static handleExit({\n editor,\n mark\n }) {\n const {\n tr\n } = editor.state;\n const currentPos = editor.state.selection.$from;\n const isAtEnd = currentPos.pos === currentPos.end();\n if (isAtEnd) {\n const currentMarks = currentPos.marks();\n const isInMark = !!currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);\n if (!isInMark) {\n return false;\n }\n const removeMark = currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);\n if (removeMark) {\n tr.removeStoredMark(removeMark);\n }\n tr.insertText(' ', currentPos.pos);\n editor.view.dispatch(tr);\n return true;\n }\n return false;\n }\n}\nfunction isNumber(value) {\n return typeof value === 'number';\n}\n\n/**\n * Paste rules are used to react to pasted content.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nclass PasteRule {\n constructor(config) {\n this.find = config.find;\n this.handler = config.handler;\n }\n}\nconst pasteRuleMatcherHandler = (text, find, event) => {\n if (isRegExp(find)) {\n return [...text.matchAll(find)];\n }\n const matches = find(text, event);\n if (!matches) {\n return [];\n }\n return matches.map(pasteRuleMatch => {\n const result = [pasteRuleMatch.text];\n result.index = pasteRuleMatch.index;\n result.input = text;\n result.data = pasteRuleMatch.data;\n if (pasteRuleMatch.replaceWith) {\n if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) {\n console.warn('[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\".');\n }\n result.push(pasteRuleMatch.replaceWith);\n }\n return result;\n });\n};\nfunction run(config) {\n const {\n editor,\n state,\n from,\n to,\n rule,\n pasteEvent,\n dropEvent\n } = config;\n const {\n commands,\n chain,\n can\n } = new CommandManager({\n editor,\n state\n });\n const handlers = [];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isTextblock || node.type.spec.code) {\n return;\n }\n const resolvedFrom = Math.max(from, pos);\n const resolvedTo = Math.min(to, pos + node.content.size);\n const textToMatch = node.textBetween(resolvedFrom - pos, resolvedTo - pos, undefined, '\\ufffc');\n const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);\n matches.forEach(match => {\n if (match.index === undefined) {\n return;\n }\n const start = resolvedFrom + match.index + 1;\n const end = start + match[0].length;\n const range = {\n from: state.tr.mapping.map(start),\n to: state.tr.mapping.map(end)\n };\n const handler = rule.handler({\n state,\n range,\n match,\n commands,\n chain,\n can,\n pasteEvent,\n dropEvent\n });\n handlers.push(handler);\n });\n });\n const success = handlers.every(handler => handler !== null);\n return success;\n}\nconst createClipboardPasteEvent = text => {\n var _a;\n const event = new ClipboardEvent('paste', {\n clipboardData: new DataTransfer()\n });\n (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData('text/html', text);\n return event;\n};\n/**\n * Create an paste rules plugin. When enabled, it will cause pasted\n * text that matches any of the given rules to trigger the rule’s\n * action.\n */\nfunction pasteRulesPlugin(props) {\n const {\n editor,\n rules\n } = props;\n let dragSourceElement = null;\n let isPastedFromProseMirror = false;\n let isDroppedFromProseMirror = false;\n let pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;\n let dropEvent;\n try {\n dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;\n } catch (e) {\n dropEvent = null;\n }\n const processEvent = ({\n state,\n from,\n to,\n rule,\n pasteEvt\n }) => {\n const tr = state.tr;\n const chainableState = createChainableState({\n state,\n transaction: tr\n });\n const handler = run({\n editor,\n state: chainableState,\n from: Math.max(from - 1, 0),\n to: to.b - 1,\n rule,\n pasteEvent: pasteEvt,\n dropEvent\n });\n if (!handler || !tr.steps.length) {\n return;\n }\n try {\n dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;\n } catch (e) {\n dropEvent = null;\n }\n pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;\n return tr;\n };\n const plugins = rules.map(rule => {\n return new Plugin({\n // we register a global drag handler to track the current drag source element\n view(view) {\n const handleDragstart = event => {\n var _a;\n dragSourceElement = ((_a = view.dom.parentElement) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ? view.dom.parentElement : null;\n };\n window.addEventListener('dragstart', handleDragstart);\n return {\n destroy() {\n window.removeEventListener('dragstart', handleDragstart);\n }\n };\n },\n props: {\n handleDOMEvents: {\n drop: (view, event) => {\n isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;\n dropEvent = event;\n return false;\n },\n paste: (_view, event) => {\n var _a;\n const html = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/html');\n pasteEvent = event;\n isPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes('data-pm-slice'));\n return false;\n }\n }\n },\n appendTransaction: (transactions, oldState, state) => {\n const transaction = transactions[0];\n const isPaste = transaction.getMeta('uiEvent') === 'paste' && !isPastedFromProseMirror;\n const isDrop = transaction.getMeta('uiEvent') === 'drop' && !isDroppedFromProseMirror;\n // if PasteRule is triggered by insertContent()\n const simulatedPasteMeta = transaction.getMeta('applyPasteRules');\n const isSimulatedPaste = !!simulatedPasteMeta;\n if (!isPaste && !isDrop && !isSimulatedPaste) {\n return;\n }\n // Handle simulated paste\n if (isSimulatedPaste) {\n let {\n text\n } = simulatedPasteMeta;\n if (typeof text === 'string') {\n text = text;\n } else {\n text = getHTMLFromFragment(Fragment.from(text), state.schema);\n }\n const {\n from\n } = simulatedPasteMeta;\n const to = from + text.length;\n const pasteEvt = createClipboardPasteEvent(text);\n return processEvent({\n rule,\n state,\n from,\n to: {\n b: to\n },\n pasteEvt\n });\n }\n // handle actual paste/drop\n const from = oldState.doc.content.findDiffStart(state.doc.content);\n const to = oldState.doc.content.findDiffEnd(state.doc.content);\n // stop if there is no changed range\n if (!isNumber(from) || !to || from === to.b) {\n return;\n }\n return processEvent({\n rule,\n state,\n from,\n to,\n pasteEvt: pasteEvent\n });\n }\n });\n });\n return plugins;\n}\nfunction findDuplicates(items) {\n const filtered = items.filter((el, index) => items.indexOf(el) !== index);\n return Array.from(new Set(filtered));\n}\nclass ExtensionManager {\n constructor(extensions, editor) {\n this.splittableMarks = [];\n this.editor = editor;\n this.extensions = ExtensionManager.resolve(extensions);\n this.schema = getSchemaByResolvedExtensions(this.extensions, editor);\n this.setupExtensions();\n }\n /**\n * Returns a flattened and sorted extension list while\n * also checking for duplicated extensions and warns the user.\n * @param extensions An array of Tiptap extensions\n * @returns An flattened and sorted array of Tiptap extensions\n */\n static resolve(extensions) {\n const resolvedExtensions = ExtensionManager.sort(ExtensionManager.flatten(extensions));\n const duplicatedNames = findDuplicates(resolvedExtensions.map(extension => extension.name));\n if (duplicatedNames.length) {\n console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map(item => `'${item}'`).join(', ')}]. This can lead to issues.`);\n }\n return resolvedExtensions;\n }\n /**\n * Create a flattened array of extensions by traversing the `addExtensions` field.\n * @param extensions An array of Tiptap extensions\n * @returns A flattened array of Tiptap extensions\n */\n static flatten(extensions) {\n return extensions.map(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const addExtensions = getExtensionField(extension, 'addExtensions', context);\n if (addExtensions) {\n return [extension, ...this.flatten(addExtensions())];\n }\n return extension;\n })\n // `Infinity` will break TypeScript so we set a number that is probably high enough\n .flat(10);\n }\n /**\n * Sort extensions by priority.\n * @param extensions An array of Tiptap extensions\n * @returns A sorted array of Tiptap extensions by priority\n */\n static sort(extensions) {\n const defaultPriority = 100;\n return extensions.sort((a, b) => {\n const priorityA = getExtensionField(a, 'priority') || defaultPriority;\n const priorityB = getExtensionField(b, 'priority') || defaultPriority;\n if (priorityA > priorityB) {\n return -1;\n }\n if (priorityA < priorityB) {\n return 1;\n }\n return 0;\n });\n }\n /**\n * Get all commands from the extensions.\n * @returns An object with all commands where the key is the command name and the value is the command function\n */\n get commands() {\n return this.extensions.reduce((commands, extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor: this.editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const addCommands = getExtensionField(extension, 'addCommands', context);\n if (!addCommands) {\n return commands;\n }\n return {\n ...commands,\n ...addCommands()\n };\n }, {});\n }\n /**\n * Get all registered Prosemirror plugins from the extensions.\n * @returns An array of Prosemirror plugins\n */\n get plugins() {\n const {\n editor\n } = this;\n // With ProseMirror, first plugins within an array are executed first.\n // In Tiptap, we provide the ability to override plugins,\n // so it feels more natural to run plugins at the end of an array first.\n // That’s why we have to reverse the `extensions` array and sort again\n // based on the `priority` option.\n const extensions = ExtensionManager.sort([...this.extensions].reverse());\n const inputRules = [];\n const pasteRules = [];\n const allPlugins = extensions.map(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const plugins = [];\n const addKeyboardShortcuts = getExtensionField(extension, 'addKeyboardShortcuts', context);\n let defaultBindings = {};\n // bind exit handling\n if (extension.type === 'mark' && getExtensionField(extension, 'exitable', context)) {\n defaultBindings.ArrowRight = () => Mark.handleExit({\n editor,\n mark: extension\n });\n }\n if (addKeyboardShortcuts) {\n const bindings = Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {\n return [shortcut, () => method({\n editor\n })];\n }));\n defaultBindings = {\n ...defaultBindings,\n ...bindings\n };\n }\n const keyMapPlugin = keymap(defaultBindings);\n plugins.push(keyMapPlugin);\n const addInputRules = getExtensionField(extension, 'addInputRules', context);\n if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {\n inputRules.push(...addInputRules());\n }\n const addPasteRules = getExtensionField(extension, 'addPasteRules', context);\n if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {\n pasteRules.push(...addPasteRules());\n }\n const addProseMirrorPlugins = getExtensionField(extension, 'addProseMirrorPlugins', context);\n if (addProseMirrorPlugins) {\n const proseMirrorPlugins = addProseMirrorPlugins();\n plugins.push(...proseMirrorPlugins);\n }\n return plugins;\n }).flat();\n return [inputRulesPlugin({\n editor,\n rules: inputRules\n }), ...pasteRulesPlugin({\n editor,\n rules: pasteRules\n }), ...allPlugins];\n }\n /**\n * Get all attributes from the extensions.\n * @returns An array of attributes\n */\n get attributes() {\n return getAttributesFromExtensions(this.extensions);\n }\n /**\n * Get all node views from the extensions.\n * @returns An object with all node views where the key is the node name and the value is the node view function\n */\n get nodeViews() {\n const {\n editor\n } = this;\n const {\n nodeExtensions\n } = splitExtensions(this.extensions);\n return Object.fromEntries(nodeExtensions.filter(extension => !!getExtensionField(extension, 'addNodeView')).map(extension => {\n const extensionAttributes = this.attributes.filter(attribute => attribute.type === extension.name);\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor,\n type: getNodeType(extension.name, this.schema)\n };\n const addNodeView = getExtensionField(extension, 'addNodeView', context);\n if (!addNodeView) {\n return [];\n }\n const nodeview = (node, view, getPos, decorations, innerDecorations) => {\n const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);\n return addNodeView()({\n // pass-through\n node,\n view,\n getPos: getPos,\n decorations,\n innerDecorations,\n // tiptap-specific\n editor,\n extension,\n HTMLAttributes\n });\n };\n return [extension.name, nodeview];\n }));\n }\n /**\n * Go through all extensions, create extension storages & setup marks\n * & bind editor event listener.\n */\n setupExtensions() {\n this.extensions.forEach(extension => {\n var _a;\n // store extension storage in editor\n this.editor.extensionStorage[extension.name] = extension.storage;\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor: this.editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n if (extension.type === 'mark') {\n const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, 'keepOnSplit', context))) !== null && _a !== void 0 ? _a : true;\n if (keepOnSplit) {\n this.splittableMarks.push(extension.name);\n }\n }\n const onBeforeCreate = getExtensionField(extension, 'onBeforeCreate', context);\n const onCreate = getExtensionField(extension, 'onCreate', context);\n const onUpdate = getExtensionField(extension, 'onUpdate', context);\n const onSelectionUpdate = getExtensionField(extension, 'onSelectionUpdate', context);\n const onTransaction = getExtensionField(extension, 'onTransaction', context);\n const onFocus = getExtensionField(extension, 'onFocus', context);\n const onBlur = getExtensionField(extension, 'onBlur', context);\n const onDestroy = getExtensionField(extension, 'onDestroy', context);\n if (onBeforeCreate) {\n this.editor.on('beforeCreate', onBeforeCreate);\n }\n if (onCreate) {\n this.editor.on('create', onCreate);\n }\n if (onUpdate) {\n this.editor.on('update', onUpdate);\n }\n if (onSelectionUpdate) {\n this.editor.on('selectionUpdate', onSelectionUpdate);\n }\n if (onTransaction) {\n this.editor.on('transaction', onTransaction);\n }\n if (onFocus) {\n this.editor.on('focus', onFocus);\n }\n if (onBlur) {\n this.editor.on('blur', onBlur);\n }\n if (onDestroy) {\n this.editor.on('destroy', onDestroy);\n }\n });\n }\n}\n\n/**\n * The Extension class is the base class for all extensions.\n * @see https://tiptap.dev/api/extensions#create-a-new-extension\n */\nclass Extension {\n constructor(config = {}) {\n this.type = 'extension';\n this.name = 'extension';\n this.parent = null;\n this.child = null;\n this.config = {\n name: this.name,\n defaultOptions: {}\n };\n this.config = {\n ...this.config,\n ...config\n };\n this.name = this.config.name;\n if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${this.name}\".`);\n }\n // TODO: remove `addOptions` fallback\n this.options = this.config.defaultOptions;\n if (this.config.addOptions) {\n this.options = callOrReturn(getExtensionField(this, 'addOptions', {\n name: this.name\n }));\n }\n this.storage = callOrReturn(getExtensionField(this, 'addStorage', {\n name: this.name,\n options: this.options\n })) || {};\n }\n static create(config = {}) {\n return new Extension(config);\n }\n configure(options = {}) {\n // return a new instance so we can use the same extension\n // with different calls of `configure`\n const extension = this.extend({\n ...this.config,\n addOptions: () => {\n return mergeDeep(this.options, options);\n }\n });\n // Always preserve the current name\n extension.name = this.name;\n // Set the parent to be our parent\n extension.parent = this.parent;\n return extension;\n }\n extend(extendedConfig = {}) {\n const extension = new Extension({\n ...this.config,\n ...extendedConfig\n });\n extension.parent = this;\n this.child = extension;\n extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;\n if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${extension.name}\".`);\n }\n extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {\n name: extension.name\n }));\n extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {\n name: extension.name,\n options: extension.options\n }));\n return extension;\n }\n}\n\n/**\n * Gets the text between two positions in a Prosemirror node\n * and serializes it using the given text serializers and block separator (see getText)\n * @param startNode The Prosemirror node to start from\n * @param range The range of the text to get\n * @param options Options for the text serializer & block separator\n * @returns The text between the two positions\n */\nfunction getTextBetween(startNode, range, options) {\n const {\n from,\n to\n } = range;\n const {\n blockSeparator = '\\n\\n',\n textSerializers = {}\n } = options || {};\n let text = '';\n startNode.nodesBetween(from, to, (node, pos, parent, index) => {\n var _a;\n if (node.isBlock && pos > from) {\n text += blockSeparator;\n }\n const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];\n if (textSerializer) {\n if (parent) {\n text += textSerializer({\n node,\n pos,\n parent,\n index,\n range\n });\n }\n // do not descend into child nodes when there exists a serializer\n return false;\n }\n if (node.isText) {\n text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos); // eslint-disable-line\n }\n });\n return text;\n}\n\n/**\n * Find text serializers `toText` in a Prosemirror schema\n * @param schema The Prosemirror schema to search in\n * @returns A record of text serializers by node name\n */\nfunction getTextSerializersFromSchema(schema) {\n return Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));\n}\nconst ClipboardTextSerializer = Extension.create({\n name: 'clipboardTextSerializer',\n addOptions() {\n return {\n blockSeparator: undefined\n };\n },\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('clipboardTextSerializer'),\n props: {\n clipboardTextSerializer: () => {\n const {\n editor\n } = this;\n const {\n state,\n schema\n } = editor;\n const {\n doc,\n selection\n } = state;\n const {\n ranges\n } = selection;\n const from = Math.min(...ranges.map(range => range.$from.pos));\n const to = Math.max(...ranges.map(range => range.$to.pos));\n const textSerializers = getTextSerializersFromSchema(schema);\n const range = {\n from,\n to\n };\n return getTextBetween(doc, range, {\n ...(this.options.blockSeparator !== undefined ? {\n blockSeparator: this.options.blockSeparator\n } : {}),\n textSerializers\n });\n }\n }\n })];\n }\n});\nconst blur = () => ({\n editor,\n view\n}) => {\n requestAnimationFrame(() => {\n var _a;\n if (!editor.isDestroyed) {\n view.dom.blur();\n // Browsers should remove the caret on blur but safari does not.\n // See: https://github.com/ueberdosis/tiptap/issues/2405\n (_a = window === null || window === void 0 ? void 0 : window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();\n }\n });\n return true;\n};\nconst clearContent = (emitUpdate = false) => ({\n commands\n}) => {\n return commands.setContent('', emitUpdate);\n};\nconst clearNodes = () => ({\n state,\n tr,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const {\n ranges\n } = selection;\n if (!dispatch) {\n return true;\n }\n ranges.forEach(({\n $from,\n $to\n }) => {\n state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (node.type.isText) {\n return;\n }\n const {\n doc,\n mapping\n } = tr;\n const $mappedFrom = doc.resolve(mapping.map(pos));\n const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));\n const nodeRange = $mappedFrom.blockRange($mappedTo);\n if (!nodeRange) {\n return;\n }\n const targetLiftDepth = liftTarget(nodeRange);\n if (node.type.isTextblock) {\n const {\n defaultType\n } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());\n tr.setNodeMarkup(nodeRange.start, defaultType);\n }\n if (targetLiftDepth || targetLiftDepth === 0) {\n tr.lift(nodeRange, targetLiftDepth);\n }\n });\n });\n return true;\n};\nconst command = fn => props => {\n return fn(props);\n};\nconst createParagraphNear = () => ({\n state,\n dispatch\n}) => {\n return createParagraphNear$1(state, dispatch);\n};\nconst cut = (originRange, targetPos) => ({\n editor,\n tr\n}) => {\n const {\n state\n } = editor;\n const contentSlice = state.doc.slice(originRange.from, originRange.to);\n tr.deleteRange(originRange.from, originRange.to);\n const newPos = tr.mapping.map(targetPos);\n tr.insert(newPos, contentSlice.content);\n tr.setSelection(new TextSelection(tr.doc.resolve(newPos - 1)));\n return true;\n};\nconst deleteCurrentNode = () => ({\n tr,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const currentNode = selection.$anchor.node();\n // if there is content inside the current node, break out of this command\n if (currentNode.content.size > 0) {\n return false;\n }\n const $pos = tr.selection.$anchor;\n for (let depth = $pos.depth; depth > 0; depth -= 1) {\n const node = $pos.node(depth);\n if (node.type === currentNode.type) {\n if (dispatch) {\n const from = $pos.before(depth);\n const to = $pos.after(depth);\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n }\n }\n return false;\n};\nconst deleteNode = typeOrName => ({\n tr,\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const $pos = tr.selection.$anchor;\n for (let depth = $pos.depth; depth > 0; depth -= 1) {\n const node = $pos.node(depth);\n if (node.type === type) {\n if (dispatch) {\n const from = $pos.before(depth);\n const to = $pos.after(depth);\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n }\n }\n return false;\n};\nconst deleteRange = range => ({\n tr,\n dispatch\n}) => {\n const {\n from,\n to\n } = range;\n if (dispatch) {\n tr.delete(from, to);\n }\n return true;\n};\nconst deleteSelection = () => ({\n state,\n dispatch\n}) => {\n return deleteSelection$1(state, dispatch);\n};\nconst enter = () => ({\n commands\n}) => {\n return commands.keyboardShortcut('Enter');\n};\nconst exitCode = () => ({\n state,\n dispatch\n}) => {\n return exitCode$1(state, dispatch);\n};\n\n/**\n * Check if object1 includes object2\n * @param object1 Object\n * @param object2 Object\n */\nfunction objectIncludes(object1, object2, options = {\n strict: true\n}) {\n const keys = Object.keys(object2);\n if (!keys.length) {\n return true;\n }\n return keys.every(key => {\n if (options.strict) {\n return object2[key] === object1[key];\n }\n if (isRegExp(object2[key])) {\n return object2[key].test(object1[key]);\n }\n return object2[key] === object1[key];\n });\n}\nfunction findMarkInSet(marks, type, attributes = {}) {\n return marks.find(item => {\n return item.type === type && objectIncludes(\n // Only check equality for the attributes that are provided\n Object.fromEntries(Object.keys(attributes).map(k => [k, item.attrs[k]])), attributes);\n });\n}\nfunction isMarkInSet(marks, type, attributes = {}) {\n return !!findMarkInSet(marks, type, attributes);\n}\n/**\n * Get the range of a mark at a resolved position.\n */\nfunction getMarkRange(\n/**\n * The position to get the mark range for.\n */\n$pos,\n/**\n * The mark type to get the range for.\n */\ntype,\n/**\n * The attributes to match against.\n * If not provided, only the first mark at the position will be matched.\n */\nattributes) {\n var _a;\n if (!$pos || !type) {\n return;\n }\n let start = $pos.parent.childAfter($pos.parentOffset);\n // If the cursor is at the start of a text node that does not have the mark, look backward\n if (!start.node || !start.node.marks.some(mark => mark.type === type)) {\n start = $pos.parent.childBefore($pos.parentOffset);\n }\n // If there is no text node with the mark even backward, return undefined\n if (!start.node || !start.node.marks.some(mark => mark.type === type)) {\n return;\n }\n // Default to only matching against the first mark's attributes\n attributes = attributes || ((_a = start.node.marks[0]) === null || _a === void 0 ? void 0 : _a.attrs);\n // We now know that the cursor is either at the start, middle or end of a text node with the specified mark\n // so we can look it up on the targeted mark\n const mark = findMarkInSet([...start.node.marks], type, attributes);\n if (!mark) {\n return;\n }\n let startIndex = start.index;\n let startPos = $pos.start() + start.offset;\n let endIndex = startIndex + 1;\n let endPos = startPos + start.node.nodeSize;\n while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {\n startIndex -= 1;\n startPos -= $pos.parent.child(startIndex).nodeSize;\n }\n while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {\n endPos += $pos.parent.child(endIndex).nodeSize;\n endIndex += 1;\n }\n return {\n from: startPos,\n to: endPos\n };\n}\nfunction getMarkType(nameOrType, schema) {\n if (typeof nameOrType === 'string') {\n if (!schema.marks[nameOrType]) {\n throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n }\n return schema.marks[nameOrType];\n }\n return nameOrType;\n}\nconst extendMarkRange = (typeOrName, attributes = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n const type = getMarkType(typeOrName, state.schema);\n const {\n doc,\n selection\n } = tr;\n const {\n $from,\n from,\n to\n } = selection;\n if (dispatch) {\n const range = getMarkRange($from, type, attributes);\n if (range && range.from <= from && range.to >= to) {\n const newSelection = TextSelection.create(doc, range.from, range.to);\n tr.setSelection(newSelection);\n }\n }\n return true;\n};\nconst first = commands => props => {\n const items = typeof commands === 'function' ? commands(props) : commands;\n for (let i = 0; i < items.length; i += 1) {\n if (items[i](props)) {\n return true;\n }\n }\n return false;\n};\nfunction isTextSelection(value) {\n return value instanceof TextSelection;\n}\nfunction minMax(value = 0, min = 0, max = 0) {\n return Math.min(Math.max(value, min), max);\n}\nfunction resolveFocusPosition(doc, position = null) {\n if (!position) {\n return null;\n }\n const selectionAtStart = Selection.atStart(doc);\n const selectionAtEnd = Selection.atEnd(doc);\n if (position === 'start' || position === true) {\n return selectionAtStart;\n }\n if (position === 'end') {\n return selectionAtEnd;\n }\n const minPos = selectionAtStart.from;\n const maxPos = selectionAtEnd.to;\n if (position === 'all') {\n return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));\n }\n return TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));\n}\nfunction isiOS() {\n return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform)\n // iPad on iOS 13 detection\n || navigator.userAgent.includes('Mac') && 'ontouchend' in document;\n}\nconst focus = (position = null, options = {}) => ({\n editor,\n view,\n tr,\n dispatch\n}) => {\n options = {\n scrollIntoView: true,\n ...options\n };\n const delayedFocus = () => {\n // focus within `requestAnimationFrame` breaks focus on iOS\n // so we have to call this\n if (isiOS()) {\n view.dom.focus();\n }\n // For React we have to focus asynchronously. Otherwise wild things happen.\n // see: https://github.com/ueberdosis/tiptap/issues/1520\n requestAnimationFrame(() => {\n if (!editor.isDestroyed) {\n view.focus();\n if (options === null || options === void 0 ? void 0 : options.scrollIntoView) {\n editor.commands.scrollIntoView();\n }\n }\n });\n };\n if (view.hasFocus() && position === null || position === false) {\n return true;\n }\n // we don’t try to resolve a NodeSelection or CellSelection\n if (dispatch && position === null && !isTextSelection(editor.state.selection)) {\n delayedFocus();\n return true;\n }\n // pass through tr.doc instead of editor.state.doc\n // since transactions could change the editors state before this command has been run\n const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;\n const isSameSelection = editor.state.selection.eq(selection);\n if (dispatch) {\n if (!isSameSelection) {\n tr.setSelection(selection);\n }\n // `tr.setSelection` resets the stored marks\n // so we’ll restore them if the selection is the same as before\n if (isSameSelection && tr.storedMarks) {\n tr.setStoredMarks(tr.storedMarks);\n }\n delayedFocus();\n }\n return true;\n};\nconst forEach = (items, fn) => props => {\n return items.every((item, index) => fn(item, {\n ...props,\n index\n }));\n};\nconst insertContent = (value, options) => ({\n tr,\n commands\n}) => {\n return commands.insertContentAt({\n from: tr.selection.from,\n to: tr.selection.to\n }, value, options);\n};\nconst removeWhitespaces = node => {\n const children = node.childNodes;\n for (let i = children.length - 1; i >= 0; i -= 1) {\n const child = children[i];\n if (child.nodeType === 3 && child.nodeValue && /^(\\n\\s\\s|\\n)$/.test(child.nodeValue)) {\n node.removeChild(child);\n } else if (child.nodeType === 1) {\n removeWhitespaces(child);\n }\n }\n return node;\n};\nfunction elementFromString(value) {\n // add a wrapper to preserve leading and trailing whitespace\n const wrappedValue = `${value}`;\n const html = new window.DOMParser().parseFromString(wrappedValue, 'text/html').body;\n return removeWhitespaces(html);\n}\n\n/**\n * Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.\n * @param content The JSON or HTML content to create the node from\n * @param schema The Prosemirror schema to use for the node\n * @param options Options for the parser\n * @returns The created Prosemirror node or fragment\n */\nfunction createNodeFromContent(content, schema, options) {\n if (content instanceof Node$1 || content instanceof Fragment) {\n return content;\n }\n options = {\n slice: true,\n parseOptions: {},\n ...options\n };\n const isJSONContent = typeof content === 'object' && content !== null;\n const isTextContent = typeof content === 'string';\n if (isJSONContent) {\n try {\n const isArrayContent = Array.isArray(content) && content.length > 0;\n // if the JSON Content is an array of nodes, create a fragment for each node\n if (isArrayContent) {\n return Fragment.fromArray(content.map(item => schema.nodeFromJSON(item)));\n }\n const node = schema.nodeFromJSON(content);\n if (options.errorOnInvalidContent) {\n node.check();\n }\n return node;\n } catch (error) {\n if (options.errorOnInvalidContent) {\n throw new Error('[tiptap error]: Invalid JSON content', {\n cause: error\n });\n }\n console.warn('[tiptap warn]: Invalid content.', 'Passed value:', content, 'Error:', error);\n return createNodeFromContent('', schema, options);\n }\n }\n if (isTextContent) {\n // Check for invalid content\n if (options.errorOnInvalidContent) {\n let hasInvalidContent = false;\n let invalidContent = '';\n // A copy of the current schema with a catch-all node at the end\n const contentCheckSchema = new Schema({\n topNode: schema.spec.topNode,\n marks: schema.spec.marks,\n // Prosemirror's schemas are executed such that: the last to execute, matches last\n // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle\n nodes: schema.spec.nodes.append({\n __tiptap__private__unknown__catch__all__node: {\n content: 'inline*',\n group: 'block',\n parseDOM: [{\n tag: '*',\n getAttrs: e => {\n // If this is ever called, we know that the content has something that we don't know how to handle in the schema\n hasInvalidContent = true;\n // Try to stringify the element for a more helpful error message\n invalidContent = typeof e === 'string' ? e : e.outerHTML;\n return null;\n }\n }]\n }\n })\n });\n if (options.slice) {\n DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);\n } else {\n DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);\n }\n if (options.errorOnInvalidContent && hasInvalidContent) {\n throw new Error('[tiptap error]: Invalid HTML content', {\n cause: new Error(`Invalid element found: ${invalidContent}`)\n });\n }\n }\n const parser = DOMParser.fromSchema(schema);\n if (options.slice) {\n return parser.parseSlice(elementFromString(content), options.parseOptions).content;\n }\n return parser.parse(elementFromString(content), options.parseOptions);\n }\n return createNodeFromContent('', schema, options);\n}\n\n// source: https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.js#L466\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n const last = tr.steps.length - 1;\n if (last < startLen) {\n return;\n }\n const step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {\n return;\n }\n const map = tr.mapping.maps[last];\n let end = 0;\n map.forEach((_from, _to, _newFrom, newTo) => {\n if (end === 0) {\n end = newTo;\n }\n });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\nconst isFragment = nodeOrFragment => {\n return !('type' in nodeOrFragment);\n};\nconst insertContentAt = (position, value, options) => ({\n tr,\n dispatch,\n editor\n}) => {\n var _a;\n if (dispatch) {\n options = {\n parseOptions: editor.options.parseOptions,\n updateSelection: true,\n applyInputRules: false,\n applyPasteRules: false,\n ...options\n };\n let content;\n try {\n content = createNodeFromContent(value, editor.schema, {\n parseOptions: {\n preserveWhitespace: 'full',\n ...options.parseOptions\n },\n errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck\n });\n } catch (e) {\n editor.emit('contentError', {\n editor,\n error: e,\n disableCollaboration: () => {\n if (editor.storage.collaboration) {\n editor.storage.collaboration.isDisabled = true;\n }\n }\n });\n return false;\n }\n let {\n from,\n to\n } = typeof position === 'number' ? {\n from: position,\n to: position\n } : {\n from: position.from,\n to: position.to\n };\n let isOnlyTextContent = true;\n let isOnlyBlockContent = true;\n const nodes = isFragment(content) ? content : [content];\n nodes.forEach(node => {\n // check if added node is valid\n node.check();\n isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;\n isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;\n });\n // check if we can replace the wrapping node by\n // the newly inserted content\n // example:\n // replace an empty paragraph by an inserted image\n // instead of inserting the image below the paragraph\n if (from === to && isOnlyBlockContent) {\n const {\n parent\n } = tr.doc.resolve(from);\n const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;\n if (isEmptyTextBlock) {\n from -= 1;\n to += 1;\n }\n }\n let newContent;\n // if there is only plain text we have to use `insertText`\n // because this will keep the current marks\n if (isOnlyTextContent) {\n // if value is string, we can use it directly\n // otherwise if it is an array, we have to join it\n if (Array.isArray(value)) {\n newContent = value.map(v => v.text || '').join('');\n } else if (value instanceof Fragment) {\n let text = '';\n value.forEach(node => {\n if (node.text) {\n text += node.text;\n }\n });\n newContent = text;\n } else if (typeof value === 'object' && !!value && !!value.text) {\n newContent = value.text;\n } else {\n newContent = value;\n }\n tr.insertText(newContent, from, to);\n } else {\n newContent = content;\n tr.replaceWith(from, to, newContent);\n }\n // set cursor at end of inserted content\n if (options.updateSelection) {\n selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n }\n if (options.applyInputRules) {\n tr.setMeta('applyInputRules', {\n from,\n text: newContent\n });\n }\n if (options.applyPasteRules) {\n tr.setMeta('applyPasteRules', {\n from,\n text: newContent\n });\n }\n }\n return true;\n};\nconst joinUp = () => ({\n state,\n dispatch\n}) => {\n return joinUp$1(state, dispatch);\n};\nconst joinDown = () => ({\n state,\n dispatch\n}) => {\n return joinDown$1(state, dispatch);\n};\nconst joinBackward = () => ({\n state,\n dispatch\n}) => {\n return joinBackward$1(state, dispatch);\n};\nconst joinForward = () => ({\n state,\n dispatch\n}) => {\n return joinForward$1(state, dispatch);\n};\nconst joinItemBackward = () => ({\n state,\n dispatch,\n tr\n}) => {\n try {\n const point = joinPoint(state.doc, state.selection.$from.pos, -1);\n if (point === null || point === undefined) {\n return false;\n }\n tr.join(point, 2);\n if (dispatch) {\n dispatch(tr);\n }\n return true;\n } catch (e) {\n return false;\n }\n};\nconst joinItemForward = () => ({\n state,\n dispatch,\n tr\n}) => {\n try {\n const point = joinPoint(state.doc, state.selection.$from.pos, +1);\n if (point === null || point === undefined) {\n return false;\n }\n tr.join(point, 2);\n if (dispatch) {\n dispatch(tr);\n }\n return true;\n } catch (e) {\n return false;\n }\n};\nconst joinTextblockBackward = () => ({\n state,\n dispatch\n}) => {\n return joinTextblockBackward$1(state, dispatch);\n};\nconst joinTextblockForward = () => ({\n state,\n dispatch\n}) => {\n return joinTextblockForward$1(state, dispatch);\n};\nfunction isMacOS() {\n return typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;\n}\nfunction normalizeKeyName(name) {\n const parts = name.split(/-(?!$)/);\n let result = parts[parts.length - 1];\n if (result === 'Space') {\n result = ' ';\n }\n let alt;\n let ctrl;\n let shift;\n let meta;\n for (let i = 0; i < parts.length - 1; i += 1) {\n const mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) {\n meta = true;\n } else if (/^a(lt)?$/i.test(mod)) {\n alt = true;\n } else if (/^(c|ctrl|control)$/i.test(mod)) {\n ctrl = true;\n } else if (/^s(hift)?$/i.test(mod)) {\n shift = true;\n } else if (/^mod$/i.test(mod)) {\n if (isiOS() || isMacOS()) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n throw new Error(`Unrecognized modifier name: ${mod}`);\n }\n }\n if (alt) {\n result = `Alt-${result}`;\n }\n if (ctrl) {\n result = `Ctrl-${result}`;\n }\n if (meta) {\n result = `Meta-${result}`;\n }\n if (shift) {\n result = `Shift-${result}`;\n }\n return result;\n}\nconst keyboardShortcut = name => ({\n editor,\n view,\n tr,\n dispatch\n}) => {\n const keys = normalizeKeyName(name).split(/-(?!$)/);\n const key = keys.find(item => !['Alt', 'Ctrl', 'Meta', 'Shift'].includes(item));\n const event = new KeyboardEvent('keydown', {\n key: key === 'Space' ? ' ' : key,\n altKey: keys.includes('Alt'),\n ctrlKey: keys.includes('Ctrl'),\n metaKey: keys.includes('Meta'),\n shiftKey: keys.includes('Shift'),\n bubbles: true,\n cancelable: true\n });\n const capturedTransaction = editor.captureTransaction(() => {\n view.someProp('handleKeyDown', f => f(view, event));\n });\n capturedTransaction === null || capturedTransaction === void 0 ? void 0 : capturedTransaction.steps.forEach(step => {\n const newStep = step.map(tr.mapping);\n if (newStep && dispatch) {\n tr.maybeStep(newStep);\n }\n });\n return true;\n};\nfunction isNodeActive(state, typeOrName, attributes = {}) {\n const {\n from,\n to,\n empty\n } = state.selection;\n const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;\n const nodeRanges = [];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isText) {\n return;\n }\n const relativeFrom = Math.max(from, pos);\n const relativeTo = Math.min(to, pos + node.nodeSize);\n nodeRanges.push({\n node,\n from: relativeFrom,\n to: relativeTo\n });\n });\n const selectionRange = to - from;\n const matchedNodeRanges = nodeRanges.filter(nodeRange => {\n if (!type) {\n return true;\n }\n return type.name === nodeRange.node.type.name;\n }).filter(nodeRange => objectIncludes(nodeRange.node.attrs, attributes, {\n strict: false\n }));\n if (empty) {\n return !!matchedNodeRanges.length;\n }\n const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);\n return range >= selectionRange;\n}\nconst lift = (typeOrName, attributes = {}) => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const isActive = isNodeActive(state, type, attributes);\n if (!isActive) {\n return false;\n }\n return lift$1(state, dispatch);\n};\nconst liftEmptyBlock = () => ({\n state,\n dispatch\n}) => {\n return liftEmptyBlock$1(state, dispatch);\n};\nconst liftListItem = typeOrName => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return liftListItem$1(type)(state, dispatch);\n};\nconst newlineInCode = () => ({\n state,\n dispatch\n}) => {\n return newlineInCode$1(state, dispatch);\n};\n\n/**\n * Get the type of a schema item by its name.\n * @param name The name of the schema item\n * @param schema The Prosemiror schema to search in\n * @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist\n */\nfunction getSchemaTypeNameByName(name, schema) {\n if (schema.nodes[name]) {\n return 'node';\n }\n if (schema.marks[name]) {\n return 'mark';\n }\n return null;\n}\n\n/**\n * Remove a property or an array of properties from an object\n * @param obj Object\n * @param key Key to remove\n */\nfunction deleteProps(obj, propOrProps) {\n const props = typeof propOrProps === 'string' ? [propOrProps] : propOrProps;\n return Object.keys(obj).reduce((newObj, prop) => {\n if (!props.includes(prop)) {\n newObj[prop] = obj[prop];\n }\n return newObj;\n }, {});\n}\nconst resetAttributes = (typeOrName, attributes) => ({\n tr,\n state,\n dispatch\n}) => {\n let nodeType = null;\n let markType = null;\n const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);\n if (!schemaType) {\n return false;\n }\n if (schemaType === 'node') {\n nodeType = getNodeType(typeOrName, state.schema);\n }\n if (schemaType === 'mark') {\n markType = getMarkType(typeOrName, state.schema);\n }\n if (dispatch) {\n tr.selection.ranges.forEach(range => {\n state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {\n if (nodeType && nodeType === node.type) {\n tr.setNodeMarkup(pos, undefined, deleteProps(node.attrs, attributes));\n }\n if (markType && node.marks.length) {\n node.marks.forEach(mark => {\n if (markType === mark.type) {\n tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));\n }\n });\n }\n });\n });\n }\n return true;\n};\nconst scrollIntoView = () => ({\n tr,\n dispatch\n}) => {\n if (dispatch) {\n tr.scrollIntoView();\n }\n return true;\n};\nconst selectAll = () => ({\n tr,\n commands\n}) => {\n return commands.setTextSelection({\n from: 0,\n to: tr.doc.content.size\n });\n};\nconst selectNodeBackward = () => ({\n state,\n dispatch\n}) => {\n return selectNodeBackward$1(state, dispatch);\n};\nconst selectNodeForward = () => ({\n state,\n dispatch\n}) => {\n return selectNodeForward$1(state, dispatch);\n};\nconst selectParentNode = () => ({\n state,\n dispatch\n}) => {\n return selectParentNode$1(state, dispatch);\n};\n\n// @ts-ignore\n// TODO: add types to @types/prosemirror-commands\nconst selectTextblockEnd = () => ({\n state,\n dispatch\n}) => {\n return selectTextblockEnd$1(state, dispatch);\n};\n\n// @ts-ignore\n// TODO: add types to @types/prosemirror-commands\nconst selectTextblockStart = () => ({\n state,\n dispatch\n}) => {\n return selectTextblockStart$1(state, dispatch);\n};\n\n/**\n * Create a new Prosemirror document node from content.\n * @param content The JSON or HTML content to create the document from\n * @param schema The Prosemirror schema to use for the document\n * @param parseOptions Options for the parser\n * @returns The created Prosemirror document node\n */\nfunction createDocument(content, schema, parseOptions = {}, options = {}) {\n return createNodeFromContent(content, schema, {\n slice: false,\n parseOptions,\n errorOnInvalidContent: options.errorOnInvalidContent\n });\n}\nconst setContent = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({\n editor,\n tr,\n dispatch,\n commands\n}) => {\n var _a, _b;\n const {\n doc\n } = tr;\n // This is to keep backward compatibility with the previous behavior\n // TODO remove this in the next major version\n if (parseOptions.preserveWhitespace !== 'full') {\n const document = createDocument(content, editor.schema, parseOptions, {\n errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck\n });\n if (dispatch) {\n tr.replaceWith(0, doc.content.size, document).setMeta('preventUpdate', !emitUpdate);\n }\n return true;\n }\n if (dispatch) {\n tr.setMeta('preventUpdate', !emitUpdate);\n }\n return commands.insertContentAt({\n from: 0,\n to: doc.content.size\n }, content, {\n parseOptions,\n errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck\n });\n};\nfunction getMarkAttributes(state, typeOrName) {\n const type = getMarkType(typeOrName, state.schema);\n const {\n from,\n to,\n empty\n } = state.selection;\n const marks = [];\n if (empty) {\n if (state.storedMarks) {\n marks.push(...state.storedMarks);\n }\n marks.push(...state.selection.$head.marks());\n } else {\n state.doc.nodesBetween(from, to, node => {\n marks.push(...node.marks);\n });\n }\n const mark = marks.find(markItem => markItem.type.name === type.name);\n if (!mark) {\n return {};\n }\n return {\n ...mark.attrs\n };\n}\n\n/**\n * Returns a new `Transform` based on all steps of the passed transactions.\n * @param oldDoc The Prosemirror node to start from\n * @param transactions The transactions to combine\n * @returns A new `Transform` with all steps of the passed transactions\n */\nfunction combineTransactionSteps(oldDoc, transactions) {\n const transform = new Transform(oldDoc);\n transactions.forEach(transaction => {\n transaction.steps.forEach(step => {\n transform.step(step);\n });\n });\n return transform;\n}\n\n/**\n * Gets the default block type at a given match\n * @param match The content match to get the default block type from\n * @returns The default block type or null\n */\nfunction defaultBlockAt(match) {\n for (let i = 0; i < match.edgeCount; i += 1) {\n const {\n type\n } = match.edge(i);\n if (type.isTextblock && !type.hasRequiredAttrs()) {\n return type;\n }\n }\n return null;\n}\n\n/**\n * Find children inside a Prosemirror node that match a predicate.\n * @param node The Prosemirror node to search in\n * @param predicate The predicate to match\n * @returns An array of nodes with their positions\n */\nfunction findChildren(node, predicate) {\n const nodesWithPos = [];\n node.descendants((child, pos) => {\n if (predicate(child)) {\n nodesWithPos.push({\n node: child,\n pos\n });\n }\n });\n return nodesWithPos;\n}\n\n/**\n * Same as `findChildren` but searches only within a `range`.\n * @param node The Prosemirror node to search in\n * @param range The range to search in\n * @param predicate The predicate to match\n * @returns An array of nodes with their positions\n */\nfunction findChildrenInRange(node, range, predicate) {\n const nodesWithPos = [];\n // if (range.from === range.to) {\n // const nodeAt = node.nodeAt(range.from)\n // if (nodeAt) {\n // nodesWithPos.push({\n // node: nodeAt,\n // pos: range.from,\n // })\n // }\n // }\n node.nodesBetween(range.from, range.to, (child, pos) => {\n if (predicate(child)) {\n nodesWithPos.push({\n node: child,\n pos\n });\n }\n });\n return nodesWithPos;\n}\n\n/**\n * Finds the closest parent node to a resolved position that matches a predicate.\n * @param $pos The resolved position to search from\n * @param predicate The predicate to match\n * @returns The closest parent node to the resolved position that matches the predicate\n * @example ```js\n * findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')\n * ```\n */\nfunction findParentNodeClosestToPos($pos, predicate) {\n for (let i = $pos.depth; i > 0; i -= 1) {\n const node = $pos.node(i);\n if (predicate(node)) {\n return {\n pos: i > 0 ? $pos.before(i) : 0,\n start: $pos.start(i),\n depth: i,\n node\n };\n }\n }\n}\n\n/**\n * Finds the closest parent node to the current selection that matches a predicate.\n * @param predicate The predicate to match\n * @returns A command that finds the closest parent node to the current selection that matches the predicate\n * @example ```js\n * findParentNode(node => node.type.name === 'paragraph')\n * ```\n */\nfunction findParentNode(predicate) {\n return selection => findParentNodeClosestToPos(selection.$from, predicate);\n}\nfunction getSchema(extensions, editor) {\n const resolvedExtensions = ExtensionManager.resolve(extensions);\n return getSchemaByResolvedExtensions(resolvedExtensions, editor);\n}\n\n/**\n * Generate HTML from a JSONContent\n * @param doc The JSONContent to generate HTML from\n * @param extensions The extensions to use for the schema\n * @returns The generated HTML\n */\nfunction generateHTML(doc, extensions) {\n const schema = getSchema(extensions);\n const contentNode = Node$1.fromJSON(schema, doc);\n return getHTMLFromFragment(contentNode.content, schema);\n}\n\n/**\n * Generate JSONContent from HTML\n * @param html The HTML to generate JSONContent from\n * @param extensions The extensions to use for the schema\n * @returns The generated JSONContent\n */\nfunction generateJSON(html, extensions) {\n const schema = getSchema(extensions);\n const dom = elementFromString(html);\n return DOMParser.fromSchema(schema).parse(dom).toJSON();\n}\n\n/**\n * Gets the text of a Prosemirror node\n * @param node The Prosemirror node\n * @param options Options for the text serializer & block separator\n * @returns The text of the node\n * @example ```js\n * const text = getText(node, { blockSeparator: '\\n' })\n * ```\n */\nfunction getText(node, options) {\n const range = {\n from: 0,\n to: node.content.size\n };\n return getTextBetween(node, range, options);\n}\n\n/**\n * Generate raw text from a JSONContent\n * @param doc The JSONContent to generate text from\n * @param extensions The extensions to use for the schema\n * @param options Options for the text generation f.e. blockSeparator or textSerializers\n * @returns The generated text\n */\nfunction generateText(doc, extensions, options) {\n const {\n blockSeparator = '\\n\\n',\n textSerializers = {}\n } = options || {};\n const schema = getSchema(extensions);\n const contentNode = Node$1.fromJSON(schema, doc);\n return getText(contentNode, {\n blockSeparator,\n textSerializers: {\n ...getTextSerializersFromSchema(schema),\n ...textSerializers\n }\n });\n}\nfunction getNodeAttributes(state, typeOrName) {\n const type = getNodeType(typeOrName, state.schema);\n const {\n from,\n to\n } = state.selection;\n const nodes = [];\n state.doc.nodesBetween(from, to, node => {\n nodes.push(node);\n });\n const node = nodes.reverse().find(nodeItem => nodeItem.type.name === type.name);\n if (!node) {\n return {};\n }\n return {\n ...node.attrs\n };\n}\n\n/**\n * Get node or mark attributes by type or name on the current editor state\n * @param state The current editor state\n * @param typeOrName The node or mark type or name\n * @returns The attributes of the node or mark or an empty object\n */\nfunction getAttributes(state, typeOrName) {\n const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);\n if (schemaType === 'node') {\n return getNodeAttributes(state, typeOrName);\n }\n if (schemaType === 'mark') {\n return getMarkAttributes(state, typeOrName);\n }\n return {};\n}\n\n/**\n * Removes duplicated values within an array.\n * Supports numbers, strings and objects.\n */\nfunction removeDuplicates(array, by = JSON.stringify) {\n const seen = {};\n return array.filter(item => {\n const key = by(item);\n return Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;\n });\n}\n\n/**\n * Removes duplicated ranges and ranges that are\n * fully captured by other ranges.\n */\nfunction simplifyChangedRanges(changes) {\n const uniqueChanges = removeDuplicates(changes);\n return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {\n const rest = uniqueChanges.filter((_, i) => i !== index);\n return !rest.some(otherChange => {\n return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;\n });\n });\n}\n/**\n * Returns a list of changed ranges\n * based on the first and last state of all steps.\n */\nfunction getChangedRanges(transform) {\n const {\n mapping,\n steps\n } = transform;\n const changes = [];\n mapping.maps.forEach((stepMap, index) => {\n const ranges = [];\n // This accounts for step changes where no range was actually altered\n // e.g. when setting a mark, node attribute, etc.\n // @ts-ignore\n if (!stepMap.ranges.length) {\n const {\n from,\n to\n } = steps[index];\n if (from === undefined || to === undefined) {\n return;\n }\n ranges.push({\n from,\n to\n });\n } else {\n stepMap.forEach((from, to) => {\n ranges.push({\n from,\n to\n });\n });\n }\n ranges.forEach(({\n from,\n to\n }) => {\n const newStart = mapping.slice(index).map(from, -1);\n const newEnd = mapping.slice(index).map(to);\n const oldStart = mapping.invert().map(newStart, -1);\n const oldEnd = mapping.invert().map(newEnd);\n changes.push({\n oldRange: {\n from: oldStart,\n to: oldEnd\n },\n newRange: {\n from: newStart,\n to: newEnd\n }\n });\n });\n });\n return simplifyChangedRanges(changes);\n}\nfunction getDebugJSON(node, startOffset = 0) {\n const isTopNode = node.type === node.type.schema.topNodeType;\n const increment = isTopNode ? 0 : 1;\n const from = startOffset;\n const to = from + node.nodeSize;\n const marks = node.marks.map(mark => {\n const output = {\n type: mark.type.name\n };\n if (Object.keys(mark.attrs).length) {\n output.attrs = {\n ...mark.attrs\n };\n }\n return output;\n });\n const attrs = {\n ...node.attrs\n };\n const output = {\n type: node.type.name,\n from,\n to\n };\n if (Object.keys(attrs).length) {\n output.attrs = attrs;\n }\n if (marks.length) {\n output.marks = marks;\n }\n if (node.content.childCount) {\n output.content = [];\n node.forEach((child, offset) => {\n var _a;\n (_a = output.content) === null || _a === void 0 ? void 0 : _a.push(getDebugJSON(child, startOffset + offset + increment));\n });\n }\n if (node.text) {\n output.text = node.text;\n }\n return output;\n}\nfunction getMarksBetween(from, to, doc) {\n const marks = [];\n // get all inclusive marks on empty selection\n if (from === to) {\n doc.resolve(from).marks().forEach(mark => {\n const $pos = doc.resolve(from);\n const range = getMarkRange($pos, mark.type);\n if (!range) {\n return;\n }\n marks.push({\n mark,\n ...range\n });\n });\n } else {\n doc.nodesBetween(from, to, (node, pos) => {\n if (!node || (node === null || node === void 0 ? void 0 : node.nodeSize) === undefined) {\n return;\n }\n marks.push(...node.marks.map(mark => ({\n from: pos,\n to: pos + node.nodeSize,\n mark\n })));\n });\n }\n return marks;\n}\n\n/**\n * Finds the first node of a given type or name in the current selection.\n * @param state The editor state.\n * @param typeOrName The node type or name.\n * @param pos The position to start searching from.\n * @param maxDepth The maximum depth to search.\n * @returns The node and the depth as an array.\n */\nconst getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {\n const $pos = state.doc.resolve(pos);\n let currentDepth = maxDepth;\n let node = null;\n while (currentDepth > 0 && node === null) {\n const currentNode = $pos.node(currentDepth);\n if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type.name) === typeOrName) {\n node = currentNode;\n } else {\n currentDepth -= 1;\n }\n }\n return [node, currentDepth];\n};\n\n/**\n * Return attributes of an extension that should be splitted by keepOnSplit flag\n * @param extensionAttributes Array of extension attributes\n * @param typeName The type of the extension\n * @param attributes The attributes of the extension\n * @returns The splitted attributes\n */\nfunction getSplittedAttributes(extensionAttributes, typeName, attributes) {\n return Object.fromEntries(Object.entries(attributes).filter(([name]) => {\n const extensionAttribute = extensionAttributes.find(item => {\n return item.type === typeName && item.name === name;\n });\n if (!extensionAttribute) {\n return false;\n }\n return extensionAttribute.attribute.keepOnSplit;\n }));\n}\nfunction isMarkActive(state, typeOrName, attributes = {}) {\n const {\n empty,\n ranges\n } = state.selection;\n const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;\n if (empty) {\n return !!(state.storedMarks || state.selection.$from.marks()).filter(mark => {\n if (!type) {\n return true;\n }\n return type.name === mark.type.name;\n }).find(mark => objectIncludes(mark.attrs, attributes, {\n strict: false\n }));\n }\n let selectionRange = 0;\n const markRanges = [];\n ranges.forEach(({\n $from,\n $to\n }) => {\n const from = $from.pos;\n const to = $to.pos;\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isText && !node.marks.length) {\n return;\n }\n const relativeFrom = Math.max(from, pos);\n const relativeTo = Math.min(to, pos + node.nodeSize);\n const range = relativeTo - relativeFrom;\n selectionRange += range;\n markRanges.push(...node.marks.map(mark => ({\n mark,\n from: relativeFrom,\n to: relativeTo\n })));\n });\n });\n if (selectionRange === 0) {\n return false;\n }\n // calculate range of matched mark\n const matchedRange = markRanges.filter(markRange => {\n if (!type) {\n return true;\n }\n return type.name === markRange.mark.type.name;\n }).filter(markRange => objectIncludes(markRange.mark.attrs, attributes, {\n strict: false\n })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n // calculate range of marks that excludes the searched mark\n // for example `code` doesn’t allow any other marks\n const excludedRange = markRanges.filter(markRange => {\n if (!type) {\n return true;\n }\n return markRange.mark.type !== type && markRange.mark.type.excludes(type);\n }).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n // we only include the result of `excludedRange`\n // if there is a match at all\n const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;\n return range >= selectionRange;\n}\nfunction isActive(state, name, attributes = {}) {\n if (!name) {\n return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);\n }\n const schemaType = getSchemaTypeNameByName(name, state.schema);\n if (schemaType === 'node') {\n return isNodeActive(state, name, attributes);\n }\n if (schemaType === 'mark') {\n return isMarkActive(state, name, attributes);\n }\n return false;\n}\nconst isAtEndOfNode = (state, nodeType) => {\n const {\n $from,\n $to,\n $anchor\n } = state.selection;\n if (nodeType) {\n const parentNode = findParentNode(node => node.type.name === nodeType)(state.selection);\n if (!parentNode) {\n return false;\n }\n const $parentPos = state.doc.resolve(parentNode.pos + 1);\n if ($anchor.pos + 1 === $parentPos.end()) {\n return true;\n }\n return false;\n }\n if ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) {\n return false;\n }\n return true;\n};\nconst isAtStartOfNode = state => {\n const {\n $from,\n $to\n } = state.selection;\n if ($from.parentOffset > 0 || $from.pos !== $to.pos) {\n return false;\n }\n return true;\n};\nfunction isList(name, extensions) {\n const {\n nodeExtensions\n } = splitExtensions(extensions);\n const extension = nodeExtensions.find(item => item.name === name);\n if (!extension) {\n return false;\n }\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const group = callOrReturn(getExtensionField(extension, 'group', context));\n if (typeof group !== 'string') {\n return false;\n }\n return group.split(' ').includes('list');\n}\n\n/**\n * Returns true if the given prosemirror node is empty.\n */\nfunction isNodeEmpty(node, {\n checkChildren = true,\n ignoreWhitespace = false\n} = {}) {\n var _a;\n if (ignoreWhitespace) {\n if (node.type.name === 'hardBreak') {\n // Hard breaks are considered empty\n return true;\n }\n if (node.isText) {\n return /^\\s*$/m.test((_a = node.text) !== null && _a !== void 0 ? _a : '');\n }\n }\n if (node.isText) {\n return !node.text;\n }\n if (node.isAtom || node.isLeaf) {\n return false;\n }\n if (node.content.childCount === 0) {\n return true;\n }\n if (checkChildren) {\n let isContentEmpty = true;\n node.content.forEach(childNode => {\n if (isContentEmpty === false) {\n // Exit early for perf\n return;\n }\n if (!isNodeEmpty(childNode, {\n ignoreWhitespace,\n checkChildren\n })) {\n isContentEmpty = false;\n }\n });\n return isContentEmpty;\n }\n return false;\n}\nfunction isNodeSelection(value) {\n return value instanceof NodeSelection;\n}\nfunction posToDOMRect(view, from, to) {\n const minPos = 0;\n const maxPos = view.state.doc.content.size;\n const resolvedFrom = minMax(from, minPos, maxPos);\n const resolvedEnd = minMax(to, minPos, maxPos);\n const start = view.coordsAtPos(resolvedFrom);\n const end = view.coordsAtPos(resolvedEnd, -1);\n const top = Math.min(start.top, end.top);\n const bottom = Math.max(start.bottom, end.bottom);\n const left = Math.min(start.left, end.left);\n const right = Math.max(start.right, end.right);\n const width = right - left;\n const height = bottom - top;\n const x = left;\n const y = top;\n const data = {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x,\n y\n };\n return {\n ...data,\n toJSON: () => data\n };\n}\nfunction canSetMark(state, tr, newMarkType) {\n var _a;\n const {\n selection\n } = tr;\n let cursor = null;\n if (isTextSelection(selection)) {\n cursor = selection.$cursor;\n }\n if (cursor) {\n const currentMarks = (_a = state.storedMarks) !== null && _a !== void 0 ? _a : cursor.marks();\n // There can be no current marks that exclude the new mark\n return !!newMarkType.isInSet(currentMarks) || !currentMarks.some(mark => mark.type.excludes(newMarkType));\n }\n const {\n ranges\n } = selection;\n return ranges.some(({\n $from,\n $to\n }) => {\n let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;\n state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {\n // If we already found a mark that we can enable, return false to bypass the remaining search\n if (someNodeSupportsMark) {\n return false;\n }\n if (node.isInline) {\n const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);\n const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some(otherMark => otherMark.type.excludes(newMarkType));\n someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;\n }\n return !someNodeSupportsMark;\n });\n return someNodeSupportsMark;\n });\n}\nconst setMark = (typeOrName, attributes = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const {\n empty,\n ranges\n } = selection;\n const type = getMarkType(typeOrName, state.schema);\n if (dispatch) {\n if (empty) {\n const oldAttributes = getMarkAttributes(state, type);\n tr.addStoredMark(type.create({\n ...oldAttributes,\n ...attributes\n }));\n } else {\n ranges.forEach(range => {\n const from = range.$from.pos;\n const to = range.$to.pos;\n state.doc.nodesBetween(from, to, (node, pos) => {\n const trimmedFrom = Math.max(pos, from);\n const trimmedTo = Math.min(pos + node.nodeSize, to);\n const someHasMark = node.marks.find(mark => mark.type === type);\n // if there is already a mark of this type\n // we know that we have to merge its attributes\n // otherwise we add a fresh new mark\n if (someHasMark) {\n node.marks.forEach(mark => {\n if (type === mark.type) {\n tr.addMark(trimmedFrom, trimmedTo, type.create({\n ...mark.attrs,\n ...attributes\n }));\n }\n });\n } else {\n tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));\n }\n });\n });\n }\n }\n return canSetMark(state, tr, type);\n};\nconst setMeta = (key, value) => ({\n tr\n}) => {\n tr.setMeta(key, value);\n return true;\n};\nconst setNode = (typeOrName, attributes = {}) => ({\n state,\n dispatch,\n chain\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n let attributesToCopy;\n if (state.selection.$anchor.sameParent(state.selection.$head)) {\n // only copy attributes if the selection is pointing to a node of the same type\n attributesToCopy = state.selection.$anchor.parent.attrs;\n }\n // TODO: use a fallback like insertContent?\n if (!type.isTextblock) {\n console.warn('[tiptap warn]: Currently \"setNode()\" only supports text block nodes.');\n return false;\n }\n return chain()\n // try to convert node to default node if needed\n .command(({\n commands\n }) => {\n const canSetBlock = setBlockType(type, {\n ...attributesToCopy,\n ...attributes\n })(state);\n if (canSetBlock) {\n return true;\n }\n return commands.clearNodes();\n }).command(({\n state: updatedState\n }) => {\n return setBlockType(type, {\n ...attributesToCopy,\n ...attributes\n })(updatedState, dispatch);\n }).run();\n};\nconst setNodeSelection = position => ({\n tr,\n dispatch\n}) => {\n if (dispatch) {\n const {\n doc\n } = tr;\n const from = minMax(position, 0, doc.content.size);\n const selection = NodeSelection.create(doc, from);\n tr.setSelection(selection);\n }\n return true;\n};\nconst setTextSelection = position => ({\n tr,\n dispatch\n}) => {\n if (dispatch) {\n const {\n doc\n } = tr;\n const {\n from,\n to\n } = typeof position === 'number' ? {\n from: position,\n to: position\n } : position;\n const minPos = TextSelection.atStart(doc).from;\n const maxPos = TextSelection.atEnd(doc).to;\n const resolvedFrom = minMax(from, minPos, maxPos);\n const resolvedEnd = minMax(to, minPos, maxPos);\n const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);\n tr.setSelection(selection);\n }\n return true;\n};\nconst sinkListItem = typeOrName => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return sinkListItem$1(type)(state, dispatch);\n};\nfunction ensureMarks(state, splittableMarks) {\n const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n if (marks) {\n const filteredMarks = marks.filter(mark => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));\n state.tr.ensureMarks(filteredMarks);\n }\n}\nconst splitBlock = ({\n keepMarks = true\n} = {}) => ({\n tr,\n state,\n dispatch,\n editor\n}) => {\n const {\n selection,\n doc\n } = tr;\n const {\n $from,\n $to\n } = selection;\n const extensionAttributes = editor.extensionManager.attributes;\n const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);\n if (selection instanceof NodeSelection && selection.node.isBlock) {\n if (!$from.parentOffset || !canSplit(doc, $from.pos)) {\n return false;\n }\n if (dispatch) {\n if (keepMarks) {\n ensureMarks(state, editor.extensionManager.splittableMarks);\n }\n tr.split($from.pos).scrollIntoView();\n }\n return true;\n }\n if (!$from.parent.isBlock) {\n return false;\n }\n const atEnd = $to.parentOffset === $to.parent.content.size;\n const deflt = $from.depth === 0 ? undefined : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));\n let types = atEnd && deflt ? [{\n type: deflt,\n attrs: newAttributes\n }] : undefined;\n let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);\n if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{\n type: deflt\n }] : undefined)) {\n can = true;\n types = deflt ? [{\n type: deflt,\n attrs: newAttributes\n }] : undefined;\n }\n if (dispatch) {\n if (can) {\n if (selection instanceof TextSelection) {\n tr.deleteSelection();\n }\n tr.split(tr.mapping.map($from.pos), 1, types);\n if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {\n const first = tr.mapping.map($from.before());\n const $first = tr.doc.resolve(first);\n if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {\n tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);\n }\n }\n }\n if (keepMarks) {\n ensureMarks(state, editor.extensionManager.splittableMarks);\n }\n tr.scrollIntoView();\n }\n return can;\n};\nconst splitListItem = (typeOrName, overrideAttrs = {}) => ({\n tr,\n state,\n dispatch,\n editor\n}) => {\n var _a;\n const type = getNodeType(typeOrName, state.schema);\n const {\n $from,\n $to\n } = state.selection;\n // @ts-ignore\n // eslint-disable-next-line\n const node = state.selection.node;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {\n return false;\n }\n const grandParent = $from.node(-1);\n if (grandParent.type !== type) {\n return false;\n }\n const extensionAttributes = editor.extensionManager.attributes;\n if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {\n return false;\n }\n if (dispatch) {\n let wrap = Fragment.empty;\n // eslint-disable-next-line\n const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {\n wrap = Fragment.from($from.node(d).copy(wrap));\n }\n // eslint-disable-next-line\n const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n // Add a second list item with an empty default start node\n const newNextTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n ...overrideAttrs\n };\n const nextType = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes)) || undefined;\n wrap = wrap.append(Fragment.from(type.createAndFill(null, nextType) || undefined));\n const start = $from.before($from.depth - (depthBefore - 1));\n tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n let sel = -1;\n tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {\n if (sel > -1) {\n return false;\n }\n if (n.isTextblock && n.content.size === 0) {\n sel = pos + 1;\n }\n });\n if (sel > -1) {\n tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));\n }\n tr.scrollIntoView();\n }\n return true;\n }\n const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n const newTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),\n ...overrideAttrs\n };\n const newNextTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n ...overrideAttrs\n };\n tr.delete($from.pos, $to.pos);\n const types = nextType ? [{\n type,\n attrs: newTypeAttributes\n }, {\n type: nextType,\n attrs: newNextTypeAttributes\n }] : [{\n type,\n attrs: newTypeAttributes\n }];\n if (!canSplit(tr.doc, $from.pos, 2)) {\n return false;\n }\n if (dispatch) {\n const {\n selection,\n storedMarks\n } = state;\n const {\n splittableMarks\n } = editor.extensionManager;\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n tr.split($from.pos, 2, types).scrollIntoView();\n if (!marks || !dispatch) {\n return true;\n }\n const filteredMarks = marks.filter(mark => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n }\n return true;\n};\nconst joinListBackwards = (tr, listType) => {\n const list = findParentNode(node => node.type === listType)(tr.selection);\n if (!list) {\n return true;\n }\n const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);\n if (before === undefined) {\n return true;\n }\n const nodeBefore = tr.doc.nodeAt(before);\n const canJoinBackwards = list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos);\n if (!canJoinBackwards) {\n return true;\n }\n tr.join(list.pos);\n return true;\n};\nconst joinListForwards = (tr, listType) => {\n const list = findParentNode(node => node.type === listType)(tr.selection);\n if (!list) {\n return true;\n }\n const after = tr.doc.resolve(list.start).after(list.depth);\n if (after === undefined) {\n return true;\n }\n const nodeAfter = tr.doc.nodeAt(after);\n const canJoinForwards = list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && canJoin(tr.doc, after);\n if (!canJoinForwards) {\n return true;\n }\n tr.join(after);\n return true;\n};\nconst toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({\n editor,\n tr,\n state,\n dispatch,\n chain,\n commands,\n can\n}) => {\n const {\n extensions,\n splittableMarks\n } = editor.extensionManager;\n const listType = getNodeType(listTypeOrName, state.schema);\n const itemType = getNodeType(itemTypeOrName, state.schema);\n const {\n selection,\n storedMarks\n } = state;\n const {\n $from,\n $to\n } = selection;\n const range = $from.blockRange($to);\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n if (!range) {\n return false;\n }\n const parentList = findParentNode(node => isList(node.type.name, extensions))(selection);\n if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {\n // remove list\n if (parentList.node.type === listType) {\n return commands.liftListItem(itemType);\n }\n // change list type\n if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {\n return chain().command(() => {\n tr.setNodeMarkup(parentList.pos, listType);\n return true;\n }).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n }\n }\n if (!keepMarks || !marks || !dispatch) {\n return chain()\n // try to convert node to default node if needed\n .command(() => {\n const canWrapInList = can().wrapInList(listType, attributes);\n if (canWrapInList) {\n return true;\n }\n return commands.clearNodes();\n }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n }\n return chain()\n // try to convert node to default node if needed\n .command(() => {\n const canWrapInList = can().wrapInList(listType, attributes);\n const filteredMarks = marks.filter(mark => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n if (canWrapInList) {\n return true;\n }\n return commands.clearNodes();\n }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n};\nconst toggleMark = (typeOrName, attributes = {}, options = {}) => ({\n state,\n commands\n}) => {\n const {\n extendEmptyMarkRange = false\n } = options;\n const type = getMarkType(typeOrName, state.schema);\n const isActive = isMarkActive(state, type, attributes);\n if (isActive) {\n return commands.unsetMark(type, {\n extendEmptyMarkRange\n });\n }\n return commands.setMark(type, attributes);\n};\nconst toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({\n state,\n commands\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const toggleType = getNodeType(toggleTypeOrName, state.schema);\n const isActive = isNodeActive(state, type, attributes);\n let attributesToCopy;\n if (state.selection.$anchor.sameParent(state.selection.$head)) {\n // only copy attributes if the selection is pointing to a node of the same type\n attributesToCopy = state.selection.$anchor.parent.attrs;\n }\n if (isActive) {\n return commands.setNode(toggleType, attributesToCopy);\n }\n // If the node is not active, we want to set the new node type with the given attributes\n // Copying over the attributes from the current node if the selection is pointing to a node of the same type\n return commands.setNode(type, {\n ...attributesToCopy,\n ...attributes\n });\n};\nconst toggleWrap = (typeOrName, attributes = {}) => ({\n state,\n commands\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const isActive = isNodeActive(state, type, attributes);\n if (isActive) {\n return commands.lift(type);\n }\n return commands.wrapIn(type, attributes);\n};\nconst undoInputRule = () => ({\n state,\n dispatch\n}) => {\n const plugins = state.plugins;\n for (let i = 0; i < plugins.length; i += 1) {\n const plugin = plugins[i];\n let undoable;\n // @ts-ignore\n // eslint-disable-next-line\n if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n if (dispatch) {\n const tr = state.tr;\n const toUndo = undoable.transform;\n for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {\n tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n }\n if (undoable.text) {\n const marks = tr.doc.resolve(undoable.from).marks();\n tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n } else {\n tr.delete(undoable.from, undoable.to);\n }\n }\n return true;\n }\n }\n return false;\n};\nconst unsetAllMarks = () => ({\n tr,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const {\n empty,\n ranges\n } = selection;\n if (empty) {\n return true;\n }\n if (dispatch) {\n ranges.forEach(range => {\n tr.removeMark(range.$from.pos, range.$to.pos);\n });\n }\n return true;\n};\nconst unsetMark = (typeOrName, options = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n var _a;\n const {\n extendEmptyMarkRange = false\n } = options;\n const {\n selection\n } = tr;\n const type = getMarkType(typeOrName, state.schema);\n const {\n $from,\n empty,\n ranges\n } = selection;\n if (!dispatch) {\n return true;\n }\n if (empty && extendEmptyMarkRange) {\n let {\n from,\n to\n } = selection;\n const attrs = (_a = $from.marks().find(mark => mark.type === type)) === null || _a === void 0 ? void 0 : _a.attrs;\n const range = getMarkRange($from, type, attrs);\n if (range) {\n from = range.from;\n to = range.to;\n }\n tr.removeMark(from, to, type);\n } else {\n ranges.forEach(range => {\n tr.removeMark(range.$from.pos, range.$to.pos, type);\n });\n }\n tr.removeStoredMark(type);\n return true;\n};\nconst updateAttributes = (typeOrName, attributes = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n let nodeType = null;\n let markType = null;\n const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);\n if (!schemaType) {\n return false;\n }\n if (schemaType === 'node') {\n nodeType = getNodeType(typeOrName, state.schema);\n }\n if (schemaType === 'mark') {\n markType = getMarkType(typeOrName, state.schema);\n }\n if (dispatch) {\n tr.selection.ranges.forEach(range => {\n const from = range.$from.pos;\n const to = range.$to.pos;\n let lastPos;\n let lastNode;\n let trimmedFrom;\n let trimmedTo;\n if (tr.selection.empty) {\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (nodeType && nodeType === node.type) {\n trimmedFrom = Math.max(pos, from);\n trimmedTo = Math.min(pos + node.nodeSize, to);\n lastPos = pos;\n lastNode = node;\n }\n });\n } else {\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (pos < from && nodeType && nodeType === node.type) {\n trimmedFrom = Math.max(pos, from);\n trimmedTo = Math.min(pos + node.nodeSize, to);\n lastPos = pos;\n lastNode = node;\n }\n if (pos >= from && pos <= to) {\n if (nodeType && nodeType === node.type) {\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n ...attributes\n });\n }\n if (markType && node.marks.length) {\n node.marks.forEach(mark => {\n if (markType === mark.type) {\n const trimmedFrom2 = Math.max(pos, from);\n const trimmedTo2 = Math.min(pos + node.nodeSize, to);\n tr.addMark(trimmedFrom2, trimmedTo2, markType.create({\n ...mark.attrs,\n ...attributes\n }));\n }\n });\n }\n }\n });\n }\n if (lastNode) {\n if (lastPos !== undefined) {\n tr.setNodeMarkup(lastPos, undefined, {\n ...lastNode.attrs,\n ...attributes\n });\n }\n if (markType && lastNode.marks.length) {\n lastNode.marks.forEach(mark => {\n if (markType === mark.type) {\n tr.addMark(trimmedFrom, trimmedTo, markType.create({\n ...mark.attrs,\n ...attributes\n }));\n }\n });\n }\n }\n });\n }\n return true;\n};\nconst wrapIn = (typeOrName, attributes = {}) => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return wrapIn$1(type, attributes)(state, dispatch);\n};\nconst wrapInList = (typeOrName, attributes = {}) => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return wrapInList$1(type, attributes)(state, dispatch);\n};\nvar commands = /*#__PURE__*/Object.freeze({\n __proto__: null,\n blur: blur,\n clearContent: clearContent,\n clearNodes: clearNodes,\n command: command,\n createParagraphNear: createParagraphNear,\n cut: cut,\n deleteCurrentNode: deleteCurrentNode,\n deleteNode: deleteNode,\n deleteRange: deleteRange,\n deleteSelection: deleteSelection,\n enter: enter,\n exitCode: exitCode,\n extendMarkRange: extendMarkRange,\n first: first,\n focus: focus,\n forEach: forEach,\n insertContent: insertContent,\n insertContentAt: insertContentAt,\n joinBackward: joinBackward,\n joinDown: joinDown,\n joinForward: joinForward,\n joinItemBackward: joinItemBackward,\n joinItemForward: joinItemForward,\n joinTextblockBackward: joinTextblockBackward,\n joinTextblockForward: joinTextblockForward,\n joinUp: joinUp,\n keyboardShortcut: keyboardShortcut,\n lift: lift,\n liftEmptyBlock: liftEmptyBlock,\n liftListItem: liftListItem,\n newlineInCode: newlineInCode,\n resetAttributes: resetAttributes,\n scrollIntoView: scrollIntoView,\n selectAll: selectAll,\n selectNodeBackward: selectNodeBackward,\n selectNodeForward: selectNodeForward,\n selectParentNode: selectParentNode,\n selectTextblockEnd: selectTextblockEnd,\n selectTextblockStart: selectTextblockStart,\n setContent: setContent,\n setMark: setMark,\n setMeta: setMeta,\n setNode: setNode,\n setNodeSelection: setNodeSelection,\n setTextSelection: setTextSelection,\n sinkListItem: sinkListItem,\n splitBlock: splitBlock,\n splitListItem: splitListItem,\n toggleList: toggleList,\n toggleMark: toggleMark,\n toggleNode: toggleNode,\n toggleWrap: toggleWrap,\n undoInputRule: undoInputRule,\n unsetAllMarks: unsetAllMarks,\n unsetMark: unsetMark,\n updateAttributes: updateAttributes,\n wrapIn: wrapIn,\n wrapInList: wrapInList\n});\nconst Commands = Extension.create({\n name: 'commands',\n addCommands() {\n return {\n ...commands\n };\n }\n});\nconst Drop = Extension.create({\n name: 'drop',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('tiptapDrop'),\n props: {\n handleDrop: (_, e, slice, moved) => {\n this.editor.emit('drop', {\n editor: this.editor,\n event: e,\n slice,\n moved\n });\n }\n }\n })];\n }\n});\nconst Editable = Extension.create({\n name: 'editable',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('editable'),\n props: {\n editable: () => this.editor.options.editable\n }\n })];\n }\n});\nconst FocusEvents = Extension.create({\n name: 'focusEvents',\n addProseMirrorPlugins() {\n const {\n editor\n } = this;\n return [new Plugin({\n key: new PluginKey('focusEvents'),\n props: {\n handleDOMEvents: {\n focus: (view, event) => {\n editor.isFocused = true;\n const transaction = editor.state.tr.setMeta('focus', {\n event\n }).setMeta('addToHistory', false);\n view.dispatch(transaction);\n return false;\n },\n blur: (view, event) => {\n editor.isFocused = false;\n const transaction = editor.state.tr.setMeta('blur', {\n event\n }).setMeta('addToHistory', false);\n view.dispatch(transaction);\n return false;\n }\n }\n }\n })];\n }\n});\nconst Keymap = Extension.create({\n name: 'keymap',\n addKeyboardShortcuts() {\n const handleBackspace = () => this.editor.commands.first(({\n commands\n }) => [() => commands.undoInputRule(),\n // maybe convert first text block node to default node\n () => commands.command(({\n tr\n }) => {\n const {\n selection,\n doc\n } = tr;\n const {\n empty,\n $anchor\n } = selection;\n const {\n pos,\n parent\n } = $anchor;\n const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;\n const parentIsIsolating = $parentPos.parent.type.spec.isolating;\n const parentPos = $anchor.pos - $anchor.parentOffset;\n const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;\n if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === 'paragraph' // prevent clearNodes when no nodes to clear, otherwise history stack is appended\n ) {\n return false;\n }\n return commands.clearNodes();\n }), () => commands.deleteSelection(), () => commands.joinBackward(), () => commands.selectNodeBackward()]);\n const handleDelete = () => this.editor.commands.first(({\n commands\n }) => [() => commands.deleteSelection(), () => commands.deleteCurrentNode(), () => commands.joinForward(), () => commands.selectNodeForward()]);\n const handleEnter = () => this.editor.commands.first(({\n commands\n }) => [() => commands.newlineInCode(), () => commands.createParagraphNear(), () => commands.liftEmptyBlock(), () => commands.splitBlock()]);\n const baseKeymap = {\n Enter: handleEnter,\n 'Mod-Enter': () => this.editor.commands.exitCode(),\n Backspace: handleBackspace,\n 'Mod-Backspace': handleBackspace,\n 'Shift-Backspace': handleBackspace,\n Delete: handleDelete,\n 'Mod-Delete': handleDelete,\n 'Mod-a': () => this.editor.commands.selectAll()\n };\n const pcKeymap = {\n ...baseKeymap\n };\n const macKeymap = {\n ...baseKeymap,\n 'Ctrl-h': handleBackspace,\n 'Alt-Backspace': handleBackspace,\n 'Ctrl-d': handleDelete,\n 'Ctrl-Alt-Backspace': handleDelete,\n 'Alt-Delete': handleDelete,\n 'Alt-d': handleDelete,\n 'Ctrl-a': () => this.editor.commands.selectTextblockStart(),\n 'Ctrl-e': () => this.editor.commands.selectTextblockEnd()\n };\n if (isiOS() || isMacOS()) {\n return macKeymap;\n }\n return pcKeymap;\n },\n addProseMirrorPlugins() {\n return [\n // With this plugin we check if the whole document was selected and deleted.\n // In this case we will additionally call `clearNodes()` to convert e.g. a heading\n // to a paragraph if necessary.\n // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well\n // with many other commands.\n new Plugin({\n key: new PluginKey('clearDocument'),\n appendTransaction: (transactions, oldState, newState) => {\n const docChanges = transactions.some(transaction => transaction.docChanged) && !oldState.doc.eq(newState.doc);\n const ignoreTr = transactions.some(transaction => transaction.getMeta('preventClearDocument'));\n if (!docChanges || ignoreTr) {\n return;\n }\n const {\n empty,\n from,\n to\n } = oldState.selection;\n const allFrom = Selection.atStart(oldState.doc).from;\n const allEnd = Selection.atEnd(oldState.doc).to;\n const allWasSelected = from === allFrom && to === allEnd;\n if (empty || !allWasSelected) {\n return;\n }\n const isEmpty = isNodeEmpty(newState.doc);\n if (!isEmpty) {\n return;\n }\n const tr = newState.tr;\n const state = createChainableState({\n state: newState,\n transaction: tr\n });\n const {\n commands\n } = new CommandManager({\n editor: this.editor,\n state\n });\n commands.clearNodes();\n if (!tr.steps.length) {\n return;\n }\n return tr;\n }\n })];\n }\n});\nconst Paste = Extension.create({\n name: 'paste',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('tiptapPaste'),\n props: {\n handlePaste: (_view, e, slice) => {\n this.editor.emit('paste', {\n editor: this.editor,\n event: e,\n slice\n });\n }\n }\n })];\n }\n});\nconst Tabindex = Extension.create({\n name: 'tabindex',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('tabindex'),\n props: {\n attributes: () => this.editor.isEditable ? {\n tabindex: '0'\n } : {}\n }\n })];\n }\n});\nvar index = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ClipboardTextSerializer: ClipboardTextSerializer,\n Commands: Commands,\n Drop: Drop,\n Editable: Editable,\n FocusEvents: FocusEvents,\n Keymap: Keymap,\n Paste: Paste,\n Tabindex: Tabindex\n});\nclass NodePos {\n get name() {\n return this.node.type.name;\n }\n constructor(pos, editor, isBlock = false, node = null) {\n this.currentNode = null;\n this.actualDepth = null;\n this.isBlock = isBlock;\n this.resolvedPos = pos;\n this.editor = editor;\n this.currentNode = node;\n }\n get node() {\n return this.currentNode || this.resolvedPos.node();\n }\n get element() {\n return this.editor.view.domAtPos(this.pos).node;\n }\n get depth() {\n var _a;\n return (_a = this.actualDepth) !== null && _a !== void 0 ? _a : this.resolvedPos.depth;\n }\n get pos() {\n return this.resolvedPos.pos;\n }\n get content() {\n return this.node.content;\n }\n set content(content) {\n let from = this.from;\n let to = this.to;\n if (this.isBlock) {\n if (this.content.size === 0) {\n console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);\n return;\n }\n from = this.from + 1;\n to = this.to - 1;\n }\n this.editor.commands.insertContentAt({\n from,\n to\n }, content);\n }\n get attributes() {\n return this.node.attrs;\n }\n get textContent() {\n return this.node.textContent;\n }\n get size() {\n return this.node.nodeSize;\n }\n get from() {\n if (this.isBlock) {\n return this.pos;\n }\n return this.resolvedPos.start(this.resolvedPos.depth);\n }\n get range() {\n return {\n from: this.from,\n to: this.to\n };\n }\n get to() {\n if (this.isBlock) {\n return this.pos + this.size;\n }\n return this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);\n }\n get parent() {\n if (this.depth === 0) {\n return null;\n }\n const parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);\n const $pos = this.resolvedPos.doc.resolve(parentPos);\n return new NodePos($pos, this.editor);\n }\n get before() {\n let $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));\n if ($pos.depth !== this.depth) {\n $pos = this.resolvedPos.doc.resolve(this.from - 3);\n }\n return new NodePos($pos, this.editor);\n }\n get after() {\n let $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));\n if ($pos.depth !== this.depth) {\n $pos = this.resolvedPos.doc.resolve(this.to + 3);\n }\n return new NodePos($pos, this.editor);\n }\n get children() {\n const children = [];\n this.node.content.forEach((node, offset) => {\n const isBlock = node.isBlock && !node.isTextblock;\n const isNonTextAtom = node.isAtom && !node.isText;\n const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);\n const $pos = this.resolvedPos.doc.resolve(targetPos);\n if (!isBlock && $pos.depth <= this.depth) {\n return;\n }\n const childNodePos = new NodePos($pos, this.editor, isBlock, isBlock ? node : null);\n if (isBlock) {\n childNodePos.actualDepth = this.depth + 1;\n }\n children.push(new NodePos($pos, this.editor, isBlock, isBlock ? node : null));\n });\n return children;\n }\n get firstChild() {\n return this.children[0] || null;\n }\n get lastChild() {\n const children = this.children;\n return children[children.length - 1] || null;\n }\n closest(selector, attributes = {}) {\n let node = null;\n let currentNode = this.parent;\n while (currentNode && !node) {\n if (currentNode.node.type.name === selector) {\n if (Object.keys(attributes).length > 0) {\n const nodeAttributes = currentNode.node.attrs;\n const attrKeys = Object.keys(attributes);\n for (let index = 0; index < attrKeys.length; index += 1) {\n const key = attrKeys[index];\n if (nodeAttributes[key] !== attributes[key]) {\n break;\n }\n }\n } else {\n node = currentNode;\n }\n }\n currentNode = currentNode.parent;\n }\n return node;\n }\n querySelector(selector, attributes = {}) {\n return this.querySelectorAll(selector, attributes, true)[0] || null;\n }\n querySelectorAll(selector, attributes = {}, firstItemOnly = false) {\n let nodes = [];\n if (!this.children || this.children.length === 0) {\n return nodes;\n }\n const attrKeys = Object.keys(attributes);\n /**\n * Finds all children recursively that match the selector and attributes\n * If firstItemOnly is true, it will return the first item found\n */\n this.children.forEach(childPos => {\n // If we already found a node and we only want the first item, we dont need to keep going\n if (firstItemOnly && nodes.length > 0) {\n return;\n }\n if (childPos.node.type.name === selector) {\n const doesAllAttributesMatch = attrKeys.every(key => attributes[key] === childPos.node.attrs[key]);\n if (doesAllAttributesMatch) {\n nodes.push(childPos);\n }\n }\n // If we already found a node and we only want the first item, we can stop here and skip the recursion\n if (firstItemOnly && nodes.length > 0) {\n return;\n }\n nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));\n });\n return nodes;\n }\n setAttribute(attributes) {\n const {\n tr\n } = this.editor.state;\n tr.setNodeMarkup(this.from, undefined, {\n ...this.node.attrs,\n ...attributes\n });\n this.editor.view.dispatch(tr);\n }\n}\nconst style = `.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}`;\nfunction createStyleTag(style, nonce, suffix) {\n const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ''}]`);\n if (tiptapStyleTag !== null) {\n return tiptapStyleTag;\n }\n const styleNode = document.createElement('style');\n if (nonce) {\n styleNode.setAttribute('nonce', nonce);\n }\n styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ''}`, '');\n styleNode.innerHTML = style;\n document.getElementsByTagName('head')[0].appendChild(styleNode);\n return styleNode;\n}\nclass Editor extends EventEmitter {\n constructor(options = {}) {\n super();\n this.isFocused = false;\n /**\n * The editor is considered initialized after the `create` event has been emitted.\n */\n this.isInitialized = false;\n this.extensionStorage = {};\n this.options = {\n element: document.createElement('div'),\n content: '',\n injectCSS: true,\n injectNonce: undefined,\n extensions: [],\n autofocus: false,\n editable: true,\n editorProps: {},\n parseOptions: {},\n coreExtensionOptions: {},\n enableInputRules: true,\n enablePasteRules: true,\n enableCoreExtensions: true,\n enableContentCheck: false,\n onBeforeCreate: () => null,\n onCreate: () => null,\n onUpdate: () => null,\n onSelectionUpdate: () => null,\n onTransaction: () => null,\n onFocus: () => null,\n onBlur: () => null,\n onDestroy: () => null,\n onContentError: ({\n error\n }) => {\n throw error;\n },\n onPaste: () => null,\n onDrop: () => null\n };\n this.isCapturingTransaction = false;\n this.capturedTransaction = null;\n this.setOptions(options);\n this.createExtensionManager();\n this.createCommandManager();\n this.createSchema();\n this.on('beforeCreate', this.options.onBeforeCreate);\n this.emit('beforeCreate', {\n editor: this\n });\n this.on('contentError', this.options.onContentError);\n this.createView();\n this.injectCSS();\n this.on('create', this.options.onCreate);\n this.on('update', this.options.onUpdate);\n this.on('selectionUpdate', this.options.onSelectionUpdate);\n this.on('transaction', this.options.onTransaction);\n this.on('focus', this.options.onFocus);\n this.on('blur', this.options.onBlur);\n this.on('destroy', this.options.onDestroy);\n this.on('drop', ({\n event,\n slice,\n moved\n }) => this.options.onDrop(event, slice, moved));\n this.on('paste', ({\n event,\n slice\n }) => this.options.onPaste(event, slice));\n window.setTimeout(() => {\n if (this.isDestroyed) {\n return;\n }\n this.commands.focus(this.options.autofocus);\n this.emit('create', {\n editor: this\n });\n this.isInitialized = true;\n }, 0);\n }\n /**\n * Returns the editor storage.\n */\n get storage() {\n return this.extensionStorage;\n }\n /**\n * An object of all registered commands.\n */\n get commands() {\n return this.commandManager.commands;\n }\n /**\n * Create a command chain to call multiple commands at once.\n */\n chain() {\n return this.commandManager.chain();\n }\n /**\n * Check if a command or a command chain can be executed. Without executing it.\n */\n can() {\n return this.commandManager.can();\n }\n /**\n * Inject CSS styles.\n */\n injectCSS() {\n if (this.options.injectCSS && document) {\n this.css = createStyleTag(style, this.options.injectNonce);\n }\n }\n /**\n * Update editor options.\n *\n * @param options A list of options\n */\n setOptions(options = {}) {\n this.options = {\n ...this.options,\n ...options\n };\n if (!this.view || !this.state || this.isDestroyed) {\n return;\n }\n if (this.options.editorProps) {\n this.view.setProps(this.options.editorProps);\n }\n this.view.updateState(this.state);\n }\n /**\n * Update editable state of the editor.\n */\n setEditable(editable, emitUpdate = true) {\n this.setOptions({\n editable\n });\n if (emitUpdate) {\n this.emit('update', {\n editor: this,\n transaction: this.state.tr\n });\n }\n }\n /**\n * Returns whether the editor is editable.\n */\n get isEditable() {\n // since plugins are applied after creating the view\n // `editable` is always `true` for one tick.\n // that’s why we also have to check for `options.editable`\n return this.options.editable && this.view && this.view.editable;\n }\n /**\n * Returns the editor state.\n */\n get state() {\n return this.view.state;\n }\n /**\n * Register a ProseMirror plugin.\n *\n * @param plugin A ProseMirror plugin\n * @param handlePlugins Control how to merge the plugin into the existing plugins.\n * @returns The new editor state\n */\n registerPlugin(plugin, handlePlugins) {\n const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];\n const state = this.state.reconfigure({\n plugins\n });\n this.view.updateState(state);\n return state;\n }\n /**\n * Unregister a ProseMirror plugin.\n *\n * @param nameOrPluginKeyToRemove The plugins name\n * @returns The new editor state or undefined if the editor is destroyed\n */\n unregisterPlugin(nameOrPluginKeyToRemove) {\n if (this.isDestroyed) {\n return undefined;\n }\n const prevPlugins = this.state.plugins;\n let plugins = prevPlugins;\n [].concat(nameOrPluginKeyToRemove).forEach(nameOrPluginKey => {\n // @ts-ignore\n const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;\n // @ts-ignore\n plugins = prevPlugins.filter(plugin => !plugin.key.startsWith(name));\n });\n if (prevPlugins.length === plugins.length) {\n // No plugin was removed, so we don’t need to update the state\n return undefined;\n }\n const state = this.state.reconfigure({\n plugins\n });\n this.view.updateState(state);\n return state;\n }\n /**\n * Creates an extension manager.\n */\n createExtensionManager() {\n var _a, _b;\n const coreExtensions = this.options.enableCoreExtensions ? [Editable, ClipboardTextSerializer.configure({\n blockSeparator: (_b = (_a = this.options.coreExtensionOptions) === null || _a === void 0 ? void 0 : _a.clipboardTextSerializer) === null || _b === void 0 ? void 0 : _b.blockSeparator\n }), Commands, FocusEvents, Keymap, Tabindex, Drop, Paste].filter(ext => {\n if (typeof this.options.enableCoreExtensions === 'object') {\n return this.options.enableCoreExtensions[ext.name] !== false;\n }\n return true;\n }) : [];\n const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => {\n return ['extension', 'node', 'mark'].includes(extension === null || extension === void 0 ? void 0 : extension.type);\n });\n this.extensionManager = new ExtensionManager(allExtensions, this);\n }\n /**\n * Creates an command manager.\n */\n createCommandManager() {\n this.commandManager = new CommandManager({\n editor: this\n });\n }\n /**\n * Creates a ProseMirror schema.\n */\n createSchema() {\n this.schema = this.extensionManager.schema;\n }\n /**\n * Creates a ProseMirror view.\n */\n createView() {\n var _a;\n let doc;\n try {\n doc = createDocument(this.options.content, this.schema, this.options.parseOptions, {\n errorOnInvalidContent: this.options.enableContentCheck\n });\n } catch (e) {\n if (!(e instanceof Error) || !['[tiptap error]: Invalid JSON content', '[tiptap error]: Invalid HTML content'].includes(e.message)) {\n // Not the content error we were expecting\n throw e;\n }\n this.emit('contentError', {\n editor: this,\n error: e,\n disableCollaboration: () => {\n if (this.storage.collaboration) {\n this.storage.collaboration.isDisabled = true;\n }\n // To avoid syncing back invalid content, reinitialize the extensions without the collaboration extension\n this.options.extensions = this.options.extensions.filter(extension => extension.name !== 'collaboration');\n // Restart the initialization process by recreating the extension manager with the new set of extensions\n this.createExtensionManager();\n }\n });\n // Content is invalid, but attempt to create it anyway, stripping out the invalid parts\n doc = createDocument(this.options.content, this.schema, this.options.parseOptions, {\n errorOnInvalidContent: false\n });\n }\n const selection = resolveFocusPosition(doc, this.options.autofocus);\n this.view = new EditorView(this.options.element, {\n ...this.options.editorProps,\n attributes: {\n // add `role=\"textbox\"` to the editor element\n role: 'textbox',\n ...((_a = this.options.editorProps) === null || _a === void 0 ? void 0 : _a.attributes)\n },\n dispatchTransaction: this.dispatchTransaction.bind(this),\n state: EditorState.create({\n doc,\n selection: selection || undefined\n })\n });\n // `editor.view` is not yet available at this time.\n // Therefore we will add all plugins and node views directly afterwards.\n const newState = this.state.reconfigure({\n plugins: this.extensionManager.plugins\n });\n this.view.updateState(newState);\n this.createNodeViews();\n this.prependClass();\n // Let’s store the editor instance in the DOM element.\n // So we’ll have access to it for tests.\n // @ts-ignore\n const dom = this.view.dom;\n dom.editor = this;\n }\n /**\n * Creates all node views.\n */\n createNodeViews() {\n if (this.view.isDestroyed) {\n return;\n }\n this.view.setProps({\n nodeViews: this.extensionManager.nodeViews\n });\n }\n /**\n * Prepend class name to element.\n */\n prependClass() {\n this.view.dom.className = `tiptap ${this.view.dom.className}`;\n }\n captureTransaction(fn) {\n this.isCapturingTransaction = true;\n fn();\n this.isCapturingTransaction = false;\n const tr = this.capturedTransaction;\n this.capturedTransaction = null;\n return tr;\n }\n /**\n * The callback over which to send transactions (state updates) produced by the view.\n *\n * @param transaction An editor state transaction\n */\n dispatchTransaction(transaction) {\n // if the editor / the view of the editor was destroyed\n // the transaction should not be dispatched as there is no view anymore.\n if (this.view.isDestroyed) {\n return;\n }\n if (this.isCapturingTransaction) {\n if (!this.capturedTransaction) {\n this.capturedTransaction = transaction;\n return;\n }\n transaction.steps.forEach(step => {\n var _a;\n return (_a = this.capturedTransaction) === null || _a === void 0 ? void 0 : _a.step(step);\n });\n return;\n }\n const state = this.state.apply(transaction);\n const selectionHasChanged = !this.state.selection.eq(state.selection);\n this.emit('beforeTransaction', {\n editor: this,\n transaction,\n nextState: state\n });\n this.view.updateState(state);\n this.emit('transaction', {\n editor: this,\n transaction\n });\n if (selectionHasChanged) {\n this.emit('selectionUpdate', {\n editor: this,\n transaction\n });\n }\n const focus = transaction.getMeta('focus');\n const blur = transaction.getMeta('blur');\n if (focus) {\n this.emit('focus', {\n editor: this,\n event: focus.event,\n transaction\n });\n }\n if (blur) {\n this.emit('blur', {\n editor: this,\n event: blur.event,\n transaction\n });\n }\n if (!transaction.docChanged || transaction.getMeta('preventUpdate')) {\n return;\n }\n this.emit('update', {\n editor: this,\n transaction\n });\n }\n /**\n * Get attributes of the currently selected node or mark.\n */\n getAttributes(nameOrType) {\n return getAttributes(this.state, nameOrType);\n }\n isActive(nameOrAttributes, attributesOrUndefined) {\n const name = typeof nameOrAttributes === 'string' ? nameOrAttributes : null;\n const attributes = typeof nameOrAttributes === 'string' ? attributesOrUndefined : nameOrAttributes;\n return isActive(this.state, name, attributes);\n }\n /**\n * Get the document as JSON.\n */\n getJSON() {\n return this.state.doc.toJSON();\n }\n /**\n * Get the document as HTML.\n */\n getHTML() {\n return getHTMLFromFragment(this.state.doc.content, this.schema);\n }\n /**\n * Get the document as text.\n */\n getText(options) {\n const {\n blockSeparator = '\\n\\n',\n textSerializers = {}\n } = options || {};\n return getText(this.state.doc, {\n blockSeparator,\n textSerializers: {\n ...getTextSerializersFromSchema(this.schema),\n ...textSerializers\n }\n });\n }\n /**\n * Check if there is no content.\n */\n get isEmpty() {\n return isNodeEmpty(this.state.doc);\n }\n /**\n * Get the number of characters for the current document.\n *\n * @deprecated\n */\n getCharacterCount() {\n console.warn('[tiptap warn]: \"editor.getCharacterCount()\" is deprecated. Please use \"editor.storage.characterCount.characters()\" instead.');\n return this.state.doc.content.size - 2;\n }\n /**\n * Destroy the editor.\n */\n destroy() {\n this.emit('destroy');\n if (this.view) {\n // Cleanup our reference to prevent circular references which caused memory leaks\n // @ts-ignore\n const dom = this.view.dom;\n if (dom && dom.editor) {\n delete dom.editor;\n }\n this.view.destroy();\n }\n this.removeAllListeners();\n }\n /**\n * Check if the editor is already destroyed.\n */\n get isDestroyed() {\n var _a;\n // @ts-ignore\n return !((_a = this.view) === null || _a === void 0 ? void 0 : _a.docView);\n }\n $node(selector, attributes) {\n var _a;\n return ((_a = this.$doc) === null || _a === void 0 ? void 0 : _a.querySelector(selector, attributes)) || null;\n }\n $nodes(selector, attributes) {\n var _a;\n return ((_a = this.$doc) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector, attributes)) || null;\n }\n $pos(pos) {\n const $pos = this.state.doc.resolve(pos);\n return new NodePos($pos, this);\n }\n get $doc() {\n return this.$pos(0);\n }\n}\n\n/**\n * Build an input rule that adds a mark when the\n * matched text is typed into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction markInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match);\n if (attributes === false || attributes === null) {\n return null;\n }\n const {\n tr\n } = state;\n const captureGroup = match[match.length - 1];\n const fullMatch = match[0];\n if (captureGroup) {\n const startSpaces = fullMatch.search(/\\S/);\n const textStart = range.from + fullMatch.indexOf(captureGroup);\n const textEnd = textStart + captureGroup.length;\n const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter(item => {\n // @ts-ignore\n const excluded = item.mark.type.excluded;\n return excluded.find(type => type === config.type && type !== item.mark.type);\n }).filter(item => item.to > textStart);\n if (excludedMarks.length) {\n return null;\n }\n if (textEnd < range.to) {\n tr.delete(textEnd, range.to);\n }\n if (textStart > range.from) {\n tr.delete(range.from + startSpaces, textStart);\n }\n const markEnd = range.from + startSpaces + captureGroup.length;\n tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n tr.removeStoredMark(config.type);\n }\n }\n });\n}\n\n/**\n * Build an input rule that adds a node when the\n * matched text is typed into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction nodeInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match) || {};\n const {\n tr\n } = state;\n const start = range.from;\n let end = range.to;\n const newNode = config.type.create(attributes);\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n let matchStart = start + offset;\n if (matchStart > end) {\n matchStart = end;\n } else {\n end = matchStart + match[1].length;\n }\n // insert last typed character\n const lastChar = match[0][match[0].length - 1];\n tr.insertText(lastChar, start + match[0].length - 1);\n // insert node from input rule\n tr.replaceWith(matchStart, end, newNode);\n } else if (match[0]) {\n const insertionStart = config.type.isInline ? start : start - 1;\n tr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));\n }\n tr.scrollIntoView();\n }\n });\n}\n\n/**\n * Build an input rule that changes the type of a textblock when the\n * matched text is typed into it. When using a regular expresion you’ll\n * probably want the regexp to start with `^`, so that the pattern can\n * only occur at the start of a textblock.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction textblockTypeInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n const $start = state.doc.resolve(range.from);\n const attributes = callOrReturn(config.getAttributes, undefined, match) || {};\n if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) {\n return null;\n }\n state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);\n }\n });\n}\n\n/**\n * Build an input rule that replaces text when the\n * matched text is typed into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction textInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n let insert = config.replace;\n let start = range.from;\n const end = range.to;\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n const cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n state.tr.insertText(insert, start, end);\n }\n });\n}\n\n/**\n * Build an input rule for automatically wrapping a textblock when a\n * given string is typed. When using a regular expresion you’ll\n * probably want the regexp to start with `^`, so that the pattern can\n * only occur at the start of a textblock.\n *\n * `type` is the type of node to wrap in.\n *\n * By default, if there’s a node with the same type above the newly\n * wrapped node, the rule will try to join those\n * two nodes. You can pass a join predicate, which takes a regular\n * expression match and the node before the wrapped node, and can\n * return a boolean to indicate whether a join should happen.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction wrappingInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match,\n chain\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match) || {};\n const tr = state.tr.delete(range.from, range.to);\n const $start = tr.doc.resolve(range.from);\n const blockRange = $start.blockRange();\n const wrapping = blockRange && findWrapping(blockRange, config.type, attributes);\n if (!wrapping) {\n return null;\n }\n tr.wrap(blockRange, wrapping);\n if (config.keepMarks && config.editor) {\n const {\n selection,\n storedMarks\n } = state;\n const {\n splittableMarks\n } = config.editor.extensionManager;\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n if (marks) {\n const filteredMarks = marks.filter(mark => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n }\n }\n if (config.keepAttributes) {\n /** If the nodeType is `bulletList` or `orderedList` set the `nodeType` as `listItem` */\n const nodeType = config.type.name === 'bulletList' || config.type.name === 'orderedList' ? 'listItem' : 'taskList';\n chain().updateAttributes(nodeType, attributes).run();\n }\n const before = tr.doc.resolve(range.from - 1).nodeBefore;\n if (before && before.type === config.type && canJoin(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) {\n tr.join(range.from - 1);\n }\n }\n });\n}\n\n/**\n * The Node class is used to create custom node extensions.\n * @see https://tiptap.dev/api/extensions#create-a-new-extension\n */\nclass Node {\n constructor(config = {}) {\n this.type = 'node';\n this.name = 'node';\n this.parent = null;\n this.child = null;\n this.config = {\n name: this.name,\n defaultOptions: {}\n };\n this.config = {\n ...this.config,\n ...config\n };\n this.name = this.config.name;\n if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${this.name}\".`);\n }\n // TODO: remove `addOptions` fallback\n this.options = this.config.defaultOptions;\n if (this.config.addOptions) {\n this.options = callOrReturn(getExtensionField(this, 'addOptions', {\n name: this.name\n }));\n }\n this.storage = callOrReturn(getExtensionField(this, 'addStorage', {\n name: this.name,\n options: this.options\n })) || {};\n }\n static create(config = {}) {\n return new Node(config);\n }\n configure(options = {}) {\n // return a new instance so we can use the same extension\n // with different calls of `configure`\n const extension = this.extend({\n ...this.config,\n addOptions: () => {\n return mergeDeep(this.options, options);\n }\n });\n // Always preserve the current name\n extension.name = this.name;\n // Set the parent to be our parent\n extension.parent = this.parent;\n return extension;\n }\n extend(extendedConfig = {}) {\n const extension = new Node(extendedConfig);\n extension.parent = this;\n this.child = extension;\n extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;\n if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${extension.name}\".`);\n }\n extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {\n name: extension.name\n }));\n extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {\n name: extension.name,\n options: extension.options\n }));\n return extension;\n }\n}\nfunction isAndroid() {\n return navigator.platform === 'Android' || /android/i.test(navigator.userAgent);\n}\n\n/**\n * Node views are used to customize the rendered DOM structure of a node.\n * @see https://tiptap.dev/guide/node-views\n */\nclass NodeView {\n constructor(component, props, options) {\n this.isDragging = false;\n this.component = component;\n this.editor = props.editor;\n this.options = {\n stopEvent: null,\n ignoreMutation: null,\n ...options\n };\n this.extension = props.extension;\n this.node = props.node;\n this.decorations = props.decorations;\n this.innerDecorations = props.innerDecorations;\n this.view = props.view;\n this.HTMLAttributes = props.HTMLAttributes;\n this.getPos = props.getPos;\n this.mount();\n }\n mount() {\n // eslint-disable-next-line\n return;\n }\n get dom() {\n return this.editor.view.dom;\n }\n get contentDOM() {\n return null;\n }\n onDragStart(event) {\n var _a, _b, _c, _d, _e, _f, _g;\n const {\n view\n } = this.editor;\n const target = event.target;\n // get the drag handle element\n // `closest` is not available for text nodes so we may have to use its parent\n const dragHandle = target.nodeType === 3 ? (_a = target.parentElement) === null || _a === void 0 ? void 0 : _a.closest('[data-drag-handle]') : target.closest('[data-drag-handle]');\n if (!this.dom || ((_b = this.contentDOM) === null || _b === void 0 ? void 0 : _b.contains(target)) || !dragHandle) {\n return;\n }\n let x = 0;\n let y = 0;\n // calculate offset for drag element if we use a different drag handle element\n if (this.dom !== dragHandle) {\n const domBox = this.dom.getBoundingClientRect();\n const handleBox = dragHandle.getBoundingClientRect();\n // In React, we have to go through nativeEvent to reach offsetX/offsetY.\n const offsetX = (_c = event.offsetX) !== null && _c !== void 0 ? _c : (_d = event.nativeEvent) === null || _d === void 0 ? void 0 : _d.offsetX;\n const offsetY = (_e = event.offsetY) !== null && _e !== void 0 ? _e : (_f = event.nativeEvent) === null || _f === void 0 ? void 0 : _f.offsetY;\n x = handleBox.x - domBox.x + offsetX;\n y = handleBox.y - domBox.y + offsetY;\n }\n (_g = event.dataTransfer) === null || _g === void 0 ? void 0 : _g.setDragImage(this.dom, x, y);\n const pos = this.getPos();\n if (typeof pos !== 'number') {\n return;\n }\n // we need to tell ProseMirror that we want to move the whole node\n // so we create a NodeSelection\n const selection = NodeSelection.create(view.state.doc, pos);\n const transaction = view.state.tr.setSelection(selection);\n view.dispatch(transaction);\n }\n stopEvent(event) {\n var _a;\n if (!this.dom) {\n return false;\n }\n if (typeof this.options.stopEvent === 'function') {\n return this.options.stopEvent({\n event\n });\n }\n const target = event.target;\n const isInElement = this.dom.contains(target) && !((_a = this.contentDOM) === null || _a === void 0 ? void 0 : _a.contains(target));\n // any event from child nodes should be handled by ProseMirror\n if (!isInElement) {\n return false;\n }\n const isDragEvent = event.type.startsWith('drag');\n const isDropEvent = event.type === 'drop';\n const isInput = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'].includes(target.tagName) || target.isContentEditable;\n // any input event within node views should be ignored by ProseMirror\n if (isInput && !isDropEvent && !isDragEvent) {\n return true;\n }\n const {\n isEditable\n } = this.editor;\n const {\n isDragging\n } = this;\n const isDraggable = !!this.node.type.spec.draggable;\n const isSelectable = NodeSelection.isSelectable(this.node);\n const isCopyEvent = event.type === 'copy';\n const isPasteEvent = event.type === 'paste';\n const isCutEvent = event.type === 'cut';\n const isClickEvent = event.type === 'mousedown';\n // ProseMirror tries to drag selectable nodes\n // even if `draggable` is set to `false`\n // this fix prevents that\n if (!isDraggable && isSelectable && isDragEvent) {\n event.preventDefault();\n }\n if (isDraggable && isDragEvent && !isDragging) {\n event.preventDefault();\n return false;\n }\n // we have to store that dragging started\n if (isDraggable && isEditable && !isDragging && isClickEvent) {\n const dragHandle = target.closest('[data-drag-handle]');\n const isValidDragHandle = dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle));\n if (isValidDragHandle) {\n this.isDragging = true;\n document.addEventListener('dragend', () => {\n this.isDragging = false;\n }, {\n once: true\n });\n document.addEventListener('drop', () => {\n this.isDragging = false;\n }, {\n once: true\n });\n document.addEventListener('mouseup', () => {\n this.isDragging = false;\n }, {\n once: true\n });\n }\n }\n // these events are handled by prosemirror\n if (isDragging || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {\n return false;\n }\n return true;\n }\n /**\n * Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.\n * @return `false` if the editor should re-read the selection or re-parse the range around the mutation\n * @return `true` if it can safely be ignored.\n */\n ignoreMutation(mutation) {\n if (!this.dom || !this.contentDOM) {\n return true;\n }\n if (typeof this.options.ignoreMutation === 'function') {\n return this.options.ignoreMutation({\n mutation\n });\n }\n // a leaf/atom node is like a black box for ProseMirror\n // and should be fully handled by the node view\n if (this.node.isLeaf || this.node.isAtom) {\n return true;\n }\n // ProseMirror should handle any selections\n if (mutation.type === 'selection') {\n return false;\n }\n // try to prevent a bug on iOS and Android that will break node views on enter\n // this is because ProseMirror can’t preventDispatch on enter\n // this will lead to a re-render of the node view on enter\n // see: https://github.com/ueberdosis/tiptap/issues/1214\n // see: https://github.com/ueberdosis/tiptap/issues/2534\n if (this.dom.contains(mutation.target) && mutation.type === 'childList' && (isiOS() || isAndroid()) && this.editor.isFocused) {\n const changedNodes = [...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)];\n // we’ll check if every changed node is contentEditable\n // to make sure it’s probably mutated by ProseMirror\n if (changedNodes.every(node => node.isContentEditable)) {\n return false;\n }\n }\n // we will allow mutation contentDOM with attributes\n // so we can for example adding classes within our node view\n if (this.contentDOM === mutation.target && mutation.type === 'attributes') {\n return true;\n }\n // ProseMirror should handle any changes within contentDOM\n if (this.contentDOM.contains(mutation.target)) {\n return false;\n }\n return true;\n }\n /**\n * Update the attributes of the prosemirror node.\n */\n updateAttributes(attributes) {\n this.editor.commands.command(({\n tr\n }) => {\n const pos = this.getPos();\n if (typeof pos !== 'number') {\n return false;\n }\n tr.setNodeMarkup(pos, undefined, {\n ...this.node.attrs,\n ...attributes\n });\n return true;\n });\n }\n /**\n * Delete the node.\n */\n deleteNode() {\n const from = this.getPos();\n if (typeof from !== 'number') {\n return;\n }\n const to = from + this.node.nodeSize;\n this.editor.commands.deleteRange({\n from,\n to\n });\n }\n}\n\n/**\n * Build an paste rule that adds a mark when the\n * matched text is pasted into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nfunction markPasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler: ({\n state,\n range,\n match,\n pasteEvent\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match, pasteEvent);\n if (attributes === false || attributes === null) {\n return null;\n }\n const {\n tr\n } = state;\n const captureGroup = match[match.length - 1];\n const fullMatch = match[0];\n let markEnd = range.to;\n if (captureGroup) {\n const startSpaces = fullMatch.search(/\\S/);\n const textStart = range.from + fullMatch.indexOf(captureGroup);\n const textEnd = textStart + captureGroup.length;\n const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter(item => {\n // @ts-ignore\n const excluded = item.mark.type.excluded;\n return excluded.find(type => type === config.type && type !== item.mark.type);\n }).filter(item => item.to > textStart);\n if (excludedMarks.length) {\n return null;\n }\n if (textEnd < range.to) {\n tr.delete(textEnd, range.to);\n }\n if (textStart > range.from) {\n tr.delete(range.from + startSpaces, textStart);\n }\n markEnd = range.from + startSpaces + captureGroup.length;\n tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n tr.removeStoredMark(config.type);\n }\n }\n });\n}\n\n// source: https://stackoverflow.com/a/6969486\nfunction escapeForRegEx(string) {\n return string.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\nfunction isString(value) {\n return typeof value === 'string';\n}\n\n/**\n * Build an paste rule that adds a node when the\n * matched text is pasted into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nfunction nodePasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler({\n match,\n chain,\n range,\n pasteEvent\n }) {\n const attributes = callOrReturn(config.getAttributes, undefined, match, pasteEvent);\n const content = callOrReturn(config.getContent, undefined, attributes);\n if (attributes === false || attributes === null) {\n return null;\n }\n const node = {\n type: config.type.name,\n attrs: attributes\n };\n if (content) {\n node.content = content;\n }\n if (match.input) {\n chain().deleteRange(range).insertContentAt(range.from, node);\n }\n }\n });\n}\n\n/**\n * Build an paste rule that replaces text when the\n * matched text is pasted into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nfunction textPasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n let insert = config.replace;\n let start = range.from;\n const end = range.to;\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n const cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n state.tr.insertText(insert, start, end);\n }\n });\n}\nclass Tracker {\n constructor(transaction) {\n this.transaction = transaction;\n this.currentStep = this.transaction.steps.length;\n }\n map(position) {\n let deleted = false;\n const mappedPosition = this.transaction.steps.slice(this.currentStep).reduce((newPosition, step) => {\n const mapResult = step.getMap().mapResult(newPosition);\n if (mapResult.deleted) {\n deleted = true;\n }\n return mapResult.pos;\n }, position);\n return {\n position: mappedPosition,\n deleted\n };\n }\n}\nexport { CommandManager, Editor, Extension, InputRule, Mark, Node, NodePos, NodeView, PasteRule, Tracker, callOrReturn, combineTransactionSteps, createChainableState, createDocument, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveFocusPosition, selectionToInsertionEnd, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };\n"],"mappings":"stBAEA,SAASA,EAAWC,EAAS,CAC3B,KAAK,QAAUA,CACjB,CACAD,EAAW,UAAY,CACrB,YAAaA,EACb,KAAM,SAAUE,EAAK,CACnB,QAASC,EAAI,EAAGA,EAAI,KAAK,QAAQ,OAAQA,GAAK,EAAG,GAAI,KAAK,QAAQA,CAAC,IAAMD,EAAK,OAAOC,EACrF,MAAO,EACT,EAIA,IAAK,SAAUD,EAAK,CAClB,IAAIE,EAAQ,KAAK,KAAKF,CAAG,EACzB,OAAOE,GAAS,GAAK,OAAY,KAAK,QAAQA,EAAQ,CAAC,CACzD,EAKA,OAAQ,SAAUF,EAAKG,EAAOC,EAAQ,CACpC,IAAIC,EAAOD,GAAUA,GAAUJ,EAAM,KAAK,OAAOI,CAAM,EAAI,KACvDF,EAAQG,EAAK,KAAKL,CAAG,EACvBD,EAAUM,EAAK,QAAQ,MAAM,EAC/B,OAAIH,GAAS,GACXH,EAAQ,KAAKK,GAAUJ,EAAKG,CAAK,GAEjCJ,EAAQG,EAAQ,CAAC,EAAIC,EACjBC,IAAQL,EAAQG,CAAK,EAAIE,IAExB,IAAIN,EAAWC,CAAO,CAC/B,EAGA,OAAQ,SAAUC,EAAK,CACrB,IAAIE,EAAQ,KAAK,KAAKF,CAAG,EACzB,GAAIE,GAAS,GAAI,OAAO,KACxB,IAAIH,EAAU,KAAK,QAAQ,MAAM,EACjC,OAAAA,EAAQ,OAAOG,EAAO,CAAC,EAChB,IAAIJ,EAAWC,CAAO,CAC/B,EAGA,WAAY,SAAUC,EAAKG,EAAO,CAChC,OAAO,IAAIL,EAAW,CAACE,EAAKG,CAAK,EAAE,OAAO,KAAK,OAAOH,CAAG,EAAE,OAAO,CAAC,CACrE,EAGA,SAAU,SAAUA,EAAKG,EAAO,CAC9B,IAAIJ,EAAU,KAAK,OAAOC,CAAG,EAAE,Q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AAWwmB,EAAQ9b,EAAOC,CAAG,CACxC,CACF,CAAC,CACH,CACA,IAAMoe,GAAN,KAAc,CACZ,YAAY9oB,EAAa,CACvB,KAAK,YAAcA,EACnB,KAAK,YAAc,KAAK,YAAY,MAAM,MAC5C,CACA,IAAIqS,EAAU,CACZ,IAAI0W,EAAU,GAQd,MAAO,CACL,SARqB,KAAK,YAAY,MAAM,MAAM,KAAK,WAAW,EAAE,OAAO,CAACC,EAAa3U,IAAS,CAClG,IAAM4U,EAAY5U,EAAK,OAAO,EAAE,UAAU2U,CAAW,EACrD,OAAIC,EAAU,UACZF,EAAU,IAELE,EAAU,GACnB,EAAG5W,CAAQ,EAGT,QAAA0W,CACF,CACF,CACF","names":["OrderedMap","content","key","i","found","value","newKey","self","place","without","f","map","result","prop","dist_default","findDiffStart","a","b","pos","i","childA","childB","j","inner","findDiffEnd","posA","posB","iA","iB","size","same","minSize","Fragment","_Fragment","content","from","to","f","nodeStart","parent","child","end","start","blockSeparator","leafText","text","first","node","nodeText","other","last","result","index","current","copy","found","p","otherPos","round","retIndex","curPos","cur","n","schema","value","array","joined","nodes","offset","compareDeep","Mark","type","attrs","set","placed","obj","_","json","mark","marks","ReplaceError","Slice","_Slice","openStart","openEnd","fragment","insertInto","removeRange","openIsolating","indexTo","offsetTo","dist","insert","replace","$from","$to","slice","replaceOuter","depth","close","prepareSliceForReplace","replaceThreeWay","replaceTwoWay","checkJoin","main","sub","joinable","$before","$after","addNode","target","addRange","$start","$end","startIndex","endIndex","$along","extra","ResolvedPos","_ResolvedPos","path","parentOffset","val","dOff","tmp","after","next","pred","d","NodeRange","str","doc","rem","cache","resolveCache","elt","ResolveCache","resolveCacheSize","emptyAttrs","Node","_Node","startPos","includeParents","name","wrapMarks","match","replacement","one","two","m","TextNode","_TextNode","base","ContentMatch","_ContentMatch","validEnd","string","nodeTypes","stream","TokenStream","expr","parseExpr","dfa","nfa","checkForDeadEnds","frag","toEnd","seen","search","types","finished","tp","computed","active","scan","out","tok","exprs","parseExprSeq","parseExprSubscript","parseExprAtom","parseExprRange","parseNum","min","max","resolveName","typeName","connect","compile","edge","term","edges","loop","cmp","nullFrom","labeled","explore","states","state","work","dead","defaultAttrs","defaults","attrName","attr","computeAttrs","built","given","checkAttrs","values","initAttrs","Attribute","NodeType","_NodeType","spec","group","before","matched","markType","topType","validateType","options","MarkType","_MarkType","rank","Schema","instanceSpec","prop","dist_default","contentExprCache","contentExpr","markExpr","gatherMarks","excl","ok","isTagRule","rule","isStyleRule","DOMParser","_DOMParser","rules","matchedStyles","r","dom","context","ParseContext","matches","style","priority","blockTags","ignoreTags","listTags","OPT_PRESERVE_WS","OPT_PRESERVE_WS_FULL","OPT_OPEN_LEFT","wsOptionsFor","preserveWhitespace","NodeContext","solid","fill","wrap","parser","isOpen","topNode","topContext","topOptions","top","preserveWS","nodeBefore","domNodeBefore","matchAfter","outerWS","ruleID","normalizeList","sync","oldNeedsBlock","innerMarks","styles","continueAfter","nodeType","startIn","contentDOM","route","cx","block","nodeMarks","markMayApply","applyMarks","textNode","parts","option","useRoot","minDepth","part","$context","deflt","prevItem","selector","DOMSerializer","_DOMSerializer","keep","rendered","add","markDOM","renderSpec","inline","toDOM","structure","xmlNS","blockArraysIn","gatherToDOM","suspiciousAttributeCache","suspiciousAttributes","suspiciousAttributesInner","tagName","suspicious","space","innerContent","lower16","factor16","makeRecover","index","offset","recoverIndex","value","recoverOffset","DEL_BEFORE","DEL_AFTER","DEL_ACROSS","DEL_SIDE","MapResult","pos","delInfo","recover","StepMap","_StepMap","ranges","inverted","diff","assoc","simple","oldIndex","newIndex","i","start","oldSize","newSize","end","side","result","del","f","oldStart","newStart","n","Mapping","_Mapping","maps","mirror","from","to","map","mirrors","mapping","startSize","mirr","m","totalSize","inverse","corr","stepsByID","Step","other","schema","json","type","id","stepClass","StepResult","_StepResult","doc","failed","message","slice","e","ReplaceError","mapFragment","fragment","parent","mapped","child","Fragment","AddMarkStep","_AddMarkStep","mark","oldSlice","$from","Slice","node","RemoveMarkStep","_RemoveMarkStep","AddNodeMarkStep","_AddNodeMarkStep","updated","newSet","RemoveNodeMarkStep","_RemoveNodeMarkStep","ReplaceStep","_ReplaceStep","structure","contentBetween","ReplaceAroundStep","_ReplaceAroundStep","gapFrom","gapTo","insert","gap","inserted","dist","depth","next","addMark","tr","removed","added","removing","adding","marks","s","removeMark","matched","step","toRemove","MarkType","set","found","style","j","clearIncompatible","parentType","match","clearNewlines","replSteps","cur","allowed","newline","fill","canCut","liftTarget","range","content","endIndex","lift","target","$to","gapStart","gapEnd","before","openStart","d","splitting","after","openEnd","findWrapping","nodeType","attrs","innerRange","around","findWrappingOutside","inner","findWrappingInside","withAttrs","startIndex","outer","inside","innerMatch","wrap","wrappers","setBlockType","mapFrom","attrsHere","canChangeType","convertNewlines","pre","supportLinebreak","replaceLinebreaks","startM","endM","replaceNewlines","$pos","setNodeMarkup","newNode","canSplit","typesAfter","base","innerType","rest","overrideChild","baseType","split","typeAfter","canJoin","joinable","canAppendWithSubstitutedLinebreaks","a","b","linebreakReplacement","joinPoint","dir","join","$before","beforeType","$after","$full","insertPoint","dropPoint","pass","bias","insertPos","fits","wrapping","replaceStep","fitsTrivially","Fitter","unplaced","fit","moveInline","placedSize","startDepth","sliceDepth","contentAt","first","frontierDepth","inject","openAtEnd","dropFromFragment","taken","add","openEndCount","matches","closeNodeStart","toEnd","addToFragment","top","level","contentAfterFits","scan","dropInner","close","count","frag","open","invalidMarks","definesContent","replaceRange","targetDepths","coveredDepths","preferredTarget","spec","preferredTargetIndex","leftNodes","preferredDepth","leftNode","def","openDepth","targetDepth","expand","closeFragment","startSteps","oldOpen","newOpen","replaceRangeWith","point","deleteRange","covered","last","minDepth","AttrStep","_AttrStep","attr","name","DocAttrStep","_DocAttrStep","TransformError","err","Transform","Mark","classesById","Selection","$anchor","$head","ranges","SelectionRange","i","tr","content","Slice","lastNode","lastParent","mapFrom","$from","$to","mapping","selectionToInsertionEnd","node","from","to","$pos","dir","textOnly","inner","TextSelection","findSelectionIn","depth","found","bias","AllSelection","doc","json","cls","id","selectionClass","warnedAboutTextSelection","checkTextSelection","_TextSelection","marks","other","TextBookmark","anchor","head","dPos","_TextBookmark","NodeSelection","_NodeSelection","$end","deleted","pos","Fragment","NodeBookmark","_NodeBookmark","_AllSelection","sel","AllBookmark","index","text","child","startLen","last","step","ReplaceStep","ReplaceAroundStep","map","end","_from","_to","_newFrom","newTo","UPDATED_SEL","UPDATED_MARKS","UPDATED_SCROLL","Transaction","Transform","state","selection","Mark","mark","time","slice","inheritMarks","schema","key","value","_","bind","f","self","FieldDesc","name","desc","baseFields","config","instance","_marks","_old","prev","Configuration","plugins","plugin","EditorState","_EditorState","ignore","rootTr","trs","newState","seen","haveNew","n","oldState","j","newInstance","fields","field","$config","pluginFields","result","m","prop","Node","bindProps","obj","target","val","Plugin","spec","createKey","keys","PluginKey","domIndex","node","index","parentNode","parent","reusedRange","textRange","from","to","range","clearReusedRange","isEquivalentPosition","off","targetNode","targetOff","scanFor","atomElements","dir","nodeSize","hasBlockDesc","textNodeBefore$1","offset","textNodeAfter$1","isOnEdge","atStart","atEnd","dom","desc","cur","selectionCollapsed","domSel","keyEvent","keyCode","key","event","deepActiveElement","doc","elt","caretFromPoint","x","y","pos","nav","agent","ie_edge","ie_upto10","ie_11up","ie","ie_version","gecko","_chrome","chrome","chrome_version","safari","ios","mac","windows","android","webkit","webkit_version","windowRect","vp","getSide","value","side","clientRect","rect","scaleX","scaleY","scrollRectIntoView","view","startDOM","scrollThreshold","scrollMargin","atTop","bounding","moveX","moveY","startX","startY","dX","dY","storeScrollPos","refDOM","refTop","localRect","scrollStack","stack","resetScrollPos","newRefTop","restoreScrollStack","dTop","i","top","left","preventScrollSupported","focusPreventScroll","stored","findOffsetInNode","coords","closest","dxClosest","coordsClosest","rowBot","rowTop","firstBelow","coordsBelow","child","childIndex","rects","dx","findOffsetInText","len","singleRect","inRect","targetKludge","posFromElement","bias","posFromCaret","outsideBlock","sawBlock","elementFromPoint","element","box","startI","j","posAtCoords","caret","p","next","prev","nonZero","target","first","BIDI","coordsAtPos","atom","supportEmptyRange","rectBefore","rectAfter","flattenV","takeSide","before","flattenH","after","withFlushedState","state","f","viewState","active","endOfTextblockVertical","sel","$pos","nearest","boxes","maybeRTL","endOfTextblockHorizontal","$head","oldNode","oldOff","anchorNode","anchorOffset","oldBidiLevel","parentDOM","newNode","newOff","result","cachedState","cachedDir","cachedResult","endOfTextblock","NOT_DIRTY","CHILD_DIRTY","CONTENT_DIRTY","NODE_DIRTY","ViewDesc","children","contentDOM","widget","mark","outerDeco","innerDeco","nodeName","size","domBefore","domAfter","search","onlyNodes","nodeDOM","scan","end","curPos","TrailingHackViewDesc","WidgetViewDesc","enter","base","fromOffset","toOffset","childBase","anchor","head","force","anchorDOM","headDOM","selRange","brKludge","domSelExtended","tmp","mutation","startInside","endInside","level","dirty","text","self","wrap","stop","CompositionViewDesc","textDOM","mut","MarkViewDesc","_MarkViewDesc","spec","inline","custom","DOMSerializer","copy","nodes","replaceNodes","NodeViewDesc","_NodeViewDesc","descObj","applyOuterDeco","CustomNodeViewDesc","TextViewDesc","rule","Fragment","sameOuterDeco","composition","localComposition","compositionInChild","updater","ViewTreeUpdater","iterDeco","insideNode","Mark","compIndex","renderDescs","iosHacks","TextSelection","textNode","textPos","findTextInFragment","topNode","needsWrap","oldDOM","patchOuterDeco","computeOuterDeco","docViewDesc","docView","_TextViewDesc","skip","n","descs","written","childDOM","rm","OuterDecoLevel","noDeco","attrs","name","val","outerDOM","prevComputed","curComputed","curDOM","deco","patchAttributes","prevList","curList","prop","m","a","b","lock","preMatch","start","marks","keep","depth","maxKeep","found","markDesc","targetDesc","e","domNode","nextDOM","updated","locked","wrapper","ch","lastChild","hack","frag","parentDesc","curDesc","descI","fI","matched","matches","outer","compareSide","onWidget","onNode","locals","decoIndex","restNode","parentIndex","widgets","cutAt","d","oldCSS","childStart","str","replacement","selectionFromDOM","origin","nearestDesc","inWidget","selection","nearestDescNode","NodeSelection","min","max","$anchor","selectionBetween","editorOwnsSelection","hasSelection","selectionToDOM","syncNodeSelection","curSel","selectCursorWrapper","resetEditableFrom","resetEditableTo","brokenSelectBetweenUneditable","temporarilyEditableNear","resetEditable","removeClassOnSelectionChange","setEditable","img","clearNodeSelection","hasFocusAndSelection","anchorInRightPlace","moveSelectionBlock","$side","$start","Selection","apply","selectHorizontally","mods","$newHead","nodePos","nodeLen","isIgnorable","skipIgnoredNodes","skipIgnoredNodesBefore","skipIgnoredNodesAfter","moveNode","moveOffset","isBlockNode","setSelFocus","textNodeAfter","textNodeBefore","findDirection","mid","selectVertically","$from","$to","beyond","AllSelection","stopNativeHorizontalDelete","empty","nextNode","tr","switchEditable","safariDownArrowBug","focusNode","focusOffset","getMods","captureKeyDown","code","serializeForClipboard","slice","context","content","openStart","openEnd","serializer","detachedDoc","firstChild","wrappers","wrapMap","parseFromClipboard","html","plainText","$context","inCode","asText","Slice","parsed","schema","block","readHTML","restoreReplacedSpaces","contextNode","sliceData","DOMParser","inlineParents","addContext","closeSlice","normalizeSiblings","fragment","match","lastWrap","inLast","addToSibling","closeRight","wrapped","withWrappers","sibling","inner","fill","closeRange","_detachedDoc","_policy","maybeWrapTrusted","trustedTypes","s","metas","firstTag","array","type","handlers","editHandlers","passiveHandlers","InputState","initInput","handler","eventBelongsToView","runCustomHandler","ensureListeners","setSelectionOrigin","destroyInput","currentHandlers","dispatchEvent","_event","inOrNearComposition","now","eventCoords","isNear","click","dy","runHandlerOnContext","propName","inside","updateSelection","selectClickedLeaf","selectClickedNode","selectedNode","selectAt","handleSingleClick","selectNode","handleDoubleClick","handleTripleClick","defaultTripleClick","forceDOMFlush","endComposition","selectNodeModifier","flushed","MouseDown","targetPos","timeoutComposition","scheduleComposeEnd","delay","clearComposition","timestampFromCustomEvent","findCompositionNode","textBefore","textAfter","descAfter","lastChanged","descBefore","restarting","captureCopy","brokenClipboardAPI","cut","data","sliceSingleNode","capturePaste","plain","doPaste","preferPlain","singleNode","getText","clipboardData","uris","Dragging","move","dragCopyModifier","mouseDown","draggedSlice","dragging","_","eventPos","$mouse","insertPos","dropPoint","isNode","beforeInsert","_from","_to","_newFrom","newTo","domChangeCount","$cursor","compareObjs","WidgetType","_WidgetType","toDOM","noSpec","mapping","span","oldOffset","deleted","Decoration","other","InlineType","_InlineType","NodeType","_NodeType","_Decoration","none","DecorationSet","_DecorationSet","local","decorations","buildTree","predicate","childOff","options","newLocal","mapped","mapChildren","byPos","childNode","childOffset","baseOffset","takeSpansForNode","moveSpans","withoutNulls","removed","dec","localSet","DecorationGroup","removeOverlap","_DecorationGroup","members","mappedDecos","member","sorted","r","oldChildren","moved","oldStart","oldEnd","newStart","newEnd","dSize","mustRebuild","fromLocal","toLocal","mapAndGatherRemainingDecorations","built","spans","gather","set","hasNulls","localStart","subtree","working","insertAhead","viewDecorations","observeOptions","useCharData","SelectionState","DOMObserver","handleDOMChange","mutations","take","ancestors","container","newSel","typeOver","added","brs","br","blockParent","readSel","checkCSS","previousSibling","nextSibling","cssChecked","cssCheckWarned","rangeToSelectionRange","currentAnchor","safariShadowSelectionRange","read","parseBetween","from_","to_","find","startDoc","parser","ruleFromNode","isInline","readDOMChange","addedNodes","compositionID","$before","shared","parse","compare","preferredPos","preferredSide","change","findDiff","resolveSelection","$fromA","inlineChange","nextSel","looksLikeBackspace","chFrom","chTo","storedMarks","markChange","isMarkChange","parsedSel","curMarks","prevMarks","update","old","$newStart","$newEnd","skipClosingAndOpening","$next","fromEnd","mayOpen","endA","endB","adjust","isSurrogatePair","EditorView","place","props","InputState","checkStateComponent","getEditable","updateCursorWrapper","buildNodeViews","docViewDesc","computeDocDeco","viewDecorations","DOMObserver","from","to","typeOver","added","readDOMChange","initInput","prev","name","ensureListeners","prevProps","updated","state","_a","redraw","updateSel","clearComposition","pluginsChanged","nodeViews","changedNodeViews","innerDeco","outerDeco","scroll","updateDoc","oldScrollPos","storeScrollPos","forceSelUpdate","ie","chrome","selectionContextChanged","chromeKludge","findCompositionNode","anchorInRightPlace","selectionToDOM","syncNodeSelection","resetScrollPos","startDOM","f","NodeSelection","target","scrollRectIntoView","view","prevState","i","plugin","pluginView","dragging","sel","found","movedPos","Dragging","propName","prop","value","plugins","node","focusPreventScroll","cached","search","coords","posAtCoords","pos","side","coordsAtPos","desc","offset","bias","dir","endOfTextblock","html","event","doPaste","text","destroyInput","clearReusedRange","dispatchEvent","tr","dispatchTransaction","safari","deepActiveElement","safariShadowSelectionRange","attrs","attr","Decoration","dom","sel1","sel2","depth","result","add","obj","a","b","nA","nB","_","base","shift","mac","ie","i","code","keyName","event","ignoreKey","name","mac","normalizeKeyName","name","parts","result","alt","ctrl","shift","meta","i","mod","normalize","map","copy","prop","modifiers","event","keymap","bindings","Plugin","keydownHandler","view","keyName","baseName","direct","noShift","base","fromCode","deleteSelection","state","dispatch","atBlockStart","view","$cursor","joinBackward","$cut","findCutBefore","range","target","liftTarget","before","deleteBarrier","textblockAt","NodeSelection","depth","delStep","replaceStep","Slice","tr","Selection","joinTextblockBackward","joinTextblocksAround","joinTextblockForward","atBlockEnd","findCutAfter","beforeText","beforePos","child","after","afterText","afterPos","step","ReplaceStep","TextSelection","node","side","only","scan","selectNodeBackward","$head","empty","$pos","i","joinForward","selectNodeForward","parent","joinUp","sel","nodeSel","point","canJoin","joinPoint","joinDown","lift","$from","$to","newlineInCode","$anchor","defaultBlockAt","match","type","exitCode","above","pos","createParagraphNear","AllSelection","liftEmptyBlock","canSplit","splitBlockAs","splitNode","types","splitDepth","deflt","atEnd","atStart","d","splitType","splitPos","can","first","$first","splitBlock","selectParentNode","state","dispatch","$from","to","pos","same","NodeSelection","selectAll","AllSelection","joinMaybeClear","$pos","before","after","index","canJoin","deleteBarrier","$cut","dir","conn","match","isolated","canDelAfter","end","wrap","Fragment","i","tr","ReplaceAroundStep","Slice","$joinAt","selAfter","Selection","range","target","liftTarget","textblockAt","at","afterText","afterDepth","selectTextblockSide","side","sel","depth","TextSelection","selectTextblockStart","selectTextblockEnd","wrapIn","nodeType","attrs","$to","wrapping","findWrapping","setBlockType","applicable","from","node","chainCommands","commands","state","dispatch","view","backspace","deleteSelection","joinBackward","selectNodeBackward","del","joinForward","selectNodeForward","pcBaseKeymap","newlineInCode","createParagraphNear","liftEmptyBlock","splitBlock","exitCode","selectAll","macBaseKeymap","selectTextblockStart","selectTextblockEnd","key","mac","wrapInList","listType","attrs","state","dispatch","$from","$to","range","tr","wrapRangeInList","doJoin","outerRange","doc","$insert","NodeRange","wrap","findWrapping","doWrapInList","wrappers","joinBefore","content","Fragment","i","ReplaceAroundStep","Slice","found","splitDepth","splitPos","parent","e","first","canSplit","liftListItem","itemType","state","dispatch","$from","$to","range","node","liftToOuterList","liftOutOfList","tr","end","endOfList","ReplaceAroundStep","Slice","Fragment","NodeRange","target","liftTarget","after","canJoin","list","pos","i","e","$start","item","atStart","atEnd","parent","indexBefore","start","sinkListItem","startIndex","nodeBefore","nestedBefore","inner","slice","before","createChainableState","config","state","transaction","selection","doc","storedMarks","__spreadProps","__spreadValues","CommandManager","props","rawCommands","editor","view","tr","name","command","args","callback","startTr","shouldDispatch","callbacks","hasStartTransaction","run","chain","dispatch","formattedCommands","EventEmitter","event","fn","onceFn","getExtensionField","extension","field","context","splitExtensions","extensions","baseExtensions","nodeExtensions","markExtensions","getAttributesFromExtensions","extensionAttributes","nodeAndMarkExtensions","defaultAttribute","addGlobalAttributes","globalAttribute","type","attribute","addAttributes","attributes","mergedAttr","getNodeType","nameOrType","schema","mergeAttributes","objects","item","items","mergedAttributes","key","value","valueClasses","existingClasses","insertClasses","valueClass","newStyles","style","existingStyles","styleMap","property","val","part","getRenderedAttributes","nodeOrMark","isFunction","callOrReturn","isEmptyObject","fromString","injectExtensionAttributesToParseRule","parseRule","node","oldAttributes","newAttributes","cleanUpSchemaItem","data","getSchemaByResolvedExtensions","_a","allAttributes","topNode","nodes","extraNodeFields","fields","e","extendNodeSchema","extensionAttribute","parseHTML","renderHTML","renderText","marks","extraMarkFields","extendMarkSchema","mark","Schema","getSchemaTypeByName","isExtensionRulesEnabled","enabled","enabledExtension","getHTMLFromFragment","fragment","documentFragment","DOMSerializer","container","getTextContentFromNodes","$from","maxMatch","textBefore","sliceEndPos","pos","parent","index","_b","chunk","isRegExp","InputRule","inputRuleMatcherHandler","text","find","inputRuleMatch","result","run$1","from","to","rules","plugin","matched","rule","match","range","commands","can","inputRulesPlugin","Plugin","prev","stored","simulatedInputMeta","Fragment","$cursor","getType","isPlainObject","mergeDeep","target","source","output","Mark","_Mark","options","extendedConfig","currentPos","currentMarks","m","removeMark","isNumber","PasteRule","pasteRuleMatcherHandler","matches","pasteRuleMatch","pasteEvent","dropEvent","handlers","resolvedFrom","resolvedTo","textToMatch","start","end","handler","createClipboardPasteEvent","pasteRulesPlugin","dragSourceElement","isPastedFromProseMirror","isDroppedFromProseMirror","processEvent","pasteEvt","chainableState","handleDragstart","_view","html","transactions","oldState","isPaste","isDrop","simulatedPasteMeta","isSimulatedPaste","findDuplicates","filtered","el","ExtensionManager","_ExtensionManager","resolvedExtensions","duplicatedNames","addExtensions","a","b","priorityA","priorityB","addCommands","inputRules","pasteRules","allPlugins","plugins","addKeyboardShortcuts","defaultBindings","bindings","shortcut","method","keyMapPlugin","keymap","addInputRules","addPasteRules","addProseMirrorPlugins","proseMirrorPlugins","addNodeView","nodeview","getPos","decorations","innerDecorations","HTMLAttributes","onBeforeCreate","onCreate","onUpdate","onSelectionUpdate","onTransaction","onFocus","onBlur","onDestroy","Extension","_Extension","getTextBetween","startNode","blockSeparator","textSerializers","textSerializer","getTextSerializersFromSchema","ClipboardTextSerializer","PluginKey","ranges","blur","clearContent","emitUpdate","clearNodes","$to","mapping","$mappedFrom","$mappedTo","nodeRange","targetLiftDepth","liftTarget","defaultType","createParagraphNear","cut","originRange","targetPos","contentSlice","newPos","TextSelection","deleteCurrentNode","currentNode","$pos","depth","deleteNode","typeOrName","deleteRange","deleteSelection","enter","exitCode","objectIncludes","object1","object2","keys","findMarkInSet","k","isMarkInSet","getMarkRange","startIndex","startPos","endIndex","endPos","getMarkType","extendMarkRange","newSelection","first","i","isTextSelection","minMax","min","max","resolveFocusPosition","position","selectionAtStart","Selection","selectionAtEnd","minPos","maxPos","isiOS","focus","delayedFocus","isSameSelection","forEach","insertContent","removeWhitespaces","children","child","elementFromString","wrappedValue","createNodeFromContent","content","Node","isJSONContent","isTextContent","error","hasInvalidContent","invalidContent","contentCheckSchema","DOMParser","parser","selectionToInsertionEnd","startLen","bias","last","step","ReplaceStep","ReplaceAroundStep","map","_from","_to","_newFrom","newTo","isFragment","nodeOrFragment","insertContentAt","isOnlyTextContent","isOnlyBlockContent","newContent","v","joinUp","joinDown","joinBackward","joinForward","joinItemBackward","point","joinPoint","joinItemForward","joinTextblockBackward","joinTextblockForward","isMacOS","normalizeKeyName","parts","alt","ctrl","shift","meta","mod","keyboardShortcut","capturedTransaction","f","newStep","isNodeActive","empty","nodeRanges","relativeFrom","relativeTo","selectionRange","matchedNodeRanges","sum","lift","liftEmptyBlock","liftListItem","newlineInCode","getSchemaTypeNameByName","deleteProps","obj","propOrProps","newObj","prop","resetAttributes","nodeType","markType","schemaType","scrollIntoView","selectAll","selectNodeBackward","selectNodeForward","selectParentNode","selectTextblockEnd","selectTextblockStart","createDocument","parseOptions","setContent","document","getMarkAttributes","markItem","combineTransactionSteps","oldDoc","transform","Transform","defaultBlockAt","findChildren","predicate","nodesWithPos","findChildrenInRange","findParentNodeClosestToPos","findParentNode","getSchema","generateHTML","contentNode","generateJSON","dom","getText","generateText","getNodeAttributes","nodeItem","getAttributes","removeDuplicates","array","by","seen","simplifyChangedRanges","changes","uniqueChanges","change","_","otherChange","getChangedRanges","steps","stepMap","newStart","newEnd","oldStart","oldEnd","getDebugJSON","startOffset","increment","attrs","offset","getMarksBetween","getNodeAtPosition","maxDepth","currentDepth","getSplittedAttributes","typeName","isMarkActive","markRanges","matchedRange","markRange","excludedRange","isActive","isAtEndOfNode","$anchor","parentNode","$parentPos","isAtStartOfNode","isList","group","isNodeEmpty","checkChildren","ignoreWhitespace","isContentEmpty","childNode","isNodeSelection","NodeSelection","posToDOMRect","resolvedEnd","top","bottom","left","right","width","height","canSetMark","newMarkType","cursor","someNodeSupportsMark","_pos","parentAllowsMarkType","currentMarksAllowMarkType","otherMark","setMark","trimmedFrom","trimmedTo","setMeta","setNode","attributesToCopy","setBlockType","updatedState","setNodeSelection","setTextSelection","sinkListItem","ensureMarks","splittableMarks","filteredMarks","splitBlock","keepMarks","canSplit","atEnd","deflt","types","$first","splitListItem","overrideAttrs","grandParent","wrap","depthBefore","d","depthAfter","newNextTypeAttributes","nextType","Slice","sel","n","newTypeAttributes","joinListBackwards","listType","list","before","nodeBefore","canJoin","joinListForwards","after","nodeAfter","toggleList","listTypeOrName","itemTypeOrName","itemType","parentList","canWrapInList","toggleMark","extendEmptyMarkRange","toggleNode","toggleTypeOrName","toggleType","toggleWrap","undoInputRule","undoable","toUndo","j","unsetAllMarks","unsetMark","updateAttributes","lastPos","lastNode","trimmedFrom2","trimmedTo2","wrapIn","wrapInList","Commands","Drop","slice","moved","Editable","FocusEvents","Keymap","handleBackspace","parentIsIsolating","parentPos","isAtStart","handleDelete","baseKeymap","pcKeymap","macKeymap","newState","docChanges","ignoreTr","allFrom","allEnd","Paste","Tabindex","NodePos","_NodePos","isBlock","isNonTextAtom","childNodePos","selector","nodeAttributes","attrKeys","firstItemOnly","childPos","createStyleTag","nonce","suffix","tiptapStyleTag","styleNode","Editor","editable","handlePlugins","nameOrPluginKeyToRemove","prevPlugins","nameOrPluginKey","allExtensions","ext","EditorView","EditorState","selectionHasChanged","nameOrAttributes","attributesOrUndefined","markInputRule","captureGroup","fullMatch","startSpaces","textStart","textEnd","markEnd","nodeInputRule","newNode","matchStart","lastChar","insertionStart","textblockTypeInputRule","$start","textInputRule","insert","cutOff","wrappingInputRule","blockRange","wrapping","findWrapping","_Node","isAndroid","NodeView","component","_c","_d","_e","_f","_g","dragHandle","x","y","domBox","handleBox","offsetX","offsetY","isDragEvent","isDropEvent","isEditable","isDragging","isDraggable","isSelectable","isCopyEvent","isPasteEvent","isCutEvent","isClickEvent","mutation","markPasteRule","escapeForRegEx","string","isString","nodePasteRule","textPasteRule","Tracker","deleted","newPosition","mapResult"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]} \ No newline at end of file diff --git a/chunk-CJRETWGW.js b/chunk-7CIXT6MF.js similarity index 85% rename from chunk-CJRETWGW.js rename to chunk-7CIXT6MF.js index 5368bdc2..925c53bf 100644 --- a/chunk-CJRETWGW.js +++ b/chunk-7CIXT6MF.js @@ -1,2 +1,2 @@ -import{E as t,V as r}from"./chunk-5XJ3NODC.js";var s=r.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",t(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});export{s as Underline,s as default}; -//# sourceMappingURL=chunk-CJRETWGW.js.map +import{E as t,V as r}from"./chunk-7OFBBPR7.js";var s=r.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",t(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});export{s as Underline,s as default}; +//# sourceMappingURL=chunk-7CIXT6MF.js.map diff --git a/chunk-CJRETWGW.js.map b/chunk-7CIXT6MF.js.map similarity index 100% rename from chunk-CJRETWGW.js.map rename to chunk-7CIXT6MF.js.map diff --git a/chunk-5XJ3NODC.js b/chunk-7OFBBPR7.js similarity index 75% rename from chunk-5XJ3NODC.js rename to chunk-7OFBBPR7.js index 298fb4af..5b0686bd 100644 --- a/chunk-5XJ3NODC.js +++ b/chunk-7OFBBPR7.js @@ -1,18 +1,18 @@ var Zr=Object.defineProperty,rl=Object.defineProperties;var il=Object.getOwnPropertyDescriptors;var vt=Object.getOwnPropertySymbols;var Qr=Object.prototype.hasOwnProperty,ei=Object.prototype.propertyIsEnumerable;var wn=(n,e,t)=>e in n?Zr(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,k=(n,e)=>{for(var t in e||(e={}))Qr.call(e,t)&&wn(n,t,e[t]);if(vt)for(var t of vt(e))ei.call(e,t)&&wn(n,t,e[t]);return n},B=(n,e)=>rl(n,il(e));var md=(n,e)=>{var t={};for(var r in n)Qr.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&vt)for(var r of vt(n))e.indexOf(r)<0&&ei.call(n,r)&&(t[r]=n[r]);return t};var gd=(n,e)=>{for(var t in e)Zr(n,t,{get:e[t],enumerable:!0})};var yd=(n,e,t)=>wn(n,typeof e!="symbol"?e+"":e,t);function $(n){this.content=n}$.prototype={constructor:$,find:function(n){for(var e=0;e>1}};$.from=function(n){if(n instanceof $)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new $(e)};var Cn=$;function fi(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let i=n.child(r),s=e.child(r);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)t++;return t}if(i.content.size||s.content.size){let o=fi(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function di(n,e,t,r){for(let i=n.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:r};let o=n.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,r-=a;continue}if(!o.sameMarkup(l))return{a:t,b:r};if(o.isText&&o.text!=l.text){let c=0,f=Math.min(o.text.length,l.text.length);for(;ce&&r(a,i+l,s||null,o)!==!1&&a.content.size){let f=l+1;a.nodesBetween(Math.max(0,e-f),Math.min(a.content.size,t-f),r,i+f)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(o?o=!1:s+=r),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(i[i.length-1]=t.withText(t.text+r.text),s=1);se)for(let s=0,o=0;oe&&((ot)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),r.push(l),i+=l.nodeSize),o=a}return new n(r,i)}cutByIndex(e,t){return e==t?n.empty:e==0&&t==this.content.length?this:new n(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return i[e]=t,new n(i,s)}addToStart(e){return new n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new n(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;tthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let s=this.child(r),o=i+s.nodeSize;if(o>=e)return o==e||t>0?Rt(r+1,o):Rt(r,i);i=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return n.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new n(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return n.empty;let t,r=0;for(let i=0;i{class n{constructor(t,r){this.type=t,this.attrs=r}addToSet(t){let r,i=!1;for(let s=0;sthis.type.rank&&(r||(r=t.slice(0,s)),r.push(this),i=!0),r&&r.push(o)}}return r||(r=t.slice()),i||r.push(this),r}removeFromSet(t){for(let r=0;ri.type.rank-s.type.rank),r}}return n.none=[],n})(),ve=class extends Error{},x=class n{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=hi(this.content,e+this.openStart,t);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(e,t){return new n(ui(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return n.empty;let r=t.openStart||0,i=t.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(b.fromJSON(e,t.content),r,i)}static maxOpen(e,t=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new n(e,r,i)}};x.empty=new x(b.empty,0,0);function ui(n,e,t){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r),{index:o,offset:l}=n.findIndex(t);if(i==e||s.isText){if(l!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(ui(s.content,e-i-1,t-i-1)))}function hi(n,e,t,r){let{index:i,offset:s}=n.findIndex(e),o=n.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=hi(o.content,e-s-1,t);return l&&n.replaceChild(i,o.copy(l))}function sl(n,e,t){if(t.openStart>n.depth)throw new ve("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new ve("Inconsistent open depths");return pi(n,e,t,0)}function pi(n,e,t,r){let i=n.index(r),s=n.node(r);if(i==e.index(r)&&r=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ot(n,e,t,r){let i=(e||n).node(t),s=0,o=e?e.index(t):i.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Ae(n.nodeAfter,r),s++));for(let l=s;li&&Tn(n,e,i+1),o=r.depth>i&&Tn(t,r,i+1),l=[];return ot(null,n,i,l),s&&o&&e.index(i)==t.index(i)?(mi(s,o),Ae(Ie(s,gi(n,e,t,r,i+1)),l)):(s&&Ae(Ie(s,zt(n,e,i+1)),l),ot(e,t,i,l),o&&Ae(Ie(o,zt(t,r,i+1)),l)),ot(r,null,i,l),new b(l)}function zt(n,e,t){let r=[];if(ot(null,n,t,r),n.depth>t){let i=Tn(n,e,t+1);Ae(Ie(i,zt(n,e,t+1)),r)}return ot(e,null,t,r),new b(r)}function ol(n,e){let t=e.depth-n.openStart,i=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(b.from(i));return{start:i.resolveNoCache(n.openStart+t),end:i.resolveNoCache(i.content.size-n.openEnd-t)}}var Ft=class n{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(t);return r?e.child(t).cut(r):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Re(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(r.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new n(t,r,s)}static resolveCached(e,t){let r=ti.get(e);if(r)for(let s=0;se&&this.nodesBetween(e,t,s=>(r.isInSet(s.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 e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),yi(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=b.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;at.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let i=b.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};G.prototype.text=void 0;var Dn=class n extends G{constructor(e,t,r,i){if(super(e,t,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yi(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function yi(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}var Pe=class n{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new An(e,t);if(r.next==null)return n.empty;let i=bi(r);r.next&&r.err("Unexpected trailing text");let s=ml(pl(i));return gl(s,r),s}matchType(e){for(let t=0;tc.createAndFill()));for(let c=0;c=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let i=0;i{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+e.indexOf(r.next[o].next);return s}).join(` -`)}};Pe.empty=new Pe(!0);var An=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.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(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function bi(n){let e=[];do e.push(cl(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function cl(n){let e=[];do e.push(fl(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function fl(n){let e=hl(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=dl(n,e);else break;return e}function ni(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function dl(n,e){let t=ni(n),r=t;return n.eat(",")&&(n.next!="}"?r=ni(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ul(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function hl(n){if(n.eat("(")){let e=bi(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ul(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function pl(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let f=0;f{c||i.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let s=e[r.join(",")]=new Pe(r.indexOf(n.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Si(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new G(this,this.computeAttrs(e),b.from(t),D.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new G(this,this.computeAttrs(e),t,D.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=b.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(b.empty,!0);return s?new G(this,e,t.append(s),D.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new n(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function yl(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}var In=class{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?yl(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}},at=class n{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=wi(e,i.attrs),this.excluded=null;let s=xi(this.attrs);this.instance=s?new D(this,s):null}create(e=null){return!e&&this.instance?this.instance:new D(this,Si(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new n(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}},ct=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Cn.from(e.nodes),t.marks=Cn.from(e.marks||{}),this.nodes=Lt.compile(this.spec.nodes,this),this.marks=at.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Pe.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?ii(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:ii(this,o.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(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Lt){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Dn(r,r.defaultAttrs,e,D.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return G.fromJSON(this,e)}markFromJSON(e){return D.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function ii(n,e){let t=[];for(let r=0;r-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function bl(n){return n.tag!=null}function kl(n){return n.style!=null}var le=class n{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(bl(i))this.tags.push(i);else if(kl(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Vt(this,t,!1);return r.addAll(e,D.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Vt(this,t,!0);return r.addAll(e,D.none,t.from,t.to),x.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=oi(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=oi(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new n(e,n.schemaRules(e)))}},Ci={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},xl={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Oi={ol:!0,ul:!0},ft=1,vn=2,lt=4;function si(n,e,t){return e!=null?(e?ft:0)|(e==="full"?vn:0):n&&n.whitespace=="pre"?ft|vn:t&~lt}var He=class{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=D.none,this.match=s||(o<?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ft)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ci.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Vt=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=si(null,t.preserveWhitespace,0)|(r?lt:0);i?s=new He(i.type,i.attrs,D.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new He(null,null,D.none,!0,null,o):s=new He(e.schema.topNodeType,null,D.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&vn?"full":this.localPreserveWS||(i.options&ft)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,` +`)}};Pe.empty=new Pe(!0);var An=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.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(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function bi(n){let e=[];do e.push(cl(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function cl(n){let e=[];do e.push(fl(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function fl(n){let e=hl(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=dl(n,e);else break;return e}function ni(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function dl(n,e){let t=ni(n),r=t;return n.eat(",")&&(n.next!="}"?r=ni(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function ul(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&n.err("No node type or group '"+e+"' found"),i}function hl(n){if(n.eat("(")){let e=bi(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=ul(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function pl(n){let e=[[]];return i(s(n,0),t()),e;function t(){return e.push([])-1}function r(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return r(l,a),i(s(o.expr,a),a),[r(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[r(a)]}else{if(o.type=="opt")return[r(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c{n[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let f=0;f{c||i.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let s=e[r.join(",")]=new Pe(r.indexOf(n.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Si(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new G(this,this.computeAttrs(e),b.from(t),D.setFrom(r))}createChecked(e=null,t,r){return t=b.from(t),this.checkContent(t),new G(this,this.computeAttrs(e),t,D.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=b.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(b.empty,!0);return s?new G(this,e,t.append(s),D.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;tr[s]=new n(s,t,o));let i=t.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function yl(n,e,t){let r=t.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${s}`)}}var In=class{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?yl(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}},at=class n{constructor(e,t,r,i){this.name=e,this.rank=t,this.schema=r,this.spec=i,this.attrs=wi(e,i.attrs),this.excluded=null;let s=xi(this.attrs);this.instance=s?new D(this,s):null}create(e=null){return!e&&this.instance?this.instance:new D(this,Si(this.attrs,e))}static compile(e,t){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new n(s,i++,t,o)),r}removeFromSet(e){for(var t=0;t-1}},ct=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=Cn.from(e.nodes),t.marks=Cn.from(e.marks||{}),this.nodes=Lt.compile(this.spec.nodes,this),this.marks=at.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Pe.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?ii(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:ii(this,o.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(e,t=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Lt){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,i)}text(e,t){let r=this.nodes.text;return new Dn(r,r.defaultAttrs,e,D.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return G.fromJSON(this,e)}markFromJSON(e){return D.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function ii(n,e){let t=[];for(let r=0;r-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function bl(n){return n.tag!=null}function kl(n){return n.style!=null}var oe=class n{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(i=>{if(bl(i))this.tags.push(i);else if(kl(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new Vt(this,t,!1);return r.addAll(e,D.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new Vt(this,t,!0);return r.addAll(e,D.none,t.from,t.to),x.maxOpen(r.finish())}matchTag(e,t,r){for(let i=r?this.tags.indexOf(r)+1:0;ie.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o{r(o=oi(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=oi(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new n(e,n.schemaRules(e)))}},Ci={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},xl={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Oi={ol:!0,ul:!0},ft=1,vn=2,lt=4;function si(n,e,t){return e!=null?(e?ft:0)|(e==="full"?vn:0):n&&n.whitespace=="pre"?ft|vn:t&~lt}var He=class{constructor(e,t,r,i,s,o){this.type=e,this.attrs=t,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=D.none,this.match=s||(o<?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ft)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Ci.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},Vt=class{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=si(null,t.preserveWhitespace,0)|(r?lt:0);i?s=new He(i.type,i.attrs,D.none,!0,t.topMatch||i.type.contentMatch,o):r?s=new He(null,null,D.none,!0,null,o):s=new He(e.schema.topNodeType,null,D.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,i=this.top,s=i.options&vn?"full":this.localPreserveWS||(i.options&ft)>0;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)s!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,` `);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],l=e.previousSibling;(!o||l&&l.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;Oi.hasOwnProperty(o)&&this.parser.normalizeLists&&Sl(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:xl.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,f=this.needsBlock;if(Ci.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),c&&this.sync(s),this.needsBlock=f}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t){let r,i;for(let s=this.open;s>=0;s--){let o=this.nodes[s],l=o.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=o,!l.length)||o.solid)break}if(!r)return null;this.sync(i);for(let s=0;s(o.type?o.type.allowsMarkType(c.type):li(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new He(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));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(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ft)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let f=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!f||f.name!=c&&!f.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};function Sl(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Oi.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Ml(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function oi(n){let e={};for(let t in n)e[t]=n[t];return e}function li(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Pt(Nn(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Pt(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ai(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ai(e.marks)}};function ai(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Nn(n){return n.document||window.document}var ci=new WeakMap;function wl(n){let e=ci.get(n);return e===void 0&&ci.set(n,e=Cl(n)),e}function Cl(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let d in c)if(c[d]!=null){let u=d.indexOf(" ");u>0?a.setAttributeNS(d.slice(0,u),d.slice(u+1),c[d]):a.setAttribute(d,c[d])}}for(let d=f;df)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Pt(n,u,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var Ei=65535,Di=Math.pow(2,16);function Ol(n,e){return n+e*Di}function Ni(n){return n&Ei}function Nl(n){return(n-(n&Ei))/Di}var Ai=1,Ii=2,$t=4,vi=8,ht=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&vi)>0}get deletedBefore(){return(this.delInfo&(Ai|$t))>0}get deletedAfter(){return(this.delInfo&(Ii|$t))>0}get deletedAcross(){return(this.delInfo&$t)>0}},he=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=Ni(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],f=this.ranges[l+o],d=a+c;if(e<=d){let u=c?e==a?-1:e==d?1:t:t,h=a+i+(u<0?0:f);if(r)return h;let p=e==(t<0?a:d)?null:Ol(l/3,e-a),m=e==a?Ii:e==d?Ai:$t;return(t<0?e!=a:e!=d)&&(m|=vi),new ht(h,m,p)}i+=f-c}return r?e+i:new ht(e+i,0,null)}touches(e,t){let r=0,i=Ni(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],f=a+c;if(e<=f&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return L.fromReplace(e,this.from,this.to,s)}invert(){return new Be(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};z.jsonID("addMark",pt);var Be=class n extends z{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new x(Vn(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return L.fromReplace(e,this.from,this.to,r)}invert(){return new pt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};z.jsonID("removeMark",Be);var mt=class n extends z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return L.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return L.fromReplace(e,this.pos,this.pos+1,new x(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new n(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,x.fromJSON(e,t.slice),t.insert,!!t.structure)}};z.jsonID("replaceAround",R);function Fn(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Tl(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,f)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&f.type.allowsMarkType(r.type)){let u=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function El(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof at){let c=o.marks,f;for(;f=r.isInSet(c);)(a||(a=[])).push(f),c=f.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let f=0;fn.step(new Be(o.from,o.to,o.style)))}function $n(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a=0;a--)n.step(o[a])}function Dl(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function pe(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,f=b.from(r.node(p).copy(f)),d++):a--;let u=b.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=b.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new R(i,s,i,s,new x(r,0,0),t.length,!0))}function Pl(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&Bl(n.doc,n.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Pi(n,o,l,s),$n(n,n.mapping.slice(s).map(l,1),r,void 0,c===null);let f=n.mapping.slice(s),d=f.map(l,1),u=f.map(l+o.nodeSize,1);return n.step(new R(d,u,d+1,u-1,new x(b.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Ri(n,o,l,s),!1}})}function Ri(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Pi(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(` -`))}})}function Bl(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function zl(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new R(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new x(b.from(o),0,0),1,!0))}function Q(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,f=t-2;c>s;c--,f--){let d=i.node(c),u=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(u,d.childCount),p=r&&r[f+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[f]||d;if(!d.canReplace(u+1,d.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Fl(n,e,t=1,r){let i=n.doc.resolve(e),s=b.empty,o=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=b.from(i.node(l).copy(s));let f=r&&r[c];o=b.from(f?f.type.create(f.attrs,o):i.node(l).copy(o))}n.step(new j(e,e,new x(s.append(o),t,t),!0))}function ie(n,e){let t=n.resolve(e),r=t.index();return Bi(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Ll(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Bi(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Vl(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let f=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);f&&!d?r=!1:!f&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let f=n.doc.resolve(e+t);Pi(n,f.node(),f.before(),l)}o.inlineContent&&$n(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new j(c,a.map(e+t,-1),x.empty,!0)),r===!0){let f=n.doc.resolve(c);Ri(n,f.node(),f.before(),n.steps.length)}return n}function $l(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),f=!1;if(s==1)f=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);f=d&&c.canReplaceWith(a,a,d[0])}if(f)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function yt(n,e,t=e,r=x.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Fi(i,s,r)?new j(e,t,r):new Ln(i,s,r).fit()}function Fi(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}var Ln=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=b.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new x(s,o,l);return e>-1?new R(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new j(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Pn(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],f,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(b.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(t==2&&o&&(f=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:f};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pn(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new x(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pn(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new x(dt(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new x(dt(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(d=g,f.push(Li(m.mark(u.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=ut(this.placed,t,b.from(f)),this.frontier[t].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],f=Bn(e,l,c,a,!0);if(!f||f.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ut(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ut(this.placed,this.depth,b.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=ut(this.placed,this.frontier.length,t))}};function dt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(dt(n.firstChild.content,e-1,t)))}function ut(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ut(n.lastChild.content,e-1,t)))}function Pn(n,e){for(let t=0;t1&&(r=r.replaceChild(0,Li(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(b.empty,!0)))),n.copy(r)}function Bn(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!jl(t,s.content,o)?l:null}function jl(n,e,t){for(let r=t;r0;u--,h--){let p=i.node(u).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(u)>-1?l=u:i.before(u)==h&&o.splice(1,0,-u)}let a=o.indexOf(l),c=[],f=r.openStart;for(let u=r.content,h=0;;h++){let p=u.firstChild;if(c.push(p),h==r.openStart)break;u=p.content}for(let u=f-1;u>=0;u--){let h=c[u],p=Wl(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))f=u;else if(p||!h.type.isTextblock)break}for(let u=r.openStart;u>=0;u--){let h=(u+f+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>d));u--){let h=o[u];h<0||(e=i.before(h),t=s.after(h))}}function Vi(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(b.empty,!0))}return n}function ql(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=$l(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new x(b.from(r),0,0))}function Kl(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=$i(r,i);for(let o=0;o0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function $i(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}var jt=class n extends z{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return L.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return L.fromReplace(e,this.pos,this.pos+1,new x(b.from(i),0,t.isLeaf?0:1))}getMap(){return he.empty}invert(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};z.jsonID("attr",jt);var Wt=class n extends z{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return L.ok(r)}getMap(){return he.empty}invert(e){return new n(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};z.jsonID("docAttr",Wt);var Ue=class extends Error{};Ue=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ue.prototype=Object.create(Error.prototype);Ue.prototype.constructor=Ue;Ue.prototype.name="TransformError";var _e=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ue(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=x.empty){let i=yt(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new x(b.from(r),0,0))}delete(e,t){return this.replace(e,t,x.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Jl(this,e,t,r),this}replaceRangeWith(e,t,r){return ql(this,e,t,r),this}deleteRange(e,t){return Kl(this,e,t),this}lift(e,t){return Al(this,e,t),this}join(e,t=1){return Vl(this,e,t),this}wrap(e,t){return Rl(this,e,t),this}setBlockType(e,t=e,r,i=null){return Pl(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return zl(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new jt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Wt(e,t)),this}addNodeMark(e,t){return this.step(new mt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof D)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new gt(e,t)),this}split(e,t=1,r){return Fl(this,e,t,r),this}addMark(e,t,r){return Tl(this,e,t,r),this}removeMark(e,t,r){return El(this,e,t,r),this}clearIncompatible(e,t,r){return $n(this,e,t,r),this}};var jn=Object.create(null),C=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qt(e.min(t),e.max(t))]}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 e=this.ranges;for(let t=0;t=0;s--){let o=t<0?Xe(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Xe(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Z(e.node(0))}static atStart(e){return Xe(e,e,0,0,1)||new Z(e)}static atEnd(e){return Xe(e,e,e.content.size,e.childCount,-1)||new Z(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=jn[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jn)throw new RangeError("Duplicate use of selection JSON ID "+e);return jn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return T.between(this.$anchor,this.$head).getBookmark()}};C.prototype.visible=!0;var qt=class{constructor(e,t){this.$from=e,this.$to=t}},ji=!1;function Wi(n){!ji&&!n.parent.inlineContent&&(ji=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}var T=class n extends C{constructor(e,t=e){Wi(e),Wi(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return C.near(r);let i=e.resolve(t.map(this.anchor));return new n(i.parent.inlineContent?i:r,r)}replace(e,t=x.empty){if(super.replace(e,t),t==x.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Kt(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=C.findFrom(t,r,!0)||C.findFrom(t,-r,!0);if(s)t=s.$head;else return C.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(C.findFrom(e,-r,!0)||C.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&M.isSelectable(l))return M.create(n,t-(i<0?l.nodeSize:0))}else{let a=Xe(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Ji(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=f)}),n.setSelection(C.near(n.doc.resolve(o),t))}var qi=1,Jt=2,Ki=4,qn=class extends _e{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Jt,this}ensureMarks(e){return D.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Jt)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Jt,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||D.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(C.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ki,this}get scrolledIntoView(){return(this.updated&Ki)>0}};function Hi(n,e){return!e||!n?n:n.bind(e)}var ze=class{constructor(e,t,r){this.name=e,this.init=Hi(t.init,r),this.apply=Hi(t.apply,r)}},Ul=[new ze("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ze("selection",{init(n,e){return n.selection||C.atStart(e.doc)},apply(n){return n.selection}}),new ze("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ze("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],bt=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ul.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ze(r.key,r.spec.state,r))})}},Ht=class n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new bt(e.schema,e.plugins),s=new n(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=G.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=C.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}};function Ui(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Ui(i,e,{})),t[r]=i}return t}var Y=class{constructor(e){this.spec=e,this.props={},e.props&&Ui(e.props,this,this.props),this.key=e.key?e.key.key:_i("plugin")}getState(e){return e[this.key]}},Wn=Object.create(null);function _i(n){return n in Wn?n+"$"+ ++Wn[n]:(Wn[n]=0,n+"$")}var ae=class{constructor(e="key"){this.key=_i(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var V=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mt=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},Yn=null,ge=function(n,e,t){let r=Yn||(Yn=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},_l=function(){Yn=null},Je=function(n,e,t,r){return t&&(Gi(n,e,t,r,-1)||Gi(n,e,t,r,1))},Gl=/^(img|br|input|textarea|hr)$/i;function Gi(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:te(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Nt(n)||Gl.test(n.nodeName)||n.contentEditable=="false")return!1;e=V(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?te(n):0}else return!1}}function te(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Yl(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=te(n)}else if(n.parentNode&&!Nt(n))e=V(n),n=n.parentNode;else return null}}function Xl(n,e){for(;;){if(n.nodeType==3&&e2),ee=nt||(ce?/Mac/.test(ce.platform):!1),ta=ce?/Win/.test(ce.platform):!1,se=/Android \d/.test(Te),Tt=!!Yi&&"webkitFontSmoothing"in Yi.documentElement.style,na=Tt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ra(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function me(n,e){return typeof n=="number"?n:n[e]}function ia(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Xi(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=Mt(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?ra(s):ia(l),f=0,d=0;if(e.topc.bottom-me(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+me(i,"top")-c.top:e.bottom-c.bottom+me(i,"bottom")),e.leftc.right-me(r,"right")&&(f=e.right-c.right+me(i,"right")),f||d)if(a)s.defaultView.scrollBy(f,d);else{let u=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),f&&(l.scrollLeft+=f);let p=l.scrollLeft-u,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function sa(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Is(n.dom)}}function Is(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Mt(r));return e}function oa({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;vs(t,r==0?0:r-e)}function vs(n,e){for(let t=0;t=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=f,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?aa(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Rs(t,i)}function aa(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function pr(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function ca(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function da(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right-1?i:n.docView.posFromDOM(e,t,-1)}function Ps(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;Tt&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=da(n,r,i,e))}l==null&&(l=fa(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Zi(n){return n.top=0&&i==r.nodeValue.length?(a--,f=1):t<0?a--:c++,kt(Se(ge(r,a,c),f),f<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==te(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Kn(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==te(r))){let a=r.childNodes[i-1],c=a.nodeType==3?ge(a,te(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return kt(Se(c,1),!1)}if(s==null&&i=0)}function kt(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Kn(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function zs(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function pa(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return zs(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Bs(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=ge(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cf.top+1&&(t=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}var ma=/[\u0590-\u08ac]/;function ga(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return l?!ma.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:zs(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:f,anchorOffset:d}=n.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(f,d),a&&(a!=f||c!=d)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),g}):r.pos==r.start()||r.pos==r.end()}var Qi=null,es=null,ts=!1;function ya(n,e,t){return Qi==e&&es==t?ts:(Qi=e,es=t,ts=t=="up"||t=="down"?pa(n,e,t):ga(n,e,t))}var ne=0,ns=1,Le=2,fe=3,qe=class{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ne,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tV(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof Gt){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Ut&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?V(s.dom)+1:0}}else{let s,o=!0;for(;s=r=f&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,f);e=o;for(let d=l;d>0;d--){let u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){i=V(u.dom)+1;break}e-=u.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let f=l+1;fp&&ot){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?Le:ns,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=fe:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Le:fe}r=o}this.dirty=Le}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Le:ns;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==ne&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},er=class extends qe{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},rt=class n extends qe{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=ue.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&fe||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=fe&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ne){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=ir(s,0,e,r));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),f=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!f)f=document.createTextNode(t.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:d}=ue.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),t.type.spec.draggable&&(f.draggable=!0));let u=f;return f=Vs(f,r,t),c?a=new tr(e,t,r,i,f,d||null,u,c,s,o+1):t.isText?new _t(e,t,r,i,f,u,s):new n(e,t,r,i,f,d||null,u,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>b.empty)}return e}matchesNode(e,t,r){return this.dirty==ne&&e.eq(this.node)&&Yt(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new rr(this,o&&o.node,e);Sa(this.node,this.innerDeco,(c,f,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(f==this.node.childCount?D.none:this.node.child(f).marks,r,e),a.placeWidget(c,e,i)},(c,f,d,u)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,f,d,u)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,f,d,h,e)||a.updateNextNode(c,f,d,e,u,i)||a.addNode(c,f,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Le)&&(o&&this.protectLocalComposition(e,o),Fs(this.contentDOM,this.children,e),nt&&Ma(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof T)||rt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=wa(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new er(this,s,t,i);e.input.compositionNodes.push(o),this.children=ir(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==fe||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ne}updateOuterDeco(e){if(Yt(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ls(this.dom,this.nodeDOM,nr(this.outerDeco,this.node,t),nr(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function rs(n,e,t,r,i){Vs(r,e,n);let s=new Oe(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}var _t=class n extends Oe{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==fe||this.dirty!=ne&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ne||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ne,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new n(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=fe)}get domAtom(){return!1}isText(e){return this.node.text==e}},Gt=class extends qe{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ne&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},tr=class extends Oe{constructor(e,t,r,i,s,o,l,a,c,f){super(e,t,r,i,s,o,l,c,f),this.spec=a}update(e,t,r,i){if(this.dirty==fe)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Fs(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=rt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof rt)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function xa(n,e){return n.type.side-e.type.side}function Sa(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let p=s+u.nodeSize;if(u.isText){let g=p;o!g.inline):l.slice();r(u,m,e.forChild(s,u),h),s=p}}function Ma(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function wa(n,e,t,r){for(let i=0,s=0;i=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function ir(n,e,t,r,i){let s=[];for(let o=0,l=0;o=t||f<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,r)))}return s}function mr(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(sn(t)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&M.isSelectable(d)&&i.parent&&!(d.isInline&&Zl(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new M(o==u?l:r.resolve(u))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,u=o;for(let h=0;h{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!$s(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Oa(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,V(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&X&&Ce<=11&&(r.disabled=!0,r.disabled=!1)}function js(n,e){if(e instanceof M){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(cs(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else cs(n)}function cs(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function gr(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||T.between(e,t,r)}function fs(n){return n.editable&&!n.hasFocus()?!1:Ws(n)}function Ws(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Na(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Je(e.node,e.offset,t.anchorNode,t.anchorOffset)}function sr(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&C.findFrom(s,e)}function Me(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ds(n,e,t){let r=n.state.selection;if(r instanceof T)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Me(n,new T(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=sr(n.state,e);return i&&i instanceof M?Me(n,i):!1}else if(!(ee&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?M.isSelectable(s)?Me(n,new M(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Tt?Me(n,new T(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof M&&r.node.isInline)return Me(n,new T(e>0?r.$to:r.$from));{let i=sr(n.state,e);return i?Me(n,i):!1}}}function Xt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function St(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Qe(n,e){return e<0?Ta(n):Ea(n)}function Ta(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(oe&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(St(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Js(t))break;{let l=t.previousSibling;for(;l&&St(l,-1);)i=t.parentNode,s=V(l),l=l.previousSibling;if(l)t=l,r=Xt(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?or(n,t,r):i&&or(n,i,s)}function Ea(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Xt(t),s,o;for(;;)if(r{n.state==i&&ye(n)},50)}function us(n,e){let t=n.state.doc.resolve(e);if(!(J||ta)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function hs(n,e,t){let r=n.state.selection;if(r instanceof T&&!r.empty||t.indexOf("s")>-1||ee&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=sr(n.state,e);if(o&&o instanceof M)return Me(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Z?C.near(o,e):C.findFrom(o,e);return l?Me(n,l):!1}return!1}function ps(n,e){if(!(n.state.selection instanceof T))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function ms(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ia(n){if(!K||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ms(n,r,"true"),setTimeout(()=>ms(n,r,"false"),20)}return!1}function va(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Ra(n,e){let t=e.keyCode,r=va(e);if(t==8||ee&&t==72&&r=="c")return ps(n,-1)||Qe(n,-1);if(t==46&&!e.shiftKey||ee&&t==68&&r=="c")return ps(n,1)||Qe(n,1);if(t==13||t==27)return!0;if(t==37||ee&&t==66&&r=="c"){let i=t==37?us(n,n.state.selection.from)=="ltr"?-1:1:-1;return ds(n,i,r)||Qe(n,i)}else if(t==39||ee&&t==70&&r=="c"){let i=t==39?us(n,n.state.selection.from)=="ltr"?1:-1:1;return ds(n,i,r)||Qe(n,i)}else{if(t==38||ee&&t==80&&r=="c")return hs(n,-1,r)||Qe(n,-1);if(t==40||ee&&t==78&&r=="c")return Ia(n)||hs(n,1,r)||Qe(n,1);if(r==(ee?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qs(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||ue.fromSchema(n.state.schema),l=Ys(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,f,d=0;for(;c&&c.nodeType==1&&(f=Gs[c.nodeName.toLowerCase()]);){for(let h=f.length-1;h>=0;h--){let p=l.createElement(f[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let u=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` +`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let i=0;i!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,r,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),r)||this.leafFallback(e,r);else{let a=this.enter(o,t.attrs||null,r,t.preserveWhitespace);a&&(s=!0,r=a)}else{let a=this.parser.schema.marks[t.mark];r=r.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t){let r,i;for(let s=this.open;s>=0;s--){let o=this.nodes[s],l=o.findWrapping(e);if(l&&(!r||r.length>l.length)&&(r=l,i=o,!l.length)||o.solid)break}if(!r)return null;this.sync(i);for(let s=0;s(o.type?o.type.allowsMarkType(c.type):li(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new He(e,t,a,i,null,l)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));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(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=ft)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let f=a>0||a==0&&i?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!f||f.name!=c&&!f.isInGroup(c))return!1;a--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}};function Sl(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Oi.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function Ml(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function oi(n){let e={};for(let t in n)e[t]=n[t];return e}function li(n,e){let t=e.schema.nodes;for(let r in t){let i=t[r];if(!i.allowsMarkType(n))continue;let s=[],o=l=>{s.push(l);for(let a=0;a{if(s.length||o.marks.length){let l=0,a=0;for(;l=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let i=this.marks[e.type.name];return i&&Pt(Nn(r),i(e,t),null,e.attrs)}static renderSpec(e,t,r=null,i){return Pt(e,t,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new n(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ai(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return ai(e.marks)}};function ai(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Nn(n){return n.document||window.document}var ci=new WeakMap;function wl(n){let e=ci.get(n);return e===void 0&&ci.set(n,e=Cl(n)),e}function Cl(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=i.indexOf(" ");o>0&&(t=i.slice(0,o),i=i.slice(o+1));let l,a=t?n.createElementNS(t,i):n.createElement(i),c=e[1],f=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){f=2;for(let d in c)if(c[d]!=null){let u=d.indexOf(" ");u>0?a.setAttributeNS(d.slice(0,u),d.slice(u+1),c[d]):a.setAttribute(d,c[d])}}for(let d=f;df)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:p}=Pt(n,u,t,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var Ei=65535,Di=Math.pow(2,16);function Ol(n,e){return n+e*Di}function Ni(n){return n&Ei}function Nl(n){return(n-(n&Ei))/Di}var Ai=1,Ii=2,$t=4,vi=8,ht=class{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&vi)>0}get deletedBefore(){return(this.delInfo&(Ai|$t))>0}get deletedAfter(){return(this.delInfo&(Ii|$t))>0}get deletedAcross(){return(this.delInfo&$t)>0}},ue=class n{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&n.empty)return n.empty}recover(e){let t=0,r=Ni(e);if(!this.inverted)for(let i=0;ie)break;let c=this.ranges[l+s],f=this.ranges[l+o],d=a+c;if(e<=d){let u=c?e==a?-1:e==d?1:t:t,h=a+i+(u<0?0:f);if(r)return h;let p=e==(t<0?a:d)?null:Ol(l/3,e-a),m=e==a?Ii:e==d?Ai:$t;return(t<0?e!=a:e!=d)&&(m|=vi),new ht(h,m,p)}i+=f-c}return r?e+i:new ht(e+i,0,null)}touches(e,t){let r=0,i=Ni(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;le)break;let c=this.ranges[l+s],f=a+c;if(e<=f&&l==i*3)return!0;r+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i=0;t--){let i=e.getMirror(t);this.appendMap(e.maps[t].invert(),i!=null&&i>t?r-i-1:void 0)}}invert(){let e=new n;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;rs&&a!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return L.fromReplace(e,this.from,this.to,s)}invert(){return new Be(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};z.jsonID("addMark",pt);var Be=class n extends z{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new x(Vn(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return L.fromReplace(e,this.from,this.to,r)}invert(){return new pt(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}merge(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}};z.jsonID("removeMark",Be);var mt=class n extends z{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return L.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return L.fromReplace(e,this.pos,this.pos+1,new x(b.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let i=0;ir.pos?null:new n(t.pos,r.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,x.fromJSON(e,t.slice),t.insert,!!t.structure)}};z.jsonID("replaceAround",R);function Fn(n,e,t){let r=n.resolve(e),i=t-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function Tl(n,e,t,r){let i=[],s=[],o,l;n.doc.nodesBetween(e,t,(a,c,f)=>{if(!a.isInline)return;let d=a.marks;if(!r.isInSet(d)&&f.type.allowsMarkType(r.type)){let u=Math.max(c,e),h=Math.min(c+a.nodeSize,t),p=r.addToSet(d);for(let m=0;mn.step(a)),s.forEach(a=>n.step(a))}function El(n,e,t,r){let i=[],s=0;n.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(r instanceof at){let c=o.marks,f;for(;f=r.isInSet(c);)(a||(a=[])).push(f),c=f.removeFromSet(c)}else r?r.isInSet(o.marks)&&(a=[r]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let f=0;fn.step(new Be(o.from,o.to,o.style)))}function $n(n,e,t,r=t.contentMatch,i=!0){let s=n.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a=0;a--)n.step(o[a])}function Dl(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function he(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),s=n.$from.index(r),o=n.$to.indexAfter(r);if(rt;p--)m||r.index(p)>0?(m=!0,f=b.from(r.node(p).copy(f)),d++):a--;let u=b.empty,h=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)=0;o--){if(r.size){let l=t[o].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=b.from(t[o].type.create(t[o].attrs,r))}let i=e.start,s=e.end;n.step(new R(i,s,i,s,new x(r,0,0),t.length,!0))}function Pl(n,e,t,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,a)&&Bl(n.doc,n.mapping.slice(s).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&Pi(n,o,l,s),$n(n,n.mapping.slice(s).map(l,1),r,void 0,c===null);let f=n.mapping.slice(s),d=f.map(l,1),u=f.map(l+o.nodeSize,1);return n.step(new R(d,u,d+1,u-1,new x(b.from(r.create(a,null,o.marks)),0,0),1,!0)),c===!0&&Ri(n,o,l,s),!1}})}function Ri(n,e,t,r){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=n.mapping.slice(r).map(t+1+s+o.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Pi(n,e,t,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+s);n.replaceWith(o,o+1,e.type.schema.text(` +`))}})}function Bl(n,e,t){let r=n.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,t)}function zl(n,e,t,r,i){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(r,null,i||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new R(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new x(b.from(o),0,0),1,!0))}function Q(n,e,t=1,r){let i=n.resolve(e),s=i.depth-t,o=r&&r[r.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,f=t-2;c>s;c--,f--){let d=i.node(c),u=i.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(u,d.childCount),p=r&&r[f+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[f]||d;if(!d.canReplace(u+1,d.childCount)||!m.type.validContent(h))return!1}let l=i.indexAfter(s),a=r&&r[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Fl(n,e,t=1,r){let i=n.doc.resolve(e),s=b.empty,o=b.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=b.from(i.node(l).copy(s));let f=r&&r[c];o=b.from(f?f.type.create(f.attrs,o):i.node(l).copy(o))}n.step(new j(e,e,new x(s.append(o),t,t),!0))}function ie(n,e){let t=n.resolve(e),r=t.index();return Bi(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Ll(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i0?(s=r.node(i+1),l++,o=r.node(i).maybeChild(l)):(s=r.node(i).maybeChild(l-1),o=r.node(i+1)),s&&!s.isTextblock&&Bi(s,o)&&r.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?r.before(i):r.after(i)}}function Vl(n,e,t){let r=null,{linebreakReplacement:i}=n.doc.type.schema,s=n.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let f=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);f&&!d?r=!1:!f&&d&&(r=!0)}let l=n.steps.length;if(r===!1){let f=n.doc.resolve(e+t);Pi(n,f.node(),f.before(),l)}o.inlineContent&&$n(n,e+t-1,o,s.node().contentMatchAt(s.index()),r==null);let a=n.mapping.slice(l),c=a.map(e-t);if(n.step(new j(c,a.map(e+t,-1),x.empty,!0)),r===!0){let f=n.doc.resolve(c);Ri(n,f.node(),f.before(),n.steps.length)}return n}function $l(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,t))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,t))return r.after(i+1);if(s=0;o--){let l=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,a=r.index(o)+(l>0?1:0),c=r.node(o),f=!1;if(s==1)f=c.canReplace(a,a,i);else{let d=c.contentMatchAt(a).findWrapping(i.firstChild.type);f=d&&c.canReplaceWith(a,a,d[0])}if(f)return l==0?r.pos:l<0?r.before(o+1):r.after(o+1)}return null}function yt(n,e,t=e,r=x.empty){if(e==t&&!r.size)return null;let i=n.resolve(e),s=n.resolve(t);return Fi(i,s,r)?new j(e,t,r):new Ln(i,s,r).fit()}function Fi(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}var Ln=class{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=b.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=b.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new x(s,o,l);return e>-1?new R(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new j(r.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Pn(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],f,d=null;if(t==1&&(o?c.matchType(o.type)||(d=c.fillBefore(b.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:d};if(t==2&&o&&(f=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:f};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pn(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new x(e,t+1,Math.max(r,i.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,i=Pn(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new x(dt(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new x(dt(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m1||a==0||m.content.size)&&(d=g,f.push(Li(m.mark(u.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=ut(this.placed,t,b.from(f)),this.frontier[t].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:i}=this.frontier[t],s=t=0;l--){let{match:a,type:c}=this.frontier[l],f=Bn(e,l,c,a,!0);if(!f||f.childCount)continue e}return{depth:t,fit:o,move:s?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ut(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=ut(this.placed,this.depth,b.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(b.empty,!0);t.childCount&&(this.placed=ut(this.placed,this.frontier.length,t))}};function dt(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(dt(n.firstChild.content,e-1,t)))}function ut(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ut(n.lastChild.content,e-1,t)))}function Pn(n,e){for(let t=0;t1&&(r=r.replaceChild(0,Li(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(b.empty,!0)))),n.copy(r)}function Bn(n,e,t,r,i){let s=n.node(e),o=i?n.indexAfter(e):n.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,o);return l&&!jl(t,s.content,o)?l:null}function jl(n,e,t){for(let r=t;r0;u--,h--){let p=i.node(u).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(u)>-1?l=u:i.before(u)==h&&o.splice(1,0,-u)}let a=o.indexOf(l),c=[],f=r.openStart;for(let u=r.content,h=0;;h++){let p=u.firstChild;if(c.push(p),h==r.openStart)break;u=p.content}for(let u=f-1;u>=0;u--){let h=c[u],p=Wl(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(l)-1)))f=u;else if(p||!h.type.isTextblock)break}for(let u=r.openStart;u>=0;u--){let h=(u+f+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m=0&&(n.replace(e,t,r),!(n.steps.length>d));u--){let h=o[u];h<0||(e=i.before(h),t=s.after(h))}}function Vi(n,e,t,r,i){if(er){let s=i.contentMatchAt(0),o=s.fillBefore(n).append(n);n=o.append(s.matchFragment(o).fillBefore(b.empty,!0))}return n}function ql(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let i=$l(n.doc,e,r.type);i!=null&&(e=t=i)}n.replaceRange(e,t,new x(b.from(r),0,0))}function Kl(n,e,t){let r=n.doc.resolve(e),i=n.doc.resolve(t),s=$i(r,i);for(let o=0;o0&&(a||r.node(l-1).canReplace(r.index(l-1),i.indexAfter(l-1))))return n.delete(r.before(l),i.after(l))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&t>r.end(o)&&i.end(o)-t!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return n.delete(r.before(o),t);n.delete(e,t)}function $i(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let i=r;i>=0;i--){let s=n.start(i);if(se.pos+(e.depth-i)||n.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==n.depth&&i==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}var jt=class n extends z{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return L.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let i=t.type.create(r,null,t.marks);return L.fromReplace(e,this.pos,this.pos+1,new x(b.from(i),0,t.isLeaf?0:1))}getMap(){return ue.empty}invert(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}};z.jsonID("attr",jt);var Wt=class n extends z{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return L.ok(r)}getMap(){return ue.empty}invert(e){return new n(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}};z.jsonID("docAttr",Wt);var Ue=class extends Error{};Ue=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ue.prototype=Object.create(Error.prototype);Ue.prototype.constructor=Ue;Ue.prototype.name="TransformError";var _e=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new zn}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ue(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=x.empty){let i=yt(this.doc,e,t,r);return i&&this.step(i),this}replaceWith(e,t,r){return this.replace(e,t,new x(b.from(r),0,0))}delete(e,t){return this.replace(e,t,x.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return Jl(this,e,t,r),this}replaceRangeWith(e,t,r){return ql(this,e,t,r),this}deleteRange(e,t){return Kl(this,e,t),this}lift(e,t){return Al(this,e,t),this}join(e,t=1){return Vl(this,e,t),this}wrap(e,t){return Rl(this,e,t),this}setBlockType(e,t=e,r,i=null){return Pl(this,e,t,r,i),this}setNodeMarkup(e,t,r=null,i){return zl(this,e,t,r,i),this}setNodeAttribute(e,t,r){return this.step(new jt(e,t,r)),this}setDocAttribute(e,t){return this.step(new Wt(e,t)),this}addNodeMark(e,t){return this.step(new mt(e,t)),this}removeNodeMark(e,t){if(!(t instanceof D)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new gt(e,t)),this}split(e,t=1,r){return Fl(this,e,t,r),this}addMark(e,t,r){return Tl(this,e,t,r),this}removeMark(e,t,r){return El(this,e,t,r),this}clearIncompatible(e,t,r){return $n(this,e,t,r),this}};var jn=Object.create(null),C=class{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new qt(e.min(t),e.max(t))]}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 e=this.ranges;for(let t=0;t=0;s--){let o=t<0?Xe(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Xe(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new Z(e.node(0))}static atStart(e){return Xe(e,e,0,0,1)||new Z(e)}static atEnd(e){return Xe(e,e,e.content.size,e.childCount,-1)||new Z(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=jn[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in jn)throw new RangeError("Duplicate use of selection JSON ID "+e);return jn[e]=t,t.prototype.jsonID=e,t}getBookmark(){return T.between(this.$anchor,this.$head).getBookmark()}};C.prototype.visible=!0;var qt=class{constructor(e,t){this.$from=e,this.$to=t}},ji=!1;function Wi(n){!ji&&!n.parent.inlineContent&&(ji=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}var T=class n extends C{constructor(e,t=e){Wi(e),Wi(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return C.near(r);let i=e.resolve(t.map(this.anchor));return new n(i.parent.inlineContent?i:r,r)}replace(e,t=x.empty){if(super.replace(e,t),t==x.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Kt(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let i=e.resolve(t);return new this(i,r==t?i:e.resolve(r))}static between(e,t,r){let i=e.pos-t.pos;if((!r||i)&&(r=i>=0?1:-1),!t.parent.inlineContent){let s=C.findFrom(t,r,!0)||C.findFrom(t,-r,!0);if(s)t=s.$head;else return C.near(t,r)}return e.parent.inlineContent||(i==0?e=t:(e=(C.findFrom(e,-r,!0)||C.findFrom(e,r,!0)).$anchor,e.pos0?0:1);i>0?o=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&M.isSelectable(l))return M.create(n,t-(i<0?l.nodeSize:0))}else{let a=Xe(n,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Ji(n,e,t){let r=n.steps.length-1;if(r{o==null&&(o=f)}),n.setSelection(C.near(n.doc.resolve(o),t))}var qi=1,Jt=2,Ki=4,qn=class extends _e{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Jt,this}ensureMarks(e){return D.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Jt)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Jt,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||D.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let i=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(t);s=r==t?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,i.text(e,s)),this.selection.empty||this.setSelection(C.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Ki,this}get scrolledIntoView(){return(this.updated&Ki)>0}};function Hi(n,e){return!e||!n?n:n.bind(e)}var ze=class{constructor(e,t,r){this.name=e,this.init=Hi(t.init,r),this.apply=Hi(t.apply,r)}},Ul=[new ze("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ze("selection",{init(n,e){return n.selection||C.atStart(e.doc)},apply(n){return n.selection}}),new ze("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new ze("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})],bt=class{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Ul.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new ze(r.key,r.spec.state,r))})}},Ht=class n{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(i,this[i.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new bt(e.schema,e.plugins),s=new n(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=G.fromJSON(e.schema,t.doc);else if(o.name=="selection")s.selection=C.fromJSON(s.doc,t.selection);else if(o.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[o.name]=c.fromJSON.call(a,e,t[l],s);return}}s[o.name]=o.init(e,s)}}),s}};function Ui(n,e,t){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=Ui(i,e,{})),t[r]=i}return t}var Y=class{constructor(e){this.spec=e,this.props={},e.props&&Ui(e.props,this,this.props),this.key=e.key?e.key.key:_i("plugin")}getState(e){return e[this.key]}},Wn=Object.create(null);function _i(n){return n in Wn?n+"$"+ ++Wn[n]:(Wn[n]=0,n+"$")}var le=class{constructor(e="key"){this.key=_i(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var V=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Mt=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e},Yn=null,me=function(n,e,t){let r=Yn||(Yn=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},_l=function(){Yn=null},Je=function(n,e,t,r){return t&&(Gi(n,e,t,r,-1)||Gi(n,e,t,r,1))},Gl=/^(img|br|input|textarea|hr)$/i;function Gi(n,e,t,r,i){for(;;){if(n==t&&e==r)return!0;if(e==(i<0?0:te(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Nt(n)||Gl.test(n.nodeName)||n.contentEditable=="false")return!1;e=V(n)+(i<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(i<0?-1:0)],n.contentEditable=="false")return!1;e=i<0?te(n):0}else return!1}}function te(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Yl(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=te(n)}else if(n.parentNode&&!Nt(n))e=V(n),n=n.parentNode;else return null}}function Xl(n,e){for(;;){if(n.nodeType==3&&e2),ee=nt||(ae?/Mac/.test(ae.platform):!1),ta=ae?/Win/.test(ae.platform):!1,ge=/Android \d/.test(Te),Tt=!!Yi&&"webkitFontSmoothing"in Yi.documentElement.style,na=Tt?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function ra(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function pe(n,e){return typeof n=="number"?n:n[e]}function ia(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Xi(n,e,t){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let o=t||n.dom;o;o=Mt(o)){if(o.nodeType!=1)continue;let l=o,a=l==s.body,c=a?ra(s):ia(l),f=0,d=0;if(e.topc.bottom-pe(r,"bottom")&&(d=e.bottom-e.top>c.bottom-c.top?e.top+pe(i,"top")-c.top:e.bottom-c.bottom+pe(i,"bottom")),e.leftc.right-pe(r,"right")&&(f=e.right-c.right+pe(i,"right")),f||d)if(a)s.defaultView.scrollBy(f,d);else{let u=l.scrollLeft,h=l.scrollTop;d&&(l.scrollTop+=d),f&&(l.scrollLeft+=f);let p=l.scrollLeft-u,m=l.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function sa(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=t+1;o=t-20){r=l,i=a.top;break}}return{refDOM:r,refTop:i,stack:Is(n.dom)}}function Is(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Mt(r));return e}function oa({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;vs(t,r==0?0:r-e)}function vs(n,e){for(let t=0;t=l){o=Math.max(p.bottom,o),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=f,c={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!t&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!t&&a&&(t=a,i=c,r=0),t&&t.nodeType==3?aa(t,i):!t||r&&t.nodeType==1?{node:n,offset:s}:Rs(t,i)}function aa(n,e){let t=n.nodeValue.length,r=document.createRange();for(let i=0;i=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function pr(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function ca(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left(o.left+o.right)/2?1:-1}return n.docView.posFromDOM(r,i,s)}function da(n,e,t,r){let i=-1;for(let s=e,o=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&(!o&&a.left>r.left||a.top>r.top?i=l.posBefore:(!o&&a.right-1?i:n.docView.posFromDOM(e,t,-1)}function Ps(n,e,t){let r=n.childNodes.length;if(r&&t.tope.top&&i++}let c;Tt&&i&&r.nodeType==1&&(c=r.childNodes[i-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&i--,r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(l=da(n,r,i,e))}l==null&&(l=fa(n,o,e));let a=n.docView.nearestDesc(o,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Zi(n){return n.top=0&&i==r.nodeValue.length?(a--,f=1):t<0?a--:c++,kt(Se(me(r,a,c),f),f<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(t<0||i==te(r))){let a=r.childNodes[i-1];if(a.nodeType==1)return Kn(a.getBoundingClientRect(),!1)}if(s==null&&i=0)}if(s==null&&i&&(t<0||i==te(r))){let a=r.childNodes[i-1],c=a.nodeType==3?me(a,te(a)-(o?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return kt(Se(c,1),!1)}if(s==null&&i=0)}function kt(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Kn(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function zs(n,e,t){let r=n.state,i=n.root.activeElement;r!=e&&n.updateState(e),i!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function pa(n,e,t){let r=e.selection,i=t=="up"?r.$from:r.$to;return zs(n,e,()=>{let{node:s}=n.docView.domFromPos(i.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let o=Bs(n,i.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=me(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;cf.top+1&&(t=="up"?o.top-f.top>(f.bottom-o.top)*2:f.bottom-o.bottom>(o.bottom-f.top)*2))return!1}}return!0})}var ma=/[\u0590-\u08ac]/;function ga(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,l=n.domSelection();return l?!ma.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:o:zs(n,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:f,anchorOffset:d}=n.domSelectionRange(),u=l.caretBidiLevel;l.modify("move",t,"character");let h=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:m}=n.domSelectionRange(),g=p&&!h.contains(p.nodeType==1?p:p.parentNode)||a==p&&c==m;try{l.collapse(f,d),a&&(a!=f||c!=d)&&l.extend&&l.extend(a,c)}catch{}return u!=null&&(l.caretBidiLevel=u),g}):r.pos==r.start()||r.pos==r.end()}var Qi=null,es=null,ts=!1;function ya(n,e,t){return Qi==e&&es==t?ts:(Qi=e,es=t,ts=t=="up"||t=="down"?pa(n,e,t):ga(n,e,t))}var ne=0,ns=1,Le=2,ce=3,qe=class{constructor(e,t,r,i){this.parent=e,this.children=t,this.dom=r,this.contentDOM=i,this.dirty=ne,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;tV(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!t||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;te||o instanceof Gt){i=e-s;break}s=l}if(i)return this.children[r].domFromPos(i-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Ut&&s.side>=0;r--);if(t<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&t&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?V(s.dom)+1:0}}else{let s,o=!0;for(;s=r=f&&t<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,f);e=o;for(let d=l;d>0;d--){let u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){i=V(u.dom)+1;break}e-=u.size}i==-1&&(i=0)}if(i>-1&&(c>t||l==this.children.length-1)){t=c;for(let f=l+1;fp&&ot){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,i=0;i=r:er){let l=r+s.border,a=o-s.border;if(e>=l&&t<=a){this.dirty=e==r||t==o?Le:ns,e==l&&t==a&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=ce:s.markDirty(e-l,t-l);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Le:ce}r=o}this.dirty=Le}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Le:ns;t.dirty{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!t.type.spec.raw){if(o.nodeType!=1){let l=document.createElement("span");l.appendChild(o),o=l}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,s=this}matchesWidget(e){return this.dirty==ne&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},er=class extends qe{constructor(e,t,r,i){super(e,[],t,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},rt=class n extends qe{constructor(e,t,r,i,s){super(e,[],r,i),this.mark=t,this.spec=s}static create(e,t,r,i){let s=i.nodeViews[t.type.name],o=s&&s(t,i,r);return(!o||!o.dom)&&(o=de.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&ce||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=ce&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=ne){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(s=ir(s,0,e,r));for(let l=0;l{if(!a)return o;if(a.parent)return a.parent.posBeforeChild(a)},r,i),f=c&&c.dom,d=c&&c.contentDOM;if(t.isText){if(!f)f=document.createTextNode(t.text);else if(f.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else f||({dom:f,contentDOM:d}=de.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!d&&!t.isText&&f.nodeName!="BR"&&(f.hasAttribute("contenteditable")||(f.contentEditable="false"),t.type.spec.draggable&&(f.draggable=!0));let u=f;return f=Vs(f,r,t),c?a=new tr(e,t,r,i,f,d||null,u,c,s,o+1):t.isText?new _t(e,t,r,i,f,u,s):new n(e,t,r,i,f,d||null,u,s,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>b.empty)}return e}matchesNode(e,t,r){return this.dirty==ne&&e.eq(this.node)&&Yt(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,i=t,s=e.composing?this.localCompositionInfo(e,t):null,o=s&&s.pos>-1?s:null,l=s&&s.pos<0,a=new rr(this,o&&o.node,e);Sa(this.node,this.innerDeco,(c,f,d)=>{c.spec.marks?a.syncToMarks(c.spec.marks,r,e):c.type.side>=0&&!d&&a.syncToMarks(f==this.node.childCount?D.none:this.node.child(f).marks,r,e),a.placeWidget(c,e,i)},(c,f,d,u)=>{a.syncToMarks(c.marks,r,e);let h;a.findNodeMatch(c,f,d,u)||l&&e.state.selection.from>i&&e.state.selection.to-1&&a.updateNodeAt(c,f,d,h,e)||a.updateNextNode(c,f,d,e,u,i)||a.addNode(c,f,d,e,i),i+=c.nodeSize}),a.syncToMarks([],r,e),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Le)&&(o&&this.protectLocalComposition(e,o),Fs(this.contentDOM,this.children,e),nt&&Ma(this.dom))}localCompositionInfo(e,t){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof T)||rt+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,l=wa(this.node.content,o,r-t,i-t);return l<0?null:{node:s,pos:l,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:i}){if(this.getDesc(t))return;let s=t;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new er(this,s,t,i);e.input.compositionNodes.push(o),this.children=ir(this.children,r,r+i.length,e,o)}update(e,t,r,i){return this.dirty==ce||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,i),!0)}updateInner(e,t,r,i){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=ne}updateOuterDeco(e){if(Yt(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Ls(this.dom,this.nodeDOM,nr(this.outerDeco,this.node,t),nr(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function rs(n,e,t,r,i){Vs(r,e,n);let s=new Oe(void 0,n,e,t,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}var _t=class n extends Oe{constructor(e,t,r,i,s,o,l){super(e,t,r,i,s,null,o,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,i){return this.dirty==ce||this.dirty!=ne&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=ne||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=ne,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let i=this.node.cut(e,t),s=document.createTextNode(i.text);return new n(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=ce)}get domAtom(){return!1}isText(e){return this.node.text==e}},Gt=class extends qe{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ne&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},tr=class extends Oe{constructor(e,t,r,i,s,o,l,a,c,f){super(e,t,r,i,s,o,l,c,f),this.spec=a}update(e,t,r,i){if(this.dirty==ce)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,t,r);return s&&this.updateInner(e,t,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,i){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function Fs(n,e,t){let r=n.firstChild,i=!1;for(let s=0;s>1,o=Math.min(s,e.length);for(;i-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let a=rt.create(this.top,e[s],t,r);this.top.children.splice(this.index,0,a),this.top=a,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,r))s=this.top.children.indexOf(o,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l0;){let l;for(;;)if(r){let c=t.children[r-1];if(c instanceof rt)t=c,r=c.children.length;else{l=c,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(i-1))break;--i,s.set(l,i),o.push(l)}}return{index:i,matched:s,matches:o.reverse()}}function xa(n,e){return n.type.side-e.type.side}function Sa(n,e,t,r){let i=e.locals(n),s=0;if(i.length==0){for(let c=0;cs;)l.push(i[o++]);let p=s+u.nodeSize;if(u.isText){let g=p;o!g.inline):l.slice();r(u,m,e.forChild(s,u),h),s=p}}function Ma(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function wa(n,e,t,r){for(let i=0,s=0;i=t){if(s>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l=0&&c+e.length+l>=t)return l+c;if(t==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function ir(n,e,t,r,i){let s=[];for(let o=0,l=0;o=t||f<=e?s.push(a):(ct&&s.push(a.slice(t-c,a.size,r)))}return s}function mr(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let i=n.docView.nearestDesc(t.focusNode),s=i&&i.size==0,o=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(o<0)return null;let l=r.resolve(o),a,c;if(sn(t)){for(a=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&M.isSelectable(d)&&i.parent&&!(d.isInline&&Zl(t.focusNode,t.focusOffset,i.dom))){let u=i.posBefore;c=new M(o==u?l:r.resolve(u))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let d=o,u=o;for(let h=0;h{(t.anchorNode!=r||t.anchorOffset!=i)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!$s(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Oa(n){let e=n.domSelection(),t=document.createRange();if(!e)return;let r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?t.setStart(r.parentNode,V(r)+1):t.setStart(r,0),t.collapse(!0),e.removeAllRanges(),e.addRange(t),!i&&!n.state.selection.visible&&X&&Ce<=11&&(r.disabled=!0,r.disabled=!1)}function js(n,e){if(e instanceof M){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(cs(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else cs(n)}function cs(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function gr(n,e,t,r){return n.someProp("createSelectionBetween",i=>i(n,e,t))||T.between(e,t,r)}function fs(n){return n.editable&&!n.hasFocus()?!1:Ws(n)}function Ws(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Na(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Je(e.node,e.offset,t.anchorNode,t.anchorOffset)}function sr(n,e){let{$anchor:t,$head:r}=n.selection,i=e>0?t.max(r):t.min(r),s=i.parent.inlineContent?i.depth?n.doc.resolve(e>0?i.after():i.before()):null:i;return s&&C.findFrom(s,e)}function Me(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function ds(n,e,t){let r=n.state.selection;if(r instanceof T)if(t.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=n.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Me(n,new T(r.$anchor,o))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let i=sr(n.state,e);return i&&i instanceof M?Me(n,i):!1}else if(!(ee&&t.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let l=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=n.docView.descAt(l))&&!o.contentDOM?M.isSelectable(s)?Me(n,new M(e<0?n.state.doc.resolve(i.pos-s.nodeSize):i)):Tt?Me(n,new T(n.state.doc.resolve(e<0?l:l+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof M&&r.node.isInline)return Me(n,new T(e>0?r.$to:r.$from));{let i=sr(n.state,e);return i?Me(n,i):!1}}}function Xt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function St(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Qe(n,e){return e<0?Ta(n):Ea(n)}function Ta(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i,s,o=!1;for(se&&t.nodeType==1&&r0){if(t.nodeType!=1)break;{let l=t.childNodes[r-1];if(St(l,-1))i=t,s=--r;else if(l.nodeType==3)t=l,r=t.nodeValue.length;else break}}else{if(Js(t))break;{let l=t.previousSibling;for(;l&&St(l,-1);)i=t.parentNode,s=V(l),l=l.previousSibling;if(l)t=l,r=Xt(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}o?or(n,t,r):i&&or(n,i,s)}function Ea(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let i=Xt(t),s,o;for(;;)if(r{n.state==i&&ye(n)},50)}function us(n,e){let t=n.state.doc.resolve(e);if(!(J||ta)&&t.parent.inlineContent){let i=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o1)return s.lefti.top&&o1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function hs(n,e,t){let r=n.state.selection;if(r instanceof T&&!r.empty||t.indexOf("s")>-1||ee&&t.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let o=sr(n.state,e);if(o&&o instanceof M)return Me(n,o)}if(!i.parent.inlineContent){let o=e<0?i:s,l=r instanceof Z?C.near(o,e):C.findFrom(o,e);return l?Me(n,l):!1}return!1}function ps(n,e){if(!(n.state.selection instanceof T))return!0;let{$head:t,$anchor:r,empty:i}=n.state.selection;if(!t.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(s&&!s.isText){let o=n.state.tr;return e<0?o.delete(t.pos-s.nodeSize,t.pos):o.delete(t.pos,t.pos+s.nodeSize),n.dispatch(o),!0}return!1}function ms(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Ia(n){if(!K||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;ms(n,r,"true"),setTimeout(()=>ms(n,r,"false"),20)}return!1}function va(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function Ra(n,e){let t=e.keyCode,r=va(e);if(t==8||ee&&t==72&&r=="c")return ps(n,-1)||Qe(n,-1);if(t==46&&!e.shiftKey||ee&&t==68&&r=="c")return ps(n,1)||Qe(n,1);if(t==13||t==27)return!0;if(t==37||ee&&t==66&&r=="c"){let i=t==37?us(n,n.state.selection.from)=="ltr"?-1:1:-1;return ds(n,i,r)||Qe(n,i)}else if(t==39||ee&&t==70&&r=="c"){let i=t==39?us(n,n.state.selection.from)=="ltr"?1:-1:1;return ds(n,i,r)||Qe(n,i)}else{if(t==38||ee&&t==80&&r=="c")return hs(n,-1,r)||Qe(n,-1);if(t==40||ee&&t==78&&r=="c")return Ia(n)||hs(n,1,r)||Qe(n,1);if(r==(ee?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qs(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=n.someProp("clipboardSerializer")||de.fromSchema(n.state.schema),l=Ys(),a=l.createElement("div");a.appendChild(o.serializeFragment(r,{document:l}));let c=a.firstChild,f,d=0;for(;c&&c.nodeType==1&&(f=Gs[c.nodeName.toLowerCase()]);){for(let h=f.length-1;h>=0;h--){let p=l.createElement(f[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(t)}`);let u=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,` `);return{dom:a,text:u,slice:e}}function Ks(n,e,t,r,i){let s=i.parent.type.spec.code,o,l;if(!t&&!e)return null;let a=e&&(r||s||!t);if(a){if(n.someProp("transformPastedText",u=>{e=u(e,s||r,n)}),s)return e?new x(b.from(n.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0):x.empty;let d=n.someProp("clipboardTextParser",u=>u(e,i,r,n));if(d)l=d;else{let u=i.marks(),{schema:h}=n.state,p=ue.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,u)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Fa(t),Tt&&La(o);let c=o&&o.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let d=+f[3];d>0;d--){let u=o.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;o=u}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||le.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||f),context:i,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!Pa.test(u.parentNode.nodeName)?{ignore:!0}:null}})),f)l=Va(gs(l,+f[1],+f[2]),f[4]);else if(l=x.maxOpen(Ba(l.content,i),!0),l.openStart||l.openEnd){let d=0,u=0;for(let h=l.content.firstChild;d{l=d(l,n)}),l}var Pa=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ba(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Us(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=_s(o[o.length-1],s.length));let f=Hs(l,a);o.push(f),i=i.matchType(f.type),s=a}}),o)return b.from(o)}return n}function Hs(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function Us(n,e,t,r,i){if(i1&&(s=0),i=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function gs(n,e,t){return et})),Un.createHTML(n)):n}function Fa(n){let e=/^(\s*]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ys().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Gs[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=za(n),i)for(let s=0;s=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(r[l+1],i)),s++,o++}return new x(i,s,o)}var H={},U={},$a={touchstart:!0,touchmove:!0},ar=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function ja(n){for(let e in H){let t=H[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Ja(n,r)&&!yr(n,r)&&(n.editable||!(r.type in U))&&t(n,r)},$a[e]?{passive:!0}:void 0)}K&&n.dom.addEventListener("input",()=>null),cr(n)}function we(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Wa(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function cr(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>yr(n,r))})}function yr(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Ja(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function qa(n,e){!yr(n,e)&&H[e.type]&&(n.editable||!(e.type in U))&&H[e.type](n,e)}U.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Zs(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(se&&J&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),nt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Fe(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Ra(n,t)?t.preventDefault():we(n,"key")};U.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};U.keypress=(n,e)=>{let t=e;if(Zs(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ee&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof T)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function on(n){return{left:n.clientX,top:n.clientY}}function Ka(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function br(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function tt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Ha(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&M.isSelectable(r)?(tt(n,new M(t),"pointer"),!0):!1}function Ua(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof M&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(M.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(tt(n,M.create(n.state.doc,i),"pointer"),!0):!1}function _a(n,e,t,r,i){return br(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Ua(n,t):Ha(n,t))}function Ga(n,e,t,r){return br(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Ya(n,e,t,r){return br(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Xa(n,t,r)}function Xa(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(tt(n,T.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)tt(n,T.create(r,l+1,l+1+o.content.size),"pointer");else if(M.isSelectable(o))tt(n,M.create(r,l),"pointer");else continue;return!0}}function kr(n){return Zt(n)}var Xs=ee?"metaKey":"ctrlKey";H.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=kr(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Ka(t,n.input.lastClick)&&!t[Xs]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(on(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new fr(n,o,t,!!r)):(s=="doubleClick"?Ga:Ya)(n,o.pos,o.inside,t)?t.preventDefault():we(n,"pointer"))};var fr=class{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Xs],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let f=e.state.doc.resolve(t.pos);s=f.parent,o=f.depth?f.before():0}let l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof M&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&oe&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),we(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ye(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(on(e))),this.updateAllowDefault(e),this.allowDefault||!t?we(this.view,"pointer"):_a(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||K&&this.mightDrag&&!this.mightDrag.node.isAtom||J&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(tt(this.view,C.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):we(this.view,"pointer")}move(e){this.updateAllowDefault(e),we(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};H.touchstart=n=>{n.input.lastTouch=Date.now(),kr(n),we(n,"pointer")};H.touchmove=n=>{n.input.lastTouch=Date.now(),we(n,"pointer")};H.contextmenu=n=>kr(n);function Zs(n,e){return n.composing?!0:K&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}var Za=se?5e3:-1;U.compositionstart=U.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof T&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Zt(n,!0),n.markCursor=null;else if(Zt(n,!e.selection.empty),oe&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}Qs(n,Za)};U.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Qs(n,20))};function Qs(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Zt(n),e))}function eo(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=ec());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Qa(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Yl(e.focusNode,e.focusOffset),r=Xl(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function ec(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Zt(n,e=!1){if(!(se&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),eo(n),e||n.docView&&n.docView.dirty){let t=mr(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function tc(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}var wt=X&&Ce<15||nt&&na<604;H.copy=U.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=wt?null:t.clipboardData,o=r.content(),{dom:l,text:a}=qs(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):tc(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function nc(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function rc(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Ct(n,r.value,null,i,e):Ct(n,r.textContent,r.innerHTML,i,e)},50)}function Ct(n,e,t,r,i){let s=Ks(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||x.empty)))return!0;if(!s)return!1;let o=nc(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function to(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}U.paste=(n,e)=>{let t=e;if(n.composing&&!se)return;let r=wt?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Ct(n,to(r),r.getData("text/html"),i,t)?t.preventDefault():rc(n,t)};var Qt=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},no=ee?"altKey":"ctrlKey";H.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(on(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof M?i.to-1:i.to))){if(r&&r.mightDrag)o=M.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(o=M.create(n.state.doc,d.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:f}=qs(n,l);(!t.dataTransfer.files.length||!J||As>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(wt?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",wt||t.dataTransfer.setData("text/plain",c),n.dragging=new Qt(f,!t[no],o)};H.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};U.dragover=U.dragenter=(n,e)=>e.preventDefault();U.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(on(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=Ks(n,to(t.dataTransfer),wt?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&!t[no]);if(n.someProp("handleDrop",p=>p(n,t,o||x.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?zi(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let f=c.mapping.map(a),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,u=c.doc;if(d?c.replaceRangeWith(f,f,o.content.firstChild):c.replaceRange(f,f,o),c.doc.eq(u))return;let h=c.doc.resolve(f);if(d&&M.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new M(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,w)=>p=w),c.setSelection(gr(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};H.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&ye(n)},20))};H.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};H.beforeinput=(n,e)=>{if(J&&se&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Fe(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in U)H[n]=U[n];function Ot(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}var en=class n{constructor(e,t){this.toDOM=e,this.spec=t||je,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ne(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ot(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},$e=class n{constructor(e,t){this.attrs=e,this.spec=t||je}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ne(s,o,this)}valid(e,t){return t.from=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;oe){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==W||e.maps.length==0?this:this.mapInner(e,t,0,0,r||je)}mapInner(e,t,r,i,s){let o;for(let l=0;l{let c=a+r,f;if(f=io(t,l,c)){for(i||(i=this.children.slice());sl&&d.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;ls&&a.type instanceof $e){let c=Math.max(s,a.from)-s,f=Math.min(o,a.to)-s;ci.map(e,t,je));return n.from(r)}forChild(e,t){if(t.isLeaf)return re.empty;let r=[];for(let i=0;it instanceof re)?e:e.reduce((t,r)=>t.concat(r instanceof re?r:r.members),[]))}}forEachSet(e){for(let t=0;t{let g=m-p-(h-u);for(let y=0;yw+f-d)continue;let O=l[y]+f-d;h>=O?l[y+1]=u<=O?-2:-1:u>=f&&g&&(l[y]+=g,l[y+1]+=g)}d+=g}),f=t.maps[c].map(f,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let u=t.map(n[c+1]+s,-1),h=u-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let y=l[c+2].mapInner(t,g,f+1,n[c]+s+1,o);y!=W?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=sc(l,n,e,t,i,s,o),f=nn(c,r,0,o);e=f.local;for(let d=0;dt&&o.to{let c=io(n,l,a+t);if(c){s=!0;let f=nn(c,l,t+a+1,r);f!=W&&i.push(a,a+l.nodeSize,f)}});let o=ro(s?so(n):n,-t).sort(We);for(let l=0;l0;)e++;n.splice(e,0,t)}function _n(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=W&&e.push(r)}),n.cursorWrapper&&e.push(re.create(n.state.doc,[n.cursorWrapper.deco])),tn.from(e)}var oc={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lc=X&&Ce<=11,ur=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},hr=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ur,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),lc&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,oc)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(fs(this.view)){if(this.suppressingSelectionUpdates)return ye(this.view);if(X&&Ce<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Je(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Mt(s))t.add(s);for(let s=e.anchorNode;s;s=Mt(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&fs(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let f=0;fd.nodeName=="BR");if(f.length==2){let[d,u]=f;d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let u of f){let h=u.parentNode;h&&h.nodeName=="LI"&&(!d||fc(e,d)!=h)&&u.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),ac(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ye(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fi;g--){let y=r.childNodes[g-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){s=g;break}if(!w||w.size)break}let d=n.state.doc,u=n.someProp("domParser")||le.fromSchema(n.state.schema),h=d.resolve(o),p=null,m=u.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:uc,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:l}}function uc(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(K&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||K&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}var hc=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function pc(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,xe=mr(n,E);if(xe&&!n.state.selection.eq(xe)){if(J&&se&&n.input.lastKeyCode===13&&Date.now()-100nl(n,Fe(13,"Enter"))))return;let It=n.state.tr.setSelection(xe);E=="pointer"?It.setMeta("pointer",!0):E=="key"&&It.scrollIntoView(),s&&It.setMeta("composition",s),n.dispatch(It)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=dc(n,e,t),f=n.state.doc,d=f.slice(c.from,c.to),u,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||se)&&i.some(E=>E.nodeType==1&&!hc.test(E.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",E=>E(n,Fe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof T&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let E=Ms(n,n.state.doc,c.sel);if(E&&!E.eq(n.state.selection)){let xe=n.state.tr.setSelection(E);s&&xe.setMeta("composition",s),n.dispatch(xe)}}return}n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),X&&Ce<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" \xA0"&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=f.resolve(p.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,O;if((nt&&n.input.lastIOSEnter>Date.now()-225&&(!w||i.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!w&&m.posE(n,Fe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&gc(f,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",E=>E(n,Fe(8,"Backspace")))){se&&J&&n.domObserver.suppressSelectionUpdates();return}J&&se&&p.endB==p.start&&(n.input.lastAndroidDelete=Date.now()),se&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,Fe(13,"Enter"))})},20));let A=p.start,I=p.endA,v,_,q;if(w){if(m.pos==g.pos)X&&Ce<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>ye(n),20)),v=n.state.tr.delete(A,I),_=f.resolve(p.start).marksAcross(f.resolve(p.endA));else if(p.endA==p.endB&&(q=mc(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))v=n.state.tr,q.type=="add"?v.addMark(A,I,q.mark):v.removeMark(A,I,q.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",xe=>xe(n,A,I,E)))return;v=n.state.tr.insertText(E,A,I)}}if(v||(v=n.state.tr.replace(A,I,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let E=Ms(n,v.doc,c.sel);E&&!(J&&se&&n.composing&&E.empty&&(p.start!=p.endB||n.input.lastAndroidDeletee.content.size?null:gr(n,e.resolve(t.anchor),e.resolve(t.head))}function mc(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let f=0;ff.mark(l.addToSet(f.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=f=>f.mark(l.removeFromSet(f.marks));else return null;let c=[];for(let f=0;ft||Gn(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function yc(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o=o?s-r:0;s-=a,s&&s=l?s-r:0;s-=a,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}var rn=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ar,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Es),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ns(this),Os(this),this.nodeViews=Ts(this),this.docView=rs(this.state.doc,Cs(this),_n(this),this.dom,this),this.domObserver=new hr(this,(r,i,s,o)=>pc(this,r,i,s,o)),this.domObserver.start(),ja(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&cr(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Es),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(eo(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ts(this);kc(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&cr(this),this.editable=Ns(this),Os(this);let a=_n(this),c=Cs(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(o=!0);let u=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&sa(this);if(o){this.domObserver.stop();let h=d&&(X||J)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&bc(i.selection,e.selection);if(d){let p=J?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Qa(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=rs(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Na(this))?ye(this,h):(js(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():u&&oa(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof M){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Xi(this,t.getBoundingClientRect(),e)}else Xi(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Qt(e.slice,e.move,i<0?void 0:M.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ua(this,e)}coordsAtPos(e,t=1){return Bs(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return ya(this,t||this.state,e)}pasteHTML(e,t){return Ct(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ct(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Wa(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],_n(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_l())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return qa(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?K&&this.root.nodeType===11&&Ql(this.dom.ownerDocument)==this.dom&&cc(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function Cs(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ne.node(0,n.state.doc.content.size,e)]}function Os(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ne.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Ns(n){return!n.someProp("editable",e=>e(n.state)===!1)}function bc(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ts(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function kc(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Es(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var be={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},an={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xc=typeof navigator<"u"&&/Mac/.test(navigator.platform),Sc=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(P=0;P<10;P++)be[48+P]=be[96+P]=String(P);var P;for(P=1;P<=24;P++)be[P+111]="F"+P;var P;for(P=65;P<=90;P++)be[P]=String.fromCharCode(P+32),an[P]=String.fromCharCode(P);var P;for(ln in be)an.hasOwnProperty(ln)||(an[ln]=be[ln]);var ln;function oo(n){var e=xc&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Sc&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?an:be)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var Mc=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function wc(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l127)&&(s=be[r.keyCode])&&s!=i){let l=e[Sr(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var cn=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function co(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}var wr=(n,e,t)=>{let r=co(n,t);if(!r)return!1;let i=Or(r);if(!i){let o=r.blockRange(),l=o&&pe(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(ko(n,i,e,-1))return!0;if(r.parent.content.size==0&&(it(s,"end")||M.isSelectable(s)))for(let o=r.depth;;o--){let l=yt(n.doc,r.before(o),r.after(o),x.empty);if(l&&l.slice.size1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},fo=(n,e,t)=>{let r=co(n,t);if(!r)return!1;let i=Or(r);return i?ho(n,i,e):!1},uo=(n,e,t)=>{let r=po(n,t);if(!r)return!1;let i=Er(r);return i?ho(n,i,e):!1};function ho(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=yt(n.doc,s,a,x.empty);if(!c||c.from!=s||c instanceof j&&c.slice.size>=a-s)return!1;if(t){let f=n.tr.step(c);f.setSelection(T.create(f.doc,s)),t(f.scrollIntoView())}return!0}function it(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}var Cr=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Or(r)}let o=s&&s.nodeBefore;return!o||!M.isSelectable(o)?!1:(e&&e(n.tr.setSelection(M.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Or(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function po(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=po(n,t);if(!r)return!1;let i=Er(r);if(!i)return!1;let s=i.nodeAfter;if(ko(n,i,e,1))return!0;if(r.parent.content.size==0&&(it(s,"start")||M.isSelectable(s))){let o=yt(n.doc,r.before(),r.after(),x.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof M,i;if(r){if(t.node.isTextblock||!ie(n.doc,t.from))return!1;i=t.from}else if(i=Ye(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(M.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},go=(n,e)=>{let t=n.selection,r;if(t instanceof M){if(t.node.isTextblock||!ie(n.doc,t.to))return!1;r=t.to}else if(r=Ye(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},yo=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&pe(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},Dr=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` -`).scrollIntoView()),!0)};function Ar(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Ar(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(C.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},vr=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Z||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Ar(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Q(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&pe(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Nc(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof M&&e.selection.node.isBlock)return!r.parentOffset||!Q(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Ar(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let m=n&&n(i.parent,a,r);s.unshift(m||(a&&l?{type:l}:null)),o=h;break}else{if(h==1)return!1;s.unshift(null)}let f=e.tr;(e.selection instanceof T||e.selection instanceof Z)&&f.deleteSelection();let d=f.mapping.map(r.pos),u=Q(f.doc,d,s.length,s);if(u||(s[0]=l?{type:l}:null,u=Q(f.doc,d,s.length,s)),f.split(d,s.length,s),!a&&c&&r.node(o).type!=l){let h=f.mapping.map(r.before(o)),p=f.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&f.setNodeMarkup(f.mapping.map(r.before(o)),l)}return t&&t(f.scrollIntoView()),!0}}var Tc=Nc();var bo=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(M.create(n.doc,i))),!0)},Ec=(n,e)=>(e&&e(n.tr.setSelection(new Z(n.doc))),!0);function Dc(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||ie(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ko(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Dc(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,p=b.empty;for(let y=o.length-1;y>=0;y--)p=b.from(o[y].create(null,p));p=b.from(i.copy(p));let m=n.tr.step(new R(e.pos-1,h,e.pos,h,new x(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&ie(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let f=s.type.spec.isolating||r>0&&a?null:C.findFrom(e,1),d=f&&f.$from.blockRange(f.$to),u=d&&pe(d);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(d,u).scrollIntoView()),!0;if(c&&it(s,"start",!0)&&it(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let y=b.empty;for(let O=p.length-1;O>=0;O--)y=b.from(p[O].copy(y));let w=n.tr.step(new R(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new x(y,p.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function xo(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(T.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}var Pr=xo(-1),Br=xo(1);function So(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&Ge(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function zr(n,e=null){return function(t,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let f=t.doc.resolve(c),d=f.index();i=f.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new Re(a,a,e.depth),e.endIndex=0;f--)s=b.from(t[f].type.create(t[f].attrs,s));n.step(new R(e.start-(r?2:0),e.end,e.start,e.end,new x(s,0,0),t.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Rc(e,t,n,s):Pc(e,t,s):!0:!1}}function Rc(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sm;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),f=s.index(-1);if(!c.canReplace(f+(l?0:1),f+1,o.content.append(a?b.empty:b.from(i))))return!1;let d=s.pos,u=d+o.nodeSize;return r.step(new R(d-(l?1:0),u+(a?1:0),d+1,u-1,new x((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Co(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,f=b.from(c?n.create():null),d=new x(b.from(n.create(null,b.from(l.type.create(null,f)))),c?3:1,0),u=s.start,h=s.end;t(e.tr.step(new R(u-(c?3:1),h,u,h,d,1,!0)).scrollIntoView())}return!0}}function gn(n){let{state:e,transaction:t}=n,{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return B(k({},e),{apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}})}var st=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...f)=>{let d=a(...f)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,c=e||s.tr,f=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(u=>u===!0)),d=B(k({},Object.fromEntries(Object.entries(r).map(([u,h])=>[u,(...m)=>{let g=this.buildProps(c,t),y=h(...m)(g);return l.push(y),d}]))),{run:f});return d}createCan(e){let{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i),l=Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...f)=>c(...f)(B(k({},o),{dispatch:void 0}))]));return B(k({},l),{chain:()=>this.createChain(s,i)})}buildProps(e,t=!0){let{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:gn({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...f)=>c(...f)(l)]))}};return l}},jr=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){let r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){let r=(...i)=>{this.off(e,r),t.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function S(n,e,t){return n.config[e]===void 0&&n.parent?S(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind(B(k({},t),{parent:n.parent?S(n.parent,e,t):null})):n.config[e]}function yn(n){let e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function zo(n){let e=[],{nodeExtensions:t,markExtensions:r}=yn(n),i=[...t,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{let l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=S(o,"addGlobalAttributes",l);if(!a)return;a().forEach(f=>{f.types.forEach(d=>{Object.entries(f.attributes).forEach(([u,h])=>{e.push({type:d,name:u,attribute:k(k({},s),h)})})})})}),i.forEach(o=>{let l={name:o.name,options:o.options,storage:o.storage},a=S(o,"addAttributes",l);if(!a)return;let c=a();Object.entries(c).forEach(([f,d])=>{let u=k(k({},s),d);typeof(u==null?void 0:u.default)=="function"&&(u.default=u.default()),u!=null&&u.isRequired&&(u==null?void 0:u.default)===void 0&&delete u.default,e.push({type:o.name,name:f,attribute:u})})}),e}function F(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Bc(...n){return n.filter(e=>!!e).reduce((e,t)=>{let r=k({},e);return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){let l=s?s.split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(f=>!a.includes(f));r[i]=[...a,...c].join(" ")}else if(i==="style"){let l=s?s.split(";").map(f=>f.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(f=>f.trim()).filter(Boolean):[],c=new Map;a.forEach(f=>{let[d,u]=f.split(":").map(h=>h.trim());c.set(d,u)}),l.forEach(f=>{let[d,u]=f.split(":").map(h=>h.trim());c.set(d,u)}),r[i]=Array.from(c.entries()).map(([f,d])=>`${f}: ${d}`).join("; ")}else r[i]=s}),r},{})}function Wr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Bc(t,r),{})}function Fo(n){return typeof n=="function"}function N(n,e=void 0,...t){return Fo(n)?e?n.bind(e)(...t):n(...t):n}function zc(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Fc(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Oo(n,e){return"style"in n?n:B(k({},n),{getAttrs:t=>{let r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;let i=e.reduce((s,o)=>{let l=o.attribute.parseHTML?o.attribute.parseHTML(t):Fc(t.getAttribute(o.name));return l==null?s:B(k({},s),{[o.name]:l})},{});return k(k({},r),i)}})}function No(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&zc(t)?!1:t!=null))}function Lo(n,e){var t;let r=zo(n),{nodeExtensions:i,markExtensions:s}=yn(n),o=(t=i.find(c=>S(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{let f=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},u=n.reduce((y,w)=>{let O=S(w,"extendNodeSchema",d);return k(k({},y),O?O(c):{})},{}),h=No(B(k({},u),{content:N(S(c,"content",d)),marks:N(S(c,"marks",d)),group:N(S(c,"group",d)),inline:N(S(c,"inline",d)),atom:N(S(c,"atom",d)),selectable:N(S(c,"selectable",d)),draggable:N(S(c,"draggable",d)),code:N(S(c,"code",d)),whitespace:N(S(c,"whitespace",d)),linebreakReplacement:N(S(c,"linebreakReplacement",d)),defining:N(S(c,"defining",d)),isolating:N(S(c,"isolating",d)),attrs:Object.fromEntries(f.map(y=>{var w;return[y.name,{default:(w=y==null?void 0:y.attribute)===null||w===void 0?void 0:w.default}]}))})),p=N(S(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Oo(y,f)));let m=S(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:Wr(y,f)}));let g=S(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(s.map(c=>{let f=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},u=n.reduce((g,y)=>{let w=S(y,"extendMarkSchema",d);return k(k({},g),w?w(c):{})},{}),h=No(B(k({},u),{inclusive:N(S(c,"inclusive",d)),excludes:N(S(c,"excludes",d)),group:N(S(c,"group",d)),spanning:N(S(c,"spanning",d)),code:N(S(c,"code",d)),attrs:Object.fromEntries(f.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))})),p=N(S(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>Oo(g,f)));let m=S(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Wr(g,f)})),[c.name,h]}));return new ct({topNode:o,nodes:l,marks:a})}function Lr(n,e){return e.nodes[n]||e.marks[n]||null}function To(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function bn(n,e){let t=ue.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}var Lc=(n,e=500)=>{let t="",r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;let f=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?f:f.slice(0,Math.max(0,r-s))}),t};function Ur(n){return Object.prototype.toString.call(n)==="[object RegExp]"}var Ke=class{constructor(e){this.find=e.find,this.handler=e.handler}},Vc=(n,e)=>{if(Ur(e))return e.exec(n);let t=e(n);if(!t)return null;let r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function fn(n){var e;let{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(u=>u.type.spec.code))return!1;let f=!1,d=Lc(c)+s;return o.forEach(u=>{if(f)return;let h=Vc(d,u.find);if(!h)return;let p=a.state.tr,m=gn({state:a.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:y,chain:w,can:O}=new st({editor:t,state:m});u.handler({state:m,range:g,match:h,commands:y,chain:w,can:O})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),f=!0)}),f}function $c(n){let{editor:e,rules:t}=n,r=new Y({state:{init(){return null},apply(i,s,o){let l=i.getMeta(r);if(l)return l;let a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:f}=a;typeof f=="string"?f=f:f=bn(b.from(f),o.schema);let{from:d}=a,u=d+f.length;fn({editor:e,from:d,to:u,text:f,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return fn({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:s}=i.state.selection;s&&fn({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;let{$cursor:o}=i.state.selection;return o?fn({editor:e,from:o.pos,to:o.pos,text:` -`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function jc(n){return Object.prototype.toString.call(n).slice(8,-1)}function dn(n){return jc(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function kn(n,e){let t=k({},n);return dn(n)&&dn(e)&&Object.keys(e).forEach(r=>{dn(e[r])&&dn(n[r])?t[r]=kn(n[r],e[r]):t[r]=e[r]}),t}var Jr=class n{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=k(k({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&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=N(S(this,"addOptions",{name:this.name}))),this.storage=N(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(B(k({},this.config),{addOptions:()=>kn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=N(S(t,"addOptions",{name:t.name})),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){let{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){let o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;let a=o.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}};function Wc(n){return typeof n=="number"}var Dt=class{constructor(e){this.find=e.find,this.handler=e.handler}},Jc=(n,e,t)=>{if(Ur(e))return[...n.matchAll(e)];let r=e(n,t);return r?r.map(i=>{let s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function qc(n){let{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:f}=new st({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;let m=Math.max(r,p),g=Math.min(i,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"\uFFFC");Jc(y,s.find,o).forEach(O=>{if(O.index===void 0)return;let A=m+O.index+1,I=A+O[0].length,v={from:t.tr.mapping.map(A),to:t.tr.mapping.map(I)},_=s.handler({state:t,range:v,match:O,commands:a,chain:c,can:f,pasteEvent:o,dropEvent:l});d.push(_)})}),d.every(h=>h!==null)}var Kc=n=>{var e;let t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function Hc(n){let{editor:e,rules:t}=n,r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}let a=({state:f,from:d,to:u,rule:h,pasteEvt:p})=>{let m=f.tr,g=gn({state:f,transaction:m});if(!(!qc({editor:e,state:g,from:Math.max(d-1,0),to:u.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(f=>new Y({view(d){let u=h=>{var p;r=!((p=d.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",u),{destroy(){window.removeEventListener("dragstart",u)}}},props:{handleDOMEvents:{drop:(d,u)=>(s=r===d.dom.parentElement,l=u,!1),paste:(d,u)=>{var h;let p=(h=u.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=u,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,u,h)=>{let p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),w=!!y;if(!m&&!g&&!w)return;if(w){let{text:I}=y;typeof I=="string"?I=I:I=bn(b.from(I),h.schema);let{from:v}=y,_=v+I.length,q=Kc(I);return a({rule:f,state:h,from:v,to:{b:_},pasteEvt:q})}let O=u.doc.content.findDiffStart(h.doc.content),A=u.doc.content.findDiffEnd(h.doc.content);if(!(!Wc(O)||!A||O===A.b))return a({rule:f,state:h,from:O,to:A,pasteEvt:o})}}))}function Uc(n){let e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}var hn=class n{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=n.resolve(e),this.schema=Lo(this.extensions,t),this.setupExtensions()}static resolve(e){let t=n.sort(n.flatten(e)),r=Uc(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{let r={name:t.name,options:t.options,storage:t.storage},i=S(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{let s=S(r,"priority")||100,o=S(i,"priority")||100;return s>o?-1:s{let r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Lr(t.name,this.schema)},i=S(t,"addCommands",r);return i?k(k({},e),i()):e},{})}get plugins(){let{editor:e}=this,t=n.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{let l={name:o.name,options:o.options,storage:o.storage,editor:e,type:Lr(o.name,this.schema)},a=[],c=S(o,"addKeyboardShortcuts",l),f={};if(o.type==="mark"&&S(o,"exitable",l)&&(f.ArrowRight=()=>Jr.handleExit({editor:e,mark:o})),c){let m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));f=k(k({},f),m)}let d=lo(f);a.push(d);let u=S(o,"addInputRules",l);To(o,e.options.enableInputRules)&&u&&r.push(...u());let h=S(o,"addPasteRules",l);To(o,e.options.enablePasteRules)&&h&&i.push(...h());let p=S(o,"addProseMirrorPlugins",l);if(p){let m=p();a.push(...m)}return a}).flat();return[$c({editor:e,rules:r}),...Hc({editor:e,rules:i}),...s]}get attributes(){return zo(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=yn(this.extensions);return Object.fromEntries(t.filter(r=>!!S(r,"addNodeView")).map(r=>{let i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:F(r.name,this.schema)},o=S(r,"addNodeView",s);if(!o)return[];let l=(a,c,f,d,u)=>{let h=Wr(a,i);return o()({node:a,view:c,getPos:f,decorations:d,innerDecorations:u,editor:e,extension:r,HTMLAttributes:h})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Lr(e.name,this.schema)};e.type==="mark"&&(!((t=N(S(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);let i=S(e,"onBeforeCreate",r),s=S(e,"onCreate",r),o=S(e,"onUpdate",r),l=S(e,"onSelectionUpdate",r),a=S(e,"onTransaction",r),c=S(e,"onFocus",r),f=S(e,"onBlur",r),d=S(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),f&&this.editor.on("blur",f),d&&this.editor.on("destroy",d)})}},de=class n{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=k(k({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&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=N(S(this,"addOptions",{name:this.name}))),this.storage=N(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(B(k({},this.config),{addOptions:()=>kn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(k(k({},this.config),e));return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=N(S(t,"addOptions",{name:t.name})),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}};function Vo(n,e,t){let{from:r,to:i}=e,{blockSeparator:s=` +`))),0,0):x.empty;let d=n.someProp("clipboardTextParser",u=>u(e,i,r,n));if(d)l=d;else{let u=i.marks(),{schema:h}=n.state,p=de.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(h.text(m,u)))})}}else n.someProp("transformPastedHTML",d=>{t=d(t,n)}),o=Fa(t),Tt&&La(o);let c=o&&o.querySelector("[data-pm-slice]"),f=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(f&&f[3])for(let d=+f[3];d>0;d--){let u=o.firstChild;for(;u&&u.nodeType!=1;)u=u.nextSibling;if(!u)break;o=u}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||oe.fromSchema(n.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||f),context:i,ruleFromNode(u){return u.nodeName=="BR"&&!u.nextSibling&&u.parentNode&&!Pa.test(u.parentNode.nodeName)?{ignore:!0}:null}})),f)l=Va(gs(l,+f[1],+f[2]),f[4]);else if(l=x.maxOpen(Ba(l.content,i),!0),l.openStart||l.openEnd){let d=0,u=0;for(let h=l.content.firstChild;d{l=d(l,n)}),l}var Pa=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function Ba(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let i=e.node(t).contentMatchAt(e.index(t)),s,o=[];if(n.forEach(l=>{if(!o)return;let a=i.findWrapping(l.type),c;if(!a)return o=null;if(c=o.length&&s.length&&Us(a,s,l,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=_s(o[o.length-1],s.length));let f=Hs(l,a);o.push(f),i=i.matchType(f.type),s=a}}),o)return b.from(o)}return n}function Hs(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,b.from(n));return n}function Us(n,e,t,r,i){if(i1&&(s=0),i=t&&(l=e<0?o.contentMatchAt(0).fillBefore(l,s<=i).append(l):l.append(o.contentMatchAt(o.childCount).fillBefore(b.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,o.copy(l))}function gs(n,e,t){return et})),Un.createHTML(n)):n}function Fa(n){let e=/^(\s*]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=Ys().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Gs[r[1].toLowerCase()])&&(n=i.map(s=>"<"+s+">").join("")+n+i.map(s=>"").reverse().join("")),t.innerHTML=za(n),i)for(let s=0;s=0;l-=2){let a=t.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;i=b.from(a.create(r[l+1],i)),s++,o++}return new x(i,s,o)}var H={},U={},$a={touchstart:!0,touchmove:!0},ar=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function ja(n){for(let e in H){let t=H[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{Ja(n,r)&&!yr(n,r)&&(n.editable||!(r.type in U))&&t(n,r)},$a[e]?{passive:!0}:void 0)}K&&n.dom.addEventListener("input",()=>null),cr(n)}function we(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function Wa(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function cr(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>yr(n,r))})}function yr(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function Ja(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function qa(n,e){!yr(n,e)&&H[e.type]&&(n.editable||!(e.type in U))&&H[e.type](n,e)}U.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Zs(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(ge&&J&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),nt&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Fe(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||Ra(n,t)?t.preventDefault():we(n,"key")};U.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};U.keypress=(n,e)=>{let t=e;if(Zs(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||ee&&t.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof T)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(t.charCode);!/[\r\n]/.test(i)&&!n.someProp("handleTextInput",s=>s(n,r.$from.pos,r.$to.pos,i))&&n.dispatch(n.state.tr.insertText(i).scrollIntoView()),t.preventDefault()}};function on(n){return{left:n.clientX,top:n.clientY}}function Ka(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function br(n,e,t,r,i){if(r==-1)return!1;let s=n.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(n.someProp(e,l=>o>s.depth?l(n,t,s.nodeAfter,s.before(o),i,!0):l(n,t,s.node(o),s.before(o),i,!1)))return!0;return!1}function tt(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);t=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Ha(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&M.isSelectable(r)?(tt(n,new M(t),"pointer"),!0):!1}function Ua(n,e){if(e==-1)return!1;let t=n.state.selection,r,i;t instanceof M&&(r=t.node);let s=n.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let l=o>s.depth?s.nodeAfter:s.node(o);if(M.isSelectable(l)){r&&t.$from.depth>0&&o>=t.$from.depth&&s.before(t.$from.depth+1)==t.$from.pos?i=s.before(t.$from.depth):i=s.before(o);break}}return i!=null?(tt(n,M.create(n.state.doc,i),"pointer"),!0):!1}function _a(n,e,t,r,i){return br(n,"handleClickOn",e,t,r)||n.someProp("handleClick",s=>s(n,e,r))||(i?Ua(n,t):Ha(n,t))}function Ga(n,e,t,r){return br(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",i=>i(n,e,r))}function Ya(n,e,t,r){return br(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",i=>i(n,e,r))||Xa(n,t,r)}function Xa(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(tt(n,T.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),l=i.before(s);if(o.inlineContent)tt(n,T.create(r,l+1,l+1+o.content.size),"pointer");else if(M.isSelectable(o))tt(n,M.create(r,l),"pointer");else continue;return!0}}function kr(n){return Zt(n)}var Xs=ee?"metaKey":"ctrlKey";H.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=kr(n),i=Date.now(),s="singleClick";i-n.input.lastClick.time<500&&Ka(t,n.input.lastClick)&&!t[Xs]&&(n.input.lastClick.type=="singleClick"?s="doubleClick":n.input.lastClick.type=="doubleClick"&&(s="tripleClick")),n.input.lastClick={time:i,x:t.clientX,y:t.clientY,type:s};let o=n.posAtCoords(on(t));o&&(s=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new fr(n,o,t,!!r)):(s=="doubleClick"?Ga:Ya)(n,o.pos,o.inside,t)?t.preventDefault():we(n,"pointer"))};var fr=class{constructor(e,t,r,i){this.view=e,this.pos=t,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Xs],this.allowDefault=r.shiftKey;let s,o;if(t.inside>-1)s=e.state.doc.nodeAt(t.inside),o=t.inside;else{let f=e.state.doc.resolve(t.pos);s=f.parent,o=f.depth?f.before():0}let l=i?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.dom.nodeType==1?a.dom:null;let{selection:c}=e.state;(r.button==0&&s.type.spec.draggable&&s.type.spec.selectable!==!1||c instanceof M&&c.from<=o&&c.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&se&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),we(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>ye(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(on(e))),this.updateAllowDefault(e),this.allowDefault||!t?we(this.view,"pointer"):_a(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||K&&this.mightDrag&&!this.mightDrag.node.isAtom||J&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(tt(this.view,C.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):we(this.view,"pointer")}move(e){this.updateAllowDefault(e),we(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};H.touchstart=n=>{n.input.lastTouch=Date.now(),kr(n),we(n,"pointer")};H.touchmove=n=>{n.input.lastTouch=Date.now(),we(n,"pointer")};H.contextmenu=n=>kr(n);function Zs(n,e){return n.composing?!0:K&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}var Za=ge?5e3:-1;U.compositionstart=U.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof T&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),Zt(n,!0),n.markCursor=null;else if(Zt(n,!e.selection.empty),se&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let l=n.domSelection();l&&l.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}n.input.composing=!0}Qs(n,Za)};U.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,Qs(n,20))};function Qs(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Zt(n),e))}function eo(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=ec());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Qa(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=Yl(e.focusNode,e.focusOffset),r=Xl(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let i=r.pmViewDesc,s=n.domObserver.lastChangedTextNode;if(t==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let o=t.pmViewDesc;if(!(!o||!o.isText(t.nodeValue)))return r}}return t||r}function ec(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Zt(n,e=!1){if(!(ge&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),eo(n),e||n.docView&&n.docView.dirty){let t=mr(n);return t&&!t.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!n.state.selection.empty?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function tc(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}var wt=X&&Ce<15||nt&&na<604;H.copy=U.cut=(n,e)=>{let t=e,r=n.state.selection,i=t.type=="cut";if(r.empty)return;let s=wt?null:t.clipboardData,o=r.content(),{dom:l,text:a}=qs(n,o);s?(t.preventDefault(),s.clearData(),s.setData("text/html",l.innerHTML),s.setData("text/plain",a)):tc(n,l),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function nc(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function rc(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Ct(n,r.value,null,i,e):Ct(n,r.textContent,r.innerHTML,i,e)},50)}function Ct(n,e,t,r,i){let s=Ks(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,i,s||x.empty)))return!0;if(!s)return!1;let o=nc(s),l=o?n.state.tr.replaceSelectionWith(o,r):n.state.tr.replaceSelection(s);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function to(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}U.paste=(n,e)=>{let t=e;if(n.composing&&!ge)return;let r=wt?null:t.clipboardData,i=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Ct(n,to(r),r.getData("text/html"),i,t)?t.preventDefault():rc(n,t)};var Qt=class{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}},no=ee?"altKey":"ctrlKey";H.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=n.state.selection,s=i.empty?null:n.posAtCoords(on(t)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof M?i.to-1:i.to))){if(r&&r.mightDrag)o=M.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let d=n.docView.nearestDesc(t.target,!0);d&&d.node.type.spec.draggable&&d!=n.docView&&(o=M.create(n.state.doc,d.posBefore))}}let l=(o||n.state.selection).content(),{dom:a,text:c,slice:f}=qs(n,l);(!t.dataTransfer.files.length||!J||As>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(wt?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",wt||t.dataTransfer.setData("text/plain",c),n.dragging=new Qt(f,!t[no],o)};H.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};U.dragover=U.dragenter=(n,e)=>e.preventDefault();U.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let i=n.posAtCoords(on(t));if(!i)return;let s=n.state.doc.resolve(i.pos),o=r&&r.slice;o?n.someProp("transformPasted",p=>{o=p(o,n)}):o=Ks(n,to(t.dataTransfer),wt?null:t.dataTransfer.getData("text/html"),!1,s);let l=!!(r&&!t[no]);if(n.someProp("handleDrop",p=>p(n,t,o||x.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let a=o?zi(n.state.doc,s.pos,o):s.pos;a==null&&(a=s.pos);let c=n.state.tr;if(l){let{node:p}=r;p?p.replace(c):c.deleteSelection()}let f=c.mapping.map(a),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,u=c.doc;if(d?c.replaceRangeWith(f,f,o.content.firstChild):c.replaceRange(f,f,o),c.doc.eq(u))return;let h=c.doc.resolve(f);if(d&&M.isSelectable(o.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new M(h));else{let p=c.mapping.map(a);c.mapping.maps[c.mapping.maps.length-1].forEach((m,g,y,w)=>p=w),c.setSelection(gr(n,h,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};H.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&ye(n)},20))};H.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};H.beforeinput=(n,e)=>{if(J&&ge&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Fe(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in U)H[n]=U[n];function Ot(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}var en=class n{constructor(e,t){this.toDOM=e,this.spec=t||je,this.side=this.spec.side||0}map(e,t,r,i){let{pos:s,deleted:o}=e.mapResult(t.from+i,this.side<0?-1:1);return o?null:new Ne(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof n&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Ot(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},$e=class n{constructor(e,t){this.attrs=e,this.spec=t||je}map(e,t,r,i){let s=e.map(t.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(t.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new Ne(s,o,this)}valid(e,t){return t.from=e&&(!s||s(l.spec))&&r.push(l.copy(l.from+i,l.to+i))}for(let o=0;oe){let l=this.children[o]+1;this.children[o+2].findInner(e-l,t-l,r,i+l,s)}}map(e,t,r){return this==W||e.maps.length==0?this:this.mapInner(e,t,0,0,r||je)}mapInner(e,t,r,i,s){let o;for(let l=0;l{let c=a+r,f;if(f=io(t,l,c)){for(i||(i=this.children.slice());sl&&d.to=e){this.children[l]==e&&(r=this.children[l+2]);break}let s=e+1,o=s+t.content.size;for(let l=0;ls&&a.type instanceof $e){let c=Math.max(s,a.from)-s,f=Math.min(o,a.to)-s;ci.map(e,t,je));return n.from(r)}forChild(e,t){if(t.isLeaf)return re.empty;let r=[];for(let i=0;it instanceof re)?e:e.reduce((t,r)=>t.concat(r instanceof re?r:r.members),[]))}}forEachSet(e){for(let t=0;t{let g=m-p-(h-u);for(let y=0;yw+f-d)continue;let O=l[y]+f-d;h>=O?l[y+1]=u<=O?-2:-1:u>=f&&g&&(l[y]+=g,l[y+1]+=g)}d+=g}),f=t.maps[c].map(f,-1)}let a=!1;for(let c=0;c=r.content.size){a=!0;continue}let u=t.map(n[c+1]+s,-1),h=u-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==h){let y=l[c+2].mapInner(t,g,f+1,n[c]+s+1,o);y!=W?(l[c]=d,l[c+1]=h,l[c+2]=y):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=sc(l,n,e,t,i,s,o),f=nn(c,r,0,o);e=f.local;for(let d=0;dt&&o.to{let c=io(n,l,a+t);if(c){s=!0;let f=nn(c,l,t+a+1,r);f!=W&&i.push(a,a+l.nodeSize,f)}});let o=ro(s?so(n):n,-t).sort(We);for(let l=0;l0;)e++;n.splice(e,0,t)}function _n(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=W&&e.push(r)}),n.cursorWrapper&&e.push(re.create(n.state.doc,[n.cursorWrapper.deco])),tn.from(e)}var oc={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lc=X&&Ce<=11,ur=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},hr=class{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ur,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),lc&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,oc)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;tthis.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(fs(this.view)){if(this.suppressingSelectionUpdates)return ye(this.view);if(X&&Ce<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Je(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let s=e.focusNode;s;s=Mt(s))t.add(s);for(let s=e.anchorNode;s;s=Mt(s))if(t.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&fs(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,l=!1,a=[];if(e.editable)for(let f=0;fd.nodeName=="BR");if(f.length==2){let[d,u]=f;d.parentNode&&d.parentNode.parentNode==u.parentNode?u.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let u of f){let h=u.parentNode;h&&h.nodeName=="LI"&&(!d||fc(e,d)!=h)&&u.remove()}}}let c=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||i)&&(s>-1&&(e.docView.markDirty(s,o),ac(e)),this.handleDOMChange(s,o,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||ye(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let f=0;fi;g--){let y=r.childNodes[g-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){s=g;break}if(!w||w.size)break}let d=n.state.doc,u=n.someProp("domParser")||oe.fromSchema(n.state.schema),h=d.resolve(o),p=null,m=u.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:s,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:uc,context:h});if(c&&c[0].pos!=null){let g=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=g),p={anchor:g+o,head:y+o}}return{doc:m,sel:p,from:o,to:l}}function uc(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(K&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||K&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}var hc=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function pc(n,e,t,r,i){let s=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,xe=mr(n,E);if(xe&&!n.state.selection.eq(xe)){if(J&&ge&&n.input.lastKeyCode===13&&Date.now()-100nl(n,Fe(13,"Enter"))))return;let It=n.state.tr.setSelection(xe);E=="pointer"?It.setMeta("pointer",!0):E=="key"&&It.scrollIntoView(),s&&It.setMeta("composition",s),n.dispatch(It)}return}let o=n.state.doc.resolve(e),l=o.sharedDepth(t);e=o.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,c=dc(n,e,t),f=n.state.doc,d=f.slice(c.from,c.to),u,h;n.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ge)&&i.some(E=>E.nodeType==1&&!hc.test(E.nodeName))&&(!p||p.endA>=p.endB)&&n.someProp("handleKeyDown",E=>E(n,Fe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof T&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let E=Ms(n,n.state.doc,c.sel);if(E&&!E.eq(n.state.selection)){let xe=n.state.tr.setSelection(E);s&&xe.setMeta("composition",s),n.dispatch(xe)}}return}n.state.selection.fromn.state.selection.from&&p.start<=n.state.selection.from+2&&n.state.selection.from>=c.from?p.start=n.state.selection.from:p.endA=n.state.selection.to-2&&n.state.selection.to<=c.to&&(p.endB+=n.state.selection.to-p.endA,p.endA=n.state.selection.to)),X&&Ce<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" \xA0"&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),g=c.doc.resolveNoCache(p.endB-c.from),y=f.resolve(p.start),w=m.sameParent(g)&&m.parent.inlineContent&&y.end()>=p.endA,O;if((nt&&n.input.lastIOSEnter>Date.now()-225&&(!w||i.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!w&&m.posE(n,Fe(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>p.start&&gc(f,p.start,p.endA,m,g)&&n.someProp("handleKeyDown",E=>E(n,Fe(8,"Backspace")))){ge&&J&&n.domObserver.suppressSelectionUpdates();return}J&&p.endB==p.start&&(n.input.lastChromeDelete=Date.now()),ge&&!w&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,g=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,Fe(13,"Enter"))})},20));let A=p.start,I=p.endA,v,_,q;if(w){if(m.pos==g.pos)X&&Ce<=11&&m.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>ye(n),20)),v=n.state.tr.delete(A,I),_=f.resolve(p.start).marksAcross(f.resolve(p.endA));else if(p.endA==p.endB&&(q=mc(m.parent.content.cut(m.parentOffset,g.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start()))))v=n.state.tr,q.type=="add"?v.addMark(A,I,q.mark):v.removeMark(A,I,q.mark);else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let E=m.parent.textBetween(m.parentOffset,g.parentOffset);if(n.someProp("handleTextInput",xe=>xe(n,A,I,E)))return;v=n.state.tr.insertText(E,A,I)}}if(v||(v=n.state.tr.replace(A,I,c.doc.slice(p.start-c.from,p.endB-c.from))),c.sel){let E=Ms(n,v.doc,c.sel);E&&!(J&&n.composing&&E.empty&&(p.start!=p.endB||n.input.lastChromeDeletee.content.size?null:gr(n,e.resolve(t.anchor),e.resolve(t.head))}function mc(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,i=t,s=r,o,l,a;for(let f=0;ff.mark(l.addToSet(f.marks));else if(i.length==0&&s.length==1)l=s[0],o="remove",a=f=>f.mark(l.removeFromSet(f.marks));else return null;let c=[];for(let f=0;ft||Gn(o,!0,!1)0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,i++,e=!1;if(t){let s=n.node(r).maybeChild(n.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function yc(n,e,t,r,i){let s=n.findDiffStart(e,t);if(s==null)return null;let{a:o,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(i=="end"){let a=Math.max(0,s-Math.min(o,l));r-=o+a-s}if(o=o?s-r:0;s-=a,s&&s=l?s-r:0;s-=a,s&&s=56320&&e<=57343&&t>=55296&&t<=56319}var rn=class{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ar,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(Es),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Ns(this),Os(this),this.nodeViews=Ts(this),this.docView=rs(this.state.doc,Cs(this),_n(this),this.dom,this),this.domObserver=new hr(this,(r,i,s,o)=>pc(this,r,i,s,o)),this.domObserver.start(),ja(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&cr(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Es),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(eo(this),o=!0),this.state=e;let l=i.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=Ts(this);kc(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&cr(this),this.editable=Ns(this),Os(this);let a=_n(this),c=Cs(this),f=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(i.selection))&&(o=!0);let u=f=="preserve"&&o&&this.dom.style.overflowAnchor==null&&sa(this);if(o){this.domObserver.stop();let h=d&&(X||J)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&bc(i.selection,e.selection);if(d){let p=J?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Qa(this)),(s||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=rs(e.doc,c,a,this.dom,this)),p&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Na(this))?ye(this,h):(js(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),f=="reset"?this.dom.scrollTop=0:f=="to selection"?this.scrollToSelection():u&&oa(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof M){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Xi(this,t.getBoundingClientRect(),e)}else Xi(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t0&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Qt(e.slice,e.move,i<0?void 0:M.create(this.state.doc,i))}someProp(e,t){let r=this._props&&this._props[e],i;if(r!=null&&(i=t?t(r):r))return i;for(let o=0;ot.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ua(this,e)}coordsAtPos(e,t=1){return Bs(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let i=this.docView.posFromDOM(e,t,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,t){return ya(this,t||this.state,e)}pasteHTML(e,t){return Ct(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ct(this,e,null,!0,t||new ClipboardEvent("paste"))}destroy(){this.docView&&(Wa(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],_n(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,_l())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return qa(this,e)}dispatch(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?K&&this.root.nodeType===11&&Ql(this.dom.ownerDocument)==this.dom&&cc(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};function Cs(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ne.node(0,n.state.doc.content.size,e)]}function Os(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ne.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Ns(n){return!n.someProp("editable",e=>e(n.state)===!1)}function bc(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function Ts(n){let e=Object.create(null);function t(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function kc(n,e){let t=0,r=0;for(let i in n){if(n[i]!=e[i])return!0;t++}for(let i in e)r++;return t!=r}function Es(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var be={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},an={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},xc=typeof navigator<"u"&&/Mac/.test(navigator.platform),Sc=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(P=0;P<10;P++)be[48+P]=be[96+P]=String(P);var P;for(P=1;P<=24;P++)be[P+111]="F"+P;var P;for(P=65;P<=90;P++)be[P]=String.fromCharCode(P+32),an[P]=String.fromCharCode(P);var P;for(ln in be)an.hasOwnProperty(ln)||(an[ln]=be[ln]);var ln;function oo(n){var e=xc&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Sc&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?an:be)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var Mc=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function wc(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,i,s,o;for(let l=0;l127)&&(s=be[r.keyCode])&&s!=i){let l=e[Sr(s,r)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var cn=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function co(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}var wr=(n,e,t)=>{let r=co(n,t);if(!r)return!1;let i=Or(r);if(!i){let o=r.blockRange(),l=o&&he(o);return l==null?!1:(e&&e(n.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(ko(n,i,e,-1))return!0;if(r.parent.content.size==0&&(it(s,"end")||M.isSelectable(s)))for(let o=r.depth;;o--){let l=yt(n.doc,r.before(o),r.after(o),x.empty);if(l&&l.slice.size1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(n.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},fo=(n,e,t)=>{let r=co(n,t);if(!r)return!1;let i=Or(r);return i?ho(n,i,e):!1},uo=(n,e,t)=>{let r=po(n,t);if(!r)return!1;let i=Er(r);return i?ho(n,i,e):!1};function ho(n,e,t){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=yt(n.doc,s,a,x.empty);if(!c||c.from!=s||c instanceof j&&c.slice.size>=a-s)return!1;if(t){let f=n.tr.step(c);f.setSelection(T.create(f.doc,s)),t(f.scrollIntoView())}return!0}function it(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}var Cr=(n,e,t)=>{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;s=Or(r)}let o=s&&s.nodeBefore;return!o||!M.isSelectable(o)?!1:(e&&e(n.tr.setSelection(M.create(n.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function Or(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function po(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset{let r=po(n,t);if(!r)return!1;let i=Er(r);if(!i)return!1;let s=i.nodeAfter;if(ko(n,i,e,1))return!0;if(r.parent.content.size==0&&(it(s,"start")||M.isSelectable(s))){let o=yt(n.doc,r.before(),r.after(),x.empty);if(o&&o.slice.size{let{$head:r,empty:i}=n.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset=0;e--){let t=n.node(e);if(n.index(e)+1{let t=n.selection,r=t instanceof M,i;if(r){if(t.node.isTextblock||!ie(n.doc,t.from))return!1;i=t.from}else if(i=Ye(n.doc,t.from,-1),i==null)return!1;if(e){let s=n.tr.join(i);r&&s.setSelection(M.create(s.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},go=(n,e)=>{let t=n.selection,r;if(t instanceof M){if(t.node.isTextblock||!ie(n.doc,t.to))return!1;r=t.to}else if(r=Ye(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},yo=(n,e)=>{let{$from:t,$to:r}=n.selection,i=t.blockRange(r),s=i&&he(i);return s==null?!1:(e&&e(n.tr.lift(i,s).scrollIntoView()),!0)},Dr=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(` +`).scrollIntoView()),!0)};function Ar(n){for(let e=0;e{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=Ar(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,o.createAndFill());a.setSelection(C.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},vr=(n,e)=>{let t=n.selection,{$from:r,$to:i}=t;if(t instanceof Z||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Ar(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index(){let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(Q(n.doc,s))return e&&e(n.tr.split(s).scrollIntoView()),!0}let r=t.blockRange(),i=r&&he(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)};function Nc(n){return(e,t)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof M&&e.selection.node.isBlock)return!r.parentOffset||!Q(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){a=r.end(h)==r.pos+(r.depth-h),c=r.start(h)==r.pos-(r.depth-h),l=Ar(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let m=n&&n(i.parent,a,r);s.unshift(m||(a&&l?{type:l}:null)),o=h;break}else{if(h==1)return!1;s.unshift(null)}let f=e.tr;(e.selection instanceof T||e.selection instanceof Z)&&f.deleteSelection();let d=f.mapping.map(r.pos),u=Q(f.doc,d,s.length,s);if(u||(s[0]=l?{type:l}:null,u=Q(f.doc,d,s.length,s)),f.split(d,s.length,s),!a&&c&&r.node(o).type!=l){let h=f.mapping.map(r.before(o)),p=f.doc.resolve(h);l&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&f.setNodeMarkup(f.mapping.map(r.before(o)),l)}return t&&t(f.scrollIntoView()),!0}}var Tc=Nc();var bo=(n,e)=>{let{$from:t,to:r}=n.selection,i,s=t.sharedDepth(r);return s==0?!1:(i=t.before(s),e&&e(n.tr.setSelection(M.create(n.doc,i))),!0)},Ec=(n,e)=>(e&&e(n.tr.setSelection(new Z(n.doc))),!0);function Dc(n,e,t){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||ie(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function ko(n,e,t,r){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&Dc(n,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let h=e.pos+s.nodeSize,p=b.empty;for(let y=o.length-1;y>=0;y--)p=b.from(o[y].create(null,p));p=b.from(i.copy(p));let m=n.tr.step(new R(e.pos-1,h,e.pos,h,new x(p,1,0),o.length,!0)),g=m.doc.resolve(h+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&ie(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let f=s.type.spec.isolating||r>0&&a?null:C.findFrom(e,1),d=f&&f.$from.blockRange(f.$to),u=d&&he(d);if(u!=null&&u>=e.depth)return t&&t(n.tr.lift(d,u).scrollIntoView()),!0;if(c&&it(s,"start",!0)&&it(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(t){let y=b.empty;for(let O=p.length-1;O>=0;O--)y=b.from(p[O].copy(y));let w=n.tr.step(new R(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new x(y,p.length,0),0,!0));t(w.scrollIntoView())}return!0}}return!1}function xo(n){return function(e,t){let r=e.selection,i=n<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(T.create(e.doc,n<0?i.start(s):i.end(s)))),!0):!1}}var Pr=xo(-1),Br=xo(1);function So(n,e=null){return function(t,r){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&Ge(o,n,e);return l?(r&&r(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function zr(n,e=null){return function(t,r){let i=!1;for(let s=0;s{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)i=!0;else{let f=t.doc.resolve(c),d=f.index();i=f.parent.canReplaceWith(d,d+1,n)}})}if(!i)return!1;if(r){let s=t.tr;for(let o=0;o=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new Re(a,a,e.depth),e.endIndex=0;f--)s=b.from(t[f].type.create(t[f].attrs,s));n.step(new R(e.start-(r?2:0),e.end,e.start,e.end,new x(s,0,0),t.length,!0));let o=0;for(let f=0;fo.childCount>0&&o.firstChild.type==n);return s?t?r.node(s.depth-1).type==n?Rc(e,t,n,s):Pc(e,t,s):!0:!1}}function Rc(n,e,t,r){let i=n.tr,s=r.end,o=r.$to.end(r.depth);sm;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(t.start),o=s.nodeAfter;if(r.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),f=s.index(-1);if(!c.canReplace(f+(l?0:1),f+1,o.content.append(a?b.empty:b.from(i))))return!1;let d=s.pos,u=d+o.nodeSize;return r.step(new R(d-(l?1:0),u+(a?1:0),d+1,u-1,new x((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function Co(n){return function(e,t){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=n)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,f=b.from(c?n.create():null),d=new x(b.from(n.create(null,b.from(l.type.create(null,f)))),c?3:1,0),u=s.start,h=s.end;t(e.tr.step(new R(u-(c?3:1),h,u,h,d,1,!0)).scrollIntoView())}return!0}}function gn(n){let{state:e,transaction:t}=n,{selection:r}=t,{doc:i}=t,{storedMarks:s}=t;return B(k({},e),{apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=t.selection,i=t.doc,s=t.storedMarks,t}})}var st=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:r}=this,{view:i}=t,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...f)=>{let d=a(...f)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l=[],a=!!e,c=e||s.tr,f=()=>(!a&&t&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(c),l.every(u=>u===!0)),d=B(k({},Object.fromEntries(Object.entries(r).map(([u,h])=>[u,(...m)=>{let g=this.buildProps(c,t),y=h(...m)(g);return l.push(y),d}]))),{run:f});return d}createCan(e){let{rawCommands:t,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i),l=Object.fromEntries(Object.entries(t).map(([a,c])=>[a,(...f)=>c(...f)(B(k({},o),{dispatch:void 0}))]));return B(k({},l),{chain:()=>this.createChain(s,i)})}buildProps(e,t=!0){let{rawCommands:r,editor:i,state:s}=this,{view:o}=i,l={tr:e,editor:i,view:o,state:gn({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...f)=>c(...f)(l)]))}};return l}},jr=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,t)),this}off(e,t){let r=this.callbacks[e];return r&&(t?this.callbacks[e]=r.filter(i=>i!==t):delete this.callbacks[e]),this}once(e,t){let r=(...i)=>{this.off(e,r),t.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}};function S(n,e,t){return n.config[e]===void 0&&n.parent?S(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind(B(k({},t),{parent:n.parent?S(n.parent,e,t):null})):n.config[e]}function yn(n){let e=n.filter(i=>i.type==="extension"),t=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function zo(n){let e=[],{nodeExtensions:t,markExtensions:r}=yn(n),i=[...t,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(o=>{let l={name:o.name,options:o.options,storage:o.storage,extensions:i},a=S(o,"addGlobalAttributes",l);if(!a)return;a().forEach(f=>{f.types.forEach(d=>{Object.entries(f.attributes).forEach(([u,h])=>{e.push({type:d,name:u,attribute:k(k({},s),h)})})})})}),i.forEach(o=>{let l={name:o.name,options:o.options,storage:o.storage},a=S(o,"addAttributes",l);if(!a)return;let c=a();Object.entries(c).forEach(([f,d])=>{let u=k(k({},s),d);typeof(u==null?void 0:u.default)=="function"&&(u.default=u.default()),u!=null&&u.isRequired&&(u==null?void 0:u.default)===void 0&&delete u.default,e.push({type:o.name,name:f,attribute:u})})}),e}function F(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function Bc(...n){return n.filter(e=>!!e).reduce((e,t)=>{let r=k({},e);return Object.entries(t).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){let l=s?s.split(" "):[],a=r[i]?r[i].split(" "):[],c=l.filter(f=>!a.includes(f));r[i]=[...a,...c].join(" ")}else if(i==="style"){let l=s?s.split(";").map(f=>f.trim()).filter(Boolean):[],a=r[i]?r[i].split(";").map(f=>f.trim()).filter(Boolean):[],c=new Map;a.forEach(f=>{let[d,u]=f.split(":").map(h=>h.trim());c.set(d,u)}),l.forEach(f=>{let[d,u]=f.split(":").map(h=>h.trim());c.set(d,u)}),r[i]=Array.from(c.entries()).map(([f,d])=>`${f}: ${d}`).join("; ")}else r[i]=s}),r},{})}function Wr(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Bc(t,r),{})}function Fo(n){return typeof n=="function"}function N(n,e=void 0,...t){return Fo(n)?e?n.bind(e)(...t):n(...t):n}function zc(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Fc(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Oo(n,e){return"style"in n?n:B(k({},n),{getAttrs:t=>{let r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;let i=e.reduce((s,o)=>{let l=o.attribute.parseHTML?o.attribute.parseHTML(t):Fc(t.getAttribute(o.name));return l==null?s:B(k({},s),{[o.name]:l})},{});return k(k({},r),i)}})}function No(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&zc(t)?!1:t!=null))}function Lo(n,e){var t;let r=zo(n),{nodeExtensions:i,markExtensions:s}=yn(n),o=(t=i.find(c=>S(c,"topNode")))===null||t===void 0?void 0:t.name,l=Object.fromEntries(i.map(c=>{let f=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},u=n.reduce((y,w)=>{let O=S(w,"extendNodeSchema",d);return k(k({},y),O?O(c):{})},{}),h=No(B(k({},u),{content:N(S(c,"content",d)),marks:N(S(c,"marks",d)),group:N(S(c,"group",d)),inline:N(S(c,"inline",d)),atom:N(S(c,"atom",d)),selectable:N(S(c,"selectable",d)),draggable:N(S(c,"draggable",d)),code:N(S(c,"code",d)),whitespace:N(S(c,"whitespace",d)),linebreakReplacement:N(S(c,"linebreakReplacement",d)),defining:N(S(c,"defining",d)),isolating:N(S(c,"isolating",d)),attrs:Object.fromEntries(f.map(y=>{var w;return[y.name,{default:(w=y==null?void 0:y.attribute)===null||w===void 0?void 0:w.default}]}))})),p=N(S(c,"parseHTML",d));p&&(h.parseDOM=p.map(y=>Oo(y,f)));let m=S(c,"renderHTML",d);m&&(h.toDOM=y=>m({node:y,HTMLAttributes:Wr(y,f)}));let g=S(c,"renderText",d);return g&&(h.toText=g),[c.name,h]})),a=Object.fromEntries(s.map(c=>{let f=r.filter(g=>g.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:e},u=n.reduce((g,y)=>{let w=S(y,"extendMarkSchema",d);return k(k({},g),w?w(c):{})},{}),h=No(B(k({},u),{inclusive:N(S(c,"inclusive",d)),excludes:N(S(c,"excludes",d)),group:N(S(c,"group",d)),spanning:N(S(c,"spanning",d)),code:N(S(c,"code",d)),attrs:Object.fromEntries(f.map(g=>{var y;return[g.name,{default:(y=g==null?void 0:g.attribute)===null||y===void 0?void 0:y.default}]}))})),p=N(S(c,"parseHTML",d));p&&(h.parseDOM=p.map(g=>Oo(g,f)));let m=S(c,"renderHTML",d);return m&&(h.toDOM=g=>m({mark:g,HTMLAttributes:Wr(g,f)})),[c.name,h]}));return new ct({topNode:o,nodes:l,marks:a})}function Lr(n,e){return e.nodes[n]||e.marks[n]||null}function To(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function bn(n,e){let t=de.fromSchema(e).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(t),i.innerHTML}var Lc=(n,e=500)=>{let t="",r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,l)=>{var a,c;let f=((c=(a=i.type.spec).toText)===null||c===void 0?void 0:c.call(a,{node:i,pos:s,parent:o,index:l}))||i.textContent||"%leaf%";t+=i.isAtom&&!i.isText?f:f.slice(0,Math.max(0,r-s))}),t};function Ur(n){return Object.prototype.toString.call(n)==="[object RegExp]"}var Ke=class{constructor(e){this.find=e.find,this.handler=e.handler}},Vc=(n,e)=>{if(Ur(e))return e.exec(n);let t=e(n);if(!t)return null;let r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function fn(n){var e;let{editor:t,from:r,to:i,text:s,rules:o,plugin:l}=n,{view:a}=t;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||!((e=c.nodeBefore||c.nodeAfter)===null||e===void 0)&&e.marks.find(u=>u.type.spec.code))return!1;let f=!1,d=Lc(c)+s;return o.forEach(u=>{if(f)return;let h=Vc(d,u.find);if(!h)return;let p=a.state.tr,m=gn({state:a.state,transaction:p}),g={from:r-(h[0].length-s.length),to:i},{commands:y,chain:w,can:O}=new st({editor:t,state:m});u.handler({state:m,range:g,match:h,commands:y,chain:w,can:O})===null||!p.steps.length||(p.setMeta(l,{transform:p,from:r,to:i,text:s}),a.dispatch(p),f=!0)}),f}function $c(n){let{editor:e,rules:t}=n,r=new Y({state:{init(){return null},apply(i,s,o){let l=i.getMeta(r);if(l)return l;let a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:f}=a;typeof f=="string"?f=f:f=bn(b.from(f),o.schema);let{from:d}=a,u=d+f.length;fn({editor:e,from:d,to:u,text:f,rules:t,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,l){return fn({editor:e,from:s,to:o,text:l,rules:t,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:s}=i.state.selection;s&&fn({editor:e,from:s.pos,to:s.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;let{$cursor:o}=i.state.selection;return o?fn({editor:e,from:o.pos,to:o.pos,text:` +`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function jc(n){return Object.prototype.toString.call(n).slice(8,-1)}function dn(n){return jc(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function kn(n,e){let t=k({},n);return dn(n)&&dn(e)&&Object.keys(e).forEach(r=>{dn(e[r])&&dn(n[r])?t[r]=kn(n[r],e[r]):t[r]=e[r]}),t}var Jr=class n{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=k(k({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&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=N(S(this,"addOptions",{name:this.name}))),this.storage=N(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(B(k({},this.config),{addOptions:()=>kn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=N(S(t,"addOptions",{name:t.name})),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}static handleExit({editor:e,mark:t}){let{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){let o=i.marks();if(!!!o.find(c=>(c==null?void 0:c.type.name)===t.name))return!1;let a=o.find(c=>(c==null?void 0:c.type.name)===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}};function Wc(n){return typeof n=="number"}var Dt=class{constructor(e){this.find=e.find,this.handler=e.handler}},Jc=(n,e,t)=>{if(Ur(e))return[...n.matchAll(e)];let r=e(n,t);return r?r.map(i=>{let s=[i.text];return s.index=i.index,s.input=n,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function qc(n){let{editor:e,state:t,from:r,to:i,rule:s,pasteEvent:o,dropEvent:l}=n,{commands:a,chain:c,can:f}=new st({editor:e,state:t}),d=[];return t.doc.nodesBetween(r,i,(h,p)=>{if(!h.isTextblock||h.type.spec.code)return;let m=Math.max(r,p),g=Math.min(i,p+h.content.size),y=h.textBetween(m-p,g-p,void 0,"\uFFFC");Jc(y,s.find,o).forEach(O=>{if(O.index===void 0)return;let A=m+O.index+1,I=A+O[0].length,v={from:t.tr.mapping.map(A),to:t.tr.mapping.map(I)},_=s.handler({state:t,range:v,match:O,commands:a,chain:c,can:f,pasteEvent:o,dropEvent:l});d.push(_)})}),d.every(h=>h!==null)}var Kc=n=>{var e;let t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)===null||e===void 0||e.setData("text/html",n),t};function Hc(n){let{editor:e,rules:t}=n,r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}let a=({state:f,from:d,to:u,rule:h,pasteEvt:p})=>{let m=f.tr,g=gn({state:f,transaction:m});if(!(!qc({editor:e,state:g,from:Math.max(d-1,0),to:u.b-1,rule:h,pasteEvent:p,dropEvent:l})||!m.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(f=>new Y({view(d){let u=h=>{var p;r=!((p=d.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?d.dom.parentElement:null};return window.addEventListener("dragstart",u),{destroy(){window.removeEventListener("dragstart",u)}}},props:{handleDOMEvents:{drop:(d,u)=>(s=r===d.dom.parentElement,l=u,!1),paste:(d,u)=>{var h;let p=(h=u.clipboardData)===null||h===void 0?void 0:h.getData("text/html");return o=u,i=!!(p!=null&&p.includes("data-pm-slice")),!1}}},appendTransaction:(d,u,h)=>{let p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,y=p.getMeta("applyPasteRules"),w=!!y;if(!m&&!g&&!w)return;if(w){let{text:I}=y;typeof I=="string"?I=I:I=bn(b.from(I),h.schema);let{from:v}=y,_=v+I.length,q=Kc(I);return a({rule:f,state:h,from:v,to:{b:_},pasteEvt:q})}let O=u.doc.content.findDiffStart(h.doc.content),A=u.doc.content.findDiffEnd(h.doc.content);if(!(!Wc(O)||!A||O===A.b))return a({rule:f,state:h,from:O,to:A,pasteEvt:o})}}))}function Uc(n){let e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}var hn=class n{constructor(e,t){this.splittableMarks=[],this.editor=t,this.extensions=n.resolve(e),this.schema=Lo(this.extensions,t),this.setupExtensions()}static resolve(e){let t=n.sort(n.flatten(e)),r=Uc(t.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),t}static flatten(e){return e.map(t=>{let r={name:t.name,options:t.options,storage:t.storage},i=S(t,"addExtensions",r);return i?[t,...this.flatten(i())]:t}).flat(10)}static sort(e){return e.sort((r,i)=>{let s=S(r,"priority")||100,o=S(i,"priority")||100;return s>o?-1:s{let r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Lr(t.name,this.schema)},i=S(t,"addCommands",r);return i?k(k({},e),i()):e},{})}get plugins(){let{editor:e}=this,t=n.sort([...this.extensions].reverse()),r=[],i=[],s=t.map(o=>{let l={name:o.name,options:o.options,storage:o.storage,editor:e,type:Lr(o.name,this.schema)},a=[],c=S(o,"addKeyboardShortcuts",l),f={};if(o.type==="mark"&&S(o,"exitable",l)&&(f.ArrowRight=()=>Jr.handleExit({editor:e,mark:o})),c){let m=Object.fromEntries(Object.entries(c()).map(([g,y])=>[g,()=>y({editor:e})]));f=k(k({},f),m)}let d=lo(f);a.push(d);let u=S(o,"addInputRules",l);To(o,e.options.enableInputRules)&&u&&r.push(...u());let h=S(o,"addPasteRules",l);To(o,e.options.enablePasteRules)&&h&&i.push(...h());let p=S(o,"addProseMirrorPlugins",l);if(p){let m=p();a.push(...m)}return a}).flat();return[$c({editor:e,rules:r}),...Hc({editor:e,rules:i}),...s]}get attributes(){return zo(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=yn(this.extensions);return Object.fromEntries(t.filter(r=>!!S(r,"addNodeView")).map(r=>{let i=this.attributes.filter(a=>a.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:F(r.name,this.schema)},o=S(r,"addNodeView",s);if(!o)return[];let l=(a,c,f,d,u)=>{let h=Wr(a,i);return o()({node:a,view:c,getPos:f,decorations:d,innerDecorations:u,editor:e,extension:r,HTMLAttributes:h})};return[r.name,l]}))}setupExtensions(){this.extensions.forEach(e=>{var t;this.editor.extensionStorage[e.name]=e.storage;let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Lr(e.name,this.schema)};e.type==="mark"&&(!((t=N(S(e,"keepOnSplit",r)))!==null&&t!==void 0)||t)&&this.splittableMarks.push(e.name);let i=S(e,"onBeforeCreate",r),s=S(e,"onCreate",r),o=S(e,"onUpdate",r),l=S(e,"onSelectionUpdate",r),a=S(e,"onTransaction",r),c=S(e,"onFocus",r),f=S(e,"onBlur",r),d=S(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),f&&this.editor.on("blur",f),d&&this.editor.on("destroy",d)})}},fe=class n{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=k(k({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&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=N(S(this,"addOptions",{name:this.name}))),this.storage=N(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(B(k({},this.config),{addOptions:()=>kn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(k(k({},this.config),e));return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=N(S(t,"addOptions",{name:t.name})),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}};function Vo(n,e,t){let{from:r,to:i}=e,{blockSeparator:s=` -`,textSerializers:o={}}=t||{},l="";return n.nodesBetween(r,i,(a,c,f,d)=>{var u;a.isBlock&&c>r&&(l+=s);let h=o==null?void 0:o[a.type.name];if(h)return f&&(l+=h({node:a,pos:c,parent:f,index:d,range:e})),!1;a.isText&&(l+=(u=a==null?void 0:a.text)===null||u===void 0?void 0:u.slice(Math.max(r,c)-c,i-c))}),l}function _r(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}var $o=de.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Y({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(f=>f.$from.pos)),l=Math.max(...s.map(f=>f.$to.pos)),a=_r(t);return Vo(r,{from:o,to:l},B(k({},this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{}),{textSerializers:a}))}}})]}}),_c=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),Gc=(n=!1)=>({commands:e})=>e.setContent("",n),Yc=()=>({state:n,tr:e,dispatch:t})=>{let{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:f}=e,d=c.resolve(f.map(a)),u=c.resolve(f.map(a+l.nodeSize)),h=d.blockRange(u);if(!h)return;let p=pe(h);if(l.type.isTextblock){let{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Xc=n=>e=>n(e),Zc=()=>({state:n,dispatch:e})=>vr(n,e),Qc=(n,e)=>({editor:t,tr:r})=>{let{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);let o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new T(r.doc.resolve(o-1))),!0},ef=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;let i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){let l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1},tf=n=>({tr:e,state:t,dispatch:r})=>{let i=F(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){let a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},nf=n=>({tr:e,dispatch:t})=>{let{from:r,to:i}=n;return t&&e.delete(r,i),!0},rf=()=>({state:n,dispatch:e})=>cn(n,e),sf=()=>({commands:n})=>n.keyboardShortcut("Enter"),of=()=>({state:n,dispatch:e})=>Ir(n,e);function pn(n,e,t={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Ur(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function jo(n,e,t={}){return n.find(r=>r.type===e&&pn(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Eo(n,e,t={}){return!!jo(n,e,t)}function Gr(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(f=>f.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(f=>f.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!jo([...i.node.marks],e,t)))return;let o=i.index,l=n.start()+i.offset,a=o+1,c=l+i.node.nodeSize;for(;o>0&&Eo([...n.parent.child(o-1).marks],e,t);)o-=1,l-=n.parent.child(o).nodeSize;for(;a({tr:t,state:r,dispatch:i})=>{let s=De(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:f}=l;if(i){let d=Gr(a,s,e);if(d&&d.from<=c&&d.to>=f){let u=T.create(o,d.from,d.to);t.setSelection(u)}}return!0},af=n=>e=>{let t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e=k({scrollIntoView:!0},e);let o=()=>{xn()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!Wo(t.state.selection))return o(),!0;let l=Jo(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ff=(n,e)=>t=>n.every((r,i)=>e(r,B(k({},t),{index:i}))),df=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),qo=n=>{let e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){let r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&qo(r)}return n};function Et(n){let e=`${n}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return qo(t)}function mn(n,e,t){if(n instanceof G||n instanceof b)return n;t=k({slice:!0,parseOptions:{}},t);let r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return b.fromArray(n.map(l=>e.nodeFromJSON(l)));let o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),mn("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="",a=new ct({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?le.fromSchema(a).parseSlice(Et(n),t.parseOptions):le.fromSchema(a).parse(Et(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let s=le.fromSchema(e);return t.slice?s.parseSlice(Et(n),t.parseOptions).content:s.parse(Et(n),t.parseOptions)}return mn("",e,t)}function uf(n,e,t){let r=n.steps.length-1;if(r{o===0&&(o=f)}),n.setSelection(C.near(n.doc.resolve(o),t))}var hf=n=>!("type"in n),pf=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t=k({parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1},t);let l;try{l=mn(e,s.schema,{parseOptions:k({preserveWhitespace:"full"},t.parseOptions),errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(p){return s.emit("contentError",{editor:s,error:p,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,d=!0;if((hf(l)?l:[l]).forEach(p=>{p.check(),f=f?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),a===c&&d){let{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;if(f){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof b){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,a,c)}else h=l,r.replaceWith(a,c,h);t.updateSelection&&uf(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},mf=()=>({state:n,dispatch:e})=>mo(n,e),gf=()=>({state:n,dispatch:e})=>go(n,e),yf=()=>({state:n,dispatch:e})=>wr(n,e),bf=()=>({state:n,dispatch:e})=>Nr(n,e),kf=()=>({state:n,dispatch:e,tr:t})=>{try{let r=Ye(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},xf=()=>({state:n,dispatch:e,tr:t})=>{try{let r=Ye(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Sf=()=>({state:n,dispatch:e})=>fo(n,e),Mf=()=>({state:n,dispatch:e})=>uo(n,e);function Ko(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function wf(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let l=0;l({editor:e,view:t,tr:r,dispatch:i})=>{let s=wf(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{let f=c.map(r.mapping);f&&i&&r.maybeStep(f)}),!0};function At(n,e,t={}){let{from:r,to:i,empty:s}=n.selection,o=e?F(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(d,u)=>{if(d.isText)return;let h=Math.max(r,u),p=Math.min(i,u+d.nodeSize);l.push({node:d,from:h,to:p})});let a=i-r,c=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>pn(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,u)=>d+u.to-u.from,0)>=a}var Of=(n,e={})=>({state:t,dispatch:r})=>{let i=F(n,t.schema);return At(t,i,e)?yo(t,r):!1},Nf=()=>({state:n,dispatch:e})=>Rr(n,e),Tf=n=>({state:e,dispatch:t})=>{let r=F(n,e.schema);return wo(r)(e,t)},Ef=()=>({state:n,dispatch:e})=>Dr(n,e);function Sn(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Do(n,e){let t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var Df=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null,l=Sn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=F(n,r.schema)),l==="mark"&&(o=De(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,f)=>{s&&s===c.type&&t.setNodeMarkup(f,void 0,Do(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&t.addMark(f,f+c.nodeSize,o.create(Do(d.attrs,e)))})})}),!0):!1},Af=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),If=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),vf=()=>({state:n,dispatch:e})=>Cr(n,e),Rf=()=>({state:n,dispatch:e})=>Tr(n,e),Pf=()=>({state:n,dispatch:e})=>bo(n,e),Bf=()=>({state:n,dispatch:e})=>Br(n,e),zf=()=>({state:n,dispatch:e})=>Pr(n,e);function qr(n,e,t={},r={}){return mn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Ff=(n,e=!1,t={},r={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{var a,c;let{doc:f}=s;if(t.preserveWhitespace!=="full"){let d=qr(n,i.schema,t,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return o&&s.replaceWith(0,f.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:f.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function Ho(n,e){let t=De(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});let l=o.find(a=>a.type.name===t.name);return l?k({},l.attrs):{}}function du(n,e){let t=new _e(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function Lf(n){for(let e=0;e{e(r)&&t.push({node:r,pos:i})}),t}function hu(n,e,t){let r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function Vf(n,e){for(let t=n.depth;t>0;t-=1){let r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Mn(n){return e=>Vf(e.$from,n)}function Yr(n,e){let t=hn.resolve(n);return Lo(t,e)}function pu(n,e){let t=Yr(e),r=G.fromJSON(t,n);return bn(r.content,t)}function mu(n,e){let t=Yr(e),r=Et(n);return le.fromSchema(t).parse(r).toJSON()}function Uo(n,e){let t={from:0,to:n.content.size};return Vo(n,t,e)}function gu(n,e,t){let{blockSeparator:r=` +`,textSerializers:o={}}=t||{},l="";return n.nodesBetween(r,i,(a,c,f,d)=>{var u;a.isBlock&&c>r&&(l+=s);let h=o==null?void 0:o[a.type.name];if(h)return f&&(l+=h({node:a,pos:c,parent:f,index:d,range:e})),!1;a.isText&&(l+=(u=a==null?void 0:a.text)===null||u===void 0?void 0:u.slice(Math.max(r,c)-c,i-c))}),l}function _r(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}var $o=fe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Y({key:new le("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(f=>f.$from.pos)),l=Math.max(...s.map(f=>f.$to.pos)),a=_r(t);return Vo(r,{from:o,to:l},B(k({},this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{}),{textSerializers:a}))}}})]}}),_c=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())===null||t===void 0||t.removeAllRanges())}),!0),Gc=(n=!1)=>({commands:e})=>e.setContent("",n),Yc=()=>({state:n,tr:e,dispatch:t})=>{let{selection:r}=e,{ranges:i}=r;return t&&i.forEach(({$from:s,$to:o})=>{n.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:f}=e,d=c.resolve(f.map(a)),u=c.resolve(f.map(a+l.nodeSize)),h=d.blockRange(u);if(!h)return;let p=he(h);if(l.type.isTextblock){let{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},Xc=n=>e=>n(e),Zc=()=>({state:n,dispatch:e})=>vr(n,e),Qc=(n,e)=>({editor:t,tr:r})=>{let{state:i}=t,s=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);let o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new T(r.doc.resolve(o-1))),!0},ef=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;let i=n.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){let l=i.before(s),a=i.after(s);n.delete(l,a).scrollIntoView()}return!0}return!1},tf=n=>({tr:e,state:t,dispatch:r})=>{let i=F(n,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){let a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},nf=n=>({tr:e,dispatch:t})=>{let{from:r,to:i}=n;return t&&e.delete(r,i),!0},rf=()=>({state:n,dispatch:e})=>cn(n,e),sf=()=>({commands:n})=>n.keyboardShortcut("Enter"),of=()=>({state:n,dispatch:e})=>Ir(n,e);function pn(n,e,t={strict:!0}){let r=Object.keys(e);return r.length?r.every(i=>t.strict?e[i]===n[i]:Ur(e[i])?e[i].test(n[i]):e[i]===n[i]):!0}function jo(n,e,t={}){return n.find(r=>r.type===e&&pn(Object.fromEntries(Object.keys(t).map(i=>[i,r.attrs[i]])),t))}function Eo(n,e,t={}){return!!jo(n,e,t)}function Gr(n,e,t){var r;if(!n||!e)return;let i=n.parent.childAfter(n.parentOffset);if((!i.node||!i.node.marks.some(f=>f.type===e))&&(i=n.parent.childBefore(n.parentOffset)),!i.node||!i.node.marks.some(f=>f.type===e)||(t=t||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!jo([...i.node.marks],e,t)))return;let o=i.index,l=n.start()+i.offset,a=o+1,c=l+i.node.nodeSize;for(;o>0&&Eo([...n.parent.child(o-1).marks],e,t);)o-=1,l-=n.parent.child(o).nodeSize;for(;a({tr:t,state:r,dispatch:i})=>{let s=De(n,r.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:f}=l;if(i){let d=Gr(a,s,e);if(d&&d.from<=c&&d.to>=f){let u=T.create(o,d.from,d.to);t.setSelection(u)}}return!0},af=n=>e=>{let t=typeof n=="function"?n(e):n;for(let r=0;r({editor:t,view:r,tr:i,dispatch:s})=>{e=k({scrollIntoView:!0},e);let o=()=>{xn()&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(s&&n===null&&!Wo(t.state.selection))return o(),!0;let l=Jo(i.doc,n)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},ff=(n,e)=>t=>n.every((r,i)=>e(r,B(k({},t),{index:i}))),df=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),qo=n=>{let e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){let r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&qo(r)}return n};function Et(n){let e=`${n}`,t=new window.DOMParser().parseFromString(e,"text/html").body;return qo(t)}function mn(n,e,t){if(n instanceof G||n instanceof b)return n;t=k({slice:!0,parseOptions:{}},t);let r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return b.fromArray(n.map(l=>e.nodeFromJSON(l)));let o=e.nodeFromJSON(n);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",s),mn("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="",a=new ct({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?oe.fromSchema(a).parseSlice(Et(n),t.parseOptions):oe.fromSchema(a).parse(Et(n),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let s=oe.fromSchema(e);return t.slice?s.parseSlice(Et(n),t.parseOptions).content:s.parse(Et(n),t.parseOptions)}return mn("",e,t)}function uf(n,e,t){let r=n.steps.length-1;if(r{o===0&&(o=f)}),n.setSelection(C.near(n.doc.resolve(o),t))}var hf=n=>!("type"in n),pf=(n,e,t)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){t=k({parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1},t);let l;try{l=mn(e,s.schema,{parseOptions:k({preserveWhitespace:"full"},t.parseOptions),errorOnInvalidContent:(o=t.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(p){return s.emit("contentError",{editor:s,error:p,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}}),!1}let{from:a,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},f=!0,d=!0;if((hf(l)?l:[l]).forEach(p=>{p.check(),f=f?p.isText&&p.marks.length===0:!1,d=d?p.isBlock:!1}),a===c&&d){let{parent:p}=r.doc.resolve(a);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(a-=1,c+=1)}let h;if(f){if(Array.isArray(e))h=e.map(p=>p.text||"").join("");else if(e instanceof b){let p="";e.forEach(m=>{m.text&&(p+=m.text)}),h=p}else typeof e=="object"&&e&&e.text?h=e.text:h=e;r.insertText(h,a,c)}else h=l,r.replaceWith(a,c,h);t.updateSelection&&uf(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:a,text:h}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:a,text:h})}return!0},mf=()=>({state:n,dispatch:e})=>mo(n,e),gf=()=>({state:n,dispatch:e})=>go(n,e),yf=()=>({state:n,dispatch:e})=>wr(n,e),bf=()=>({state:n,dispatch:e})=>Nr(n,e),kf=()=>({state:n,dispatch:e,tr:t})=>{try{let r=Ye(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},xf=()=>({state:n,dispatch:e,tr:t})=>{try{let r=Ye(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},Sf=()=>({state:n,dispatch:e})=>fo(n,e),Mf=()=>({state:n,dispatch:e})=>uo(n,e);function Ko(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function wf(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t==="Space"&&(t=" ");let r,i,s,o;for(let l=0;l({editor:e,view:t,tr:r,dispatch:i})=>{let s=wf(n).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a==null||a.steps.forEach(c=>{let f=c.map(r.mapping);f&&i&&r.maybeStep(f)}),!0};function At(n,e,t={}){let{from:r,to:i,empty:s}=n.selection,o=e?F(e,n.schema):null,l=[];n.doc.nodesBetween(r,i,(d,u)=>{if(d.isText)return;let h=Math.max(r,u),p=Math.min(i,u+d.nodeSize);l.push({node:d,from:h,to:p})});let a=i-r,c=l.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>pn(d.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((d,u)=>d+u.to-u.from,0)>=a}var Of=(n,e={})=>({state:t,dispatch:r})=>{let i=F(n,t.schema);return At(t,i,e)?yo(t,r):!1},Nf=()=>({state:n,dispatch:e})=>Rr(n,e),Tf=n=>({state:e,dispatch:t})=>{let r=F(n,e.schema);return wo(r)(e,t)},Ef=()=>({state:n,dispatch:e})=>Dr(n,e);function Sn(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Do(n,e){let t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,i)=>(t.includes(i)||(r[i]=n[i]),r),{})}var Df=(n,e)=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null,l=Sn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=F(n,r.schema)),l==="mark"&&(o=De(n,r.schema)),i&&t.selection.ranges.forEach(a=>{r.doc.nodesBetween(a.$from.pos,a.$to.pos,(c,f)=>{s&&s===c.type&&t.setNodeMarkup(f,void 0,Do(c.attrs,e)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&t.addMark(f,f+c.nodeSize,o.create(Do(d.attrs,e)))})})}),!0):!1},Af=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),If=()=>({tr:n,commands:e})=>e.setTextSelection({from:0,to:n.doc.content.size}),vf=()=>({state:n,dispatch:e})=>Cr(n,e),Rf=()=>({state:n,dispatch:e})=>Tr(n,e),Pf=()=>({state:n,dispatch:e})=>bo(n,e),Bf=()=>({state:n,dispatch:e})=>Br(n,e),zf=()=>({state:n,dispatch:e})=>Pr(n,e);function qr(n,e,t={},r={}){return mn(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}var Ff=(n,e=!1,t={},r={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{var a,c;let{doc:f}=s;if(t.preserveWhitespace!=="full"){let d=qr(n,i.schema,t,{errorOnInvalidContent:(a=r.errorOnInvalidContent)!==null&&a!==void 0?a:i.options.enableContentCheck});return o&&s.replaceWith(0,f.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),l.insertContentAt({from:0,to:f.content.size},n,{parseOptions:t,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function Ho(n,e){let t=De(e,n.schema),{from:r,to:i,empty:s}=n.selection,o=[];s?(n.storedMarks&&o.push(...n.storedMarks),o.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,a=>{o.push(...a.marks)});let l=o.find(a=>a.type.name===t.name);return l?k({},l.attrs):{}}function du(n,e){let t=new _e(n);return e.forEach(r=>{r.steps.forEach(i=>{t.step(i)})}),t}function Lf(n){for(let e=0;e{e(r)&&t.push({node:r,pos:i})}),t}function hu(n,e,t){let r=[];return n.nodesBetween(e.from,e.to,(i,s)=>{t(i)&&r.push({node:i,pos:s})}),r}function Vf(n,e){for(let t=n.depth;t>0;t-=1){let r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function Mn(n){return e=>Vf(e.$from,n)}function Yr(n,e){let t=hn.resolve(n);return Lo(t,e)}function pu(n,e){let t=Yr(e),r=G.fromJSON(t,n);return bn(r.content,t)}function mu(n,e){let t=Yr(e),r=Et(n);return oe.fromSchema(t).parse(r).toJSON()}function Uo(n,e){let t={from:0,to:n.content.size};return Vo(n,t,e)}function gu(n,e,t){let{blockSeparator:r=` -`,textSerializers:i={}}=t||{},s=Yr(e),o=G.fromJSON(s,n);return Uo(o,{blockSeparator:r,textSerializers:k(k({},_r(s)),i)})}function $f(n,e){let t=F(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});let o=s.reverse().find(l=>l.type.name===t.name);return o?k({},o.attrs):{}}function jf(n,e){let t=Sn(typeof e=="string"?e:e.name,n.schema);return t==="node"?$f(n,e):t==="mark"?Ho(n,e):{}}function Wf(n,e=JSON.stringify){let t={};return n.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Jf(n){let e=Wf(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function yu(n){let{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{let o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{let{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{let c=e.slice(s).map(l,-1),f=e.slice(s).map(a),d=e.invert().map(c,-1),u=e.invert().map(f);r.push({oldRange:{from:d,to:u},newRange:{from:c,to:f}})})}),Jf(r)}function qf(n,e=0){let r=n.type===n.type.schema.topNodeType?0:1,i=e,s=i+n.nodeSize,o=n.marks.map(c=>{let f={type:c.type.name};return Object.keys(c.attrs).length&&(f.attrs=k({},c.attrs)),f}),l=k({},n.attrs),a={type:n.type.name,from:i,to:s};return Object.keys(l).length&&(a.attrs=l),o.length&&(a.marks=o),n.content.childCount&&(a.content=[],n.forEach((c,f)=>{var d;(d=a.content)===null||d===void 0||d.push(qf(c,e+f+r))})),n.text&&(a.text=n.text),a}function _o(n,e,t){let r=[];return n===e?t.resolve(n).marks().forEach(i=>{let s=t.resolve(n),o=Gr(s,i.type);o&&r.push(k({mark:i},o))}):t.nodesBetween(n,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var bu=(n,e,t,r=20)=>{let i=n.doc.resolve(t),s=r,o=null;for(;s>0&&o===null;){let l=i.node(s);(l==null?void 0:l.type.name)===e?o=l:s-=1}return[o,s]};function un(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{let i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Kr(n,e,t={}){let{empty:r,ranges:i}=n.selection,s=e?De(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>pn(d.attrs,t,{strict:!1}));let o=0,l=[];if(i.forEach(({$from:d,$to:u})=>{let h=d.pos,p=u.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;let y=Math.max(h,g),w=Math.min(p,g+m.nodeSize),O=w-y;o+=O,l.push(...m.marks.map(A=>({mark:A,from:y,to:w})))})}),o===0)return!1;let a=l.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>pn(d.mark.attrs,t,{strict:!1})).reduce((d,u)=>d+u.to-u.from,0),c=l.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,u)=>d+u.to-u.from,0);return(a>0?a+c:a)>=o}function Kf(n,e,t={}){if(!e)return At(n,null,t)||Kr(n,null,t);let r=Sn(e,n.schema);return r==="node"?At(n,e,t):r==="mark"?Kr(n,e,t):!1}var ku=(n,e)=>{let{$from:t,$to:r,$anchor:i}=n.selection;if(e){let s=Mn(l=>l.type.name===e)(n.selection);if(!s)return!1;let o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset{let{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Ao(n,e){let{nodeExtensions:t}=yn(e),r=t.find(o=>o.name===n);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},s=N(S(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Xr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(Xr(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Su(n){return n instanceof M}function Mu(n,e,t){let i=n.state.doc.content.size,s=ke(e,0,i),o=ke(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),f=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),u=Math.max(l.right,a.right),h=u-d,p=f-c,y={top:c,bottom:f,left:d,right:u,width:h,height:p,x:d,y:c};return B(k({},y),{toJSON:()=>y})}function Hf(n,e,t){var r;let{selection:i}=e,s=null;if(Wo(i)&&(s=i.$cursor),s){let l=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}let{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(f,d,u)=>{if(c)return!1;if(f.isInline){let h=!u||u.type.allowsMarkType(t),p=!!t.isInSet(f.marks)||!f.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}var Uf=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let{selection:s}=t,{empty:o,ranges:l}=s,a=De(n,r.schema);if(i)if(o){let c=Ho(r,a);t.addStoredMark(a.create(k(k({},c),e)))}else l.forEach(c=>{let f=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(f,d,(u,h)=>{let p=Math.max(h,f),m=Math.min(h+u.nodeSize,d);u.marks.find(y=>y.type===a)?u.marks.forEach(y=>{a===y.type&&t.addMark(p,m,a.create(k(k({},y.attrs),e)))}):t.addMark(p,m,a.create(e))})});return Hf(r,t,a)},_f=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Gf=(n,e={})=>({state:t,dispatch:r,chain:i})=>{let s=F(n,t.schema),o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>zr(s,k(k({},o),e))(t)?!0:l.clearNodes()).command(({state:l})=>zr(s,k(k({},o),e))(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Yf=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,i=ke(n,0,r.content.size),s=M.create(r,i);e.setSelection(s)}return!0},Xf=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=T.atStart(r).from,l=T.atEnd(r).to,a=ke(i,o,l),c=ke(s,o,l),f=T.create(r,a,c);e.setSelection(f)}return!0},Zf=n=>({state:e,dispatch:t})=>{let r=F(n,e.schema);return Co(r)(e,t)};function Io(n,e){let t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){let r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}var Qf=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{let{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,f=un(c,l.node().type.name,l.node().attrs);if(s instanceof M&&s.node.isBlock)return!l.parentOffset||!Q(o,l.pos)?!1:(r&&(n&&Io(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,u=l.depth===0?void 0:Lf(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=d&&u?[{type:u,attrs:f}]:void 0,p=Q(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Q(e.doc,e.mapping.map(l.pos),1,u?[{type:u}]:void 0)&&(p=!0,h=u?[{type:u,attrs:f}]:void 0),r){if(p&&(s instanceof T&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),u&&!d&&!l.parentOffset&&l.parent.type!==u)){let m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,u)&&e.setNodeMarkup(e.mapping.map(l.before()),u)}n&&Io(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},ed=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;let l=F(n,r.schema),{$from:a,$to:c}=r.selection,f=r.selection.node;if(f&&f.isBlock||a.depth<2||!a.sameParent(c))return!1;let d=a.node(-1);if(d.type!==l)return!1;let u=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let y=b.empty,w=a.index(-1)?1:a.index(-2)?2:3;for(let q=a.depth-w;q>=a.depth-3;q-=1)y=b.from(a.node(q).copy(y));let O=a.indexAfter(-1){if(_>-1)return!1;q.isTextblock&&q.content.size===0&&(_=E+1)}),_>-1&&t.setSelection(T.near(t.doc.resolve(_))),t.scrollIntoView()}return!0}let h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p=k(k({},un(u,d.type.name,d.attrs)),e),m=k(k({},un(u,a.node().type.name,a.node().attrs)),e);t.delete(a.pos,c.pos);let g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Q(t.doc,a.pos,2))return!1;if(i){let{selection:y,storedMarks:w}=r,{splittableMarks:O}=s.extensionManager,A=w||y.$to.parentOffset&&y.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!A||!i)return!0;let I=A.filter(v=>O.includes(v.type.name));t.ensureMarks(I)}return!0},Vr=(n,e)=>{let t=Mn(o=>o.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&ie(n.doc,t.pos)&&n.join(t.pos),!0},$r=(n,e)=>{let t=Mn(o=>o.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&ie(n.doc,r)&&n.join(r),!0},td=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:f})=>{let{extensions:d,splittableMarks:u}=i.extensionManager,h=F(n,o.schema),p=F(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:w}=m,O=y.blockRange(w),A=g||m.$to.parentOffset&&m.$from.marks();if(!O)return!1;let I=Mn(v=>Ao(v.type.name,d))(m);if(O.depth>=1&&I&&O.depth-I.depth<=1){if(I.node.type===h)return c.liftListItem(p);if(Ao(I.node.type.name,d)&&h.validContent(I.node.content)&&l)return a().command(()=>(s.setNodeMarkup(I.pos,h),!0)).command(()=>Vr(s,h)).command(()=>$r(s,h)).run()}return!t||!A||!l?a().command(()=>f().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Vr(s,h)).command(()=>$r(s,h)).run():a().command(()=>{let v=f().wrapInList(h,r),_=A.filter(q=>u.includes(q.type.name));return s.ensureMarks(_),v?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Vr(s,h)).command(()=>$r(s,h)).run()},nd=(n,e={},t={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:s=!1}=t,o=De(n,r.schema);return Kr(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},rd=(n,e,t={})=>({state:r,commands:i})=>{let s=F(n,r.schema),o=F(e,r.schema),l=At(r,s,t),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,k(k({},a),t))},id=(n,e={})=>({state:t,commands:r})=>{let i=F(n,t.schema);return At(t,i,e)?r.lift(i):r.wrapIn(i,e)},sd=()=>({state:n,dispatch:e})=>{let t=n.plugins;for(let r=0;r=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){let a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},od=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},ld=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;let{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=De(n,r.schema),{$from:c,empty:f,ranges:d}=l;if(!i)return!0;if(f&&o){let{from:u,to:h}=l,p=(s=c.marks().find(g=>g.type===a))===null||s===void 0?void 0:s.attrs,m=Gr(c,a,p);m&&(u=m.from,h=m.to),t.removeMark(u,h,a)}else d.forEach(u=>{t.removeMark(u.$from.pos,u.$to.pos,a)});return t.removeStoredMark(a),!0},ad=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null,l=Sn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=F(n,r.schema)),l==="mark"&&(o=De(n,r.schema)),i&&t.selection.ranges.forEach(a=>{let c=a.$from.pos,f=a.$to.pos,d,u,h,p;t.selection.empty?r.doc.nodesBetween(c,f,(m,g)=>{s&&s===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,f),d=g,u=m)}):r.doc.nodesBetween(c,f,(m,g)=>{g=c&&g<=f&&(s&&s===m.type&&t.setNodeMarkup(g,void 0,k(k({},m.attrs),e)),o&&m.marks.length&&m.marks.forEach(y=>{if(o===y.type){let w=Math.max(g,c),O=Math.min(g+m.nodeSize,f);t.addMark(w,O,o.create(k(k({},y.attrs),e)))}}))}),u&&(d!==void 0&&t.setNodeMarkup(d,void 0,k(k({},u.attrs),e)),o&&u.marks.length&&u.marks.forEach(m=>{o===m.type&&t.addMark(h,p,o.create(k(k({},m.attrs),e)))}))}),!0):!1},cd=(n,e={})=>({state:t,dispatch:r})=>{let i=F(n,t.schema);return So(i,e)(t,r)},fd=(n,e={})=>({state:t,dispatch:r})=>{let i=F(n,t.schema);return Mo(i,e)(t,r)},dd=Object.freeze({__proto__:null,blur:_c,clearContent:Gc,clearNodes:Yc,command:Xc,createParagraphNear:Zc,cut:Qc,deleteCurrentNode:ef,deleteNode:tf,deleteRange:nf,deleteSelection:rf,enter:sf,exitCode:of,extendMarkRange:lf,first:af,focus:cf,forEach:ff,insertContent:df,insertContentAt:pf,joinBackward:yf,joinDown:gf,joinForward:bf,joinItemBackward:kf,joinItemForward:xf,joinTextblockBackward:Sf,joinTextblockForward:Mf,joinUp:mf,keyboardShortcut:Cf,lift:Of,liftEmptyBlock:Nf,liftListItem:Tf,newlineInCode:Ef,resetAttributes:Df,scrollIntoView:Af,selectAll:If,selectNodeBackward:vf,selectNodeForward:Rf,selectParentNode:Pf,selectTextblockEnd:Bf,selectTextblockStart:zf,setContent:Ff,setMark:Uf,setMeta:_f,setNode:Gf,setNodeSelection:Yf,setTextSelection:Xf,sinkListItem:Zf,splitBlock:Qf,splitListItem:ed,toggleList:td,toggleMark:nd,toggleNode:rd,toggleWrap:id,undoInputRule:sd,unsetAllMarks:od,unsetMark:ld,updateAttributes:ad,wrapIn:cd,wrapInList:fd}),Go=de.create({name:"commands",addCommands(){return k({},dd)}}),Yo=de.create({name:"drop",addProseMirrorPlugins(){return[new Y({key:new ae("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Xo=de.create({name:"editable",addProseMirrorPlugins(){return[new Y({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Zo=de.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:n}=this;return[new Y({key:new ae("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;let r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;let r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Qo=de.create({name:"keymap",addKeyboardShortcuts(){let n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:f,$anchor:d}=a,{pos:u,parent:h}=d,p=d.parent.isTextblock&&u>0?l.doc.resolve(u-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:C.atStart(c).from===u;return!f||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i=k({},r),s=B(k({},r),{"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()});return xn()||Ko()?s:i},addProseMirrorPlugins(){return[new Y({key:new ae("clearDocument"),appendTransaction:(n,e,t)=>{let r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;let{empty:s,from:o,to:l}=e.selection,a=C.atStart(e.doc).from,c=C.atEnd(e.doc).to;if(s||!(o===a&&l===c)||!Xr(t.doc))return;let u=t.tr,h=gn({state:t,transaction:u}),{commands:p}=new st({editor:this.editor,state:h});if(p.clearNodes(),!!u.steps.length)return u}})]}}),el=de.create({name:"paste",addProseMirrorPlugins(){return[new Y({key:new ae("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),tl=de.create({name:"tabindex",addProseMirrorPlugins(){return[new Y({key:new ae("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),wu=Object.freeze({__proto__:null,ClipboardTextSerializer:$o,Commands:Go,Drop:Yo,Editable:Xo,FocusEvents:Zo,Keymap:Qo,Paste:el,Tabindex:tl}),Hr=class n{get name(){return this.node.type.name}constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new n(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new n(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new n(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,r)=>{let i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1),l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth)return;let a=new n(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new n(l,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){let s=i.node.attrs,o=Object.keys(t);for(let l=0;l{r&&i.length>0||(o.node.type.name===e&&s.every(a=>t[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,k(k({},this.node.attrs),e)),this.editor.view.dispatch(t)}},ud=`.ProseMirror { +`,textSerializers:i={}}=t||{},s=Yr(e),o=G.fromJSON(s,n);return Uo(o,{blockSeparator:r,textSerializers:k(k({},_r(s)),i)})}function $f(n,e){let t=F(e,n.schema),{from:r,to:i}=n.selection,s=[];n.doc.nodesBetween(r,i,l=>{s.push(l)});let o=s.reverse().find(l=>l.type.name===t.name);return o?k({},o.attrs):{}}function jf(n,e){let t=Sn(typeof e=="string"?e:e.name,n.schema);return t==="node"?$f(n,e):t==="mark"?Ho(n,e):{}}function Wf(n,e=JSON.stringify){let t={};return n.filter(r=>{let i=e(r);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Jf(n){let e=Wf(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,o)=>o!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function yu(n){let{mapping:e,steps:t}=n,r=[];return e.maps.forEach((i,s)=>{let o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{let{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{let c=e.slice(s).map(l,-1),f=e.slice(s).map(a),d=e.invert().map(c,-1),u=e.invert().map(f);r.push({oldRange:{from:d,to:u},newRange:{from:c,to:f}})})}),Jf(r)}function qf(n,e=0){let r=n.type===n.type.schema.topNodeType?0:1,i=e,s=i+n.nodeSize,o=n.marks.map(c=>{let f={type:c.type.name};return Object.keys(c.attrs).length&&(f.attrs=k({},c.attrs)),f}),l=k({},n.attrs),a={type:n.type.name,from:i,to:s};return Object.keys(l).length&&(a.attrs=l),o.length&&(a.marks=o),n.content.childCount&&(a.content=[],n.forEach((c,f)=>{var d;(d=a.content)===null||d===void 0||d.push(qf(c,e+f+r))})),n.text&&(a.text=n.text),a}function _o(n,e,t){let r=[];return n===e?t.resolve(n).marks().forEach(i=>{let s=t.resolve(n),o=Gr(s,i.type);o&&r.push(k({mark:i},o))}):t.nodesBetween(n,e,(i,s)=>{!i||(i==null?void 0:i.nodeSize)===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}var bu=(n,e,t,r=20)=>{let i=n.doc.resolve(t),s=r,o=null;for(;s>0&&o===null;){let l=i.node(s);(l==null?void 0:l.type.name)===e?o=l:s-=1}return[o,s]};function un(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{let i=n.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function Kr(n,e,t={}){let{empty:r,ranges:i}=n.selection,s=e?De(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>pn(d.attrs,t,{strict:!1}));let o=0,l=[];if(i.forEach(({$from:d,$to:u})=>{let h=d.pos,p=u.pos;n.doc.nodesBetween(h,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;let y=Math.max(h,g),w=Math.min(p,g+m.nodeSize),O=w-y;o+=O,l.push(...m.marks.map(A=>({mark:A,from:y,to:w})))})}),o===0)return!1;let a=l.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>pn(d.mark.attrs,t,{strict:!1})).reduce((d,u)=>d+u.to-u.from,0),c=l.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,u)=>d+u.to-u.from,0);return(a>0?a+c:a)>=o}function Kf(n,e,t={}){if(!e)return At(n,null,t)||Kr(n,null,t);let r=Sn(e,n.schema);return r==="node"?At(n,e,t):r==="mark"?Kr(n,e,t):!1}var ku=(n,e)=>{let{$from:t,$to:r,$anchor:i}=n.selection;if(e){let s=Mn(l=>l.type.name===e)(n.selection);if(!s)return!1;let o=n.doc.resolve(s.pos+1);return i.pos+1===o.end()}return!(r.parentOffset{let{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Ao(n,e){let{nodeExtensions:t}=yn(e),r=t.find(o=>o.name===n);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},s=N(S(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Xr(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let i=!0;return n.content.forEach(s=>{i!==!1&&(Xr(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Su(n){return n instanceof M}function Mu(n,e,t){let i=n.state.doc.content.size,s=ke(e,0,i),o=ke(t,0,i),l=n.coordsAtPos(s),a=n.coordsAtPos(o,-1),c=Math.min(l.top,a.top),f=Math.max(l.bottom,a.bottom),d=Math.min(l.left,a.left),u=Math.max(l.right,a.right),h=u-d,p=f-c,y={top:c,bottom:f,left:d,right:u,width:h,height:p,x:d,y:c};return B(k({},y),{toJSON:()=>y})}function Hf(n,e,t){var r;let{selection:i}=e,s=null;if(Wo(i)&&(s=i.$cursor),s){let l=(r=n.storedMarks)!==null&&r!==void 0?r:s.marks();return!!t.isInSet(l)||!l.some(a=>a.type.excludes(t))}let{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(f,d,u)=>{if(c)return!1;if(f.isInline){let h=!u||u.type.allowsMarkType(t),p=!!t.isInSet(f.marks)||!f.marks.some(m=>m.type.excludes(t));c=h&&p}return!c}),c})}var Uf=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let{selection:s}=t,{empty:o,ranges:l}=s,a=De(n,r.schema);if(i)if(o){let c=Ho(r,a);t.addStoredMark(a.create(k(k({},c),e)))}else l.forEach(c=>{let f=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(f,d,(u,h)=>{let p=Math.max(h,f),m=Math.min(h+u.nodeSize,d);u.marks.find(y=>y.type===a)?u.marks.forEach(y=>{a===y.type&&t.addMark(p,m,a.create(k(k({},y.attrs),e)))}):t.addMark(p,m,a.create(e))})});return Hf(r,t,a)},_f=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Gf=(n,e={})=>({state:t,dispatch:r,chain:i})=>{let s=F(n,t.schema),o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>zr(s,k(k({},o),e))(t)?!0:l.clearNodes()).command(({state:l})=>zr(s,k(k({},o),e))(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Yf=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,i=ke(n,0,r.content.size),s=M.create(r,i);e.setSelection(s)}return!0},Xf=n=>({tr:e,dispatch:t})=>{if(t){let{doc:r}=e,{from:i,to:s}=typeof n=="number"?{from:n,to:n}:n,o=T.atStart(r).from,l=T.atEnd(r).to,a=ke(i,o,l),c=ke(s,o,l),f=T.create(r,a,c);e.setSelection(f)}return!0},Zf=n=>({state:e,dispatch:t})=>{let r=F(n,e.schema);return Co(r)(e,t)};function Io(n,e){let t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){let r=t.filter(i=>e==null?void 0:e.includes(i.type.name));n.tr.ensureMarks(r)}}var Qf=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:i})=>{let{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,f=un(c,l.node().type.name,l.node().attrs);if(s instanceof M&&s.node.isBlock)return!l.parentOffset||!Q(o,l.pos)?!1:(r&&(n&&Io(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,u=l.depth===0?void 0:Lf(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=d&&u?[{type:u,attrs:f}]:void 0,p=Q(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!p&&Q(e.doc,e.mapping.map(l.pos),1,u?[{type:u}]:void 0)&&(p=!0,h=u?[{type:u,attrs:f}]:void 0),r){if(p&&(s instanceof T&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),u&&!d&&!l.parentOffset&&l.parent.type!==u)){let m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,u)&&e.setNodeMarkup(e.mapping.map(l.before()),u)}n&&Io(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},ed=(n,e={})=>({tr:t,state:r,dispatch:i,editor:s})=>{var o;let l=F(n,r.schema),{$from:a,$to:c}=r.selection,f=r.selection.node;if(f&&f.isBlock||a.depth<2||!a.sameParent(c))return!1;let d=a.node(-1);if(d.type!==l)return!1;let u=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let y=b.empty,w=a.index(-1)?1:a.index(-2)?2:3;for(let q=a.depth-w;q>=a.depth-3;q-=1)y=b.from(a.node(q).copy(y));let O=a.indexAfter(-1){if(_>-1)return!1;q.isTextblock&&q.content.size===0&&(_=E+1)}),_>-1&&t.setSelection(T.near(t.doc.resolve(_))),t.scrollIntoView()}return!0}let h=c.pos===a.end()?d.contentMatchAt(0).defaultType:null,p=k(k({},un(u,d.type.name,d.attrs)),e),m=k(k({},un(u,a.node().type.name,a.node().attrs)),e);t.delete(a.pos,c.pos);let g=h?[{type:l,attrs:p},{type:h,attrs:m}]:[{type:l,attrs:p}];if(!Q(t.doc,a.pos,2))return!1;if(i){let{selection:y,storedMarks:w}=r,{splittableMarks:O}=s.extensionManager,A=w||y.$to.parentOffset&&y.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!A||!i)return!0;let I=A.filter(v=>O.includes(v.type.name));t.ensureMarks(I)}return!0},Vr=(n,e)=>{let t=Mn(o=>o.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&ie(n.doc,t.pos)&&n.join(t.pos),!0},$r=(n,e)=>{let t=Mn(o=>o.type===e)(n.selection);if(!t)return!0;let r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return t.node.type===(i==null?void 0:i.type)&&ie(n.doc,r)&&n.join(r),!0},td=(n,e,t,r={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:f})=>{let{extensions:d,splittableMarks:u}=i.extensionManager,h=F(n,o.schema),p=F(e,o.schema),{selection:m,storedMarks:g}=o,{$from:y,$to:w}=m,O=y.blockRange(w),A=g||m.$to.parentOffset&&m.$from.marks();if(!O)return!1;let I=Mn(v=>Ao(v.type.name,d))(m);if(O.depth>=1&&I&&O.depth-I.depth<=1){if(I.node.type===h)return c.liftListItem(p);if(Ao(I.node.type.name,d)&&h.validContent(I.node.content)&&l)return a().command(()=>(s.setNodeMarkup(I.pos,h),!0)).command(()=>Vr(s,h)).command(()=>$r(s,h)).run()}return!t||!A||!l?a().command(()=>f().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>Vr(s,h)).command(()=>$r(s,h)).run():a().command(()=>{let v=f().wrapInList(h,r),_=A.filter(q=>u.includes(q.type.name));return s.ensureMarks(_),v?!0:c.clearNodes()}).wrapInList(h,r).command(()=>Vr(s,h)).command(()=>$r(s,h)).run()},nd=(n,e={},t={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:s=!1}=t,o=De(n,r.schema);return Kr(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},rd=(n,e,t={})=>({state:r,commands:i})=>{let s=F(n,r.schema),o=F(e,r.schema),l=At(r,s,t),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,k(k({},a),t))},id=(n,e={})=>({state:t,commands:r})=>{let i=F(n,t.schema);return At(t,i,e)?r.lift(i):r.wrapIn(i,e)},sd=()=>({state:n,dispatch:e})=>{let t=n.plugins;for(let r=0;r=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){let a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,n.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},od=()=>({tr:n,dispatch:e})=>{let{selection:t}=n,{empty:r,ranges:i}=t;return r||e&&i.forEach(s=>{n.removeMark(s.$from.pos,s.$to.pos)}),!0},ld=(n,e={})=>({tr:t,state:r,dispatch:i})=>{var s;let{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=De(n,r.schema),{$from:c,empty:f,ranges:d}=l;if(!i)return!0;if(f&&o){let{from:u,to:h}=l,p=(s=c.marks().find(g=>g.type===a))===null||s===void 0?void 0:s.attrs,m=Gr(c,a,p);m&&(u=m.from,h=m.to),t.removeMark(u,h,a)}else d.forEach(u=>{t.removeMark(u.$from.pos,u.$to.pos,a)});return t.removeStoredMark(a),!0},ad=(n,e={})=>({tr:t,state:r,dispatch:i})=>{let s=null,o=null,l=Sn(typeof n=="string"?n:n.name,r.schema);return l?(l==="node"&&(s=F(n,r.schema)),l==="mark"&&(o=De(n,r.schema)),i&&t.selection.ranges.forEach(a=>{let c=a.$from.pos,f=a.$to.pos,d,u,h,p;t.selection.empty?r.doc.nodesBetween(c,f,(m,g)=>{s&&s===m.type&&(h=Math.max(g,c),p=Math.min(g+m.nodeSize,f),d=g,u=m)}):r.doc.nodesBetween(c,f,(m,g)=>{g=c&&g<=f&&(s&&s===m.type&&t.setNodeMarkup(g,void 0,k(k({},m.attrs),e)),o&&m.marks.length&&m.marks.forEach(y=>{if(o===y.type){let w=Math.max(g,c),O=Math.min(g+m.nodeSize,f);t.addMark(w,O,o.create(k(k({},y.attrs),e)))}}))}),u&&(d!==void 0&&t.setNodeMarkup(d,void 0,k(k({},u.attrs),e)),o&&u.marks.length&&u.marks.forEach(m=>{o===m.type&&t.addMark(h,p,o.create(k(k({},m.attrs),e)))}))}),!0):!1},cd=(n,e={})=>({state:t,dispatch:r})=>{let i=F(n,t.schema);return So(i,e)(t,r)},fd=(n,e={})=>({state:t,dispatch:r})=>{let i=F(n,t.schema);return Mo(i,e)(t,r)},dd=Object.freeze({__proto__:null,blur:_c,clearContent:Gc,clearNodes:Yc,command:Xc,createParagraphNear:Zc,cut:Qc,deleteCurrentNode:ef,deleteNode:tf,deleteRange:nf,deleteSelection:rf,enter:sf,exitCode:of,extendMarkRange:lf,first:af,focus:cf,forEach:ff,insertContent:df,insertContentAt:pf,joinBackward:yf,joinDown:gf,joinForward:bf,joinItemBackward:kf,joinItemForward:xf,joinTextblockBackward:Sf,joinTextblockForward:Mf,joinUp:mf,keyboardShortcut:Cf,lift:Of,liftEmptyBlock:Nf,liftListItem:Tf,newlineInCode:Ef,resetAttributes:Df,scrollIntoView:Af,selectAll:If,selectNodeBackward:vf,selectNodeForward:Rf,selectParentNode:Pf,selectTextblockEnd:Bf,selectTextblockStart:zf,setContent:Ff,setMark:Uf,setMeta:_f,setNode:Gf,setNodeSelection:Yf,setTextSelection:Xf,sinkListItem:Zf,splitBlock:Qf,splitListItem:ed,toggleList:td,toggleMark:nd,toggleNode:rd,toggleWrap:id,undoInputRule:sd,unsetAllMarks:od,unsetMark:ld,updateAttributes:ad,wrapIn:cd,wrapInList:fd}),Go=fe.create({name:"commands",addCommands(){return k({},dd)}}),Yo=fe.create({name:"drop",addProseMirrorPlugins(){return[new Y({key:new le("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Xo=fe.create({name:"editable",addProseMirrorPlugins(){return[new Y({key:new le("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Zo=fe.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:n}=this;return[new Y({key:new le("focusEvents"),props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;let r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;let r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Qo=fe.create({name:"keymap",addKeyboardShortcuts(){let n=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:f,$anchor:d}=a,{pos:u,parent:h}=d,p=d.parent.isTextblock&&u>0?l.doc.resolve(u-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&p.parent.childCount===1?g===d.pos:C.atStart(c).from===u;return!f||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i=k({},r),s=B(k({},r),{"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()});return xn()||Ko()?s:i},addProseMirrorPlugins(){return[new Y({key:new le("clearDocument"),appendTransaction:(n,e,t)=>{let r=n.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=n.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;let{empty:s,from:o,to:l}=e.selection,a=C.atStart(e.doc).from,c=C.atEnd(e.doc).to;if(s||!(o===a&&l===c)||!Xr(t.doc))return;let u=t.tr,h=gn({state:t,transaction:u}),{commands:p}=new st({editor:this.editor,state:h});if(p.clearNodes(),!!u.steps.length)return u}})]}}),el=fe.create({name:"paste",addProseMirrorPlugins(){return[new Y({key:new le("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),tl=fe.create({name:"tabindex",addProseMirrorPlugins(){return[new Y({key:new le("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),wu=Object.freeze({__proto__:null,ClipboardTextSerializer:$o,Commands:Go,Drop:Yo,Editable:Xo,FocusEvents:Zo,Keymap:Qo,Paste:el,Tabindex:tl}),Hr=class n{get name(){return this.node.type.name}constructor(e,t,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new n(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new n(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new n(e,this.editor)}get children(){let e=[];return this.node.content.forEach((t,r)=>{let i=t.isBlock&&!t.isTextblock,s=t.isAtom&&!t.isText,o=this.pos+r+(s?0:1),l=this.resolvedPos.doc.resolve(o);if(!i&&l.depth<=this.depth)return;let a=new n(l,this.editor,i,i?t:null);i&&(a.actualDepth=this.depth+1),e.push(new n(l,this.editor,i,i?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(t).length>0){let s=i.node.attrs,o=Object.keys(t);for(let l=0;l{r&&i.length>0||(o.node.type.name===e&&s.every(a=>t[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,t,r))))}),i}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,k(k({},this.node.attrs),e)),this.editor.view.dispatch(t)}},ud=`.ProseMirror { position: relative; } @@ -88,5 +88,5 @@ img.ProseMirror-separator { opacity: 0 }`;function hd(n,e,t){let r=document.querySelector(`style[data-tiptap-style${t?`-${t}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute(`data-tiptap-style${t?`-${t}`:""}`,""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var vo=class extends jr{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),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),this.on("drop",({event:t,slice:r,moved:i})=>this.options.onDrop(t,r,i)),this.on("paste",({event:t,slice:r})=>this.options.onPaste(t,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},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=hd(ud,this.options.injectNonce))}setOptions(e={}){this.options=k(k({},this.options),e),!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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(e,t){let r=Fo(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,r=t;if([].concat(e).forEach(s=>{let o=typeof s=="string"?`${s}$`:s.key;r=t.filter(l=>!l.key.startsWith(o))}),t.length===r.length)return;let i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,t;let i=[...this.options.enableCoreExtensions?[Xo,$o.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),Go,Zo,Qo,tl,Yo,el].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s==null?void 0:s.type));this.extensionManager=new hn(i,this)}createCommandManager(){this.commandManager=new st({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let t;try{t=qr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(l=>l.name!=="collaboration"),this.createExtensionManager()}}),t=qr(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let r=Jo(t,this.options.autofocus);this.view=new rn(this.options.element,B(k({},this.options.editorProps),{attributes:k({role:"textbox"},(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes),dispatchTransaction:this.dispatchTransaction.bind(this),state:Ht.create({doc:t,selection:r||void 0})}));let i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();let s=this.view.dom;s.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var l;return(l=this.capturedTransaction)===null||l===void 0?void 0:l.step(o)});return}let t=this.state.apply(e),r=!this.state.selection.eq(t.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let i=e.getMeta("focus"),s=e.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:e}),s&&this.emit("blur",{editor:this,event:s.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return jf(this.state,e)}isActive(e,t){let r=typeof e=="string"?e:null,i=typeof e=="string"?t:e;return Kf(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return bn(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` -`,textSerializers:r={}}=e||{};return Uo(this.state.doc,{blockSeparator:t,textSerializers:k(k({},_r(this.schema)),r)})}get isEmpty(){return Xr(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(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e);return new Hr(t,this)}get $doc(){return this.$pos(0)}};function Cu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=N(n.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:s}=e,o=r[r.length-1],l=r[0];if(o){let a=l.search(/\S/),c=t.from+l.indexOf(o),f=c+o.length;if(_o(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;ft.from&&s.delete(t.from+a,c);let u=t.from+a+o.length;s.addMark(t.from+a,u,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function Ou(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=N(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from,l=t.to,a=n.type.create(i);if(r[1]){let c=r[0].lastIndexOf(r[1]),f=o+c;f>l?f=l:l=f+r[1].length;let d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(f,l,a)}else if(r[0]){let c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()}})}function Nu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=e.doc.resolve(t.from),s=N(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function Tu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=n.replace,s=t.from,o=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);i+=r[0].slice(l+r[1].length),s+=l;let a=s-o;a>0&&(i=r[0].slice(l-a,l)+i,s=o)}e.tr.insertText(i,s,o)}})}function Eu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{let s=N(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&Ge(a,n.type,s);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){let{selection:d,storedMarks:u}=e,{splittableMarks:h}=n.editor.extensionManager,p=u||d.$to.parentOffset&&d.$from.marks();if(p){let m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){let d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}let f=o.doc.resolve(t.from-1).nodeBefore;f&&f.type===n.type&&ie(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,f))&&o.join(t.from-1)}})}var Ro=class n{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=k(k({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&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=N(S(this,"addOptions",{name:this.name}))),this.storage=N(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(B(k({},this.config),{addOptions:()=>kn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=N(S(t,"addOptions",{name:t.name})),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}};function pd(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}var Po=class{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options=k({stopEvent:null,ignoreMutation:null},r),this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,i,s,o,l,a;let{view:c}=this.editor,f=e.target,d=f.nodeType===3?(t=f.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):f.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(f)||!d)return;let u=0,h=0;if(this.dom!==d){let y=this.dom.getBoundingClientRect(),w=d.getBoundingClientRect(),O=(i=e.offsetX)!==null&&i!==void 0?i:(s=e.nativeEvent)===null||s===void 0?void 0:s.offsetX,A=(o=e.offsetY)!==null&&o!==void 0?o:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;u=w.x-y.x+O,h=w.y-y.y+A}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,u,h);let p=this.getPos();if(typeof p!="number")return;let m=M.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});let r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;let s=e.type.startsWith("drag"),o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!o&&!s)return!0;let{isEditable:a}=this.editor,{isDragging:c}=this,f=!!this.node.type.spec.draggable,d=M.isSelectable(this.node),u=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!f&&d&&s&&e.preventDefault(),f&&s&&!c)return e.preventDefault(),!1;if(f&&a&&!c&&m){let g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(c||o||u||h||p||m&&d)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(xn()||pd())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,k(k({},this.node.attrs),e)),!0)})}deleteNode(){let e=this.getPos();if(typeof e!="number")return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Du(n){return new Dt({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{let s=N(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;let{tr:o}=e,l=r[r.length-1],a=r[0],c=t.to;if(l){let f=a.search(/\S/),d=t.from+a.indexOf(l),u=d+l.length;if(_o(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;ut.from&&o.delete(t.from+f,d),c=t.from+f+l.length,o.addMark(t.from+f,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function Au(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Iu(n){return typeof n=="string"}function vu(n){return new Dt({find:n.find,handler({match:e,chain:t,range:r,pasteEvent:i}){let s=N(n.getAttributes,void 0,e,i),o=N(n.getContent,void 0,s);if(s===!1||s===null)return null;let l={type:n.type.name,attrs:s};o&&(l.content=o),e.input&&t().deleteRange(r).insertContentAt(r.from,l)}})}function Ru(n){return new Dt({find:n.find,handler:({state:e,range:t,match:r})=>{let i=n.replace,s=t.from,o=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);i+=r[0].slice(l+r[1].length),s+=l;let a=s-o;a>0&&(i=r[0].slice(l-a,l)+i,s=o)}e.tr.insertText(i,s,o)}})}var Bo=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let t=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((i,s)=>{let o=s.getMap().mapResult(i);return o.deleted&&(t=!0),o.pos},e),deleted:t}}};export{k as a,B as b,md as c,gd as d,yd as e,b as f,D as g,x as h,G as i,ct as j,le as k,zn as l,zi as m,_e as n,C as o,qt as p,T as q,M as r,Ht as s,Y as t,ae as u,Ne as v,re as w,Oc as x,gn as y,st as z,S as A,yn as B,zo as C,F as D,Bc as E,Wr as F,Fo as G,N as H,zc as I,Fc as J,Oo as K,Lo as L,Lr as M,To as N,bn as O,Lc as P,Ur as Q,Ke as R,$c as S,dn as T,kn as U,Jr as V,Wc as W,Dt as X,Hc as Y,Uc as Z,de as _,Vo as $,_r as aa,pn as ba,Gr as ca,De as da,Wo as ea,ke as fa,Jo as ga,xn as ha,Et as ia,mn as ja,uf as ka,Ko as la,At as ma,Sn as na,Do as oa,qr as pa,Ho as qa,du as ra,Lf as sa,uu as ta,hu as ua,Vf as va,Mn as wa,Yr as xa,pu as ya,mu as za,Uo as Aa,gu as Ba,$f as Ca,jf as Da,Wf as Ea,yu as Fa,qf as Ga,_o as Ha,bu as Ia,un as Ja,Kr as Ka,Kf as La,ku as Ma,xu as Na,Ao as Oa,Xr as Pa,Su as Qa,Mu as Ra,wu as Sa,Hr as Ta,hd as Ua,vo as Va,Cu as Wa,Ou as Xa,Nu as Ya,Tu as Za,Eu as _a,Ro as $a,Po as ab,Du as bb,Au as cb,Iu as db,vu as eb,Ru as fb,Bo as gb}; -//# sourceMappingURL=chunk-5XJ3NODC.js.map +`,textSerializers:r={}}=e||{};return Uo(this.state.doc,{blockSeparator:t,textSerializers:k(k({},_r(this.schema)),r)})}get isEmpty(){return Xr(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(){if(this.emit("destroy"),this.view){let e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,t))||null}$nodes(e,t){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e);return new Hr(t,this)}get $doc(){return this.$pos(0)}};function Cu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=N(n.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:s}=e,o=r[r.length-1],l=r[0];if(o){let a=l.search(/\S/),c=t.from+l.indexOf(o),f=c+o.length;if(_o(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(m=>m===n.type&&m!==h.mark.type)).filter(h=>h.to>c).length)return null;ft.from&&s.delete(t.from+a,c);let u=t.from+a+o.length;s.addMark(t.from+a,u,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function Ou(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=N(n.getAttributes,void 0,r)||{},{tr:s}=e,o=t.from,l=t.to,a=n.type.create(i);if(r[1]){let c=r[0].lastIndexOf(r[1]),f=o+c;f>l?f=l:l=f+r[1].length;let d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(f,l,a)}else if(r[0]){let c=n.type.isInline?o:o-1;s.insert(c,n.type.create(i)).delete(s.mapping.map(o),s.mapping.map(l))}s.scrollIntoView()}})}function Nu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=e.doc.resolve(t.from),s=N(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,s)}})}function Tu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r})=>{let i=n.replace,s=t.from,o=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);i+=r[0].slice(l+r[1].length),s+=l;let a=s-o;a>0&&(i=r[0].slice(l-a,l)+i,s=o)}e.tr.insertText(i,s,o)}})}function Eu(n){return new Ke({find:n.find,handler:({state:e,range:t,match:r,chain:i})=>{let s=N(n.getAttributes,void 0,r)||{},o=e.tr.delete(t.from,t.to),a=o.doc.resolve(t.from).blockRange(),c=a&&Ge(a,n.type,s);if(!c)return null;if(o.wrap(a,c),n.keepMarks&&n.editor){let{selection:d,storedMarks:u}=e,{splittableMarks:h}=n.editor.extensionManager,p=u||d.$to.parentOffset&&d.$from.marks();if(p){let m=p.filter(g=>h.includes(g.type.name));o.ensureMarks(m)}}if(n.keepAttributes){let d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}let f=o.doc.resolve(t.from-1).nodeBefore;f&&f.type===n.type&&ie(o.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,f))&&o.join(t.from-1)}})}var Ro=class n{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config=k(k({},this.config),e),this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&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=N(S(this,"addOptions",{name:this.name}))),this.storage=N(S(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new n(e)}configure(e={}){let t=this.extend(B(k({},this.config),{addOptions:()=>kn(this.options,e)}));return t.name=this.name,t.parent=this.parent,t}extend(e={}){let t=new n(e);return t.parent=this,this.child=t,t.name=e.name?e.name:t.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${t.name}".`),t.options=N(S(t,"addOptions",{name:t.name})),t.storage=N(S(t,"addStorage",{name:t.name,options:t.options})),t}};function pd(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}var Po=class{constructor(e,t,r){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options=k({stopEvent:null,ignoreMutation:null},r),this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,r,i,s,o,l,a;let{view:c}=this.editor,f=e.target,d=f.nodeType===3?(t=f.parentElement)===null||t===void 0?void 0:t.closest("[data-drag-handle]"):f.closest("[data-drag-handle]");if(!this.dom||!((r=this.contentDOM)===null||r===void 0)&&r.contains(f)||!d)return;let u=0,h=0;if(this.dom!==d){let y=this.dom.getBoundingClientRect(),w=d.getBoundingClientRect(),O=(i=e.offsetX)!==null&&i!==void 0?i:(s=e.nativeEvent)===null||s===void 0?void 0:s.offsetX,A=(o=e.offsetY)!==null&&o!==void 0?o:(l=e.nativeEvent)===null||l===void 0?void 0:l.offsetY;u=w.x-y.x+O,h=w.y-y.y+A}(a=e.dataTransfer)===null||a===void 0||a.setDragImage(this.dom,u,h);let p=this.getPos();if(typeof p!="number")return;let m=M.create(c.state.doc,p),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});let r=e.target;if(!(this.dom.contains(r)&&!(!((t=this.contentDOM)===null||t===void 0)&&t.contains(r))))return!1;let s=e.type.startsWith("drag"),o=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(r.tagName)||r.isContentEditable)&&!o&&!s)return!0;let{isEditable:a}=this.editor,{isDragging:c}=this,f=!!this.node.type.spec.draggable,d=M.isSelectable(this.node),u=e.type==="copy",h=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!f&&d&&s&&e.preventDefault(),f&&s&&!c)return e.preventDefault(),!1;if(f&&a&&!c&&m){let g=r.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(c||o||u||h||p||m&&d)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(xn()||pd())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(r=>r.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let r=this.getPos();return typeof r!="number"?!1:(t.setNodeMarkup(r,void 0,k(k({},this.node.attrs),e)),!0)})}deleteNode(){let e=this.getPos();if(typeof e!="number")return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Du(n){return new Dt({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:i})=>{let s=N(n.getAttributes,void 0,r,i);if(s===!1||s===null)return null;let{tr:o}=e,l=r[r.length-1],a=r[0],c=t.to;if(l){let f=a.search(/\S/),d=t.from+a.indexOf(l),u=d+l.length;if(_o(t.from,t.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===n.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;ut.from&&o.delete(t.from+f,d),c=t.from+f+l.length,o.addMark(t.from+f,c,n.type.create(s||{})),o.removeStoredMark(n.type)}}})}function Au(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Iu(n){return typeof n=="string"}function vu(n){return new Dt({find:n.find,handler({match:e,chain:t,range:r,pasteEvent:i}){let s=N(n.getAttributes,void 0,e,i),o=N(n.getContent,void 0,s);if(s===!1||s===null)return null;let l={type:n.type.name,attrs:s};o&&(l.content=o),e.input&&t().deleteRange(r).insertContentAt(r.from,l)}})}function Ru(n){return new Dt({find:n.find,handler:({state:e,range:t,match:r})=>{let i=n.replace,s=t.from,o=t.to;if(r[1]){let l=r[0].lastIndexOf(r[1]);i+=r[0].slice(l+r[1].length),s+=l;let a=s-o;a>0&&(i=r[0].slice(l-a,l)+i,s=o)}e.tr.insertText(i,s,o)}})}var Bo=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let t=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((i,s)=>{let o=s.getMap().mapResult(i);return o.deleted&&(t=!0),o.pos},e),deleted:t}}};export{k as a,B as b,md as c,gd as d,yd as e,b as f,D as g,x as h,G as i,ct as j,oe as k,zn as l,zi as m,_e as n,C as o,qt as p,T as q,M as r,Ht as s,Y as t,le as u,Ne as v,re as w,Oc as x,gn as y,st as z,S as A,yn as B,zo as C,F as D,Bc as E,Wr as F,Fo as G,N as H,zc as I,Fc as J,Oo as K,Lo as L,Lr as M,To as N,bn as O,Lc as P,Ur as Q,Ke as R,$c as S,dn as T,kn as U,Jr as V,Wc as W,Dt as X,Hc as Y,Uc as Z,fe as _,Vo as $,_r as aa,pn as ba,Gr as ca,De as da,Wo as ea,ke as fa,Jo as ga,xn as ha,Et as ia,mn as ja,uf as ka,Ko as la,At as ma,Sn as na,Do as oa,qr as pa,Ho as qa,du as ra,Lf as sa,uu as ta,hu as ua,Vf as va,Mn as wa,Yr as xa,pu as ya,mu as za,Uo as Aa,gu as Ba,$f as Ca,jf as Da,Wf as Ea,yu as Fa,qf as Ga,_o as Ha,bu as Ia,un as Ja,Kr as Ka,Kf as La,ku as Ma,xu as Na,Ao as Oa,Xr as Pa,Su as Qa,Mu as Ra,wu as Sa,Hr as Ta,hd as Ua,vo as Va,Cu as Wa,Ou as Xa,Nu as Ya,Tu as Za,Eu as _a,Ro as $a,Po as ab,Du as bb,Au as cb,Iu as db,vu as eb,Ru as fb,Bo as gb}; +//# sourceMappingURL=chunk-7OFBBPR7.js.map diff --git a/chunk-7OFBBPR7.js.map b/chunk-7OFBBPR7.js.map new file mode 100644 index 00000000..b0c2a81d --- /dev/null +++ b/chunk-7OFBBPR7.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/orderedmap/dist/index.js","node_modules/prosemirror-model/dist/index.js","node_modules/prosemirror-transform/dist/index.js","node_modules/prosemirror-state/dist/index.js","node_modules/prosemirror-view/dist/index.js","node_modules/w3c-keyname/index.js","node_modules/prosemirror-keymap/dist/index.js","node_modules/prosemirror-commands/dist/index.js","node_modules/prosemirror-schema-list/dist/index.js","node_modules/@tiptap/core/dist/index.js"],"sourcesContent":["// ::- Persistent data structure representing an ordered mapping from\n// strings to values, with some convenient update methods.\nfunction OrderedMap(content) {\n this.content = content;\n}\nOrderedMap.prototype = {\n constructor: OrderedMap,\n find: function (key) {\n for (var i = 0; i < this.content.length; i += 2) if (this.content[i] === key) return i;\n return -1;\n },\n // :: (string) → ?any\n // Retrieve the value stored under `key`, or return undefined when\n // no such key exists.\n get: function (key) {\n var found = this.find(key);\n return found == -1 ? undefined : this.content[found + 1];\n },\n // :: (string, any, ?string) → OrderedMap\n // Create a new map by replacing the value of `key` with a new\n // value, or adding a binding to the end of the map. If `newKey` is\n // given, the key of the binding will be replaced with that key.\n update: function (key, value, newKey) {\n var self = newKey && newKey != key ? this.remove(newKey) : this;\n var found = self.find(key),\n content = self.content.slice();\n if (found == -1) {\n content.push(newKey || key, value);\n } else {\n content[found + 1] = value;\n if (newKey) content[found] = newKey;\n }\n return new OrderedMap(content);\n },\n // :: (string) → OrderedMap\n // Return a map with the given key removed, if it existed.\n remove: function (key) {\n var found = this.find(key);\n if (found == -1) return this;\n var content = this.content.slice();\n content.splice(found, 2);\n return new OrderedMap(content);\n },\n // :: (string, any) → OrderedMap\n // Add a new key to the start of the map.\n addToStart: function (key, value) {\n return new OrderedMap([key, value].concat(this.remove(key).content));\n },\n // :: (string, any) → OrderedMap\n // Add a new key to the end of the map.\n addToEnd: function (key, value) {\n var content = this.remove(key).content.slice();\n content.push(key, value);\n return new OrderedMap(content);\n },\n // :: (string, string, any) → OrderedMap\n // Add a key after the given key. If `place` is not found, the new\n // key is added to the end.\n addBefore: function (place, key, value) {\n var without = this.remove(key),\n content = without.content.slice();\n var found = without.find(place);\n content.splice(found == -1 ? content.length : found, 0, key, value);\n return new OrderedMap(content);\n },\n // :: ((key: string, value: any))\n // Call the given function for each key/value pair in the map, in\n // order.\n forEach: function (f) {\n for (var i = 0; i < this.content.length; i += 2) f(this.content[i], this.content[i + 1]);\n },\n // :: (union) → OrderedMap\n // Create a new map by prepending the keys in this map that don't\n // appear in `map` before the keys in `map`.\n prepend: function (map) {\n map = OrderedMap.from(map);\n if (!map.size) return this;\n return new OrderedMap(map.content.concat(this.subtract(map).content));\n },\n // :: (union) → OrderedMap\n // Create a new map by appending the keys in this map that don't\n // appear in `map` after the keys in `map`.\n append: function (map) {\n map = OrderedMap.from(map);\n if (!map.size) return this;\n return new OrderedMap(this.subtract(map).content.concat(map.content));\n },\n // :: (union) → OrderedMap\n // Create a map containing all the keys in this map that don't\n // appear in `map`.\n subtract: function (map) {\n var result = this;\n map = OrderedMap.from(map);\n for (var i = 0; i < map.content.length; i += 2) result = result.remove(map.content[i]);\n return result;\n },\n // :: () → Object\n // Turn ordered map into a plain object.\n toObject: function () {\n var result = {};\n this.forEach(function (key, value) {\n result[key] = value;\n });\n return result;\n },\n // :: number\n // The amount of keys in this map.\n get size() {\n return this.content.length >> 1;\n }\n};\n\n// :: (?union) → OrderedMap\n// Return a map with the given content. If null, create an empty\n// map. If given an ordered map, return that map itself. If given an\n// object, create a map from the object's properties.\nOrderedMap.from = function (value) {\n if (value instanceof OrderedMap) return value;\n var content = [];\n if (value) for (var prop in value) content.push(prop, value[prop]);\n return new OrderedMap(content);\n};\nexport default OrderedMap;","import OrderedMap from 'orderedmap';\nfunction findDiffStart(a, b, pos) {\n for (let i = 0;; i++) {\n if (i == a.childCount || i == b.childCount) return a.childCount == b.childCount ? null : pos;\n let childA = a.child(i),\n childB = b.child(i);\n if (childA == childB) {\n pos += childA.nodeSize;\n continue;\n }\n if (!childA.sameMarkup(childB)) return pos;\n if (childA.isText && childA.text != childB.text) {\n for (let j = 0; childA.text[j] == childB.text[j]; j++) pos++;\n return pos;\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffStart(childA.content, childB.content, pos + 1);\n if (inner != null) return inner;\n }\n pos += childA.nodeSize;\n }\n}\nfunction findDiffEnd(a, b, posA, posB) {\n for (let iA = a.childCount, iB = b.childCount;;) {\n if (iA == 0 || iB == 0) return iA == iB ? null : {\n a: posA,\n b: posB\n };\n let childA = a.child(--iA),\n childB = b.child(--iB),\n size = childA.nodeSize;\n if (childA == childB) {\n posA -= size;\n posB -= size;\n continue;\n }\n if (!childA.sameMarkup(childB)) return {\n a: posA,\n b: posB\n };\n if (childA.isText && childA.text != childB.text) {\n let same = 0,\n minSize = Math.min(childA.text.length, childB.text.length);\n while (same < minSize && childA.text[childA.text.length - same - 1] == childB.text[childB.text.length - same - 1]) {\n same++;\n posA--;\n posB--;\n }\n return {\n a: posA,\n b: posB\n };\n }\n if (childA.content.size || childB.content.size) {\n let inner = findDiffEnd(childA.content, childB.content, posA - 1, posB - 1);\n if (inner) return inner;\n }\n posA -= size;\n posB -= size;\n }\n}\n\n/**\nA fragment represents a node's collection of child nodes.\n\nLike nodes, fragments are persistent data structures, and you\nshould not mutate them or their content. Rather, you create new\ninstances whenever needed. The API tries to make this easy.\n*/\nclass Fragment {\n /**\n @internal\n */\n constructor(\n /**\n The child nodes in this fragment.\n */\n content, size) {\n this.content = content;\n this.size = size || 0;\n if (size == null) for (let i = 0; i < content.length; i++) this.size += content[i].nodeSize;\n }\n /**\n Invoke a callback for all descendant nodes between the given two\n positions (relative to start of this fragment). Doesn't descend\n into a node when the callback returns `false`.\n */\n nodesBetween(from, to, f, nodeStart = 0, parent) {\n for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i],\n end = pos + child.nodeSize;\n if (end > from && f(child, nodeStart + pos, parent || null, i) !== false && child.content.size) {\n let start = pos + 1;\n child.nodesBetween(Math.max(0, from - start), Math.min(child.content.size, to - start), f, nodeStart + start);\n }\n pos = end;\n }\n }\n /**\n Call the given callback for every descendant node. `pos` will be\n relative to the start of the fragment. The callback may return\n `false` to prevent traversal of a given node's children.\n */\n descendants(f) {\n this.nodesBetween(0, this.size, f);\n }\n /**\n Extract the text between `from` and `to`. See the same method on\n [`Node`](https://prosemirror.net/docs/ref/#model.Node.textBetween).\n */\n textBetween(from, to, blockSeparator, leafText) {\n let text = \"\",\n first = true;\n this.nodesBetween(from, to, (node, pos) => {\n let nodeText = node.isText ? node.text.slice(Math.max(from, pos) - pos, to - pos) : !node.isLeaf ? \"\" : leafText ? typeof leafText === \"function\" ? leafText(node) : leafText : node.type.spec.leafText ? node.type.spec.leafText(node) : \"\";\n if (node.isBlock && (node.isLeaf && nodeText || node.isTextblock) && blockSeparator) {\n if (first) first = false;else text += blockSeparator;\n }\n text += nodeText;\n }, 0);\n return text;\n }\n /**\n Create a new fragment containing the combined content of this\n fragment and the other.\n */\n append(other) {\n if (!other.size) return this;\n if (!this.size) return other;\n let last = this.lastChild,\n first = other.firstChild,\n content = this.content.slice(),\n i = 0;\n if (last.isText && last.sameMarkup(first)) {\n content[content.length - 1] = last.withText(last.text + first.text);\n i = 1;\n }\n for (; i < other.content.length; i++) content.push(other.content[i]);\n return new Fragment(content, this.size + other.size);\n }\n /**\n Cut out the sub-fragment between the two given positions.\n */\n cut(from, to = this.size) {\n if (from == 0 && to == this.size) return this;\n let result = [],\n size = 0;\n if (to > from) for (let i = 0, pos = 0; pos < to; i++) {\n let child = this.content[i],\n end = pos + child.nodeSize;\n if (end > from) {\n if (pos < from || end > to) {\n if (child.isText) child = child.cut(Math.max(0, from - pos), Math.min(child.text.length, to - pos));else child = child.cut(Math.max(0, from - pos - 1), Math.min(child.content.size, to - pos - 1));\n }\n result.push(child);\n size += child.nodeSize;\n }\n pos = end;\n }\n return new Fragment(result, size);\n }\n /**\n @internal\n */\n cutByIndex(from, to) {\n if (from == to) return Fragment.empty;\n if (from == 0 && to == this.content.length) return this;\n return new Fragment(this.content.slice(from, to));\n }\n /**\n Create a new fragment in which the node at the given index is\n replaced by the given node.\n */\n replaceChild(index, node) {\n let current = this.content[index];\n if (current == node) return this;\n let copy = this.content.slice();\n let size = this.size + node.nodeSize - current.nodeSize;\n copy[index] = node;\n return new Fragment(copy, size);\n }\n /**\n Create a new fragment by prepending the given node to this\n fragment.\n */\n addToStart(node) {\n return new Fragment([node].concat(this.content), this.size + node.nodeSize);\n }\n /**\n Create a new fragment by appending the given node to this\n fragment.\n */\n addToEnd(node) {\n return new Fragment(this.content.concat(node), this.size + node.nodeSize);\n }\n /**\n Compare this fragment to another one.\n */\n eq(other) {\n if (this.content.length != other.content.length) return false;\n for (let i = 0; i < this.content.length; i++) if (!this.content[i].eq(other.content[i])) return false;\n return true;\n }\n /**\n The first child of the fragment, or `null` if it is empty.\n */\n get firstChild() {\n return this.content.length ? this.content[0] : null;\n }\n /**\n The last child of the fragment, or `null` if it is empty.\n */\n get lastChild() {\n return this.content.length ? this.content[this.content.length - 1] : null;\n }\n /**\n The number of child nodes in this fragment.\n */\n get childCount() {\n return this.content.length;\n }\n /**\n Get the child node at the given index. Raise an error when the\n index is out of range.\n */\n child(index) {\n let found = this.content[index];\n if (!found) throw new RangeError(\"Index \" + index + \" out of range for \" + this);\n return found;\n }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) {\n return this.content[index] || null;\n }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) {\n for (let i = 0, p = 0; i < this.content.length; i++) {\n let child = this.content[i];\n f(child, p, i);\n p += child.nodeSize;\n }\n }\n /**\n Find the first position at which this fragment and another\n fragment differ, or `null` if they are the same.\n */\n findDiffStart(other, pos = 0) {\n return findDiffStart(this, other, pos);\n }\n /**\n Find the first position, searching from the end, at which this\n fragment and the given fragment differ, or `null` if they are\n the same. Since this position will not be the same in both\n nodes, an object with two separate positions is returned.\n */\n findDiffEnd(other, pos = this.size, otherPos = other.size) {\n return findDiffEnd(this, other, pos, otherPos);\n }\n /**\n Find the index and inner offset corresponding to a given relative\n position in this fragment. The result object will be reused\n (overwritten) the next time the function is called. @internal\n */\n findIndex(pos, round = -1) {\n if (pos == 0) return retIndex(0, pos);\n if (pos == this.size) return retIndex(this.content.length, pos);\n if (pos > this.size || pos < 0) throw new RangeError(`Position ${pos} outside of fragment (${this})`);\n for (let i = 0, curPos = 0;; i++) {\n let cur = this.child(i),\n end = curPos + cur.nodeSize;\n if (end >= pos) {\n if (end == pos || round > 0) return retIndex(i + 1, end);\n return retIndex(i, curPos);\n }\n curPos = end;\n }\n }\n /**\n Return a debugging string that describes this fragment.\n */\n toString() {\n return \"<\" + this.toStringInner() + \">\";\n }\n /**\n @internal\n */\n toStringInner() {\n return this.content.join(\", \");\n }\n /**\n Create a JSON-serializeable representation of this fragment.\n */\n toJSON() {\n return this.content.length ? this.content.map(n => n.toJSON()) : null;\n }\n /**\n Deserialize a fragment from its JSON representation.\n */\n static fromJSON(schema, value) {\n if (!value) return Fragment.empty;\n if (!Array.isArray(value)) throw new RangeError(\"Invalid input for Fragment.fromJSON\");\n return new Fragment(value.map(schema.nodeFromJSON));\n }\n /**\n Build a fragment from an array of nodes. Ensures that adjacent\n text nodes with the same marks are joined together.\n */\n static fromArray(array) {\n if (!array.length) return Fragment.empty;\n let joined,\n size = 0;\n for (let i = 0; i < array.length; i++) {\n let node = array[i];\n size += node.nodeSize;\n if (i && node.isText && array[i - 1].sameMarkup(node)) {\n if (!joined) joined = array.slice(0, i);\n joined[joined.length - 1] = node.withText(joined[joined.length - 1].text + node.text);\n } else if (joined) {\n joined.push(node);\n }\n }\n return new Fragment(joined || array, size);\n }\n /**\n Create a fragment from something that can be interpreted as a\n set of nodes. For `null`, it returns the empty fragment. For a\n fragment, the fragment itself. For a node or array of nodes, a\n fragment containing those nodes.\n */\n static from(nodes) {\n if (!nodes) return Fragment.empty;\n if (nodes instanceof Fragment) return nodes;\n if (Array.isArray(nodes)) return this.fromArray(nodes);\n if (nodes.attrs) return new Fragment([nodes], nodes.nodeSize);\n throw new RangeError(\"Can not convert \" + nodes + \" to a Fragment\" + (nodes.nodesBetween ? \" (looks like multiple versions of prosemirror-model were loaded)\" : \"\"));\n }\n}\n/**\nAn empty fragment. Intended to be reused whenever a node doesn't\ncontain anything (rather than allocating a new empty fragment for\neach leaf node).\n*/\nFragment.empty = new Fragment([], 0);\nconst found = {\n index: 0,\n offset: 0\n};\nfunction retIndex(index, offset) {\n found.index = index;\n found.offset = offset;\n return found;\n}\nfunction compareDeep(a, b) {\n if (a === b) return true;\n if (!(a && typeof a == \"object\") || !(b && typeof b == \"object\")) return false;\n let array = Array.isArray(a);\n if (Array.isArray(b) != array) return false;\n if (array) {\n if (a.length != b.length) return false;\n for (let i = 0; i < a.length; i++) if (!compareDeep(a[i], b[i])) return false;\n } else {\n for (let p in a) if (!(p in b) || !compareDeep(a[p], b[p])) return false;\n for (let p in b) if (!(p in a)) return false;\n }\n return true;\n}\n\n/**\nA mark is a piece of information that can be attached to a node,\nsuch as it being emphasized, in code font, or a link. It has a\ntype and optionally a set of attributes that provide further\ninformation (such as the target of the link). Marks are created\nthrough a `Schema`, which controls which types exist and which\nattributes they have.\n*/\nlet Mark = /*#__PURE__*/(() => {\n class Mark {\n /**\n @internal\n */\n constructor(\n /**\n The type of this mark.\n */\n type,\n /**\n The attributes associated with this mark.\n */\n attrs) {\n this.type = type;\n this.attrs = attrs;\n }\n /**\n Given a set of marks, create a new set which contains this one as\n well, in the right position. If this mark is already in the set,\n the set itself is returned. If any marks that are set to be\n [exclusive](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) with this mark are present,\n those are replaced by this one.\n */\n addToSet(set) {\n let copy,\n placed = false;\n for (let i = 0; i < set.length; i++) {\n let other = set[i];\n if (this.eq(other)) return set;\n if (this.type.excludes(other.type)) {\n if (!copy) copy = set.slice(0, i);\n } else if (other.type.excludes(this.type)) {\n return set;\n } else {\n if (!placed && other.type.rank > this.type.rank) {\n if (!copy) copy = set.slice(0, i);\n copy.push(this);\n placed = true;\n }\n if (copy) copy.push(other);\n }\n }\n if (!copy) copy = set.slice();\n if (!placed) copy.push(this);\n return copy;\n }\n /**\n Remove this mark from the given set, returning a new set. If this\n mark is not in the set, the set itself is returned.\n */\n removeFromSet(set) {\n for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return set.slice(0, i).concat(set.slice(i + 1));\n return set;\n }\n /**\n Test whether this mark is in the given set of marks.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++) if (this.eq(set[i])) return true;\n return false;\n }\n /**\n Test whether this mark has the same type and attributes as\n another mark.\n */\n eq(other) {\n return this == other || this.type == other.type && compareDeep(this.attrs, other.attrs);\n }\n /**\n Convert this mark to a JSON-serializeable representation.\n */\n toJSON() {\n let obj = {\n type: this.type.name\n };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n return obj;\n }\n /**\n Deserialize a mark from JSON.\n */\n static fromJSON(schema, json) {\n if (!json) throw new RangeError(\"Invalid input for Mark.fromJSON\");\n let type = schema.marks[json.type];\n if (!type) throw new RangeError(`There is no mark type ${json.type} in this schema`);\n let mark = type.create(json.attrs);\n type.checkAttrs(mark.attrs);\n return mark;\n }\n /**\n Test whether two sets of marks are identical.\n */\n static sameSet(a, b) {\n if (a == b) return true;\n if (a.length != b.length) return false;\n for (let i = 0; i < a.length; i++) if (!a[i].eq(b[i])) return false;\n return true;\n }\n /**\n Create a properly sorted mark set from null, a single mark, or an\n unsorted array of marks.\n */\n static setFrom(marks) {\n if (!marks || Array.isArray(marks) && marks.length == 0) return Mark.none;\n if (marks instanceof Mark) return [marks];\n let copy = marks.slice();\n copy.sort((a, b) => a.type.rank - b.type.rank);\n return copy;\n }\n }\n /**\n The empty set of marks.\n */\n Mark.none = [];\n\n /**\n Error type raised by [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) when\n given an invalid replacement.\n */\n return Mark;\n})();\nclass ReplaceError extends Error {}\n/*\nReplaceError = function(this: any, message: string) {\n let err = Error.call(this, message)\n ;(err as any).__proto__ = ReplaceError.prototype\n return err\n} as any\n\nReplaceError.prototype = Object.create(Error.prototype)\nReplaceError.prototype.constructor = ReplaceError\nReplaceError.prototype.name = \"ReplaceError\"\n*/\n/**\nA slice represents a piece cut out of a larger document. It\nstores not only a fragment, but also the depth up to which nodes on\nboth side are ‘open’ (cut through).\n*/\nclass Slice {\n /**\n Create a slice. When specifying a non-zero open depth, you must\n make sure that there are nodes of at least that depth at the\n appropriate side of the fragment—i.e. if the fragment is an\n empty paragraph node, `openStart` and `openEnd` can't be greater\n than 1.\n \n It is not necessary for the content of open nodes to conform to\n the schema's content constraints, though it should be a valid\n start/end/middle for such a node, depending on which sides are\n open.\n */\n constructor(\n /**\n The slice's content.\n */\n content,\n /**\n The open depth at the start of the fragment.\n */\n openStart,\n /**\n The open depth at the end.\n */\n openEnd) {\n this.content = content;\n this.openStart = openStart;\n this.openEnd = openEnd;\n }\n /**\n The size this slice would add when inserted into a document.\n */\n get size() {\n return this.content.size - this.openStart - this.openEnd;\n }\n /**\n @internal\n */\n insertAt(pos, fragment) {\n let content = insertInto(this.content, pos + this.openStart, fragment);\n return content && new Slice(content, this.openStart, this.openEnd);\n }\n /**\n @internal\n */\n removeBetween(from, to) {\n return new Slice(removeRange(this.content, from + this.openStart, to + this.openStart), this.openStart, this.openEnd);\n }\n /**\n Tests whether this slice is equal to another slice.\n */\n eq(other) {\n return this.content.eq(other.content) && this.openStart == other.openStart && this.openEnd == other.openEnd;\n }\n /**\n @internal\n */\n toString() {\n return this.content + \"(\" + this.openStart + \",\" + this.openEnd + \")\";\n }\n /**\n Convert a slice to a JSON-serializable representation.\n */\n toJSON() {\n if (!this.content.size) return null;\n let json = {\n content: this.content.toJSON()\n };\n if (this.openStart > 0) json.openStart = this.openStart;\n if (this.openEnd > 0) json.openEnd = this.openEnd;\n return json;\n }\n /**\n Deserialize a slice from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json) return Slice.empty;\n let openStart = json.openStart || 0,\n openEnd = json.openEnd || 0;\n if (typeof openStart != \"number\" || typeof openEnd != \"number\") throw new RangeError(\"Invalid input for Slice.fromJSON\");\n return new Slice(Fragment.fromJSON(schema, json.content), openStart, openEnd);\n }\n /**\n Create a slice from a fragment by taking the maximum possible\n open value on both side of the fragment.\n */\n static maxOpen(fragment, openIsolating = true) {\n let openStart = 0,\n openEnd = 0;\n for (let n = fragment.firstChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.firstChild) openStart++;\n for (let n = fragment.lastChild; n && !n.isLeaf && (openIsolating || !n.type.spec.isolating); n = n.lastChild) openEnd++;\n return new Slice(fragment, openStart, openEnd);\n }\n}\n/**\nThe empty slice.\n*/\nSlice.empty = new Slice(Fragment.empty, 0, 0);\nfunction removeRange(content, from, to) {\n let {\n index,\n offset\n } = content.findIndex(from),\n child = content.maybeChild(index);\n let {\n index: indexTo,\n offset: offsetTo\n } = content.findIndex(to);\n if (offset == from || child.isText) {\n if (offsetTo != to && !content.child(indexTo).isText) throw new RangeError(\"Removing non-flat range\");\n return content.cut(0, from).append(content.cut(to));\n }\n if (index != indexTo) throw new RangeError(\"Removing non-flat range\");\n return content.replaceChild(index, child.copy(removeRange(child.content, from - offset - 1, to - offset - 1)));\n}\nfunction insertInto(content, dist, insert, parent) {\n let {\n index,\n offset\n } = content.findIndex(dist),\n child = content.maybeChild(index);\n if (offset == dist || child.isText) {\n if (parent && !parent.canReplace(index, index, insert)) return null;\n return content.cut(0, dist).append(insert).append(content.cut(dist));\n }\n let inner = insertInto(child.content, dist - offset - 1, insert);\n return inner && content.replaceChild(index, child.copy(inner));\n}\nfunction replace($from, $to, slice) {\n if (slice.openStart > $from.depth) throw new ReplaceError(\"Inserted content deeper than insertion position\");\n if ($from.depth - slice.openStart != $to.depth - slice.openEnd) throw new ReplaceError(\"Inconsistent open depths\");\n return replaceOuter($from, $to, slice, 0);\n}\nfunction replaceOuter($from, $to, slice, depth) {\n let index = $from.index(depth),\n node = $from.node(depth);\n if (index == $to.index(depth) && depth < $from.depth - slice.openStart) {\n let inner = replaceOuter($from, $to, slice, depth + 1);\n return node.copy(node.content.replaceChild(index, inner));\n } else if (!slice.content.size) {\n return close(node, replaceTwoWay($from, $to, depth));\n } else if (!slice.openStart && !slice.openEnd && $from.depth == depth && $to.depth == depth) {\n // Simple, flat case\n let parent = $from.parent,\n content = parent.content;\n return close(parent, content.cut(0, $from.parentOffset).append(slice.content).append(content.cut($to.parentOffset)));\n } else {\n let {\n start,\n end\n } = prepareSliceForReplace(slice, $from);\n return close(node, replaceThreeWay($from, start, end, $to, depth));\n }\n}\nfunction checkJoin(main, sub) {\n if (!sub.type.compatibleContent(main.type)) throw new ReplaceError(\"Cannot join \" + sub.type.name + \" onto \" + main.type.name);\n}\nfunction joinable($before, $after, depth) {\n let node = $before.node(depth);\n checkJoin(node, $after.node(depth));\n return node;\n}\nfunction addNode(child, target) {\n let last = target.length - 1;\n if (last >= 0 && child.isText && child.sameMarkup(target[last])) target[last] = child.withText(target[last].text + child.text);else target.push(child);\n}\nfunction addRange($start, $end, depth, target) {\n let node = ($end || $start).node(depth);\n let startIndex = 0,\n endIndex = $end ? $end.index(depth) : node.childCount;\n if ($start) {\n startIndex = $start.index(depth);\n if ($start.depth > depth) {\n startIndex++;\n } else if ($start.textOffset) {\n addNode($start.nodeAfter, target);\n startIndex++;\n }\n }\n for (let i = startIndex; i < endIndex; i++) addNode(node.child(i), target);\n if ($end && $end.depth == depth && $end.textOffset) addNode($end.nodeBefore, target);\n}\nfunction close(node, content) {\n node.type.checkContent(content);\n return node.copy(content);\n}\nfunction replaceThreeWay($from, $start, $end, $to, depth) {\n let openStart = $from.depth > depth && joinable($from, $start, depth + 1);\n let openEnd = $to.depth > depth && joinable($end, $to, depth + 1);\n let content = [];\n addRange(null, $from, depth, content);\n if (openStart && openEnd && $start.index(depth) == $end.index(depth)) {\n checkJoin(openStart, openEnd);\n addNode(close(openStart, replaceThreeWay($from, $start, $end, $to, depth + 1)), content);\n } else {\n if (openStart) addNode(close(openStart, replaceTwoWay($from, $start, depth + 1)), content);\n addRange($start, $end, depth, content);\n if (openEnd) addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction replaceTwoWay($from, $to, depth) {\n let content = [];\n addRange(null, $from, depth, content);\n if ($from.depth > depth) {\n let type = joinable($from, $to, depth + 1);\n addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);\n }\n addRange($to, null, depth, content);\n return new Fragment(content);\n}\nfunction prepareSliceForReplace(slice, $along) {\n let extra = $along.depth - slice.openStart,\n parent = $along.node(extra);\n let node = parent.copy(slice.content);\n for (let i = extra - 1; i >= 0; i--) node = $along.node(i).copy(Fragment.from(node));\n return {\n start: node.resolveNoCache(slice.openStart + extra),\n end: node.resolveNoCache(node.content.size - slice.openEnd - extra)\n };\n}\n\n/**\nYou can [_resolve_](https://prosemirror.net/docs/ref/#model.Node.resolve) a position to get more\ninformation about it. Objects of this class represent such a\nresolved position, providing various pieces of context\ninformation, and some helper methods.\n\nThroughout this interface, methods that take an optional `depth`\nparameter will interpret undefined as `this.depth` and negative\nnumbers as `this.depth + value`.\n*/\nclass ResolvedPos {\n /**\n @internal\n */\n constructor(\n /**\n The position that was resolved.\n */\n pos,\n /**\n @internal\n */\n path,\n /**\n The offset this position has into its parent node.\n */\n parentOffset) {\n this.pos = pos;\n this.path = path;\n this.parentOffset = parentOffset;\n this.depth = path.length / 3 - 1;\n }\n /**\n @internal\n */\n resolveDepth(val) {\n if (val == null) return this.depth;\n if (val < 0) return this.depth + val;\n return val;\n }\n /**\n The parent node that the position points into. Note that even if\n a position points into a text node, that node is not considered\n the parent—text nodes are ‘flat’ in this model, and have no content.\n */\n get parent() {\n return this.node(this.depth);\n }\n /**\n The root node in which the position was resolved.\n */\n get doc() {\n return this.node(0);\n }\n /**\n The ancestor node at the given level. `p.node(p.depth)` is the\n same as `p.parent`.\n */\n node(depth) {\n return this.path[this.resolveDepth(depth) * 3];\n }\n /**\n The index into the ancestor at the given level. If this points\n at the 3rd node in the 2nd paragraph on the top level, for\n example, `p.index(0)` is 1 and `p.index(1)` is 2.\n */\n index(depth) {\n return this.path[this.resolveDepth(depth) * 3 + 1];\n }\n /**\n The index pointing after this position into the ancestor at the\n given level.\n */\n indexAfter(depth) {\n depth = this.resolveDepth(depth);\n return this.index(depth) + (depth == this.depth && !this.textOffset ? 0 : 1);\n }\n /**\n The (absolute) position at the start of the node at the given\n level.\n */\n start(depth) {\n depth = this.resolveDepth(depth);\n return depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n }\n /**\n The (absolute) position at the end of the node at the given\n level.\n */\n end(depth) {\n depth = this.resolveDepth(depth);\n return this.start(depth) + this.node(depth).content.size;\n }\n /**\n The (absolute) position directly before the wrapping node at the\n given level, or, when `depth` is `this.depth + 1`, the original\n position.\n */\n before(depth) {\n depth = this.resolveDepth(depth);\n if (!depth) throw new RangeError(\"There is no position before the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1];\n }\n /**\n The (absolute) position directly after the wrapping node at the\n given level, or the original position when `depth` is `this.depth + 1`.\n */\n after(depth) {\n depth = this.resolveDepth(depth);\n if (!depth) throw new RangeError(\"There is no position after the top-level node\");\n return depth == this.depth + 1 ? this.pos : this.path[depth * 3 - 1] + this.path[depth * 3].nodeSize;\n }\n /**\n When this position points into a text node, this returns the\n distance between the position and the start of the text node.\n Will be zero for positions that point between nodes.\n */\n get textOffset() {\n return this.pos - this.path[this.path.length - 1];\n }\n /**\n Get the node directly after the position, if any. If the position\n points into a text node, only the part of that node after the\n position is returned.\n */\n get nodeAfter() {\n let parent = this.parent,\n index = this.index(this.depth);\n if (index == parent.childCount) return null;\n let dOff = this.pos - this.path[this.path.length - 1],\n child = parent.child(index);\n return dOff ? parent.child(index).cut(dOff) : child;\n }\n /**\n Get the node directly before the position, if any. If the\n position points into a text node, only the part of that node\n before the position is returned.\n */\n get nodeBefore() {\n let index = this.index(this.depth);\n let dOff = this.pos - this.path[this.path.length - 1];\n if (dOff) return this.parent.child(index).cut(0, dOff);\n return index == 0 ? null : this.parent.child(index - 1);\n }\n /**\n Get the position at the given index in the parent node at the\n given depth (which defaults to `this.depth`).\n */\n posAtIndex(index, depth) {\n depth = this.resolveDepth(depth);\n let node = this.path[depth * 3],\n pos = depth == 0 ? 0 : this.path[depth * 3 - 1] + 1;\n for (let i = 0; i < index; i++) pos += node.child(i).nodeSize;\n return pos;\n }\n /**\n Get the marks at this position, factoring in the surrounding\n marks' [`inclusive`](https://prosemirror.net/docs/ref/#model.MarkSpec.inclusive) property. If the\n position is at the start of a non-empty node, the marks of the\n node after it (if any) are returned.\n */\n marks() {\n let parent = this.parent,\n index = this.index();\n // In an empty parent, return the empty array\n if (parent.content.size == 0) return Mark.none;\n // When inside a text node, just return the text node's marks\n if (this.textOffset) return parent.child(index).marks;\n let main = parent.maybeChild(index - 1),\n other = parent.maybeChild(index);\n // If the `after` flag is true of there is no node before, make\n // the node after this position the main reference.\n if (!main) {\n let tmp = main;\n main = other;\n other = tmp;\n }\n // Use all marks in the main node, except those that have\n // `inclusive` set to false and are not present in the other node.\n let marks = main.marks;\n for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!other || !marks[i].isInSet(other.marks))) marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n Get the marks after the current position, if any, except those\n that are non-inclusive and not present at position `$end`. This\n is mostly useful for getting the set of marks to preserve after a\n deletion. Will return `null` if this position is at the end of\n its parent node or its parent node isn't a textblock (in which\n case no marks should be preserved).\n */\n marksAcross($end) {\n let after = this.parent.maybeChild(this.index());\n if (!after || !after.isInline) return null;\n let marks = after.marks,\n next = $end.parent.maybeChild($end.index());\n for (var i = 0; i < marks.length; i++) if (marks[i].type.spec.inclusive === false && (!next || !marks[i].isInSet(next.marks))) marks = marks[i--].removeFromSet(marks);\n return marks;\n }\n /**\n The depth up to which this position and the given (non-resolved)\n position share the same parent nodes.\n */\n sharedDepth(pos) {\n for (let depth = this.depth; depth > 0; depth--) if (this.start(depth) <= pos && this.end(depth) >= pos) return depth;\n return 0;\n }\n /**\n Returns a range based on the place where this position and the\n given position diverge around block content. If both point into\n the same textblock, for example, a range around that textblock\n will be returned. If they point into different blocks, the range\n around those blocks in their shared ancestor is returned. You can\n pass in an optional predicate that will be called with a parent\n node to see if a range into that parent is acceptable.\n */\n blockRange(other = this, pred) {\n if (other.pos < this.pos) return other.blockRange(this);\n for (let d = this.depth - (this.parent.inlineContent || this.pos == other.pos ? 1 : 0); d >= 0; d--) if (other.pos <= this.end(d) && (!pred || pred(this.node(d)))) return new NodeRange(this, other, d);\n return null;\n }\n /**\n Query whether the given position shares the same parent node.\n */\n sameParent(other) {\n return this.pos - this.parentOffset == other.pos - other.parentOffset;\n }\n /**\n Return the greater of this and the given position.\n */\n max(other) {\n return other.pos > this.pos ? other : this;\n }\n /**\n Return the smaller of this and the given position.\n */\n min(other) {\n return other.pos < this.pos ? other : this;\n }\n /**\n @internal\n */\n toString() {\n let str = \"\";\n for (let i = 1; i <= this.depth; i++) str += (str ? \"/\" : \"\") + this.node(i).type.name + \"_\" + this.index(i - 1);\n return str + \":\" + this.parentOffset;\n }\n /**\n @internal\n */\n static resolve(doc, pos) {\n if (!(pos >= 0 && pos <= doc.content.size)) throw new RangeError(\"Position \" + pos + \" out of range\");\n let path = [];\n let start = 0,\n parentOffset = pos;\n for (let node = doc;;) {\n let {\n index,\n offset\n } = node.content.findIndex(parentOffset);\n let rem = parentOffset - offset;\n path.push(node, index, start + offset);\n if (!rem) break;\n node = node.child(index);\n if (node.isText) break;\n parentOffset = rem - 1;\n start += offset + 1;\n }\n return new ResolvedPos(pos, path, parentOffset);\n }\n /**\n @internal\n */\n static resolveCached(doc, pos) {\n let cache = resolveCache.get(doc);\n if (cache) {\n for (let i = 0; i < cache.elts.length; i++) {\n let elt = cache.elts[i];\n if (elt.pos == pos) return elt;\n }\n } else {\n resolveCache.set(doc, cache = new ResolveCache());\n }\n let result = cache.elts[cache.i] = ResolvedPos.resolve(doc, pos);\n cache.i = (cache.i + 1) % resolveCacheSize;\n return result;\n }\n}\nclass ResolveCache {\n constructor() {\n this.elts = [];\n this.i = 0;\n }\n}\nconst resolveCacheSize = 12,\n resolveCache = new WeakMap();\n/**\nRepresents a flat range of content, i.e. one that starts and\nends in the same node.\n*/\nclass NodeRange {\n /**\n Construct a node range. `$from` and `$to` should point into the\n same node until at least the given `depth`, since a node range\n denotes an adjacent set of nodes in a single parent node.\n */\n constructor(\n /**\n A resolved position along the start of the content. May have a\n `depth` greater than this object's `depth` property, since\n these are the positions that were used to compute the range,\n not re-resolved positions directly at its boundaries.\n */\n $from,\n /**\n A position along the end of the content. See\n caveat for [`$from`](https://prosemirror.net/docs/ref/#model.NodeRange.$from).\n */\n $to,\n /**\n The depth of the node that this range points into.\n */\n depth) {\n this.$from = $from;\n this.$to = $to;\n this.depth = depth;\n }\n /**\n The position at the start of the range.\n */\n get start() {\n return this.$from.before(this.depth + 1);\n }\n /**\n The position at the end of the range.\n */\n get end() {\n return this.$to.after(this.depth + 1);\n }\n /**\n The parent node that the range points into.\n */\n get parent() {\n return this.$from.node(this.depth);\n }\n /**\n The start index of the range in the parent node.\n */\n get startIndex() {\n return this.$from.index(this.depth);\n }\n /**\n The end index of the range in the parent node.\n */\n get endIndex() {\n return this.$to.indexAfter(this.depth);\n }\n}\nconst emptyAttrs = Object.create(null);\n/**\nThis class represents a node in the tree that makes up a\nProseMirror document. So a document is an instance of `Node`, with\nchildren that are also instances of `Node`.\n\nNodes are persistent data structures. Instead of changing them, you\ncreate new ones with the content you want. Old ones keep pointing\nat the old document shape. This is made cheaper by sharing\nstructure between the old and new data as much as possible, which a\ntree shape like this (without back pointers) makes easy.\n\n**Do not** directly mutate the properties of a `Node` object. See\n[the guide](/docs/guide/#doc) for more information.\n*/\nclass Node {\n /**\n @internal\n */\n constructor(\n /**\n The type of node that this is.\n */\n type,\n /**\n An object mapping attribute names to values. The kind of\n attributes allowed and required are\n [determined](https://prosemirror.net/docs/ref/#model.NodeSpec.attrs) by the node type.\n */\n attrs,\n // A fragment holding the node's children.\n content,\n /**\n The marks (things like whether it is emphasized or part of a\n link) applied to this node.\n */\n marks = Mark.none) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.content = content || Fragment.empty;\n }\n /**\n The array of this node's child nodes.\n */\n get children() {\n return this.content.content;\n }\n /**\n The size of this node, as defined by the integer-based [indexing\n scheme](/docs/guide/#doc.indexing). For text nodes, this is the\n amount of characters. For other leaf nodes, it is one. For\n non-leaf nodes, it is the size of the content plus two (the\n start and end token).\n */\n get nodeSize() {\n return this.isLeaf ? 1 : 2 + this.content.size;\n }\n /**\n The number of children that the node has.\n */\n get childCount() {\n return this.content.childCount;\n }\n /**\n Get the child node at the given index. Raises an error when the\n index is out of range.\n */\n child(index) {\n return this.content.child(index);\n }\n /**\n Get the child node at the given index, if it exists.\n */\n maybeChild(index) {\n return this.content.maybeChild(index);\n }\n /**\n Call `f` for every child node, passing the node, its offset\n into this parent node, and its index.\n */\n forEach(f) {\n this.content.forEach(f);\n }\n /**\n Invoke a callback for all descendant nodes recursively between\n the given two positions that are relative to start of this\n node's content. The callback is invoked with the node, its\n position relative to the original node (method receiver),\n its parent node, and its child index. When the callback returns\n false for a given node, that node's children will not be\n recursed over. The last parameter can be used to specify a\n starting position to count from.\n */\n nodesBetween(from, to, f, startPos = 0) {\n this.content.nodesBetween(from, to, f, startPos, this);\n }\n /**\n Call the given callback for every descendant node. Doesn't\n descend into a node when the callback returns `false`.\n */\n descendants(f) {\n this.nodesBetween(0, this.content.size, f);\n }\n /**\n Concatenates all the text nodes found in this fragment and its\n children.\n */\n get textContent() {\n return this.isLeaf && this.type.spec.leafText ? this.type.spec.leafText(this) : this.textBetween(0, this.content.size, \"\");\n }\n /**\n Get all text between positions `from` and `to`. When\n `blockSeparator` is given, it will be inserted to separate text\n from different block nodes. If `leafText` is given, it'll be\n inserted for every non-text leaf node encountered, otherwise\n [`leafText`](https://prosemirror.net/docs/ref/#model.NodeSpec^leafText) will be used.\n */\n textBetween(from, to, blockSeparator, leafText) {\n return this.content.textBetween(from, to, blockSeparator, leafText);\n }\n /**\n Returns this node's first child, or `null` if there are no\n children.\n */\n get firstChild() {\n return this.content.firstChild;\n }\n /**\n Returns this node's last child, or `null` if there are no\n children.\n */\n get lastChild() {\n return this.content.lastChild;\n }\n /**\n Test whether two nodes represent the same piece of document.\n */\n eq(other) {\n return this == other || this.sameMarkup(other) && this.content.eq(other.content);\n }\n /**\n Compare the markup (type, attributes, and marks) of this node to\n those of another. Returns `true` if both have the same markup.\n */\n sameMarkup(other) {\n return this.hasMarkup(other.type, other.attrs, other.marks);\n }\n /**\n Check whether this node's markup correspond to the given type,\n attributes, and marks.\n */\n hasMarkup(type, attrs, marks) {\n return this.type == type && compareDeep(this.attrs, attrs || type.defaultAttrs || emptyAttrs) && Mark.sameSet(this.marks, marks || Mark.none);\n }\n /**\n Create a new node with the same markup as this node, containing\n the given content (or empty, if no content is given).\n */\n copy(content = null) {\n if (content == this.content) return this;\n return new Node(this.type, this.attrs, content, this.marks);\n }\n /**\n Create a copy of this node, with the given set of marks instead\n of the node's own marks.\n */\n mark(marks) {\n return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);\n }\n /**\n Create a copy of this node with only the content between the\n given positions. If `to` is not given, it defaults to the end of\n the node.\n */\n cut(from, to = this.content.size) {\n if (from == 0 && to == this.content.size) return this;\n return this.copy(this.content.cut(from, to));\n }\n /**\n Cut out the part of the document between the given positions, and\n return it as a `Slice` object.\n */\n slice(from, to = this.content.size, includeParents = false) {\n if (from == to) return Slice.empty;\n let $from = this.resolve(from),\n $to = this.resolve(to);\n let depth = includeParents ? 0 : $from.sharedDepth(to);\n let start = $from.start(depth),\n node = $from.node(depth);\n let content = node.content.cut($from.pos - start, $to.pos - start);\n return new Slice(content, $from.depth - depth, $to.depth - depth);\n }\n /**\n Replace the part of the document between the given positions with\n the given slice. The slice must 'fit', meaning its open sides\n must be able to connect to the surrounding content, and its\n content nodes must be valid children for the node they are placed\n into. If any of this is violated, an error of type\n [`ReplaceError`](https://prosemirror.net/docs/ref/#model.ReplaceError) is thrown.\n */\n replace(from, to, slice) {\n return replace(this.resolve(from), this.resolve(to), slice);\n }\n /**\n Find the node directly after the given position.\n */\n nodeAt(pos) {\n for (let node = this;;) {\n let {\n index,\n offset\n } = node.content.findIndex(pos);\n node = node.maybeChild(index);\n if (!node) return null;\n if (offset == pos || node.isText) return node;\n pos -= offset + 1;\n }\n }\n /**\n Find the (direct) child node after the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childAfter(pos) {\n let {\n index,\n offset\n } = this.content.findIndex(pos);\n return {\n node: this.content.maybeChild(index),\n index,\n offset\n };\n }\n /**\n Find the (direct) child node before the given offset, if any,\n and return it along with its index and offset relative to this\n node.\n */\n childBefore(pos) {\n if (pos == 0) return {\n node: null,\n index: 0,\n offset: 0\n };\n let {\n index,\n offset\n } = this.content.findIndex(pos);\n if (offset < pos) return {\n node: this.content.child(index),\n index,\n offset\n };\n let node = this.content.child(index - 1);\n return {\n node,\n index: index - 1,\n offset: offset - node.nodeSize\n };\n }\n /**\n Resolve the given position in the document, returning an\n [object](https://prosemirror.net/docs/ref/#model.ResolvedPos) with information about its context.\n */\n resolve(pos) {\n return ResolvedPos.resolveCached(this, pos);\n }\n /**\n @internal\n */\n resolveNoCache(pos) {\n return ResolvedPos.resolve(this, pos);\n }\n /**\n Test whether a given mark or mark type occurs in this document\n between the two given positions.\n */\n rangeHasMark(from, to, type) {\n let found = false;\n if (to > from) this.nodesBetween(from, to, node => {\n if (type.isInSet(node.marks)) found = true;\n return !found;\n });\n return found;\n }\n /**\n True when this is a block (non-inline node)\n */\n get isBlock() {\n return this.type.isBlock;\n }\n /**\n True when this is a textblock node, a block node with inline\n content.\n */\n get isTextblock() {\n return this.type.isTextblock;\n }\n /**\n True when this node allows inline content.\n */\n get inlineContent() {\n return this.type.inlineContent;\n }\n /**\n True when this is an inline node (a text node or a node that can\n appear among text).\n */\n get isInline() {\n return this.type.isInline;\n }\n /**\n True when this is a text node.\n */\n get isText() {\n return this.type.isText;\n }\n /**\n True when this is a leaf node.\n */\n get isLeaf() {\n return this.type.isLeaf;\n }\n /**\n True when this is an atom, i.e. when it does not have directly\n editable content. This is usually the same as `isLeaf`, but can\n be configured with the [`atom` property](https://prosemirror.net/docs/ref/#model.NodeSpec.atom)\n on a node's spec (typically used when the node is displayed as\n an uneditable [node view](https://prosemirror.net/docs/ref/#view.NodeView)).\n */\n get isAtom() {\n return this.type.isAtom;\n }\n /**\n Return a string representation of this node for debugging\n purposes.\n */\n toString() {\n if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);\n let name = this.type.name;\n if (this.content.size) name += \"(\" + this.content.toStringInner() + \")\";\n return wrapMarks(this.marks, name);\n }\n /**\n Get the content match in this node at the given index.\n */\n contentMatchAt(index) {\n let match = this.type.contentMatch.matchFragment(this.content, 0, index);\n if (!match) throw new Error(\"Called contentMatchAt on a node with invalid content\");\n return match;\n }\n /**\n Test whether replacing the range between `from` and `to` (by\n child index) with the given replacement fragment (which defaults\n to the empty fragment) would leave the node's content valid. You\n can optionally pass `start` and `end` indices into the\n replacement fragment.\n */\n canReplace(from, to, replacement = Fragment.empty, start = 0, end = replacement.childCount) {\n let one = this.contentMatchAt(from).matchFragment(replacement, start, end);\n let two = one && one.matchFragment(this.content, to);\n if (!two || !two.validEnd) return false;\n for (let i = start; i < end; i++) if (!this.type.allowsMarks(replacement.child(i).marks)) return false;\n return true;\n }\n /**\n Test whether replacing the range `from` to `to` (by index) with\n a node of the given type would leave the node's content valid.\n */\n canReplaceWith(from, to, type, marks) {\n if (marks && !this.type.allowsMarks(marks)) return false;\n let start = this.contentMatchAt(from).matchType(type);\n let end = start && start.matchFragment(this.content, to);\n return end ? end.validEnd : false;\n }\n /**\n Test whether the given node's content could be appended to this\n node. If that node is empty, this will only return true if there\n is at least one node type that can appear in both nodes (to avoid\n merging completely incompatible nodes).\n */\n canAppend(other) {\n if (other.content.size) return this.canReplace(this.childCount, this.childCount, other.content);else return this.type.compatibleContent(other.type);\n }\n /**\n Check whether this node and its descendants conform to the\n schema, and raise an exception when they do not.\n */\n check() {\n this.type.checkContent(this.content);\n this.type.checkAttrs(this.attrs);\n let copy = Mark.none;\n for (let i = 0; i < this.marks.length; i++) {\n let mark = this.marks[i];\n mark.type.checkAttrs(mark.attrs);\n copy = mark.addToSet(copy);\n }\n if (!Mark.sameSet(copy, this.marks)) throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(m => m.type.name)}`);\n this.content.forEach(node => node.check());\n }\n /**\n Return a JSON-serializeable representation of this node.\n */\n toJSON() {\n let obj = {\n type: this.type.name\n };\n for (let _ in this.attrs) {\n obj.attrs = this.attrs;\n break;\n }\n if (this.content.size) obj.content = this.content.toJSON();\n if (this.marks.length) obj.marks = this.marks.map(n => n.toJSON());\n return obj;\n }\n /**\n Deserialize a node from its JSON representation.\n */\n static fromJSON(schema, json) {\n if (!json) throw new RangeError(\"Invalid input for Node.fromJSON\");\n let marks = undefined;\n if (json.marks) {\n if (!Array.isArray(json.marks)) throw new RangeError(\"Invalid mark data for Node.fromJSON\");\n marks = json.marks.map(schema.markFromJSON);\n }\n if (json.type == \"text\") {\n if (typeof json.text != \"string\") throw new RangeError(\"Invalid text node in JSON\");\n return schema.text(json.text, marks);\n }\n let content = Fragment.fromJSON(schema, json.content);\n let node = schema.nodeType(json.type).create(json.attrs, content, marks);\n node.type.checkAttrs(node.attrs);\n return node;\n }\n}\nNode.prototype.text = undefined;\nclass TextNode extends Node {\n /**\n @internal\n */\n constructor(type, attrs, content, marks) {\n super(type, attrs, null, marks);\n if (!content) throw new RangeError(\"Empty text nodes are not allowed\");\n this.text = content;\n }\n toString() {\n if (this.type.spec.toDebugString) return this.type.spec.toDebugString(this);\n return wrapMarks(this.marks, JSON.stringify(this.text));\n }\n get textContent() {\n return this.text;\n }\n textBetween(from, to) {\n return this.text.slice(from, to);\n }\n get nodeSize() {\n return this.text.length;\n }\n mark(marks) {\n return marks == this.marks ? this : new TextNode(this.type, this.attrs, this.text, marks);\n }\n withText(text) {\n if (text == this.text) return this;\n return new TextNode(this.type, this.attrs, text, this.marks);\n }\n cut(from = 0, to = this.text.length) {\n if (from == 0 && to == this.text.length) return this;\n return this.withText(this.text.slice(from, to));\n }\n eq(other) {\n return this.sameMarkup(other) && this.text == other.text;\n }\n toJSON() {\n let base = super.toJSON();\n base.text = this.text;\n return base;\n }\n}\nfunction wrapMarks(marks, str) {\n for (let i = marks.length - 1; i >= 0; i--) str = marks[i].type.name + \"(\" + str + \")\";\n return str;\n}\n\n/**\nInstances of this class represent a match state of a node type's\n[content expression](https://prosemirror.net/docs/ref/#model.NodeSpec.content), and can be used to\nfind out whether further content matches here, and whether a given\nposition is a valid end of the node.\n*/\nclass ContentMatch {\n /**\n @internal\n */\n constructor(\n /**\n True when this match state represents a valid end of the node.\n */\n validEnd) {\n this.validEnd = validEnd;\n /**\n @internal\n */\n this.next = [];\n /**\n @internal\n */\n this.wrapCache = [];\n }\n /**\n @internal\n */\n static parse(string, nodeTypes) {\n let stream = new TokenStream(string, nodeTypes);\n if (stream.next == null) return ContentMatch.empty;\n let expr = parseExpr(stream);\n if (stream.next) stream.err(\"Unexpected trailing text\");\n let match = dfa(nfa(expr));\n checkForDeadEnds(match, stream);\n return match;\n }\n /**\n Match a node type, returning a match after that node if\n successful.\n */\n matchType(type) {\n for (let i = 0; i < this.next.length; i++) if (this.next[i].type == type) return this.next[i].next;\n return null;\n }\n /**\n Try to match a fragment. Returns the resulting match when\n successful.\n */\n matchFragment(frag, start = 0, end = frag.childCount) {\n let cur = this;\n for (let i = start; cur && i < end; i++) cur = cur.matchType(frag.child(i).type);\n return cur;\n }\n /**\n @internal\n */\n get inlineContent() {\n return this.next.length != 0 && this.next[0].type.isInline;\n }\n /**\n Get the first matching node type at this match position that can\n be generated.\n */\n get defaultType() {\n for (let i = 0; i < this.next.length; i++) {\n let {\n type\n } = this.next[i];\n if (!(type.isText || type.hasRequiredAttrs())) return type;\n }\n return null;\n }\n /**\n @internal\n */\n compatible(other) {\n for (let i = 0; i < this.next.length; i++) for (let j = 0; j < other.next.length; j++) if (this.next[i].type == other.next[j].type) return true;\n return false;\n }\n /**\n Try to match the given fragment, and if that fails, see if it can\n be made to match by inserting nodes in front of it. When\n successful, return a fragment of inserted nodes (which may be\n empty if nothing had to be inserted). When `toEnd` is true, only\n return a fragment if the resulting match goes to the end of the\n content expression.\n */\n fillBefore(after, toEnd = false, startIndex = 0) {\n let seen = [this];\n function search(match, types) {\n let finished = match.matchFragment(after, startIndex);\n if (finished && (!toEnd || finished.validEnd)) return Fragment.from(types.map(tp => tp.createAndFill()));\n for (let i = 0; i < match.next.length; i++) {\n let {\n type,\n next\n } = match.next[i];\n if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {\n seen.push(next);\n let found = search(next, types.concat(type));\n if (found) return found;\n }\n }\n return null;\n }\n return search(this, []);\n }\n /**\n Find a set of wrapping node types that would allow a node of the\n given type to appear at this position. The result may be empty\n (when it fits directly) and will be null when no such wrapping\n exists.\n */\n findWrapping(target) {\n for (let i = 0; i < this.wrapCache.length; i += 2) if (this.wrapCache[i] == target) return this.wrapCache[i + 1];\n let computed = this.computeWrapping(target);\n this.wrapCache.push(target, computed);\n return computed;\n }\n /**\n @internal\n */\n computeWrapping(target) {\n let seen = Object.create(null),\n active = [{\n match: this,\n type: null,\n via: null\n }];\n while (active.length) {\n let current = active.shift(),\n match = current.match;\n if (match.matchType(target)) {\n let result = [];\n for (let obj = current; obj.type; obj = obj.via) result.push(obj.type);\n return result.reverse();\n }\n for (let i = 0; i < match.next.length; i++) {\n let {\n type,\n next\n } = match.next[i];\n if (!type.isLeaf && !type.hasRequiredAttrs() && !(type.name in seen) && (!current.type || next.validEnd)) {\n active.push({\n match: type.contentMatch,\n type,\n via: current\n });\n seen[type.name] = true;\n }\n }\n }\n return null;\n }\n /**\n The number of outgoing edges this node has in the finite\n automaton that describes the content expression.\n */\n get edgeCount() {\n return this.next.length;\n }\n /**\n Get the _n_​th outgoing edge from this node in the finite\n automaton that describes the content expression.\n */\n edge(n) {\n if (n >= this.next.length) throw new RangeError(`There's no ${n}th edge in this content match`);\n return this.next[n];\n }\n /**\n @internal\n */\n toString() {\n let seen = [];\n function scan(m) {\n seen.push(m);\n for (let i = 0; i < m.next.length; i++) if (seen.indexOf(m.next[i].next) == -1) scan(m.next[i].next);\n }\n scan(this);\n return seen.map((m, i) => {\n let out = i + (m.validEnd ? \"*\" : \" \") + \" \";\n for (let i = 0; i < m.next.length; i++) out += (i ? \", \" : \"\") + m.next[i].type.name + \"->\" + seen.indexOf(m.next[i].next);\n return out;\n }).join(\"\\n\");\n }\n}\n/**\n@internal\n*/\nContentMatch.empty = new ContentMatch(true);\nclass TokenStream {\n constructor(string, nodeTypes) {\n this.string = string;\n this.nodeTypes = nodeTypes;\n this.inline = null;\n this.pos = 0;\n this.tokens = string.split(/\\s*(?=\\b|\\W|$)/);\n if (this.tokens[this.tokens.length - 1] == \"\") this.tokens.pop();\n if (this.tokens[0] == \"\") this.tokens.shift();\n }\n get next() {\n return this.tokens[this.pos];\n }\n eat(tok) {\n return this.next == tok && (this.pos++ || true);\n }\n err(str) {\n throw new SyntaxError(str + \" (in content expression '\" + this.string + \"')\");\n }\n}\nfunction parseExpr(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSeq(stream));\n } while (stream.eat(\"|\"));\n return exprs.length == 1 ? exprs[0] : {\n type: \"choice\",\n exprs\n };\n}\nfunction parseExprSeq(stream) {\n let exprs = [];\n do {\n exprs.push(parseExprSubscript(stream));\n } while (stream.next && stream.next != \")\" && stream.next != \"|\");\n return exprs.length == 1 ? exprs[0] : {\n type: \"seq\",\n exprs\n };\n}\nfunction parseExprSubscript(stream) {\n let expr = parseExprAtom(stream);\n for (;;) {\n if (stream.eat(\"+\")) expr = {\n type: \"plus\",\n expr\n };else if (stream.eat(\"*\")) expr = {\n type: \"star\",\n expr\n };else if (stream.eat(\"?\")) expr = {\n type: \"opt\",\n expr\n };else if (stream.eat(\"{\")) expr = parseExprRange(stream, expr);else break;\n }\n return expr;\n}\nfunction parseNum(stream) {\n if (/\\D/.test(stream.next)) stream.err(\"Expected number, got '\" + stream.next + \"'\");\n let result = Number(stream.next);\n stream.pos++;\n return result;\n}\nfunction parseExprRange(stream, expr) {\n let min = parseNum(stream),\n max = min;\n if (stream.eat(\",\")) {\n if (stream.next != \"}\") max = parseNum(stream);else max = -1;\n }\n if (!stream.eat(\"}\")) stream.err(\"Unclosed braced range\");\n return {\n type: \"range\",\n min,\n max,\n expr\n };\n}\nfunction resolveName(stream, name) {\n let types = stream.nodeTypes,\n type = types[name];\n if (type) return [type];\n let result = [];\n for (let typeName in types) {\n let type = types[typeName];\n if (type.isInGroup(name)) result.push(type);\n }\n if (result.length == 0) stream.err(\"No node type or group '\" + name + \"' found\");\n return result;\n}\nfunction parseExprAtom(stream) {\n if (stream.eat(\"(\")) {\n let expr = parseExpr(stream);\n if (!stream.eat(\")\")) stream.err(\"Missing closing paren\");\n return expr;\n } else if (!/\\W/.test(stream.next)) {\n let exprs = resolveName(stream, stream.next).map(type => {\n if (stream.inline == null) stream.inline = type.isInline;else if (stream.inline != type.isInline) stream.err(\"Mixing inline and block content\");\n return {\n type: \"name\",\n value: type\n };\n });\n stream.pos++;\n return exprs.length == 1 ? exprs[0] : {\n type: \"choice\",\n exprs\n };\n } else {\n stream.err(\"Unexpected token '\" + stream.next + \"'\");\n }\n}\n// Construct an NFA from an expression as returned by the parser. The\n// NFA is represented as an array of states, which are themselves\n// arrays of edges, which are `{term, to}` objects. The first state is\n// the entry state and the last node is the success state.\n//\n// Note that unlike typical NFAs, the edge ordering in this one is\n// significant, in that it is used to contruct filler content when\n// necessary.\nfunction nfa(expr) {\n let nfa = [[]];\n connect(compile(expr, 0), node());\n return nfa;\n function node() {\n return nfa.push([]) - 1;\n }\n function edge(from, to, term) {\n let edge = {\n term,\n to\n };\n nfa[from].push(edge);\n return edge;\n }\n function connect(edges, to) {\n edges.forEach(edge => edge.to = to);\n }\n function compile(expr, from) {\n if (expr.type == \"choice\") {\n return expr.exprs.reduce((out, expr) => out.concat(compile(expr, from)), []);\n } else if (expr.type == \"seq\") {\n for (let i = 0;; i++) {\n let next = compile(expr.exprs[i], from);\n if (i == expr.exprs.length - 1) return next;\n connect(next, from = node());\n }\n } else if (expr.type == \"star\") {\n let loop = node();\n edge(from, loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n } else if (expr.type == \"plus\") {\n let loop = node();\n connect(compile(expr.expr, from), loop);\n connect(compile(expr.expr, loop), loop);\n return [edge(loop)];\n } else if (expr.type == \"opt\") {\n return [edge(from)].concat(compile(expr.expr, from));\n } else if (expr.type == \"range\") {\n let cur = from;\n for (let i = 0; i < expr.min; i++) {\n let next = node();\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n if (expr.max == -1) {\n connect(compile(expr.expr, cur), cur);\n } else {\n for (let i = expr.min; i < expr.max; i++) {\n let next = node();\n edge(cur, next);\n connect(compile(expr.expr, cur), next);\n cur = next;\n }\n }\n return [edge(cur)];\n } else if (expr.type == \"name\") {\n return [edge(from, undefined, expr.value)];\n } else {\n throw new Error(\"Unknown expr type\");\n }\n }\n}\nfunction cmp(a, b) {\n return b - a;\n}\n// Get the set of nodes reachable by null edges from `node`. Omit\n// nodes with only a single null-out-edge, since they may lead to\n// needless duplicated nodes.\nfunction nullFrom(nfa, node) {\n let result = [];\n scan(node);\n return result.sort(cmp);\n function scan(node) {\n let edges = nfa[node];\n if (edges.length == 1 && !edges[0].term) return scan(edges[0].to);\n result.push(node);\n for (let i = 0; i < edges.length; i++) {\n let {\n term,\n to\n } = edges[i];\n if (!term && result.indexOf(to) == -1) scan(to);\n }\n }\n}\n// Compiles an NFA as produced by `nfa` into a DFA, modeled as a set\n// of state objects (`ContentMatch` instances) with transitions\n// between them.\nfunction dfa(nfa) {\n let labeled = Object.create(null);\n return explore(nullFrom(nfa, 0));\n function explore(states) {\n let out = [];\n states.forEach(node => {\n nfa[node].forEach(({\n term,\n to\n }) => {\n if (!term) return;\n let set;\n for (let i = 0; i < out.length; i++) if (out[i][0] == term) set = out[i][1];\n nullFrom(nfa, to).forEach(node => {\n if (!set) out.push([term, set = []]);\n if (set.indexOf(node) == -1) set.push(node);\n });\n });\n });\n let state = labeled[states.join(\",\")] = new ContentMatch(states.indexOf(nfa.length - 1) > -1);\n for (let i = 0; i < out.length; i++) {\n let states = out[i][1].sort(cmp);\n state.next.push({\n type: out[i][0],\n next: labeled[states.join(\",\")] || explore(states)\n });\n }\n return state;\n }\n}\nfunction checkForDeadEnds(match, stream) {\n for (let i = 0, work = [match]; i < work.length; i++) {\n let state = work[i],\n dead = !state.validEnd,\n nodes = [];\n for (let j = 0; j < state.next.length; j++) {\n let {\n type,\n next\n } = state.next[j];\n nodes.push(type.name);\n if (dead && !(type.isText || type.hasRequiredAttrs())) dead = false;\n if (work.indexOf(next) == -1) work.push(next);\n }\n if (dead) stream.err(\"Only non-generatable nodes (\" + nodes.join(\", \") + \") in a required position (see https://prosemirror.net/docs/guide/#generatable)\");\n }\n}\n\n// For node types where all attrs have a default value (or which don't\n// have any attributes), build up a single reusable default attribute\n// object, and use it for all nodes that don't specify specific\n// attributes.\nfunction defaultAttrs(attrs) {\n let defaults = Object.create(null);\n for (let attrName in attrs) {\n let attr = attrs[attrName];\n if (!attr.hasDefault) return null;\n defaults[attrName] = attr.default;\n }\n return defaults;\n}\nfunction computeAttrs(attrs, value) {\n let built = Object.create(null);\n for (let name in attrs) {\n let given = value && value[name];\n if (given === undefined) {\n let attr = attrs[name];\n if (attr.hasDefault) given = attr.default;else throw new RangeError(\"No value supplied for attribute \" + name);\n }\n built[name] = given;\n }\n return built;\n}\nfunction checkAttrs(attrs, values, type, name) {\n for (let name in values) if (!(name in attrs)) throw new RangeError(`Unsupported attribute ${name} for ${type} of type ${name}`);\n for (let name in attrs) {\n let attr = attrs[name];\n if (attr.validate) attr.validate(values[name]);\n }\n}\nfunction initAttrs(typeName, attrs) {\n let result = Object.create(null);\n if (attrs) for (let name in attrs) result[name] = new Attribute(typeName, name, attrs[name]);\n return result;\n}\n/**\nNode types are objects allocated once per `Schema` and used to\n[tag](https://prosemirror.net/docs/ref/#model.Node.type) `Node` instances. They contain information\nabout the node type, such as its name and what kind of node it\nrepresents.\n*/\nclass NodeType {\n /**\n @internal\n */\n constructor(\n /**\n The name the node type has in this schema.\n */\n name,\n /**\n A link back to the `Schema` the node type belongs to.\n */\n schema,\n /**\n The spec that this type is based on\n */\n spec) {\n this.name = name;\n this.schema = schema;\n this.spec = spec;\n /**\n The set of marks allowed in this node. `null` means all marks\n are allowed.\n */\n this.markSet = null;\n this.groups = spec.group ? spec.group.split(\" \") : [];\n this.attrs = initAttrs(name, spec.attrs);\n this.defaultAttrs = defaultAttrs(this.attrs);\n this.contentMatch = null;\n this.inlineContent = null;\n this.isBlock = !(spec.inline || name == \"text\");\n this.isText = name == \"text\";\n }\n /**\n True if this is an inline type.\n */\n get isInline() {\n return !this.isBlock;\n }\n /**\n True if this is a textblock type, a block that contains inline\n content.\n */\n get isTextblock() {\n return this.isBlock && this.inlineContent;\n }\n /**\n True for node types that allow no content.\n */\n get isLeaf() {\n return this.contentMatch == ContentMatch.empty;\n }\n /**\n True when this node is an atom, i.e. when it does not have\n directly editable content.\n */\n get isAtom() {\n return this.isLeaf || !!this.spec.atom;\n }\n /**\n Return true when this node type is part of the given\n [group](https://prosemirror.net/docs/ref/#model.NodeSpec.group).\n */\n isInGroup(group) {\n return this.groups.indexOf(group) > -1;\n }\n /**\n The node type's [whitespace](https://prosemirror.net/docs/ref/#model.NodeSpec.whitespace) option.\n */\n get whitespace() {\n return this.spec.whitespace || (this.spec.code ? \"pre\" : \"normal\");\n }\n /**\n Tells you whether this node type has any required attributes.\n */\n hasRequiredAttrs() {\n for (let n in this.attrs) if (this.attrs[n].isRequired) return true;\n return false;\n }\n /**\n Indicates whether this node allows some of the same content as\n the given node type.\n */\n compatibleContent(other) {\n return this == other || this.contentMatch.compatible(other.contentMatch);\n }\n /**\n @internal\n */\n computeAttrs(attrs) {\n if (!attrs && this.defaultAttrs) return this.defaultAttrs;else return computeAttrs(this.attrs, attrs);\n }\n /**\n Create a `Node` of this type. The given attributes are\n checked and defaulted (you can pass `null` to use the type's\n defaults entirely, if no required attributes exist). `content`\n may be a `Fragment`, a node, an array of nodes, or\n `null`. Similarly `marks` may be `null` to default to the empty\n set of marks.\n */\n create(attrs = null, content, marks) {\n if (this.isText) throw new Error(\"NodeType.create can't construct text nodes\");\n return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content\n against the node type's content restrictions, and throw an error\n if it doesn't match.\n */\n createChecked(attrs = null, content, marks) {\n content = Fragment.from(content);\n this.checkContent(content);\n return new Node(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));\n }\n /**\n Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is\n necessary to add nodes to the start or end of the given fragment\n to make it fit the node. If no fitting wrapping can be found,\n return null. Note that, due to the fact that required nodes can\n always be created, this will always succeed if you pass null or\n `Fragment.empty` as content.\n */\n createAndFill(attrs = null, content, marks) {\n attrs = this.computeAttrs(attrs);\n content = Fragment.from(content);\n if (content.size) {\n let before = this.contentMatch.fillBefore(content);\n if (!before) return null;\n content = before.append(content);\n }\n let matched = this.contentMatch.matchFragment(content);\n let after = matched && matched.fillBefore(Fragment.empty, true);\n if (!after) return null;\n return new Node(this, attrs, content.append(after), Mark.setFrom(marks));\n }\n /**\n Returns true if the given fragment is valid content for this node\n type.\n */\n validContent(content) {\n let result = this.contentMatch.matchFragment(content);\n if (!result || !result.validEnd) return false;\n for (let i = 0; i < content.childCount; i++) if (!this.allowsMarks(content.child(i).marks)) return false;\n return true;\n }\n /**\n Throws a RangeError if the given fragment is not valid content for this\n node type.\n @internal\n */\n checkContent(content) {\n if (!this.validContent(content)) throw new RangeError(`Invalid content for node ${this.name}: ${content.toString().slice(0, 50)}`);\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"node\", this.name);\n }\n /**\n Check whether the given mark type is allowed in this node.\n */\n allowsMarkType(markType) {\n return this.markSet == null || this.markSet.indexOf(markType) > -1;\n }\n /**\n Test whether the given set of marks are allowed in this node.\n */\n allowsMarks(marks) {\n if (this.markSet == null) return true;\n for (let i = 0; i < marks.length; i++) if (!this.allowsMarkType(marks[i].type)) return false;\n return true;\n }\n /**\n Removes the marks that are not allowed in this node from the given set.\n */\n allowedMarks(marks) {\n if (this.markSet == null) return marks;\n let copy;\n for (let i = 0; i < marks.length; i++) {\n if (!this.allowsMarkType(marks[i].type)) {\n if (!copy) copy = marks.slice(0, i);\n } else if (copy) {\n copy.push(marks[i]);\n }\n }\n return !copy ? marks : copy.length ? copy : Mark.none;\n }\n /**\n @internal\n */\n static compile(nodes, schema) {\n let result = Object.create(null);\n nodes.forEach((name, spec) => result[name] = new NodeType(name, schema, spec));\n let topType = schema.spec.topNode || \"doc\";\n if (!result[topType]) throw new RangeError(\"Schema is missing its top node type ('\" + topType + \"')\");\n if (!result.text) throw new RangeError(\"Every schema needs a 'text' type\");\n for (let _ in result.text.attrs) throw new RangeError(\"The text node type should not have attributes\");\n return result;\n }\n}\nfunction validateType(typeName, attrName, type) {\n let types = type.split(\"|\");\n return value => {\n let name = value === null ? \"null\" : typeof value;\n if (types.indexOf(name) < 0) throw new RangeError(`Expected value of type ${types} for attribute ${attrName} on type ${typeName}, got ${name}`);\n };\n}\n// Attribute descriptors\nclass Attribute {\n constructor(typeName, attrName, options) {\n this.hasDefault = Object.prototype.hasOwnProperty.call(options, \"default\");\n this.default = options.default;\n this.validate = typeof options.validate == \"string\" ? validateType(typeName, attrName, options.validate) : options.validate;\n }\n get isRequired() {\n return !this.hasDefault;\n }\n}\n// Marks\n/**\nLike nodes, marks (which are associated with nodes to signify\nthings like emphasis or being part of a link) are\n[tagged](https://prosemirror.net/docs/ref/#model.Mark.type) with type objects, which are\ninstantiated once per `Schema`.\n*/\nclass MarkType {\n /**\n @internal\n */\n constructor(\n /**\n The name of the mark type.\n */\n name,\n /**\n @internal\n */\n rank,\n /**\n The schema that this mark type instance is part of.\n */\n schema,\n /**\n The spec on which the type is based.\n */\n spec) {\n this.name = name;\n this.rank = rank;\n this.schema = schema;\n this.spec = spec;\n this.attrs = initAttrs(name, spec.attrs);\n this.excluded = null;\n let defaults = defaultAttrs(this.attrs);\n this.instance = defaults ? new Mark(this, defaults) : null;\n }\n /**\n Create a mark of this type. `attrs` may be `null` or an object\n containing only some of the mark's attributes. The others, if\n they have defaults, will be added.\n */\n create(attrs = null) {\n if (!attrs && this.instance) return this.instance;\n return new Mark(this, computeAttrs(this.attrs, attrs));\n }\n /**\n @internal\n */\n static compile(marks, schema) {\n let result = Object.create(null),\n rank = 0;\n marks.forEach((name, spec) => result[name] = new MarkType(name, rank++, schema, spec));\n return result;\n }\n /**\n When there is a mark of this type in the given set, a new set\n without it is returned. Otherwise, the input set is returned.\n */\n removeFromSet(set) {\n for (var i = 0; i < set.length; i++) if (set[i].type == this) {\n set = set.slice(0, i).concat(set.slice(i + 1));\n i--;\n }\n return set;\n }\n /**\n Tests whether there is a mark of this type in the given set.\n */\n isInSet(set) {\n for (let i = 0; i < set.length; i++) if (set[i].type == this) return set[i];\n }\n /**\n @internal\n */\n checkAttrs(attrs) {\n checkAttrs(this.attrs, attrs, \"mark\", this.name);\n }\n /**\n Queries whether a given mark type is\n [excluded](https://prosemirror.net/docs/ref/#model.MarkSpec.excludes) by this one.\n */\n excludes(other) {\n return this.excluded.indexOf(other) > -1;\n }\n}\n/**\nA document schema. Holds [node](https://prosemirror.net/docs/ref/#model.NodeType) and [mark\ntype](https://prosemirror.net/docs/ref/#model.MarkType) objects for the nodes and marks that may\noccur in conforming documents, and provides functionality for\ncreating and deserializing such documents.\n\nWhen given, the type parameters provide the names of the nodes and\nmarks in this schema.\n*/\nclass Schema {\n /**\n Construct a schema from a schema [specification](https://prosemirror.net/docs/ref/#model.SchemaSpec).\n */\n constructor(spec) {\n /**\n The [linebreak\n replacement](https://prosemirror.net/docs/ref/#model.NodeSpec.linebreakReplacement) node defined\n in this schema, if any.\n */\n this.linebreakReplacement = null;\n /**\n An object for storing whatever values modules may want to\n compute and cache per schema. (If you want to store something\n in it, try to use property names unlikely to clash.)\n */\n this.cached = Object.create(null);\n let instanceSpec = this.spec = {};\n for (let prop in spec) instanceSpec[prop] = spec[prop];\n instanceSpec.nodes = OrderedMap.from(spec.nodes), instanceSpec.marks = OrderedMap.from(spec.marks || {}), this.nodes = NodeType.compile(this.spec.nodes, this);\n this.marks = MarkType.compile(this.spec.marks, this);\n let contentExprCache = Object.create(null);\n for (let prop in this.nodes) {\n if (prop in this.marks) throw new RangeError(prop + \" can not be both a node and a mark\");\n let type = this.nodes[prop],\n contentExpr = type.spec.content || \"\",\n markExpr = type.spec.marks;\n type.contentMatch = contentExprCache[contentExpr] || (contentExprCache[contentExpr] = ContentMatch.parse(contentExpr, this.nodes));\n type.inlineContent = type.contentMatch.inlineContent;\n if (type.spec.linebreakReplacement) {\n if (this.linebreakReplacement) throw new RangeError(\"Multiple linebreak nodes defined\");\n if (!type.isInline || !type.isLeaf) throw new RangeError(\"Linebreak replacement nodes must be inline leaf nodes\");\n this.linebreakReplacement = type;\n }\n type.markSet = markExpr == \"_\" ? null : markExpr ? gatherMarks(this, markExpr.split(\" \")) : markExpr == \"\" || !type.inlineContent ? [] : null;\n }\n for (let prop in this.marks) {\n let type = this.marks[prop],\n excl = type.spec.excludes;\n type.excluded = excl == null ? [type] : excl == \"\" ? [] : gatherMarks(this, excl.split(\" \"));\n }\n this.nodeFromJSON = this.nodeFromJSON.bind(this);\n this.markFromJSON = this.markFromJSON.bind(this);\n this.topNodeType = this.nodes[this.spec.topNode || \"doc\"];\n this.cached.wrappings = Object.create(null);\n }\n /**\n Create a node in this schema. The `type` may be a string or a\n `NodeType` instance. Attributes will be extended with defaults,\n `content` may be a `Fragment`, `null`, a `Node`, or an array of\n nodes.\n */\n node(type, attrs = null, content, marks) {\n if (typeof type == \"string\") type = this.nodeType(type);else if (!(type instanceof NodeType)) throw new RangeError(\"Invalid node type: \" + type);else if (type.schema != this) throw new RangeError(\"Node type from different schema used (\" + type.name + \")\");\n return type.createChecked(attrs, content, marks);\n }\n /**\n Create a text node in the schema. Empty text nodes are not\n allowed.\n */\n text(text, marks) {\n let type = this.nodes.text;\n return new TextNode(type, type.defaultAttrs, text, Mark.setFrom(marks));\n }\n /**\n Create a mark with the given type and attributes.\n */\n mark(type, attrs) {\n if (typeof type == \"string\") type = this.marks[type];\n return type.create(attrs);\n }\n /**\n Deserialize a node from its JSON representation. This method is\n bound.\n */\n nodeFromJSON(json) {\n return Node.fromJSON(this, json);\n }\n /**\n Deserialize a mark from its JSON representation. This method is\n bound.\n */\n markFromJSON(json) {\n return Mark.fromJSON(this, json);\n }\n /**\n @internal\n */\n nodeType(name) {\n let found = this.nodes[name];\n if (!found) throw new RangeError(\"Unknown node type: \" + name);\n return found;\n }\n}\nfunction gatherMarks(schema, marks) {\n let found = [];\n for (let i = 0; i < marks.length; i++) {\n let name = marks[i],\n mark = schema.marks[name],\n ok = mark;\n if (mark) {\n found.push(mark);\n } else {\n for (let prop in schema.marks) {\n let mark = schema.marks[prop];\n if (name == \"_\" || mark.spec.group && mark.spec.group.split(\" \").indexOf(name) > -1) found.push(ok = mark);\n }\n }\n if (!ok) throw new SyntaxError(\"Unknown mark type: '\" + marks[i] + \"'\");\n }\n return found;\n}\nfunction isTagRule(rule) {\n return rule.tag != null;\n}\nfunction isStyleRule(rule) {\n return rule.style != null;\n}\n/**\nA DOM parser represents a strategy for parsing DOM content into a\nProseMirror document conforming to a given schema. Its behavior is\ndefined by an array of [rules](https://prosemirror.net/docs/ref/#model.ParseRule).\n*/\nclass DOMParser {\n /**\n Create a parser that targets the given schema, using the given\n parsing rules.\n */\n constructor(\n /**\n The schema into which the parser parses.\n */\n schema,\n /**\n The set of [parse rules](https://prosemirror.net/docs/ref/#model.ParseRule) that the parser\n uses, in order of precedence.\n */\n rules) {\n this.schema = schema;\n this.rules = rules;\n /**\n @internal\n */\n this.tags = [];\n /**\n @internal\n */\n this.styles = [];\n let matchedStyles = this.matchedStyles = [];\n rules.forEach(rule => {\n if (isTagRule(rule)) {\n this.tags.push(rule);\n } else if (isStyleRule(rule)) {\n let prop = /[^=]*/.exec(rule.style)[0];\n if (matchedStyles.indexOf(prop) < 0) matchedStyles.push(prop);\n this.styles.push(rule);\n }\n });\n // Only normalize list elements when lists in the schema can't directly contain themselves\n this.normalizeLists = !this.tags.some(r => {\n if (!/^(ul|ol)\\b/.test(r.tag) || !r.node) return false;\n let node = schema.nodes[r.node];\n return node.contentMatch.matchType(node);\n });\n }\n /**\n Parse a document from the content of a DOM node.\n */\n parse(dom, options = {}) {\n let context = new ParseContext(this, options, false);\n context.addAll(dom, Mark.none, options.from, options.to);\n return context.finish();\n }\n /**\n Parses the content of the given DOM node, like\n [`parse`](https://prosemirror.net/docs/ref/#model.DOMParser.parse), and takes the same set of\n options. But unlike that method, which produces a whole node,\n this one returns a slice that is open at the sides, meaning that\n the schema constraints aren't applied to the start of nodes to\n the left of the input and the end of nodes at the end.\n */\n parseSlice(dom, options = {}) {\n let context = new ParseContext(this, options, true);\n context.addAll(dom, Mark.none, options.from, options.to);\n return Slice.maxOpen(context.finish());\n }\n /**\n @internal\n */\n matchTag(dom, context, after) {\n for (let i = after ? this.tags.indexOf(after) + 1 : 0; i < this.tags.length; i++) {\n let rule = this.tags[i];\n if (matches(dom, rule.tag) && (rule.namespace === undefined || dom.namespaceURI == rule.namespace) && (!rule.context || context.matchesContext(rule.context))) {\n if (rule.getAttrs) {\n let result = rule.getAttrs(dom);\n if (result === false) continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n }\n /**\n @internal\n */\n matchStyle(prop, value, context, after) {\n for (let i = after ? this.styles.indexOf(after) + 1 : 0; i < this.styles.length; i++) {\n let rule = this.styles[i],\n style = rule.style;\n if (style.indexOf(prop) != 0 || rule.context && !context.matchesContext(rule.context) ||\n // Test that the style string either precisely matches the prop,\n // or has an '=' sign after the prop, followed by the given\n // value.\n style.length > prop.length && (style.charCodeAt(prop.length) != 61 || style.slice(prop.length + 1) != value)) continue;\n if (rule.getAttrs) {\n let result = rule.getAttrs(value);\n if (result === false) continue;\n rule.attrs = result || undefined;\n }\n return rule;\n }\n }\n /**\n @internal\n */\n static schemaRules(schema) {\n let result = [];\n function insert(rule) {\n let priority = rule.priority == null ? 50 : rule.priority,\n i = 0;\n for (; i < result.length; i++) {\n let next = result[i],\n nextPriority = next.priority == null ? 50 : next.priority;\n if (nextPriority < priority) break;\n }\n result.splice(i, 0, rule);\n }\n for (let name in schema.marks) {\n let rules = schema.marks[name].spec.parseDOM;\n if (rules) rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.mark || rule.ignore || rule.clearMark)) rule.mark = name;\n });\n }\n for (let name in schema.nodes) {\n let rules = schema.nodes[name].spec.parseDOM;\n if (rules) rules.forEach(rule => {\n insert(rule = copy(rule));\n if (!(rule.node || rule.ignore || rule.mark)) rule.node = name;\n });\n }\n return result;\n }\n /**\n Construct a DOM parser using the parsing rules listed in a\n schema's [node specs](https://prosemirror.net/docs/ref/#model.NodeSpec.parseDOM), reordered by\n [priority](https://prosemirror.net/docs/ref/#model.ParseRule.priority).\n */\n static fromSchema(schema) {\n return schema.cached.domParser || (schema.cached.domParser = new DOMParser(schema, DOMParser.schemaRules(schema)));\n }\n}\nconst blockTags = {\n address: true,\n article: true,\n aside: true,\n blockquote: true,\n canvas: true,\n dd: true,\n div: true,\n dl: true,\n fieldset: true,\n figcaption: true,\n figure: true,\n footer: true,\n form: true,\n h1: true,\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n header: true,\n hgroup: true,\n hr: true,\n li: true,\n noscript: true,\n ol: true,\n output: true,\n p: true,\n pre: true,\n section: true,\n table: true,\n tfoot: true,\n ul: true\n};\nconst ignoreTags = {\n head: true,\n noscript: true,\n object: true,\n script: true,\n style: true,\n title: true\n};\nconst listTags = {\n ol: true,\n ul: true\n};\n// Using a bitfield for node context options\nconst OPT_PRESERVE_WS = 1,\n OPT_PRESERVE_WS_FULL = 2,\n OPT_OPEN_LEFT = 4;\nfunction wsOptionsFor(type, preserveWhitespace, base) {\n if (preserveWhitespace != null) return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === \"full\" ? OPT_PRESERVE_WS_FULL : 0);\n return type && type.whitespace == \"pre\" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base & ~OPT_OPEN_LEFT;\n}\nclass NodeContext {\n constructor(type, attrs, marks, solid, match, options) {\n this.type = type;\n this.attrs = attrs;\n this.marks = marks;\n this.solid = solid;\n this.options = options;\n this.content = [];\n // Marks applied to the node's children\n this.activeMarks = Mark.none;\n this.match = match || (options & OPT_OPEN_LEFT ? null : type.contentMatch);\n }\n findWrapping(node) {\n if (!this.match) {\n if (!this.type) return [];\n let fill = this.type.contentMatch.fillBefore(Fragment.from(node));\n if (fill) {\n this.match = this.type.contentMatch.matchFragment(fill);\n } else {\n let start = this.type.contentMatch,\n wrap;\n if (wrap = start.findWrapping(node.type)) {\n this.match = start;\n return wrap;\n } else {\n return null;\n }\n }\n }\n return this.match.findWrapping(node.type);\n }\n finish(openEnd) {\n if (!(this.options & OPT_PRESERVE_WS)) {\n // Strip trailing whitespace\n let last = this.content[this.content.length - 1],\n m;\n if (last && last.isText && (m = /[ \\t\\r\\n\\u000c]+$/.exec(last.text))) {\n let text = last;\n if (last.text.length == m[0].length) this.content.pop();else this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m[0].length));\n }\n }\n let content = Fragment.from(this.content);\n if (!openEnd && this.match) content = content.append(this.match.fillBefore(Fragment.empty, true));\n return this.type ? this.type.create(this.attrs, content, this.marks) : content;\n }\n inlineContext(node) {\n if (this.type) return this.type.inlineContent;\n if (this.content.length) return this.content[0].isInline;\n return node.parentNode && !blockTags.hasOwnProperty(node.parentNode.nodeName.toLowerCase());\n }\n}\nclass ParseContext {\n constructor(\n // The parser we are using.\n parser,\n // The options passed to this parse.\n options, isOpen) {\n this.parser = parser;\n this.options = options;\n this.isOpen = isOpen;\n this.open = 0;\n this.localPreserveWS = false;\n let topNode = options.topNode,\n topContext;\n let topOptions = wsOptionsFor(null, options.preserveWhitespace, 0) | (isOpen ? OPT_OPEN_LEFT : 0);\n if (topNode) topContext = new NodeContext(topNode.type, topNode.attrs, Mark.none, true, options.topMatch || topNode.type.contentMatch, topOptions);else if (isOpen) topContext = new NodeContext(null, null, Mark.none, true, null, topOptions);else topContext = new NodeContext(parser.schema.topNodeType, null, Mark.none, true, null, topOptions);\n this.nodes = [topContext];\n this.find = options.findPositions;\n this.needsBlock = false;\n }\n get top() {\n return this.nodes[this.open];\n }\n // Add a DOM node to the content. Text is inserted as text node,\n // otherwise, the node is passed to `addElement` or, if it has a\n // `style` attribute, `addElementWithStyles`.\n addDOM(dom, marks) {\n if (dom.nodeType == 3) this.addTextNode(dom, marks);else if (dom.nodeType == 1) this.addElement(dom, marks);\n }\n addTextNode(dom, marks) {\n let value = dom.nodeValue;\n let top = this.top,\n preserveWS = top.options & OPT_PRESERVE_WS_FULL ? \"full\" : this.localPreserveWS || (top.options & OPT_PRESERVE_WS) > 0;\n if (preserveWS === \"full\" || top.inlineContext(dom) || /[^ \\t\\r\\n\\u000c]/.test(value)) {\n if (!preserveWS) {\n value = value.replace(/[ \\t\\r\\n\\u000c]+/g, \" \");\n // If this starts with whitespace, and there is no node before it, or\n // a hard break, or a text node that ends with whitespace, strip the\n // leading space.\n if (/^[ \\t\\r\\n\\u000c]/.test(value) && this.open == this.nodes.length - 1) {\n let nodeBefore = top.content[top.content.length - 1];\n let domNodeBefore = dom.previousSibling;\n if (!nodeBefore || domNodeBefore && domNodeBefore.nodeName == 'BR' || nodeBefore.isText && /[ \\t\\r\\n\\u000c]$/.test(nodeBefore.text)) value = value.slice(1);\n }\n } else if (preserveWS !== \"full\") {\n value = value.replace(/\\r?\\n|\\r/g, \" \");\n } else {\n value = value.replace(/\\r\\n?/g, \"\\n\");\n }\n if (value) this.insertNode(this.parser.schema.text(value), marks);\n this.findInText(dom);\n } else {\n this.findInside(dom);\n }\n }\n // Try to find a handler for the given tag and use that to parse. If\n // none is found, the element's content nodes are added directly.\n addElement(dom, marks, matchAfter) {\n let outerWS = this.localPreserveWS,\n top = this.top;\n if (dom.tagName == \"PRE\" || /pre/.test(dom.style && dom.style.whiteSpace)) this.localPreserveWS = true;\n let name = dom.nodeName.toLowerCase(),\n ruleID;\n if (listTags.hasOwnProperty(name) && this.parser.normalizeLists) normalizeList(dom);\n let rule = this.options.ruleFromNode && this.options.ruleFromNode(dom) || (ruleID = this.parser.matchTag(dom, this, matchAfter));\n out: if (rule ? rule.ignore : ignoreTags.hasOwnProperty(name)) {\n this.findInside(dom);\n this.ignoreFallback(dom, marks);\n } else if (!rule || rule.skip || rule.closeParent) {\n if (rule && rule.closeParent) this.open = Math.max(0, this.open - 1);else if (rule && rule.skip.nodeType) dom = rule.skip;\n let sync,\n oldNeedsBlock = this.needsBlock;\n if (blockTags.hasOwnProperty(name)) {\n if (top.content.length && top.content[0].isInline && this.open) {\n this.open--;\n top = this.top;\n }\n sync = true;\n if (!top.type) this.needsBlock = true;\n } else if (!dom.firstChild) {\n this.leafFallback(dom, marks);\n break out;\n }\n let innerMarks = rule && rule.skip ? marks : this.readStyles(dom, marks);\n if (innerMarks) this.addAll(dom, innerMarks);\n if (sync) this.sync(top);\n this.needsBlock = oldNeedsBlock;\n } else {\n let innerMarks = this.readStyles(dom, marks);\n if (innerMarks) this.addElementByRule(dom, rule, innerMarks, rule.consuming === false ? ruleID : undefined);\n }\n this.localPreserveWS = outerWS;\n }\n // Called for leaf DOM nodes that would otherwise be ignored\n leafFallback(dom, marks) {\n if (dom.nodeName == \"BR\" && this.top.type && this.top.type.inlineContent) this.addTextNode(dom.ownerDocument.createTextNode(\"\\n\"), marks);\n }\n // Called for ignored nodes\n ignoreFallback(dom, marks) {\n // Ignored BR nodes should at least create an inline context\n if (dom.nodeName == \"BR\" && (!this.top.type || !this.top.type.inlineContent)) this.findPlace(this.parser.schema.text(\"-\"), marks);\n }\n // Run any style parser associated with the node's styles. Either\n // return an updated array of marks, or null to indicate some of the\n // styles had a rule with `ignore` set.\n readStyles(dom, marks) {\n let styles = dom.style;\n // Because many properties will only show up in 'normalized' form\n // in `style.item` (i.e. text-decoration becomes\n // text-decoration-line, text-decoration-color, etc), we directly\n // query the styles mentioned in our rules instead of iterating\n // over the items.\n if (styles && styles.length) for (let i = 0; i < this.parser.matchedStyles.length; i++) {\n let name = this.parser.matchedStyles[i],\n value = styles.getPropertyValue(name);\n if (value) for (let after = undefined;;) {\n let rule = this.parser.matchStyle(name, value, this, after);\n if (!rule) break;\n if (rule.ignore) return null;\n if (rule.clearMark) marks = marks.filter(m => !rule.clearMark(m));else marks = marks.concat(this.parser.schema.marks[rule.mark].create(rule.attrs));\n if (rule.consuming === false) after = rule;else break;\n }\n }\n return marks;\n }\n // Look up a handler for the given node. If none are found, return\n // false. Otherwise, apply it, use its return value to drive the way\n // the node's content is wrapped, and return true.\n addElementByRule(dom, rule, marks, continueAfter) {\n let sync, nodeType;\n if (rule.node) {\n nodeType = this.parser.schema.nodes[rule.node];\n if (!nodeType.isLeaf) {\n let inner = this.enter(nodeType, rule.attrs || null, marks, rule.preserveWhitespace);\n if (inner) {\n sync = true;\n marks = inner;\n }\n } else if (!this.insertNode(nodeType.create(rule.attrs), marks)) {\n this.leafFallback(dom, marks);\n }\n } else {\n let markType = this.parser.schema.marks[rule.mark];\n marks = marks.concat(markType.create(rule.attrs));\n }\n let startIn = this.top;\n if (nodeType && nodeType.isLeaf) {\n this.findInside(dom);\n } else if (continueAfter) {\n this.addElement(dom, marks, continueAfter);\n } else if (rule.getContent) {\n this.findInside(dom);\n rule.getContent(dom, this.parser.schema).forEach(node => this.insertNode(node, marks));\n } else {\n let contentDOM = dom;\n if (typeof rule.contentElement == \"string\") contentDOM = dom.querySelector(rule.contentElement);else if (typeof rule.contentElement == \"function\") contentDOM = rule.contentElement(dom);else if (rule.contentElement) contentDOM = rule.contentElement;\n this.findAround(dom, contentDOM, true);\n this.addAll(contentDOM, marks);\n this.findAround(dom, contentDOM, false);\n }\n if (sync && this.sync(startIn)) this.open--;\n }\n // Add all child nodes between `startIndex` and `endIndex` (or the\n // whole node, if not given). If `sync` is passed, use it to\n // synchronize after every block element.\n addAll(parent, marks, startIndex, endIndex) {\n let index = startIndex || 0;\n for (let dom = startIndex ? parent.childNodes[startIndex] : parent.firstChild, end = endIndex == null ? null : parent.childNodes[endIndex]; dom != end; dom = dom.nextSibling, ++index) {\n this.findAtPoint(parent, index);\n this.addDOM(dom, marks);\n }\n this.findAtPoint(parent, index);\n }\n // Try to find a way to fit the given node type into the current\n // context. May add intermediate wrappers and/or leave non-solid\n // nodes that we're in.\n findPlace(node, marks) {\n let route, sync;\n for (let depth = this.open; depth >= 0; depth--) {\n let cx = this.nodes[depth];\n let found = cx.findWrapping(node);\n if (found && (!route || route.length > found.length)) {\n route = found;\n sync = cx;\n if (!found.length) break;\n }\n if (cx.solid) break;\n }\n if (!route) return null;\n this.sync(sync);\n for (let i = 0; i < route.length; i++) marks = this.enterInner(route[i], null, marks, false);\n return marks;\n }\n // Try to insert the given node, adjusting the context when needed.\n insertNode(node, marks) {\n if (node.isInline && this.needsBlock && !this.top.type) {\n let block = this.textblockFromContext();\n if (block) marks = this.enterInner(block, null, marks);\n }\n let innerMarks = this.findPlace(node, marks);\n if (innerMarks) {\n this.closeExtra();\n let top = this.top;\n if (top.match) top.match = top.match.matchType(node.type);\n let nodeMarks = Mark.none;\n for (let m of innerMarks.concat(node.marks)) if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, node.type)) nodeMarks = m.addToSet(nodeMarks);\n top.content.push(node.mark(nodeMarks));\n return true;\n }\n return false;\n }\n // Try to start a node of the given type, adjusting the context when\n // necessary.\n enter(type, attrs, marks, preserveWS) {\n let innerMarks = this.findPlace(type.create(attrs), marks);\n if (innerMarks) innerMarks = this.enterInner(type, attrs, marks, true, preserveWS);\n return innerMarks;\n }\n // Open a node of the given type\n enterInner(type, attrs, marks, solid = false, preserveWS) {\n this.closeExtra();\n let top = this.top;\n top.match = top.match && top.match.matchType(type);\n let options = wsOptionsFor(type, preserveWS, top.options);\n if (top.options & OPT_OPEN_LEFT && top.content.length == 0) options |= OPT_OPEN_LEFT;\n let applyMarks = Mark.none;\n marks = marks.filter(m => {\n if (top.type ? top.type.allowsMarkType(m.type) : markMayApply(m.type, type)) {\n applyMarks = m.addToSet(applyMarks);\n return false;\n }\n return true;\n });\n this.nodes.push(new NodeContext(type, attrs, applyMarks, solid, null, options));\n this.open++;\n return marks;\n }\n // Make sure all nodes above this.open are finished and added to\n // their parents\n closeExtra(openEnd = false) {\n let i = this.nodes.length - 1;\n if (i > this.open) {\n for (; i > this.open; i--) this.nodes[i - 1].content.push(this.nodes[i].finish(openEnd));\n this.nodes.length = this.open + 1;\n }\n }\n finish() {\n this.open = 0;\n this.closeExtra(this.isOpen);\n return this.nodes[0].finish(!!(this.isOpen || this.options.topOpen));\n }\n sync(to) {\n for (let i = this.open; i >= 0; i--) {\n if (this.nodes[i] == to) {\n this.open = i;\n return true;\n } else if (this.localPreserveWS) {\n this.nodes[i].options |= OPT_PRESERVE_WS;\n }\n }\n return false;\n }\n get currentPos() {\n this.closeExtra();\n let pos = 0;\n for (let i = this.open; i >= 0; i--) {\n let content = this.nodes[i].content;\n for (let j = content.length - 1; j >= 0; j--) pos += content[j].nodeSize;\n if (i) pos++;\n }\n return pos;\n }\n findAtPoint(parent, offset) {\n if (this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == parent && this.find[i].offset == offset) this.find[i].pos = this.currentPos;\n }\n }\n findInside(parent) {\n if (this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) this.find[i].pos = this.currentPos;\n }\n }\n findAround(parent, content, before) {\n if (parent != content && this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].pos == null && parent.nodeType == 1 && parent.contains(this.find[i].node)) {\n let pos = content.compareDocumentPosition(this.find[i].node);\n if (pos & (before ? 2 : 4)) this.find[i].pos = this.currentPos;\n }\n }\n }\n findInText(textNode) {\n if (this.find) for (let i = 0; i < this.find.length; i++) {\n if (this.find[i].node == textNode) this.find[i].pos = this.currentPos - (textNode.nodeValue.length - this.find[i].offset);\n }\n }\n // Determines whether the given context string matches this context.\n matchesContext(context) {\n if (context.indexOf(\"|\") > -1) return context.split(/\\s*\\|\\s*/).some(this.matchesContext, this);\n let parts = context.split(\"/\");\n let option = this.options.context;\n let useRoot = !this.isOpen && (!option || option.parent.type == this.nodes[0].type);\n let minDepth = -(option ? option.depth + 1 : 0) + (useRoot ? 0 : 1);\n let match = (i, depth) => {\n for (; i >= 0; i--) {\n let part = parts[i];\n if (part == \"\") {\n if (i == parts.length - 1 || i == 0) continue;\n for (; depth >= minDepth; depth--) if (match(i - 1, depth)) return true;\n return false;\n } else {\n let next = depth > 0 || depth == 0 && useRoot ? this.nodes[depth].type : option && depth >= minDepth ? option.node(depth - minDepth).type : null;\n if (!next || next.name != part && !next.isInGroup(part)) return false;\n depth--;\n }\n }\n return true;\n };\n return match(parts.length - 1, this.open);\n }\n textblockFromContext() {\n let $context = this.options.context;\n if ($context) for (let d = $context.depth; d >= 0; d--) {\n let deflt = $context.node(d).contentMatchAt($context.indexAfter(d)).defaultType;\n if (deflt && deflt.isTextblock && deflt.defaultAttrs) return deflt;\n }\n for (let name in this.parser.schema.nodes) {\n let type = this.parser.schema.nodes[name];\n if (type.isTextblock && type.defaultAttrs) return type;\n }\n }\n}\n// Kludge to work around directly nested list nodes produced by some\n// tools and allowed by browsers to mean that the nested list is\n// actually part of the list item above it.\nfunction normalizeList(dom) {\n for (let child = dom.firstChild, prevItem = null; child; child = child.nextSibling) {\n let name = child.nodeType == 1 ? child.nodeName.toLowerCase() : null;\n if (name && listTags.hasOwnProperty(name) && prevItem) {\n prevItem.appendChild(child);\n child = prevItem;\n } else if (name == \"li\") {\n prevItem = child;\n } else if (name) {\n prevItem = null;\n }\n }\n}\n// Apply a CSS selector.\nfunction matches(dom, selector) {\n return (dom.matches || dom.msMatchesSelector || dom.webkitMatchesSelector || dom.mozMatchesSelector).call(dom, selector);\n}\nfunction copy(obj) {\n let copy = {};\n for (let prop in obj) copy[prop] = obj[prop];\n return copy;\n}\n// Used when finding a mark at the top level of a fragment parse.\n// Checks whether it would be reasonable to apply a given mark type to\n// a given node, by looking at the way the mark occurs in the schema.\nfunction markMayApply(markType, nodeType) {\n let nodes = nodeType.schema.nodes;\n for (let name in nodes) {\n let parent = nodes[name];\n if (!parent.allowsMarkType(markType)) continue;\n let seen = [],\n scan = match => {\n seen.push(match);\n for (let i = 0; i < match.edgeCount; i++) {\n let {\n type,\n next\n } = match.edge(i);\n if (type == nodeType) return true;\n if (seen.indexOf(next) < 0 && scan(next)) return true;\n }\n };\n if (scan(parent.contentMatch)) return true;\n }\n}\n\n/**\nA DOM serializer knows how to convert ProseMirror nodes and\nmarks of various types to DOM nodes.\n*/\nclass DOMSerializer {\n /**\n Create a serializer. `nodes` should map node names to functions\n that take a node and return a description of the corresponding\n DOM. `marks` does the same for mark names, but also gets an\n argument that tells it whether the mark's content is block or\n inline content (for typical use, it'll always be inline). A mark\n serializer may be `null` to indicate that marks of that type\n should not be serialized.\n */\n constructor(\n /**\n The node serialization functions.\n */\n nodes,\n /**\n The mark serialization functions.\n */\n marks) {\n this.nodes = nodes;\n this.marks = marks;\n }\n /**\n Serialize the content of this fragment to a DOM fragment. When\n not in the browser, the `document` option, containing a DOM\n document, should be passed so that the serializer can create\n nodes.\n */\n serializeFragment(fragment, options = {}, target) {\n if (!target) target = doc(options).createDocumentFragment();\n let top = target,\n active = [];\n fragment.forEach(node => {\n if (active.length || node.marks.length) {\n let keep = 0,\n rendered = 0;\n while (keep < active.length && rendered < node.marks.length) {\n let next = node.marks[rendered];\n if (!this.marks[next.type.name]) {\n rendered++;\n continue;\n }\n if (!next.eq(active[keep][0]) || next.type.spec.spanning === false) break;\n keep++;\n rendered++;\n }\n while (keep < active.length) top = active.pop()[1];\n while (rendered < node.marks.length) {\n let add = node.marks[rendered++];\n let markDOM = this.serializeMark(add, node.isInline, options);\n if (markDOM) {\n active.push([add, top]);\n top.appendChild(markDOM.dom);\n top = markDOM.contentDOM || markDOM.dom;\n }\n }\n }\n top.appendChild(this.serializeNodeInner(node, options));\n });\n return target;\n }\n /**\n @internal\n */\n serializeNodeInner(node, options) {\n let {\n dom,\n contentDOM\n } = renderSpec(doc(options), this.nodes[node.type.name](node), null, node.attrs);\n if (contentDOM) {\n if (node.isLeaf) throw new RangeError(\"Content hole not allowed in a leaf node spec\");\n this.serializeFragment(node.content, options, contentDOM);\n }\n return dom;\n }\n /**\n Serialize this node to a DOM node. This can be useful when you\n need to serialize a part of a document, as opposed to the whole\n document. To serialize a whole document, use\n [`serializeFragment`](https://prosemirror.net/docs/ref/#model.DOMSerializer.serializeFragment) on\n its [content](https://prosemirror.net/docs/ref/#model.Node.content).\n */\n serializeNode(node, options = {}) {\n let dom = this.serializeNodeInner(node, options);\n for (let i = node.marks.length - 1; i >= 0; i--) {\n let wrap = this.serializeMark(node.marks[i], node.isInline, options);\n if (wrap) {\n (wrap.contentDOM || wrap.dom).appendChild(dom);\n dom = wrap.dom;\n }\n }\n return dom;\n }\n /**\n @internal\n */\n serializeMark(mark, inline, options = {}) {\n let toDOM = this.marks[mark.type.name];\n return toDOM && renderSpec(doc(options), toDOM(mark, inline), null, mark.attrs);\n }\n static renderSpec(doc, structure, xmlNS = null, blockArraysIn) {\n return renderSpec(doc, structure, xmlNS, blockArraysIn);\n }\n /**\n Build a serializer using the [`toDOM`](https://prosemirror.net/docs/ref/#model.NodeSpec.toDOM)\n properties in a schema's node and mark specs.\n */\n static fromSchema(schema) {\n return schema.cached.domSerializer || (schema.cached.domSerializer = new DOMSerializer(this.nodesFromSchema(schema), this.marksFromSchema(schema)));\n }\n /**\n Gather the serializers in a schema's node specs into an object.\n This can be useful as a base to build a custom serializer from.\n */\n static nodesFromSchema(schema) {\n let result = gatherToDOM(schema.nodes);\n if (!result.text) result.text = node => node.text;\n return result;\n }\n /**\n Gather the serializers in a schema's mark specs into an object.\n */\n static marksFromSchema(schema) {\n return gatherToDOM(schema.marks);\n }\n}\nfunction gatherToDOM(obj) {\n let result = {};\n for (let name in obj) {\n let toDOM = obj[name].spec.toDOM;\n if (toDOM) result[name] = toDOM;\n }\n return result;\n}\nfunction doc(options) {\n return options.document || window.document;\n}\nconst suspiciousAttributeCache = new WeakMap();\nfunction suspiciousAttributes(attrs) {\n let value = suspiciousAttributeCache.get(attrs);\n if (value === undefined) suspiciousAttributeCache.set(attrs, value = suspiciousAttributesInner(attrs));\n return value;\n}\nfunction suspiciousAttributesInner(attrs) {\n let result = null;\n function scan(value) {\n if (value && typeof value == \"object\") {\n if (Array.isArray(value)) {\n if (typeof value[0] == \"string\") {\n if (!result) result = [];\n result.push(value);\n } else {\n for (let i = 0; i < value.length; i++) scan(value[i]);\n }\n } else {\n for (let prop in value) scan(value[prop]);\n }\n }\n }\n scan(attrs);\n return result;\n}\nfunction renderSpec(doc, structure, xmlNS, blockArraysIn) {\n if (typeof structure == \"string\") return {\n dom: doc.createTextNode(structure)\n };\n if (structure.nodeType != null) return {\n dom: structure\n };\n if (structure.dom && structure.dom.nodeType != null) return structure;\n let tagName = structure[0],\n suspicious;\n if (typeof tagName != \"string\") throw new RangeError(\"Invalid array passed to renderSpec\");\n if (blockArraysIn && (suspicious = suspiciousAttributes(blockArraysIn)) && suspicious.indexOf(structure) > -1) throw new RangeError(\"Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.\");\n let space = tagName.indexOf(\" \");\n if (space > 0) {\n xmlNS = tagName.slice(0, space);\n tagName = tagName.slice(space + 1);\n }\n let contentDOM;\n let dom = xmlNS ? doc.createElementNS(xmlNS, tagName) : doc.createElement(tagName);\n let attrs = structure[1],\n start = 1;\n if (attrs && typeof attrs == \"object\" && attrs.nodeType == null && !Array.isArray(attrs)) {\n start = 2;\n for (let name in attrs) if (attrs[name] != null) {\n let space = name.indexOf(\" \");\n if (space > 0) dom.setAttributeNS(name.slice(0, space), name.slice(space + 1), attrs[name]);else dom.setAttribute(name, attrs[name]);\n }\n }\n for (let i = start; i < structure.length; i++) {\n let child = structure[i];\n if (child === 0) {\n if (i < structure.length - 1 || i > start) throw new RangeError(\"Content hole must be the only child of its parent node\");\n return {\n dom,\n contentDOM: dom\n };\n } else {\n let {\n dom: inner,\n contentDOM: innerContent\n } = renderSpec(doc, child, xmlNS, blockArraysIn);\n dom.appendChild(inner);\n if (innerContent) {\n if (contentDOM) throw new RangeError(\"Multiple content holes\");\n contentDOM = innerContent;\n }\n }\n }\n return {\n dom,\n contentDOM\n };\n}\nexport { ContentMatch, DOMParser, DOMSerializer, Fragment, Mark, MarkType, Node, NodeRange, NodeType, ReplaceError, ResolvedPos, Schema, Slice };","import { ReplaceError, Slice, Fragment, MarkType, Mark } from 'prosemirror-model';\n\n// Recovery values encode a range index and an offset. They are\n// represented as numbers, because tons of them will be created when\n// mapping, for example, a large number of decorations. The number's\n// lower 16 bits provide the index, the remaining bits the offset.\n//\n// Note: We intentionally don't use bit shift operators to en- and\n// decode these, since those clip to 32 bits, which we might in rare\n// cases want to overflow. A 64-bit float can represent 48-bit\n// integers precisely.\nconst lower16 = 0xffff;\nconst factor16 = Math.pow(2, 16);\nfunction makeRecover(index, offset) {\n return index + offset * factor16;\n}\nfunction recoverIndex(value) {\n return value & lower16;\n}\nfunction recoverOffset(value) {\n return (value - (value & lower16)) / factor16;\n}\nconst DEL_BEFORE = 1,\n DEL_AFTER = 2,\n DEL_ACROSS = 4,\n DEL_SIDE = 8;\n/**\nAn object representing a mapped position with extra\ninformation.\n*/\nclass MapResult {\n /**\n @internal\n */\n constructor(\n /**\n The mapped version of the position.\n */\n pos,\n /**\n @internal\n */\n delInfo,\n /**\n @internal\n */\n recover) {\n this.pos = pos;\n this.delInfo = delInfo;\n this.recover = recover;\n }\n /**\n Tells you whether the position was deleted, that is, whether the\n step removed the token on the side queried (via the `assoc`)\n argument from the document.\n */\n get deleted() {\n return (this.delInfo & DEL_SIDE) > 0;\n }\n /**\n Tells you whether the token before the mapped position was deleted.\n */\n get deletedBefore() {\n return (this.delInfo & (DEL_BEFORE | DEL_ACROSS)) > 0;\n }\n /**\n True when the token after the mapped position was deleted.\n */\n get deletedAfter() {\n return (this.delInfo & (DEL_AFTER | DEL_ACROSS)) > 0;\n }\n /**\n Tells whether any of the steps mapped through deletes across the\n position (including both the token before and after the\n position).\n */\n get deletedAcross() {\n return (this.delInfo & DEL_ACROSS) > 0;\n }\n}\n/**\nA map describing the deletions and insertions made by a step, which\ncan be used to find the correspondence between positions in the\npre-step version of a document and the same position in the\npost-step version.\n*/\nclass StepMap {\n /**\n Create a position map. The modifications to the document are\n represented as an array of numbers, in which each group of three\n represents a modified chunk as `[start, oldSize, newSize]`.\n */\n constructor(\n /**\n @internal\n */\n ranges,\n /**\n @internal\n */\n inverted = false) {\n this.ranges = ranges;\n this.inverted = inverted;\n if (!ranges.length && StepMap.empty) return StepMap.empty;\n }\n /**\n @internal\n */\n recover(value) {\n let diff = 0,\n index = recoverIndex(value);\n if (!this.inverted) for (let i = 0; i < index; i++) diff += this.ranges[i * 3 + 2] - this.ranges[i * 3 + 1];\n return this.ranges[index * 3] + diff + recoverOffset(value);\n }\n mapResult(pos, assoc = 1) {\n return this._map(pos, assoc, false);\n }\n map(pos, assoc = 1) {\n return this._map(pos, assoc, true);\n }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let diff = 0,\n oldIndex = this.inverted ? 2 : 1,\n newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) break;\n let oldSize = this.ranges[i + oldIndex],\n newSize = this.ranges[i + newIndex],\n end = start + oldSize;\n if (pos <= end) {\n let side = !oldSize ? assoc : pos == start ? -1 : pos == end ? 1 : assoc;\n let result = start + diff + (side < 0 ? 0 : newSize);\n if (simple) return result;\n let recover = pos == (assoc < 0 ? start : end) ? null : makeRecover(i / 3, pos - start);\n let del = pos == start ? DEL_AFTER : pos == end ? DEL_BEFORE : DEL_ACROSS;\n if (assoc < 0 ? pos != start : pos != end) del |= DEL_SIDE;\n return new MapResult(result, del, recover);\n }\n diff += newSize - oldSize;\n }\n return simple ? pos + diff : new MapResult(pos + diff, 0, null);\n }\n /**\n @internal\n */\n touches(pos, recover) {\n let diff = 0,\n index = recoverIndex(recover);\n let oldIndex = this.inverted ? 2 : 1,\n newIndex = this.inverted ? 1 : 2;\n for (let i = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i] - (this.inverted ? diff : 0);\n if (start > pos) break;\n let oldSize = this.ranges[i + oldIndex],\n end = start + oldSize;\n if (pos <= end && i == index * 3) return true;\n diff += this.ranges[i + newIndex] - oldSize;\n }\n return false;\n }\n /**\n Calls the given function on each of the changed ranges included in\n this map.\n */\n forEach(f) {\n let oldIndex = this.inverted ? 2 : 1,\n newIndex = this.inverted ? 1 : 2;\n for (let i = 0, diff = 0; i < this.ranges.length; i += 3) {\n let start = this.ranges[i],\n oldStart = start - (this.inverted ? diff : 0),\n newStart = start + (this.inverted ? 0 : diff);\n let oldSize = this.ranges[i + oldIndex],\n newSize = this.ranges[i + newIndex];\n f(oldStart, oldStart + oldSize, newStart, newStart + newSize);\n diff += newSize - oldSize;\n }\n }\n /**\n Create an inverted version of this map. The result can be used to\n map positions in the post-step document to the pre-step document.\n */\n invert() {\n return new StepMap(this.ranges, !this.inverted);\n }\n /**\n @internal\n */\n toString() {\n return (this.inverted ? \"-\" : \"\") + JSON.stringify(this.ranges);\n }\n /**\n Create a map that moves all positions by offset `n` (which may be\n negative). This can be useful when applying steps meant for a\n sub-document to a larger document, or vice-versa.\n */\n static offset(n) {\n return n == 0 ? StepMap.empty : new StepMap(n < 0 ? [0, -n, 0] : [0, 0, n]);\n }\n}\n/**\nA StepMap that contains no changed ranges.\n*/\nStepMap.empty = new StepMap([]);\n/**\nA mapping represents a pipeline of zero or more [step\nmaps](https://prosemirror.net/docs/ref/#transform.StepMap). It has special provisions for losslessly\nhandling mapping positions through a series of steps in which some\nsteps are inverted versions of earlier steps. (This comes up when\n‘[rebasing](/docs/guide/#transform.rebasing)’ steps for\ncollaboration or history management.)\n*/\nclass Mapping {\n /**\n Create a new mapping with the given position maps.\n */\n constructor(\n /**\n The step maps in this mapping.\n */\n maps = [],\n /**\n @internal\n */\n mirror,\n /**\n The starting position in the `maps` array, used when `map` or\n `mapResult` is called.\n */\n from = 0,\n /**\n The end position in the `maps` array.\n */\n to = maps.length) {\n this.maps = maps;\n this.mirror = mirror;\n this.from = from;\n this.to = to;\n }\n /**\n Create a mapping that maps only through a part of this one.\n */\n slice(from = 0, to = this.maps.length) {\n return new Mapping(this.maps, this.mirror, from, to);\n }\n /**\n @internal\n */\n copy() {\n return new Mapping(this.maps.slice(), this.mirror && this.mirror.slice(), this.from, this.to);\n }\n /**\n Add a step map to the end of this mapping. If `mirrors` is\n given, it should be the index of the step map that is the mirror\n image of this one.\n */\n appendMap(map, mirrors) {\n this.to = this.maps.push(map);\n if (mirrors != null) this.setMirror(this.maps.length - 1, mirrors);\n }\n /**\n Add all the step maps in a given mapping to this one (preserving\n mirroring information).\n */\n appendMapping(mapping) {\n for (let i = 0, startSize = this.maps.length; i < mapping.maps.length; i++) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i], mirr != null && mirr < i ? startSize + mirr : undefined);\n }\n }\n /**\n Finds the offset of the step map that mirrors the map at the\n given offset, in this mapping (as per the second argument to\n `appendMap`).\n */\n getMirror(n) {\n if (this.mirror) for (let i = 0; i < this.mirror.length; i++) if (this.mirror[i] == n) return this.mirror[i + (i % 2 ? -1 : 1)];\n }\n /**\n @internal\n */\n setMirror(n, m) {\n if (!this.mirror) this.mirror = [];\n this.mirror.push(n, m);\n }\n /**\n Append the inverse of the given mapping to this one.\n */\n appendMappingInverted(mapping) {\n for (let i = mapping.maps.length - 1, totalSize = this.maps.length + mapping.maps.length; i >= 0; i--) {\n let mirr = mapping.getMirror(i);\n this.appendMap(mapping.maps[i].invert(), mirr != null && mirr > i ? totalSize - mirr - 1 : undefined);\n }\n }\n /**\n Create an inverted version of this mapping.\n */\n invert() {\n let inverse = new Mapping();\n inverse.appendMappingInverted(this);\n return inverse;\n }\n /**\n Map a position through this mapping.\n */\n map(pos, assoc = 1) {\n if (this.mirror) return this._map(pos, assoc, true);\n for (let i = this.from; i < this.to; i++) pos = this.maps[i].map(pos, assoc);\n return pos;\n }\n /**\n Map a position through this mapping, returning a mapping\n result.\n */\n mapResult(pos, assoc = 1) {\n return this._map(pos, assoc, false);\n }\n /**\n @internal\n */\n _map(pos, assoc, simple) {\n let delInfo = 0;\n for (let i = this.from; i < this.to; i++) {\n let map = this.maps[i],\n result = map.mapResult(pos, assoc);\n if (result.recover != null) {\n let corr = this.getMirror(i);\n if (corr != null && corr > i && corr < this.to) {\n i = corr;\n pos = this.maps[corr].recover(result.recover);\n continue;\n }\n }\n delInfo |= result.delInfo;\n pos = result.pos;\n }\n return simple ? pos : new MapResult(pos, delInfo, null);\n }\n}\nconst stepsByID = Object.create(null);\n/**\nA step object represents an atomic change. It generally applies\nonly to the document it was created for, since the positions\nstored in it will only make sense for that document.\n\nNew steps are defined by creating classes that extend `Step`,\noverriding the `apply`, `invert`, `map`, `getMap` and `fromJSON`\nmethods, and registering your class with a unique\nJSON-serialization identifier using\n[`Step.jsonID`](https://prosemirror.net/docs/ref/#transform.Step^jsonID).\n*/\nclass Step {\n /**\n Get the step map that represents the changes made by this step,\n and which can be used to transform between positions in the old\n and the new document.\n */\n getMap() {\n return StepMap.empty;\n }\n /**\n Try to merge this step with another one, to be applied directly\n after it. Returns the merged step when possible, null if the\n steps can't be merged.\n */\n merge(other) {\n return null;\n }\n /**\n Deserialize a step from its JSON representation. Will call\n through to the step class' own implementation of this method.\n */\n static fromJSON(schema, json) {\n if (!json || !json.stepType) throw new RangeError(\"Invalid input for Step.fromJSON\");\n let type = stepsByID[json.stepType];\n if (!type) throw new RangeError(`No step type ${json.stepType} defined`);\n return type.fromJSON(schema, json);\n }\n /**\n To be able to serialize steps to JSON, each step needs a string\n ID to attach to its JSON representation. Use this method to\n register an ID for your step classes. Try to pick something\n that's unlikely to clash with steps from other modules.\n */\n static jsonID(id, stepClass) {\n if (id in stepsByID) throw new RangeError(\"Duplicate use of step JSON ID \" + id);\n stepsByID[id] = stepClass;\n stepClass.prototype.jsonID = id;\n return stepClass;\n }\n}\n/**\nThe result of [applying](https://prosemirror.net/docs/ref/#transform.Step.apply) a step. Contains either a\nnew document or a failure value.\n*/\nclass StepResult {\n /**\n @internal\n */\n constructor(\n /**\n The transformed document, if successful.\n */\n doc,\n /**\n The failure message, if unsuccessful.\n */\n failed) {\n this.doc = doc;\n this.failed = failed;\n }\n /**\n Create a successful step result.\n */\n static ok(doc) {\n return new StepResult(doc, null);\n }\n /**\n Create a failed step result.\n */\n static fail(message) {\n return new StepResult(null, message);\n }\n /**\n Call [`Node.replace`](https://prosemirror.net/docs/ref/#model.Node.replace) with the given\n arguments. Create a successful result if it succeeds, and a\n failed one if it throws a `ReplaceError`.\n */\n static fromReplace(doc, from, to, slice) {\n try {\n return StepResult.ok(doc.replace(from, to, slice));\n } catch (e) {\n if (e instanceof ReplaceError) return StepResult.fail(e.message);\n throw e;\n }\n }\n}\nfunction mapFragment(fragment, f, parent) {\n let mapped = [];\n for (let i = 0; i < fragment.childCount; i++) {\n let child = fragment.child(i);\n if (child.content.size) child = child.copy(mapFragment(child.content, f, child));\n if (child.isInline) child = f(child, parent, i);\n mapped.push(child);\n }\n return Fragment.fromArray(mapped);\n}\n/**\nAdd a mark to all inline content between two positions.\n*/\nclass AddMarkStep extends Step {\n /**\n Create a mark step.\n */\n constructor(\n /**\n The start of the marked range.\n */\n from,\n /**\n The end of the marked range.\n */\n to,\n /**\n The mark to add.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to),\n $from = doc.resolve(this.from);\n let parent = $from.node($from.sharedDepth(this.to));\n let slice = new Slice(mapFragment(oldSlice.content, (node, parent) => {\n if (!node.isAtom || !parent.type.allowsMarkType(this.mark.type)) return node;\n return node.mark(this.mark.addToSet(node.marks));\n }, parent), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new RemoveMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) return null;\n return new AddMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof AddMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new AddMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return {\n stepType: \"addMark\",\n mark: this.mark.toJSON(),\n from: this.from,\n to: this.to\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\") throw new RangeError(\"Invalid input for AddMarkStep.fromJSON\");\n return new AddMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addMark\", AddMarkStep);\n/**\nRemove a mark from all inline content between two positions.\n*/\nclass RemoveMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The start of the unmarked range.\n */\n from,\n /**\n The end of the unmarked range.\n */\n to,\n /**\n The mark to remove.\n */\n mark) {\n super();\n this.from = from;\n this.to = to;\n this.mark = mark;\n }\n apply(doc) {\n let oldSlice = doc.slice(this.from, this.to);\n let slice = new Slice(mapFragment(oldSlice.content, node => {\n return node.mark(this.mark.removeFromSet(node.marks));\n }, doc), oldSlice.openStart, oldSlice.openEnd);\n return StepResult.fromReplace(doc, this.from, this.to, slice);\n }\n invert() {\n return new AddMarkStep(this.from, this.to, this.mark);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n if (from.deleted && to.deleted || from.pos >= to.pos) return null;\n return new RemoveMarkStep(from.pos, to.pos, this.mark);\n }\n merge(other) {\n if (other instanceof RemoveMarkStep && other.mark.eq(this.mark) && this.from <= other.to && this.to >= other.from) return new RemoveMarkStep(Math.min(this.from, other.from), Math.max(this.to, other.to), this.mark);\n return null;\n }\n toJSON() {\n return {\n stepType: \"removeMark\",\n mark: this.mark.toJSON(),\n from: this.from,\n to: this.to\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\") throw new RangeError(\"Invalid input for RemoveMarkStep.fromJSON\");\n return new RemoveMarkStep(json.from, json.to, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeMark\", RemoveMarkStep);\n/**\nAdd a mark to a specific node.\n*/\nclass AddNodeMarkStep extends Step {\n /**\n Create a node mark step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos,\n /**\n The mark to add.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node) return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (node) {\n let newSet = this.mark.addToSet(node.marks);\n if (newSet.length == node.marks.length) {\n for (let i = 0; i < node.marks.length; i++) if (!node.marks[i].isInSet(newSet)) return new AddNodeMarkStep(this.pos, node.marks[i]);\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n }\n return new RemoveNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return {\n stepType: \"addNodeMark\",\n pos: this.pos,\n mark: this.mark.toJSON()\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\") throw new RangeError(\"Invalid input for AddNodeMarkStep.fromJSON\");\n return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"addNodeMark\", AddNodeMarkStep);\n/**\nRemove a mark from a specific node.\n*/\nclass RemoveNodeMarkStep extends Step {\n /**\n Create a mark-removing step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos,\n /**\n The mark to remove.\n */\n mark) {\n super();\n this.pos = pos;\n this.mark = mark;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node) return StepResult.fail(\"No node at mark step's position\");\n let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n invert(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node || !this.mark.isInSet(node.marks)) return this;\n return new AddNodeMarkStep(this.pos, this.mark);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);\n }\n toJSON() {\n return {\n stepType: \"removeNodeMark\",\n pos: this.pos,\n mark: this.mark.toJSON()\n };\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\") throw new RangeError(\"Invalid input for RemoveNodeMarkStep.fromJSON\");\n return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));\n }\n}\nStep.jsonID(\"removeNodeMark\", RemoveNodeMarkStep);\n\n/**\nReplace a part of the document with a slice of new content.\n*/\nclass ReplaceStep extends Step {\n /**\n The given `slice` should fit the 'gap' between `from` and\n `to`—the depths must line up, and the surrounding nodes must be\n able to be joined with the open sides of the slice. When\n `structure` is true, the step will fail if the content between\n from and to is not just a sequence of closing and then opening\n tokens (this is to guard against rebased replace steps\n overwriting something they weren't supposed to).\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from,\n /**\n The end position of the replaced range.\n */\n to,\n /**\n The slice to insert.\n */\n slice,\n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.slice = slice;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && contentBetween(doc, this.from, this.to)) return StepResult.fail(\"Structure replace would overwrite content\");\n return StepResult.fromReplace(doc, this.from, this.to, this.slice);\n }\n getMap() {\n return new StepMap([this.from, this.to - this.from, this.slice.size]);\n }\n invert(doc) {\n return new ReplaceStep(this.from, this.from + this.slice.size, doc.slice(this.from, this.to));\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n if (from.deletedAcross && to.deletedAcross) return null;\n return new ReplaceStep(from.pos, Math.max(from.pos, to.pos), this.slice);\n }\n merge(other) {\n if (!(other instanceof ReplaceStep) || other.structure || this.structure) return null;\n if (this.from + this.slice.size == other.from && !this.slice.openEnd && !other.slice.openStart) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(this.slice.content.append(other.slice.content), this.slice.openStart, other.slice.openEnd);\n return new ReplaceStep(this.from, this.to + (other.to - other.from), slice, this.structure);\n } else if (other.to == this.from && !this.slice.openStart && !other.slice.openEnd) {\n let slice = this.slice.size + other.slice.size == 0 ? Slice.empty : new Slice(other.slice.content.append(this.slice.content), other.slice.openStart, this.slice.openEnd);\n return new ReplaceStep(other.from, this.to, slice, this.structure);\n } else {\n return null;\n }\n }\n toJSON() {\n let json = {\n stepType: \"replace\",\n from: this.from,\n to: this.to\n };\n if (this.slice.size) json.slice = this.slice.toJSON();\n if (this.structure) json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\") throw new RangeError(\"Invalid input for ReplaceStep.fromJSON\");\n return new ReplaceStep(json.from, json.to, Slice.fromJSON(schema, json.slice), !!json.structure);\n }\n}\nStep.jsonID(\"replace\", ReplaceStep);\n/**\nReplace a part of the document with a slice of content, but\npreserve a range of the replaced content by moving it into the\nslice.\n*/\nclass ReplaceAroundStep extends Step {\n /**\n Create a replace-around step with the given range and gap.\n `insert` should be the point in the slice into which the content\n of the gap should be moved. `structure` has the same meaning as\n it has in the [`ReplaceStep`](https://prosemirror.net/docs/ref/#transform.ReplaceStep) class.\n */\n constructor(\n /**\n The start position of the replaced range.\n */\n from,\n /**\n The end position of the replaced range.\n */\n to,\n /**\n The start of preserved range.\n */\n gapFrom,\n /**\n The end of preserved range.\n */\n gapTo,\n /**\n The slice to insert.\n */\n slice,\n /**\n The position in the slice where the preserved range should be\n inserted.\n */\n insert,\n /**\n @internal\n */\n structure = false) {\n super();\n this.from = from;\n this.to = to;\n this.gapFrom = gapFrom;\n this.gapTo = gapTo;\n this.slice = slice;\n this.insert = insert;\n this.structure = structure;\n }\n apply(doc) {\n if (this.structure && (contentBetween(doc, this.from, this.gapFrom) || contentBetween(doc, this.gapTo, this.to))) return StepResult.fail(\"Structure gap-replace would overwrite content\");\n let gap = doc.slice(this.gapFrom, this.gapTo);\n if (gap.openStart || gap.openEnd) return StepResult.fail(\"Gap is not a flat range\");\n let inserted = this.slice.insertAt(this.insert, gap.content);\n if (!inserted) return StepResult.fail(\"Content does not fit in gap\");\n return StepResult.fromReplace(doc, this.from, this.to, inserted);\n }\n getMap() {\n return new StepMap([this.from, this.gapFrom - this.from, this.insert, this.gapTo, this.to - this.gapTo, this.slice.size - this.insert]);\n }\n invert(doc) {\n let gap = this.gapTo - this.gapFrom;\n return new ReplaceAroundStep(this.from, this.from + this.slice.size + gap, this.from + this.insert, this.from + this.insert + gap, doc.slice(this.from, this.to).removeBetween(this.gapFrom - this.from, this.gapTo - this.from), this.gapFrom - this.from, this.structure);\n }\n map(mapping) {\n let from = mapping.mapResult(this.from, 1),\n to = mapping.mapResult(this.to, -1);\n let gapFrom = this.from == this.gapFrom ? from.pos : mapping.map(this.gapFrom, -1);\n let gapTo = this.to == this.gapTo ? to.pos : mapping.map(this.gapTo, 1);\n if (from.deletedAcross && to.deletedAcross || gapFrom < from.pos || gapTo > to.pos) return null;\n return new ReplaceAroundStep(from.pos, to.pos, gapFrom, gapTo, this.slice, this.insert, this.structure);\n }\n toJSON() {\n let json = {\n stepType: \"replaceAround\",\n from: this.from,\n to: this.to,\n gapFrom: this.gapFrom,\n gapTo: this.gapTo,\n insert: this.insert\n };\n if (this.slice.size) json.slice = this.slice.toJSON();\n if (this.structure) json.structure = true;\n return json;\n }\n /**\n @internal\n */\n static fromJSON(schema, json) {\n if (typeof json.from != \"number\" || typeof json.to != \"number\" || typeof json.gapFrom != \"number\" || typeof json.gapTo != \"number\" || typeof json.insert != \"number\") throw new RangeError(\"Invalid input for ReplaceAroundStep.fromJSON\");\n return new ReplaceAroundStep(json.from, json.to, json.gapFrom, json.gapTo, Slice.fromJSON(schema, json.slice), json.insert, !!json.structure);\n }\n}\nStep.jsonID(\"replaceAround\", ReplaceAroundStep);\nfunction contentBetween(doc, from, to) {\n let $from = doc.resolve(from),\n dist = to - from,\n depth = $from.depth;\n while (dist > 0 && depth > 0 && $from.indexAfter(depth) == $from.node(depth).childCount) {\n depth--;\n dist--;\n }\n if (dist > 0) {\n let next = $from.node(depth).maybeChild($from.indexAfter(depth));\n while (dist > 0) {\n if (!next || next.isLeaf) return true;\n next = next.firstChild;\n dist--;\n }\n }\n return false;\n}\nfunction addMark(tr, from, to, mark) {\n let removed = [],\n added = [];\n let removing, adding;\n tr.doc.nodesBetween(from, to, (node, pos, parent) => {\n if (!node.isInline) return;\n let marks = node.marks;\n if (!mark.isInSet(marks) && parent.type.allowsMarkType(mark.type)) {\n let start = Math.max(pos, from),\n end = Math.min(pos + node.nodeSize, to);\n let newSet = mark.addToSet(marks);\n for (let i = 0; i < marks.length; i++) {\n if (!marks[i].isInSet(newSet)) {\n if (removing && removing.to == start && removing.mark.eq(marks[i])) removing.to = end;else removed.push(removing = new RemoveMarkStep(start, end, marks[i]));\n }\n }\n if (adding && adding.to == start) adding.to = end;else added.push(adding = new AddMarkStep(start, end, mark));\n }\n });\n removed.forEach(s => tr.step(s));\n added.forEach(s => tr.step(s));\n}\nfunction removeMark(tr, from, to, mark) {\n let matched = [],\n step = 0;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isInline) return;\n step++;\n let toRemove = null;\n if (mark instanceof MarkType) {\n let set = node.marks,\n found;\n while (found = mark.isInSet(set)) {\n (toRemove || (toRemove = [])).push(found);\n set = found.removeFromSet(set);\n }\n } else if (mark) {\n if (mark.isInSet(node.marks)) toRemove = [mark];\n } else {\n toRemove = node.marks;\n }\n if (toRemove && toRemove.length) {\n let end = Math.min(pos + node.nodeSize, to);\n for (let i = 0; i < toRemove.length; i++) {\n let style = toRemove[i],\n found;\n for (let j = 0; j < matched.length; j++) {\n let m = matched[j];\n if (m.step == step - 1 && style.eq(matched[j].style)) found = m;\n }\n if (found) {\n found.to = end;\n found.step = step;\n } else {\n matched.push({\n style,\n from: Math.max(pos, from),\n to: end,\n step\n });\n }\n }\n }\n });\n matched.forEach(m => tr.step(new RemoveMarkStep(m.from, m.to, m.style)));\n}\nfunction clearIncompatible(tr, pos, parentType, match = parentType.contentMatch, clearNewlines = true) {\n let node = tr.doc.nodeAt(pos);\n let replSteps = [],\n cur = pos + 1;\n for (let i = 0; i < node.childCount; i++) {\n let child = node.child(i),\n end = cur + child.nodeSize;\n let allowed = match.matchType(child.type);\n if (!allowed) {\n replSteps.push(new ReplaceStep(cur, end, Slice.empty));\n } else {\n match = allowed;\n for (let j = 0; j < child.marks.length; j++) if (!parentType.allowsMarkType(child.marks[j].type)) tr.step(new RemoveMarkStep(cur, end, child.marks[j]));\n if (clearNewlines && child.isText && parentType.whitespace != \"pre\") {\n let m,\n newline = /\\r?\\n|\\r/g,\n slice;\n while (m = newline.exec(child.text)) {\n if (!slice) slice = new Slice(Fragment.from(parentType.schema.text(\" \", parentType.allowedMarks(child.marks))), 0, 0);\n replSteps.push(new ReplaceStep(cur + m.index, cur + m.index + m[0].length, slice));\n }\n }\n }\n cur = end;\n }\n if (!match.validEnd) {\n let fill = match.fillBefore(Fragment.empty, true);\n tr.replace(cur, cur, new Slice(fill, 0, 0));\n }\n for (let i = replSteps.length - 1; i >= 0; i--) tr.step(replSteps[i]);\n}\nfunction canCut(node, start, end) {\n return (start == 0 || node.canReplace(start, node.childCount)) && (end == node.childCount || node.canReplace(0, end));\n}\n/**\nTry to find a target depth to which the content in the given range\ncan be lifted. Will not go across\n[isolating](https://prosemirror.net/docs/ref/#model.NodeSpec.isolating) parent nodes.\n*/\nfunction liftTarget(range) {\n let parent = range.parent;\n let content = parent.content.cutByIndex(range.startIndex, range.endIndex);\n for (let depth = range.depth;; --depth) {\n let node = range.$from.node(depth);\n let index = range.$from.index(depth),\n endIndex = range.$to.indexAfter(depth);\n if (depth < range.depth && node.canReplace(index, endIndex, content)) return depth;\n if (depth == 0 || node.type.spec.isolating || !canCut(node, index, endIndex)) break;\n }\n return null;\n}\nfunction lift(tr, range, target) {\n let {\n $from,\n $to,\n depth\n } = range;\n let gapStart = $from.before(depth + 1),\n gapEnd = $to.after(depth + 1);\n let start = gapStart,\n end = gapEnd;\n let before = Fragment.empty,\n openStart = 0;\n for (let d = depth, splitting = false; d > target; d--) if (splitting || $from.index(d) > 0) {\n splitting = true;\n before = Fragment.from($from.node(d).copy(before));\n openStart++;\n } else {\n start--;\n }\n let after = Fragment.empty,\n openEnd = 0;\n for (let d = depth, splitting = false; d > target; d--) if (splitting || $to.after(d + 1) < $to.end(d)) {\n splitting = true;\n after = Fragment.from($to.node(d).copy(after));\n openEnd++;\n } else {\n end++;\n }\n tr.step(new ReplaceAroundStep(start, end, gapStart, gapEnd, new Slice(before.append(after), openStart, openEnd), before.size - openStart, true));\n}\n/**\nTry to find a valid way to wrap the content in the given range in a\nnode of the given type. May introduce extra nodes around and inside\nthe wrapper node, if necessary. Returns null if no valid wrapping\ncould be found. When `innerRange` is given, that range's content is\nused as the content to fit into the wrapping, instead of the\ncontent of `range`.\n*/\nfunction findWrapping(range, nodeType, attrs = null, innerRange = range) {\n let around = findWrappingOutside(range, nodeType);\n let inner = around && findWrappingInside(innerRange, nodeType);\n if (!inner) return null;\n return around.map(withAttrs).concat({\n type: nodeType,\n attrs\n }).concat(inner.map(withAttrs));\n}\nfunction withAttrs(type) {\n return {\n type,\n attrs: null\n };\n}\nfunction findWrappingOutside(range, type) {\n let {\n parent,\n startIndex,\n endIndex\n } = range;\n let around = parent.contentMatchAt(startIndex).findWrapping(type);\n if (!around) return null;\n let outer = around.length ? around[0] : type;\n return parent.canReplaceWith(startIndex, endIndex, outer) ? around : null;\n}\nfunction findWrappingInside(range, type) {\n let {\n parent,\n startIndex,\n endIndex\n } = range;\n let inner = parent.child(startIndex);\n let inside = type.contentMatch.findWrapping(inner.type);\n if (!inside) return null;\n let lastType = inside.length ? inside[inside.length - 1] : type;\n let innerMatch = lastType.contentMatch;\n for (let i = startIndex; innerMatch && i < endIndex; i++) innerMatch = innerMatch.matchType(parent.child(i).type);\n if (!innerMatch || !innerMatch.validEnd) return null;\n return inside;\n}\nfunction wrap(tr, range, wrappers) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--) {\n if (content.size) {\n let match = wrappers[i].type.contentMatch.matchFragment(content);\n if (!match || !match.validEnd) throw new RangeError(\"Wrapper type given to Transform.wrap does not form valid content of its parent wrapper\");\n }\n content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n }\n let start = range.start,\n end = range.end;\n tr.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));\n}\nfunction setBlockType(tr, from, to, type, attrs) {\n if (!type.isTextblock) throw new RangeError(\"Type given to setBlockType should be a textblock\");\n let mapFrom = tr.steps.length;\n tr.doc.nodesBetween(from, to, (node, pos) => {\n let attrsHere = typeof attrs == \"function\" ? attrs(node) : attrs;\n if (node.isTextblock && !node.hasMarkup(type, attrsHere) && canChangeType(tr.doc, tr.mapping.slice(mapFrom).map(pos), type)) {\n let convertNewlines = null;\n if (type.schema.linebreakReplacement) {\n let pre = type.whitespace == \"pre\",\n supportLinebreak = !!type.contentMatch.matchType(type.schema.linebreakReplacement);\n if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;\n }\n // Ensure all markup that isn't allowed in the new node type is cleared\n if (convertNewlines === false) replaceLinebreaks(tr, node, pos, mapFrom);\n clearIncompatible(tr, tr.mapping.slice(mapFrom).map(pos, 1), type, undefined, convertNewlines === null);\n let mapping = tr.mapping.slice(mapFrom);\n let startM = mapping.map(pos, 1),\n endM = mapping.map(pos + node.nodeSize, 1);\n tr.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));\n if (convertNewlines === true) replaceNewlines(tr, node, pos, mapFrom);\n return false;\n }\n });\n}\nfunction replaceNewlines(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.isText) {\n let m,\n newline = /\\r?\\n|\\r/g;\n while (m = newline.exec(child.text)) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset + m.index);\n tr.replaceWith(start, start + 1, node.type.schema.linebreakReplacement.create());\n }\n }\n });\n}\nfunction replaceLinebreaks(tr, node, pos, mapFrom) {\n node.forEach((child, offset) => {\n if (child.type == child.type.schema.linebreakReplacement) {\n let start = tr.mapping.slice(mapFrom).map(pos + 1 + offset);\n tr.replaceWith(start, start + 1, node.type.schema.text(\"\\n\"));\n }\n });\n}\nfunction canChangeType(doc, pos, type) {\n let $pos = doc.resolve(pos),\n index = $pos.index();\n return $pos.parent.canReplaceWith(index, index + 1, type);\n}\n/**\nChange the type, attributes, and/or marks of the node at `pos`.\nWhen `type` isn't given, the existing node type is preserved,\n*/\nfunction setNodeMarkup(tr, pos, type, attrs, marks) {\n let node = tr.doc.nodeAt(pos);\n if (!node) throw new RangeError(\"No node at given position\");\n if (!type) type = node.type;\n let newNode = type.create(attrs, null, marks || node.marks);\n if (node.isLeaf) return tr.replaceWith(pos, pos + node.nodeSize, newNode);\n if (!type.validContent(node.content)) throw new RangeError(\"Invalid content for node type \" + type.name);\n tr.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment.from(newNode), 0, 0), 1, true));\n}\n/**\nCheck whether splitting at the given position is allowed.\n*/\nfunction canSplit(doc, pos, depth = 1, typesAfter) {\n let $pos = doc.resolve(pos),\n base = $pos.depth - depth;\n let innerType = typesAfter && typesAfter[typesAfter.length - 1] || $pos.parent;\n if (base < 0 || $pos.parent.type.spec.isolating || !$pos.parent.canReplace($pos.index(), $pos.parent.childCount) || !innerType.type.validContent($pos.parent.content.cutByIndex($pos.index(), $pos.parent.childCount))) return false;\n for (let d = $pos.depth - 1, i = depth - 2; d > base; d--, i--) {\n let node = $pos.node(d),\n index = $pos.index(d);\n if (node.type.spec.isolating) return false;\n let rest = node.content.cutByIndex(index, node.childCount);\n let overrideChild = typesAfter && typesAfter[i + 1];\n if (overrideChild) rest = rest.replaceChild(0, overrideChild.type.create(overrideChild.attrs));\n let after = typesAfter && typesAfter[i] || node;\n if (!node.canReplace(index + 1, node.childCount) || !after.type.validContent(rest)) return false;\n }\n let index = $pos.indexAfter(base);\n let baseType = typesAfter && typesAfter[0];\n return $pos.node(base).canReplaceWith(index, index, baseType ? baseType.type : $pos.node(base + 1).type);\n}\nfunction split(tr, pos, depth = 1, typesAfter) {\n let $pos = tr.doc.resolve(pos),\n before = Fragment.empty,\n after = Fragment.empty;\n for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {\n before = Fragment.from($pos.node(d).copy(before));\n let typeAfter = typesAfter && typesAfter[i];\n after = Fragment.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));\n }\n tr.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));\n}\n/**\nTest whether the blocks before and after a given position can be\njoined.\n*/\nfunction canJoin(doc, pos) {\n let $pos = doc.resolve(pos),\n index = $pos.index();\n return joinable($pos.nodeBefore, $pos.nodeAfter) && $pos.parent.canReplace(index, index + 1);\n}\nfunction canAppendWithSubstitutedLinebreaks(a, b) {\n if (!b.content.size) a.type.compatibleContent(b.type);\n let match = a.contentMatchAt(a.childCount);\n let {\n linebreakReplacement\n } = a.type.schema;\n for (let i = 0; i < b.childCount; i++) {\n let child = b.child(i);\n let type = child.type == linebreakReplacement ? a.type.schema.nodes.text : child.type;\n match = match.matchType(type);\n if (!match) return false;\n if (!a.type.allowsMarks(child.marks)) return false;\n }\n return match.validEnd;\n}\nfunction joinable(a, b) {\n return !!(a && b && !a.isLeaf && canAppendWithSubstitutedLinebreaks(a, b));\n}\n/**\nFind an ancestor of the given position that can be joined to the\nblock before (or after if `dir` is positive). Returns the joinable\npoint, if any.\n*/\nfunction joinPoint(doc, pos, dir = -1) {\n let $pos = doc.resolve(pos);\n for (let d = $pos.depth;; d--) {\n let before,\n after,\n index = $pos.index(d);\n if (d == $pos.depth) {\n before = $pos.nodeBefore;\n after = $pos.nodeAfter;\n } else if (dir > 0) {\n before = $pos.node(d + 1);\n index++;\n after = $pos.node(d).maybeChild(index);\n } else {\n before = $pos.node(d).maybeChild(index - 1);\n after = $pos.node(d + 1);\n }\n if (before && !before.isTextblock && joinable(before, after) && $pos.node(d).canReplace(index, index + 1)) return pos;\n if (d == 0) break;\n pos = dir < 0 ? $pos.before(d) : $pos.after(d);\n }\n}\nfunction join(tr, pos, depth) {\n let convertNewlines = null;\n let {\n linebreakReplacement\n } = tr.doc.type.schema;\n let $before = tr.doc.resolve(pos - depth),\n beforeType = $before.node().type;\n if (linebreakReplacement && beforeType.inlineContent) {\n let pre = beforeType.whitespace == \"pre\";\n let supportLinebreak = !!beforeType.contentMatch.matchType(linebreakReplacement);\n if (pre && !supportLinebreak) convertNewlines = false;else if (!pre && supportLinebreak) convertNewlines = true;\n }\n let mapFrom = tr.steps.length;\n if (convertNewlines === false) {\n let $after = tr.doc.resolve(pos + depth);\n replaceLinebreaks(tr, $after.node(), $after.before(), mapFrom);\n }\n if (beforeType.inlineContent) clearIncompatible(tr, pos + depth - 1, beforeType, $before.node().contentMatchAt($before.index()), convertNewlines == null);\n let mapping = tr.mapping.slice(mapFrom),\n start = mapping.map(pos - depth);\n tr.step(new ReplaceStep(start, mapping.map(pos + depth, -1), Slice.empty, true));\n if (convertNewlines === true) {\n let $full = tr.doc.resolve(start);\n replaceNewlines(tr, $full.node(), $full.before(), tr.steps.length);\n }\n return tr;\n}\n/**\nTry to find a point where a node of the given type can be inserted\nnear `pos`, by searching up the node hierarchy when `pos` itself\nisn't a valid place but is at the start or end of a node. Return\nnull if no position was found.\n*/\nfunction insertPoint(doc, pos, nodeType) {\n let $pos = doc.resolve(pos);\n if ($pos.parent.canReplaceWith($pos.index(), $pos.index(), nodeType)) return pos;\n if ($pos.parentOffset == 0) for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.index(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.before(d + 1);\n if (index > 0) return null;\n }\n if ($pos.parentOffset == $pos.parent.content.size) for (let d = $pos.depth - 1; d >= 0; d--) {\n let index = $pos.indexAfter(d);\n if ($pos.node(d).canReplaceWith(index, index, nodeType)) return $pos.after(d + 1);\n if (index < $pos.node(d).childCount) return null;\n }\n return null;\n}\n/**\nFinds a position at or around the given position where the given\nslice can be inserted. Will look at parent nodes' nearest boundary\nand try there, even if the original position wasn't directly at the\nstart or end of that node. Returns null when no position was found.\n*/\nfunction dropPoint(doc, pos, slice) {\n let $pos = doc.resolve(pos);\n if (!slice.content.size) return pos;\n let content = slice.content;\n for (let i = 0; i < slice.openStart; i++) content = content.firstChild.content;\n for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {\n for (let d = $pos.depth; d >= 0; d--) {\n let bias = d == $pos.depth ? 0 : $pos.pos <= ($pos.start(d + 1) + $pos.end(d + 1)) / 2 ? -1 : 1;\n let insertPos = $pos.index(d) + (bias > 0 ? 1 : 0);\n let parent = $pos.node(d),\n fits = false;\n if (pass == 1) {\n fits = parent.canReplace(insertPos, insertPos, content);\n } else {\n let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);\n fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);\n }\n if (fits) return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d + 1) : $pos.after(d + 1);\n }\n }\n return null;\n}\n\n/**\n‘Fit’ a slice into a given position in the document, producing a\n[step](https://prosemirror.net/docs/ref/#transform.Step) that inserts it. Will return null if\nthere's no meaningful way to insert the slice here, or inserting it\nwould be a no-op (an empty slice over an empty range).\n*/\nfunction replaceStep(doc, from, to = from, slice = Slice.empty) {\n if (from == to && !slice.size) return null;\n let $from = doc.resolve(from),\n $to = doc.resolve(to);\n // Optimization -- avoid work if it's obvious that it's not needed.\n if (fitsTrivially($from, $to, slice)) return new ReplaceStep(from, to, slice);\n return new Fitter($from, $to, slice).fit();\n}\nfunction fitsTrivially($from, $to, slice) {\n return !slice.openStart && !slice.openEnd && $from.start() == $to.start() && $from.parent.canReplace($from.index(), $to.index(), slice.content);\n}\n// Algorithm for 'placing' the elements of a slice into a gap:\n//\n// We consider the content of each node that is open to the left to be\n// independently placeable. I.e. in , when the\n// paragraph on the left is open, \"foo\" can be placed (somewhere on\n// the left side of the replacement gap) independently from p(\"bar\").\n//\n// This class tracks the state of the placement progress in the\n// following properties:\n//\n// - `frontier` holds a stack of `{type, match}` objects that\n// represent the open side of the replacement. It starts at\n// `$from`, then moves forward as content is placed, and is finally\n// reconciled with `$to`.\n//\n// - `unplaced` is a slice that represents the content that hasn't\n// been placed yet.\n//\n// - `placed` is a fragment of placed content. Its open-start value\n// is implicit in `$from`, and its open-end value in `frontier`.\nclass Fitter {\n constructor($from, $to, unplaced) {\n this.$from = $from;\n this.$to = $to;\n this.unplaced = unplaced;\n this.frontier = [];\n this.placed = Fragment.empty;\n for (let i = 0; i <= $from.depth; i++) {\n let node = $from.node(i);\n this.frontier.push({\n type: node.type,\n match: node.contentMatchAt($from.indexAfter(i))\n });\n }\n for (let i = $from.depth; i > 0; i--) this.placed = Fragment.from($from.node(i).copy(this.placed));\n }\n get depth() {\n return this.frontier.length - 1;\n }\n fit() {\n // As long as there's unplaced content, try to place some of it.\n // If that fails, either increase the open score of the unplaced\n // slice, or drop nodes from it, and then try again.\n while (this.unplaced.size) {\n let fit = this.findFittable();\n if (fit) this.placeNodes(fit);else this.openMore() || this.dropNode();\n }\n // When there's inline content directly after the frontier _and_\n // directly after `this.$to`, we must generate a `ReplaceAround`\n // step that pulls that content into the node after the frontier.\n // That means the fitting must be done to the end of the textblock\n // node after `this.$to`, not `this.$to` itself.\n let moveInline = this.mustMoveInline(),\n placedSize = this.placed.size - this.depth - this.$from.depth;\n let $from = this.$from,\n $to = this.close(moveInline < 0 ? this.$to : $from.doc.resolve(moveInline));\n if (!$to) return null;\n // If closing to `$to` succeeded, create a step\n let content = this.placed,\n openStart = $from.depth,\n openEnd = $to.depth;\n while (openStart && openEnd && content.childCount == 1) {\n // Normalize by dropping open parent nodes\n content = content.firstChild.content;\n openStart--;\n openEnd--;\n }\n let slice = new Slice(content, openStart, openEnd);\n if (moveInline > -1) return new ReplaceAroundStep($from.pos, moveInline, this.$to.pos, this.$to.end(), slice, placedSize);\n if (slice.size || $from.pos != this.$to.pos)\n // Don't generate no-op steps\n return new ReplaceStep($from.pos, $to.pos, slice);\n return null;\n }\n // Find a position on the start spine of `this.unplaced` that has\n // content that can be moved somewhere on the frontier. Returns two\n // depths, one for the slice and one for the frontier.\n findFittable() {\n let startDepth = this.unplaced.openStart;\n for (let cur = this.unplaced.content, d = 0, openEnd = this.unplaced.openEnd; d < startDepth; d++) {\n let node = cur.firstChild;\n if (cur.childCount > 1) openEnd = 0;\n if (node.type.spec.isolating && openEnd <= d) {\n startDepth = d;\n break;\n }\n cur = node.content;\n }\n // Only try wrapping nodes (pass 2) after finding a place without\n // wrapping failed.\n for (let pass = 1; pass <= 2; pass++) {\n for (let sliceDepth = pass == 1 ? startDepth : this.unplaced.openStart; sliceDepth >= 0; sliceDepth--) {\n let fragment,\n parent = null;\n if (sliceDepth) {\n parent = contentAt(this.unplaced.content, sliceDepth - 1).firstChild;\n fragment = parent.content;\n } else {\n fragment = this.unplaced.content;\n }\n let first = fragment.firstChild;\n for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {\n let {\n type,\n match\n } = this.frontier[frontierDepth],\n wrap,\n inject = null;\n // In pass 1, if the next node matches, or there is no next\n // node but the parents look compatible, we've found a\n // place.\n if (pass == 1 && (first ? match.matchType(first.type) || (inject = match.fillBefore(Fragment.from(first), false)) : parent && type.compatibleContent(parent.type))) return {\n sliceDepth,\n frontierDepth,\n parent,\n inject\n };\n // In pass 2, look for a set of wrapping nodes that make\n // `first` fit here.\n else if (pass == 2 && first && (wrap = match.findWrapping(first.type))) return {\n sliceDepth,\n frontierDepth,\n parent,\n wrap\n };\n // Don't continue looking further up if the parent node\n // would fit here.\n if (parent && match.matchType(parent.type)) break;\n }\n }\n }\n }\n openMore() {\n let {\n content,\n openStart,\n openEnd\n } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (!inner.childCount || inner.firstChild.isLeaf) return false;\n this.unplaced = new Slice(content, openStart + 1, Math.max(openEnd, inner.size + openStart >= content.size - openEnd ? openStart + 1 : 0));\n return true;\n }\n dropNode() {\n let {\n content,\n openStart,\n openEnd\n } = this.unplaced;\n let inner = contentAt(content, openStart);\n if (inner.childCount <= 1 && openStart > 0) {\n let openAtEnd = content.size - openStart <= openStart + inner.size;\n this.unplaced = new Slice(dropFromFragment(content, openStart - 1, 1), openStart - 1, openAtEnd ? openStart - 1 : openEnd);\n } else {\n this.unplaced = new Slice(dropFromFragment(content, openStart, 1), openStart, openEnd);\n }\n }\n // Move content from the unplaced slice at `sliceDepth` to the\n // frontier node at `frontierDepth`. Close that frontier node when\n // applicable.\n placeNodes({\n sliceDepth,\n frontierDepth,\n parent,\n inject,\n wrap\n }) {\n while (this.depth > frontierDepth) this.closeFrontierNode();\n if (wrap) for (let i = 0; i < wrap.length; i++) this.openFrontierNode(wrap[i]);\n let slice = this.unplaced,\n fragment = parent ? parent.content : slice.content;\n let openStart = slice.openStart - sliceDepth;\n let taken = 0,\n add = [];\n let {\n match,\n type\n } = this.frontier[frontierDepth];\n if (inject) {\n for (let i = 0; i < inject.childCount; i++) add.push(inject.child(i));\n match = match.matchFragment(inject);\n }\n // Computes the amount of (end) open nodes at the end of the\n // fragment. When 0, the parent is open, but no more. When\n // negative, nothing is open.\n let openEndCount = fragment.size + sliceDepth - (slice.content.size - slice.openEnd);\n // Scan over the fragment, fitting as many child nodes as\n // possible.\n while (taken < fragment.childCount) {\n let next = fragment.child(taken),\n matches = match.matchType(next.type);\n if (!matches) break;\n taken++;\n if (taken > 1 || openStart == 0 || next.content.size) {\n // Drop empty open nodes\n match = matches;\n add.push(closeNodeStart(next.mark(type.allowedMarks(next.marks)), taken == 1 ? openStart : 0, taken == fragment.childCount ? openEndCount : -1));\n }\n }\n let toEnd = taken == fragment.childCount;\n if (!toEnd) openEndCount = -1;\n this.placed = addToFragment(this.placed, frontierDepth, Fragment.from(add));\n this.frontier[frontierDepth].match = match;\n // If the parent types match, and the entire node was moved, and\n // it's not open, close this frontier node right away.\n if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1) this.closeFrontierNode();\n // Add new frontier nodes for any open nodes at the end.\n for (let i = 0, cur = fragment; i < openEndCount; i++) {\n let node = cur.lastChild;\n this.frontier.push({\n type: node.type,\n match: node.contentMatchAt(node.childCount)\n });\n cur = node.content;\n }\n // Update `this.unplaced`. Drop the entire node from which we\n // placed it we got to its end, otherwise just drop the placed\n // nodes.\n this.unplaced = !toEnd ? new Slice(dropFromFragment(slice.content, sliceDepth, taken), slice.openStart, slice.openEnd) : sliceDepth == 0 ? Slice.empty : new Slice(dropFromFragment(slice.content, sliceDepth - 1, 1), sliceDepth - 1, openEndCount < 0 ? slice.openEnd : sliceDepth - 1);\n }\n mustMoveInline() {\n if (!this.$to.parent.isTextblock) return -1;\n let top = this.frontier[this.depth],\n level;\n if (!top.type.isTextblock || !contentAfterFits(this.$to, this.$to.depth, top.type, top.match, false) || this.$to.depth == this.depth && (level = this.findCloseLevel(this.$to)) && level.depth == this.depth) return -1;\n let {\n depth\n } = this.$to,\n after = this.$to.after(depth);\n while (depth > 1 && after == this.$to.end(--depth)) ++after;\n return after;\n }\n findCloseLevel($to) {\n scan: for (let i = Math.min(this.depth, $to.depth); i >= 0; i--) {\n let {\n match,\n type\n } = this.frontier[i];\n let dropInner = i < $to.depth && $to.end(i + 1) == $to.pos + ($to.depth - (i + 1));\n let fit = contentAfterFits($to, i, type, match, dropInner);\n if (!fit) continue;\n for (let d = i - 1; d >= 0; d--) {\n let {\n match,\n type\n } = this.frontier[d];\n let matches = contentAfterFits($to, d, type, match, true);\n if (!matches || matches.childCount) continue scan;\n }\n return {\n depth: i,\n fit,\n move: dropInner ? $to.doc.resolve($to.after(i + 1)) : $to\n };\n }\n }\n close($to) {\n let close = this.findCloseLevel($to);\n if (!close) return null;\n while (this.depth > close.depth) this.closeFrontierNode();\n if (close.fit.childCount) this.placed = addToFragment(this.placed, close.depth, close.fit);\n $to = close.move;\n for (let d = close.depth + 1; d <= $to.depth; d++) {\n let node = $to.node(d),\n add = node.type.contentMatch.fillBefore(node.content, true, $to.index(d));\n this.openFrontierNode(node.type, node.attrs, add);\n }\n return $to;\n }\n openFrontierNode(type, attrs = null, content) {\n let top = this.frontier[this.depth];\n top.match = top.match.matchType(type);\n this.placed = addToFragment(this.placed, this.depth, Fragment.from(type.create(attrs, content)));\n this.frontier.push({\n type,\n match: type.contentMatch\n });\n }\n closeFrontierNode() {\n let open = this.frontier.pop();\n let add = open.match.fillBefore(Fragment.empty, true);\n if (add.childCount) this.placed = addToFragment(this.placed, this.frontier.length, add);\n }\n}\nfunction dropFromFragment(fragment, depth, count) {\n if (depth == 0) return fragment.cutByIndex(count, fragment.childCount);\n return fragment.replaceChild(0, fragment.firstChild.copy(dropFromFragment(fragment.firstChild.content, depth - 1, count)));\n}\nfunction addToFragment(fragment, depth, content) {\n if (depth == 0) return fragment.append(content);\n return fragment.replaceChild(fragment.childCount - 1, fragment.lastChild.copy(addToFragment(fragment.lastChild.content, depth - 1, content)));\n}\nfunction contentAt(fragment, depth) {\n for (let i = 0; i < depth; i++) fragment = fragment.firstChild.content;\n return fragment;\n}\nfunction closeNodeStart(node, openStart, openEnd) {\n if (openStart <= 0) return node;\n let frag = node.content;\n if (openStart > 1) frag = frag.replaceChild(0, closeNodeStart(frag.firstChild, openStart - 1, frag.childCount == 1 ? openEnd - 1 : 0));\n if (openStart > 0) {\n frag = node.type.contentMatch.fillBefore(frag).append(frag);\n if (openEnd <= 0) frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment.empty, true));\n }\n return node.copy(frag);\n}\nfunction contentAfterFits($to, depth, type, match, open) {\n let node = $to.node(depth),\n index = open ? $to.indexAfter(depth) : $to.index(depth);\n if (index == node.childCount && !type.compatibleContent(node.type)) return null;\n let fit = match.fillBefore(node.content, true, index);\n return fit && !invalidMarks(type, node.content, index) ? fit : null;\n}\nfunction invalidMarks(type, fragment, start) {\n for (let i = start; i < fragment.childCount; i++) if (!type.allowsMarks(fragment.child(i).marks)) return true;\n return false;\n}\nfunction definesContent(type) {\n return type.spec.defining || type.spec.definingForContent;\n}\nfunction replaceRange(tr, from, to, slice) {\n if (!slice.size) return tr.deleteRange(from, to);\n let $from = tr.doc.resolve(from),\n $to = tr.doc.resolve(to);\n if (fitsTrivially($from, $to, slice)) return tr.step(new ReplaceStep(from, to, slice));\n let targetDepths = coveredDepths($from, tr.doc.resolve(to));\n // Can't replace the whole document, so remove 0 if it's present\n if (targetDepths[targetDepths.length - 1] == 0) targetDepths.pop();\n // Negative numbers represent not expansion over the whole node at\n // that depth, but replacing from $from.before(-D) to $to.pos.\n let preferredTarget = -($from.depth + 1);\n targetDepths.unshift(preferredTarget);\n // This loop picks a preferred target depth, if one of the covering\n // depths is not outside of a defining node, and adds negative\n // depths for any depth that has $from at its start and does not\n // cross a defining node.\n for (let d = $from.depth, pos = $from.pos - 1; d > 0; d--, pos--) {\n let spec = $from.node(d).type.spec;\n if (spec.defining || spec.definingAsContext || spec.isolating) break;\n if (targetDepths.indexOf(d) > -1) preferredTarget = d;else if ($from.before(d) == pos) targetDepths.splice(1, 0, -d);\n }\n // Try to fit each possible depth of the slice into each possible\n // target depth, starting with the preferred depths.\n let preferredTargetIndex = targetDepths.indexOf(preferredTarget);\n let leftNodes = [],\n preferredDepth = slice.openStart;\n for (let content = slice.content, i = 0;; i++) {\n let node = content.firstChild;\n leftNodes.push(node);\n if (i == slice.openStart) break;\n content = node.content;\n }\n // Back up preferredDepth to cover defining textblocks directly\n // above it, possibly skipping a non-defining textblock.\n for (let d = preferredDepth - 1; d >= 0; d--) {\n let leftNode = leftNodes[d],\n def = definesContent(leftNode.type);\n if (def && !leftNode.sameMarkup($from.node(Math.abs(preferredTarget) - 1))) preferredDepth = d;else if (def || !leftNode.type.isTextblock) break;\n }\n for (let j = slice.openStart; j >= 0; j--) {\n let openDepth = (j + preferredDepth + 1) % (slice.openStart + 1);\n let insert = leftNodes[openDepth];\n if (!insert) continue;\n for (let i = 0; i < targetDepths.length; i++) {\n // Loop over possible expansion levels, starting with the\n // preferred one\n let targetDepth = targetDepths[(i + preferredTargetIndex) % targetDepths.length],\n expand = true;\n if (targetDepth < 0) {\n expand = false;\n targetDepth = -targetDepth;\n }\n let parent = $from.node(targetDepth - 1),\n index = $from.index(targetDepth - 1);\n if (parent.canReplaceWith(index, index, insert.type, insert.marks)) return tr.replace($from.before(targetDepth), expand ? $to.after(targetDepth) : to, new Slice(closeFragment(slice.content, 0, slice.openStart, openDepth), openDepth, slice.openEnd));\n }\n }\n let startSteps = tr.steps.length;\n for (let i = targetDepths.length - 1; i >= 0; i--) {\n tr.replace(from, to, slice);\n if (tr.steps.length > startSteps) break;\n let depth = targetDepths[i];\n if (depth < 0) continue;\n from = $from.before(depth);\n to = $to.after(depth);\n }\n}\nfunction closeFragment(fragment, depth, oldOpen, newOpen, parent) {\n if (depth < oldOpen) {\n let first = fragment.firstChild;\n fragment = fragment.replaceChild(0, first.copy(closeFragment(first.content, depth + 1, oldOpen, newOpen, first)));\n }\n if (depth > newOpen) {\n let match = parent.contentMatchAt(0);\n let start = match.fillBefore(fragment).append(fragment);\n fragment = start.append(match.matchFragment(start).fillBefore(Fragment.empty, true));\n }\n return fragment;\n}\nfunction replaceRangeWith(tr, from, to, node) {\n if (!node.isInline && from == to && tr.doc.resolve(from).parent.content.size) {\n let point = insertPoint(tr.doc, from, node.type);\n if (point != null) from = to = point;\n }\n tr.replaceRange(from, to, new Slice(Fragment.from(node), 0, 0));\n}\nfunction deleteRange(tr, from, to) {\n let $from = tr.doc.resolve(from),\n $to = tr.doc.resolve(to);\n let covered = coveredDepths($from, $to);\n for (let i = 0; i < covered.length; i++) {\n let depth = covered[i],\n last = i == covered.length - 1;\n if (last && depth == 0 || $from.node(depth).type.contentMatch.validEnd) return tr.delete($from.start(depth), $to.end(depth));\n if (depth > 0 && (last || $from.node(depth - 1).canReplace($from.index(depth - 1), $to.indexAfter(depth - 1)))) return tr.delete($from.before(depth), $to.after(depth));\n }\n for (let d = 1; d <= $from.depth && d <= $to.depth; d++) {\n if (from - $from.start(d) == $from.depth - d && to > $from.end(d) && $to.end(d) - to != $to.depth - d && $from.start(d - 1) == $to.start(d - 1) && $from.node(d - 1).canReplace($from.index(d - 1), $to.index(d - 1))) return tr.delete($from.before(d), to);\n }\n tr.delete(from, to);\n}\n// Returns an array of all depths for which $from - $to spans the\n// whole content of the nodes at that depth.\nfunction coveredDepths($from, $to) {\n let result = [],\n minDepth = Math.min($from.depth, $to.depth);\n for (let d = minDepth; d >= 0; d--) {\n let start = $from.start(d);\n if (start < $from.pos - ($from.depth - d) || $to.end(d) > $to.pos + ($to.depth - d) || $from.node(d).type.spec.isolating || $to.node(d).type.spec.isolating) break;\n if (start == $to.start(d) || d == $from.depth && d == $to.depth && $from.parent.inlineContent && $to.parent.inlineContent && d && $to.start(d - 1) == start - 1) result.push(d);\n }\n return result;\n}\n\n/**\nUpdate an attribute in a specific node.\n*/\nclass AttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The position of the target node.\n */\n pos,\n /**\n The attribute to set.\n */\n attr,\n // The attribute's new value.\n value) {\n super();\n this.pos = pos;\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let node = doc.nodeAt(this.pos);\n if (!node) return StepResult.fail(\"No node at attribute step's position\");\n let attrs = Object.create(null);\n for (let name in node.attrs) attrs[name] = node.attrs[name];\n attrs[this.attr] = this.value;\n let updated = node.type.create(attrs, null, node.marks);\n return StepResult.fromReplace(doc, this.pos, this.pos + 1, new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1));\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);\n }\n map(mapping) {\n let pos = mapping.mapResult(this.pos, 1);\n return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);\n }\n toJSON() {\n return {\n stepType: \"attr\",\n pos: this.pos,\n attr: this.attr,\n value: this.value\n };\n }\n static fromJSON(schema, json) {\n if (typeof json.pos != \"number\" || typeof json.attr != \"string\") throw new RangeError(\"Invalid input for AttrStep.fromJSON\");\n return new AttrStep(json.pos, json.attr, json.value);\n }\n}\nStep.jsonID(\"attr\", AttrStep);\n/**\nUpdate an attribute in the doc node.\n*/\nclass DocAttrStep extends Step {\n /**\n Construct an attribute step.\n */\n constructor(\n /**\n The attribute to set.\n */\n attr,\n // The attribute's new value.\n value) {\n super();\n this.attr = attr;\n this.value = value;\n }\n apply(doc) {\n let attrs = Object.create(null);\n for (let name in doc.attrs) attrs[name] = doc.attrs[name];\n attrs[this.attr] = this.value;\n let updated = doc.type.create(attrs, doc.content, doc.marks);\n return StepResult.ok(updated);\n }\n getMap() {\n return StepMap.empty;\n }\n invert(doc) {\n return new DocAttrStep(this.attr, doc.attrs[this.attr]);\n }\n map(mapping) {\n return this;\n }\n toJSON() {\n return {\n stepType: \"docAttr\",\n attr: this.attr,\n value: this.value\n };\n }\n static fromJSON(schema, json) {\n if (typeof json.attr != \"string\") throw new RangeError(\"Invalid input for DocAttrStep.fromJSON\");\n return new DocAttrStep(json.attr, json.value);\n }\n}\nStep.jsonID(\"docAttr\", DocAttrStep);\n\n/**\n@internal\n*/\nlet TransformError = class extends Error {};\nTransformError = function TransformError(message) {\n let err = Error.call(this, message);\n err.__proto__ = TransformError.prototype;\n return err;\n};\nTransformError.prototype = Object.create(Error.prototype);\nTransformError.prototype.constructor = TransformError;\nTransformError.prototype.name = \"TransformError\";\n/**\nAbstraction to build up and track an array of\n[steps](https://prosemirror.net/docs/ref/#transform.Step) representing a document transformation.\n\nMost transforming methods return the `Transform` object itself, so\nthat they can be chained.\n*/\nclass Transform {\n /**\n Create a transform that starts with the given document.\n */\n constructor(\n /**\n The current document (the result of applying the steps in the\n transform).\n */\n doc) {\n this.doc = doc;\n /**\n The steps in this transform.\n */\n this.steps = [];\n /**\n The documents before each of the steps.\n */\n this.docs = [];\n /**\n A mapping with the maps for each of the steps in this transform.\n */\n this.mapping = new Mapping();\n }\n /**\n The starting document.\n */\n get before() {\n return this.docs.length ? this.docs[0] : this.doc;\n }\n /**\n Apply a new step in this transform, saving the result. Throws an\n error when the step fails.\n */\n step(step) {\n let result = this.maybeStep(step);\n if (result.failed) throw new TransformError(result.failed);\n return this;\n }\n /**\n Try to apply a step in this transformation, ignoring it if it\n fails. Returns the step result.\n */\n maybeStep(step) {\n let result = step.apply(this.doc);\n if (!result.failed) this.addStep(step, result.doc);\n return result;\n }\n /**\n True when the document has been changed (when there are any\n steps).\n */\n get docChanged() {\n return this.steps.length > 0;\n }\n /**\n @internal\n */\n addStep(step, doc) {\n this.docs.push(this.doc);\n this.steps.push(step);\n this.mapping.appendMap(step.getMap());\n this.doc = doc;\n }\n /**\n Replace the part of the document between `from` and `to` with the\n given `slice`.\n */\n replace(from, to = from, slice = Slice.empty) {\n let step = replaceStep(this.doc, from, to, slice);\n if (step) this.step(step);\n return this;\n }\n /**\n Replace the given range with the given content, which may be a\n fragment, node, or array of nodes.\n */\n replaceWith(from, to, content) {\n return this.replace(from, to, new Slice(Fragment.from(content), 0, 0));\n }\n /**\n Delete the content between the given positions.\n */\n delete(from, to) {\n return this.replace(from, to, Slice.empty);\n }\n /**\n Insert the given content at the given position.\n */\n insert(pos, content) {\n return this.replaceWith(pos, pos, content);\n }\n /**\n Replace a range of the document with a given slice, using\n `from`, `to`, and the slice's\n [`openStart`](https://prosemirror.net/docs/ref/#model.Slice.openStart) property as hints, rather\n than fixed start and end points. This method may grow the\n replaced area or close open nodes in the slice in order to get a\n fit that is more in line with WYSIWYG expectations, by dropping\n fully covered parent nodes of the replaced region when they are\n marked [non-defining as\n context](https://prosemirror.net/docs/ref/#model.NodeSpec.definingAsContext), or including an\n open parent node from the slice that _is_ marked as [defining\n its content](https://prosemirror.net/docs/ref/#model.NodeSpec.definingForContent).\n \n This is the method, for example, to handle paste. The similar\n [`replace`](https://prosemirror.net/docs/ref/#transform.Transform.replace) method is a more\n primitive tool which will _not_ move the start and end of its given\n range, and is useful in situations where you need more precise\n control over what happens.\n */\n replaceRange(from, to, slice) {\n replaceRange(this, from, to, slice);\n return this;\n }\n /**\n Replace the given range with a node, but use `from` and `to` as\n hints, rather than precise positions. When from and to are the same\n and are at the start or end of a parent node in which the given\n node doesn't fit, this method may _move_ them out towards a parent\n that does allow the given node to be placed. When the given range\n completely covers a parent node, this method may completely replace\n that parent node.\n */\n replaceRangeWith(from, to, node) {\n replaceRangeWith(this, from, to, node);\n return this;\n }\n /**\n Delete the given range, expanding it to cover fully covered\n parent nodes until a valid replace is found.\n */\n deleteRange(from, to) {\n deleteRange(this, from, to);\n return this;\n }\n /**\n Split the content in the given range off from its parent, if there\n is sibling content before or after it, and move it up the tree to\n the depth specified by `target`. You'll probably want to use\n [`liftTarget`](https://prosemirror.net/docs/ref/#transform.liftTarget) to compute `target`, to make\n sure the lift is valid.\n */\n lift(range, target) {\n lift(this, range, target);\n return this;\n }\n /**\n Join the blocks around the given position. If depth is 2, their\n last and first siblings are also joined, and so on.\n */\n join(pos, depth = 1) {\n join(this, pos, depth);\n return this;\n }\n /**\n Wrap the given [range](https://prosemirror.net/docs/ref/#model.NodeRange) in the given set of wrappers.\n The wrappers are assumed to be valid in this position, and should\n probably be computed with [`findWrapping`](https://prosemirror.net/docs/ref/#transform.findWrapping).\n */\n wrap(range, wrappers) {\n wrap(this, range, wrappers);\n return this;\n }\n /**\n Set the type of all textblocks (partly) between `from` and `to` to\n the given node type with the given attributes.\n */\n setBlockType(from, to = from, type, attrs = null) {\n setBlockType(this, from, to, type, attrs);\n return this;\n }\n /**\n Change the type, attributes, and/or marks of the node at `pos`.\n When `type` isn't given, the existing node type is preserved,\n */\n setNodeMarkup(pos, type, attrs = null, marks) {\n setNodeMarkup(this, pos, type, attrs, marks);\n return this;\n }\n /**\n Set a single attribute on a given node to a new value.\n The `pos` addresses the document content. Use `setDocAttribute`\n to set attributes on the document itself.\n */\n setNodeAttribute(pos, attr, value) {\n this.step(new AttrStep(pos, attr, value));\n return this;\n }\n /**\n Set a single attribute on the document to a new value.\n */\n setDocAttribute(attr, value) {\n this.step(new DocAttrStep(attr, value));\n return this;\n }\n /**\n Add a mark to the node at position `pos`.\n */\n addNodeMark(pos, mark) {\n this.step(new AddNodeMarkStep(pos, mark));\n return this;\n }\n /**\n Remove a mark (or a mark of the given type) from the node at\n position `pos`.\n */\n removeNodeMark(pos, mark) {\n if (!(mark instanceof Mark)) {\n let node = this.doc.nodeAt(pos);\n if (!node) throw new RangeError(\"No node at position \" + pos);\n mark = mark.isInSet(node.marks);\n if (!mark) return this;\n }\n this.step(new RemoveNodeMarkStep(pos, mark));\n return this;\n }\n /**\n Split the node at the given position, and optionally, if `depth` is\n greater than one, any number of nodes above that. By default, the\n parts split off will inherit the node type of the original node.\n This can be changed by passing an array of types and attributes to\n use after the split.\n */\n split(pos, depth = 1, typesAfter) {\n split(this, pos, depth, typesAfter);\n return this;\n }\n /**\n Add the given mark to the inline content between `from` and `to`.\n */\n addMark(from, to, mark) {\n addMark(this, from, to, mark);\n return this;\n }\n /**\n Remove marks from inline nodes between `from` and `to`. When\n `mark` is a single mark, remove precisely that mark. When it is\n a mark type, remove all marks of that type. When it is null,\n remove all marks of any type.\n */\n removeMark(from, to, mark) {\n removeMark(this, from, to, mark);\n return this;\n }\n /**\n Removes all marks and nodes from the content of the node at\n `pos` that don't match the given new parent node type. Accepts\n an optional starting [content match](https://prosemirror.net/docs/ref/#model.ContentMatch) as\n third argument.\n */\n clearIncompatible(pos, parentType, match) {\n clearIncompatible(this, pos, parentType, match);\n return this;\n }\n}\nexport { AddMarkStep, AddNodeMarkStep, AttrStep, DocAttrStep, MapResult, Mapping, RemoveMarkStep, RemoveNodeMarkStep, ReplaceAroundStep, ReplaceStep, Step, StepMap, StepResult, Transform, TransformError, canJoin, canSplit, dropPoint, findWrapping, insertPoint, joinPoint, liftTarget, replaceStep };","import { Slice, Fragment, Mark, Node } from 'prosemirror-model';\nimport { ReplaceStep, ReplaceAroundStep, Transform } from 'prosemirror-transform';\nconst classesById = Object.create(null);\n/**\nSuperclass for editor selections. Every selection type should\nextend this. Should not be instantiated directly.\n*/\nclass Selection {\n /**\n Initialize a selection with the head and anchor and ranges. If no\n ranges are given, constructs a single range across `$anchor` and\n `$head`.\n */\n constructor(\n /**\n The resolved anchor of the selection (the side that stays in\n place when the selection is modified).\n */\n $anchor,\n /**\n The resolved head of the selection (the side that moves when\n the selection is modified).\n */\n $head, ranges) {\n this.$anchor = $anchor;\n this.$head = $head;\n this.ranges = ranges || [new SelectionRange($anchor.min($head), $anchor.max($head))];\n }\n /**\n The selection's anchor, as an unresolved position.\n */\n get anchor() {\n return this.$anchor.pos;\n }\n /**\n The selection's head.\n */\n get head() {\n return this.$head.pos;\n }\n /**\n The lower bound of the selection's main range.\n */\n get from() {\n return this.$from.pos;\n }\n /**\n The upper bound of the selection's main range.\n */\n get to() {\n return this.$to.pos;\n }\n /**\n The resolved lower bound of the selection's main range.\n */\n get $from() {\n return this.ranges[0].$from;\n }\n /**\n The resolved upper bound of the selection's main range.\n */\n get $to() {\n return this.ranges[0].$to;\n }\n /**\n Indicates whether the selection contains any content.\n */\n get empty() {\n let ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) if (ranges[i].$from.pos != ranges[i].$to.pos) return false;\n return true;\n }\n /**\n Get the content of this selection as a slice.\n */\n content() {\n return this.$from.doc.slice(this.from, this.to, true);\n }\n /**\n Replace the selection with a slice or, if no slice is given,\n delete the selection. Will append to the given transaction.\n */\n replace(tr, content = Slice.empty) {\n // Put the new selection at the position after the inserted\n // content. When that ended in an inline node, search backwards,\n // to get the position after that node. If not, search forward.\n let lastNode = content.content.lastChild,\n lastParent = null;\n for (let i = 0; i < content.openEnd; i++) {\n lastParent = lastNode;\n lastNode = lastNode.lastChild;\n }\n let mapFrom = tr.steps.length,\n ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i],\n mapping = tr.mapping.slice(mapFrom);\n tr.replaceRange(mapping.map($from.pos), mapping.map($to.pos), i ? Slice.empty : content);\n if (i == 0) selectionToInsertionEnd(tr, mapFrom, (lastNode ? lastNode.isInline : lastParent && lastParent.isTextblock) ? -1 : 1);\n }\n }\n /**\n Replace the selection with the given node, appending the changes\n to the given transaction.\n */\n replaceWith(tr, node) {\n let mapFrom = tr.steps.length,\n ranges = this.ranges;\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i],\n mapping = tr.mapping.slice(mapFrom);\n let from = mapping.map($from.pos),\n to = mapping.map($to.pos);\n if (i) {\n tr.deleteRange(from, to);\n } else {\n tr.replaceRangeWith(from, to, node);\n selectionToInsertionEnd(tr, mapFrom, node.isInline ? -1 : 1);\n }\n }\n }\n /**\n Find a valid cursor or leaf node selection starting at the given\n position and searching back if `dir` is negative, and forward if\n positive. When `textOnly` is true, only consider cursor\n selections. Will return null when no valid selection position is\n found.\n */\n static findFrom($pos, dir, textOnly = false) {\n let inner = $pos.parent.inlineContent ? new TextSelection($pos) : findSelectionIn($pos.node(0), $pos.parent, $pos.pos, $pos.index(), dir, textOnly);\n if (inner) return inner;\n for (let depth = $pos.depth - 1; depth >= 0; depth--) {\n let found = dir < 0 ? findSelectionIn($pos.node(0), $pos.node(depth), $pos.before(depth + 1), $pos.index(depth), dir, textOnly) : findSelectionIn($pos.node(0), $pos.node(depth), $pos.after(depth + 1), $pos.index(depth) + 1, dir, textOnly);\n if (found) return found;\n }\n return null;\n }\n /**\n Find a valid cursor or leaf node selection near the given\n position. Searches forward first by default, but if `bias` is\n negative, it will search backwards first.\n */\n static near($pos, bias = 1) {\n return this.findFrom($pos, bias) || this.findFrom($pos, -bias) || new AllSelection($pos.node(0));\n }\n /**\n Find the cursor or leaf node selection closest to the start of\n the given document. Will return an\n [`AllSelection`](https://prosemirror.net/docs/ref/#state.AllSelection) if no valid position\n exists.\n */\n static atStart(doc) {\n return findSelectionIn(doc, doc, 0, 0, 1) || new AllSelection(doc);\n }\n /**\n Find the cursor or leaf node selection closest to the end of the\n given document.\n */\n static atEnd(doc) {\n return findSelectionIn(doc, doc, doc.content.size, doc.childCount, -1) || new AllSelection(doc);\n }\n /**\n Deserialize the JSON representation of a selection. Must be\n implemented for custom classes (as a static class method).\n */\n static fromJSON(doc, json) {\n if (!json || !json.type) throw new RangeError(\"Invalid input for Selection.fromJSON\");\n let cls = classesById[json.type];\n if (!cls) throw new RangeError(`No selection type ${json.type} defined`);\n return cls.fromJSON(doc, json);\n }\n /**\n To be able to deserialize selections from JSON, custom selection\n classes must register themselves with an ID string, so that they\n can be disambiguated. Try to pick something that's unlikely to\n clash with classes from other modules.\n */\n static jsonID(id, selectionClass) {\n if (id in classesById) throw new RangeError(\"Duplicate use of selection JSON ID \" + id);\n classesById[id] = selectionClass;\n selectionClass.prototype.jsonID = id;\n return selectionClass;\n }\n /**\n Get a [bookmark](https://prosemirror.net/docs/ref/#state.SelectionBookmark) for this selection,\n which is a value that can be mapped without having access to a\n current document, and later resolved to a real selection for a\n given document again. (This is used mostly by the history to\n track and restore old selections.) The default implementation of\n this method just converts the selection to a text selection and\n returns the bookmark for that.\n */\n getBookmark() {\n return TextSelection.between(this.$anchor, this.$head).getBookmark();\n }\n}\nSelection.prototype.visible = true;\n/**\nRepresents a selected range in a document.\n*/\nclass SelectionRange {\n /**\n Create a range.\n */\n constructor(\n /**\n The lower bound of the range.\n */\n $from,\n /**\n The upper bound of the range.\n */\n $to) {\n this.$from = $from;\n this.$to = $to;\n }\n}\nlet warnedAboutTextSelection = false;\nfunction checkTextSelection($pos) {\n if (!warnedAboutTextSelection && !$pos.parent.inlineContent) {\n warnedAboutTextSelection = true;\n console[\"warn\"](\"TextSelection endpoint not pointing into a node with inline content (\" + $pos.parent.type.name + \")\");\n }\n}\n/**\nA text selection represents a classical editor selection, with a\nhead (the moving side) and anchor (immobile side), both of which\npoint into textblock nodes. It can be empty (a regular cursor\nposition).\n*/\nclass TextSelection extends Selection {\n /**\n Construct a text selection between the given points.\n */\n constructor($anchor, $head = $anchor) {\n checkTextSelection($anchor);\n checkTextSelection($head);\n super($anchor, $head);\n }\n /**\n Returns a resolved position if this is a cursor selection (an\n empty text selection), and null otherwise.\n */\n get $cursor() {\n return this.$anchor.pos == this.$head.pos ? this.$head : null;\n }\n map(doc, mapping) {\n let $head = doc.resolve(mapping.map(this.head));\n if (!$head.parent.inlineContent) return Selection.near($head);\n let $anchor = doc.resolve(mapping.map(this.anchor));\n return new TextSelection($anchor.parent.inlineContent ? $anchor : $head, $head);\n }\n replace(tr, content = Slice.empty) {\n super.replace(tr, content);\n if (content == Slice.empty) {\n let marks = this.$from.marksAcross(this.$to);\n if (marks) tr.ensureMarks(marks);\n }\n }\n eq(other) {\n return other instanceof TextSelection && other.anchor == this.anchor && other.head == this.head;\n }\n getBookmark() {\n return new TextBookmark(this.anchor, this.head);\n }\n toJSON() {\n return {\n type: \"text\",\n anchor: this.anchor,\n head: this.head\n };\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\" || typeof json.head != \"number\") throw new RangeError(\"Invalid input for TextSelection.fromJSON\");\n return new TextSelection(doc.resolve(json.anchor), doc.resolve(json.head));\n }\n /**\n Create a text selection from non-resolved positions.\n */\n static create(doc, anchor, head = anchor) {\n let $anchor = doc.resolve(anchor);\n return new this($anchor, head == anchor ? $anchor : doc.resolve(head));\n }\n /**\n Return a text selection that spans the given positions or, if\n they aren't text positions, find a text selection near them.\n `bias` determines whether the method searches forward (default)\n or backwards (negative number) first. Will fall back to calling\n [`Selection.near`](https://prosemirror.net/docs/ref/#state.Selection^near) when the document\n doesn't contain a valid text position.\n */\n static between($anchor, $head, bias) {\n let dPos = $anchor.pos - $head.pos;\n if (!bias || dPos) bias = dPos >= 0 ? 1 : -1;\n if (!$head.parent.inlineContent) {\n let found = Selection.findFrom($head, bias, true) || Selection.findFrom($head, -bias, true);\n if (found) $head = found.$head;else return Selection.near($head, bias);\n }\n if (!$anchor.parent.inlineContent) {\n if (dPos == 0) {\n $anchor = $head;\n } else {\n $anchor = (Selection.findFrom($anchor, -bias, true) || Selection.findFrom($anchor, bias, true)).$anchor;\n if ($anchor.pos < $head.pos != dPos < 0) $anchor = $head;\n }\n }\n return new TextSelection($anchor, $head);\n }\n}\nSelection.jsonID(\"text\", TextSelection);\nclass TextBookmark {\n constructor(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n }\n map(mapping) {\n return new TextBookmark(mapping.map(this.anchor), mapping.map(this.head));\n }\n resolve(doc) {\n return TextSelection.between(doc.resolve(this.anchor), doc.resolve(this.head));\n }\n}\n/**\nA node selection is a selection that points at a single node. All\nnodes marked [selectable](https://prosemirror.net/docs/ref/#model.NodeSpec.selectable) can be the\ntarget of a node selection. In such a selection, `from` and `to`\npoint directly before and after the selected node, `anchor` equals\n`from`, and `head` equals `to`..\n*/\nclass NodeSelection extends Selection {\n /**\n Create a node selection. Does not verify the validity of its\n argument.\n */\n constructor($pos) {\n let node = $pos.nodeAfter;\n let $end = $pos.node(0).resolve($pos.pos + node.nodeSize);\n super($pos, $end);\n this.node = node;\n }\n map(doc, mapping) {\n let {\n deleted,\n pos\n } = mapping.mapResult(this.anchor);\n let $pos = doc.resolve(pos);\n if (deleted) return Selection.near($pos);\n return new NodeSelection($pos);\n }\n content() {\n return new Slice(Fragment.from(this.node), 0, 0);\n }\n eq(other) {\n return other instanceof NodeSelection && other.anchor == this.anchor;\n }\n toJSON() {\n return {\n type: \"node\",\n anchor: this.anchor\n };\n }\n getBookmark() {\n return new NodeBookmark(this.anchor);\n }\n /**\n @internal\n */\n static fromJSON(doc, json) {\n if (typeof json.anchor != \"number\") throw new RangeError(\"Invalid input for NodeSelection.fromJSON\");\n return new NodeSelection(doc.resolve(json.anchor));\n }\n /**\n Create a node selection from non-resolved positions.\n */\n static create(doc, from) {\n return new NodeSelection(doc.resolve(from));\n }\n /**\n Determines whether the given node may be selected as a node\n selection.\n */\n static isSelectable(node) {\n return !node.isText && node.type.spec.selectable !== false;\n }\n}\nNodeSelection.prototype.visible = false;\nSelection.jsonID(\"node\", NodeSelection);\nclass NodeBookmark {\n constructor(anchor) {\n this.anchor = anchor;\n }\n map(mapping) {\n let {\n deleted,\n pos\n } = mapping.mapResult(this.anchor);\n return deleted ? new TextBookmark(pos, pos) : new NodeBookmark(pos);\n }\n resolve(doc) {\n let $pos = doc.resolve(this.anchor),\n node = $pos.nodeAfter;\n if (node && NodeSelection.isSelectable(node)) return new NodeSelection($pos);\n return Selection.near($pos);\n }\n}\n/**\nA selection type that represents selecting the whole document\n(which can not necessarily be expressed with a text selection, when\nthere are for example leaf block nodes at the start or end of the\ndocument).\n*/\nclass AllSelection extends Selection {\n /**\n Create an all-selection over the given document.\n */\n constructor(doc) {\n super(doc.resolve(0), doc.resolve(doc.content.size));\n }\n replace(tr, content = Slice.empty) {\n if (content == Slice.empty) {\n tr.delete(0, tr.doc.content.size);\n let sel = Selection.atStart(tr.doc);\n if (!sel.eq(tr.selection)) tr.setSelection(sel);\n } else {\n super.replace(tr, content);\n }\n }\n toJSON() {\n return {\n type: \"all\"\n };\n }\n /**\n @internal\n */\n static fromJSON(doc) {\n return new AllSelection(doc);\n }\n map(doc) {\n return new AllSelection(doc);\n }\n eq(other) {\n return other instanceof AllSelection;\n }\n getBookmark() {\n return AllBookmark;\n }\n}\nSelection.jsonID(\"all\", AllSelection);\nconst AllBookmark = {\n map() {\n return this;\n },\n resolve(doc) {\n return new AllSelection(doc);\n }\n};\n// FIXME we'll need some awareness of text direction when scanning for selections\n// Try to find a selection inside the given node. `pos` points at the\n// position where the search starts. When `text` is true, only return\n// text selections.\nfunction findSelectionIn(doc, node, pos, index, dir, text = false) {\n if (node.inlineContent) return TextSelection.create(doc, pos);\n for (let i = index - (dir > 0 ? 0 : 1); dir > 0 ? i < node.childCount : i >= 0; i += dir) {\n let child = node.child(i);\n if (!child.isAtom) {\n let inner = findSelectionIn(doc, child, pos + dir, dir < 0 ? child.childCount : 0, dir, text);\n if (inner) return inner;\n } else if (!text && NodeSelection.isSelectable(child)) {\n return NodeSelection.create(doc, pos - (dir < 0 ? child.nodeSize : 0));\n }\n pos += child.nodeSize * dir;\n }\n return null;\n}\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n let last = tr.steps.length - 1;\n if (last < startLen) return;\n let step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) return;\n let map = tr.mapping.maps[last],\n end;\n map.forEach((_from, _to, _newFrom, newTo) => {\n if (end == null) end = newTo;\n });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\nconst UPDATED_SEL = 1,\n UPDATED_MARKS = 2,\n UPDATED_SCROLL = 4;\n/**\nAn editor state transaction, which can be applied to a state to\ncreate an updated state. Use\n[`EditorState.tr`](https://prosemirror.net/docs/ref/#state.EditorState.tr) to create an instance.\n\nTransactions track changes to the document (they are a subclass of\n[`Transform`](https://prosemirror.net/docs/ref/#transform.Transform)), but also other state changes,\nlike selection updates and adjustments of the set of [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks). In addition, you can store\nmetadata properties in a transaction, which are extra pieces of\ninformation that client code or plugins can use to describe what a\ntransaction represents, so that they can update their [own\nstate](https://prosemirror.net/docs/ref/#state.StateField) accordingly.\n\nThe [editor view](https://prosemirror.net/docs/ref/#view.EditorView) uses a few metadata\nproperties: it will attach a property `\"pointer\"` with the value\n`true` to selection transactions directly caused by mouse or touch\ninput, a `\"composition\"` property holding an ID identifying the\ncomposition that caused it to transactions caused by composed DOM\ninput, and a `\"uiEvent\"` property of that may be `\"paste\"`,\n`\"cut\"`, or `\"drop\"`.\n*/\nclass Transaction extends Transform {\n /**\n @internal\n */\n constructor(state) {\n super(state.doc);\n // The step count for which the current selection is valid.\n this.curSelectionFor = 0;\n // Bitfield to track which aspects of the state were updated by\n // this transaction.\n this.updated = 0;\n // Object used to store metadata properties for the transaction.\n this.meta = Object.create(null);\n this.time = Date.now();\n this.curSelection = state.selection;\n this.storedMarks = state.storedMarks;\n }\n /**\n The transaction's current selection. This defaults to the editor\n selection [mapped](https://prosemirror.net/docs/ref/#state.Selection.map) through the steps in the\n transaction, but can be overwritten with\n [`setSelection`](https://prosemirror.net/docs/ref/#state.Transaction.setSelection).\n */\n get selection() {\n if (this.curSelectionFor < this.steps.length) {\n this.curSelection = this.curSelection.map(this.doc, this.mapping.slice(this.curSelectionFor));\n this.curSelectionFor = this.steps.length;\n }\n return this.curSelection;\n }\n /**\n Update the transaction's current selection. Will determine the\n selection that the editor gets when the transaction is applied.\n */\n setSelection(selection) {\n if (selection.$from.doc != this.doc) throw new RangeError(\"Selection passed to setSelection must point at the current document\");\n this.curSelection = selection;\n this.curSelectionFor = this.steps.length;\n this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;\n this.storedMarks = null;\n return this;\n }\n /**\n Whether the selection was explicitly updated by this transaction.\n */\n get selectionSet() {\n return (this.updated & UPDATED_SEL) > 0;\n }\n /**\n Set the current stored marks.\n */\n setStoredMarks(marks) {\n this.storedMarks = marks;\n this.updated |= UPDATED_MARKS;\n return this;\n }\n /**\n Make sure the current stored marks or, if that is null, the marks\n at the selection, match the given set of marks. Does nothing if\n this is already the case.\n */\n ensureMarks(marks) {\n if (!Mark.sameSet(this.storedMarks || this.selection.$from.marks(), marks)) this.setStoredMarks(marks);\n return this;\n }\n /**\n Add a mark to the set of stored marks.\n */\n addStoredMark(mark) {\n return this.ensureMarks(mark.addToSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Remove a mark or mark type from the set of stored marks.\n */\n removeStoredMark(mark) {\n return this.ensureMarks(mark.removeFromSet(this.storedMarks || this.selection.$head.marks()));\n }\n /**\n Whether the stored marks were explicitly set for this transaction.\n */\n get storedMarksSet() {\n return (this.updated & UPDATED_MARKS) > 0;\n }\n /**\n @internal\n */\n addStep(step, doc) {\n super.addStep(step, doc);\n this.updated = this.updated & ~UPDATED_MARKS;\n this.storedMarks = null;\n }\n /**\n Update the timestamp for the transaction.\n */\n setTime(time) {\n this.time = time;\n return this;\n }\n /**\n Replace the current selection with the given slice.\n */\n replaceSelection(slice) {\n this.selection.replace(this, slice);\n return this;\n }\n /**\n Replace the selection with the given node. When `inheritMarks` is\n true and the content is inline, it inherits the marks from the\n place where it is inserted.\n */\n replaceSelectionWith(node, inheritMarks = true) {\n let selection = this.selection;\n if (inheritMarks) node = node.mark(this.storedMarks || (selection.empty ? selection.$from.marks() : selection.$from.marksAcross(selection.$to) || Mark.none));\n selection.replaceWith(this, node);\n return this;\n }\n /**\n Delete the selection.\n */\n deleteSelection() {\n this.selection.replace(this);\n return this;\n }\n /**\n Replace the given range, or the selection if no range is given,\n with a text node containing the given string.\n */\n insertText(text, from, to) {\n let schema = this.doc.type.schema;\n if (from == null) {\n if (!text) return this.deleteSelection();\n return this.replaceSelectionWith(schema.text(text), true);\n } else {\n if (to == null) to = from;\n to = to == null ? from : to;\n if (!text) return this.deleteRange(from, to);\n let marks = this.storedMarks;\n if (!marks) {\n let $from = this.doc.resolve(from);\n marks = to == from ? $from.marks() : $from.marksAcross(this.doc.resolve(to));\n }\n this.replaceRangeWith(from, to, schema.text(text, marks));\n if (!this.selection.empty) this.setSelection(Selection.near(this.selection.$to));\n return this;\n }\n }\n /**\n Store a metadata property in this transaction, keyed either by\n name or by plugin.\n */\n setMeta(key, value) {\n this.meta[typeof key == \"string\" ? key : key.key] = value;\n return this;\n }\n /**\n Retrieve a metadata property for a given name or plugin.\n */\n getMeta(key) {\n return this.meta[typeof key == \"string\" ? key : key.key];\n }\n /**\n Returns true if this transaction doesn't contain any metadata,\n and can thus safely be extended.\n */\n get isGeneric() {\n for (let _ in this.meta) return false;\n return true;\n }\n /**\n Indicate that the editor should scroll the selection into view\n when updated to the state produced by this transaction.\n */\n scrollIntoView() {\n this.updated |= UPDATED_SCROLL;\n return this;\n }\n /**\n True when this transaction has had `scrollIntoView` called on it.\n */\n get scrolledIntoView() {\n return (this.updated & UPDATED_SCROLL) > 0;\n }\n}\nfunction bind(f, self) {\n return !self || !f ? f : f.bind(self);\n}\nclass FieldDesc {\n constructor(name, desc, self) {\n this.name = name;\n this.init = bind(desc.init, self);\n this.apply = bind(desc.apply, self);\n }\n}\nconst baseFields = [new FieldDesc(\"doc\", {\n init(config) {\n return config.doc || config.schema.topNodeType.createAndFill();\n },\n apply(tr) {\n return tr.doc;\n }\n}), new FieldDesc(\"selection\", {\n init(config, instance) {\n return config.selection || Selection.atStart(instance.doc);\n },\n apply(tr) {\n return tr.selection;\n }\n}), new FieldDesc(\"storedMarks\", {\n init(config) {\n return config.storedMarks || null;\n },\n apply(tr, _marks, _old, state) {\n return state.selection.$cursor ? tr.storedMarks : null;\n }\n}), new FieldDesc(\"scrollToSelection\", {\n init() {\n return 0;\n },\n apply(tr, prev) {\n return tr.scrolledIntoView ? prev + 1 : prev;\n }\n})];\n// Object wrapping the part of a state object that stays the same\n// across transactions. Stored in the state's `config` property.\nclass Configuration {\n constructor(schema, plugins) {\n this.schema = schema;\n this.plugins = [];\n this.pluginsByKey = Object.create(null);\n this.fields = baseFields.slice();\n if (plugins) plugins.forEach(plugin => {\n if (this.pluginsByKey[plugin.key]) throw new RangeError(\"Adding different instances of a keyed plugin (\" + plugin.key + \")\");\n this.plugins.push(plugin);\n this.pluginsByKey[plugin.key] = plugin;\n if (plugin.spec.state) this.fields.push(new FieldDesc(plugin.key, plugin.spec.state, plugin));\n });\n }\n}\n/**\nThe state of a ProseMirror editor is represented by an object of\nthis type. A state is a persistent data structure—it isn't\nupdated, but rather a new state value is computed from an old one\nusing the [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) method.\n\nA state holds a number of built-in fields, and plugins can\n[define](https://prosemirror.net/docs/ref/#state.PluginSpec.state) additional fields.\n*/\nclass EditorState {\n /**\n @internal\n */\n constructor(\n /**\n @internal\n */\n config) {\n this.config = config;\n }\n /**\n The schema of the state's document.\n */\n get schema() {\n return this.config.schema;\n }\n /**\n The plugins that are active in this state.\n */\n get plugins() {\n return this.config.plugins;\n }\n /**\n Apply the given transaction to produce a new state.\n */\n apply(tr) {\n return this.applyTransaction(tr).state;\n }\n /**\n @internal\n */\n filterTransaction(tr, ignore = -1) {\n for (let i = 0; i < this.config.plugins.length; i++) if (i != ignore) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.filterTransaction && !plugin.spec.filterTransaction.call(plugin, tr, this)) return false;\n }\n return true;\n }\n /**\n Verbose variant of [`apply`](https://prosemirror.net/docs/ref/#state.EditorState.apply) that\n returns the precise transactions that were applied (which might\n be influenced by the [transaction\n hooks](https://prosemirror.net/docs/ref/#state.PluginSpec.filterTransaction) of\n plugins) along with the new state.\n */\n applyTransaction(rootTr) {\n if (!this.filterTransaction(rootTr)) return {\n state: this,\n transactions: []\n };\n let trs = [rootTr],\n newState = this.applyInner(rootTr),\n seen = null;\n // This loop repeatedly gives plugins a chance to respond to\n // transactions as new transactions are added, making sure to only\n // pass the transactions the plugin did not see before.\n for (;;) {\n let haveNew = false;\n for (let i = 0; i < this.config.plugins.length; i++) {\n let plugin = this.config.plugins[i];\n if (plugin.spec.appendTransaction) {\n let n = seen ? seen[i].n : 0,\n oldState = seen ? seen[i].state : this;\n let tr = n < trs.length && plugin.spec.appendTransaction.call(plugin, n ? trs.slice(n) : trs, oldState, newState);\n if (tr && newState.filterTransaction(tr, i)) {\n tr.setMeta(\"appendedTransaction\", rootTr);\n if (!seen) {\n seen = [];\n for (let j = 0; j < this.config.plugins.length; j++) seen.push(j < i ? {\n state: newState,\n n: trs.length\n } : {\n state: this,\n n: 0\n });\n }\n trs.push(tr);\n newState = newState.applyInner(tr);\n haveNew = true;\n }\n if (seen) seen[i] = {\n state: newState,\n n: trs.length\n };\n }\n }\n if (!haveNew) return {\n state: newState,\n transactions: trs\n };\n }\n }\n /**\n @internal\n */\n applyInner(tr) {\n if (!tr.before.eq(this.doc)) throw new RangeError(\"Applying a mismatched transaction\");\n let newInstance = new EditorState(this.config),\n fields = this.config.fields;\n for (let i = 0; i < fields.length; i++) {\n let field = fields[i];\n newInstance[field.name] = field.apply(tr, this[field.name], this, newInstance);\n }\n return newInstance;\n }\n /**\n Start a [transaction](https://prosemirror.net/docs/ref/#state.Transaction) from this state.\n */\n get tr() {\n return new Transaction(this);\n }\n /**\n Create a new state.\n */\n static create(config) {\n let $config = new Configuration(config.doc ? config.doc.type.schema : config.schema, config.plugins);\n let instance = new EditorState($config);\n for (let i = 0; i < $config.fields.length; i++) instance[$config.fields[i].name] = $config.fields[i].init(config, instance);\n return instance;\n }\n /**\n Create a new state based on this one, but with an adjusted set\n of active plugins. State fields that exist in both sets of\n plugins are kept unchanged. Those that no longer exist are\n dropped, and those that are new are initialized using their\n [`init`](https://prosemirror.net/docs/ref/#state.StateField.init) method, passing in the new\n configuration object..\n */\n reconfigure(config) {\n let $config = new Configuration(this.schema, config.plugins);\n let fields = $config.fields,\n instance = new EditorState($config);\n for (let i = 0; i < fields.length; i++) {\n let name = fields[i].name;\n instance[name] = this.hasOwnProperty(name) ? this[name] : fields[i].init(config, instance);\n }\n return instance;\n }\n /**\n Serialize this state to JSON. If you want to serialize the state\n of plugins, pass an object mapping property names to use in the\n resulting JSON object to plugin objects. The argument may also be\n a string or number, in which case it is ignored, to support the\n way `JSON.stringify` calls `toString` methods.\n */\n toJSON(pluginFields) {\n let result = {\n doc: this.doc.toJSON(),\n selection: this.selection.toJSON()\n };\n if (this.storedMarks) result.storedMarks = this.storedMarks.map(m => m.toJSON());\n if (pluginFields && typeof pluginFields == 'object') for (let prop in pluginFields) {\n if (prop == \"doc\" || prop == \"selection\") throw new RangeError(\"The JSON fields `doc` and `selection` are reserved\");\n let plugin = pluginFields[prop],\n state = plugin.spec.state;\n if (state && state.toJSON) result[prop] = state.toJSON.call(plugin, this[plugin.key]);\n }\n return result;\n }\n /**\n Deserialize a JSON representation of a state. `config` should\n have at least a `schema` field, and should contain array of\n plugins to initialize the state with. `pluginFields` can be used\n to deserialize the state of plugins, by associating plugin\n instances with the property names they use in the JSON object.\n */\n static fromJSON(config, json, pluginFields) {\n if (!json) throw new RangeError(\"Invalid input for EditorState.fromJSON\");\n if (!config.schema) throw new RangeError(\"Required config field 'schema' missing\");\n let $config = new Configuration(config.schema, config.plugins);\n let instance = new EditorState($config);\n $config.fields.forEach(field => {\n if (field.name == \"doc\") {\n instance.doc = Node.fromJSON(config.schema, json.doc);\n } else if (field.name == \"selection\") {\n instance.selection = Selection.fromJSON(instance.doc, json.selection);\n } else if (field.name == \"storedMarks\") {\n if (json.storedMarks) instance.storedMarks = json.storedMarks.map(config.schema.markFromJSON);\n } else {\n if (pluginFields) for (let prop in pluginFields) {\n let plugin = pluginFields[prop],\n state = plugin.spec.state;\n if (plugin.key == field.name && state && state.fromJSON && Object.prototype.hasOwnProperty.call(json, prop)) {\n instance[field.name] = state.fromJSON.call(plugin, config, json[prop], instance);\n return;\n }\n }\n instance[field.name] = field.init(config, instance);\n }\n });\n return instance;\n }\n}\nfunction bindProps(obj, self, target) {\n for (let prop in obj) {\n let val = obj[prop];\n if (val instanceof Function) val = val.bind(self);else if (prop == \"handleDOMEvents\") val = bindProps(val, self, {});\n target[prop] = val;\n }\n return target;\n}\n/**\nPlugins bundle functionality that can be added to an editor.\nThey are part of the [editor state](https://prosemirror.net/docs/ref/#state.EditorState) and\nmay influence that state and the view that contains it.\n*/\nclass Plugin {\n /**\n Create a plugin.\n */\n constructor(\n /**\n The plugin's [spec object](https://prosemirror.net/docs/ref/#state.PluginSpec).\n */\n spec) {\n this.spec = spec;\n /**\n The [props](https://prosemirror.net/docs/ref/#view.EditorProps) exported by this plugin.\n */\n this.props = {};\n if (spec.props) bindProps(spec.props, this, this.props);\n this.key = spec.key ? spec.key.key : createKey(\"plugin\");\n }\n /**\n Extract the plugin's state field from an editor state.\n */\n getState(state) {\n return state[this.key];\n }\n}\nconst keys = Object.create(null);\nfunction createKey(name) {\n if (name in keys) return name + \"$\" + ++keys[name];\n keys[name] = 0;\n return name + \"$\";\n}\n/**\nA key is used to [tag](https://prosemirror.net/docs/ref/#state.PluginSpec.key) plugins in a way\nthat makes it possible to find them, given an editor state.\nAssigning a key does mean only one plugin of that type can be\nactive in a state.\n*/\nclass PluginKey {\n /**\n Create a plugin key.\n */\n constructor(name = \"key\") {\n this.key = createKey(name);\n }\n /**\n Get the active plugin with this key, if any, from an editor\n state.\n */\n get(state) {\n return state.config.pluginsByKey[this.key];\n }\n /**\n Get the plugin's state from an editor state.\n */\n getState(state) {\n return state[this.key];\n }\n}\nexport { AllSelection, EditorState, NodeSelection, Plugin, PluginKey, Selection, SelectionRange, TextSelection, Transaction };","import { TextSelection, NodeSelection, AllSelection, Selection } from 'prosemirror-state';\nimport { DOMSerializer, Fragment, Mark, Slice, DOMParser } from 'prosemirror-model';\nimport { dropPoint } from 'prosemirror-transform';\nconst domIndex = function (node) {\n for (var index = 0;; index++) {\n node = node.previousSibling;\n if (!node) return index;\n }\n};\nconst parentNode = function (node) {\n let parent = node.assignedSlot || node.parentNode;\n return parent && parent.nodeType == 11 ? parent.host : parent;\n};\nlet reusedRange = null;\n// Note that this will always return the same range, because DOM range\n// objects are every expensive, and keep slowing down subsequent DOM\n// updates, for some reason.\nconst textRange = function (node, from, to) {\n let range = reusedRange || (reusedRange = document.createRange());\n range.setEnd(node, to == null ? node.nodeValue.length : to);\n range.setStart(node, from || 0);\n return range;\n};\nconst clearReusedRange = function () {\n reusedRange = null;\n};\n// Scans forward and backward through DOM positions equivalent to the\n// given one to see if the two are in the same place (i.e. after a\n// text node vs at the end of that text node)\nconst isEquivalentPosition = function (node, off, targetNode, targetOff) {\n return targetNode && (scanFor(node, off, targetNode, targetOff, -1) || scanFor(node, off, targetNode, targetOff, 1));\n};\nconst atomElements = /^(img|br|input|textarea|hr)$/i;\nfunction scanFor(node, off, targetNode, targetOff, dir) {\n for (;;) {\n if (node == targetNode && off == targetOff) return true;\n if (off == (dir < 0 ? 0 : nodeSize(node))) {\n let parent = node.parentNode;\n if (!parent || parent.nodeType != 1 || hasBlockDesc(node) || atomElements.test(node.nodeName) || node.contentEditable == \"false\") return false;\n off = domIndex(node) + (dir < 0 ? 0 : 1);\n node = parent;\n } else if (node.nodeType == 1) {\n node = node.childNodes[off + (dir < 0 ? -1 : 0)];\n if (node.contentEditable == \"false\") return false;\n off = dir < 0 ? nodeSize(node) : 0;\n } else {\n return false;\n }\n }\n}\nfunction nodeSize(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction textNodeBefore$1(node, offset) {\n for (;;) {\n if (node.nodeType == 3 && offset) return node;\n if (node.nodeType == 1 && offset > 0) {\n if (node.contentEditable == \"false\") return null;\n node = node.childNodes[offset - 1];\n offset = nodeSize(node);\n } else if (node.parentNode && !hasBlockDesc(node)) {\n offset = domIndex(node);\n node = node.parentNode;\n } else {\n return null;\n }\n }\n}\nfunction textNodeAfter$1(node, offset) {\n for (;;) {\n if (node.nodeType == 3 && offset < node.nodeValue.length) return node;\n if (node.nodeType == 1 && offset < node.childNodes.length) {\n if (node.contentEditable == \"false\") return null;\n node = node.childNodes[offset];\n offset = 0;\n } else if (node.parentNode && !hasBlockDesc(node)) {\n offset = domIndex(node) + 1;\n node = node.parentNode;\n } else {\n return null;\n }\n }\n}\nfunction isOnEdge(node, offset, parent) {\n for (let atStart = offset == 0, atEnd = offset == nodeSize(node); atStart || atEnd;) {\n if (node == parent) return true;\n let index = domIndex(node);\n node = node.parentNode;\n if (!node) return false;\n atStart = atStart && index == 0;\n atEnd = atEnd && index == nodeSize(node);\n }\n}\nfunction hasBlockDesc(dom) {\n let desc;\n for (let cur = dom; cur; cur = cur.parentNode) if (desc = cur.pmViewDesc) break;\n return desc && desc.node && desc.node.isBlock && (desc.dom == dom || desc.contentDOM == dom);\n}\n// Work around Chrome issue https://bugs.chromium.org/p/chromium/issues/detail?id=447523\n// (isCollapsed inappropriately returns true in shadow dom)\nconst selectionCollapsed = function (domSel) {\n return domSel.focusNode && isEquivalentPosition(domSel.focusNode, domSel.focusOffset, domSel.anchorNode, domSel.anchorOffset);\n};\nfunction keyEvent(keyCode, key) {\n let event = document.createEvent(\"Event\");\n event.initEvent(\"keydown\", true, true);\n event.keyCode = keyCode;\n event.key = event.code = key;\n return event;\n}\nfunction deepActiveElement(doc) {\n let elt = doc.activeElement;\n while (elt && elt.shadowRoot) elt = elt.shadowRoot.activeElement;\n return elt;\n}\nfunction caretFromPoint(doc, x, y) {\n if (doc.caretPositionFromPoint) {\n try {\n // Firefox throws for this call in hard-to-predict circumstances (#994)\n let pos = doc.caretPositionFromPoint(x, y);\n // Clip the offset, because Chrome will return a text offset\n // into nodes, which can't be treated as a regular DOM\n // offset\n if (pos) return {\n node: pos.offsetNode,\n offset: Math.min(nodeSize(pos.offsetNode), pos.offset)\n };\n } catch (_) {}\n }\n if (doc.caretRangeFromPoint) {\n let range = doc.caretRangeFromPoint(x, y);\n if (range) return {\n node: range.startContainer,\n offset: Math.min(nodeSize(range.startContainer), range.startOffset)\n };\n }\n}\nconst nav = typeof navigator != \"undefined\" ? navigator : null;\nconst doc = typeof document != \"undefined\" ? document : null;\nconst agent = nav && nav.userAgent || \"\";\nconst ie_edge = /Edge\\/(\\d+)/.exec(agent);\nconst ie_upto10 = /MSIE \\d/.exec(agent);\nconst ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(agent);\nconst ie = !!(ie_upto10 || ie_11up || ie_edge);\nconst ie_version = ie_upto10 ? document.documentMode : ie_11up ? +ie_11up[1] : ie_edge ? +ie_edge[1] : 0;\nconst gecko = !ie && /gecko\\/(\\d+)/i.test(agent);\ngecko && +(/Firefox\\/(\\d+)/.exec(agent) || [0, 0])[1];\nconst _chrome = !ie && /Chrome\\/(\\d+)/.exec(agent);\nconst chrome = !!_chrome;\nconst chrome_version = _chrome ? +_chrome[1] : 0;\nconst safari = !ie && !!nav && /Apple Computer/.test(nav.vendor);\n// Is true for both iOS and iPadOS for convenience\nconst ios = safari && (/Mobile\\/\\w+/.test(agent) || !!nav && nav.maxTouchPoints > 2);\nconst mac = ios || (nav ? /Mac/.test(nav.platform) : false);\nconst windows = nav ? /Win/.test(nav.platform) : false;\nconst android = /Android \\d/.test(agent);\nconst webkit = !!doc && \"webkitFontSmoothing\" in doc.documentElement.style;\nconst webkit_version = webkit ? +(/\\bAppleWebKit\\/(\\d+)/.exec(navigator.userAgent) || [0, 0])[1] : 0;\nfunction windowRect(doc) {\n let vp = doc.defaultView && doc.defaultView.visualViewport;\n if (vp) return {\n left: 0,\n right: vp.width,\n top: 0,\n bottom: vp.height\n };\n return {\n left: 0,\n right: doc.documentElement.clientWidth,\n top: 0,\n bottom: doc.documentElement.clientHeight\n };\n}\nfunction getSide(value, side) {\n return typeof value == \"number\" ? value : value[side];\n}\nfunction clientRect(node) {\n let rect = node.getBoundingClientRect();\n // Adjust for elements with style \"transform: scale()\"\n let scaleX = rect.width / node.offsetWidth || 1;\n let scaleY = rect.height / node.offsetHeight || 1;\n // Make sure scrollbar width isn't included in the rectangle\n return {\n left: rect.left,\n right: rect.left + node.clientWidth * scaleX,\n top: rect.top,\n bottom: rect.top + node.clientHeight * scaleY\n };\n}\nfunction scrollRectIntoView(view, rect, startDOM) {\n let scrollThreshold = view.someProp(\"scrollThreshold\") || 0,\n scrollMargin = view.someProp(\"scrollMargin\") || 5;\n let doc = view.dom.ownerDocument;\n for (let parent = startDOM || view.dom;; parent = parentNode(parent)) {\n if (!parent) break;\n if (parent.nodeType != 1) continue;\n let elt = parent;\n let atTop = elt == doc.body;\n let bounding = atTop ? windowRect(doc) : clientRect(elt);\n let moveX = 0,\n moveY = 0;\n if (rect.top < bounding.top + getSide(scrollThreshold, \"top\")) moveY = -(bounding.top - rect.top + getSide(scrollMargin, \"top\"));else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, \"bottom\")) moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, \"top\") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, \"bottom\");\n if (rect.left < bounding.left + getSide(scrollThreshold, \"left\")) moveX = -(bounding.left - rect.left + getSide(scrollMargin, \"left\"));else if (rect.right > bounding.right - getSide(scrollThreshold, \"right\")) moveX = rect.right - bounding.right + getSide(scrollMargin, \"right\");\n if (moveX || moveY) {\n if (atTop) {\n doc.defaultView.scrollBy(moveX, moveY);\n } else {\n let startX = elt.scrollLeft,\n startY = elt.scrollTop;\n if (moveY) elt.scrollTop += moveY;\n if (moveX) elt.scrollLeft += moveX;\n let dX = elt.scrollLeft - startX,\n dY = elt.scrollTop - startY;\n rect = {\n left: rect.left - dX,\n top: rect.top - dY,\n right: rect.right - dX,\n bottom: rect.bottom - dY\n };\n }\n }\n if (atTop || /^(fixed|sticky)$/.test(getComputedStyle(parent).position)) break;\n }\n}\n// Store the scroll position of the editor's parent nodes, along with\n// the top position of an element near the top of the editor, which\n// will be used to make sure the visible viewport remains stable even\n// when the size of the content above changes.\nfunction storeScrollPos(view) {\n let rect = view.dom.getBoundingClientRect(),\n startY = Math.max(0, rect.top);\n let refDOM, refTop;\n for (let x = (rect.left + rect.right) / 2, y = startY + 1; y < Math.min(innerHeight, rect.bottom); y += 5) {\n let dom = view.root.elementFromPoint(x, y);\n if (!dom || dom == view.dom || !view.dom.contains(dom)) continue;\n let localRect = dom.getBoundingClientRect();\n if (localRect.top >= startY - 20) {\n refDOM = dom;\n refTop = localRect.top;\n break;\n }\n }\n return {\n refDOM: refDOM,\n refTop: refTop,\n stack: scrollStack(view.dom)\n };\n}\nfunction scrollStack(dom) {\n let stack = [],\n doc = dom.ownerDocument;\n for (let cur = dom; cur; cur = parentNode(cur)) {\n stack.push({\n dom: cur,\n top: cur.scrollTop,\n left: cur.scrollLeft\n });\n if (dom == doc) break;\n }\n return stack;\n}\n// Reset the scroll position of the editor's parent nodes to that what\n// it was before, when storeScrollPos was called.\nfunction resetScrollPos({\n refDOM,\n refTop,\n stack\n}) {\n let newRefTop = refDOM ? refDOM.getBoundingClientRect().top : 0;\n restoreScrollStack(stack, newRefTop == 0 ? 0 : newRefTop - refTop);\n}\nfunction restoreScrollStack(stack, dTop) {\n for (let i = 0; i < stack.length; i++) {\n let {\n dom,\n top,\n left\n } = stack[i];\n if (dom.scrollTop != top + dTop) dom.scrollTop = top + dTop;\n if (dom.scrollLeft != left) dom.scrollLeft = left;\n }\n}\nlet preventScrollSupported = null;\n// Feature-detects support for .focus({preventScroll: true}), and uses\n// a fallback kludge when not supported.\nfunction focusPreventScroll(dom) {\n if (dom.setActive) return dom.setActive(); // in IE\n if (preventScrollSupported) return dom.focus(preventScrollSupported);\n let stored = scrollStack(dom);\n dom.focus(preventScrollSupported == null ? {\n get preventScroll() {\n preventScrollSupported = {\n preventScroll: true\n };\n return true;\n }\n } : undefined);\n if (!preventScrollSupported) {\n preventScrollSupported = false;\n restoreScrollStack(stored, 0);\n }\n}\nfunction findOffsetInNode(node, coords) {\n let closest,\n dxClosest = 2e8,\n coordsClosest,\n offset = 0;\n let rowBot = coords.top,\n rowTop = coords.top;\n let firstBelow, coordsBelow;\n for (let child = node.firstChild, childIndex = 0; child; child = child.nextSibling, childIndex++) {\n let rects;\n if (child.nodeType == 1) rects = child.getClientRects();else if (child.nodeType == 3) rects = textRange(child).getClientRects();else continue;\n for (let i = 0; i < rects.length; i++) {\n let rect = rects[i];\n if (rect.top <= rowBot && rect.bottom >= rowTop) {\n rowBot = Math.max(rect.bottom, rowBot);\n rowTop = Math.min(rect.top, rowTop);\n let dx = rect.left > coords.left ? rect.left - coords.left : rect.right < coords.left ? coords.left - rect.right : 0;\n if (dx < dxClosest) {\n closest = child;\n dxClosest = dx;\n coordsClosest = dx && closest.nodeType == 3 ? {\n left: rect.right < coords.left ? rect.right : rect.left,\n top: coords.top\n } : coords;\n if (child.nodeType == 1 && dx) offset = childIndex + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0);\n continue;\n }\n } else if (rect.top > coords.top && !firstBelow && rect.left <= coords.left && rect.right >= coords.left) {\n firstBelow = child;\n coordsBelow = {\n left: Math.max(rect.left, Math.min(rect.right, coords.left)),\n top: rect.top\n };\n }\n if (!closest && (coords.left >= rect.right && coords.top >= rect.top || coords.left >= rect.left && coords.top >= rect.bottom)) offset = childIndex + 1;\n }\n }\n if (!closest && firstBelow) {\n closest = firstBelow;\n coordsClosest = coordsBelow;\n dxClosest = 0;\n }\n if (closest && closest.nodeType == 3) return findOffsetInText(closest, coordsClosest);\n if (!closest || dxClosest && closest.nodeType == 1) return {\n node,\n offset\n };\n return findOffsetInNode(closest, coordsClosest);\n}\nfunction findOffsetInText(node, coords) {\n let len = node.nodeValue.length;\n let range = document.createRange();\n for (let i = 0; i < len; i++) {\n range.setEnd(node, i + 1);\n range.setStart(node, i);\n let rect = singleRect(range, 1);\n if (rect.top == rect.bottom) continue;\n if (inRect(coords, rect)) return {\n node,\n offset: i + (coords.left >= (rect.left + rect.right) / 2 ? 1 : 0)\n };\n }\n return {\n node,\n offset: 0\n };\n}\nfunction inRect(coords, rect) {\n return coords.left >= rect.left - 1 && coords.left <= rect.right + 1 && coords.top >= rect.top - 1 && coords.top <= rect.bottom + 1;\n}\nfunction targetKludge(dom, coords) {\n let parent = dom.parentNode;\n if (parent && /^li$/i.test(parent.nodeName) && coords.left < dom.getBoundingClientRect().left) return parent;\n return dom;\n}\nfunction posFromElement(view, elt, coords) {\n let {\n node,\n offset\n } = findOffsetInNode(elt, coords),\n bias = -1;\n if (node.nodeType == 1 && !node.firstChild) {\n let rect = node.getBoundingClientRect();\n bias = rect.left != rect.right && coords.left > (rect.left + rect.right) / 2 ? 1 : -1;\n }\n return view.docView.posFromDOM(node, offset, bias);\n}\nfunction posFromCaret(view, node, offset, coords) {\n // Browser (in caretPosition/RangeFromPoint) will agressively\n // normalize towards nearby inline nodes. Since we are interested in\n // positions between block nodes too, we first walk up the hierarchy\n // of nodes to see if there are block nodes that the coordinates\n // fall outside of. If so, we take the position before/after that\n // block. If not, we call `posFromDOM` on the raw node/offset.\n let outsideBlock = -1;\n for (let cur = node, sawBlock = false;;) {\n if (cur == view.dom) break;\n let desc = view.docView.nearestDesc(cur, true),\n rect;\n if (!desc) return null;\n if (desc.dom.nodeType == 1 && (desc.node.isBlock && desc.parent || !desc.contentDOM) && (\n // Ignore elements with zero-size bounding rectangles\n (rect = desc.dom.getBoundingClientRect()).width || rect.height)) {\n if (desc.node.isBlock && desc.parent) {\n // Only apply the horizontal test to the innermost block. Vertical for any parent.\n if (!sawBlock && rect.left > coords.left || rect.top > coords.top) outsideBlock = desc.posBefore;else if (!sawBlock && rect.right < coords.left || rect.bottom < coords.top) outsideBlock = desc.posAfter;\n sawBlock = true;\n }\n if (!desc.contentDOM && outsideBlock < 0 && !desc.node.isText) {\n // If we are inside a leaf, return the side of the leaf closer to the coords\n let before = desc.node.isBlock ? coords.top < (rect.top + rect.bottom) / 2 : coords.left < (rect.left + rect.right) / 2;\n return before ? desc.posBefore : desc.posAfter;\n }\n }\n cur = desc.dom.parentNode;\n }\n return outsideBlock > -1 ? outsideBlock : view.docView.posFromDOM(node, offset, -1);\n}\nfunction elementFromPoint(element, coords, box) {\n let len = element.childNodes.length;\n if (len && box.top < box.bottom) {\n for (let startI = Math.max(0, Math.min(len - 1, Math.floor(len * (coords.top - box.top) / (box.bottom - box.top)) - 2)), i = startI;;) {\n let child = element.childNodes[i];\n if (child.nodeType == 1) {\n let rects = child.getClientRects();\n for (let j = 0; j < rects.length; j++) {\n let rect = rects[j];\n if (inRect(coords, rect)) return elementFromPoint(child, coords, rect);\n }\n }\n if ((i = (i + 1) % len) == startI) break;\n }\n }\n return element;\n}\n// Given an x,y position on the editor, get the position in the document.\nfunction posAtCoords(view, coords) {\n let doc = view.dom.ownerDocument,\n node,\n offset = 0;\n let caret = caretFromPoint(doc, coords.left, coords.top);\n if (caret) ({\n node,\n offset\n } = caret);\n let elt = (view.root.elementFromPoint ? view.root : doc).elementFromPoint(coords.left, coords.top);\n let pos;\n if (!elt || !view.dom.contains(elt.nodeType != 1 ? elt.parentNode : elt)) {\n let box = view.dom.getBoundingClientRect();\n if (!inRect(coords, box)) return null;\n elt = elementFromPoint(view.dom, coords, box);\n if (!elt) return null;\n }\n // Safari's caretRangeFromPoint returns nonsense when on a draggable element\n if (safari) {\n for (let p = elt; node && p; p = parentNode(p)) if (p.draggable) node = undefined;\n }\n elt = targetKludge(elt, coords);\n if (node) {\n if (gecko && node.nodeType == 1) {\n // Firefox will sometimes return offsets into nodes, which\n // have no actual children, from caretPositionFromPoint (#953)\n offset = Math.min(offset, node.childNodes.length);\n // It'll also move the returned position before image nodes,\n // even if those are behind it.\n if (offset < node.childNodes.length) {\n let next = node.childNodes[offset],\n box;\n if (next.nodeName == \"IMG\" && (box = next.getBoundingClientRect()).right <= coords.left && box.bottom > coords.top) offset++;\n }\n }\n let prev;\n // When clicking above the right side of an uneditable node, Chrome will report a cursor position after that node.\n if (webkit && offset && node.nodeType == 1 && (prev = node.childNodes[offset - 1]).nodeType == 1 && prev.contentEditable == \"false\" && prev.getBoundingClientRect().top >= coords.top) offset--;\n // Suspiciously specific kludge to work around caret*FromPoint\n // never returning a position at the end of the document\n if (node == view.dom && offset == node.childNodes.length - 1 && node.lastChild.nodeType == 1 && coords.top > node.lastChild.getBoundingClientRect().bottom) pos = view.state.doc.content.size;\n // Ignore positions directly after a BR, since caret*FromPoint\n // 'round up' positions that would be more accurately placed\n // before the BR node.\n else if (offset == 0 || node.nodeType != 1 || node.childNodes[offset - 1].nodeName != \"BR\") pos = posFromCaret(view, node, offset, coords);\n }\n if (pos == null) pos = posFromElement(view, elt, coords);\n let desc = view.docView.nearestDesc(elt, true);\n return {\n pos,\n inside: desc ? desc.posAtStart - desc.border : -1\n };\n}\nfunction nonZero(rect) {\n return rect.top < rect.bottom || rect.left < rect.right;\n}\nfunction singleRect(target, bias) {\n let rects = target.getClientRects();\n if (rects.length) {\n let first = rects[bias < 0 ? 0 : rects.length - 1];\n if (nonZero(first)) return first;\n }\n return Array.prototype.find.call(rects, nonZero) || target.getBoundingClientRect();\n}\nconst BIDI = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n// Given a position in the document model, get a bounding box of the\n// character at that position, relative to the window.\nfunction coordsAtPos(view, pos, side) {\n let {\n node,\n offset,\n atom\n } = view.docView.domFromPos(pos, side < 0 ? -1 : 1);\n let supportEmptyRange = webkit || gecko;\n if (node.nodeType == 3) {\n // These browsers support querying empty text ranges. Prefer that in\n // bidi context or when at the end of a node.\n if (supportEmptyRange && (BIDI.test(node.nodeValue) || (side < 0 ? !offset : offset == node.nodeValue.length))) {\n let rect = singleRect(textRange(node, offset, offset), side);\n // Firefox returns bad results (the position before the space)\n // when querying a position directly after line-broken\n // whitespace. Detect this situation and and kludge around it\n if (gecko && offset && /\\s/.test(node.nodeValue[offset - 1]) && offset < node.nodeValue.length) {\n let rectBefore = singleRect(textRange(node, offset - 1, offset - 1), -1);\n if (rectBefore.top == rect.top) {\n let rectAfter = singleRect(textRange(node, offset, offset + 1), -1);\n if (rectAfter.top != rect.top) return flattenV(rectAfter, rectAfter.left < rectBefore.left);\n }\n }\n return rect;\n } else {\n let from = offset,\n to = offset,\n takeSide = side < 0 ? 1 : -1;\n if (side < 0 && !offset) {\n to++;\n takeSide = -1;\n } else if (side >= 0 && offset == node.nodeValue.length) {\n from--;\n takeSide = 1;\n } else if (side < 0) {\n from--;\n } else {\n to++;\n }\n return flattenV(singleRect(textRange(node, from, to), takeSide), takeSide < 0);\n }\n }\n let $dom = view.state.doc.resolve(pos - (atom || 0));\n // Return a horizontal line in block context\n if (!$dom.parent.inlineContent) {\n if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n let before = node.childNodes[offset - 1];\n if (before.nodeType == 1) return flattenH(before.getBoundingClientRect(), false);\n }\n if (atom == null && offset < nodeSize(node)) {\n let after = node.childNodes[offset];\n if (after.nodeType == 1) return flattenH(after.getBoundingClientRect(), true);\n }\n return flattenH(node.getBoundingClientRect(), side >= 0);\n }\n // Inline, not in text node (this is not Bidi-safe)\n if (atom == null && offset && (side < 0 || offset == nodeSize(node))) {\n let before = node.childNodes[offset - 1];\n let target = before.nodeType == 3 ? textRange(before, nodeSize(before) - (supportEmptyRange ? 0 : 1))\n // BR nodes tend to only return the rectangle before them.\n // Only use them if they are the last element in their parent\n : before.nodeType == 1 && (before.nodeName != \"BR\" || !before.nextSibling) ? before : null;\n if (target) return flattenV(singleRect(target, 1), false);\n }\n if (atom == null && offset < nodeSize(node)) {\n let after = node.childNodes[offset];\n while (after.pmViewDesc && after.pmViewDesc.ignoreForCoords) after = after.nextSibling;\n let target = !after ? null : after.nodeType == 3 ? textRange(after, 0, supportEmptyRange ? 0 : 1) : after.nodeType == 1 ? after : null;\n if (target) return flattenV(singleRect(target, -1), true);\n }\n // All else failed, just try to get a rectangle for the target node\n return flattenV(singleRect(node.nodeType == 3 ? textRange(node) : node, -side), side >= 0);\n}\nfunction flattenV(rect, left) {\n if (rect.width == 0) return rect;\n let x = left ? rect.left : rect.right;\n return {\n top: rect.top,\n bottom: rect.bottom,\n left: x,\n right: x\n };\n}\nfunction flattenH(rect, top) {\n if (rect.height == 0) return rect;\n let y = top ? rect.top : rect.bottom;\n return {\n top: y,\n bottom: y,\n left: rect.left,\n right: rect.right\n };\n}\nfunction withFlushedState(view, state, f) {\n let viewState = view.state,\n active = view.root.activeElement;\n if (viewState != state) view.updateState(state);\n if (active != view.dom) view.focus();\n try {\n return f();\n } finally {\n if (viewState != state) view.updateState(viewState);\n if (active != view.dom && active) active.focus();\n }\n}\n// Whether vertical position motion in a given direction\n// from a position would leave a text block.\nfunction endOfTextblockVertical(view, state, dir) {\n let sel = state.selection;\n let $pos = dir == \"up\" ? sel.$from : sel.$to;\n return withFlushedState(view, state, () => {\n let {\n node: dom\n } = view.docView.domFromPos($pos.pos, dir == \"up\" ? -1 : 1);\n for (;;) {\n let nearest = view.docView.nearestDesc(dom, true);\n if (!nearest) break;\n if (nearest.node.isBlock) {\n dom = nearest.contentDOM || nearest.dom;\n break;\n }\n dom = nearest.dom.parentNode;\n }\n let coords = coordsAtPos(view, $pos.pos, 1);\n for (let child = dom.firstChild; child; child = child.nextSibling) {\n let boxes;\n if (child.nodeType == 1) boxes = child.getClientRects();else if (child.nodeType == 3) boxes = textRange(child, 0, child.nodeValue.length).getClientRects();else continue;\n for (let i = 0; i < boxes.length; i++) {\n let box = boxes[i];\n if (box.bottom > box.top + 1 && (dir == \"up\" ? coords.top - box.top > (box.bottom - coords.top) * 2 : box.bottom - coords.bottom > (coords.bottom - box.top) * 2)) return false;\n }\n }\n return true;\n });\n}\nconst maybeRTL = /[\\u0590-\\u08ac]/;\nfunction endOfTextblockHorizontal(view, state, dir) {\n let {\n $head\n } = state.selection;\n if (!$head.parent.isTextblock) return false;\n let offset = $head.parentOffset,\n atStart = !offset,\n atEnd = offset == $head.parent.content.size;\n let sel = view.domSelection();\n if (!sel) return $head.pos == $head.start() || $head.pos == $head.end();\n // If the textblock is all LTR, or the browser doesn't support\n // Selection.modify (Edge), fall back to a primitive approach\n if (!maybeRTL.test($head.parent.textContent) || !sel.modify) return dir == \"left\" || dir == \"backward\" ? atStart : atEnd;\n return withFlushedState(view, state, () => {\n // This is a huge hack, but appears to be the best we can\n // currently do: use `Selection.modify` to move the selection by\n // one character, and see if that moves the cursor out of the\n // textblock (or doesn't move it at all, when at the start/end of\n // the document).\n let {\n focusNode: oldNode,\n focusOffset: oldOff,\n anchorNode,\n anchorOffset\n } = view.domSelectionRange();\n let oldBidiLevel = sel.caretBidiLevel // Only for Firefox\n ;\n sel.modify(\"move\", dir, \"character\");\n let parentDOM = $head.depth ? view.docView.domAfterPos($head.before()) : view.dom;\n let {\n focusNode: newNode,\n focusOffset: newOff\n } = view.domSelectionRange();\n let result = newNode && !parentDOM.contains(newNode.nodeType == 1 ? newNode : newNode.parentNode) || oldNode == newNode && oldOff == newOff;\n // Restore the previous selection\n try {\n sel.collapse(anchorNode, anchorOffset);\n if (oldNode && (oldNode != anchorNode || oldOff != anchorOffset) && sel.extend) sel.extend(oldNode, oldOff);\n } catch (_) {}\n if (oldBidiLevel != null) sel.caretBidiLevel = oldBidiLevel;\n return result;\n });\n}\nlet cachedState = null;\nlet cachedDir = null;\nlet cachedResult = false;\nfunction endOfTextblock(view, state, dir) {\n if (cachedState == state && cachedDir == dir) return cachedResult;\n cachedState = state;\n cachedDir = dir;\n return cachedResult = dir == \"up\" || dir == \"down\" ? endOfTextblockVertical(view, state, dir) : endOfTextblockHorizontal(view, state, dir);\n}\n\n// View descriptions are data structures that describe the DOM that is\n// used to represent the editor's content. They are used for:\n//\n// - Incremental redrawing when the document changes\n//\n// - Figuring out what part of the document a given DOM position\n// corresponds to\n//\n// - Wiring in custom implementations of the editing interface for a\n// given node\n//\n// They form a doubly-linked mutable tree, starting at `view.docView`.\nconst NOT_DIRTY = 0,\n CHILD_DIRTY = 1,\n CONTENT_DIRTY = 2,\n NODE_DIRTY = 3;\n// Superclass for the various kinds of descriptions. Defines their\n// basic structure and shared methods.\nclass ViewDesc {\n constructor(parent, children, dom,\n // This is the node that holds the child views. It may be null for\n // descs that don't have children.\n contentDOM) {\n this.parent = parent;\n this.children = children;\n this.dom = dom;\n this.contentDOM = contentDOM;\n this.dirty = NOT_DIRTY;\n // An expando property on the DOM node provides a link back to its\n // description.\n dom.pmViewDesc = this;\n }\n // Used to check whether a given description corresponds to a\n // widget/mark/node.\n matchesWidget(widget) {\n return false;\n }\n matchesMark(mark) {\n return false;\n }\n matchesNode(node, outerDeco, innerDeco) {\n return false;\n }\n matchesHack(nodeName) {\n return false;\n }\n // When parsing in-editor content (in domchange.js), we allow\n // descriptions to determine the parse rules that should be used to\n // parse them.\n parseRule() {\n return null;\n }\n // Used by the editor's event handler to ignore events that come\n // from certain descs.\n stopEvent(event) {\n return false;\n }\n // The size of the content represented by this desc.\n get size() {\n let size = 0;\n for (let i = 0; i < this.children.length; i++) size += this.children[i].size;\n return size;\n }\n // For block nodes, this represents the space taken up by their\n // start/end tokens.\n get border() {\n return 0;\n }\n destroy() {\n this.parent = undefined;\n if (this.dom.pmViewDesc == this) this.dom.pmViewDesc = undefined;\n for (let i = 0; i < this.children.length; i++) this.children[i].destroy();\n }\n posBeforeChild(child) {\n for (let i = 0, pos = this.posAtStart;; i++) {\n let cur = this.children[i];\n if (cur == child) return pos;\n pos += cur.size;\n }\n }\n get posBefore() {\n return this.parent.posBeforeChild(this);\n }\n get posAtStart() {\n return this.parent ? this.parent.posBeforeChild(this) + this.border : 0;\n }\n get posAfter() {\n return this.posBefore + this.size;\n }\n get posAtEnd() {\n return this.posAtStart + this.size - 2 * this.border;\n }\n localPosFromDOM(dom, offset, bias) {\n // If the DOM position is in the content, use the child desc after\n // it to figure out a position.\n if (this.contentDOM && this.contentDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode)) {\n if (bias < 0) {\n let domBefore, desc;\n if (dom == this.contentDOM) {\n domBefore = dom.childNodes[offset - 1];\n } else {\n while (dom.parentNode != this.contentDOM) dom = dom.parentNode;\n domBefore = dom.previousSibling;\n }\n while (domBefore && !((desc = domBefore.pmViewDesc) && desc.parent == this)) domBefore = domBefore.previousSibling;\n return domBefore ? this.posBeforeChild(desc) + desc.size : this.posAtStart;\n } else {\n let domAfter, desc;\n if (dom == this.contentDOM) {\n domAfter = dom.childNodes[offset];\n } else {\n while (dom.parentNode != this.contentDOM) dom = dom.parentNode;\n domAfter = dom.nextSibling;\n }\n while (domAfter && !((desc = domAfter.pmViewDesc) && desc.parent == this)) domAfter = domAfter.nextSibling;\n return domAfter ? this.posBeforeChild(desc) : this.posAtEnd;\n }\n }\n // Otherwise, use various heuristics, falling back on the bias\n // parameter, to determine whether to return the position at the\n // start or at the end of this view desc.\n let atEnd;\n if (dom == this.dom && this.contentDOM) {\n atEnd = offset > domIndex(this.contentDOM);\n } else if (this.contentDOM && this.contentDOM != this.dom && this.dom.contains(this.contentDOM)) {\n atEnd = dom.compareDocumentPosition(this.contentDOM) & 2;\n } else if (this.dom.firstChild) {\n if (offset == 0) for (let search = dom;; search = search.parentNode) {\n if (search == this.dom) {\n atEnd = false;\n break;\n }\n if (search.previousSibling) break;\n }\n if (atEnd == null && offset == dom.childNodes.length) for (let search = dom;; search = search.parentNode) {\n if (search == this.dom) {\n atEnd = true;\n break;\n }\n if (search.nextSibling) break;\n }\n }\n return (atEnd == null ? bias > 0 : atEnd) ? this.posAtEnd : this.posAtStart;\n }\n nearestDesc(dom, onlyNodes = false) {\n for (let first = true, cur = dom; cur; cur = cur.parentNode) {\n let desc = this.getDesc(cur),\n nodeDOM;\n if (desc && (!onlyNodes || desc.node)) {\n // If dom is outside of this desc's nodeDOM, don't count it.\n if (first && (nodeDOM = desc.nodeDOM) && !(nodeDOM.nodeType == 1 ? nodeDOM.contains(dom.nodeType == 1 ? dom : dom.parentNode) : nodeDOM == dom)) first = false;else return desc;\n }\n }\n }\n getDesc(dom) {\n let desc = dom.pmViewDesc;\n for (let cur = desc; cur; cur = cur.parent) if (cur == this) return desc;\n }\n posFromDOM(dom, offset, bias) {\n for (let scan = dom; scan; scan = scan.parentNode) {\n let desc = this.getDesc(scan);\n if (desc) return desc.localPosFromDOM(dom, offset, bias);\n }\n return -1;\n }\n // Find the desc for the node after the given pos, if any. (When a\n // parent node overrode rendering, there might not be one.)\n descAt(pos) {\n for (let i = 0, offset = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (offset == pos && end != offset) {\n while (!child.border && child.children.length) child = child.children[0];\n return child;\n }\n if (pos < end) return child.descAt(pos - offset - child.border);\n offset = end;\n }\n }\n domFromPos(pos, side) {\n if (!this.contentDOM) return {\n node: this.dom,\n offset: 0,\n atom: pos + 1\n };\n // First find the position in the child array\n let i = 0,\n offset = 0;\n for (let curPos = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = curPos + child.size;\n if (end > pos || child instanceof TrailingHackViewDesc) {\n offset = pos - curPos;\n break;\n }\n curPos = end;\n }\n // If this points into the middle of a child, call through\n if (offset) return this.children[i].domFromPos(offset - this.children[i].border, side);\n // Go back if there were any zero-length widgets with side >= 0 before this point\n for (let prev; i && !(prev = this.children[i - 1]).size && prev instanceof WidgetViewDesc && prev.side >= 0; i--) {}\n // Scan towards the first useable node\n if (side <= 0) {\n let prev,\n enter = true;\n for (;; i--, enter = false) {\n prev = i ? this.children[i - 1] : null;\n if (!prev || prev.dom.parentNode == this.contentDOM) break;\n }\n if (prev && side && enter && !prev.border && !prev.domAtom) return prev.domFromPos(prev.size, side);\n return {\n node: this.contentDOM,\n offset: prev ? domIndex(prev.dom) + 1 : 0\n };\n } else {\n let next,\n enter = true;\n for (;; i++, enter = false) {\n next = i < this.children.length ? this.children[i] : null;\n if (!next || next.dom.parentNode == this.contentDOM) break;\n }\n if (next && enter && !next.border && !next.domAtom) return next.domFromPos(0, side);\n return {\n node: this.contentDOM,\n offset: next ? domIndex(next.dom) : this.contentDOM.childNodes.length\n };\n }\n }\n // Used to find a DOM range in a single parent for a given changed\n // range.\n parseRange(from, to, base = 0) {\n if (this.children.length == 0) return {\n node: this.contentDOM,\n from,\n to,\n fromOffset: 0,\n toOffset: this.contentDOM.childNodes.length\n };\n let fromOffset = -1,\n toOffset = -1;\n for (let offset = base, i = 0;; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (fromOffset == -1 && from <= end) {\n let childBase = offset + child.border;\n // FIXME maybe descend mark views to parse a narrower range?\n if (from >= childBase && to <= end - child.border && child.node && child.contentDOM && this.contentDOM.contains(child.contentDOM)) return child.parseRange(from, to, childBase);\n from = offset;\n for (let j = i; j > 0; j--) {\n let prev = this.children[j - 1];\n if (prev.size && prev.dom.parentNode == this.contentDOM && !prev.emptyChildAt(1)) {\n fromOffset = domIndex(prev.dom) + 1;\n break;\n }\n from -= prev.size;\n }\n if (fromOffset == -1) fromOffset = 0;\n }\n if (fromOffset > -1 && (end > to || i == this.children.length - 1)) {\n to = end;\n for (let j = i + 1; j < this.children.length; j++) {\n let next = this.children[j];\n if (next.size && next.dom.parentNode == this.contentDOM && !next.emptyChildAt(-1)) {\n toOffset = domIndex(next.dom);\n break;\n }\n to += next.size;\n }\n if (toOffset == -1) toOffset = this.contentDOM.childNodes.length;\n break;\n }\n offset = end;\n }\n return {\n node: this.contentDOM,\n from,\n to,\n fromOffset,\n toOffset\n };\n }\n emptyChildAt(side) {\n if (this.border || !this.contentDOM || !this.children.length) return false;\n let child = this.children[side < 0 ? 0 : this.children.length - 1];\n return child.size == 0 || child.emptyChildAt(side);\n }\n domAfterPos(pos) {\n let {\n node,\n offset\n } = this.domFromPos(pos, 0);\n if (node.nodeType != 1 || offset == node.childNodes.length) throw new RangeError(\"No node after pos \" + pos);\n return node.childNodes[offset];\n }\n // View descs are responsible for setting any selection that falls\n // entirely inside of them, so that custom implementations can do\n // custom things with the selection. Note that this falls apart when\n // a selection starts in such a node and ends in another, in which\n // case we just use whatever domFromPos produces as a best effort.\n setSelection(anchor, head, view, force = false) {\n // If the selection falls entirely in a child, give it to that child\n let from = Math.min(anchor, head),\n to = Math.max(anchor, head);\n for (let i = 0, offset = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (from > offset && to < end) return child.setSelection(anchor - offset - child.border, head - offset - child.border, view, force);\n offset = end;\n }\n let anchorDOM = this.domFromPos(anchor, anchor ? -1 : 1);\n let headDOM = head == anchor ? anchorDOM : this.domFromPos(head, head ? -1 : 1);\n let domSel = view.root.getSelection();\n let selRange = view.domSelectionRange();\n let brKludge = false;\n // On Firefox, using Selection.collapse to put the cursor after a\n // BR node for some reason doesn't always work (#1073). On Safari,\n // the cursor sometimes inexplicable visually lags behind its\n // reported position in such situations (#1092).\n if ((gecko || safari) && anchor == head) {\n let {\n node,\n offset\n } = anchorDOM;\n if (node.nodeType == 3) {\n brKludge = !!(offset && node.nodeValue[offset - 1] == \"\\n\");\n // Issue #1128\n if (brKludge && offset == node.nodeValue.length) {\n for (let scan = node, after; scan; scan = scan.parentNode) {\n if (after = scan.nextSibling) {\n if (after.nodeName == \"BR\") anchorDOM = headDOM = {\n node: after.parentNode,\n offset: domIndex(after) + 1\n };\n break;\n }\n let desc = scan.pmViewDesc;\n if (desc && desc.node && desc.node.isBlock) break;\n }\n }\n } else {\n let prev = node.childNodes[offset - 1];\n brKludge = prev && (prev.nodeName == \"BR\" || prev.contentEditable == \"false\");\n }\n }\n // Firefox can act strangely when the selection is in front of an\n // uneditable node. See #1163 and https://bugzilla.mozilla.org/show_bug.cgi?id=1709536\n if (gecko && selRange.focusNode && selRange.focusNode != headDOM.node && selRange.focusNode.nodeType == 1) {\n let after = selRange.focusNode.childNodes[selRange.focusOffset];\n if (after && after.contentEditable == \"false\") force = true;\n }\n if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset)) return;\n // Selection.extend can be used to create an 'inverted' selection\n // (one where the focus is before the anchor), but not all\n // browsers support it yet.\n let domSelExtended = false;\n if ((domSel.extend || anchor == head) && !brKludge) {\n domSel.collapse(anchorDOM.node, anchorDOM.offset);\n try {\n if (anchor != head) domSel.extend(headDOM.node, headDOM.offset);\n domSelExtended = true;\n } catch (_) {\n // In some cases with Chrome the selection is empty after calling\n // collapse, even when it should be valid. This appears to be a bug, but\n // it is difficult to isolate. If this happens fallback to the old path\n // without using extend.\n // Similarly, this could crash on Safari if the editor is hidden, and\n // there was no selection.\n }\n }\n if (!domSelExtended) {\n if (anchor > head) {\n let tmp = anchorDOM;\n anchorDOM = headDOM;\n headDOM = tmp;\n }\n let range = document.createRange();\n range.setEnd(headDOM.node, headDOM.offset);\n range.setStart(anchorDOM.node, anchorDOM.offset);\n domSel.removeAllRanges();\n domSel.addRange(range);\n }\n }\n ignoreMutation(mutation) {\n return !this.contentDOM && mutation.type != \"selection\";\n }\n get contentLost() {\n return this.contentDOM && this.contentDOM != this.dom && !this.dom.contains(this.contentDOM);\n }\n // Remove a subtree of the element tree that has been touched\n // by a DOM change, so that the next update will redraw it.\n markDirty(from, to) {\n for (let offset = 0, i = 0; i < this.children.length; i++) {\n let child = this.children[i],\n end = offset + child.size;\n if (offset == end ? from <= end && to >= offset : from < end && to > offset) {\n let startInside = offset + child.border,\n endInside = end - child.border;\n if (from >= startInside && to <= endInside) {\n this.dirty = from == offset || to == end ? CONTENT_DIRTY : CHILD_DIRTY;\n if (from == startInside && to == endInside && (child.contentLost || child.dom.parentNode != this.contentDOM)) child.dirty = NODE_DIRTY;else child.markDirty(from - startInside, to - startInside);\n return;\n } else {\n child.dirty = child.dom == child.contentDOM && child.dom.parentNode == this.contentDOM && !child.children.length ? CONTENT_DIRTY : NODE_DIRTY;\n }\n }\n offset = end;\n }\n this.dirty = CONTENT_DIRTY;\n }\n markParentsDirty() {\n let level = 1;\n for (let node = this.parent; node; node = node.parent, level++) {\n let dirty = level == 1 ? CONTENT_DIRTY : CHILD_DIRTY;\n if (node.dirty < dirty) node.dirty = dirty;\n }\n }\n get domAtom() {\n return false;\n }\n get ignoreForCoords() {\n return false;\n }\n isText(text) {\n return false;\n }\n}\n// A widget desc represents a widget decoration, which is a DOM node\n// drawn between the document nodes.\nclass WidgetViewDesc extends ViewDesc {\n constructor(parent, widget, view, pos) {\n let self,\n dom = widget.type.toDOM;\n if (typeof dom == \"function\") dom = dom(view, () => {\n if (!self) return pos;\n if (self.parent) return self.parent.posBeforeChild(self);\n });\n if (!widget.type.spec.raw) {\n if (dom.nodeType != 1) {\n let wrap = document.createElement(\"span\");\n wrap.appendChild(dom);\n dom = wrap;\n }\n dom.contentEditable = \"false\";\n dom.classList.add(\"ProseMirror-widget\");\n }\n super(parent, [], dom, null);\n this.widget = widget;\n this.widget = widget;\n self = this;\n }\n matchesWidget(widget) {\n return this.dirty == NOT_DIRTY && widget.type.eq(this.widget.type);\n }\n parseRule() {\n return {\n ignore: true\n };\n }\n stopEvent(event) {\n let stop = this.widget.spec.stopEvent;\n return stop ? stop(event) : false;\n }\n ignoreMutation(mutation) {\n return mutation.type != \"selection\" || this.widget.spec.ignoreSelection;\n }\n destroy() {\n this.widget.type.destroy(this.dom);\n super.destroy();\n }\n get domAtom() {\n return true;\n }\n get side() {\n return this.widget.type.side;\n }\n}\nclass CompositionViewDesc extends ViewDesc {\n constructor(parent, dom, textDOM, text) {\n super(parent, [], dom, null);\n this.textDOM = textDOM;\n this.text = text;\n }\n get size() {\n return this.text.length;\n }\n localPosFromDOM(dom, offset) {\n if (dom != this.textDOM) return this.posAtStart + (offset ? this.size : 0);\n return this.posAtStart + offset;\n }\n domFromPos(pos) {\n return {\n node: this.textDOM,\n offset: pos\n };\n }\n ignoreMutation(mut) {\n return mut.type === 'characterData' && mut.target.nodeValue == mut.oldValue;\n }\n}\n// A mark desc represents a mark. May have multiple children,\n// depending on how the mark is split. Note that marks are drawn using\n// a fixed nesting order, for simplicity and predictability, so in\n// some cases they will be split more often than would appear\n// necessary.\nclass MarkViewDesc extends ViewDesc {\n constructor(parent, mark, dom, contentDOM, spec) {\n super(parent, [], dom, contentDOM);\n this.mark = mark;\n this.spec = spec;\n }\n static create(parent, mark, inline, view) {\n let custom = view.nodeViews[mark.type.name];\n let spec = custom && custom(mark, view, inline);\n if (!spec || !spec.dom) spec = DOMSerializer.renderSpec(document, mark.type.spec.toDOM(mark, inline), null, mark.attrs);\n return new MarkViewDesc(parent, mark, spec.dom, spec.contentDOM || spec.dom, spec);\n }\n parseRule() {\n if (this.dirty & NODE_DIRTY || this.mark.type.spec.reparseInView) return null;\n return {\n mark: this.mark.type.name,\n attrs: this.mark.attrs,\n contentElement: this.contentDOM\n };\n }\n matchesMark(mark) {\n return this.dirty != NODE_DIRTY && this.mark.eq(mark);\n }\n markDirty(from, to) {\n super.markDirty(from, to);\n // Move dirty info to nearest node view\n if (this.dirty != NOT_DIRTY) {\n let parent = this.parent;\n while (!parent.node) parent = parent.parent;\n if (parent.dirty < this.dirty) parent.dirty = this.dirty;\n this.dirty = NOT_DIRTY;\n }\n }\n slice(from, to, view) {\n let copy = MarkViewDesc.create(this.parent, this.mark, true, view);\n let nodes = this.children,\n size = this.size;\n if (to < size) nodes = replaceNodes(nodes, to, size, view);\n if (from > 0) nodes = replaceNodes(nodes, 0, from, view);\n for (let i = 0; i < nodes.length; i++) nodes[i].parent = copy;\n copy.children = nodes;\n return copy;\n }\n ignoreMutation(mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n }\n destroy() {\n if (this.spec.destroy) this.spec.destroy();\n super.destroy();\n }\n}\n// Node view descs are the main, most common type of view desc, and\n// correspond to an actual node in the document. Unlike mark descs,\n// they populate their child array themselves.\nclass NodeViewDesc extends ViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos) {\n super(parent, [], dom, contentDOM);\n this.node = node;\n this.outerDeco = outerDeco;\n this.innerDeco = innerDeco;\n this.nodeDOM = nodeDOM;\n }\n // By default, a node is rendered using the `toDOM` method from the\n // node type spec. But client code can use the `nodeViews` spec to\n // supply a custom node view, which can influence various aspects of\n // the way the node works.\n //\n // (Using subclassing for this was intentionally decided against,\n // since it'd require exposing a whole slew of finicky\n // implementation details to the user code that they probably will\n // never need.)\n static create(parent, node, outerDeco, innerDeco, view, pos) {\n let custom = view.nodeViews[node.type.name],\n descObj;\n let spec = custom && custom(node, view, () => {\n // (This is a function that allows the custom view to find its\n // own position)\n if (!descObj) return pos;\n if (descObj.parent) return descObj.parent.posBeforeChild(descObj);\n }, outerDeco, innerDeco);\n let dom = spec && spec.dom,\n contentDOM = spec && spec.contentDOM;\n if (node.isText) {\n if (!dom) dom = document.createTextNode(node.text);else if (dom.nodeType != 3) throw new RangeError(\"Text must be rendered as a DOM text node\");\n } else if (!dom) {\n let spec = DOMSerializer.renderSpec(document, node.type.spec.toDOM(node), null, node.attrs);\n ({\n dom,\n contentDOM\n } = spec);\n }\n if (!contentDOM && !node.isText && dom.nodeName != \"BR\") {\n // Chrome gets confused by
      \n if (!dom.hasAttribute(\"contenteditable\")) dom.contentEditable = \"false\";\n if (node.type.spec.draggable) dom.draggable = true;\n }\n let nodeDOM = dom;\n dom = applyOuterDeco(dom, outerDeco, node);\n if (spec) return descObj = new CustomNodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, spec, view, pos + 1);else if (node.isText) return new TextViewDesc(parent, node, outerDeco, innerDeco, dom, nodeDOM, view);else return new NodeViewDesc(parent, node, outerDeco, innerDeco, dom, contentDOM || null, nodeDOM, view, pos + 1);\n }\n parseRule() {\n // Experimental kludge to allow opt-in re-parsing of nodes\n if (this.node.type.spec.reparseInView) return null;\n // FIXME the assumption that this can always return the current\n // attrs means that if the user somehow manages to change the\n // attrs in the dom, that won't be picked up. Not entirely sure\n // whether this is a problem\n let rule = {\n node: this.node.type.name,\n attrs: this.node.attrs\n };\n if (this.node.type.whitespace == \"pre\") rule.preserveWhitespace = \"full\";\n if (!this.contentDOM) {\n rule.getContent = () => this.node.content;\n } else if (!this.contentLost) {\n rule.contentElement = this.contentDOM;\n } else {\n // Chrome likes to randomly recreate parent nodes when\n // backspacing things. When that happens, this tries to find the\n // new parent.\n for (let i = this.children.length - 1; i >= 0; i--) {\n let child = this.children[i];\n if (this.dom.contains(child.dom.parentNode)) {\n rule.contentElement = child.dom.parentNode;\n break;\n }\n }\n if (!rule.contentElement) rule.getContent = () => Fragment.empty;\n }\n return rule;\n }\n matchesNode(node, outerDeco, innerDeco) {\n return this.dirty == NOT_DIRTY && node.eq(this.node) && sameOuterDeco(outerDeco, this.outerDeco) && innerDeco.eq(this.innerDeco);\n }\n get size() {\n return this.node.nodeSize;\n }\n get border() {\n return this.node.isLeaf ? 0 : 1;\n }\n // Syncs `this.children` to match `this.node.content` and the local\n // decorations, possibly introducing nesting for marks. Then, in a\n // separate step, syncs the DOM inside `this.contentDOM` to\n // `this.children`.\n updateChildren(view, pos) {\n let inline = this.node.inlineContent,\n off = pos;\n let composition = view.composing ? this.localCompositionInfo(view, pos) : null;\n let localComposition = composition && composition.pos > -1 ? composition : null;\n let compositionInChild = composition && composition.pos < 0;\n let updater = new ViewTreeUpdater(this, localComposition && localComposition.node, view);\n iterDeco(this.node, this.innerDeco, (widget, i, insideNode) => {\n if (widget.spec.marks) updater.syncToMarks(widget.spec.marks, inline, view);else if (widget.type.side >= 0 && !insideNode) updater.syncToMarks(i == this.node.childCount ? Mark.none : this.node.child(i).marks, inline, view);\n // If the next node is a desc matching this widget, reuse it,\n // otherwise insert the widget as a new view desc.\n updater.placeWidget(widget, view, off);\n }, (child, outerDeco, innerDeco, i) => {\n // Make sure the wrapping mark descs match the node's marks.\n updater.syncToMarks(child.marks, inline, view);\n // Try several strategies for drawing this node\n let compIndex;\n if (updater.findNodeMatch(child, outerDeco, innerDeco, i)) ;else if (compositionInChild && view.state.selection.from > off && view.state.selection.to < off + child.nodeSize && (compIndex = updater.findIndexWithChild(composition.node)) > -1 && updater.updateNodeAt(child, outerDeco, innerDeco, compIndex, view)) ;else if (updater.updateNextNode(child, outerDeco, innerDeco, view, i, off)) ;else {\n // Add it as a new view\n updater.addNode(child, outerDeco, innerDeco, view, off);\n }\n off += child.nodeSize;\n });\n // Drop all remaining descs after the current position.\n updater.syncToMarks([], inline, view);\n if (this.node.isTextblock) updater.addTextblockHacks();\n updater.destroyRest();\n // Sync the DOM if anything changed\n if (updater.changed || this.dirty == CONTENT_DIRTY) {\n // May have to protect focused DOM from being changed if a composition is active\n if (localComposition) this.protectLocalComposition(view, localComposition);\n renderDescs(this.contentDOM, this.children, view);\n if (ios) iosHacks(this.dom);\n }\n }\n localCompositionInfo(view, pos) {\n // Only do something if both the selection and a focused text node\n // are inside of this node\n let {\n from,\n to\n } = view.state.selection;\n if (!(view.state.selection instanceof TextSelection) || from < pos || to > pos + this.node.content.size) return null;\n let textNode = view.input.compositionNode;\n if (!textNode || !this.dom.contains(textNode.parentNode)) return null;\n if (this.node.inlineContent) {\n // Find the text in the focused node in the node, stop if it's not\n // there (may have been modified through other means, in which\n // case it should overwritten)\n let text = textNode.nodeValue;\n let textPos = findTextInFragment(this.node.content, text, from - pos, to - pos);\n return textPos < 0 ? null : {\n node: textNode,\n pos: textPos,\n text\n };\n } else {\n return {\n node: textNode,\n pos: -1,\n text: \"\"\n };\n }\n }\n protectLocalComposition(view, {\n node,\n pos,\n text\n }) {\n // The node is already part of a local view desc, leave it there\n if (this.getDesc(node)) return;\n // Create a composition view for the orphaned nodes\n let topNode = node;\n for (;; topNode = topNode.parentNode) {\n if (topNode.parentNode == this.contentDOM) break;\n while (topNode.previousSibling) topNode.parentNode.removeChild(topNode.previousSibling);\n while (topNode.nextSibling) topNode.parentNode.removeChild(topNode.nextSibling);\n if (topNode.pmViewDesc) topNode.pmViewDesc = undefined;\n }\n let desc = new CompositionViewDesc(this, topNode, node, text);\n view.input.compositionNodes.push(desc);\n // Patch up this.children to contain the composition view\n this.children = replaceNodes(this.children, pos, pos + text.length, view, desc);\n }\n // If this desc must be updated to match the given node decoration,\n // do so and return true.\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY || !node.sameMarkup(this.node)) return false;\n this.updateInner(node, outerDeco, innerDeco, view);\n return true;\n }\n updateInner(node, outerDeco, innerDeco, view) {\n this.updateOuterDeco(outerDeco);\n this.node = node;\n this.innerDeco = innerDeco;\n if (this.contentDOM) this.updateChildren(view, this.posAtStart);\n this.dirty = NOT_DIRTY;\n }\n updateOuterDeco(outerDeco) {\n if (sameOuterDeco(outerDeco, this.outerDeco)) return;\n let needsWrap = this.nodeDOM.nodeType != 1;\n let oldDOM = this.dom;\n this.dom = patchOuterDeco(this.dom, this.nodeDOM, computeOuterDeco(this.outerDeco, this.node, needsWrap), computeOuterDeco(outerDeco, this.node, needsWrap));\n if (this.dom != oldDOM) {\n oldDOM.pmViewDesc = undefined;\n this.dom.pmViewDesc = this;\n }\n this.outerDeco = outerDeco;\n }\n // Mark this node as being the selected node.\n selectNode() {\n if (this.nodeDOM.nodeType == 1) this.nodeDOM.classList.add(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) this.dom.draggable = true;\n }\n // Remove selected node marking from this node.\n deselectNode() {\n if (this.nodeDOM.nodeType == 1) {\n this.nodeDOM.classList.remove(\"ProseMirror-selectednode\");\n if (this.contentDOM || !this.node.type.spec.draggable) this.dom.removeAttribute(\"draggable\");\n }\n }\n get domAtom() {\n return this.node.isAtom;\n }\n}\n// Create a view desc for the top-level document node, to be exported\n// and used by the view class.\nfunction docViewDesc(doc, outerDeco, innerDeco, dom, view) {\n applyOuterDeco(dom, outerDeco, doc);\n let docView = new NodeViewDesc(undefined, doc, outerDeco, innerDeco, dom, dom, dom, view, 0);\n if (docView.contentDOM) docView.updateChildren(view, 0);\n return docView;\n}\nclass TextViewDesc extends NodeViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, nodeDOM, view) {\n super(parent, node, outerDeco, innerDeco, dom, null, nodeDOM, view, 0);\n }\n parseRule() {\n let skip = this.nodeDOM.parentNode;\n while (skip && skip != this.dom && !skip.pmIsDeco) skip = skip.parentNode;\n return {\n skip: skip || true\n };\n }\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY || this.dirty != NOT_DIRTY && !this.inParent() || !node.sameMarkup(this.node)) return false;\n this.updateOuterDeco(outerDeco);\n if ((this.dirty != NOT_DIRTY || node.text != this.node.text) && node.text != this.nodeDOM.nodeValue) {\n this.nodeDOM.nodeValue = node.text;\n if (view.trackWrites == this.nodeDOM) view.trackWrites = null;\n }\n this.node = node;\n this.dirty = NOT_DIRTY;\n return true;\n }\n inParent() {\n let parentDOM = this.parent.contentDOM;\n for (let n = this.nodeDOM; n; n = n.parentNode) if (n == parentDOM) return true;\n return false;\n }\n domFromPos(pos) {\n return {\n node: this.nodeDOM,\n offset: pos\n };\n }\n localPosFromDOM(dom, offset, bias) {\n if (dom == this.nodeDOM) return this.posAtStart + Math.min(offset, this.node.text.length);\n return super.localPosFromDOM(dom, offset, bias);\n }\n ignoreMutation(mutation) {\n return mutation.type != \"characterData\" && mutation.type != \"selection\";\n }\n slice(from, to, view) {\n let node = this.node.cut(from, to),\n dom = document.createTextNode(node.text);\n return new TextViewDesc(this.parent, node, this.outerDeco, this.innerDeco, dom, dom, view);\n }\n markDirty(from, to) {\n super.markDirty(from, to);\n if (this.dom != this.nodeDOM && (from == 0 || to == this.nodeDOM.nodeValue.length)) this.dirty = NODE_DIRTY;\n }\n get domAtom() {\n return false;\n }\n isText(text) {\n return this.node.text == text;\n }\n}\n// A dummy desc used to tag trailing BR or IMG nodes created to work\n// around contentEditable terribleness.\nclass TrailingHackViewDesc extends ViewDesc {\n parseRule() {\n return {\n ignore: true\n };\n }\n matchesHack(nodeName) {\n return this.dirty == NOT_DIRTY && this.dom.nodeName == nodeName;\n }\n get domAtom() {\n return true;\n }\n get ignoreForCoords() {\n return this.dom.nodeName == \"IMG\";\n }\n}\n// A separate subclass is used for customized node views, so that the\n// extra checks only have to be made for nodes that are actually\n// customized.\nclass CustomNodeViewDesc extends NodeViewDesc {\n constructor(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, spec, view, pos) {\n super(parent, node, outerDeco, innerDeco, dom, contentDOM, nodeDOM, view, pos);\n this.spec = spec;\n }\n // A custom `update` method gets to decide whether the update goes\n // through. If it does, and there's a `contentDOM` node, our logic\n // updates the children.\n update(node, outerDeco, innerDeco, view) {\n if (this.dirty == NODE_DIRTY) return false;\n if (this.spec.update && (this.node.type == node.type || this.spec.multiType)) {\n let result = this.spec.update(node, outerDeco, innerDeco);\n if (result) this.updateInner(node, outerDeco, innerDeco, view);\n return result;\n } else if (!this.contentDOM && !node.isLeaf) {\n return false;\n } else {\n return super.update(node, outerDeco, innerDeco, view);\n }\n }\n selectNode() {\n this.spec.selectNode ? this.spec.selectNode() : super.selectNode();\n }\n deselectNode() {\n this.spec.deselectNode ? this.spec.deselectNode() : super.deselectNode();\n }\n setSelection(anchor, head, view, force) {\n this.spec.setSelection ? this.spec.setSelection(anchor, head, view.root) : super.setSelection(anchor, head, view, force);\n }\n destroy() {\n if (this.spec.destroy) this.spec.destroy();\n super.destroy();\n }\n stopEvent(event) {\n return this.spec.stopEvent ? this.spec.stopEvent(event) : false;\n }\n ignoreMutation(mutation) {\n return this.spec.ignoreMutation ? this.spec.ignoreMutation(mutation) : super.ignoreMutation(mutation);\n }\n}\n// Sync the content of the given DOM node with the nodes associated\n// with the given array of view descs, recursing into mark descs\n// because this should sync the subtree for a whole node at a time.\nfunction renderDescs(parentDOM, descs, view) {\n let dom = parentDOM.firstChild,\n written = false;\n for (let i = 0; i < descs.length; i++) {\n let desc = descs[i],\n childDOM = desc.dom;\n if (childDOM.parentNode == parentDOM) {\n while (childDOM != dom) {\n dom = rm(dom);\n written = true;\n }\n dom = dom.nextSibling;\n } else {\n written = true;\n parentDOM.insertBefore(childDOM, dom);\n }\n if (desc instanceof MarkViewDesc) {\n let pos = dom ? dom.previousSibling : parentDOM.lastChild;\n renderDescs(desc.contentDOM, desc.children, view);\n dom = pos ? pos.nextSibling : parentDOM.firstChild;\n }\n }\n while (dom) {\n dom = rm(dom);\n written = true;\n }\n if (written && view.trackWrites == parentDOM) view.trackWrites = null;\n}\nconst OuterDecoLevel = function (nodeName) {\n if (nodeName) this.nodeName = nodeName;\n};\nOuterDecoLevel.prototype = Object.create(null);\nconst noDeco = [new OuterDecoLevel()];\nfunction computeOuterDeco(outerDeco, node, needsWrap) {\n if (outerDeco.length == 0) return noDeco;\n let top = needsWrap ? noDeco[0] : new OuterDecoLevel(),\n result = [top];\n for (let i = 0; i < outerDeco.length; i++) {\n let attrs = outerDeco[i].type.attrs;\n if (!attrs) continue;\n if (attrs.nodeName) result.push(top = new OuterDecoLevel(attrs.nodeName));\n for (let name in attrs) {\n let val = attrs[name];\n if (val == null) continue;\n if (needsWrap && result.length == 1) result.push(top = new OuterDecoLevel(node.isInline ? \"span\" : \"div\"));\n if (name == \"class\") top.class = (top.class ? top.class + \" \" : \"\") + val;else if (name == \"style\") top.style = (top.style ? top.style + \";\" : \"\") + val;else if (name != \"nodeName\") top[name] = val;\n }\n }\n return result;\n}\nfunction patchOuterDeco(outerDOM, nodeDOM, prevComputed, curComputed) {\n // Shortcut for trivial case\n if (prevComputed == noDeco && curComputed == noDeco) return nodeDOM;\n let curDOM = nodeDOM;\n for (let i = 0; i < curComputed.length; i++) {\n let deco = curComputed[i],\n prev = prevComputed[i];\n if (i) {\n let parent;\n if (prev && prev.nodeName == deco.nodeName && curDOM != outerDOM && (parent = curDOM.parentNode) && parent.nodeName.toLowerCase() == deco.nodeName) {\n curDOM = parent;\n } else {\n parent = document.createElement(deco.nodeName);\n parent.pmIsDeco = true;\n parent.appendChild(curDOM);\n prev = noDeco[0];\n curDOM = parent;\n }\n }\n patchAttributes(curDOM, prev || noDeco[0], deco);\n }\n return curDOM;\n}\nfunction patchAttributes(dom, prev, cur) {\n for (let name in prev) if (name != \"class\" && name != \"style\" && name != \"nodeName\" && !(name in cur)) dom.removeAttribute(name);\n for (let name in cur) if (name != \"class\" && name != \"style\" && name != \"nodeName\" && cur[name] != prev[name]) dom.setAttribute(name, cur[name]);\n if (prev.class != cur.class) {\n let prevList = prev.class ? prev.class.split(\" \").filter(Boolean) : [];\n let curList = cur.class ? cur.class.split(\" \").filter(Boolean) : [];\n for (let i = 0; i < prevList.length; i++) if (curList.indexOf(prevList[i]) == -1) dom.classList.remove(prevList[i]);\n for (let i = 0; i < curList.length; i++) if (prevList.indexOf(curList[i]) == -1) dom.classList.add(curList[i]);\n if (dom.classList.length == 0) dom.removeAttribute(\"class\");\n }\n if (prev.style != cur.style) {\n if (prev.style) {\n let prop = /\\s*([\\w\\-\\xa1-\\uffff]+)\\s*:(?:\"(?:\\\\.|[^\"])*\"|'(?:\\\\.|[^'])*'|\\(.*?\\)|[^;])*/g,\n m;\n while (m = prop.exec(prev.style)) dom.style.removeProperty(m[1]);\n }\n if (cur.style) dom.style.cssText += cur.style;\n }\n}\nfunction applyOuterDeco(dom, deco, node) {\n return patchOuterDeco(dom, dom, noDeco, computeOuterDeco(deco, node, dom.nodeType != 1));\n}\nfunction sameOuterDeco(a, b) {\n if (a.length != b.length) return false;\n for (let i = 0; i < a.length; i++) if (!a[i].type.eq(b[i].type)) return false;\n return true;\n}\n// Remove a DOM node and return its next sibling.\nfunction rm(dom) {\n let next = dom.nextSibling;\n dom.parentNode.removeChild(dom);\n return next;\n}\n// Helper class for incrementally updating a tree of mark descs and\n// the widget and node descs inside of them.\nclass ViewTreeUpdater {\n constructor(top, lock, view) {\n this.lock = lock;\n this.view = view;\n // Index into `this.top`'s child array, represents the current\n // update position.\n this.index = 0;\n // When entering a mark, the current top and index are pushed\n // onto this.\n this.stack = [];\n // Tracks whether anything was changed\n this.changed = false;\n this.top = top;\n this.preMatch = preMatch(top.node.content, top);\n }\n // Destroy and remove the children between the given indices in\n // `this.top`.\n destroyBetween(start, end) {\n if (start == end) return;\n for (let i = start; i < end; i++) this.top.children[i].destroy();\n this.top.children.splice(start, end - start);\n this.changed = true;\n }\n // Destroy all remaining children in `this.top`.\n destroyRest() {\n this.destroyBetween(this.index, this.top.children.length);\n }\n // Sync the current stack of mark descs with the given array of\n // marks, reusing existing mark descs when possible.\n syncToMarks(marks, inline, view) {\n let keep = 0,\n depth = this.stack.length >> 1;\n let maxKeep = Math.min(depth, marks.length);\n while (keep < maxKeep && (keep == depth - 1 ? this.top : this.stack[keep + 1 << 1]).matchesMark(marks[keep]) && marks[keep].type.spec.spanning !== false) keep++;\n while (keep < depth) {\n this.destroyRest();\n this.top.dirty = NOT_DIRTY;\n this.index = this.stack.pop();\n this.top = this.stack.pop();\n depth--;\n }\n while (depth < marks.length) {\n this.stack.push(this.top, this.index + 1);\n let found = -1;\n for (let i = this.index; i < Math.min(this.index + 3, this.top.children.length); i++) {\n let next = this.top.children[i];\n if (next.matchesMark(marks[depth]) && !this.isLocked(next.dom)) {\n found = i;\n break;\n }\n }\n if (found > -1) {\n if (found > this.index) {\n this.changed = true;\n this.destroyBetween(this.index, found);\n }\n this.top = this.top.children[this.index];\n } else {\n let markDesc = MarkViewDesc.create(this.top, marks[depth], inline, view);\n this.top.children.splice(this.index, 0, markDesc);\n this.top = markDesc;\n this.changed = true;\n }\n this.index = 0;\n depth++;\n }\n }\n // Try to find a node desc matching the given data. Skip over it and\n // return true when successful.\n findNodeMatch(node, outerDeco, innerDeco, index) {\n let found = -1,\n targetDesc;\n if (index >= this.preMatch.index && (targetDesc = this.preMatch.matches[index - this.preMatch.index]).parent == this.top && targetDesc.matchesNode(node, outerDeco, innerDeco)) {\n found = this.top.children.indexOf(targetDesc, this.index);\n } else {\n for (let i = this.index, e = Math.min(this.top.children.length, i + 5); i < e; i++) {\n let child = this.top.children[i];\n if (child.matchesNode(node, outerDeco, innerDeco) && !this.preMatch.matched.has(child)) {\n found = i;\n break;\n }\n }\n }\n if (found < 0) return false;\n this.destroyBetween(this.index, found);\n this.index++;\n return true;\n }\n updateNodeAt(node, outerDeco, innerDeco, index, view) {\n let child = this.top.children[index];\n if (child.dirty == NODE_DIRTY && child.dom == child.contentDOM) child.dirty = CONTENT_DIRTY;\n if (!child.update(node, outerDeco, innerDeco, view)) return false;\n this.destroyBetween(this.index, index);\n this.index++;\n return true;\n }\n findIndexWithChild(domNode) {\n for (;;) {\n let parent = domNode.parentNode;\n if (!parent) return -1;\n if (parent == this.top.contentDOM) {\n let desc = domNode.pmViewDesc;\n if (desc) for (let i = this.index; i < this.top.children.length; i++) {\n if (this.top.children[i] == desc) return i;\n }\n return -1;\n }\n domNode = parent;\n }\n }\n // Try to update the next node, if any, to the given data. Checks\n // pre-matches to avoid overwriting nodes that could still be used.\n updateNextNode(node, outerDeco, innerDeco, view, index, pos) {\n for (let i = this.index; i < this.top.children.length; i++) {\n let next = this.top.children[i];\n if (next instanceof NodeViewDesc) {\n let preMatch = this.preMatch.matched.get(next);\n if (preMatch != null && preMatch != index) return false;\n let nextDOM = next.dom,\n updated;\n // Can't update if nextDOM is or contains this.lock, except if\n // it's a text node whose content already matches the new text\n // and whose decorations match the new ones.\n let locked = this.isLocked(nextDOM) && !(node.isText && next.node && next.node.isText && next.nodeDOM.nodeValue == node.text && next.dirty != NODE_DIRTY && sameOuterDeco(outerDeco, next.outerDeco));\n if (!locked && next.update(node, outerDeco, innerDeco, view)) {\n this.destroyBetween(this.index, i);\n if (next.dom != nextDOM) this.changed = true;\n this.index++;\n return true;\n } else if (!locked && (updated = this.recreateWrapper(next, node, outerDeco, innerDeco, view, pos))) {\n this.destroyBetween(this.index, i);\n this.top.children[this.index] = updated;\n if (updated.contentDOM) {\n updated.dirty = CONTENT_DIRTY;\n updated.updateChildren(view, pos + 1);\n updated.dirty = NOT_DIRTY;\n }\n this.changed = true;\n this.index++;\n return true;\n }\n break;\n }\n }\n return false;\n }\n // When a node with content is replaced by a different node with\n // identical content, move over its children.\n recreateWrapper(next, node, outerDeco, innerDeco, view, pos) {\n if (next.dirty || node.isAtom || !next.children.length || !next.node.content.eq(node.content) || !sameOuterDeco(outerDeco, next.outerDeco) || !innerDeco.eq(next.innerDeco)) return null;\n let wrapper = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n if (wrapper.contentDOM) {\n wrapper.children = next.children;\n next.children = [];\n for (let ch of wrapper.children) ch.parent = wrapper;\n }\n next.destroy();\n return wrapper;\n }\n // Insert the node as a newly created node desc.\n addNode(node, outerDeco, innerDeco, view, pos) {\n let desc = NodeViewDesc.create(this.top, node, outerDeco, innerDeco, view, pos);\n if (desc.contentDOM) desc.updateChildren(view, pos + 1);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n placeWidget(widget, view, pos) {\n let next = this.index < this.top.children.length ? this.top.children[this.index] : null;\n if (next && next.matchesWidget(widget) && (widget == next.widget || !next.widget.type.toDOM.parentNode)) {\n this.index++;\n } else {\n let desc = new WidgetViewDesc(this.top, widget, view, pos);\n this.top.children.splice(this.index++, 0, desc);\n this.changed = true;\n }\n }\n // Make sure a textblock looks and behaves correctly in\n // contentEditable.\n addTextblockHacks() {\n let lastChild = this.top.children[this.index - 1],\n parent = this.top;\n while (lastChild instanceof MarkViewDesc) {\n parent = lastChild;\n lastChild = parent.children[parent.children.length - 1];\n }\n if (!lastChild ||\n // Empty textblock\n !(lastChild instanceof TextViewDesc) || /\\n$/.test(lastChild.node.text) || this.view.requiresGeckoHackNode && /\\s$/.test(lastChild.node.text)) {\n // Avoid bugs in Safari's cursor drawing (#1165) and Chrome's mouse selection (#1152)\n if ((safari || chrome) && lastChild && lastChild.dom.contentEditable == \"false\") this.addHackNode(\"IMG\", parent);\n this.addHackNode(\"BR\", this.top);\n }\n }\n addHackNode(nodeName, parent) {\n if (parent == this.top && this.index < parent.children.length && parent.children[this.index].matchesHack(nodeName)) {\n this.index++;\n } else {\n let dom = document.createElement(nodeName);\n if (nodeName == \"IMG\") {\n dom.className = \"ProseMirror-separator\";\n dom.alt = \"\";\n }\n if (nodeName == \"BR\") dom.className = \"ProseMirror-trailingBreak\";\n let hack = new TrailingHackViewDesc(this.top, [], dom, null);\n if (parent != this.top) parent.children.push(hack);else parent.children.splice(this.index++, 0, hack);\n this.changed = true;\n }\n }\n isLocked(node) {\n return this.lock && (node == this.lock || node.nodeType == 1 && node.contains(this.lock.parentNode));\n }\n}\n// Iterate from the end of the fragment and array of descs to find\n// directly matching ones, in order to avoid overeagerly reusing those\n// for other nodes. Returns the fragment index of the first node that\n// is part of the sequence of matched nodes at the end of the\n// fragment.\nfunction preMatch(frag, parentDesc) {\n let curDesc = parentDesc,\n descI = curDesc.children.length;\n let fI = frag.childCount,\n matched = new Map(),\n matches = [];\n outer: while (fI > 0) {\n let desc;\n for (;;) {\n if (descI) {\n let next = curDesc.children[descI - 1];\n if (next instanceof MarkViewDesc) {\n curDesc = next;\n descI = next.children.length;\n } else {\n desc = next;\n descI--;\n break;\n }\n } else if (curDesc == parentDesc) {\n break outer;\n } else {\n // FIXME\n descI = curDesc.parent.children.indexOf(curDesc);\n curDesc = curDesc.parent;\n }\n }\n let node = desc.node;\n if (!node) continue;\n if (node != frag.child(fI - 1)) break;\n --fI;\n matched.set(desc, fI);\n matches.push(desc);\n }\n return {\n index: fI,\n matched,\n matches: matches.reverse()\n };\n}\nfunction compareSide(a, b) {\n return a.type.side - b.type.side;\n}\n// This function abstracts iterating over the nodes and decorations in\n// a fragment. Calls `onNode` for each node, with its local and child\n// decorations. Splits text nodes when there is a decoration starting\n// or ending inside of them. Calls `onWidget` for each widget.\nfunction iterDeco(parent, deco, onWidget, onNode) {\n let locals = deco.locals(parent),\n offset = 0;\n // Simple, cheap variant for when there are no local decorations\n if (locals.length == 0) {\n for (let i = 0; i < parent.childCount; i++) {\n let child = parent.child(i);\n onNode(child, locals, deco.forChild(offset, child), i);\n offset += child.nodeSize;\n }\n return;\n }\n let decoIndex = 0,\n active = [],\n restNode = null;\n for (let parentIndex = 0;;) {\n let widget, widgets;\n while (decoIndex < locals.length && locals[decoIndex].to == offset) {\n let next = locals[decoIndex++];\n if (next.widget) {\n if (!widget) widget = next;else (widgets || (widgets = [widget])).push(next);\n }\n }\n if (widget) {\n if (widgets) {\n widgets.sort(compareSide);\n for (let i = 0; i < widgets.length; i++) onWidget(widgets[i], parentIndex, !!restNode);\n } else {\n onWidget(widget, parentIndex, !!restNode);\n }\n }\n let child, index;\n if (restNode) {\n index = -1;\n child = restNode;\n restNode = null;\n } else if (parentIndex < parent.childCount) {\n index = parentIndex;\n child = parent.child(parentIndex++);\n } else {\n break;\n }\n for (let i = 0; i < active.length; i++) if (active[i].to <= offset) active.splice(i--, 1);\n while (decoIndex < locals.length && locals[decoIndex].from <= offset && locals[decoIndex].to > offset) active.push(locals[decoIndex++]);\n let end = offset + child.nodeSize;\n if (child.isText) {\n let cutAt = end;\n if (decoIndex < locals.length && locals[decoIndex].from < cutAt) cutAt = locals[decoIndex].from;\n for (let i = 0; i < active.length; i++) if (active[i].to < cutAt) cutAt = active[i].to;\n if (cutAt < end) {\n restNode = child.cut(cutAt - offset);\n child = child.cut(0, cutAt - offset);\n end = cutAt;\n index = -1;\n }\n } else {\n while (decoIndex < locals.length && locals[decoIndex].to < end) decoIndex++;\n }\n let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice();\n onNode(child, outerDeco, deco.forChild(offset, child), index);\n offset = end;\n }\n}\n// List markers in Mobile Safari will mysteriously disappear\n// sometimes. This works around that.\nfunction iosHacks(dom) {\n if (dom.nodeName == \"UL\" || dom.nodeName == \"OL\") {\n let oldCSS = dom.style.cssText;\n dom.style.cssText = oldCSS + \"; list-style: square !important\";\n window.getComputedStyle(dom).listStyle;\n dom.style.cssText = oldCSS;\n }\n}\n// Find a piece of text in an inline fragment, overlapping from-to\nfunction findTextInFragment(frag, text, from, to) {\n for (let i = 0, pos = 0; i < frag.childCount && pos <= to;) {\n let child = frag.child(i++),\n childStart = pos;\n pos += child.nodeSize;\n if (!child.isText) continue;\n let str = child.text;\n while (i < frag.childCount) {\n let next = frag.child(i++);\n pos += next.nodeSize;\n if (!next.isText) break;\n str += next.text;\n }\n if (pos >= from) {\n if (pos >= to && str.slice(to - text.length - childStart, to - childStart) == text) return to - text.length;\n let found = childStart < to ? str.lastIndexOf(text, to - childStart - 1) : -1;\n if (found >= 0 && found + text.length + childStart >= from) return childStart + found;\n if (from == to && str.length >= to + text.length - childStart && str.slice(to - childStart, to - childStart + text.length) == text) return to;\n }\n }\n return -1;\n}\n// Replace range from-to in an array of view descs with replacement\n// (may be null to just delete). This goes very much against the grain\n// of the rest of this code, which tends to create nodes with the\n// right shape in one go, rather than messing with them after\n// creation, but is necessary in the composition hack.\nfunction replaceNodes(nodes, from, to, view, replacement) {\n let result = [];\n for (let i = 0, off = 0; i < nodes.length; i++) {\n let child = nodes[i],\n start = off,\n end = off += child.size;\n if (start >= to || end <= from) {\n result.push(child);\n } else {\n if (start < from) result.push(child.slice(0, from - start, view));\n if (replacement) {\n result.push(replacement);\n replacement = undefined;\n }\n if (end > to) result.push(child.slice(to - start, child.size, view));\n }\n }\n return result;\n}\nfunction selectionFromDOM(view, origin = null) {\n let domSel = view.domSelectionRange(),\n doc = view.state.doc;\n if (!domSel.focusNode) return null;\n let nearestDesc = view.docView.nearestDesc(domSel.focusNode),\n inWidget = nearestDesc && nearestDesc.size == 0;\n let head = view.docView.posFromDOM(domSel.focusNode, domSel.focusOffset, 1);\n if (head < 0) return null;\n let $head = doc.resolve(head),\n anchor,\n selection;\n if (selectionCollapsed(domSel)) {\n anchor = head;\n while (nearestDesc && !nearestDesc.node) nearestDesc = nearestDesc.parent;\n let nearestDescNode = nearestDesc.node;\n if (nearestDesc && nearestDescNode.isAtom && NodeSelection.isSelectable(nearestDescNode) && nearestDesc.parent && !(nearestDescNode.isInline && isOnEdge(domSel.focusNode, domSel.focusOffset, nearestDesc.dom))) {\n let pos = nearestDesc.posBefore;\n selection = new NodeSelection(head == pos ? $head : doc.resolve(pos));\n }\n } else {\n if (domSel instanceof view.dom.ownerDocument.defaultView.Selection && domSel.rangeCount > 1) {\n let min = head,\n max = head;\n for (let i = 0; i < domSel.rangeCount; i++) {\n let range = domSel.getRangeAt(i);\n min = Math.min(min, view.docView.posFromDOM(range.startContainer, range.startOffset, 1));\n max = Math.max(max, view.docView.posFromDOM(range.endContainer, range.endOffset, -1));\n }\n if (min < 0) return null;\n [anchor, head] = max == view.state.selection.anchor ? [max, min] : [min, max];\n $head = doc.resolve(head);\n } else {\n anchor = view.docView.posFromDOM(domSel.anchorNode, domSel.anchorOffset, 1);\n }\n if (anchor < 0) return null;\n }\n let $anchor = doc.resolve(anchor);\n if (!selection) {\n let bias = origin == \"pointer\" || view.state.selection.head < $head.pos && !inWidget ? 1 : -1;\n selection = selectionBetween(view, $anchor, $head, bias);\n }\n return selection;\n}\nfunction editorOwnsSelection(view) {\n return view.editable ? view.hasFocus() : hasSelection(view) && document.activeElement && document.activeElement.contains(view.dom);\n}\nfunction selectionToDOM(view, force = false) {\n let sel = view.state.selection;\n syncNodeSelection(view, sel);\n if (!editorOwnsSelection(view)) return;\n // The delayed drag selection causes issues with Cell Selections\n // in Safari. And the drag selection delay is to workarond issues\n // which only present in Chrome.\n if (!force && view.input.mouseDown && view.input.mouseDown.allowDefault && chrome) {\n let domSel = view.domSelectionRange(),\n curSel = view.domObserver.currentSelection;\n if (domSel.anchorNode && curSel.anchorNode && isEquivalentPosition(domSel.anchorNode, domSel.anchorOffset, curSel.anchorNode, curSel.anchorOffset)) {\n view.input.mouseDown.delayedSelectionSync = true;\n view.domObserver.setCurSelection();\n return;\n }\n }\n view.domObserver.disconnectSelection();\n if (view.cursorWrapper) {\n selectCursorWrapper(view);\n } else {\n let {\n anchor,\n head\n } = sel,\n resetEditableFrom,\n resetEditableTo;\n if (brokenSelectBetweenUneditable && !(sel instanceof TextSelection)) {\n if (!sel.$from.parent.inlineContent) resetEditableFrom = temporarilyEditableNear(view, sel.from);\n if (!sel.empty && !sel.$from.parent.inlineContent) resetEditableTo = temporarilyEditableNear(view, sel.to);\n }\n view.docView.setSelection(anchor, head, view, force);\n if (brokenSelectBetweenUneditable) {\n if (resetEditableFrom) resetEditable(resetEditableFrom);\n if (resetEditableTo) resetEditable(resetEditableTo);\n }\n if (sel.visible) {\n view.dom.classList.remove(\"ProseMirror-hideselection\");\n } else {\n view.dom.classList.add(\"ProseMirror-hideselection\");\n if (\"onselectionchange\" in document) removeClassOnSelectionChange(view);\n }\n }\n view.domObserver.setCurSelection();\n view.domObserver.connectSelection();\n}\n// Kludge to work around Webkit not allowing a selection to start/end\n// between non-editable block nodes. We briefly make something\n// editable, set the selection, then set it uneditable again.\nconst brokenSelectBetweenUneditable = safari || chrome && chrome_version < 63;\nfunction temporarilyEditableNear(view, pos) {\n let {\n node,\n offset\n } = view.docView.domFromPos(pos, 0);\n let after = offset < node.childNodes.length ? node.childNodes[offset] : null;\n let before = offset ? node.childNodes[offset - 1] : null;\n if (safari && after && after.contentEditable == \"false\") return setEditable(after);\n if ((!after || after.contentEditable == \"false\") && (!before || before.contentEditable == \"false\")) {\n if (after) return setEditable(after);else if (before) return setEditable(before);\n }\n}\nfunction setEditable(element) {\n element.contentEditable = \"true\";\n if (safari && element.draggable) {\n element.draggable = false;\n element.wasDraggable = true;\n }\n return element;\n}\nfunction resetEditable(element) {\n element.contentEditable = \"false\";\n if (element.wasDraggable) {\n element.draggable = true;\n element.wasDraggable = null;\n }\n}\nfunction removeClassOnSelectionChange(view) {\n let doc = view.dom.ownerDocument;\n doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n let domSel = view.domSelectionRange();\n let node = domSel.anchorNode,\n offset = domSel.anchorOffset;\n doc.addEventListener(\"selectionchange\", view.input.hideSelectionGuard = () => {\n if (domSel.anchorNode != node || domSel.anchorOffset != offset) {\n doc.removeEventListener(\"selectionchange\", view.input.hideSelectionGuard);\n setTimeout(() => {\n if (!editorOwnsSelection(view) || view.state.selection.visible) view.dom.classList.remove(\"ProseMirror-hideselection\");\n }, 20);\n }\n });\n}\nfunction selectCursorWrapper(view) {\n let domSel = view.domSelection(),\n range = document.createRange();\n if (!domSel) return;\n let node = view.cursorWrapper.dom,\n img = node.nodeName == \"IMG\";\n if (img) range.setStart(node.parentNode, domIndex(node) + 1);else range.setStart(node, 0);\n range.collapse(true);\n domSel.removeAllRanges();\n domSel.addRange(range);\n // Kludge to kill 'control selection' in IE11 when selecting an\n // invisible cursor wrapper, since that would result in those weird\n // resize handles and a selection that considers the absolutely\n // positioned wrapper, rather than the root editable node, the\n // focused element.\n if (!img && !view.state.selection.visible && ie && ie_version <= 11) {\n node.disabled = true;\n node.disabled = false;\n }\n}\nfunction syncNodeSelection(view, sel) {\n if (sel instanceof NodeSelection) {\n let desc = view.docView.descAt(sel.from);\n if (desc != view.lastSelectedViewDesc) {\n clearNodeSelection(view);\n if (desc) desc.selectNode();\n view.lastSelectedViewDesc = desc;\n }\n } else {\n clearNodeSelection(view);\n }\n}\n// Clear all DOM statefulness of the last node selection.\nfunction clearNodeSelection(view) {\n if (view.lastSelectedViewDesc) {\n if (view.lastSelectedViewDesc.parent) view.lastSelectedViewDesc.deselectNode();\n view.lastSelectedViewDesc = undefined;\n }\n}\nfunction selectionBetween(view, $anchor, $head, bias) {\n return view.someProp(\"createSelectionBetween\", f => f(view, $anchor, $head)) || TextSelection.between($anchor, $head, bias);\n}\nfunction hasFocusAndSelection(view) {\n if (view.editable && !view.hasFocus()) return false;\n return hasSelection(view);\n}\nfunction hasSelection(view) {\n let sel = view.domSelectionRange();\n if (!sel.anchorNode) return false;\n try {\n // Firefox will raise 'permission denied' errors when accessing\n // properties of `sel.anchorNode` when it's in a generated CSS\n // element.\n return view.dom.contains(sel.anchorNode.nodeType == 3 ? sel.anchorNode.parentNode : sel.anchorNode) && (view.editable || view.dom.contains(sel.focusNode.nodeType == 3 ? sel.focusNode.parentNode : sel.focusNode));\n } catch (_) {\n return false;\n }\n}\nfunction anchorInRightPlace(view) {\n let anchorDOM = view.docView.domFromPos(view.state.selection.anchor, 0);\n let domSel = view.domSelectionRange();\n return isEquivalentPosition(anchorDOM.node, anchorDOM.offset, domSel.anchorNode, domSel.anchorOffset);\n}\nfunction moveSelectionBlock(state, dir) {\n let {\n $anchor,\n $head\n } = state.selection;\n let $side = dir > 0 ? $anchor.max($head) : $anchor.min($head);\n let $start = !$side.parent.inlineContent ? $side : $side.depth ? state.doc.resolve(dir > 0 ? $side.after() : $side.before()) : null;\n return $start && Selection.findFrom($start, dir);\n}\nfunction apply(view, sel) {\n view.dispatch(view.state.tr.setSelection(sel).scrollIntoView());\n return true;\n}\nfunction selectHorizontally(view, dir, mods) {\n let sel = view.state.selection;\n if (sel instanceof TextSelection) {\n if (mods.indexOf(\"s\") > -1) {\n let {\n $head\n } = sel,\n node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter;\n if (!node || node.isText || !node.isLeaf) return false;\n let $newHead = view.state.doc.resolve($head.pos + node.nodeSize * (dir < 0 ? -1 : 1));\n return apply(view, new TextSelection(sel.$anchor, $newHead));\n } else if (!sel.empty) {\n return false;\n } else if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) {\n let next = moveSelectionBlock(view.state, dir);\n if (next && next instanceof NodeSelection) return apply(view, next);\n return false;\n } else if (!(mac && mods.indexOf(\"m\") > -1)) {\n let $head = sel.$head,\n node = $head.textOffset ? null : dir < 0 ? $head.nodeBefore : $head.nodeAfter,\n desc;\n if (!node || node.isText) return false;\n let nodePos = dir < 0 ? $head.pos - node.nodeSize : $head.pos;\n if (!(node.isAtom || (desc = view.docView.descAt(nodePos)) && !desc.contentDOM)) return false;\n if (NodeSelection.isSelectable(node)) {\n return apply(view, new NodeSelection(dir < 0 ? view.state.doc.resolve($head.pos - node.nodeSize) : $head));\n } else if (webkit) {\n // Chrome and Safari will introduce extra pointless cursor\n // positions around inline uneditable nodes, so we have to\n // take over and move the cursor past them (#937)\n return apply(view, new TextSelection(view.state.doc.resolve(dir < 0 ? nodePos : nodePos + node.nodeSize)));\n } else {\n return false;\n }\n }\n } else if (sel instanceof NodeSelection && sel.node.isInline) {\n return apply(view, new TextSelection(dir > 0 ? sel.$to : sel.$from));\n } else {\n let next = moveSelectionBlock(view.state, dir);\n if (next) return apply(view, next);\n return false;\n }\n}\nfunction nodeLen(node) {\n return node.nodeType == 3 ? node.nodeValue.length : node.childNodes.length;\n}\nfunction isIgnorable(dom, dir) {\n let desc = dom.pmViewDesc;\n return desc && desc.size == 0 && (dir < 0 || dom.nextSibling || dom.nodeName != \"BR\");\n}\nfunction skipIgnoredNodes(view, dir) {\n return dir < 0 ? skipIgnoredNodesBefore(view) : skipIgnoredNodesAfter(view);\n}\n// Make sure the cursor isn't directly after one or more ignored\n// nodes, which will confuse the browser's cursor motion logic.\nfunction skipIgnoredNodesBefore(view) {\n let sel = view.domSelectionRange();\n let node = sel.focusNode,\n offset = sel.focusOffset;\n if (!node) return;\n let moveNode,\n moveOffset,\n force = false;\n // Gecko will do odd things when the selection is directly in front\n // of a non-editable node, so in that case, move it into the next\n // node if possible. Issue prosemirror/prosemirror#832.\n if (gecko && node.nodeType == 1 && offset < nodeLen(node) && isIgnorable(node.childNodes[offset], -1)) force = true;\n for (;;) {\n if (offset > 0) {\n if (node.nodeType != 1) {\n break;\n } else {\n let before = node.childNodes[offset - 1];\n if (isIgnorable(before, -1)) {\n moveNode = node;\n moveOffset = --offset;\n } else if (before.nodeType == 3) {\n node = before;\n offset = node.nodeValue.length;\n } else break;\n }\n } else if (isBlockNode(node)) {\n break;\n } else {\n let prev = node.previousSibling;\n while (prev && isIgnorable(prev, -1)) {\n moveNode = node.parentNode;\n moveOffset = domIndex(prev);\n prev = prev.previousSibling;\n }\n if (!prev) {\n node = node.parentNode;\n if (node == view.dom) break;\n offset = 0;\n } else {\n node = prev;\n offset = nodeLen(node);\n }\n }\n }\n if (force) setSelFocus(view, node, offset);else if (moveNode) setSelFocus(view, moveNode, moveOffset);\n}\n// Make sure the cursor isn't directly before one or more ignored\n// nodes.\nfunction skipIgnoredNodesAfter(view) {\n let sel = view.domSelectionRange();\n let node = sel.focusNode,\n offset = sel.focusOffset;\n if (!node) return;\n let len = nodeLen(node);\n let moveNode, moveOffset;\n for (;;) {\n if (offset < len) {\n if (node.nodeType != 1) break;\n let after = node.childNodes[offset];\n if (isIgnorable(after, 1)) {\n moveNode = node;\n moveOffset = ++offset;\n } else break;\n } else if (isBlockNode(node)) {\n break;\n } else {\n let next = node.nextSibling;\n while (next && isIgnorable(next, 1)) {\n moveNode = next.parentNode;\n moveOffset = domIndex(next) + 1;\n next = next.nextSibling;\n }\n if (!next) {\n node = node.parentNode;\n if (node == view.dom) break;\n offset = len = 0;\n } else {\n node = next;\n offset = 0;\n len = nodeLen(node);\n }\n }\n }\n if (moveNode) setSelFocus(view, moveNode, moveOffset);\n}\nfunction isBlockNode(dom) {\n let desc = dom.pmViewDesc;\n return desc && desc.node && desc.node.isBlock;\n}\nfunction textNodeAfter(node, offset) {\n while (node && offset == node.childNodes.length && !hasBlockDesc(node)) {\n offset = domIndex(node) + 1;\n node = node.parentNode;\n }\n while (node && offset < node.childNodes.length) {\n let next = node.childNodes[offset];\n if (next.nodeType == 3) return next;\n if (next.nodeType == 1 && next.contentEditable == \"false\") break;\n node = next;\n offset = 0;\n }\n}\nfunction textNodeBefore(node, offset) {\n while (node && !offset && !hasBlockDesc(node)) {\n offset = domIndex(node);\n node = node.parentNode;\n }\n while (node && offset) {\n let next = node.childNodes[offset - 1];\n if (next.nodeType == 3) return next;\n if (next.nodeType == 1 && next.contentEditable == \"false\") break;\n node = next;\n offset = node.childNodes.length;\n }\n}\nfunction setSelFocus(view, node, offset) {\n if (node.nodeType != 3) {\n let before, after;\n if (after = textNodeAfter(node, offset)) {\n node = after;\n offset = 0;\n } else if (before = textNodeBefore(node, offset)) {\n node = before;\n offset = before.nodeValue.length;\n }\n }\n let sel = view.domSelection();\n if (!sel) return;\n if (selectionCollapsed(sel)) {\n let range = document.createRange();\n range.setEnd(node, offset);\n range.setStart(node, offset);\n sel.removeAllRanges();\n sel.addRange(range);\n } else if (sel.extend) {\n sel.extend(node, offset);\n }\n view.domObserver.setCurSelection();\n let {\n state\n } = view;\n // If no state update ends up happening, reset the selection.\n setTimeout(() => {\n if (view.state == state) selectionToDOM(view);\n }, 50);\n}\nfunction findDirection(view, pos) {\n let $pos = view.state.doc.resolve(pos);\n if (!(chrome || windows) && $pos.parent.inlineContent) {\n let coords = view.coordsAtPos(pos);\n if (pos > $pos.start()) {\n let before = view.coordsAtPos(pos - 1);\n let mid = (before.top + before.bottom) / 2;\n if (mid > coords.top && mid < coords.bottom && Math.abs(before.left - coords.left) > 1) return before.left < coords.left ? \"ltr\" : \"rtl\";\n }\n if (pos < $pos.end()) {\n let after = view.coordsAtPos(pos + 1);\n let mid = (after.top + after.bottom) / 2;\n if (mid > coords.top && mid < coords.bottom && Math.abs(after.left - coords.left) > 1) return after.left > coords.left ? \"ltr\" : \"rtl\";\n }\n }\n let computed = getComputedStyle(view.dom).direction;\n return computed == \"rtl\" ? \"rtl\" : \"ltr\";\n}\n// Check whether vertical selection motion would involve node\n// selections. If so, apply it (if not, the result is left to the\n// browser)\nfunction selectVertically(view, dir, mods) {\n let sel = view.state.selection;\n if (sel instanceof TextSelection && !sel.empty || mods.indexOf(\"s\") > -1) return false;\n if (mac && mods.indexOf(\"m\") > -1) return false;\n let {\n $from,\n $to\n } = sel;\n if (!$from.parent.inlineContent || view.endOfTextblock(dir < 0 ? \"up\" : \"down\")) {\n let next = moveSelectionBlock(view.state, dir);\n if (next && next instanceof NodeSelection) return apply(view, next);\n }\n if (!$from.parent.inlineContent) {\n let side = dir < 0 ? $from : $to;\n let beyond = sel instanceof AllSelection ? Selection.near(side, dir) : Selection.findFrom(side, dir);\n return beyond ? apply(view, beyond) : false;\n }\n return false;\n}\nfunction stopNativeHorizontalDelete(view, dir) {\n if (!(view.state.selection instanceof TextSelection)) return true;\n let {\n $head,\n $anchor,\n empty\n } = view.state.selection;\n if (!$head.sameParent($anchor)) return true;\n if (!empty) return false;\n if (view.endOfTextblock(dir > 0 ? \"forward\" : \"backward\")) return true;\n let nextNode = !$head.textOffset && (dir < 0 ? $head.nodeBefore : $head.nodeAfter);\n if (nextNode && !nextNode.isText) {\n let tr = view.state.tr;\n if (dir < 0) tr.delete($head.pos - nextNode.nodeSize, $head.pos);else tr.delete($head.pos, $head.pos + nextNode.nodeSize);\n view.dispatch(tr);\n return true;\n }\n return false;\n}\nfunction switchEditable(view, node, state) {\n view.domObserver.stop();\n node.contentEditable = state;\n view.domObserver.start();\n}\n// Issue #867 / #1090 / https://bugs.chromium.org/p/chromium/issues/detail?id=903821\n// In which Safari (and at some point in the past, Chrome) does really\n// wrong things when the down arrow is pressed when the cursor is\n// directly at the start of a textblock and has an uneditable node\n// after it\nfunction safariDownArrowBug(view) {\n if (!safari || view.state.selection.$head.parentOffset > 0) return false;\n let {\n focusNode,\n focusOffset\n } = view.domSelectionRange();\n if (focusNode && focusNode.nodeType == 1 && focusOffset == 0 && focusNode.firstChild && focusNode.firstChild.contentEditable == \"false\") {\n let child = focusNode.firstChild;\n switchEditable(view, child, \"true\");\n setTimeout(() => switchEditable(view, child, \"false\"), 20);\n }\n return false;\n}\n// A backdrop key mapping used to make sure we always suppress keys\n// that have a dangerous default effect, even if the commands they are\n// bound to return false, and to make sure that cursor-motion keys\n// find a cursor (as opposed to a node selection) when pressed. For\n// cursor-motion keys, the code in the handlers also takes care of\n// block selections.\nfunction getMods(event) {\n let result = \"\";\n if (event.ctrlKey) result += \"c\";\n if (event.metaKey) result += \"m\";\n if (event.altKey) result += \"a\";\n if (event.shiftKey) result += \"s\";\n return result;\n}\nfunction captureKeyDown(view, event) {\n let code = event.keyCode,\n mods = getMods(event);\n if (code == 8 || mac && code == 72 && mods == \"c\") {\n // Backspace, Ctrl-h on Mac\n return stopNativeHorizontalDelete(view, -1) || skipIgnoredNodes(view, -1);\n } else if (code == 46 && !event.shiftKey || mac && code == 68 && mods == \"c\") {\n // Delete, Ctrl-d on Mac\n return stopNativeHorizontalDelete(view, 1) || skipIgnoredNodes(view, 1);\n } else if (code == 13 || code == 27) {\n // Enter, Esc\n return true;\n } else if (code == 37 || mac && code == 66 && mods == \"c\") {\n // Left arrow, Ctrl-b on Mac\n let dir = code == 37 ? findDirection(view, view.state.selection.from) == \"ltr\" ? -1 : 1 : -1;\n return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n } else if (code == 39 || mac && code == 70 && mods == \"c\") {\n // Right arrow, Ctrl-f on Mac\n let dir = code == 39 ? findDirection(view, view.state.selection.from) == \"ltr\" ? 1 : -1 : 1;\n return selectHorizontally(view, dir, mods) || skipIgnoredNodes(view, dir);\n } else if (code == 38 || mac && code == 80 && mods == \"c\") {\n // Up arrow, Ctrl-p on Mac\n return selectVertically(view, -1, mods) || skipIgnoredNodes(view, -1);\n } else if (code == 40 || mac && code == 78 && mods == \"c\") {\n // Down arrow, Ctrl-n on Mac\n return safariDownArrowBug(view) || selectVertically(view, 1, mods) || skipIgnoredNodes(view, 1);\n } else if (mods == (mac ? \"m\" : \"c\") && (code == 66 || code == 73 || code == 89 || code == 90)) {\n // Mod-[biyz]\n return true;\n }\n return false;\n}\nfunction serializeForClipboard(view, slice) {\n view.someProp(\"transformCopied\", f => {\n slice = f(slice, view);\n });\n let context = [],\n {\n content,\n openStart,\n openEnd\n } = slice;\n while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {\n openStart--;\n openEnd--;\n let node = content.firstChild;\n context.push(node.type.name, node.attrs != node.type.defaultAttrs ? node.attrs : null);\n content = node.content;\n }\n let serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema);\n let doc = detachedDoc(),\n wrap = doc.createElement(\"div\");\n wrap.appendChild(serializer.serializeFragment(content, {\n document: doc\n }));\n let firstChild = wrap.firstChild,\n needsWrap,\n wrappers = 0;\n while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n for (let i = needsWrap.length - 1; i >= 0; i--) {\n let wrapper = doc.createElement(needsWrap[i]);\n while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);\n wrap.appendChild(wrapper);\n wrappers++;\n }\n firstChild = wrap.firstChild;\n }\n if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute(\"data-pm-slice\", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : \"\"} ${JSON.stringify(context)}`);\n let text = view.someProp(\"clipboardTextSerializer\", f => f(slice, view)) || slice.content.textBetween(0, slice.content.size, \"\\n\\n\");\n return {\n dom: wrap,\n text,\n slice\n };\n}\n// Read a slice of content from the clipboard (or drop data).\nfunction parseFromClipboard(view, text, html, plainText, $context) {\n let inCode = $context.parent.type.spec.code;\n let dom, slice;\n if (!html && !text) return null;\n let asText = text && (plainText || inCode || !html);\n if (asText) {\n view.someProp(\"transformPastedText\", f => {\n text = f(text, inCode || plainText, view);\n });\n if (inCode) return text ? new Slice(Fragment.from(view.state.schema.text(text.replace(/\\r\\n?/g, \"\\n\"))), 0, 0) : Slice.empty;\n let parsed = view.someProp(\"clipboardTextParser\", f => f(text, $context, plainText, view));\n if (parsed) {\n slice = parsed;\n } else {\n let marks = $context.marks();\n let {\n schema\n } = view.state,\n serializer = DOMSerializer.fromSchema(schema);\n dom = document.createElement(\"div\");\n text.split(/(?:\\r\\n?|\\n)+/).forEach(block => {\n let p = dom.appendChild(document.createElement(\"p\"));\n if (block) p.appendChild(serializer.serializeNode(schema.text(block, marks)));\n });\n }\n } else {\n view.someProp(\"transformPastedHTML\", f => {\n html = f(html, view);\n });\n dom = readHTML(html);\n if (webkit) restoreReplacedSpaces(dom);\n }\n let contextNode = dom && dom.querySelector(\"[data-pm-slice]\");\n let sliceData = contextNode && /^(\\d+) (\\d+)(?: -(\\d+))? (.*)/.exec(contextNode.getAttribute(\"data-pm-slice\") || \"\");\n if (sliceData && sliceData[3]) for (let i = +sliceData[3]; i > 0; i--) {\n let child = dom.firstChild;\n while (child && child.nodeType != 1) child = child.nextSibling;\n if (!child) break;\n dom = child;\n }\n if (!slice) {\n let parser = view.someProp(\"clipboardParser\") || view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n slice = parser.parseSlice(dom, {\n preserveWhitespace: !!(asText || sliceData),\n context: $context,\n ruleFromNode(dom) {\n if (dom.nodeName == \"BR\" && !dom.nextSibling && dom.parentNode && !inlineParents.test(dom.parentNode.nodeName)) return {\n ignore: true\n };\n return null;\n }\n });\n }\n if (sliceData) {\n slice = addContext(closeSlice(slice, +sliceData[1], +sliceData[2]), sliceData[4]);\n } else {\n // HTML wasn't created by ProseMirror. Make sure top-level siblings are coherent\n slice = Slice.maxOpen(normalizeSiblings(slice.content, $context), true);\n if (slice.openStart || slice.openEnd) {\n let openStart = 0,\n openEnd = 0;\n for (let node = slice.content.firstChild; openStart < slice.openStart && !node.type.spec.isolating; openStart++, node = node.firstChild) {}\n for (let node = slice.content.lastChild; openEnd < slice.openEnd && !node.type.spec.isolating; openEnd++, node = node.lastChild) {}\n slice = closeSlice(slice, openStart, openEnd);\n }\n }\n view.someProp(\"transformPasted\", f => {\n slice = f(slice, view);\n });\n return slice;\n}\nconst inlineParents = /^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;\n// Takes a slice parsed with parseSlice, which means there hasn't been\n// any content-expression checking done on the top nodes, tries to\n// find a parent node in the current context that might fit the nodes,\n// and if successful, rebuilds the slice so that it fits into that parent.\n//\n// This addresses the problem that Transform.replace expects a\n// coherent slice, and will fail to place a set of siblings that don't\n// fit anywhere in the schema.\nfunction normalizeSiblings(fragment, $context) {\n if (fragment.childCount < 2) return fragment;\n for (let d = $context.depth; d >= 0; d--) {\n let parent = $context.node(d);\n let match = parent.contentMatchAt($context.index(d));\n let lastWrap,\n result = [];\n fragment.forEach(node => {\n if (!result) return;\n let wrap = match.findWrapping(node.type),\n inLast;\n if (!wrap) return result = null;\n if (inLast = result.length && lastWrap.length && addToSibling(wrap, lastWrap, node, result[result.length - 1], 0)) {\n result[result.length - 1] = inLast;\n } else {\n if (result.length) result[result.length - 1] = closeRight(result[result.length - 1], lastWrap.length);\n let wrapped = withWrappers(node, wrap);\n result.push(wrapped);\n match = match.matchType(wrapped.type);\n lastWrap = wrap;\n }\n });\n if (result) return Fragment.from(result);\n }\n return fragment;\n}\nfunction withWrappers(node, wrap, from = 0) {\n for (let i = wrap.length - 1; i >= from; i--) node = wrap[i].create(null, Fragment.from(node));\n return node;\n}\n// Used to group adjacent nodes wrapped in similar parents by\n// normalizeSiblings into the same parent node\nfunction addToSibling(wrap, lastWrap, node, sibling, depth) {\n if (depth < wrap.length && depth < lastWrap.length && wrap[depth] == lastWrap[depth]) {\n let inner = addToSibling(wrap, lastWrap, node, sibling.lastChild, depth + 1);\n if (inner) return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));\n let match = sibling.contentMatchAt(sibling.childCount);\n if (match.matchType(depth == wrap.length - 1 ? node.type : wrap[depth + 1])) return sibling.copy(sibling.content.append(Fragment.from(withWrappers(node, wrap, depth + 1))));\n }\n}\nfunction closeRight(node, depth) {\n if (depth == 0) return node;\n let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));\n let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true);\n return node.copy(fragment.append(fill));\n}\nfunction closeRange(fragment, side, from, to, depth, openEnd) {\n let node = side < 0 ? fragment.firstChild : fragment.lastChild,\n inner = node.content;\n if (fragment.childCount > 1) openEnd = 0;\n if (depth < to - 1) inner = closeRange(inner, side, from, to, depth + 1, openEnd);\n if (depth >= from) inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment.empty, true));\n return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));\n}\nfunction closeSlice(slice, openStart, openEnd) {\n if (openStart < slice.openStart) slice = new Slice(closeRange(slice.content, -1, openStart, slice.openStart, 0, slice.openEnd), openStart, slice.openEnd);\n if (openEnd < slice.openEnd) slice = new Slice(closeRange(slice.content, 1, openEnd, slice.openEnd, 0, 0), slice.openStart, openEnd);\n return slice;\n}\n// Trick from jQuery -- some elements must be wrapped in other\n// elements for innerHTML to work. I.e. if you do `div.innerHTML =\n// \"..\"` the table cells are ignored.\nconst wrapMap = {\n thead: [\"table\"],\n tbody: [\"table\"],\n tfoot: [\"table\"],\n caption: [\"table\"],\n colgroup: [\"table\"],\n col: [\"table\", \"colgroup\"],\n tr: [\"table\", \"tbody\"],\n td: [\"table\", \"tbody\", \"tr\"],\n th: [\"table\", \"tbody\", \"tr\"]\n};\nlet _detachedDoc = null;\nfunction detachedDoc() {\n return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument(\"title\"));\n}\nlet _policy = null;\nfunction maybeWrapTrusted(html) {\n let trustedTypes = window.trustedTypes;\n if (!trustedTypes) return html;\n // With the require-trusted-types-for CSP, Chrome will block\n // innerHTML, even on a detached document. This wraps the string in\n // a way that makes the browser allow us to use its parser again.\n if (!_policy) _policy = trustedTypes.createPolicy(\"ProseMirrorClipboard\", {\n createHTML: s => s\n });\n return _policy.createHTML(html);\n}\nfunction readHTML(html) {\n let metas = /^(\\s*]*>)*/.exec(html);\n if (metas) html = html.slice(metas[0].length);\n let elt = detachedDoc().createElement(\"div\");\n let firstTag = /<([a-z][^>\\s]+)/i.exec(html),\n wrap;\n if (wrap = firstTag && wrapMap[firstTag[1].toLowerCase()]) html = wrap.map(n => \"<\" + n + \">\").join(\"\") + html + wrap.map(n => \"\").reverse().join(\"\");\n elt.innerHTML = maybeWrapTrusted(html);\n if (wrap) for (let i = 0; i < wrap.length; i++) elt = elt.querySelector(wrap[i]) || elt;\n return elt;\n}\n// Webkit browsers do some hard-to-predict replacement of regular\n// spaces with non-breaking spaces when putting content on the\n// clipboard. This tries to convert such non-breaking spaces (which\n// will be wrapped in a plain span on Chrome, a span with class\n// Apple-converted-space on Safari) back to regular spaces.\nfunction restoreReplacedSpaces(dom) {\n let nodes = dom.querySelectorAll(chrome ? \"span:not([class]):not([style])\" : \"span.Apple-converted-space\");\n for (let i = 0; i < nodes.length; i++) {\n let node = nodes[i];\n if (node.childNodes.length == 1 && node.textContent == \"\\u00a0\" && node.parentNode) node.parentNode.replaceChild(dom.ownerDocument.createTextNode(\" \"), node);\n }\n}\nfunction addContext(slice, context) {\n if (!slice.size) return slice;\n let schema = slice.content.firstChild.type.schema,\n array;\n try {\n array = JSON.parse(context);\n } catch (e) {\n return slice;\n }\n let {\n content,\n openStart,\n openEnd\n } = slice;\n for (let i = array.length - 2; i >= 0; i -= 2) {\n let type = schema.nodes[array[i]];\n if (!type || type.hasRequiredAttrs()) break;\n content = Fragment.from(type.create(array[i + 1], content));\n openStart++;\n openEnd++;\n }\n return new Slice(content, openStart, openEnd);\n}\n\n// A collection of DOM events that occur within the editor, and callback functions\n// to invoke when the event fires.\nconst handlers = {};\nconst editHandlers = {};\nconst passiveHandlers = {\n touchstart: true,\n touchmove: true\n};\nclass InputState {\n constructor() {\n this.shiftKey = false;\n this.mouseDown = null;\n this.lastKeyCode = null;\n this.lastKeyCodeTime = 0;\n this.lastClick = {\n time: 0,\n x: 0,\n y: 0,\n type: \"\"\n };\n this.lastSelectionOrigin = null;\n this.lastSelectionTime = 0;\n this.lastIOSEnter = 0;\n this.lastIOSEnterFallbackTimeout = -1;\n this.lastFocus = 0;\n this.lastTouch = 0;\n this.lastChromeDelete = 0;\n this.composing = false;\n this.compositionNode = null;\n this.composingTimeout = -1;\n this.compositionNodes = [];\n this.compositionEndedAt = -2e8;\n this.compositionID = 1;\n // Set to a composition ID when there are pending changes at compositionend\n this.compositionPendingChanges = 0;\n this.domChangeCount = 0;\n this.eventHandlers = Object.create(null);\n this.hideSelectionGuard = null;\n }\n}\nfunction initInput(view) {\n for (let event in handlers) {\n let handler = handlers[event];\n view.dom.addEventListener(event, view.input.eventHandlers[event] = event => {\n if (eventBelongsToView(view, event) && !runCustomHandler(view, event) && (view.editable || !(event.type in editHandlers))) handler(view, event);\n }, passiveHandlers[event] ? {\n passive: true\n } : undefined);\n }\n // On Safari, for reasons beyond my understanding, adding an input\n // event handler makes an issue where the composition vanishes when\n // you press enter go away.\n if (safari) view.dom.addEventListener(\"input\", () => null);\n ensureListeners(view);\n}\nfunction setSelectionOrigin(view, origin) {\n view.input.lastSelectionOrigin = origin;\n view.input.lastSelectionTime = Date.now();\n}\nfunction destroyInput(view) {\n view.domObserver.stop();\n for (let type in view.input.eventHandlers) view.dom.removeEventListener(type, view.input.eventHandlers[type]);\n clearTimeout(view.input.composingTimeout);\n clearTimeout(view.input.lastIOSEnterFallbackTimeout);\n}\nfunction ensureListeners(view) {\n view.someProp(\"handleDOMEvents\", currentHandlers => {\n for (let type in currentHandlers) if (!view.input.eventHandlers[type]) view.dom.addEventListener(type, view.input.eventHandlers[type] = event => runCustomHandler(view, event));\n });\n}\nfunction runCustomHandler(view, event) {\n return view.someProp(\"handleDOMEvents\", handlers => {\n let handler = handlers[event.type];\n return handler ? handler(view, event) || event.defaultPrevented : false;\n });\n}\nfunction eventBelongsToView(view, event) {\n if (!event.bubbles) return true;\n if (event.defaultPrevented) return false;\n for (let node = event.target; node != view.dom; node = node.parentNode) if (!node || node.nodeType == 11 || node.pmViewDesc && node.pmViewDesc.stopEvent(event)) return false;\n return true;\n}\nfunction dispatchEvent(view, event) {\n if (!runCustomHandler(view, event) && handlers[event.type] && (view.editable || !(event.type in editHandlers))) handlers[event.type](view, event);\n}\neditHandlers.keydown = (view, _event) => {\n let event = _event;\n view.input.shiftKey = event.keyCode == 16 || event.shiftKey;\n if (inOrNearComposition(view, event)) return;\n view.input.lastKeyCode = event.keyCode;\n view.input.lastKeyCodeTime = Date.now();\n // Suppress enter key events on Chrome Android, because those tend\n // to be part of a confused sequence of composition events fired,\n // and handling them eagerly tends to corrupt the input.\n if (android && chrome && event.keyCode == 13) return;\n if (event.keyCode != 229) view.domObserver.forceFlush();\n // On iOS, if we preventDefault enter key presses, the virtual\n // keyboard gets confused. So the hack here is to set a flag that\n // makes the DOM change code recognize that what just happens should\n // be replaced by whatever the Enter key handlers do.\n if (ios && event.keyCode == 13 && !event.ctrlKey && !event.altKey && !event.metaKey) {\n let now = Date.now();\n view.input.lastIOSEnter = now;\n view.input.lastIOSEnterFallbackTimeout = setTimeout(() => {\n if (view.input.lastIOSEnter == now) {\n view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")));\n view.input.lastIOSEnter = 0;\n }\n }, 200);\n } else if (view.someProp(\"handleKeyDown\", f => f(view, event)) || captureKeyDown(view, event)) {\n event.preventDefault();\n } else {\n setSelectionOrigin(view, \"key\");\n }\n};\neditHandlers.keyup = (view, event) => {\n if (event.keyCode == 16) view.input.shiftKey = false;\n};\neditHandlers.keypress = (view, _event) => {\n let event = _event;\n if (inOrNearComposition(view, event) || !event.charCode || event.ctrlKey && !event.altKey || mac && event.metaKey) return;\n if (view.someProp(\"handleKeyPress\", f => f(view, event))) {\n event.preventDefault();\n return;\n }\n let sel = view.state.selection;\n if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {\n let text = String.fromCharCode(event.charCode);\n if (!/[\\r\\n]/.test(text) && !view.someProp(\"handleTextInput\", f => f(view, sel.$from.pos, sel.$to.pos, text))) view.dispatch(view.state.tr.insertText(text).scrollIntoView());\n event.preventDefault();\n }\n};\nfunction eventCoords(event) {\n return {\n left: event.clientX,\n top: event.clientY\n };\n}\nfunction isNear(event, click) {\n let dx = click.x - event.clientX,\n dy = click.y - event.clientY;\n return dx * dx + dy * dy < 100;\n}\nfunction runHandlerOnContext(view, propName, pos, inside, event) {\n if (inside == -1) return false;\n let $pos = view.state.doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n if (view.someProp(propName, f => i > $pos.depth ? f(view, pos, $pos.nodeAfter, $pos.before(i), event, true) : f(view, pos, $pos.node(i), $pos.before(i), event, false))) return true;\n }\n return false;\n}\nfunction updateSelection(view, selection, origin) {\n if (!view.focused) view.focus();\n if (view.state.selection.eq(selection)) return;\n let tr = view.state.tr.setSelection(selection);\n if (origin == \"pointer\") tr.setMeta(\"pointer\", true);\n view.dispatch(tr);\n}\nfunction selectClickedLeaf(view, inside) {\n if (inside == -1) return false;\n let $pos = view.state.doc.resolve(inside),\n node = $pos.nodeAfter;\n if (node && node.isAtom && NodeSelection.isSelectable(node)) {\n updateSelection(view, new NodeSelection($pos), \"pointer\");\n return true;\n }\n return false;\n}\nfunction selectClickedNode(view, inside) {\n if (inside == -1) return false;\n let sel = view.state.selection,\n selectedNode,\n selectAt;\n if (sel instanceof NodeSelection) selectedNode = sel.node;\n let $pos = view.state.doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n if (NodeSelection.isSelectable(node)) {\n if (selectedNode && sel.$from.depth > 0 && i >= sel.$from.depth && $pos.before(sel.$from.depth + 1) == sel.$from.pos) selectAt = $pos.before(sel.$from.depth);else selectAt = $pos.before(i);\n break;\n }\n }\n if (selectAt != null) {\n updateSelection(view, NodeSelection.create(view.state.doc, selectAt), \"pointer\");\n return true;\n } else {\n return false;\n }\n}\nfunction handleSingleClick(view, pos, inside, event, selectNode) {\n return runHandlerOnContext(view, \"handleClickOn\", pos, inside, event) || view.someProp(\"handleClick\", f => f(view, pos, event)) || (selectNode ? selectClickedNode(view, inside) : selectClickedLeaf(view, inside));\n}\nfunction handleDoubleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleDoubleClickOn\", pos, inside, event) || view.someProp(\"handleDoubleClick\", f => f(view, pos, event));\n}\nfunction handleTripleClick(view, pos, inside, event) {\n return runHandlerOnContext(view, \"handleTripleClickOn\", pos, inside, event) || view.someProp(\"handleTripleClick\", f => f(view, pos, event)) || defaultTripleClick(view, inside, event);\n}\nfunction defaultTripleClick(view, inside, event) {\n if (event.button != 0) return false;\n let doc = view.state.doc;\n if (inside == -1) {\n if (doc.inlineContent) {\n updateSelection(view, TextSelection.create(doc, 0, doc.content.size), \"pointer\");\n return true;\n }\n return false;\n }\n let $pos = doc.resolve(inside);\n for (let i = $pos.depth + 1; i > 0; i--) {\n let node = i > $pos.depth ? $pos.nodeAfter : $pos.node(i);\n let nodePos = $pos.before(i);\n if (node.inlineContent) updateSelection(view, TextSelection.create(doc, nodePos + 1, nodePos + 1 + node.content.size), \"pointer\");else if (NodeSelection.isSelectable(node)) updateSelection(view, NodeSelection.create(doc, nodePos), \"pointer\");else continue;\n return true;\n }\n}\nfunction forceDOMFlush(view) {\n return endComposition(view);\n}\nconst selectNodeModifier = mac ? \"metaKey\" : \"ctrlKey\";\nhandlers.mousedown = (view, _event) => {\n let event = _event;\n view.input.shiftKey = event.shiftKey;\n let flushed = forceDOMFlush(view);\n let now = Date.now(),\n type = \"singleClick\";\n if (now - view.input.lastClick.time < 500 && isNear(event, view.input.lastClick) && !event[selectNodeModifier]) {\n if (view.input.lastClick.type == \"singleClick\") type = \"doubleClick\";else if (view.input.lastClick.type == \"doubleClick\") type = \"tripleClick\";\n }\n view.input.lastClick = {\n time: now,\n x: event.clientX,\n y: event.clientY,\n type\n };\n let pos = view.posAtCoords(eventCoords(event));\n if (!pos) return;\n if (type == \"singleClick\") {\n if (view.input.mouseDown) view.input.mouseDown.done();\n view.input.mouseDown = new MouseDown(view, pos, event, !!flushed);\n } else if ((type == \"doubleClick\" ? handleDoubleClick : handleTripleClick)(view, pos.pos, pos.inside, event)) {\n event.preventDefault();\n } else {\n setSelectionOrigin(view, \"pointer\");\n }\n};\nclass MouseDown {\n constructor(view, pos, event, flushed) {\n this.view = view;\n this.pos = pos;\n this.event = event;\n this.flushed = flushed;\n this.delayedSelectionSync = false;\n this.mightDrag = null;\n this.startDoc = view.state.doc;\n this.selectNode = !!event[selectNodeModifier];\n this.allowDefault = event.shiftKey;\n let targetNode, targetPos;\n if (pos.inside > -1) {\n targetNode = view.state.doc.nodeAt(pos.inside);\n targetPos = pos.inside;\n } else {\n let $pos = view.state.doc.resolve(pos.pos);\n targetNode = $pos.parent;\n targetPos = $pos.depth ? $pos.before() : 0;\n }\n const target = flushed ? null : event.target;\n const targetDesc = target ? view.docView.nearestDesc(target, true) : null;\n this.target = targetDesc && targetDesc.dom.nodeType == 1 ? targetDesc.dom : null;\n let {\n selection\n } = view.state;\n if (event.button == 0 && targetNode.type.spec.draggable && targetNode.type.spec.selectable !== false || selection instanceof NodeSelection && selection.from <= targetPos && selection.to > targetPos) this.mightDrag = {\n node: targetNode,\n pos: targetPos,\n addAttr: !!(this.target && !this.target.draggable),\n setUneditable: !!(this.target && gecko && !this.target.hasAttribute(\"contentEditable\"))\n };\n if (this.target && this.mightDrag && (this.mightDrag.addAttr || this.mightDrag.setUneditable)) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) this.target.draggable = true;\n if (this.mightDrag.setUneditable) setTimeout(() => {\n if (this.view.input.mouseDown == this) this.target.setAttribute(\"contentEditable\", \"false\");\n }, 20);\n this.view.domObserver.start();\n }\n view.root.addEventListener(\"mouseup\", this.up = this.up.bind(this));\n view.root.addEventListener(\"mousemove\", this.move = this.move.bind(this));\n setSelectionOrigin(view, \"pointer\");\n }\n done() {\n this.view.root.removeEventListener(\"mouseup\", this.up);\n this.view.root.removeEventListener(\"mousemove\", this.move);\n if (this.mightDrag && this.target) {\n this.view.domObserver.stop();\n if (this.mightDrag.addAttr) this.target.removeAttribute(\"draggable\");\n if (this.mightDrag.setUneditable) this.target.removeAttribute(\"contentEditable\");\n this.view.domObserver.start();\n }\n if (this.delayedSelectionSync) setTimeout(() => selectionToDOM(this.view));\n this.view.input.mouseDown = null;\n }\n up(event) {\n this.done();\n if (!this.view.dom.contains(event.target)) return;\n let pos = this.pos;\n if (this.view.state.doc != this.startDoc) pos = this.view.posAtCoords(eventCoords(event));\n this.updateAllowDefault(event);\n if (this.allowDefault || !pos) {\n setSelectionOrigin(this.view, \"pointer\");\n } else if (handleSingleClick(this.view, pos.pos, pos.inside, event, this.selectNode)) {\n event.preventDefault();\n } else if (event.button == 0 && (this.flushed ||\n // Safari ignores clicks on draggable elements\n safari && this.mightDrag && !this.mightDrag.node.isAtom ||\n // Chrome will sometimes treat a node selection as a\n // cursor, but still report that the node is selected\n // when asked through getSelection. You'll then get a\n // situation where clicking at the point where that\n // (hidden) cursor is doesn't change the selection, and\n // thus doesn't get a reaction from ProseMirror. This\n // works around that.\n chrome && !this.view.state.selection.visible && Math.min(Math.abs(pos.pos - this.view.state.selection.from), Math.abs(pos.pos - this.view.state.selection.to)) <= 2)) {\n updateSelection(this.view, Selection.near(this.view.state.doc.resolve(pos.pos)), \"pointer\");\n event.preventDefault();\n } else {\n setSelectionOrigin(this.view, \"pointer\");\n }\n }\n move(event) {\n this.updateAllowDefault(event);\n setSelectionOrigin(this.view, \"pointer\");\n if (event.buttons == 0) this.done();\n }\n updateAllowDefault(event) {\n if (!this.allowDefault && (Math.abs(this.event.x - event.clientX) > 4 || Math.abs(this.event.y - event.clientY) > 4)) this.allowDefault = true;\n }\n}\nhandlers.touchstart = view => {\n view.input.lastTouch = Date.now();\n forceDOMFlush(view);\n setSelectionOrigin(view, \"pointer\");\n};\nhandlers.touchmove = view => {\n view.input.lastTouch = Date.now();\n setSelectionOrigin(view, \"pointer\");\n};\nhandlers.contextmenu = view => forceDOMFlush(view);\nfunction inOrNearComposition(view, event) {\n if (view.composing) return true;\n // See https://www.stum.de/2016/06/24/handling-ime-events-in-javascript/.\n // On Japanese input method editors (IMEs), the Enter key is used to confirm character\n // selection. On Safari, when Enter is pressed, compositionend and keydown events are\n // emitted. The keydown event triggers newline insertion, which we don't want.\n // This method returns true if the keydown event should be ignored.\n // We only ignore it once, as pressing Enter a second time *should* insert a newline.\n // Furthermore, the keydown event timestamp must be close to the compositionEndedAt timestamp.\n // This guards against the case where compositionend is triggered without the keyboard\n // (e.g. character confirmation may be done with the mouse), and keydown is triggered\n // afterwards- we wouldn't want to ignore the keydown event in this case.\n if (safari && Math.abs(event.timeStamp - view.input.compositionEndedAt) < 500) {\n view.input.compositionEndedAt = -2e8;\n return true;\n }\n return false;\n}\n// Drop active composition after 5 seconds of inactivity on Android\nconst timeoutComposition = android ? 5000 : -1;\neditHandlers.compositionstart = editHandlers.compositionupdate = view => {\n if (!view.composing) {\n view.domObserver.flush();\n let {\n state\n } = view,\n $pos = state.selection.$to;\n if (state.selection instanceof TextSelection && (state.storedMarks || !$pos.textOffset && $pos.parentOffset && $pos.nodeBefore.marks.some(m => m.type.spec.inclusive === false))) {\n // Need to wrap the cursor in mark nodes different from the ones in the DOM context\n view.markCursor = view.state.storedMarks || $pos.marks();\n endComposition(view, true);\n view.markCursor = null;\n } else {\n endComposition(view, !state.selection.empty);\n // In firefox, if the cursor is after but outside a marked node,\n // the inserted text won't inherit the marks. So this moves it\n // inside if necessary.\n if (gecko && state.selection.empty && $pos.parentOffset && !$pos.textOffset && $pos.nodeBefore.marks.length) {\n let sel = view.domSelectionRange();\n for (let node = sel.focusNode, offset = sel.focusOffset; node && node.nodeType == 1 && offset != 0;) {\n let before = offset < 0 ? node.lastChild : node.childNodes[offset - 1];\n if (!before) break;\n if (before.nodeType == 3) {\n let sel = view.domSelection();\n if (sel) sel.collapse(before, before.nodeValue.length);\n break;\n } else {\n node = before;\n offset = -1;\n }\n }\n }\n }\n view.input.composing = true;\n }\n scheduleComposeEnd(view, timeoutComposition);\n};\neditHandlers.compositionend = (view, event) => {\n if (view.composing) {\n view.input.composing = false;\n view.input.compositionEndedAt = event.timeStamp;\n view.input.compositionPendingChanges = view.domObserver.pendingRecords().length ? view.input.compositionID : 0;\n view.input.compositionNode = null;\n if (view.input.compositionPendingChanges) Promise.resolve().then(() => view.domObserver.flush());\n view.input.compositionID++;\n scheduleComposeEnd(view, 20);\n }\n};\nfunction scheduleComposeEnd(view, delay) {\n clearTimeout(view.input.composingTimeout);\n if (delay > -1) view.input.composingTimeout = setTimeout(() => endComposition(view), delay);\n}\nfunction clearComposition(view) {\n if (view.composing) {\n view.input.composing = false;\n view.input.compositionEndedAt = timestampFromCustomEvent();\n }\n while (view.input.compositionNodes.length > 0) view.input.compositionNodes.pop().markParentsDirty();\n}\nfunction findCompositionNode(view) {\n let sel = view.domSelectionRange();\n if (!sel.focusNode) return null;\n let textBefore = textNodeBefore$1(sel.focusNode, sel.focusOffset);\n let textAfter = textNodeAfter$1(sel.focusNode, sel.focusOffset);\n if (textBefore && textAfter && textBefore != textAfter) {\n let descAfter = textAfter.pmViewDesc,\n lastChanged = view.domObserver.lastChangedTextNode;\n if (textBefore == lastChanged || textAfter == lastChanged) return lastChanged;\n if (!descAfter || !descAfter.isText(textAfter.nodeValue)) {\n return textAfter;\n } else if (view.input.compositionNode == textAfter) {\n let descBefore = textBefore.pmViewDesc;\n if (!(!descBefore || !descBefore.isText(textBefore.nodeValue))) return textAfter;\n }\n }\n return textBefore || textAfter;\n}\nfunction timestampFromCustomEvent() {\n let event = document.createEvent(\"Event\");\n event.initEvent(\"event\", true, true);\n return event.timeStamp;\n}\n/**\n@internal\n*/\nfunction endComposition(view, restarting = false) {\n if (android && view.domObserver.flushingSoon >= 0) return;\n view.domObserver.forceFlush();\n clearComposition(view);\n if (restarting || view.docView && view.docView.dirty) {\n let sel = selectionFromDOM(view);\n if (sel && !sel.eq(view.state.selection)) view.dispatch(view.state.tr.setSelection(sel));else if ((view.markCursor || restarting) && !view.state.selection.empty) view.dispatch(view.state.tr.deleteSelection());else view.updateState(view.state);\n return true;\n }\n return false;\n}\nfunction captureCopy(view, dom) {\n // The extra wrapper is somehow necessary on IE/Edge to prevent the\n // content from being mangled when it is put onto the clipboard\n if (!view.dom.parentNode) return;\n let wrap = view.dom.parentNode.appendChild(document.createElement(\"div\"));\n wrap.appendChild(dom);\n wrap.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n let sel = getSelection(),\n range = document.createRange();\n range.selectNodeContents(dom);\n // Done because IE will fire a selectionchange moving the selection\n // to its start when removeAllRanges is called and the editor still\n // has focus (which will mess up the editor's selection state).\n view.dom.blur();\n sel.removeAllRanges();\n sel.addRange(range);\n setTimeout(() => {\n if (wrap.parentNode) wrap.parentNode.removeChild(wrap);\n view.focus();\n }, 50);\n}\n// This is very crude, but unfortunately both these browsers _pretend_\n// that they have a clipboard API—all the objects and methods are\n// there, they just don't work, and they are hard to test.\nconst brokenClipboardAPI = ie && ie_version < 15 || ios && webkit_version < 604;\nhandlers.copy = editHandlers.cut = (view, _event) => {\n let event = _event;\n let sel = view.state.selection,\n cut = event.type == \"cut\";\n if (sel.empty) return;\n // IE and Edge's clipboard interface is completely broken\n let data = brokenClipboardAPI ? null : event.clipboardData;\n let slice = sel.content(),\n {\n dom,\n text\n } = serializeForClipboard(view, slice);\n if (data) {\n event.preventDefault();\n data.clearData();\n data.setData(\"text/html\", dom.innerHTML);\n data.setData(\"text/plain\", text);\n } else {\n captureCopy(view, dom);\n }\n if (cut) view.dispatch(view.state.tr.deleteSelection().scrollIntoView().setMeta(\"uiEvent\", \"cut\"));\n};\nfunction sliceSingleNode(slice) {\n return slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1 ? slice.content.firstChild : null;\n}\nfunction capturePaste(view, event) {\n if (!view.dom.parentNode) return;\n let plainText = view.input.shiftKey || view.state.selection.$from.parent.type.spec.code;\n let target = view.dom.parentNode.appendChild(document.createElement(plainText ? \"textarea\" : \"div\"));\n if (!plainText) target.contentEditable = \"true\";\n target.style.cssText = \"position: fixed; left: -10000px; top: 10px\";\n target.focus();\n let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n setTimeout(() => {\n view.focus();\n if (target.parentNode) target.parentNode.removeChild(target);\n if (plainText) doPaste(view, target.value, null, plain, event);else doPaste(view, target.textContent, target.innerHTML, plain, event);\n }, 50);\n}\nfunction doPaste(view, text, html, preferPlain, event) {\n let slice = parseFromClipboard(view, text, html, preferPlain, view.state.selection.$from);\n if (view.someProp(\"handlePaste\", f => f(view, event, slice || Slice.empty))) return true;\n if (!slice) return false;\n let singleNode = sliceSingleNode(slice);\n let tr = singleNode ? view.state.tr.replaceSelectionWith(singleNode, preferPlain) : view.state.tr.replaceSelection(slice);\n view.dispatch(tr.scrollIntoView().setMeta(\"paste\", true).setMeta(\"uiEvent\", \"paste\"));\n return true;\n}\nfunction getText(clipboardData) {\n let text = clipboardData.getData(\"text/plain\") || clipboardData.getData(\"Text\");\n if (text) return text;\n let uris = clipboardData.getData(\"text/uri-list\");\n return uris ? uris.replace(/\\r?\\n/g, \" \") : \"\";\n}\neditHandlers.paste = (view, _event) => {\n let event = _event;\n // Handling paste from JavaScript during composition is very poorly\n // handled by browsers, so as a dodgy but preferable kludge, we just\n // let the browser do its native thing there, except on Android,\n // where the editor is almost always composing.\n if (view.composing && !android) return;\n let data = brokenClipboardAPI ? null : event.clipboardData;\n let plain = view.input.shiftKey && view.input.lastKeyCode != 45;\n if (data && doPaste(view, getText(data), data.getData(\"text/html\"), plain, event)) event.preventDefault();else capturePaste(view, event);\n};\nclass Dragging {\n constructor(slice, move, node) {\n this.slice = slice;\n this.move = move;\n this.node = node;\n }\n}\nconst dragCopyModifier = mac ? \"altKey\" : \"ctrlKey\";\nhandlers.dragstart = (view, _event) => {\n let event = _event;\n let mouseDown = view.input.mouseDown;\n if (mouseDown) mouseDown.done();\n if (!event.dataTransfer) return;\n let sel = view.state.selection;\n let pos = sel.empty ? null : view.posAtCoords(eventCoords(event));\n let node;\n if (pos && pos.pos >= sel.from && pos.pos <= (sel instanceof NodeSelection ? sel.to - 1 : sel.to)) ;else if (mouseDown && mouseDown.mightDrag) {\n node = NodeSelection.create(view.state.doc, mouseDown.mightDrag.pos);\n } else if (event.target && event.target.nodeType == 1) {\n let desc = view.docView.nearestDesc(event.target, true);\n if (desc && desc.node.type.spec.draggable && desc != view.docView) node = NodeSelection.create(view.state.doc, desc.posBefore);\n }\n let draggedSlice = (node || view.state.selection).content();\n let {\n dom,\n text,\n slice\n } = serializeForClipboard(view, draggedSlice);\n // Pre-120 Chrome versions clear files when calling `clearData` (#1472)\n if (!event.dataTransfer.files.length || !chrome || chrome_version > 120) event.dataTransfer.clearData();\n event.dataTransfer.setData(brokenClipboardAPI ? \"Text\" : \"text/html\", dom.innerHTML);\n // See https://github.com/ProseMirror/prosemirror/issues/1156\n event.dataTransfer.effectAllowed = \"copyMove\";\n if (!brokenClipboardAPI) event.dataTransfer.setData(\"text/plain\", text);\n view.dragging = new Dragging(slice, !event[dragCopyModifier], node);\n};\nhandlers.dragend = view => {\n let dragging = view.dragging;\n window.setTimeout(() => {\n if (view.dragging == dragging) view.dragging = null;\n }, 50);\n};\neditHandlers.dragover = editHandlers.dragenter = (_, e) => e.preventDefault();\neditHandlers.drop = (view, _event) => {\n let event = _event;\n let dragging = view.dragging;\n view.dragging = null;\n if (!event.dataTransfer) return;\n let eventPos = view.posAtCoords(eventCoords(event));\n if (!eventPos) return;\n let $mouse = view.state.doc.resolve(eventPos.pos);\n let slice = dragging && dragging.slice;\n if (slice) {\n view.someProp(\"transformPasted\", f => {\n slice = f(slice, view);\n });\n } else {\n slice = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData(\"text/html\"), false, $mouse);\n }\n let move = !!(dragging && !event[dragCopyModifier]);\n if (view.someProp(\"handleDrop\", f => f(view, event, slice || Slice.empty, move))) {\n event.preventDefault();\n return;\n }\n if (!slice) return;\n event.preventDefault();\n let insertPos = slice ? dropPoint(view.state.doc, $mouse.pos, slice) : $mouse.pos;\n if (insertPos == null) insertPos = $mouse.pos;\n let tr = view.state.tr;\n if (move) {\n let {\n node\n } = dragging;\n if (node) node.replace(tr);else tr.deleteSelection();\n }\n let pos = tr.mapping.map(insertPos);\n let isNode = slice.openStart == 0 && slice.openEnd == 0 && slice.content.childCount == 1;\n let beforeInsert = tr.doc;\n if (isNode) tr.replaceRangeWith(pos, pos, slice.content.firstChild);else tr.replaceRange(pos, pos, slice);\n if (tr.doc.eq(beforeInsert)) return;\n let $pos = tr.doc.resolve(pos);\n if (isNode && NodeSelection.isSelectable(slice.content.firstChild) && $pos.nodeAfter && $pos.nodeAfter.sameMarkup(slice.content.firstChild)) {\n tr.setSelection(new NodeSelection($pos));\n } else {\n let end = tr.mapping.map(insertPos);\n tr.mapping.maps[tr.mapping.maps.length - 1].forEach((_from, _to, _newFrom, newTo) => end = newTo);\n tr.setSelection(selectionBetween(view, $pos, tr.doc.resolve(end)));\n }\n view.focus();\n view.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n};\nhandlers.focus = view => {\n view.input.lastFocus = Date.now();\n if (!view.focused) {\n view.domObserver.stop();\n view.dom.classList.add(\"ProseMirror-focused\");\n view.domObserver.start();\n view.focused = true;\n setTimeout(() => {\n if (view.docView && view.hasFocus() && !view.domObserver.currentSelection.eq(view.domSelectionRange())) selectionToDOM(view);\n }, 20);\n }\n};\nhandlers.blur = (view, _event) => {\n let event = _event;\n if (view.focused) {\n view.domObserver.stop();\n view.dom.classList.remove(\"ProseMirror-focused\");\n view.domObserver.start();\n if (event.relatedTarget && view.dom.contains(event.relatedTarget)) view.domObserver.currentSelection.clear();\n view.focused = false;\n }\n};\nhandlers.beforeinput = (view, _event) => {\n let event = _event;\n // We should probably do more with beforeinput events, but support\n // is so spotty that I'm still waiting to see where they are going.\n // Very specific hack to deal with backspace sometimes failing on\n // Chrome Android when after an uneditable node.\n if (chrome && android && event.inputType == \"deleteContentBackward\") {\n view.domObserver.flushSoon();\n let {\n domChangeCount\n } = view.input;\n setTimeout(() => {\n if (view.input.domChangeCount != domChangeCount) return; // Event already had some effect\n // This bug tends to close the virtual keyboard, so we refocus\n view.dom.blur();\n view.focus();\n if (view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\")))) return;\n let {\n $cursor\n } = view.state.selection;\n // Crude approximation of backspace behavior when no command handled it\n if ($cursor && $cursor.pos > 0) view.dispatch(view.state.tr.delete($cursor.pos - 1, $cursor.pos).scrollIntoView());\n }, 50);\n }\n};\n// Make sure all handlers get registered\nfor (let prop in editHandlers) handlers[prop] = editHandlers[prop];\nfunction compareObjs(a, b) {\n if (a == b) return true;\n for (let p in a) if (a[p] !== b[p]) return false;\n for (let p in b) if (!(p in a)) return false;\n return true;\n}\nclass WidgetType {\n constructor(toDOM, spec) {\n this.toDOM = toDOM;\n this.spec = spec || noSpec;\n this.side = this.spec.side || 0;\n }\n map(mapping, span, offset, oldOffset) {\n let {\n pos,\n deleted\n } = mapping.mapResult(span.from + oldOffset, this.side < 0 ? -1 : 1);\n return deleted ? null : new Decoration(pos - offset, pos - offset, this);\n }\n valid() {\n return true;\n }\n eq(other) {\n return this == other || other instanceof WidgetType && (this.spec.key && this.spec.key == other.spec.key || this.toDOM == other.toDOM && compareObjs(this.spec, other.spec));\n }\n destroy(node) {\n if (this.spec.destroy) this.spec.destroy(node);\n }\n}\nclass InlineType {\n constructor(attrs, spec) {\n this.attrs = attrs;\n this.spec = spec || noSpec;\n }\n map(mapping, span, offset, oldOffset) {\n let from = mapping.map(span.from + oldOffset, this.spec.inclusiveStart ? -1 : 1) - offset;\n let to = mapping.map(span.to + oldOffset, this.spec.inclusiveEnd ? 1 : -1) - offset;\n return from >= to ? null : new Decoration(from, to, this);\n }\n valid(_, span) {\n return span.from < span.to;\n }\n eq(other) {\n return this == other || other instanceof InlineType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);\n }\n static is(span) {\n return span.type instanceof InlineType;\n }\n destroy() {}\n}\nclass NodeType {\n constructor(attrs, spec) {\n this.attrs = attrs;\n this.spec = spec || noSpec;\n }\n map(mapping, span, offset, oldOffset) {\n let from = mapping.mapResult(span.from + oldOffset, 1);\n if (from.deleted) return null;\n let to = mapping.mapResult(span.to + oldOffset, -1);\n if (to.deleted || to.pos <= from.pos) return null;\n return new Decoration(from.pos - offset, to.pos - offset, this);\n }\n valid(node, span) {\n let {\n index,\n offset\n } = node.content.findIndex(span.from),\n child;\n return offset == span.from && !(child = node.child(index)).isText && offset + child.nodeSize == span.to;\n }\n eq(other) {\n return this == other || other instanceof NodeType && compareObjs(this.attrs, other.attrs) && compareObjs(this.spec, other.spec);\n }\n destroy() {}\n}\n/**\nDecoration objects can be provided to the view through the\n[`decorations` prop](https://prosemirror.net/docs/ref/#view.EditorProps.decorations). They come in\nseveral variants—see the static members of this class for details.\n*/\nclass Decoration {\n /**\n @internal\n */\n constructor(\n /**\n The start position of the decoration.\n */\n from,\n /**\n The end position. Will be the same as `from` for [widget\n decorations](https://prosemirror.net/docs/ref/#view.Decoration^widget).\n */\n to,\n /**\n @internal\n */\n type) {\n this.from = from;\n this.to = to;\n this.type = type;\n }\n /**\n @internal\n */\n copy(from, to) {\n return new Decoration(from, to, this.type);\n }\n /**\n @internal\n */\n eq(other, offset = 0) {\n return this.type.eq(other.type) && this.from + offset == other.from && this.to + offset == other.to;\n }\n /**\n @internal\n */\n map(mapping, offset, oldOffset) {\n return this.type.map(mapping, this, offset, oldOffset);\n }\n /**\n Creates a widget decoration, which is a DOM node that's shown in\n the document at the given position. It is recommended that you\n delay rendering the widget by passing a function that will be\n called when the widget is actually drawn in a view, but you can\n also directly pass a DOM node. `getPos` can be used to find the\n widget's current document position.\n */\n static widget(pos, toDOM, spec) {\n return new Decoration(pos, pos, new WidgetType(toDOM, spec));\n }\n /**\n Creates an inline decoration, which adds the given attributes to\n each inline node between `from` and `to`.\n */\n static inline(from, to, attrs, spec) {\n return new Decoration(from, to, new InlineType(attrs, spec));\n }\n /**\n Creates a node decoration. `from` and `to` should point precisely\n before and after a node in the document. That node, and only that\n node, will receive the given attributes.\n */\n static node(from, to, attrs, spec) {\n return new Decoration(from, to, new NodeType(attrs, spec));\n }\n /**\n The spec provided when creating this decoration. Can be useful\n if you've stored extra information in that object.\n */\n get spec() {\n return this.type.spec;\n }\n /**\n @internal\n */\n get inline() {\n return this.type instanceof InlineType;\n }\n /**\n @internal\n */\n get widget() {\n return this.type instanceof WidgetType;\n }\n}\nconst none = [],\n noSpec = {};\n/**\nA collection of [decorations](https://prosemirror.net/docs/ref/#view.Decoration), organized in such\na way that the drawing algorithm can efficiently use and compare\nthem. This is a persistent data structure—it is not modified,\nupdates create a new value.\n*/\nclass DecorationSet {\n /**\n @internal\n */\n constructor(local, children) {\n this.local = local.length ? local : none;\n this.children = children.length ? children : none;\n }\n /**\n Create a set of decorations, using the structure of the given\n document. This will consume (modify) the `decorations` array, so\n you must make a copy if you want need to preserve that.\n */\n static create(doc, decorations) {\n return decorations.length ? buildTree(decorations, doc, 0, noSpec) : empty;\n }\n /**\n Find all decorations in this set which touch the given range\n (including decorations that start or end directly at the\n boundaries) and match the given predicate on their spec. When\n `start` and `end` are omitted, all decorations in the set are\n considered. When `predicate` isn't given, all decorations are\n assumed to match.\n */\n find(start, end, predicate) {\n let result = [];\n this.findInner(start == null ? 0 : start, end == null ? 1e9 : end, result, 0, predicate);\n return result;\n }\n findInner(start, end, result, offset, predicate) {\n for (let i = 0; i < this.local.length; i++) {\n let span = this.local[i];\n if (span.from <= end && span.to >= start && (!predicate || predicate(span.spec))) result.push(span.copy(span.from + offset, span.to + offset));\n }\n for (let i = 0; i < this.children.length; i += 3) {\n if (this.children[i] < end && this.children[i + 1] > start) {\n let childOff = this.children[i] + 1;\n this.children[i + 2].findInner(start - childOff, end - childOff, result, offset + childOff, predicate);\n }\n }\n }\n /**\n Map the set of decorations in response to a change in the\n document.\n */\n map(mapping, doc, options) {\n if (this == empty || mapping.maps.length == 0) return this;\n return this.mapInner(mapping, doc, 0, 0, options || noSpec);\n }\n /**\n @internal\n */\n mapInner(mapping, node, offset, oldOffset, options) {\n let newLocal;\n for (let i = 0; i < this.local.length; i++) {\n let mapped = this.local[i].map(mapping, offset, oldOffset);\n if (mapped && mapped.type.valid(node, mapped)) (newLocal || (newLocal = [])).push(mapped);else if (options.onRemove) options.onRemove(this.local[i].spec);\n }\n if (this.children.length) return mapChildren(this.children, newLocal || [], mapping, node, offset, oldOffset, options);else return newLocal ? new DecorationSet(newLocal.sort(byPos), none) : empty;\n }\n /**\n Add the given array of decorations to the ones in the set,\n producing a new set. Consumes the `decorations` array. Needs\n access to the current document to create the appropriate tree\n structure.\n */\n add(doc, decorations) {\n if (!decorations.length) return this;\n if (this == empty) return DecorationSet.create(doc, decorations);\n return this.addInner(doc, decorations, 0);\n }\n addInner(doc, decorations, offset) {\n let children,\n childIndex = 0;\n doc.forEach((childNode, childOffset) => {\n let baseOffset = childOffset + offset,\n found;\n if (!(found = takeSpansForNode(decorations, childNode, baseOffset))) return;\n if (!children) children = this.children.slice();\n while (childIndex < children.length && children[childIndex] < childOffset) childIndex += 3;\n if (children[childIndex] == childOffset) children[childIndex + 2] = children[childIndex + 2].addInner(childNode, found, baseOffset + 1);else children.splice(childIndex, 0, childOffset, childOffset + childNode.nodeSize, buildTree(found, childNode, baseOffset + 1, noSpec));\n childIndex += 3;\n });\n let local = moveSpans(childIndex ? withoutNulls(decorations) : decorations, -offset);\n for (let i = 0; i < local.length; i++) if (!local[i].type.valid(doc, local[i])) local.splice(i--, 1);\n return new DecorationSet(local.length ? this.local.concat(local).sort(byPos) : this.local, children || this.children);\n }\n /**\n Create a new set that contains the decorations in this set, minus\n the ones in the given array.\n */\n remove(decorations) {\n if (decorations.length == 0 || this == empty) return this;\n return this.removeInner(decorations, 0);\n }\n removeInner(decorations, offset) {\n let children = this.children,\n local = this.local;\n for (let i = 0; i < children.length; i += 3) {\n let found;\n let from = children[i] + offset,\n to = children[i + 1] + offset;\n for (let j = 0, span; j < decorations.length; j++) if (span = decorations[j]) {\n if (span.from > from && span.to < to) {\n decorations[j] = null;\n (found || (found = [])).push(span);\n }\n }\n if (!found) continue;\n if (children == this.children) children = this.children.slice();\n let removed = children[i + 2].removeInner(found, from + 1);\n if (removed != empty) {\n children[i + 2] = removed;\n } else {\n children.splice(i, 3);\n i -= 3;\n }\n }\n if (local.length) for (let i = 0, span; i < decorations.length; i++) if (span = decorations[i]) {\n for (let j = 0; j < local.length; j++) if (local[j].eq(span, offset)) {\n if (local == this.local) local = this.local.slice();\n local.splice(j--, 1);\n }\n }\n if (children == this.children && local == this.local) return this;\n return local.length || children.length ? new DecorationSet(local, children) : empty;\n }\n forChild(offset, node) {\n if (this == empty) return this;\n if (node.isLeaf) return DecorationSet.empty;\n let child, local;\n for (let i = 0; i < this.children.length; i += 3) if (this.children[i] >= offset) {\n if (this.children[i] == offset) child = this.children[i + 2];\n break;\n }\n let start = offset + 1,\n end = start + node.content.size;\n for (let i = 0; i < this.local.length; i++) {\n let dec = this.local[i];\n if (dec.from < end && dec.to > start && dec.type instanceof InlineType) {\n let from = Math.max(start, dec.from) - start,\n to = Math.min(end, dec.to) - start;\n if (from < to) (local || (local = [])).push(dec.copy(from, to));\n }\n }\n if (local) {\n let localSet = new DecorationSet(local.sort(byPos), none);\n return child ? new DecorationGroup([localSet, child]) : localSet;\n }\n return child || empty;\n }\n /**\n @internal\n */\n eq(other) {\n if (this == other) return true;\n if (!(other instanceof DecorationSet) || this.local.length != other.local.length || this.children.length != other.children.length) return false;\n for (let i = 0; i < this.local.length; i++) if (!this.local[i].eq(other.local[i])) return false;\n for (let i = 0; i < this.children.length; i += 3) if (this.children[i] != other.children[i] || this.children[i + 1] != other.children[i + 1] || !this.children[i + 2].eq(other.children[i + 2])) return false;\n return true;\n }\n /**\n @internal\n */\n locals(node) {\n return removeOverlap(this.localsInner(node));\n }\n /**\n @internal\n */\n localsInner(node) {\n if (this == empty) return none;\n if (node.inlineContent || !this.local.some(InlineType.is)) return this.local;\n let result = [];\n for (let i = 0; i < this.local.length; i++) {\n if (!(this.local[i].type instanceof InlineType)) result.push(this.local[i]);\n }\n return result;\n }\n forEachSet(f) {\n f(this);\n }\n}\n/**\nThe empty set of decorations.\n*/\nDecorationSet.empty = new DecorationSet([], []);\n/**\n@internal\n*/\nDecorationSet.removeOverlap = removeOverlap;\nconst empty = DecorationSet.empty;\n// An abstraction that allows the code dealing with decorations to\n// treat multiple DecorationSet objects as if it were a single object\n// with (a subset of) the same interface.\nclass DecorationGroup {\n constructor(members) {\n this.members = members;\n }\n map(mapping, doc) {\n const mappedDecos = this.members.map(member => member.map(mapping, doc, noSpec));\n return DecorationGroup.from(mappedDecos);\n }\n forChild(offset, child) {\n if (child.isLeaf) return DecorationSet.empty;\n let found = [];\n for (let i = 0; i < this.members.length; i++) {\n let result = this.members[i].forChild(offset, child);\n if (result == empty) continue;\n if (result instanceof DecorationGroup) found = found.concat(result.members);else found.push(result);\n }\n return DecorationGroup.from(found);\n }\n eq(other) {\n if (!(other instanceof DecorationGroup) || other.members.length != this.members.length) return false;\n for (let i = 0; i < this.members.length; i++) if (!this.members[i].eq(other.members[i])) return false;\n return true;\n }\n locals(node) {\n let result,\n sorted = true;\n for (let i = 0; i < this.members.length; i++) {\n let locals = this.members[i].localsInner(node);\n if (!locals.length) continue;\n if (!result) {\n result = locals;\n } else {\n if (sorted) {\n result = result.slice();\n sorted = false;\n }\n for (let j = 0; j < locals.length; j++) result.push(locals[j]);\n }\n }\n return result ? removeOverlap(sorted ? result : result.sort(byPos)) : none;\n }\n // Create a group for the given array of decoration sets, or return\n // a single set when possible.\n static from(members) {\n switch (members.length) {\n case 0:\n return empty;\n case 1:\n return members[0];\n default:\n return new DecorationGroup(members.every(m => m instanceof DecorationSet) ? members : members.reduce((r, m) => r.concat(m instanceof DecorationSet ? m : m.members), []));\n }\n }\n forEachSet(f) {\n for (let i = 0; i < this.members.length; i++) this.members[i].forEachSet(f);\n }\n}\nfunction mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, options) {\n let children = oldChildren.slice();\n // Mark the children that are directly touched by changes, and\n // move those that are after the changes.\n for (let i = 0, baseOffset = oldOffset; i < mapping.maps.length; i++) {\n let moved = 0;\n mapping.maps[i].forEach((oldStart, oldEnd, newStart, newEnd) => {\n let dSize = newEnd - newStart - (oldEnd - oldStart);\n for (let i = 0; i < children.length; i += 3) {\n let end = children[i + 1];\n if (end < 0 || oldStart > end + baseOffset - moved) continue;\n let start = children[i] + baseOffset - moved;\n if (oldEnd >= start) {\n children[i + 1] = oldStart <= start ? -2 : -1;\n } else if (oldStart >= baseOffset && dSize) {\n children[i] += dSize;\n children[i + 1] += dSize;\n }\n }\n moved += dSize;\n });\n baseOffset = mapping.maps[i].map(baseOffset, -1);\n }\n // Find the child nodes that still correspond to a single node,\n // recursively call mapInner on them and update their positions.\n let mustRebuild = false;\n for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {\n // Touched nodes\n if (children[i + 1] == -2) {\n mustRebuild = true;\n children[i + 1] = -1;\n continue;\n }\n let from = mapping.map(oldChildren[i] + oldOffset),\n fromLocal = from - offset;\n if (fromLocal < 0 || fromLocal >= node.content.size) {\n mustRebuild = true;\n continue;\n }\n // Must read oldChildren because children was tagged with -1\n let to = mapping.map(oldChildren[i + 1] + oldOffset, -1),\n toLocal = to - offset;\n let {\n index,\n offset: childOffset\n } = node.content.findIndex(fromLocal);\n let childNode = node.maybeChild(index);\n if (childNode && childOffset == fromLocal && childOffset + childNode.nodeSize == toLocal) {\n let mapped = children[i + 2].mapInner(mapping, childNode, from + 1, oldChildren[i] + oldOffset + 1, options);\n if (mapped != empty) {\n children[i] = fromLocal;\n children[i + 1] = toLocal;\n children[i + 2] = mapped;\n } else {\n children[i + 1] = -2;\n mustRebuild = true;\n }\n } else {\n mustRebuild = true;\n }\n }\n // Remaining children must be collected and rebuilt into the appropriate structure\n if (mustRebuild) {\n let decorations = mapAndGatherRemainingDecorations(children, oldChildren, newLocal, mapping, offset, oldOffset, options);\n let built = buildTree(decorations, node, 0, options);\n newLocal = built.local;\n for (let i = 0; i < children.length; i += 3) if (children[i + 1] < 0) {\n children.splice(i, 3);\n i -= 3;\n }\n for (let i = 0, j = 0; i < built.children.length; i += 3) {\n let from = built.children[i];\n while (j < children.length && children[j] < from) j += 3;\n children.splice(j, 0, built.children[i], built.children[i + 1], built.children[i + 2]);\n }\n }\n return new DecorationSet(newLocal.sort(byPos), children);\n}\nfunction moveSpans(spans, offset) {\n if (!offset || !spans.length) return spans;\n let result = [];\n for (let i = 0; i < spans.length; i++) {\n let span = spans[i];\n result.push(new Decoration(span.from + offset, span.to + offset, span.type));\n }\n return result;\n}\nfunction mapAndGatherRemainingDecorations(children, oldChildren, decorations, mapping, offset, oldOffset, options) {\n // Gather all decorations from the remaining marked children\n function gather(set, oldOffset) {\n for (let i = 0; i < set.local.length; i++) {\n let mapped = set.local[i].map(mapping, offset, oldOffset);\n if (mapped) decorations.push(mapped);else if (options.onRemove) options.onRemove(set.local[i].spec);\n }\n for (let i = 0; i < set.children.length; i += 3) gather(set.children[i + 2], set.children[i] + oldOffset + 1);\n }\n for (let i = 0; i < children.length; i += 3) if (children[i + 1] == -1) gather(children[i + 2], oldChildren[i] + oldOffset + 1);\n return decorations;\n}\nfunction takeSpansForNode(spans, node, offset) {\n if (node.isLeaf) return null;\n let end = offset + node.nodeSize,\n found = null;\n for (let i = 0, span; i < spans.length; i++) {\n if ((span = spans[i]) && span.from > offset && span.to < end) {\n (found || (found = [])).push(span);\n spans[i] = null;\n }\n }\n return found;\n}\nfunction withoutNulls(array) {\n let result = [];\n for (let i = 0; i < array.length; i++) if (array[i] != null) result.push(array[i]);\n return result;\n}\n// Build up a tree that corresponds to a set of decorations. `offset`\n// is a base offset that should be subtracted from the `from` and `to`\n// positions in the spans (so that we don't have to allocate new spans\n// for recursive calls).\nfunction buildTree(spans, node, offset, options) {\n let children = [],\n hasNulls = false;\n node.forEach((childNode, localStart) => {\n let found = takeSpansForNode(spans, childNode, localStart + offset);\n if (found) {\n hasNulls = true;\n let subtree = buildTree(found, childNode, offset + localStart + 1, options);\n if (subtree != empty) children.push(localStart, localStart + childNode.nodeSize, subtree);\n }\n });\n let locals = moveSpans(hasNulls ? withoutNulls(spans) : spans, -offset).sort(byPos);\n for (let i = 0; i < locals.length; i++) if (!locals[i].type.valid(node, locals[i])) {\n if (options.onRemove) options.onRemove(locals[i].spec);\n locals.splice(i--, 1);\n }\n return locals.length || children.length ? new DecorationSet(locals, children) : empty;\n}\n// Used to sort decorations so that ones with a low start position\n// come first, and within a set with the same start position, those\n// with an smaller end position come first.\nfunction byPos(a, b) {\n return a.from - b.from || a.to - b.to;\n}\n// Scan a sorted array of decorations for partially overlapping spans,\n// and split those so that only fully overlapping spans are left (to\n// make subsequent rendering easier). Will return the input array if\n// no partially overlapping spans are found (the common case).\nfunction removeOverlap(spans) {\n let working = spans;\n for (let i = 0; i < working.length - 1; i++) {\n let span = working[i];\n if (span.from != span.to) for (let j = i + 1; j < working.length; j++) {\n let next = working[j];\n if (next.from == span.from) {\n if (next.to != span.to) {\n if (working == spans) working = spans.slice();\n // Followed by a partially overlapping larger span. Split that\n // span.\n working[j] = next.copy(next.from, span.to);\n insertAhead(working, j + 1, next.copy(span.to, next.to));\n }\n continue;\n } else {\n if (next.from < span.to) {\n if (working == spans) working = spans.slice();\n // The end of this one overlaps with a subsequent span. Split\n // this one.\n working[i] = span.copy(span.from, next.from);\n insertAhead(working, j, span.copy(next.from, span.to));\n }\n break;\n }\n }\n }\n return working;\n}\nfunction insertAhead(array, i, deco) {\n while (i < array.length && byPos(deco, array[i]) > 0) i++;\n array.splice(i, 0, deco);\n}\n// Get the decorations associated with the current props of a view.\nfunction viewDecorations(view) {\n let found = [];\n view.someProp(\"decorations\", f => {\n let result = f(view.state);\n if (result && result != empty) found.push(result);\n });\n if (view.cursorWrapper) found.push(DecorationSet.create(view.state.doc, [view.cursorWrapper.deco]));\n return DecorationGroup.from(found);\n}\nconst observeOptions = {\n childList: true,\n characterData: true,\n characterDataOldValue: true,\n attributes: true,\n attributeOldValue: true,\n subtree: true\n};\n// IE11 has very broken mutation observers, so we also listen to DOMCharacterDataModified\nconst useCharData = ie && ie_version <= 11;\nclass SelectionState {\n constructor() {\n this.anchorNode = null;\n this.anchorOffset = 0;\n this.focusNode = null;\n this.focusOffset = 0;\n }\n set(sel) {\n this.anchorNode = sel.anchorNode;\n this.anchorOffset = sel.anchorOffset;\n this.focusNode = sel.focusNode;\n this.focusOffset = sel.focusOffset;\n }\n clear() {\n this.anchorNode = this.focusNode = null;\n }\n eq(sel) {\n return sel.anchorNode == this.anchorNode && sel.anchorOffset == this.anchorOffset && sel.focusNode == this.focusNode && sel.focusOffset == this.focusOffset;\n }\n}\nclass DOMObserver {\n constructor(view, handleDOMChange) {\n this.view = view;\n this.handleDOMChange = handleDOMChange;\n this.queue = [];\n this.flushingSoon = -1;\n this.observer = null;\n this.currentSelection = new SelectionState();\n this.onCharData = null;\n this.suppressingSelectionUpdates = false;\n this.lastChangedTextNode = null;\n this.observer = window.MutationObserver && new window.MutationObserver(mutations => {\n for (let i = 0; i < mutations.length; i++) this.queue.push(mutations[i]);\n // IE11 will sometimes (on backspacing out a single character\n // text node after a BR node) call the observer callback\n // before actually updating the DOM, which will cause\n // ProseMirror to miss the change (see #930)\n if (ie && ie_version <= 11 && mutations.some(m => m.type == \"childList\" && m.removedNodes.length || m.type == \"characterData\" && m.oldValue.length > m.target.nodeValue.length)) this.flushSoon();else this.flush();\n });\n if (useCharData) {\n this.onCharData = e => {\n this.queue.push({\n target: e.target,\n type: \"characterData\",\n oldValue: e.prevValue\n });\n this.flushSoon();\n };\n }\n this.onSelectionChange = this.onSelectionChange.bind(this);\n }\n flushSoon() {\n if (this.flushingSoon < 0) this.flushingSoon = window.setTimeout(() => {\n this.flushingSoon = -1;\n this.flush();\n }, 20);\n }\n forceFlush() {\n if (this.flushingSoon > -1) {\n window.clearTimeout(this.flushingSoon);\n this.flushingSoon = -1;\n this.flush();\n }\n }\n start() {\n if (this.observer) {\n this.observer.takeRecords();\n this.observer.observe(this.view.dom, observeOptions);\n }\n if (this.onCharData) this.view.dom.addEventListener(\"DOMCharacterDataModified\", this.onCharData);\n this.connectSelection();\n }\n stop() {\n if (this.observer) {\n let take = this.observer.takeRecords();\n if (take.length) {\n for (let i = 0; i < take.length; i++) this.queue.push(take[i]);\n window.setTimeout(() => this.flush(), 20);\n }\n this.observer.disconnect();\n }\n if (this.onCharData) this.view.dom.removeEventListener(\"DOMCharacterDataModified\", this.onCharData);\n this.disconnectSelection();\n }\n connectSelection() {\n this.view.dom.ownerDocument.addEventListener(\"selectionchange\", this.onSelectionChange);\n }\n disconnectSelection() {\n this.view.dom.ownerDocument.removeEventListener(\"selectionchange\", this.onSelectionChange);\n }\n suppressSelectionUpdates() {\n this.suppressingSelectionUpdates = true;\n setTimeout(() => this.suppressingSelectionUpdates = false, 50);\n }\n onSelectionChange() {\n if (!hasFocusAndSelection(this.view)) return;\n if (this.suppressingSelectionUpdates) return selectionToDOM(this.view);\n // Deletions on IE11 fire their events in the wrong order, giving\n // us a selection change event before the DOM changes are\n // reported.\n if (ie && ie_version <= 11 && !this.view.state.selection.empty) {\n let sel = this.view.domSelectionRange();\n // Selection.isCollapsed isn't reliable on IE\n if (sel.focusNode && isEquivalentPosition(sel.focusNode, sel.focusOffset, sel.anchorNode, sel.anchorOffset)) return this.flushSoon();\n }\n this.flush();\n }\n setCurSelection() {\n this.currentSelection.set(this.view.domSelectionRange());\n }\n ignoreSelectionChange(sel) {\n if (!sel.focusNode) return true;\n let ancestors = new Set(),\n container;\n for (let scan = sel.focusNode; scan; scan = parentNode(scan)) ancestors.add(scan);\n for (let scan = sel.anchorNode; scan; scan = parentNode(scan)) if (ancestors.has(scan)) {\n container = scan;\n break;\n }\n let desc = container && this.view.docView.nearestDesc(container);\n if (desc && desc.ignoreMutation({\n type: \"selection\",\n target: container.nodeType == 3 ? container.parentNode : container\n })) {\n this.setCurSelection();\n return true;\n }\n }\n pendingRecords() {\n if (this.observer) for (let mut of this.observer.takeRecords()) this.queue.push(mut);\n return this.queue;\n }\n flush() {\n let {\n view\n } = this;\n if (!view.docView || this.flushingSoon > -1) return;\n let mutations = this.pendingRecords();\n if (mutations.length) this.queue = [];\n let sel = view.domSelectionRange();\n let newSel = !this.suppressingSelectionUpdates && !this.currentSelection.eq(sel) && hasFocusAndSelection(view) && !this.ignoreSelectionChange(sel);\n let from = -1,\n to = -1,\n typeOver = false,\n added = [];\n if (view.editable) {\n for (let i = 0; i < mutations.length; i++) {\n let result = this.registerMutation(mutations[i], added);\n if (result) {\n from = from < 0 ? result.from : Math.min(result.from, from);\n to = to < 0 ? result.to : Math.max(result.to, to);\n if (result.typeOver) typeOver = true;\n }\n }\n }\n if (gecko && added.length) {\n let brs = added.filter(n => n.nodeName == \"BR\");\n if (brs.length == 2) {\n let [a, b] = brs;\n if (a.parentNode && a.parentNode.parentNode == b.parentNode) b.remove();else a.remove();\n } else {\n let {\n focusNode\n } = this.currentSelection;\n for (let br of brs) {\n let parent = br.parentNode;\n if (parent && parent.nodeName == \"LI\" && (!focusNode || blockParent(view, focusNode) != parent)) br.remove();\n }\n }\n }\n let readSel = null;\n // If it looks like the browser has reset the selection to the\n // start of the document after focus, restore the selection from\n // the state\n if (from < 0 && newSel && view.input.lastFocus > Date.now() - 200 && Math.max(view.input.lastTouch, view.input.lastClick.time) < Date.now() - 300 && selectionCollapsed(sel) && (readSel = selectionFromDOM(view)) && readSel.eq(Selection.near(view.state.doc.resolve(0), 1))) {\n view.input.lastFocus = 0;\n selectionToDOM(view);\n this.currentSelection.set(sel);\n view.scrollToSelection();\n } else if (from > -1 || newSel) {\n if (from > -1) {\n view.docView.markDirty(from, to);\n checkCSS(view);\n }\n this.handleDOMChange(from, to, typeOver, added);\n if (view.docView && view.docView.dirty) view.updateState(view.state);else if (!this.currentSelection.eq(sel)) selectionToDOM(view);\n this.currentSelection.set(sel);\n }\n }\n registerMutation(mut, added) {\n // Ignore mutations inside nodes that were already noted as inserted\n if (added.indexOf(mut.target) > -1) return null;\n let desc = this.view.docView.nearestDesc(mut.target);\n if (mut.type == \"attributes\" && (desc == this.view.docView || mut.attributeName == \"contenteditable\" ||\n // Firefox sometimes fires spurious events for null/empty styles\n mut.attributeName == \"style\" && !mut.oldValue && !mut.target.getAttribute(\"style\"))) return null;\n if (!desc || desc.ignoreMutation(mut)) return null;\n if (mut.type == \"childList\") {\n for (let i = 0; i < mut.addedNodes.length; i++) {\n let node = mut.addedNodes[i];\n added.push(node);\n if (node.nodeType == 3) this.lastChangedTextNode = node;\n }\n if (desc.contentDOM && desc.contentDOM != desc.dom && !desc.contentDOM.contains(mut.target)) return {\n from: desc.posBefore,\n to: desc.posAfter\n };\n let prev = mut.previousSibling,\n next = mut.nextSibling;\n if (ie && ie_version <= 11 && mut.addedNodes.length) {\n // IE11 gives us incorrect next/prev siblings for some\n // insertions, so if there are added nodes, recompute those\n for (let i = 0; i < mut.addedNodes.length; i++) {\n let {\n previousSibling,\n nextSibling\n } = mut.addedNodes[i];\n if (!previousSibling || Array.prototype.indexOf.call(mut.addedNodes, previousSibling) < 0) prev = previousSibling;\n if (!nextSibling || Array.prototype.indexOf.call(mut.addedNodes, nextSibling) < 0) next = nextSibling;\n }\n }\n let fromOffset = prev && prev.parentNode == mut.target ? domIndex(prev) + 1 : 0;\n let from = desc.localPosFromDOM(mut.target, fromOffset, -1);\n let toOffset = next && next.parentNode == mut.target ? domIndex(next) : mut.target.childNodes.length;\n let to = desc.localPosFromDOM(mut.target, toOffset, 1);\n return {\n from,\n to\n };\n } else if (mut.type == \"attributes\") {\n return {\n from: desc.posAtStart - desc.border,\n to: desc.posAtEnd + desc.border\n };\n } else {\n // \"characterData\"\n this.lastChangedTextNode = mut.target;\n return {\n from: desc.posAtStart,\n to: desc.posAtEnd,\n // An event was generated for a text change that didn't change\n // any text. Mark the dom change to fall back to assuming the\n // selection was typed over with an identical value if it can't\n // find another change.\n typeOver: mut.target.nodeValue == mut.oldValue\n };\n }\n }\n}\nlet cssChecked = new WeakMap();\nlet cssCheckWarned = false;\nfunction checkCSS(view) {\n if (cssChecked.has(view)) return;\n cssChecked.set(view, null);\n if (['normal', 'nowrap', 'pre-line'].indexOf(getComputedStyle(view.dom).whiteSpace) !== -1) {\n view.requiresGeckoHackNode = gecko;\n if (cssCheckWarned) return;\n console[\"warn\"](\"ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package.\");\n cssCheckWarned = true;\n }\n}\nfunction rangeToSelectionRange(view, range) {\n let anchorNode = range.startContainer,\n anchorOffset = range.startOffset;\n let focusNode = range.endContainer,\n focusOffset = range.endOffset;\n let currentAnchor = view.domAtPos(view.state.selection.anchor);\n // Since such a range doesn't distinguish between anchor and head,\n // use a heuristic that flips it around if its end matches the\n // current anchor.\n if (isEquivalentPosition(currentAnchor.node, currentAnchor.offset, focusNode, focusOffset)) [anchorNode, anchorOffset, focusNode, focusOffset] = [focusNode, focusOffset, anchorNode, anchorOffset];\n return {\n anchorNode,\n anchorOffset,\n focusNode,\n focusOffset\n };\n}\n// Used to work around a Safari Selection/shadow DOM bug\n// Based on https://github.com/codemirror/dev/issues/414 fix\nfunction safariShadowSelectionRange(view, selection) {\n if (selection.getComposedRanges) {\n let range = selection.getComposedRanges(view.root)[0];\n if (range) return rangeToSelectionRange(view, range);\n }\n let found;\n function read(event) {\n event.preventDefault();\n event.stopImmediatePropagation();\n found = event.getTargetRanges()[0];\n }\n // Because Safari (at least in 2018-2022) doesn't provide regular\n // access to the selection inside a shadowRoot, we have to perform a\n // ridiculous hack to get at it—using `execCommand` to trigger a\n // `beforeInput` event so that we can read the target range from the\n // event.\n view.dom.addEventListener(\"beforeinput\", read, true);\n document.execCommand(\"indent\");\n view.dom.removeEventListener(\"beforeinput\", read, true);\n return found ? rangeToSelectionRange(view, found) : null;\n}\nfunction blockParent(view, node) {\n for (let p = node.parentNode; p && p != view.dom; p = p.parentNode) {\n let desc = view.docView.nearestDesc(p, true);\n if (desc && desc.node.isBlock) return p;\n }\n return null;\n}\n\n// Note that all referencing and parsing is done with the\n// start-of-operation selection and document, since that's the one\n// that the DOM represents. If any changes came in in the meantime,\n// the modification is mapped over those before it is applied, in\n// readDOMChange.\nfunction parseBetween(view, from_, to_) {\n let {\n node: parent,\n fromOffset,\n toOffset,\n from,\n to\n } = view.docView.parseRange(from_, to_);\n let domSel = view.domSelectionRange();\n let find;\n let anchor = domSel.anchorNode;\n if (anchor && view.dom.contains(anchor.nodeType == 1 ? anchor : anchor.parentNode)) {\n find = [{\n node: anchor,\n offset: domSel.anchorOffset\n }];\n if (!selectionCollapsed(domSel)) find.push({\n node: domSel.focusNode,\n offset: domSel.focusOffset\n });\n }\n // Work around issue in Chrome where backspacing sometimes replaces\n // the deleted content with a random BR node (issues #799, #831)\n if (chrome && view.input.lastKeyCode === 8) {\n for (let off = toOffset; off > fromOffset; off--) {\n let node = parent.childNodes[off - 1],\n desc = node.pmViewDesc;\n if (node.nodeName == \"BR\" && !desc) {\n toOffset = off;\n break;\n }\n if (!desc || desc.size) break;\n }\n }\n let startDoc = view.state.doc;\n let parser = view.someProp(\"domParser\") || DOMParser.fromSchema(view.state.schema);\n let $from = startDoc.resolve(from);\n let sel = null,\n doc = parser.parse(parent, {\n topNode: $from.parent,\n topMatch: $from.parent.contentMatchAt($from.index()),\n topOpen: true,\n from: fromOffset,\n to: toOffset,\n preserveWhitespace: $from.parent.type.whitespace == \"pre\" ? \"full\" : true,\n findPositions: find,\n ruleFromNode,\n context: $from\n });\n if (find && find[0].pos != null) {\n let anchor = find[0].pos,\n head = find[1] && find[1].pos;\n if (head == null) head = anchor;\n sel = {\n anchor: anchor + from,\n head: head + from\n };\n }\n return {\n doc,\n sel,\n from,\n to\n };\n}\nfunction ruleFromNode(dom) {\n let desc = dom.pmViewDesc;\n if (desc) {\n return desc.parseRule();\n } else if (dom.nodeName == \"BR\" && dom.parentNode) {\n // Safari replaces the list item or table cell with a BR\n // directly in the list node (?!) if you delete the last\n // character in a list item or table cell (#708, #862)\n if (safari && /^(ul|ol)$/i.test(dom.parentNode.nodeName)) {\n let skip = document.createElement(\"div\");\n skip.appendChild(document.createElement(\"li\"));\n return {\n skip\n };\n } else if (dom.parentNode.lastChild == dom || safari && /^(tr|table)$/i.test(dom.parentNode.nodeName)) {\n return {\n ignore: true\n };\n }\n } else if (dom.nodeName == \"IMG\" && dom.getAttribute(\"mark-placeholder\")) {\n return {\n ignore: true\n };\n }\n return null;\n}\nconst isInline = /^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;\nfunction readDOMChange(view, from, to, typeOver, addedNodes) {\n let compositionID = view.input.compositionPendingChanges || (view.composing ? view.input.compositionID : 0);\n view.input.compositionPendingChanges = 0;\n if (from < 0) {\n let origin = view.input.lastSelectionTime > Date.now() - 50 ? view.input.lastSelectionOrigin : null;\n let newSel = selectionFromDOM(view, origin);\n if (newSel && !view.state.selection.eq(newSel)) {\n if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) return;\n let tr = view.state.tr.setSelection(newSel);\n if (origin == \"pointer\") tr.setMeta(\"pointer\", true);else if (origin == \"key\") tr.scrollIntoView();\n if (compositionID) tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr);\n }\n return;\n }\n let $before = view.state.doc.resolve(from);\n let shared = $before.sharedDepth(to);\n from = $before.before(shared + 1);\n to = view.state.doc.resolve(to).after(shared + 1);\n let sel = view.state.selection;\n let parse = parseBetween(view, from, to);\n let doc = view.state.doc,\n compare = doc.slice(parse.from, parse.to);\n let preferredPos, preferredSide;\n // Prefer anchoring to end when Backspace is pressed\n if (view.input.lastKeyCode === 8 && Date.now() - 100 < view.input.lastKeyCodeTime) {\n preferredPos = view.state.selection.to;\n preferredSide = \"end\";\n } else {\n preferredPos = view.state.selection.from;\n preferredSide = \"start\";\n }\n view.input.lastKeyCode = null;\n let change = findDiff(compare.content, parse.doc.content, parse.from, preferredPos, preferredSide);\n if (change) view.input.domChangeCount++;\n if ((ios && view.input.lastIOSEnter > Date.now() - 225 || android) && addedNodes.some(n => n.nodeType == 1 && !isInline.test(n.nodeName)) && (!change || change.endA >= change.endB) && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n view.input.lastIOSEnter = 0;\n return;\n }\n if (!change) {\n if (typeOver && sel instanceof TextSelection && !sel.empty && sel.$head.sameParent(sel.$anchor) && !view.composing && !(parse.sel && parse.sel.anchor != parse.sel.head)) {\n change = {\n start: sel.from,\n endA: sel.to,\n endB: sel.to\n };\n } else {\n if (parse.sel) {\n let sel = resolveSelection(view, view.state.doc, parse.sel);\n if (sel && !sel.eq(view.state.selection)) {\n let tr = view.state.tr.setSelection(sel);\n if (compositionID) tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr);\n }\n }\n return;\n }\n }\n // Handle the case where overwriting a selection by typing matches\n // the start or end of the selected content, creating a change\n // that's smaller than what was actually overwritten.\n if (view.state.selection.from < view.state.selection.to && change.start == change.endB && view.state.selection instanceof TextSelection) {\n if (change.start > view.state.selection.from && change.start <= view.state.selection.from + 2 && view.state.selection.from >= parse.from) {\n change.start = view.state.selection.from;\n } else if (change.endA < view.state.selection.to && change.endA >= view.state.selection.to - 2 && view.state.selection.to <= parse.to) {\n change.endB += view.state.selection.to - change.endA;\n change.endA = view.state.selection.to;\n }\n }\n // IE11 will insert a non-breaking space _ahead_ of the space after\n // the cursor space when adding a space before another space. When\n // that happened, adjust the change to cover the space instead.\n if (ie && ie_version <= 11 && change.endB == change.start + 1 && change.endA == change.start && change.start > parse.from && parse.doc.textBetween(change.start - parse.from - 1, change.start - parse.from + 1) == \" \\u00a0\") {\n change.start--;\n change.endA--;\n change.endB--;\n }\n let $from = parse.doc.resolveNoCache(change.start - parse.from);\n let $to = parse.doc.resolveNoCache(change.endB - parse.from);\n let $fromA = doc.resolve(change.start);\n let inlineChange = $from.sameParent($to) && $from.parent.inlineContent && $fromA.end() >= change.endA;\n let nextSel;\n // If this looks like the effect of pressing Enter (or was recorded\n // as being an iOS enter press), just dispatch an Enter key instead.\n if ((ios && view.input.lastIOSEnter > Date.now() - 225 && (!inlineChange || addedNodes.some(n => n.nodeName == \"DIV\" || n.nodeName == \"P\")) || !inlineChange && $from.pos < parse.doc.content.size && !$from.sameParent($to) && (nextSel = Selection.findFrom(parse.doc.resolve($from.pos + 1), 1, true)) && nextSel.head == $to.pos) && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(13, \"Enter\")))) {\n view.input.lastIOSEnter = 0;\n return;\n }\n // Same for backspace\n if (view.state.selection.anchor > change.start && looksLikeBackspace(doc, change.start, change.endA, $from, $to) && view.someProp(\"handleKeyDown\", f => f(view, keyEvent(8, \"Backspace\")))) {\n if (android && chrome) view.domObserver.suppressSelectionUpdates(); // #820\n return;\n }\n // Chrome will occasionally, during composition, delete the\n // entire composition and then immediately insert it again. This is\n // used to detect that situation.\n if (chrome && change.endB == change.start) view.input.lastChromeDelete = Date.now();\n // This tries to detect Android virtual keyboard\n // enter-and-pick-suggestion action. That sometimes (see issue\n // #1059) first fires a DOM mutation, before moving the selection to\n // the newly created block. And then, because ProseMirror cleans up\n // the DOM selection, it gives up moving the selection entirely,\n // leaving the cursor in the wrong place. When that happens, we drop\n // the new paragraph from the initial change, and fire a simulated\n // enter key afterwards.\n if (android && !inlineChange && $from.start() != $to.start() && $to.parentOffset == 0 && $from.depth == $to.depth && parse.sel && parse.sel.anchor == parse.sel.head && parse.sel.head == change.endA) {\n change.endB -= 2;\n $to = parse.doc.resolveNoCache(change.endB - parse.from);\n setTimeout(() => {\n view.someProp(\"handleKeyDown\", function (f) {\n return f(view, keyEvent(13, \"Enter\"));\n });\n }, 20);\n }\n let chFrom = change.start,\n chTo = change.endA;\n let tr, storedMarks, markChange;\n if (inlineChange) {\n if ($from.pos == $to.pos) {\n // Deletion\n // IE11 sometimes weirdly moves the DOM selection around after\n // backspacing out the first element in a textblock\n if (ie && ie_version <= 11 && $from.parentOffset == 0) {\n view.domObserver.suppressSelectionUpdates();\n setTimeout(() => selectionToDOM(view), 20);\n }\n tr = view.state.tr.delete(chFrom, chTo);\n storedMarks = doc.resolve(change.start).marksAcross(doc.resolve(change.endA));\n } else if (\n // Adding or removing a mark\n change.endA == change.endB && (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))) {\n tr = view.state.tr;\n if (markChange.type == \"add\") tr.addMark(chFrom, chTo, markChange.mark);else tr.removeMark(chFrom, chTo, markChange.mark);\n } else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {\n // Both positions in the same text node -- simply insert text\n let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);\n if (view.someProp(\"handleTextInput\", f => f(view, chFrom, chTo, text))) return;\n tr = view.state.tr.insertText(text, chFrom, chTo);\n }\n }\n if (!tr) tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));\n if (parse.sel) {\n let sel = resolveSelection(view, tr.doc, parse.sel);\n // Chrome will sometimes, during composition, report the\n // selection in the wrong place. If it looks like that is\n // happening, don't update the selection.\n // Edge just doesn't move the cursor forward when you start typing\n // in an empty block or between br nodes.\n if (sel && !(chrome && view.composing && sel.empty && (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) && (sel.head == chFrom || sel.head == tr.mapping.map(chTo) - 1) || ie && sel.empty && sel.head == chFrom)) tr.setSelection(sel);\n }\n if (storedMarks) tr.ensureMarks(storedMarks);\n if (compositionID) tr.setMeta(\"composition\", compositionID);\n view.dispatch(tr.scrollIntoView());\n}\nfunction resolveSelection(view, doc, parsedSel) {\n if (Math.max(parsedSel.anchor, parsedSel.head) > doc.content.size) return null;\n return selectionBetween(view, doc.resolve(parsedSel.anchor), doc.resolve(parsedSel.head));\n}\n// Given two same-length, non-empty fragments of inline content,\n// determine whether the first could be created from the second by\n// removing or adding a single mark type.\nfunction isMarkChange(cur, prev) {\n let curMarks = cur.firstChild.marks,\n prevMarks = prev.firstChild.marks;\n let added = curMarks,\n removed = prevMarks,\n type,\n mark,\n update;\n for (let i = 0; i < prevMarks.length; i++) added = prevMarks[i].removeFromSet(added);\n for (let i = 0; i < curMarks.length; i++) removed = curMarks[i].removeFromSet(removed);\n if (added.length == 1 && removed.length == 0) {\n mark = added[0];\n type = \"add\";\n update = node => node.mark(mark.addToSet(node.marks));\n } else if (added.length == 0 && removed.length == 1) {\n mark = removed[0];\n type = \"remove\";\n update = node => node.mark(mark.removeFromSet(node.marks));\n } else {\n return null;\n }\n let updated = [];\n for (let i = 0; i < prev.childCount; i++) updated.push(update(prev.child(i)));\n if (Fragment.from(updated).eq(cur)) return {\n mark,\n type\n };\n}\nfunction looksLikeBackspace(old, start, end, $newStart, $newEnd) {\n if (\n // The content must have shrunk\n end - start <= $newEnd.pos - $newStart.pos ||\n // newEnd must point directly at or after the end of the block that newStart points into\n skipClosingAndOpening($newStart, true, false) < $newEnd.pos) return false;\n let $start = old.resolve(start);\n // Handle the case where, rather than joining blocks, the change just removed an entire block\n if (!$newStart.parent.isTextblock) {\n let after = $start.nodeAfter;\n return after != null && end == start + after.nodeSize;\n }\n // Start must be at the end of a block\n if ($start.parentOffset < $start.parent.content.size || !$start.parent.isTextblock) return false;\n let $next = old.resolve(skipClosingAndOpening($start, true, true));\n // The next textblock must start before end and end near it\n if (!$next.parent.isTextblock || $next.pos > end || skipClosingAndOpening($next, true, false) < end) return false;\n // The fragments after the join point must match\n return $newStart.parent.content.cut($newStart.parentOffset).eq($next.parent.content);\n}\nfunction skipClosingAndOpening($pos, fromEnd, mayOpen) {\n let depth = $pos.depth,\n end = fromEnd ? $pos.end() : $pos.pos;\n while (depth > 0 && (fromEnd || $pos.indexAfter(depth) == $pos.node(depth).childCount)) {\n depth--;\n end++;\n fromEnd = false;\n }\n if (mayOpen) {\n let next = $pos.node(depth).maybeChild($pos.indexAfter(depth));\n while (next && !next.isLeaf) {\n next = next.firstChild;\n end++;\n }\n }\n return end;\n}\nfunction findDiff(a, b, pos, preferredPos, preferredSide) {\n let start = a.findDiffStart(b, pos);\n if (start == null) return null;\n let {\n a: endA,\n b: endB\n } = a.findDiffEnd(b, pos + a.size, pos + b.size);\n if (preferredSide == \"end\") {\n let adjust = Math.max(0, start - Math.min(endA, endB));\n preferredPos -= endA + adjust - start;\n }\n if (endA < start && a.size < b.size) {\n let move = preferredPos <= start && preferredPos >= endA ? start - preferredPos : 0;\n start -= move;\n if (start && start < b.size && isSurrogatePair(b.textBetween(start - 1, start + 1))) start += move ? 1 : -1;\n endB = start + (endB - endA);\n endA = start;\n } else if (endB < start) {\n let move = preferredPos <= start && preferredPos >= endB ? start - preferredPos : 0;\n start -= move;\n if (start && start < a.size && isSurrogatePair(a.textBetween(start - 1, start + 1))) start += move ? 1 : -1;\n endA = start + (endA - endB);\n endB = start;\n }\n return {\n start,\n endA,\n endB\n };\n}\nfunction isSurrogatePair(str) {\n if (str.length != 2) return false;\n let a = str.charCodeAt(0),\n b = str.charCodeAt(1);\n return a >= 0xDC00 && a <= 0xDFFF && b >= 0xD800 && b <= 0xDBFF;\n}\n\n/**\n@internal\n*/\nconst __serializeForClipboard = serializeForClipboard;\n/**\n@internal\n*/\nconst __parseFromClipboard = parseFromClipboard;\n/**\n@internal\n*/\nconst __endComposition = endComposition;\n/**\nAn editor view manages the DOM structure that represents an\neditable document. Its state and behavior are determined by its\n[props](https://prosemirror.net/docs/ref/#view.DirectEditorProps).\n*/\nclass EditorView {\n /**\n Create a view. `place` may be a DOM node that the editor should\n be appended to, a function that will place it into the document,\n or an object whose `mount` property holds the node to use as the\n document container. If it is `null`, the editor will not be\n added to the document.\n */\n constructor(place, props) {\n this._root = null;\n /**\n @internal\n */\n this.focused = false;\n /**\n Kludge used to work around a Chrome bug @internal\n */\n this.trackWrites = null;\n this.mounted = false;\n /**\n @internal\n */\n this.markCursor = null;\n /**\n @internal\n */\n this.cursorWrapper = null;\n /**\n @internal\n */\n this.lastSelectedViewDesc = undefined;\n /**\n @internal\n */\n this.input = new InputState();\n this.prevDirectPlugins = [];\n this.pluginViews = [];\n /**\n Holds `true` when a hack node is needed in Firefox to prevent the\n [space is eaten issue](https://github.com/ProseMirror/prosemirror/issues/651)\n @internal\n */\n this.requiresGeckoHackNode = false;\n /**\n When editor content is being dragged, this object contains\n information about the dragged slice and whether it is being\n copied or moved. At any other time, it is null.\n */\n this.dragging = null;\n this._props = props;\n this.state = props.state;\n this.directPlugins = props.plugins || [];\n this.directPlugins.forEach(checkStateComponent);\n this.dispatch = this.dispatch.bind(this);\n this.dom = place && place.mount || document.createElement(\"div\");\n if (place) {\n if (place.appendChild) place.appendChild(this.dom);else if (typeof place == \"function\") place(this.dom);else if (place.mount) this.mounted = true;\n }\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n this.nodeViews = buildNodeViews(this);\n this.docView = docViewDesc(this.state.doc, computeDocDeco(this), viewDecorations(this), this.dom, this);\n this.domObserver = new DOMObserver(this, (from, to, typeOver, added) => readDOMChange(this, from, to, typeOver, added));\n this.domObserver.start();\n initInput(this);\n this.updatePluginViews();\n }\n /**\n Holds `true` when a\n [composition](https://w3c.github.io/uievents/#events-compositionevents)\n is active.\n */\n get composing() {\n return this.input.composing;\n }\n /**\n The view's current [props](https://prosemirror.net/docs/ref/#view.EditorProps).\n */\n get props() {\n if (this._props.state != this.state) {\n let prev = this._props;\n this._props = {};\n for (let name in prev) this._props[name] = prev[name];\n this._props.state = this.state;\n }\n return this._props;\n }\n /**\n Update the view's props. Will immediately cause an update to\n the DOM.\n */\n update(props) {\n if (props.handleDOMEvents != this._props.handleDOMEvents) ensureListeners(this);\n let prevProps = this._props;\n this._props = props;\n if (props.plugins) {\n props.plugins.forEach(checkStateComponent);\n this.directPlugins = props.plugins;\n }\n this.updateStateInner(props.state, prevProps);\n }\n /**\n Update the view by updating existing props object with the object\n given as argument. Equivalent to `view.update(Object.assign({},\n view.props, props))`.\n */\n setProps(props) {\n let updated = {};\n for (let name in this._props) updated[name] = this._props[name];\n updated.state = this.state;\n for (let name in props) updated[name] = props[name];\n this.update(updated);\n }\n /**\n Update the editor's `state` prop, without touching any of the\n other props.\n */\n updateState(state) {\n this.updateStateInner(state, this._props);\n }\n updateStateInner(state, prevProps) {\n var _a;\n let prev = this.state,\n redraw = false,\n updateSel = false;\n // When stored marks are added, stop composition, so that they can\n // be displayed.\n if (state.storedMarks && this.composing) {\n clearComposition(this);\n updateSel = true;\n }\n this.state = state;\n let pluginsChanged = prev.plugins != state.plugins || this._props.plugins != prevProps.plugins;\n if (pluginsChanged || this._props.plugins != prevProps.plugins || this._props.nodeViews != prevProps.nodeViews) {\n let nodeViews = buildNodeViews(this);\n if (changedNodeViews(nodeViews, this.nodeViews)) {\n this.nodeViews = nodeViews;\n redraw = true;\n }\n }\n if (pluginsChanged || prevProps.handleDOMEvents != this._props.handleDOMEvents) {\n ensureListeners(this);\n }\n this.editable = getEditable(this);\n updateCursorWrapper(this);\n let innerDeco = viewDecorations(this),\n outerDeco = computeDocDeco(this);\n let scroll = prev.plugins != state.plugins && !prev.doc.eq(state.doc) ? \"reset\" : state.scrollToSelection > prev.scrollToSelection ? \"to selection\" : \"preserve\";\n let updateDoc = redraw || !this.docView.matchesNode(state.doc, outerDeco, innerDeco);\n if (updateDoc || !state.selection.eq(prev.selection)) updateSel = true;\n let oldScrollPos = scroll == \"preserve\" && updateSel && this.dom.style.overflowAnchor == null && storeScrollPos(this);\n if (updateSel) {\n this.domObserver.stop();\n // Work around an issue in Chrome, IE, and Edge where changing\n // the DOM around an active selection puts it into a broken\n // state where the thing the user sees differs from the\n // selection reported by the Selection object (#710, #973,\n // #1011, #1013, #1035).\n let forceSelUpdate = updateDoc && (ie || chrome) && !this.composing && !prev.selection.empty && !state.selection.empty && selectionContextChanged(prev.selection, state.selection);\n if (updateDoc) {\n // If the node that the selection points into is written to,\n // Chrome sometimes starts misreporting the selection, so this\n // tracks that and forces a selection reset when our update\n // did write to the node.\n let chromeKludge = chrome ? this.trackWrites = this.domSelectionRange().focusNode : null;\n if (this.composing) this.input.compositionNode = findCompositionNode(this);\n if (redraw || !this.docView.update(state.doc, outerDeco, innerDeco, this)) {\n this.docView.updateOuterDeco(outerDeco);\n this.docView.destroy();\n this.docView = docViewDesc(state.doc, outerDeco, innerDeco, this.dom, this);\n }\n if (chromeKludge && !this.trackWrites) forceSelUpdate = true;\n }\n // Work around for an issue where an update arriving right between\n // a DOM selection change and the \"selectionchange\" event for it\n // can cause a spurious DOM selection update, disrupting mouse\n // drag selection.\n if (forceSelUpdate || !(this.input.mouseDown && this.domObserver.currentSelection.eq(this.domSelectionRange()) && anchorInRightPlace(this))) {\n selectionToDOM(this, forceSelUpdate);\n } else {\n syncNodeSelection(this, state.selection);\n this.domObserver.setCurSelection();\n }\n this.domObserver.start();\n }\n this.updatePluginViews(prev);\n if (((_a = this.dragging) === null || _a === void 0 ? void 0 : _a.node) && !prev.doc.eq(state.doc)) this.updateDraggedNode(this.dragging, prev);\n if (scroll == \"reset\") {\n this.dom.scrollTop = 0;\n } else if (scroll == \"to selection\") {\n this.scrollToSelection();\n } else if (oldScrollPos) {\n resetScrollPos(oldScrollPos);\n }\n }\n /**\n @internal\n */\n scrollToSelection() {\n let startDOM = this.domSelectionRange().focusNode;\n if (this.someProp(\"handleScrollToSelection\", f => f(this))) ;else if (this.state.selection instanceof NodeSelection) {\n let target = this.docView.domAfterPos(this.state.selection.from);\n if (target.nodeType == 1) scrollRectIntoView(this, target.getBoundingClientRect(), startDOM);\n } else {\n scrollRectIntoView(this, this.coordsAtPos(this.state.selection.head, 1), startDOM);\n }\n }\n destroyPluginViews() {\n let view;\n while (view = this.pluginViews.pop()) if (view.destroy) view.destroy();\n }\n updatePluginViews(prevState) {\n if (!prevState || prevState.plugins != this.state.plugins || this.directPlugins != this.prevDirectPlugins) {\n this.prevDirectPlugins = this.directPlugins;\n this.destroyPluginViews();\n for (let i = 0; i < this.directPlugins.length; i++) {\n let plugin = this.directPlugins[i];\n if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));\n }\n for (let i = 0; i < this.state.plugins.length; i++) {\n let plugin = this.state.plugins[i];\n if (plugin.spec.view) this.pluginViews.push(plugin.spec.view(this));\n }\n } else {\n for (let i = 0; i < this.pluginViews.length; i++) {\n let pluginView = this.pluginViews[i];\n if (pluginView.update) pluginView.update(this, prevState);\n }\n }\n }\n updateDraggedNode(dragging, prev) {\n let sel = dragging.node,\n found = -1;\n if (this.state.doc.nodeAt(sel.from) == sel.node) {\n found = sel.from;\n } else {\n let movedPos = sel.from + (this.state.doc.content.size - prev.doc.content.size);\n let moved = movedPos > 0 && this.state.doc.nodeAt(movedPos);\n if (moved == sel.node) found = movedPos;\n }\n this.dragging = new Dragging(dragging.slice, dragging.move, found < 0 ? undefined : NodeSelection.create(this.state.doc, found));\n }\n someProp(propName, f) {\n let prop = this._props && this._props[propName],\n value;\n if (prop != null && (value = f ? f(prop) : prop)) return value;\n for (let i = 0; i < this.directPlugins.length; i++) {\n let prop = this.directPlugins[i].props[propName];\n if (prop != null && (value = f ? f(prop) : prop)) return value;\n }\n let plugins = this.state.plugins;\n if (plugins) for (let i = 0; i < plugins.length; i++) {\n let prop = plugins[i].props[propName];\n if (prop != null && (value = f ? f(prop) : prop)) return value;\n }\n }\n /**\n Query whether the view has focus.\n */\n hasFocus() {\n // Work around IE not handling focus correctly if resize handles are shown.\n // If the cursor is inside an element with resize handles, activeElement\n // will be that element instead of this.dom.\n if (ie) {\n // If activeElement is within this.dom, and there are no other elements\n // setting `contenteditable` to false in between, treat it as focused.\n let node = this.root.activeElement;\n if (node == this.dom) return true;\n if (!node || !this.dom.contains(node)) return false;\n while (node && this.dom != node && this.dom.contains(node)) {\n if (node.contentEditable == 'false') return false;\n node = node.parentElement;\n }\n return true;\n }\n return this.root.activeElement == this.dom;\n }\n /**\n Focus the editor.\n */\n focus() {\n this.domObserver.stop();\n if (this.editable) focusPreventScroll(this.dom);\n selectionToDOM(this);\n this.domObserver.start();\n }\n /**\n Get the document root in which the editor exists. This will\n usually be the top-level `document`, but might be a [shadow\n DOM](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Shadow_DOM)\n root if the editor is inside one.\n */\n get root() {\n let cached = this._root;\n if (cached == null) for (let search = this.dom.parentNode; search; search = search.parentNode) {\n if (search.nodeType == 9 || search.nodeType == 11 && search.host) {\n if (!search.getSelection) Object.getPrototypeOf(search).getSelection = () => search.ownerDocument.getSelection();\n return this._root = search;\n }\n }\n return cached || document;\n }\n /**\n When an existing editor view is moved to a new document or\n shadow tree, call this to make it recompute its root.\n */\n updateRoot() {\n this._root = null;\n }\n /**\n Given a pair of viewport coordinates, return the document\n position that corresponds to them. May return null if the given\n coordinates aren't inside of the editor. When an object is\n returned, its `pos` property is the position nearest to the\n coordinates, and its `inside` property holds the position of the\n inner node that the position falls inside of, or -1 if it is at\n the top level, not in any node.\n */\n posAtCoords(coords) {\n return posAtCoords(this, coords);\n }\n /**\n Returns the viewport rectangle at a given document position.\n `left` and `right` will be the same number, as this returns a\n flat cursor-ish rectangle. If the position is between two things\n that aren't directly adjacent, `side` determines which element\n is used. When < 0, the element before the position is used,\n otherwise the element after.\n */\n coordsAtPos(pos, side = 1) {\n return coordsAtPos(this, pos, side);\n }\n /**\n Find the DOM position that corresponds to the given document\n position. When `side` is negative, find the position as close as\n possible to the content before the position. When positive,\n prefer positions close to the content after the position. When\n zero, prefer as shallow a position as possible.\n \n Note that you should **not** mutate the editor's internal DOM,\n only inspect it (and even that is usually not necessary).\n */\n domAtPos(pos, side = 0) {\n return this.docView.domFromPos(pos, side);\n }\n /**\n Find the DOM node that represents the document node after the\n given position. May return `null` when the position doesn't point\n in front of a node or if the node is inside an opaque node view.\n \n This is intended to be able to call things like\n `getBoundingClientRect` on that DOM node. Do **not** mutate the\n editor DOM directly, or add styling this way, since that will be\n immediately overriden by the editor as it redraws the node.\n */\n nodeDOM(pos) {\n let desc = this.docView.descAt(pos);\n return desc ? desc.nodeDOM : null;\n }\n /**\n Find the document position that corresponds to a given DOM\n position. (Whenever possible, it is preferable to inspect the\n document structure directly, rather than poking around in the\n DOM, but sometimes—for example when interpreting an event\n target—you don't have a choice.)\n \n The `bias` parameter can be used to influence which side of a DOM\n node to use when the position is inside a leaf node.\n */\n posAtDOM(node, offset, bias = -1) {\n let pos = this.docView.posFromDOM(node, offset, bias);\n if (pos == null) throw new RangeError(\"DOM position not inside the editor\");\n return pos;\n }\n /**\n Find out whether the selection is at the end of a textblock when\n moving in a given direction. When, for example, given `\"left\"`,\n it will return true if moving left from the current cursor\n position would leave that position's parent textblock. Will apply\n to the view's current state by default, but it is possible to\n pass a different state.\n */\n endOfTextblock(dir, state) {\n return endOfTextblock(this, state || this.state, dir);\n }\n /**\n Run the editor's paste logic with the given HTML string. The\n `event`, if given, will be passed to the\n [`handlePaste`](https://prosemirror.net/docs/ref/#view.EditorProps.handlePaste) hook.\n */\n pasteHTML(html, event) {\n return doPaste(this, \"\", html, false, event || new ClipboardEvent(\"paste\"));\n }\n /**\n Run the editor's paste logic with the given plain-text input.\n */\n pasteText(text, event) {\n return doPaste(this, text, null, true, event || new ClipboardEvent(\"paste\"));\n }\n /**\n Removes the editor from the DOM and destroys all [node\n views](https://prosemirror.net/docs/ref/#view.NodeView).\n */\n destroy() {\n if (!this.docView) return;\n destroyInput(this);\n this.destroyPluginViews();\n if (this.mounted) {\n this.docView.update(this.state.doc, [], viewDecorations(this), this);\n this.dom.textContent = \"\";\n } else if (this.dom.parentNode) {\n this.dom.parentNode.removeChild(this.dom);\n }\n this.docView.destroy();\n this.docView = null;\n clearReusedRange();\n }\n /**\n This is true when the view has been\n [destroyed](https://prosemirror.net/docs/ref/#view.EditorView.destroy) (and thus should not be\n used anymore).\n */\n get isDestroyed() {\n return this.docView == null;\n }\n /**\n Used for testing.\n */\n dispatchEvent(event) {\n return dispatchEvent(this, event);\n }\n /**\n Dispatch a transaction. Will call\n [`dispatchTransaction`](https://prosemirror.net/docs/ref/#view.DirectEditorProps.dispatchTransaction)\n when given, and otherwise defaults to applying the transaction to\n the current state and calling\n [`updateState`](https://prosemirror.net/docs/ref/#view.EditorView.updateState) with the result.\n This method is bound to the view instance, so that it can be\n easily passed around.\n */\n dispatch(tr) {\n let dispatchTransaction = this._props.dispatchTransaction;\n if (dispatchTransaction) dispatchTransaction.call(this, tr);else this.updateState(this.state.apply(tr));\n }\n /**\n @internal\n */\n domSelectionRange() {\n let sel = this.domSelection();\n if (!sel) return {\n focusNode: null,\n focusOffset: 0,\n anchorNode: null,\n anchorOffset: 0\n };\n return safari && this.root.nodeType === 11 && deepActiveElement(this.dom.ownerDocument) == this.dom && safariShadowSelectionRange(this, sel) || sel;\n }\n /**\n @internal\n */\n domSelection() {\n return this.root.getSelection();\n }\n}\nfunction computeDocDeco(view) {\n let attrs = Object.create(null);\n attrs.class = \"ProseMirror\";\n attrs.contenteditable = String(view.editable);\n view.someProp(\"attributes\", value => {\n if (typeof value == \"function\") value = value(view.state);\n if (value) for (let attr in value) {\n if (attr == \"class\") attrs.class += \" \" + value[attr];else if (attr == \"style\") attrs.style = (attrs.style ? attrs.style + \";\" : \"\") + value[attr];else if (!attrs[attr] && attr != \"contenteditable\" && attr != \"nodeName\") attrs[attr] = String(value[attr]);\n }\n });\n if (!attrs.translate) attrs.translate = \"no\";\n return [Decoration.node(0, view.state.doc.content.size, attrs)];\n}\nfunction updateCursorWrapper(view) {\n if (view.markCursor) {\n let dom = document.createElement(\"img\");\n dom.className = \"ProseMirror-separator\";\n dom.setAttribute(\"mark-placeholder\", \"true\");\n dom.setAttribute(\"alt\", \"\");\n view.cursorWrapper = {\n dom,\n deco: Decoration.widget(view.state.selection.from, dom, {\n raw: true,\n marks: view.markCursor\n })\n };\n } else {\n view.cursorWrapper = null;\n }\n}\nfunction getEditable(view) {\n return !view.someProp(\"editable\", value => value(view.state) === false);\n}\nfunction selectionContextChanged(sel1, sel2) {\n let depth = Math.min(sel1.$anchor.sharedDepth(sel1.head), sel2.$anchor.sharedDepth(sel2.head));\n return sel1.$anchor.start(depth) != sel2.$anchor.start(depth);\n}\nfunction buildNodeViews(view) {\n let result = Object.create(null);\n function add(obj) {\n for (let prop in obj) if (!Object.prototype.hasOwnProperty.call(result, prop)) result[prop] = obj[prop];\n }\n view.someProp(\"nodeViews\", add);\n view.someProp(\"markViews\", add);\n return result;\n}\nfunction changedNodeViews(a, b) {\n let nA = 0,\n nB = 0;\n for (let prop in a) {\n if (a[prop] != b[prop]) return true;\n nA++;\n }\n for (let _ in b) nB++;\n return nA != nB;\n}\nfunction checkStateComponent(plugin) {\n if (plugin.spec.state || plugin.spec.filterTransaction || plugin.spec.appendTransaction) throw new RangeError(\"Plugins passed directly to the view must not have a state component\");\n}\nexport { Decoration, DecorationSet, EditorView, __endComposition, __parseFromClipboard, __serializeForClipboard };","export var base = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 10: \"Enter\",\n 12: \"NumLock\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 44: \"PrintScreen\",\n 45: \"Insert\",\n 46: \"Delete\",\n 59: \";\",\n 61: \"=\",\n 91: \"Meta\",\n 92: \"Meta\",\n 106: \"*\",\n 107: \"+\",\n 108: \",\",\n 109: \"-\",\n 110: \".\",\n 111: \"/\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 160: \"Shift\",\n 161: \"Shift\",\n 162: \"Control\",\n 163: \"Control\",\n 164: \"Alt\",\n 165: \"Alt\",\n 173: \"-\",\n 186: \";\",\n 187: \"=\",\n 188: \",\",\n 189: \"-\",\n 190: \".\",\n 191: \"/\",\n 192: \"`\",\n 219: \"[\",\n 220: \"\\\\\",\n 221: \"]\",\n 222: \"'\"\n};\nexport var shift = {\n 48: \")\",\n 49: \"!\",\n 50: \"@\",\n 51: \"#\",\n 52: \"$\",\n 53: \"%\",\n 54: \"^\",\n 55: \"&\",\n 56: \"*\",\n 57: \"(\",\n 59: \":\",\n 61: \"+\",\n 173: \"_\",\n 186: \":\",\n 187: \"+\",\n 188: \"<\",\n 189: \"_\",\n 190: \">\",\n 191: \"?\",\n 192: \"~\",\n 219: \"{\",\n 220: \"|\",\n 221: \"}\",\n 222: \"\\\"\"\n};\nvar mac = typeof navigator != \"undefined\" && /Mac/.test(navigator.platform);\nvar ie = typeof navigator != \"undefined\" && /MSIE \\d|Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(navigator.userAgent);\n\n// Fill in the digit keys\nfor (var i = 0; i < 10; i++) base[48 + i] = base[96 + i] = String(i);\n\n// The function keys\nfor (var i = 1; i <= 24; i++) base[i + 111] = \"F\" + i;\n\n// And the alphabetic keys\nfor (var i = 65; i <= 90; i++) {\n base[i] = String.fromCharCode(i + 32);\n shift[i] = String.fromCharCode(i);\n}\n\n// For each code that doesn't have a shift-equivalent, copy the base name\nfor (var code in base) if (!shift.hasOwnProperty(code)) shift[code] = base[code];\nexport function keyName(event) {\n // On macOS, keys held with Shift and Cmd don't reflect the effect of Shift in `.key`.\n // On IE, shift effect is never included in `.key`.\n var ignoreKey = mac && event.metaKey && event.shiftKey && !event.ctrlKey && !event.altKey || ie && event.shiftKey && event.key && event.key.length == 1 || event.key == \"Unidentified\";\n var name = !ignoreKey && event.key || (event.shiftKey ? shift : base)[event.keyCode] || event.key || \"Unidentified\";\n // Edge sometimes produces wrong names (Issue #3)\n if (name == \"Esc\") name = \"Escape\";\n if (name == \"Del\") name = \"Delete\";\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8860571/\n if (name == \"Left\") name = \"ArrowLeft\";\n if (name == \"Up\") name = \"ArrowUp\";\n if (name == \"Right\") name = \"ArrowRight\";\n if (name == \"Down\") name = \"ArrowDown\";\n return name;\n}","import { keyName, base } from 'w3c-keyname';\nimport { Plugin } from 'prosemirror-state';\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform) : false;\nfunction normalizeKeyName(name) {\n let parts = name.split(/-(?!$)/),\n result = parts[parts.length - 1];\n if (result == \"Space\") result = \" \";\n let alt, ctrl, shift, meta;\n for (let i = 0; i < parts.length - 1; i++) {\n let mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) meta = true;else if (/^a(lt)?$/i.test(mod)) alt = true;else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true;else if (/^s(hift)?$/i.test(mod)) shift = true;else if (/^mod$/i.test(mod)) {\n if (mac) meta = true;else ctrl = true;\n } else throw new Error(\"Unrecognized modifier name: \" + mod);\n }\n if (alt) result = \"Alt-\" + result;\n if (ctrl) result = \"Ctrl-\" + result;\n if (meta) result = \"Meta-\" + result;\n if (shift) result = \"Shift-\" + result;\n return result;\n}\nfunction normalize(map) {\n let copy = Object.create(null);\n for (let prop in map) copy[normalizeKeyName(prop)] = map[prop];\n return copy;\n}\nfunction modifiers(name, event, shift = true) {\n if (event.altKey) name = \"Alt-\" + name;\n if (event.ctrlKey) name = \"Ctrl-\" + name;\n if (event.metaKey) name = \"Meta-\" + name;\n if (shift && event.shiftKey) name = \"Shift-\" + name;\n return name;\n}\n/**\nCreate a keymap plugin for the given set of bindings.\n\nBindings should map key names to [command](https://prosemirror.net/docs/ref/#commands)-style\nfunctions, which will be called with `(EditorState, dispatch,\nEditorView)` arguments, and should return true when they've handled\nthe key. Note that the view argument isn't part of the command\nprotocol, but can be used as an escape hatch if a binding needs to\ndirectly interact with the UI.\n\nKey names may be strings like `\"Shift-Ctrl-Enter\"`—a key\nidentifier prefixed with zero or more modifiers. Key identifiers\nare based on the strings that can appear in\n[`KeyEvent.key`](https:developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key).\nUse lowercase letters to refer to letter keys (or uppercase letters\nif you want shift to be held). You may use `\"Space\"` as an alias\nfor the `\" \"` name.\n\nModifiers can be given in any order. `Shift-` (or `s-`), `Alt-` (or\n`a-`), `Ctrl-` (or `c-` or `Control-`) and `Cmd-` (or `m-` or\n`Meta-`) are recognized. For characters that are created by holding\nshift, the `Shift-` prefix is implied, and should not be added\nexplicitly.\n\nYou can use `Mod-` as a shorthand for `Cmd-` on Mac and `Ctrl-` on\nother platforms.\n\nYou can add multiple keymap plugins to an editor. The order in\nwhich they appear determines their precedence (the ones early in\nthe array get to dispatch first).\n*/\nfunction keymap(bindings) {\n return new Plugin({\n props: {\n handleKeyDown: keydownHandler(bindings)\n }\n });\n}\n/**\nGiven a set of bindings (using the same format as\n[`keymap`](https://prosemirror.net/docs/ref/#keymap.keymap)), return a [keydown\nhandler](https://prosemirror.net/docs/ref/#view.EditorProps.handleKeyDown) that handles them.\n*/\nfunction keydownHandler(bindings) {\n let map = normalize(bindings);\n return function (view, event) {\n let name = keyName(event),\n baseName,\n direct = map[modifiers(name, event)];\n if (direct && direct(view.state, view.dispatch, view)) return true;\n // A character key\n if (name.length == 1 && name != \" \") {\n if (event.shiftKey) {\n // In case the name was already modified by shift, try looking\n // it up without its shift modifier\n let noShift = map[modifiers(name, event, false)];\n if (noShift && noShift(view.state, view.dispatch, view)) return true;\n }\n if ((event.shiftKey || event.altKey || event.metaKey || name.charCodeAt(0) > 127) && (baseName = base[event.keyCode]) && baseName != name) {\n // Try falling back to the keyCode when there's a modifier\n // active or the character produced isn't ASCII, and our table\n // produces a different name from the the keyCode. See #668,\n // #1060\n let fromCode = map[modifiers(baseName, event)];\n if (fromCode && fromCode(view.state, view.dispatch, view)) return true;\n }\n }\n return false;\n };\n}\nexport { keydownHandler, keymap };","import { liftTarget, replaceStep, ReplaceStep, canJoin, joinPoint, canSplit, ReplaceAroundStep, findWrapping } from 'prosemirror-transform';\nimport { Slice, Fragment } from 'prosemirror-model';\nimport { NodeSelection, Selection, TextSelection, AllSelection, SelectionRange } from 'prosemirror-state';\n\n/**\nDelete the selection, if there is one.\n*/\nconst deleteSelection = (state, dispatch) => {\n if (state.selection.empty) return false;\n if (dispatch) dispatch(state.tr.deleteSelection().scrollIntoView());\n return true;\n};\nfunction atBlockStart(state, view) {\n let {\n $cursor\n } = state.selection;\n if (!$cursor || (view ? !view.endOfTextblock(\"backward\", state) : $cursor.parentOffset > 0)) return null;\n return $cursor;\n}\n/**\nIf the selection is empty and at the start of a textblock, try to\nreduce the distance between that block and the one before it—if\nthere's a block directly before it that can be joined, join them.\nIf not, try to move the selected block closer to the next one in\nthe document structure by lifting it out of its parent or moving it\ninto a parent of the previous block. Will use the view for accurate\n(bidi-aware) start-of-textblock detection if given.\n*/\nconst joinBackward = (state, dispatch, view) => {\n let $cursor = atBlockStart(state, view);\n if (!$cursor) return false;\n let $cut = findCutBefore($cursor);\n // If there is no node before this, try to lift\n if (!$cut) {\n let range = $cursor.blockRange(),\n target = range && liftTarget(range);\n if (target == null) return false;\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n }\n let before = $cut.nodeBefore;\n // Apply the joining algorithm\n if (deleteBarrier(state, $cut, dispatch, -1)) return true;\n // If the node below has no content and the node above is\n // selectable, delete the node below and select the one above.\n if ($cursor.parent.content.size == 0 && (textblockAt(before, \"end\") || NodeSelection.isSelectable(before))) {\n for (let depth = $cursor.depth;; depth--) {\n let delStep = replaceStep(state.doc, $cursor.before(depth), $cursor.after(depth), Slice.empty);\n if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n if (dispatch) {\n let tr = state.tr.step(delStep);\n tr.setSelection(textblockAt(before, \"end\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos, -1)), -1) : NodeSelection.create(tr.doc, $cut.pos - before.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n if (depth == 1 || $cursor.node(depth - 1).childCount > 1) break;\n }\n }\n // If the node before is an atom, delete it\n if (before.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) dispatch(state.tr.delete($cut.pos - before.nodeSize, $cut.pos).scrollIntoView());\n return true;\n }\n return false;\n};\n/**\nA more limited form of [`joinBackward`]($commands.joinBackward)\nthat only tries to join the current textblock to the one before\nit, if the cursor is at the start of a textblock.\n*/\nconst joinTextblockBackward = (state, dispatch, view) => {\n let $cursor = atBlockStart(state, view);\n if (!$cursor) return false;\n let $cut = findCutBefore($cursor);\n return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\n/**\nA more limited form of [`joinForward`]($commands.joinForward)\nthat only tries to join the current textblock to the one after\nit, if the cursor is at the end of a textblock.\n*/\nconst joinTextblockForward = (state, dispatch, view) => {\n let $cursor = atBlockEnd(state, view);\n if (!$cursor) return false;\n let $cut = findCutAfter($cursor);\n return $cut ? joinTextblocksAround(state, $cut, dispatch) : false;\n};\nfunction joinTextblocksAround(state, $cut, dispatch) {\n let before = $cut.nodeBefore,\n beforeText = before,\n beforePos = $cut.pos - 1;\n for (; !beforeText.isTextblock; beforePos--) {\n if (beforeText.type.spec.isolating) return false;\n let child = beforeText.lastChild;\n if (!child) return false;\n beforeText = child;\n }\n let after = $cut.nodeAfter,\n afterText = after,\n afterPos = $cut.pos + 1;\n for (; !afterText.isTextblock; afterPos++) {\n if (afterText.type.spec.isolating) return false;\n let child = afterText.firstChild;\n if (!child) return false;\n afterText = child;\n }\n let step = replaceStep(state.doc, beforePos, afterPos, Slice.empty);\n if (!step || step.from != beforePos || step instanceof ReplaceStep && step.slice.size >= afterPos - beforePos) return false;\n if (dispatch) {\n let tr = state.tr.step(step);\n tr.setSelection(TextSelection.create(tr.doc, beforePos));\n dispatch(tr.scrollIntoView());\n }\n return true;\n}\nfunction textblockAt(node, side, only = false) {\n for (let scan = node; scan; scan = side == \"start\" ? scan.firstChild : scan.lastChild) {\n if (scan.isTextblock) return true;\n if (only && scan.childCount != 1) return false;\n }\n return false;\n}\n/**\nWhen the selection is empty and at the start of a textblock, select\nthe node before that textblock, if possible. This is intended to be\nbound to keys like backspace, after\n[`joinBackward`](https://prosemirror.net/docs/ref/#commands.joinBackward) or other deleting\ncommands, as a fall-back behavior when the schema doesn't allow\ndeletion at the selected point.\n*/\nconst selectNodeBackward = (state, dispatch, view) => {\n let {\n $head,\n empty\n } = state.selection,\n $cut = $head;\n if (!empty) return false;\n if ($head.parent.isTextblock) {\n if (view ? !view.endOfTextblock(\"backward\", state) : $head.parentOffset > 0) return false;\n $cut = findCutBefore($head);\n }\n let node = $cut && $cut.nodeBefore;\n if (!node || !NodeSelection.isSelectable(node)) return false;\n if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos - node.nodeSize)).scrollIntoView());\n return true;\n};\nfunction findCutBefore($pos) {\n if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {\n if ($pos.index(i) > 0) return $pos.doc.resolve($pos.before(i + 1));\n if ($pos.node(i).type.spec.isolating) break;\n }\n return null;\n}\nfunction atBlockEnd(state, view) {\n let {\n $cursor\n } = state.selection;\n if (!$cursor || (view ? !view.endOfTextblock(\"forward\", state) : $cursor.parentOffset < $cursor.parent.content.size)) return null;\n return $cursor;\n}\n/**\nIf the selection is empty and the cursor is at the end of a\ntextblock, try to reduce or remove the boundary between that block\nand the one after it, either by joining them or by moving the other\nblock closer to this one in the tree structure. Will use the view\nfor accurate start-of-textblock detection if given.\n*/\nconst joinForward = (state, dispatch, view) => {\n let $cursor = atBlockEnd(state, view);\n if (!$cursor) return false;\n let $cut = findCutAfter($cursor);\n // If there is no node after this, there's nothing to do\n if (!$cut) return false;\n let after = $cut.nodeAfter;\n // Try the joining algorithm\n if (deleteBarrier(state, $cut, dispatch, 1)) return true;\n // If the node above has no content and the node below is\n // selectable, delete the node above and select the one below.\n if ($cursor.parent.content.size == 0 && (textblockAt(after, \"start\") || NodeSelection.isSelectable(after))) {\n let delStep = replaceStep(state.doc, $cursor.before(), $cursor.after(), Slice.empty);\n if (delStep && delStep.slice.size < delStep.to - delStep.from) {\n if (dispatch) {\n let tr = state.tr.step(delStep);\n tr.setSelection(textblockAt(after, \"start\") ? Selection.findFrom(tr.doc.resolve(tr.mapping.map($cut.pos)), 1) : NodeSelection.create(tr.doc, tr.mapping.map($cut.pos)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n }\n // If the next node is an atom, delete it\n if (after.isAtom && $cut.depth == $cursor.depth - 1) {\n if (dispatch) dispatch(state.tr.delete($cut.pos, $cut.pos + after.nodeSize).scrollIntoView());\n return true;\n }\n return false;\n};\n/**\nWhen the selection is empty and at the end of a textblock, select\nthe node coming after that textblock, if possible. This is intended\nto be bound to keys like delete, after\n[`joinForward`](https://prosemirror.net/docs/ref/#commands.joinForward) and similar deleting\ncommands, to provide a fall-back behavior when the schema doesn't\nallow deletion at the selected point.\n*/\nconst selectNodeForward = (state, dispatch, view) => {\n let {\n $head,\n empty\n } = state.selection,\n $cut = $head;\n if (!empty) return false;\n if ($head.parent.isTextblock) {\n if (view ? !view.endOfTextblock(\"forward\", state) : $head.parentOffset < $head.parent.content.size) return false;\n $cut = findCutAfter($head);\n }\n let node = $cut && $cut.nodeAfter;\n if (!node || !NodeSelection.isSelectable(node)) return false;\n if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, $cut.pos)).scrollIntoView());\n return true;\n};\nfunction findCutAfter($pos) {\n if (!$pos.parent.type.spec.isolating) for (let i = $pos.depth - 1; i >= 0; i--) {\n let parent = $pos.node(i);\n if ($pos.index(i) + 1 < parent.childCount) return $pos.doc.resolve($pos.after(i + 1));\n if (parent.type.spec.isolating) break;\n }\n return null;\n}\n/**\nJoin the selected block or, if there is a text selection, the\nclosest ancestor block of the selection that can be joined, with\nthe sibling above it.\n*/\nconst joinUp = (state, dispatch) => {\n let sel = state.selection,\n nodeSel = sel instanceof NodeSelection,\n point;\n if (nodeSel) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.from)) return false;\n point = sel.from;\n } else {\n point = joinPoint(state.doc, sel.from, -1);\n if (point == null) return false;\n }\n if (dispatch) {\n let tr = state.tr.join(point);\n if (nodeSel) tr.setSelection(NodeSelection.create(tr.doc, point - state.doc.resolve(point).nodeBefore.nodeSize));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nJoin the selected block, or the closest ancestor of the selection\nthat can be joined, with the sibling after it.\n*/\nconst joinDown = (state, dispatch) => {\n let sel = state.selection,\n point;\n if (sel instanceof NodeSelection) {\n if (sel.node.isTextblock || !canJoin(state.doc, sel.to)) return false;\n point = sel.to;\n } else {\n point = joinPoint(state.doc, sel.to, 1);\n if (point == null) return false;\n }\n if (dispatch) dispatch(state.tr.join(point).scrollIntoView());\n return true;\n};\n/**\nLift the selected block, or the closest ancestor block of the\nselection that can be lifted, out of its parent node.\n*/\nconst lift = (state, dispatch) => {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to),\n target = range && liftTarget(range);\n if (target == null) return false;\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n};\n/**\nIf the selection is in a node whose type has a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, replace the\nselection with a newline character.\n*/\nconst newlineInCode = (state, dispatch) => {\n let {\n $head,\n $anchor\n } = state.selection;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;\n if (dispatch) dispatch(state.tr.insertText(\"\\n\").scrollIntoView());\n return true;\n};\nfunction defaultBlockAt(match) {\n for (let i = 0; i < match.edgeCount; i++) {\n let {\n type\n } = match.edge(i);\n if (type.isTextblock && !type.hasRequiredAttrs()) return type;\n }\n return null;\n}\n/**\nWhen the selection is in a node with a truthy\n[`code`](https://prosemirror.net/docs/ref/#model.NodeSpec.code) property in its spec, create a\ndefault block after the code block, and move the cursor there.\n*/\nconst exitCode = (state, dispatch) => {\n let {\n $head,\n $anchor\n } = state.selection;\n if (!$head.parent.type.spec.code || !$head.sameParent($anchor)) return false;\n let above = $head.node(-1),\n after = $head.indexAfter(-1),\n type = defaultBlockAt(above.contentMatchAt(after));\n if (!type || !above.canReplaceWith(after, after, type)) return false;\n if (dispatch) {\n let pos = $head.after(),\n tr = state.tr.replaceWith(pos, pos, type.createAndFill());\n tr.setSelection(Selection.near(tr.doc.resolve(pos), 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nIf a block node is selected, create an empty paragraph before (if\nit is its parent's first child) or after it.\n*/\nconst createParagraphNear = (state, dispatch) => {\n let sel = state.selection,\n {\n $from,\n $to\n } = sel;\n if (sel instanceof AllSelection || $from.parent.inlineContent || $to.parent.inlineContent) return false;\n let type = defaultBlockAt($to.parent.contentMatchAt($to.indexAfter()));\n if (!type || !type.isTextblock) return false;\n if (dispatch) {\n let side = (!$from.parentOffset && $to.index() < $to.parent.childCount ? $from : $to).pos;\n let tr = state.tr.insert(side, type.createAndFill());\n tr.setSelection(TextSelection.create(tr.doc, side + 1));\n dispatch(tr.scrollIntoView());\n }\n return true;\n};\n/**\nIf the cursor is in an empty textblock that can be lifted, lift the\nblock.\n*/\nconst liftEmptyBlock = (state, dispatch) => {\n let {\n $cursor\n } = state.selection;\n if (!$cursor || $cursor.parent.content.size) return false;\n if ($cursor.depth > 1 && $cursor.after() != $cursor.end(-1)) {\n let before = $cursor.before();\n if (canSplit(state.doc, before)) {\n if (dispatch) dispatch(state.tr.split(before).scrollIntoView());\n return true;\n }\n }\n let range = $cursor.blockRange(),\n target = range && liftTarget(range);\n if (target == null) return false;\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n};\n/**\nCreate a variant of [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock) that uses\na custom function to determine the type of the newly split off block.\n*/\nfunction splitBlockAs(splitNode) {\n return (state, dispatch) => {\n let {\n $from,\n $to\n } = state.selection;\n if (state.selection instanceof NodeSelection && state.selection.node.isBlock) {\n if (!$from.parentOffset || !canSplit(state.doc, $from.pos)) return false;\n if (dispatch) dispatch(state.tr.split($from.pos).scrollIntoView());\n return true;\n }\n if (!$from.depth) return false;\n let types = [];\n let splitDepth,\n deflt,\n atEnd = false,\n atStart = false;\n for (let d = $from.depth;; d--) {\n let node = $from.node(d);\n if (node.isBlock) {\n atEnd = $from.end(d) == $from.pos + ($from.depth - d);\n atStart = $from.start(d) == $from.pos - ($from.depth - d);\n deflt = defaultBlockAt($from.node(d - 1).contentMatchAt($from.indexAfter(d - 1)));\n let splitType = splitNode && splitNode($to.parent, atEnd, $from);\n types.unshift(splitType || (atEnd && deflt ? {\n type: deflt\n } : null));\n splitDepth = d;\n break;\n } else {\n if (d == 1) return false;\n types.unshift(null);\n }\n }\n let tr = state.tr;\n if (state.selection instanceof TextSelection || state.selection instanceof AllSelection) tr.deleteSelection();\n let splitPos = tr.mapping.map($from.pos);\n let can = canSplit(tr.doc, splitPos, types.length, types);\n if (!can) {\n types[0] = deflt ? {\n type: deflt\n } : null;\n can = canSplit(tr.doc, splitPos, types.length, types);\n }\n tr.split(splitPos, types.length, types);\n if (!atEnd && atStart && $from.node(splitDepth).type != deflt) {\n let first = tr.mapping.map($from.before(splitDepth)),\n $first = tr.doc.resolve(first);\n if (deflt && $from.node(splitDepth - 1).canReplaceWith($first.index(), $first.index() + 1, deflt)) tr.setNodeMarkup(tr.mapping.map($from.before(splitDepth)), deflt);\n }\n if (dispatch) dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nSplit the parent block of the selection. If the selection is a text\nselection, also delete its content.\n*/\nconst splitBlock = splitBlockAs();\n/**\nActs like [`splitBlock`](https://prosemirror.net/docs/ref/#commands.splitBlock), but without\nresetting the set of active marks at the cursor.\n*/\nconst splitBlockKeepMarks = (state, dispatch) => {\n return splitBlock(state, dispatch && (tr => {\n let marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n if (marks) tr.ensureMarks(marks);\n dispatch(tr);\n }));\n};\n/**\nMove the selection to the node wrapping the current selection, if\nany. (Will not select the document node.)\n*/\nconst selectParentNode = (state, dispatch) => {\n let {\n $from,\n to\n } = state.selection,\n pos;\n let same = $from.sharedDepth(to);\n if (same == 0) return false;\n pos = $from.before(same);\n if (dispatch) dispatch(state.tr.setSelection(NodeSelection.create(state.doc, pos)));\n return true;\n};\n/**\nSelect the whole document.\n*/\nconst selectAll = (state, dispatch) => {\n if (dispatch) dispatch(state.tr.setSelection(new AllSelection(state.doc)));\n return true;\n};\nfunction joinMaybeClear(state, $pos, dispatch) {\n let before = $pos.nodeBefore,\n after = $pos.nodeAfter,\n index = $pos.index();\n if (!before || !after || !before.type.compatibleContent(after.type)) return false;\n if (!before.content.size && $pos.parent.canReplace(index - 1, index)) {\n if (dispatch) dispatch(state.tr.delete($pos.pos - before.nodeSize, $pos.pos).scrollIntoView());\n return true;\n }\n if (!$pos.parent.canReplace(index, index + 1) || !(after.isTextblock || canJoin(state.doc, $pos.pos))) return false;\n if (dispatch) dispatch(state.tr.join($pos.pos).scrollIntoView());\n return true;\n}\nfunction deleteBarrier(state, $cut, dispatch, dir) {\n let before = $cut.nodeBefore,\n after = $cut.nodeAfter,\n conn,\n match;\n let isolated = before.type.spec.isolating || after.type.spec.isolating;\n if (!isolated && joinMaybeClear(state, $cut, dispatch)) return true;\n let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);\n if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) {\n if (dispatch) {\n let end = $cut.pos + after.nodeSize,\n wrap = Fragment.empty;\n for (let i = conn.length - 1; i >= 0; i--) wrap = Fragment.from(conn[i].create(null, wrap));\n wrap = Fragment.from(before.copy(wrap));\n let tr = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap, 1, 0), conn.length, true));\n let $joinAt = tr.doc.resolve(end + 2 * conn.length);\n if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr.doc, $joinAt.pos)) tr.join($joinAt.pos);\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let selAfter = after.type.spec.isolating || dir > 0 && isolated ? null : Selection.findFrom($cut, 1);\n let range = selAfter && selAfter.$from.blockRange(selAfter.$to),\n target = range && liftTarget(range);\n if (target != null && target >= $cut.depth) {\n if (dispatch) dispatch(state.tr.lift(range, target).scrollIntoView());\n return true;\n }\n if (canDelAfter && textblockAt(after, \"start\", true) && textblockAt(before, \"end\")) {\n let at = before,\n wrap = [];\n for (;;) {\n wrap.push(at);\n if (at.isTextblock) break;\n at = at.lastChild;\n }\n let afterText = after,\n afterDepth = 1;\n for (; !afterText.isTextblock; afterText = afterText.firstChild) afterDepth++;\n if (at.canReplace(at.childCount, at.childCount, afterText.content)) {\n if (dispatch) {\n let end = Fragment.empty;\n for (let i = wrap.length - 1; i >= 0; i--) end = Fragment.from(wrap[i].copy(end));\n let tr = state.tr.step(new ReplaceAroundStep($cut.pos - wrap.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap.length, 0), 0, true));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n }\n return false;\n}\nfunction selectTextblockSide(side) {\n return function (state, dispatch) {\n let sel = state.selection,\n $pos = side < 0 ? sel.$from : sel.$to;\n let depth = $pos.depth;\n while ($pos.node(depth).isInline) {\n if (!depth) return false;\n depth--;\n }\n if (!$pos.node(depth).isTextblock) return false;\n if (dispatch) dispatch(state.tr.setSelection(TextSelection.create(state.doc, side < 0 ? $pos.start(depth) : $pos.end(depth))));\n return true;\n };\n}\n/**\nMoves the cursor to the start of current text block.\n*/\nconst selectTextblockStart = selectTextblockSide(-1);\n/**\nMoves the cursor to the end of current text block.\n*/\nconst selectTextblockEnd = selectTextblockSide(1);\n// Parameterized commands\n/**\nWrap the selection in a node of the given type with the given\nattributes.\n*/\nfunction wrapIn(nodeType, attrs = null) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to),\n wrapping = range && findWrapping(range, nodeType, attrs);\n if (!wrapping) return false;\n if (dispatch) dispatch(state.tr.wrap(range, wrapping).scrollIntoView());\n return true;\n };\n}\n/**\nReturns a command that tries to set the selected textblocks to the\ngiven node type with the given attributes.\n*/\nfunction setBlockType(nodeType, attrs = null) {\n return function (state, dispatch) {\n let applicable = false;\n for (let i = 0; i < state.selection.ranges.length && !applicable; i++) {\n let {\n $from: {\n pos: from\n },\n $to: {\n pos: to\n }\n } = state.selection.ranges[i];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (applicable) return false;\n if (!node.isTextblock || node.hasMarkup(nodeType, attrs)) return;\n if (node.type == nodeType) {\n applicable = true;\n } else {\n let $pos = state.doc.resolve(pos),\n index = $pos.index();\n applicable = $pos.parent.canReplaceWith(index, index + 1, nodeType);\n }\n });\n }\n if (!applicable) return false;\n if (dispatch) {\n let tr = state.tr;\n for (let i = 0; i < state.selection.ranges.length; i++) {\n let {\n $from: {\n pos: from\n },\n $to: {\n pos: to\n }\n } = state.selection.ranges[i];\n tr.setBlockType(from, to, nodeType, attrs);\n }\n dispatch(tr.scrollIntoView());\n }\n return true;\n };\n}\nfunction markApplies(doc, ranges, type, enterAtoms) {\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i];\n let can = $from.depth == 0 ? doc.inlineContent && doc.type.allowsMarkType(type) : false;\n doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (can || !enterAtoms && node.isAtom && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos) return false;\n can = node.inlineContent && node.type.allowsMarkType(type);\n });\n if (can) return true;\n }\n return false;\n}\nfunction removeInlineAtoms(ranges) {\n let result = [];\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i];\n $from.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (node.isAtom && node.content.size && node.isInline && pos >= $from.pos && pos + node.nodeSize <= $to.pos) {\n if (pos + 1 > $from.pos) result.push(new SelectionRange($from, $from.doc.resolve(pos + 1)));\n $from = $from.doc.resolve(pos + 1 + node.content.size);\n return false;\n }\n });\n if ($from.pos < $to.pos) result.push(new SelectionRange($from, $to));\n }\n return result;\n}\n/**\nCreate a command function that toggles the given mark with the\ngiven attributes. Will return `false` when the current selection\ndoesn't support that mark. This will remove the mark if any marks\nof that type exist in the selection, or add it otherwise. If the\nselection is empty, this applies to the [stored\nmarks](https://prosemirror.net/docs/ref/#state.EditorState.storedMarks) instead of a range of the\ndocument.\n*/\nfunction toggleMark(markType, attrs = null, options) {\n let removeWhenPresent = (options && options.removeWhenPresent) !== false;\n let enterAtoms = (options && options.enterInlineAtoms) !== false;\n return function (state, dispatch) {\n let {\n empty,\n $cursor,\n ranges\n } = state.selection;\n if (empty && !$cursor || !markApplies(state.doc, ranges, markType, enterAtoms)) return false;\n if (dispatch) {\n if ($cursor) {\n if (markType.isInSet(state.storedMarks || $cursor.marks())) dispatch(state.tr.removeStoredMark(markType));else dispatch(state.tr.addStoredMark(markType.create(attrs)));\n } else {\n let add,\n tr = state.tr;\n if (!enterAtoms) ranges = removeInlineAtoms(ranges);\n if (removeWhenPresent) {\n add = !ranges.some(r => state.doc.rangeHasMark(r.$from.pos, r.$to.pos, markType));\n } else {\n add = !ranges.every(r => {\n let missing = false;\n tr.doc.nodesBetween(r.$from.pos, r.$to.pos, (node, pos, parent) => {\n if (missing) return false;\n missing = !markType.isInSet(node.marks) && !!parent && parent.type.allowsMarkType(markType) && !(node.isText && /^\\s*$/.test(node.textBetween(Math.max(0, r.$from.pos - pos), Math.min(node.nodeSize, r.$to.pos - pos))));\n });\n return !missing;\n });\n }\n for (let i = 0; i < ranges.length; i++) {\n let {\n $from,\n $to\n } = ranges[i];\n if (!add) {\n tr.removeMark($from.pos, $to.pos, markType);\n } else {\n let from = $from.pos,\n to = $to.pos,\n start = $from.nodeAfter,\n end = $to.nodeBefore;\n let spaceStart = start && start.isText ? /^\\s*/.exec(start.text)[0].length : 0;\n let spaceEnd = end && end.isText ? /\\s*$/.exec(end.text)[0].length : 0;\n if (from + spaceStart < to) {\n from += spaceStart;\n to -= spaceEnd;\n }\n tr.addMark(from, to, markType.create(attrs));\n }\n }\n dispatch(tr.scrollIntoView());\n }\n }\n return true;\n };\n}\nfunction wrapDispatchForJoin(dispatch, isJoinable) {\n return tr => {\n if (!tr.isGeneric) return dispatch(tr);\n let ranges = [];\n for (let i = 0; i < tr.mapping.maps.length; i++) {\n let map = tr.mapping.maps[i];\n for (let j = 0; j < ranges.length; j++) ranges[j] = map.map(ranges[j]);\n map.forEach((_s, _e, from, to) => ranges.push(from, to));\n }\n // Figure out which joinable points exist inside those ranges,\n // by checking all node boundaries in their parent nodes.\n let joinable = [];\n for (let i = 0; i < ranges.length; i += 2) {\n let from = ranges[i],\n to = ranges[i + 1];\n let $from = tr.doc.resolve(from),\n depth = $from.sharedDepth(to),\n parent = $from.node(depth);\n for (let index = $from.indexAfter(depth), pos = $from.after(depth + 1); pos <= to; ++index) {\n let after = parent.maybeChild(index);\n if (!after) break;\n if (index && joinable.indexOf(pos) == -1) {\n let before = parent.child(index - 1);\n if (before.type == after.type && isJoinable(before, after)) joinable.push(pos);\n }\n pos += after.nodeSize;\n }\n }\n // Join the joinable points\n joinable.sort((a, b) => a - b);\n for (let i = joinable.length - 1; i >= 0; i--) {\n if (canJoin(tr.doc, joinable[i])) tr.join(joinable[i]);\n }\n dispatch(tr);\n };\n}\n/**\nWrap a command so that, when it produces a transform that causes\ntwo joinable nodes to end up next to each other, those are joined.\nNodes are considered joinable when they are of the same type and\nwhen the `isJoinable` predicate returns true for them or, if an\narray of strings was passed, if their node type name is in that\narray.\n*/\nfunction autoJoin(command, isJoinable) {\n let canJoin = Array.isArray(isJoinable) ? node => isJoinable.indexOf(node.type.name) > -1 : isJoinable;\n return (state, dispatch, view) => command(state, dispatch && wrapDispatchForJoin(dispatch, canJoin), view);\n}\n/**\nCombine a number of command functions into a single function (which\ncalls them one by one until one returns true).\n*/\nfunction chainCommands(...commands) {\n return function (state, dispatch, view) {\n for (let i = 0; i < commands.length; i++) if (commands[i](state, dispatch, view)) return true;\n return false;\n };\n}\nlet backspace = chainCommands(deleteSelection, joinBackward, selectNodeBackward);\nlet del = chainCommands(deleteSelection, joinForward, selectNodeForward);\n/**\nA basic keymap containing bindings not specific to any schema.\nBinds the following keys (when multiple commands are listed, they\nare chained with [`chainCommands`](https://prosemirror.net/docs/ref/#commands.chainCommands)):\n\n* **Enter** to `newlineInCode`, `createParagraphNear`, `liftEmptyBlock`, `splitBlock`\n* **Mod-Enter** to `exitCode`\n* **Backspace** and **Mod-Backspace** to `deleteSelection`, `joinBackward`, `selectNodeBackward`\n* **Delete** and **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-Delete** to `deleteSelection`, `joinForward`, `selectNodeForward`\n* **Mod-a** to `selectAll`\n*/\nconst pcBaseKeymap = {\n \"Enter\": chainCommands(newlineInCode, createParagraphNear, liftEmptyBlock, splitBlock),\n \"Mod-Enter\": exitCode,\n \"Backspace\": backspace,\n \"Mod-Backspace\": backspace,\n \"Shift-Backspace\": backspace,\n \"Delete\": del,\n \"Mod-Delete\": del,\n \"Mod-a\": selectAll\n};\n/**\nA copy of `pcBaseKeymap` that also binds **Ctrl-h** like Backspace,\n**Ctrl-d** like Delete, **Alt-Backspace** like Ctrl-Backspace, and\n**Ctrl-Alt-Backspace**, **Alt-Delete**, and **Alt-d** like\nCtrl-Delete.\n*/\nconst macBaseKeymap = {\n \"Ctrl-h\": pcBaseKeymap[\"Backspace\"],\n \"Alt-Backspace\": pcBaseKeymap[\"Mod-Backspace\"],\n \"Ctrl-d\": pcBaseKeymap[\"Delete\"],\n \"Ctrl-Alt-Backspace\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-Delete\": pcBaseKeymap[\"Mod-Delete\"],\n \"Alt-d\": pcBaseKeymap[\"Mod-Delete\"],\n \"Ctrl-a\": selectTextblockStart,\n \"Ctrl-e\": selectTextblockEnd\n};\nfor (let key in pcBaseKeymap) macBaseKeymap[key] = pcBaseKeymap[key];\nconst mac = typeof navigator != \"undefined\" ? /Mac|iP(hone|[oa]d)/.test(navigator.platform)\n// @ts-ignore\n: typeof os != \"undefined\" && os.platform ? os.platform() == \"darwin\" : false;\n/**\nDepending on the detected platform, this will hold\n[`pcBasekeymap`](https://prosemirror.net/docs/ref/#commands.pcBaseKeymap) or\n[`macBaseKeymap`](https://prosemirror.net/docs/ref/#commands.macBaseKeymap).\n*/\nconst baseKeymap = mac ? macBaseKeymap : pcBaseKeymap;\nexport { autoJoin, baseKeymap, chainCommands, createParagraphNear, deleteSelection, exitCode, joinBackward, joinDown, joinForward, joinTextblockBackward, joinTextblockForward, joinUp, lift, liftEmptyBlock, macBaseKeymap, newlineInCode, pcBaseKeymap, selectAll, selectNodeBackward, selectNodeForward, selectParentNode, selectTextblockEnd, selectTextblockStart, setBlockType, splitBlock, splitBlockAs, splitBlockKeepMarks, toggleMark, wrapIn };","import { findWrapping, ReplaceAroundStep, canSplit, liftTarget, canJoin } from 'prosemirror-transform';\nimport { NodeRange, Fragment, Slice } from 'prosemirror-model';\nimport { Selection } from 'prosemirror-state';\nconst olDOM = [\"ol\", 0],\n ulDOM = [\"ul\", 0],\n liDOM = [\"li\", 0];\n/**\nAn ordered list [node spec](https://prosemirror.net/docs/ref/#model.NodeSpec). Has a single\nattribute, `order`, which determines the number at which the list\nstarts counting, and defaults to 1. Represented as an `
        `\nelement.\n*/\nconst orderedList = {\n attrs: {\n order: {\n default: 1,\n validate: \"number\"\n }\n },\n parseDOM: [{\n tag: \"ol\",\n getAttrs(dom) {\n return {\n order: dom.hasAttribute(\"start\") ? +dom.getAttribute(\"start\") : 1\n };\n }\n }],\n toDOM(node) {\n return node.attrs.order == 1 ? olDOM : [\"ol\", {\n start: node.attrs.order\n }, 0];\n }\n};\n/**\nA bullet list node spec, represented in the DOM as `
          `.\n*/\nconst bulletList = {\n parseDOM: [{\n tag: \"ul\"\n }],\n toDOM() {\n return ulDOM;\n }\n};\n/**\nA list item (`
        • `) spec.\n*/\nconst listItem = {\n parseDOM: [{\n tag: \"li\"\n }],\n toDOM() {\n return liDOM;\n },\n defining: true\n};\nfunction add(obj, props) {\n let copy = {};\n for (let prop in obj) copy[prop] = obj[prop];\n for (let prop in props) copy[prop] = props[prop];\n return copy;\n}\n/**\nConvenience function for adding list-related node types to a map\nspecifying the nodes for a schema. Adds\n[`orderedList`](https://prosemirror.net/docs/ref/#schema-list.orderedList) as `\"ordered_list\"`,\n[`bulletList`](https://prosemirror.net/docs/ref/#schema-list.bulletList) as `\"bullet_list\"`, and\n[`listItem`](https://prosemirror.net/docs/ref/#schema-list.listItem) as `\"list_item\"`.\n\n`itemContent` determines the content expression for the list items.\nIf you want the commands defined in this module to apply to your\nlist structure, it should have a shape like `\"paragraph block*\"` or\n`\"paragraph (ordered_list | bullet_list)*\"`. `listGroup` can be\ngiven to assign a group name to the list node types, for example\n`\"block\"`.\n*/\nfunction addListNodes(nodes, itemContent, listGroup) {\n return nodes.append({\n ordered_list: add(orderedList, {\n content: \"list_item+\",\n group: listGroup\n }),\n bullet_list: add(bulletList, {\n content: \"list_item+\",\n group: listGroup\n }),\n list_item: add(listItem, {\n content: itemContent\n })\n });\n}\n/**\nReturns a command function that wraps the selection in a list with\nthe given type an attributes. If `dispatch` is null, only return a\nvalue to indicate whether this is possible, but don't actually\nperform the change.\n*/\nfunction wrapInList(listType, attrs = null) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to);\n if (!range) return false;\n let tr = dispatch ? state.tr : null;\n if (!wrapRangeInList(tr, range, listType, attrs)) return false;\n if (dispatch) dispatch(tr.scrollIntoView());\n return true;\n };\n}\n/**\nTry to wrap the given node range in a list of the given type.\nReturn `true` when this is possible, `false` otherwise. When `tr`\nis non-null, the wrapping is added to that transaction. When it is\n`null`, the function only queries whether the wrapping is\npossible.\n*/\nfunction wrapRangeInList(tr, range, listType, attrs = null) {\n let doJoin = false,\n outerRange = range,\n doc = range.$from.doc;\n // This is at the top of an existing list item\n if (range.depth >= 2 && range.$from.node(range.depth - 1).type.compatibleContent(listType) && range.startIndex == 0) {\n // Don't do anything if this is the top of the list\n if (range.$from.index(range.depth - 1) == 0) return false;\n let $insert = doc.resolve(range.start - 2);\n outerRange = new NodeRange($insert, $insert, range.depth);\n if (range.endIndex < range.parent.childCount) range = new NodeRange(range.$from, doc.resolve(range.$to.end(range.depth)), range.depth);\n doJoin = true;\n }\n let wrap = findWrapping(outerRange, listType, attrs, range);\n if (!wrap) return false;\n if (tr) doWrapInList(tr, range, wrap, doJoin, listType);\n return true;\n}\nfunction doWrapInList(tr, range, wrappers, joinBefore, listType) {\n let content = Fragment.empty;\n for (let i = wrappers.length - 1; i >= 0; i--) content = Fragment.from(wrappers[i].type.create(wrappers[i].attrs, content));\n tr.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));\n let found = 0;\n for (let i = 0; i < wrappers.length; i++) if (wrappers[i].type == listType) found = i + 1;\n let splitDepth = wrappers.length - found;\n let splitPos = range.start + wrappers.length - (joinBefore ? 2 : 0),\n parent = range.parent;\n for (let i = range.startIndex, e = range.endIndex, first = true; i < e; i++, first = false) {\n if (!first && canSplit(tr.doc, splitPos, splitDepth)) {\n tr.split(splitPos, splitDepth);\n splitPos += 2 * splitDepth;\n }\n splitPos += parent.child(i).nodeSize;\n }\n return tr;\n}\n/**\nBuild a command that splits a non-empty textblock at the top level\nof a list item by also splitting that list item.\n*/\nfunction splitListItem(itemType, itemAttrs) {\n return function (state, dispatch) {\n let {\n $from,\n $to,\n node\n } = state.selection;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) return false;\n let grandParent = $from.node(-1);\n if (grandParent.type != itemType) return false;\n if ($from.parent.content.size == 0 && $from.node(-1).childCount == $from.indexAfter(-1)) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth == 3 || $from.node(-3).type != itemType || $from.index(-2) != $from.node(-2).childCount - 1) return false;\n if (dispatch) {\n let wrap = Fragment.empty;\n let depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d--) wrap = Fragment.from($from.node(d).copy(wrap));\n let depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n // Add a second list item with an empty default start node\n wrap = wrap.append(Fragment.from(itemType.createAndFill()));\n let start = $from.before($from.depth - (depthBefore - 1));\n let tr = state.tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n let sel = -1;\n tr.doc.nodesBetween(start, tr.doc.content.size, (node, pos) => {\n if (sel > -1) return false;\n if (node.isTextblock && node.content.size == 0) sel = pos + 1;\n });\n if (sel > -1) tr.setSelection(Selection.near(tr.doc.resolve(sel)));\n dispatch(tr.scrollIntoView());\n }\n return true;\n }\n let nextType = $to.pos == $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n let tr = state.tr.delete($from.pos, $to.pos);\n let types = nextType ? [itemAttrs ? {\n type: itemType,\n attrs: itemAttrs\n } : null, {\n type: nextType\n }] : undefined;\n if (!canSplit(tr.doc, $from.pos, 2, types)) return false;\n if (dispatch) dispatch(tr.split($from.pos, 2, types).scrollIntoView());\n return true;\n };\n}\n/**\nActs like [`splitListItem`](https://prosemirror.net/docs/ref/#schema-list.splitListItem), but\nwithout resetting the set of active marks at the cursor.\n*/\nfunction splitListItemKeepMarks(itemType, itemAttrs) {\n let split = splitListItem(itemType, itemAttrs);\n return (state, dispatch) => {\n return split(state, dispatch && (tr => {\n let marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n if (marks) tr.ensureMarks(marks);\n dispatch(tr);\n }));\n };\n}\n/**\nCreate a command to lift the list item around the selection up into\na wrapping list.\n*/\nfunction liftListItem(itemType) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range) return false;\n if (!dispatch) return true;\n if ($from.node(range.depth - 1).type == itemType)\n // Inside a parent list\n return liftToOuterList(state, dispatch, itemType, range);else\n // Outer list node\n return liftOutOfList(state, dispatch, range);\n };\n}\nfunction liftToOuterList(state, dispatch, itemType, range) {\n let tr = state.tr,\n end = range.end,\n endOfList = range.$to.end(range.depth);\n if (end < endOfList) {\n // There are siblings after the lifted items, which must become\n // children of the last item\n tr.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));\n range = new NodeRange(tr.doc.resolve(range.$from.pos), tr.doc.resolve(endOfList), range.depth);\n }\n const target = liftTarget(range);\n if (target == null) return false;\n tr.lift(range, target);\n let after = tr.mapping.map(end, -1) - 1;\n if (canJoin(tr.doc, after)) tr.join(after);\n dispatch(tr.scrollIntoView());\n return true;\n}\nfunction liftOutOfList(state, dispatch, range) {\n let tr = state.tr,\n list = range.parent;\n // Merge the list items into a single big item\n for (let pos = range.end, i = range.endIndex - 1, e = range.startIndex; i > e; i--) {\n pos -= list.child(i).nodeSize;\n tr.delete(pos - 1, pos + 1);\n }\n let $start = tr.doc.resolve(range.start),\n item = $start.nodeAfter;\n if (tr.mapping.map(range.end) != range.start + $start.nodeAfter.nodeSize) return false;\n let atStart = range.startIndex == 0,\n atEnd = range.endIndex == list.childCount;\n let parent = $start.node(-1),\n indexBefore = $start.index(-1);\n if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment.empty : Fragment.from(list)))) return false;\n let start = $start.pos,\n end = start + item.nodeSize;\n // Strip off the surrounding list. At the sides where we're not at\n // the end of the list, the existing list is closed. At sides where\n // this is the end, it is overwritten to its end.\n tr.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))).append(atEnd ? Fragment.empty : Fragment.from(list.copy(Fragment.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));\n dispatch(tr.scrollIntoView());\n return true;\n}\n/**\nCreate a command to sink the list item around the selection down\ninto an inner list.\n*/\nfunction sinkListItem(itemType) {\n return function (state, dispatch) {\n let {\n $from,\n $to\n } = state.selection;\n let range = $from.blockRange($to, node => node.childCount > 0 && node.firstChild.type == itemType);\n if (!range) return false;\n let startIndex = range.startIndex;\n if (startIndex == 0) return false;\n let parent = range.parent,\n nodeBefore = parent.child(startIndex - 1);\n if (nodeBefore.type != itemType) return false;\n if (dispatch) {\n let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;\n let inner = Fragment.from(nestedBefore ? itemType.create() : null);\n let slice = new Slice(Fragment.from(itemType.create(null, Fragment.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);\n let before = range.start,\n after = range.end;\n dispatch(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice, 1, true)).scrollIntoView());\n }\n return true;\n };\n}\nexport { addListNodes, bulletList, liftListItem, listItem, orderedList, sinkListItem, splitListItem, splitListItemKeepMarks, wrapInList, wrapRangeInList };","import { Plugin, PluginKey, TextSelection, Selection, NodeSelection, EditorState } from '@tiptap/pm/state';\nimport { EditorView } from '@tiptap/pm/view';\nimport { keymap } from '@tiptap/pm/keymap';\nimport { Schema, DOMSerializer, Fragment, Node as Node$1, DOMParser, Slice } from '@tiptap/pm/model';\nimport { liftTarget, ReplaceStep, ReplaceAroundStep, joinPoint, Transform, canSplit, canJoin, findWrapping } from '@tiptap/pm/transform';\nimport { createParagraphNear as createParagraphNear$1, deleteSelection as deleteSelection$1, exitCode as exitCode$1, joinUp as joinUp$1, joinDown as joinDown$1, joinBackward as joinBackward$1, joinForward as joinForward$1, joinTextblockBackward as joinTextblockBackward$1, joinTextblockForward as joinTextblockForward$1, lift as lift$1, liftEmptyBlock as liftEmptyBlock$1, newlineInCode as newlineInCode$1, selectNodeBackward as selectNodeBackward$1, selectNodeForward as selectNodeForward$1, selectParentNode as selectParentNode$1, selectTextblockEnd as selectTextblockEnd$1, selectTextblockStart as selectTextblockStart$1, setBlockType, wrapIn as wrapIn$1 } from '@tiptap/pm/commands';\nimport { liftListItem as liftListItem$1, sinkListItem as sinkListItem$1, wrapInList as wrapInList$1 } from '@tiptap/pm/schema-list';\n\n/**\n * Takes a Transaction & Editor State and turns it into a chainable state object\n * @param config The transaction and state to create the chainable state from\n * @returns A chainable Editor state object\n */\nfunction createChainableState(config) {\n const {\n state,\n transaction\n } = config;\n let {\n selection\n } = transaction;\n let {\n doc\n } = transaction;\n let {\n storedMarks\n } = transaction;\n return {\n ...state,\n apply: state.apply.bind(state),\n applyTransaction: state.applyTransaction.bind(state),\n plugins: state.plugins,\n schema: state.schema,\n reconfigure: state.reconfigure.bind(state),\n toJSON: state.toJSON.bind(state),\n get storedMarks() {\n return storedMarks;\n },\n get selection() {\n return selection;\n },\n get doc() {\n return doc;\n },\n get tr() {\n selection = transaction.selection;\n doc = transaction.doc;\n storedMarks = transaction.storedMarks;\n return transaction;\n }\n };\n}\nclass CommandManager {\n constructor(props) {\n this.editor = props.editor;\n this.rawCommands = this.editor.extensionManager.commands;\n this.customState = props.state;\n }\n get hasCustomState() {\n return !!this.customState;\n }\n get state() {\n return this.customState || this.editor.state;\n }\n get commands() {\n const {\n rawCommands,\n editor,\n state\n } = this;\n const {\n view\n } = editor;\n const {\n tr\n } = state;\n const props = this.buildProps(tr);\n return Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n const method = (...args) => {\n const callback = command(...args)(props);\n if (!tr.getMeta('preventDispatch') && !this.hasCustomState) {\n view.dispatch(tr);\n }\n return callback;\n };\n return [name, method];\n }));\n }\n get chain() {\n return () => this.createChain();\n }\n get can() {\n return () => this.createCan();\n }\n createChain(startTr, shouldDispatch = true) {\n const {\n rawCommands,\n editor,\n state\n } = this;\n const {\n view\n } = editor;\n const callbacks = [];\n const hasStartTransaction = !!startTr;\n const tr = startTr || state.tr;\n const run = () => {\n if (!hasStartTransaction && shouldDispatch && !tr.getMeta('preventDispatch') && !this.hasCustomState) {\n view.dispatch(tr);\n }\n return callbacks.every(callback => callback === true);\n };\n const chain = {\n ...Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n const chainedCommand = (...args) => {\n const props = this.buildProps(tr, shouldDispatch);\n const callback = command(...args)(props);\n callbacks.push(callback);\n return chain;\n };\n return [name, chainedCommand];\n })),\n run\n };\n return chain;\n }\n createCan(startTr) {\n const {\n rawCommands,\n state\n } = this;\n const dispatch = false;\n const tr = startTr || state.tr;\n const props = this.buildProps(tr, dispatch);\n const formattedCommands = Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n return [name, (...args) => command(...args)({\n ...props,\n dispatch: undefined\n })];\n }));\n return {\n ...formattedCommands,\n chain: () => this.createChain(tr, dispatch)\n };\n }\n buildProps(tr, shouldDispatch = true) {\n const {\n rawCommands,\n editor,\n state\n } = this;\n const {\n view\n } = editor;\n const props = {\n tr,\n editor,\n view,\n state: createChainableState({\n state,\n transaction: tr\n }),\n dispatch: shouldDispatch ? () => undefined : undefined,\n chain: () => this.createChain(tr, shouldDispatch),\n can: () => this.createCan(tr),\n get commands() {\n return Object.fromEntries(Object.entries(rawCommands).map(([name, command]) => {\n return [name, (...args) => command(...args)(props)];\n }));\n }\n };\n return props;\n }\n}\nclass EventEmitter {\n constructor() {\n this.callbacks = {};\n }\n on(event, fn) {\n if (!this.callbacks[event]) {\n this.callbacks[event] = [];\n }\n this.callbacks[event].push(fn);\n return this;\n }\n emit(event, ...args) {\n const callbacks = this.callbacks[event];\n if (callbacks) {\n callbacks.forEach(callback => callback.apply(this, args));\n }\n return this;\n }\n off(event, fn) {\n const callbacks = this.callbacks[event];\n if (callbacks) {\n if (fn) {\n this.callbacks[event] = callbacks.filter(callback => callback !== fn);\n } else {\n delete this.callbacks[event];\n }\n }\n return this;\n }\n once(event, fn) {\n const onceFn = (...args) => {\n this.off(event, onceFn);\n fn.apply(this, args);\n };\n return this.on(event, onceFn);\n }\n removeAllListeners() {\n this.callbacks = {};\n }\n}\n\n/**\n * Returns a field from an extension\n * @param extension The Tiptap extension\n * @param field The field, for example `renderHTML` or `priority`\n * @param context The context object that should be passed as `this` into the function\n * @returns The field value\n */\nfunction getExtensionField(extension, field, context) {\n if (extension.config[field] === undefined && extension.parent) {\n return getExtensionField(extension.parent, field, context);\n }\n if (typeof extension.config[field] === 'function') {\n const value = extension.config[field].bind({\n ...context,\n parent: extension.parent ? getExtensionField(extension.parent, field, context) : null\n });\n return value;\n }\n return extension.config[field];\n}\nfunction splitExtensions(extensions) {\n const baseExtensions = extensions.filter(extension => extension.type === 'extension');\n const nodeExtensions = extensions.filter(extension => extension.type === 'node');\n const markExtensions = extensions.filter(extension => extension.type === 'mark');\n return {\n baseExtensions,\n nodeExtensions,\n markExtensions\n };\n}\n\n/**\n * Get a list of all extension attributes defined in `addAttribute` and `addGlobalAttribute`.\n * @param extensions List of extensions\n */\nfunction getAttributesFromExtensions(extensions) {\n const extensionAttributes = [];\n const {\n nodeExtensions,\n markExtensions\n } = splitExtensions(extensions);\n const nodeAndMarkExtensions = [...nodeExtensions, ...markExtensions];\n const defaultAttribute = {\n default: null,\n rendered: true,\n renderHTML: null,\n parseHTML: null,\n keepOnSplit: true,\n isRequired: false\n };\n extensions.forEach(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n extensions: nodeAndMarkExtensions\n };\n const addGlobalAttributes = getExtensionField(extension, 'addGlobalAttributes', context);\n if (!addGlobalAttributes) {\n return;\n }\n const globalAttributes = addGlobalAttributes();\n globalAttributes.forEach(globalAttribute => {\n globalAttribute.types.forEach(type => {\n Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {\n extensionAttributes.push({\n type,\n name,\n attribute: {\n ...defaultAttribute,\n ...attribute\n }\n });\n });\n });\n });\n });\n nodeAndMarkExtensions.forEach(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const addAttributes = getExtensionField(extension, 'addAttributes', context);\n if (!addAttributes) {\n return;\n }\n // TODO: remove `as Attributes`\n const attributes = addAttributes();\n Object.entries(attributes).forEach(([name, attribute]) => {\n const mergedAttr = {\n ...defaultAttribute,\n ...attribute\n };\n if (typeof (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === 'function') {\n mergedAttr.default = mergedAttr.default();\n }\n if ((mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.isRequired) && (mergedAttr === null || mergedAttr === void 0 ? void 0 : mergedAttr.default) === undefined) {\n delete mergedAttr.default;\n }\n extensionAttributes.push({\n type: extension.name,\n name,\n attribute: mergedAttr\n });\n });\n });\n return extensionAttributes;\n}\nfunction getNodeType(nameOrType, schema) {\n if (typeof nameOrType === 'string') {\n if (!schema.nodes[nameOrType]) {\n throw Error(`There is no node type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n }\n return schema.nodes[nameOrType];\n }\n return nameOrType;\n}\nfunction mergeAttributes(...objects) {\n return objects.filter(item => !!item).reduce((items, item) => {\n const mergedAttributes = {\n ...items\n };\n Object.entries(item).forEach(([key, value]) => {\n const exists = mergedAttributes[key];\n if (!exists) {\n mergedAttributes[key] = value;\n return;\n }\n if (key === 'class') {\n const valueClasses = value ? value.split(' ') : [];\n const existingClasses = mergedAttributes[key] ? mergedAttributes[key].split(' ') : [];\n const insertClasses = valueClasses.filter(valueClass => !existingClasses.includes(valueClass));\n mergedAttributes[key] = [...existingClasses, ...insertClasses].join(' ');\n } else if (key === 'style') {\n const newStyles = value ? value.split(';').map(style => style.trim()).filter(Boolean) : [];\n const existingStyles = mergedAttributes[key] ? mergedAttributes[key].split(';').map(style => style.trim()).filter(Boolean) : [];\n const styleMap = new Map();\n existingStyles.forEach(style => {\n const [property, val] = style.split(':').map(part => part.trim());\n styleMap.set(property, val);\n });\n newStyles.forEach(style => {\n const [property, val] = style.split(':').map(part => part.trim());\n styleMap.set(property, val);\n });\n mergedAttributes[key] = Array.from(styleMap.entries()).map(([property, val]) => `${property}: ${val}`).join('; ');\n } else {\n mergedAttributes[key] = value;\n }\n });\n return mergedAttributes;\n }, {});\n}\nfunction getRenderedAttributes(nodeOrMark, extensionAttributes) {\n return extensionAttributes.filter(attribute => attribute.type === nodeOrMark.type.name).filter(item => item.attribute.rendered).map(item => {\n if (!item.attribute.renderHTML) {\n return {\n [item.name]: nodeOrMark.attrs[item.name]\n };\n }\n return item.attribute.renderHTML(nodeOrMark.attrs) || {};\n }).reduce((attributes, attribute) => mergeAttributes(attributes, attribute), {});\n}\nfunction isFunction(value) {\n return typeof value === 'function';\n}\n\n/**\n * Optionally calls `value` as a function.\n * Otherwise it is returned directly.\n * @param value Function or any value.\n * @param context Optional context to bind to function.\n * @param props Optional props to pass to function.\n */\nfunction callOrReturn(value, context = undefined, ...props) {\n if (isFunction(value)) {\n if (context) {\n return value.bind(context)(...props);\n }\n return value(...props);\n }\n return value;\n}\nfunction isEmptyObject(value = {}) {\n return Object.keys(value).length === 0 && value.constructor === Object;\n}\nfunction fromString(value) {\n if (typeof value !== 'string') {\n return value;\n }\n if (value.match(/^[+-]?(?:\\d*\\.)?\\d+$/)) {\n return Number(value);\n }\n if (value === 'true') {\n return true;\n }\n if (value === 'false') {\n return false;\n }\n return value;\n}\n\n/**\n * This function merges extension attributes into parserule attributes (`attrs` or `getAttrs`).\n * Cancels when `getAttrs` returned `false`.\n * @param parseRule ProseMirror ParseRule\n * @param extensionAttributes List of attributes to inject\n */\nfunction injectExtensionAttributesToParseRule(parseRule, extensionAttributes) {\n if ('style' in parseRule) {\n return parseRule;\n }\n return {\n ...parseRule,\n getAttrs: node => {\n const oldAttributes = parseRule.getAttrs ? parseRule.getAttrs(node) : parseRule.attrs;\n if (oldAttributes === false) {\n return false;\n }\n const newAttributes = extensionAttributes.reduce((items, item) => {\n const value = item.attribute.parseHTML ? item.attribute.parseHTML(node) : fromString(node.getAttribute(item.name));\n if (value === null || value === undefined) {\n return items;\n }\n return {\n ...items,\n [item.name]: value\n };\n }, {});\n return {\n ...oldAttributes,\n ...newAttributes\n };\n }\n };\n}\nfunction cleanUpSchemaItem(data) {\n return Object.fromEntries(\n // @ts-ignore\n Object.entries(data).filter(([key, value]) => {\n if (key === 'attrs' && isEmptyObject(value)) {\n return false;\n }\n return value !== null && value !== undefined;\n }));\n}\n/**\n * Creates a new Prosemirror schema based on the given extensions.\n * @param extensions An array of Tiptap extensions\n * @param editor The editor instance\n * @returns A Prosemirror schema\n */\nfunction getSchemaByResolvedExtensions(extensions, editor) {\n var _a;\n const allAttributes = getAttributesFromExtensions(extensions);\n const {\n nodeExtensions,\n markExtensions\n } = splitExtensions(extensions);\n const topNode = (_a = nodeExtensions.find(extension => getExtensionField(extension, 'topNode'))) === null || _a === void 0 ? void 0 : _a.name;\n const nodes = Object.fromEntries(nodeExtensions.map(extension => {\n const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name);\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor\n };\n const extraNodeFields = extensions.reduce((fields, e) => {\n const extendNodeSchema = getExtensionField(e, 'extendNodeSchema', context);\n return {\n ...fields,\n ...(extendNodeSchema ? extendNodeSchema(extension) : {})\n };\n }, {});\n const schema = cleanUpSchemaItem({\n ...extraNodeFields,\n content: callOrReturn(getExtensionField(extension, 'content', context)),\n marks: callOrReturn(getExtensionField(extension, 'marks', context)),\n group: callOrReturn(getExtensionField(extension, 'group', context)),\n inline: callOrReturn(getExtensionField(extension, 'inline', context)),\n atom: callOrReturn(getExtensionField(extension, 'atom', context)),\n selectable: callOrReturn(getExtensionField(extension, 'selectable', context)),\n draggable: callOrReturn(getExtensionField(extension, 'draggable', context)),\n code: callOrReturn(getExtensionField(extension, 'code', context)),\n whitespace: callOrReturn(getExtensionField(extension, 'whitespace', context)),\n linebreakReplacement: callOrReturn(getExtensionField(extension, 'linebreakReplacement', context)),\n defining: callOrReturn(getExtensionField(extension, 'defining', context)),\n isolating: callOrReturn(getExtensionField(extension, 'isolating', context)),\n attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {\n var _a;\n return [extensionAttribute.name, {\n default: (_a = extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) === null || _a === void 0 ? void 0 : _a.default\n }];\n }))\n });\n const parseHTML = callOrReturn(getExtensionField(extension, 'parseHTML', context));\n if (parseHTML) {\n schema.parseDOM = parseHTML.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n }\n const renderHTML = getExtensionField(extension, 'renderHTML', context);\n if (renderHTML) {\n schema.toDOM = node => renderHTML({\n node,\n HTMLAttributes: getRenderedAttributes(node, extensionAttributes)\n });\n }\n const renderText = getExtensionField(extension, 'renderText', context);\n if (renderText) {\n schema.toText = renderText;\n }\n return [extension.name, schema];\n }));\n const marks = Object.fromEntries(markExtensions.map(extension => {\n const extensionAttributes = allAttributes.filter(attribute => attribute.type === extension.name);\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor\n };\n const extraMarkFields = extensions.reduce((fields, e) => {\n const extendMarkSchema = getExtensionField(e, 'extendMarkSchema', context);\n return {\n ...fields,\n ...(extendMarkSchema ? extendMarkSchema(extension) : {})\n };\n }, {});\n const schema = cleanUpSchemaItem({\n ...extraMarkFields,\n inclusive: callOrReturn(getExtensionField(extension, 'inclusive', context)),\n excludes: callOrReturn(getExtensionField(extension, 'excludes', context)),\n group: callOrReturn(getExtensionField(extension, 'group', context)),\n spanning: callOrReturn(getExtensionField(extension, 'spanning', context)),\n code: callOrReturn(getExtensionField(extension, 'code', context)),\n attrs: Object.fromEntries(extensionAttributes.map(extensionAttribute => {\n var _a;\n return [extensionAttribute.name, {\n default: (_a = extensionAttribute === null || extensionAttribute === void 0 ? void 0 : extensionAttribute.attribute) === null || _a === void 0 ? void 0 : _a.default\n }];\n }))\n });\n const parseHTML = callOrReturn(getExtensionField(extension, 'parseHTML', context));\n if (parseHTML) {\n schema.parseDOM = parseHTML.map(parseRule => injectExtensionAttributesToParseRule(parseRule, extensionAttributes));\n }\n const renderHTML = getExtensionField(extension, 'renderHTML', context);\n if (renderHTML) {\n schema.toDOM = mark => renderHTML({\n mark,\n HTMLAttributes: getRenderedAttributes(mark, extensionAttributes)\n });\n }\n return [extension.name, schema];\n }));\n return new Schema({\n topNode,\n nodes,\n marks\n });\n}\n\n/**\n * Tries to get a node or mark type by its name.\n * @param name The name of the node or mark type\n * @param schema The Prosemiror schema to search in\n * @returns The node or mark type, or null if it doesn't exist\n */\nfunction getSchemaTypeByName(name, schema) {\n return schema.nodes[name] || schema.marks[name] || null;\n}\nfunction isExtensionRulesEnabled(extension, enabled) {\n if (Array.isArray(enabled)) {\n return enabled.some(enabledExtension => {\n const name = typeof enabledExtension === 'string' ? enabledExtension : enabledExtension.name;\n return name === extension.name;\n });\n }\n return enabled;\n}\nfunction getHTMLFromFragment(fragment, schema) {\n const documentFragment = DOMSerializer.fromSchema(schema).serializeFragment(fragment);\n const temporaryDocument = document.implementation.createHTMLDocument();\n const container = temporaryDocument.createElement('div');\n container.appendChild(documentFragment);\n return container.innerHTML;\n}\n\n/**\n * Returns the text content of a resolved prosemirror position\n * @param $from The resolved position to get the text content from\n * @param maxMatch The maximum number of characters to match\n * @returns The text content\n */\nconst getTextContentFromNodes = ($from, maxMatch = 500) => {\n let textBefore = '';\n const sliceEndPos = $from.parentOffset;\n $from.parent.nodesBetween(Math.max(0, sliceEndPos - maxMatch), sliceEndPos, (node, pos, parent, index) => {\n var _a, _b;\n const chunk = ((_b = (_a = node.type.spec).toText) === null || _b === void 0 ? void 0 : _b.call(_a, {\n node,\n pos,\n parent,\n index\n })) || node.textContent || '%leaf%';\n textBefore += node.isAtom && !node.isText ? chunk : chunk.slice(0, Math.max(0, sliceEndPos - pos));\n });\n return textBefore;\n};\nfunction isRegExp(value) {\n return Object.prototype.toString.call(value) === '[object RegExp]';\n}\nclass InputRule {\n constructor(config) {\n this.find = config.find;\n this.handler = config.handler;\n }\n}\nconst inputRuleMatcherHandler = (text, find) => {\n if (isRegExp(find)) {\n return find.exec(text);\n }\n const inputRuleMatch = find(text);\n if (!inputRuleMatch) {\n return null;\n }\n const result = [inputRuleMatch.text];\n result.index = inputRuleMatch.index;\n result.input = text;\n result.data = inputRuleMatch.data;\n if (inputRuleMatch.replaceWith) {\n if (!inputRuleMatch.text.includes(inputRuleMatch.replaceWith)) {\n console.warn('[tiptap warn]: \"inputRuleMatch.replaceWith\" must be part of \"inputRuleMatch.text\".');\n }\n result.push(inputRuleMatch.replaceWith);\n }\n return result;\n};\nfunction run$1(config) {\n var _a;\n const {\n editor,\n from,\n to,\n text,\n rules,\n plugin\n } = config;\n const {\n view\n } = editor;\n if (view.composing) {\n return false;\n }\n const $from = view.state.doc.resolve(from);\n if (\n // check for code node\n $from.parent.type.spec.code\n // check for code mark\n || !!((_a = $from.nodeBefore || $from.nodeAfter) === null || _a === void 0 ? void 0 : _a.marks.find(mark => mark.type.spec.code))) {\n return false;\n }\n let matched = false;\n const textBefore = getTextContentFromNodes($from) + text;\n rules.forEach(rule => {\n if (matched) {\n return;\n }\n const match = inputRuleMatcherHandler(textBefore, rule.find);\n if (!match) {\n return;\n }\n const tr = view.state.tr;\n const state = createChainableState({\n state: view.state,\n transaction: tr\n });\n const range = {\n from: from - (match[0].length - text.length),\n to\n };\n const {\n commands,\n chain,\n can\n } = new CommandManager({\n editor,\n state\n });\n const handler = rule.handler({\n state,\n range,\n match,\n commands,\n chain,\n can\n });\n // stop if there are no changes\n if (handler === null || !tr.steps.length) {\n return;\n }\n // store transform as meta data\n // so we can undo input rules within the `undoInputRules` command\n tr.setMeta(plugin, {\n transform: tr,\n from,\n to,\n text\n });\n view.dispatch(tr);\n matched = true;\n });\n return matched;\n}\n/**\n * Create an input rules plugin. When enabled, it will cause text\n * input that matches any of the given rules to trigger the rule’s\n * action.\n */\nfunction inputRulesPlugin(props) {\n const {\n editor,\n rules\n } = props;\n const plugin = new Plugin({\n state: {\n init() {\n return null;\n },\n apply(tr, prev, state) {\n const stored = tr.getMeta(plugin);\n if (stored) {\n return stored;\n }\n // if InputRule is triggered by insertContent()\n const simulatedInputMeta = tr.getMeta('applyInputRules');\n const isSimulatedInput = !!simulatedInputMeta;\n if (isSimulatedInput) {\n setTimeout(() => {\n let {\n text\n } = simulatedInputMeta;\n if (typeof text === 'string') {\n text = text;\n } else {\n text = getHTMLFromFragment(Fragment.from(text), state.schema);\n }\n const {\n from\n } = simulatedInputMeta;\n const to = from + text.length;\n run$1({\n editor,\n from,\n to,\n text,\n rules,\n plugin\n });\n });\n }\n return tr.selectionSet || tr.docChanged ? null : prev;\n }\n },\n props: {\n handleTextInput(view, from, to, text) {\n return run$1({\n editor,\n from,\n to,\n text,\n rules,\n plugin\n });\n },\n handleDOMEvents: {\n compositionend: view => {\n setTimeout(() => {\n const {\n $cursor\n } = view.state.selection;\n if ($cursor) {\n run$1({\n editor,\n from: $cursor.pos,\n to: $cursor.pos,\n text: '',\n rules,\n plugin\n });\n }\n });\n return false;\n }\n },\n // add support for input rules to trigger on enter\n // this is useful for example for code blocks\n handleKeyDown(view, event) {\n if (event.key !== 'Enter') {\n return false;\n }\n const {\n $cursor\n } = view.state.selection;\n if ($cursor) {\n return run$1({\n editor,\n from: $cursor.pos,\n to: $cursor.pos,\n text: '\\n',\n rules,\n plugin\n });\n }\n return false;\n }\n },\n // @ts-ignore\n isInputRules: true\n });\n return plugin;\n}\n\n// see: https://github.com/mesqueeb/is-what/blob/88d6e4ca92fb2baab6003c54e02eedf4e729e5ab/src/index.ts\nfunction getType(value) {\n return Object.prototype.toString.call(value).slice(8, -1);\n}\nfunction isPlainObject(value) {\n if (getType(value) !== 'Object') {\n return false;\n }\n return value.constructor === Object && Object.getPrototypeOf(value) === Object.prototype;\n}\nfunction mergeDeep(target, source) {\n const output = {\n ...target\n };\n if (isPlainObject(target) && isPlainObject(source)) {\n Object.keys(source).forEach(key => {\n if (isPlainObject(source[key]) && isPlainObject(target[key])) {\n output[key] = mergeDeep(target[key], source[key]);\n } else {\n output[key] = source[key];\n }\n });\n }\n return output;\n}\n\n/**\n * The Mark class is used to create custom mark extensions.\n * @see https://tiptap.dev/api/extensions#create-a-new-extension\n */\nclass Mark {\n constructor(config = {}) {\n this.type = 'mark';\n this.name = 'mark';\n this.parent = null;\n this.child = null;\n this.config = {\n name: this.name,\n defaultOptions: {}\n };\n this.config = {\n ...this.config,\n ...config\n };\n this.name = this.config.name;\n if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${this.name}\".`);\n }\n // TODO: remove `addOptions` fallback\n this.options = this.config.defaultOptions;\n if (this.config.addOptions) {\n this.options = callOrReturn(getExtensionField(this, 'addOptions', {\n name: this.name\n }));\n }\n this.storage = callOrReturn(getExtensionField(this, 'addStorage', {\n name: this.name,\n options: this.options\n })) || {};\n }\n static create(config = {}) {\n return new Mark(config);\n }\n configure(options = {}) {\n // return a new instance so we can use the same extension\n // with different calls of `configure`\n const extension = this.extend({\n ...this.config,\n addOptions: () => {\n return mergeDeep(this.options, options);\n }\n });\n // Always preserve the current name\n extension.name = this.name;\n // Set the parent to be our parent\n extension.parent = this.parent;\n return extension;\n }\n extend(extendedConfig = {}) {\n const extension = new Mark(extendedConfig);\n extension.parent = this;\n this.child = extension;\n extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;\n if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${extension.name}\".`);\n }\n extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {\n name: extension.name\n }));\n extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {\n name: extension.name,\n options: extension.options\n }));\n return extension;\n }\n static handleExit({\n editor,\n mark\n }) {\n const {\n tr\n } = editor.state;\n const currentPos = editor.state.selection.$from;\n const isAtEnd = currentPos.pos === currentPos.end();\n if (isAtEnd) {\n const currentMarks = currentPos.marks();\n const isInMark = !!currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);\n if (!isInMark) {\n return false;\n }\n const removeMark = currentMarks.find(m => (m === null || m === void 0 ? void 0 : m.type.name) === mark.name);\n if (removeMark) {\n tr.removeStoredMark(removeMark);\n }\n tr.insertText(' ', currentPos.pos);\n editor.view.dispatch(tr);\n return true;\n }\n return false;\n }\n}\nfunction isNumber(value) {\n return typeof value === 'number';\n}\n\n/**\n * Paste rules are used to react to pasted content.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nclass PasteRule {\n constructor(config) {\n this.find = config.find;\n this.handler = config.handler;\n }\n}\nconst pasteRuleMatcherHandler = (text, find, event) => {\n if (isRegExp(find)) {\n return [...text.matchAll(find)];\n }\n const matches = find(text, event);\n if (!matches) {\n return [];\n }\n return matches.map(pasteRuleMatch => {\n const result = [pasteRuleMatch.text];\n result.index = pasteRuleMatch.index;\n result.input = text;\n result.data = pasteRuleMatch.data;\n if (pasteRuleMatch.replaceWith) {\n if (!pasteRuleMatch.text.includes(pasteRuleMatch.replaceWith)) {\n console.warn('[tiptap warn]: \"pasteRuleMatch.replaceWith\" must be part of \"pasteRuleMatch.text\".');\n }\n result.push(pasteRuleMatch.replaceWith);\n }\n return result;\n });\n};\nfunction run(config) {\n const {\n editor,\n state,\n from,\n to,\n rule,\n pasteEvent,\n dropEvent\n } = config;\n const {\n commands,\n chain,\n can\n } = new CommandManager({\n editor,\n state\n });\n const handlers = [];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isTextblock || node.type.spec.code) {\n return;\n }\n const resolvedFrom = Math.max(from, pos);\n const resolvedTo = Math.min(to, pos + node.content.size);\n const textToMatch = node.textBetween(resolvedFrom - pos, resolvedTo - pos, undefined, '\\ufffc');\n const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);\n matches.forEach(match => {\n if (match.index === undefined) {\n return;\n }\n const start = resolvedFrom + match.index + 1;\n const end = start + match[0].length;\n const range = {\n from: state.tr.mapping.map(start),\n to: state.tr.mapping.map(end)\n };\n const handler = rule.handler({\n state,\n range,\n match,\n commands,\n chain,\n can,\n pasteEvent,\n dropEvent\n });\n handlers.push(handler);\n });\n });\n const success = handlers.every(handler => handler !== null);\n return success;\n}\nconst createClipboardPasteEvent = text => {\n var _a;\n const event = new ClipboardEvent('paste', {\n clipboardData: new DataTransfer()\n });\n (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.setData('text/html', text);\n return event;\n};\n/**\n * Create an paste rules plugin. When enabled, it will cause pasted\n * text that matches any of the given rules to trigger the rule’s\n * action.\n */\nfunction pasteRulesPlugin(props) {\n const {\n editor,\n rules\n } = props;\n let dragSourceElement = null;\n let isPastedFromProseMirror = false;\n let isDroppedFromProseMirror = false;\n let pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;\n let dropEvent;\n try {\n dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;\n } catch (e) {\n dropEvent = null;\n }\n const processEvent = ({\n state,\n from,\n to,\n rule,\n pasteEvt\n }) => {\n const tr = state.tr;\n const chainableState = createChainableState({\n state,\n transaction: tr\n });\n const handler = run({\n editor,\n state: chainableState,\n from: Math.max(from - 1, 0),\n to: to.b - 1,\n rule,\n pasteEvent: pasteEvt,\n dropEvent\n });\n if (!handler || !tr.steps.length) {\n return;\n }\n try {\n dropEvent = typeof DragEvent !== 'undefined' ? new DragEvent('drop') : null;\n } catch (e) {\n dropEvent = null;\n }\n pasteEvent = typeof ClipboardEvent !== 'undefined' ? new ClipboardEvent('paste') : null;\n return tr;\n };\n const plugins = rules.map(rule => {\n return new Plugin({\n // we register a global drag handler to track the current drag source element\n view(view) {\n const handleDragstart = event => {\n var _a;\n dragSourceElement = ((_a = view.dom.parentElement) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ? view.dom.parentElement : null;\n };\n window.addEventListener('dragstart', handleDragstart);\n return {\n destroy() {\n window.removeEventListener('dragstart', handleDragstart);\n }\n };\n },\n props: {\n handleDOMEvents: {\n drop: (view, event) => {\n isDroppedFromProseMirror = dragSourceElement === view.dom.parentElement;\n dropEvent = event;\n return false;\n },\n paste: (_view, event) => {\n var _a;\n const html = (_a = event.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text/html');\n pasteEvent = event;\n isPastedFromProseMirror = !!(html === null || html === void 0 ? void 0 : html.includes('data-pm-slice'));\n return false;\n }\n }\n },\n appendTransaction: (transactions, oldState, state) => {\n const transaction = transactions[0];\n const isPaste = transaction.getMeta('uiEvent') === 'paste' && !isPastedFromProseMirror;\n const isDrop = transaction.getMeta('uiEvent') === 'drop' && !isDroppedFromProseMirror;\n // if PasteRule is triggered by insertContent()\n const simulatedPasteMeta = transaction.getMeta('applyPasteRules');\n const isSimulatedPaste = !!simulatedPasteMeta;\n if (!isPaste && !isDrop && !isSimulatedPaste) {\n return;\n }\n // Handle simulated paste\n if (isSimulatedPaste) {\n let {\n text\n } = simulatedPasteMeta;\n if (typeof text === 'string') {\n text = text;\n } else {\n text = getHTMLFromFragment(Fragment.from(text), state.schema);\n }\n const {\n from\n } = simulatedPasteMeta;\n const to = from + text.length;\n const pasteEvt = createClipboardPasteEvent(text);\n return processEvent({\n rule,\n state,\n from,\n to: {\n b: to\n },\n pasteEvt\n });\n }\n // handle actual paste/drop\n const from = oldState.doc.content.findDiffStart(state.doc.content);\n const to = oldState.doc.content.findDiffEnd(state.doc.content);\n // stop if there is no changed range\n if (!isNumber(from) || !to || from === to.b) {\n return;\n }\n return processEvent({\n rule,\n state,\n from,\n to,\n pasteEvt: pasteEvent\n });\n }\n });\n });\n return plugins;\n}\nfunction findDuplicates(items) {\n const filtered = items.filter((el, index) => items.indexOf(el) !== index);\n return Array.from(new Set(filtered));\n}\nclass ExtensionManager {\n constructor(extensions, editor) {\n this.splittableMarks = [];\n this.editor = editor;\n this.extensions = ExtensionManager.resolve(extensions);\n this.schema = getSchemaByResolvedExtensions(this.extensions, editor);\n this.setupExtensions();\n }\n /**\n * Returns a flattened and sorted extension list while\n * also checking for duplicated extensions and warns the user.\n * @param extensions An array of Tiptap extensions\n * @returns An flattened and sorted array of Tiptap extensions\n */\n static resolve(extensions) {\n const resolvedExtensions = ExtensionManager.sort(ExtensionManager.flatten(extensions));\n const duplicatedNames = findDuplicates(resolvedExtensions.map(extension => extension.name));\n if (duplicatedNames.length) {\n console.warn(`[tiptap warn]: Duplicate extension names found: [${duplicatedNames.map(item => `'${item}'`).join(', ')}]. This can lead to issues.`);\n }\n return resolvedExtensions;\n }\n /**\n * Create a flattened array of extensions by traversing the `addExtensions` field.\n * @param extensions An array of Tiptap extensions\n * @returns A flattened array of Tiptap extensions\n */\n static flatten(extensions) {\n return extensions.map(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const addExtensions = getExtensionField(extension, 'addExtensions', context);\n if (addExtensions) {\n return [extension, ...this.flatten(addExtensions())];\n }\n return extension;\n })\n // `Infinity` will break TypeScript so we set a number that is probably high enough\n .flat(10);\n }\n /**\n * Sort extensions by priority.\n * @param extensions An array of Tiptap extensions\n * @returns A sorted array of Tiptap extensions by priority\n */\n static sort(extensions) {\n const defaultPriority = 100;\n return extensions.sort((a, b) => {\n const priorityA = getExtensionField(a, 'priority') || defaultPriority;\n const priorityB = getExtensionField(b, 'priority') || defaultPriority;\n if (priorityA > priorityB) {\n return -1;\n }\n if (priorityA < priorityB) {\n return 1;\n }\n return 0;\n });\n }\n /**\n * Get all commands from the extensions.\n * @returns An object with all commands where the key is the command name and the value is the command function\n */\n get commands() {\n return this.extensions.reduce((commands, extension) => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor: this.editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const addCommands = getExtensionField(extension, 'addCommands', context);\n if (!addCommands) {\n return commands;\n }\n return {\n ...commands,\n ...addCommands()\n };\n }, {});\n }\n /**\n * Get all registered Prosemirror plugins from the extensions.\n * @returns An array of Prosemirror plugins\n */\n get plugins() {\n const {\n editor\n } = this;\n // With ProseMirror, first plugins within an array are executed first.\n // In Tiptap, we provide the ability to override plugins,\n // so it feels more natural to run plugins at the end of an array first.\n // That’s why we have to reverse the `extensions` array and sort again\n // based on the `priority` option.\n const extensions = ExtensionManager.sort([...this.extensions].reverse());\n const inputRules = [];\n const pasteRules = [];\n const allPlugins = extensions.map(extension => {\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n const plugins = [];\n const addKeyboardShortcuts = getExtensionField(extension, 'addKeyboardShortcuts', context);\n let defaultBindings = {};\n // bind exit handling\n if (extension.type === 'mark' && getExtensionField(extension, 'exitable', context)) {\n defaultBindings.ArrowRight = () => Mark.handleExit({\n editor,\n mark: extension\n });\n }\n if (addKeyboardShortcuts) {\n const bindings = Object.fromEntries(Object.entries(addKeyboardShortcuts()).map(([shortcut, method]) => {\n return [shortcut, () => method({\n editor\n })];\n }));\n defaultBindings = {\n ...defaultBindings,\n ...bindings\n };\n }\n const keyMapPlugin = keymap(defaultBindings);\n plugins.push(keyMapPlugin);\n const addInputRules = getExtensionField(extension, 'addInputRules', context);\n if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {\n inputRules.push(...addInputRules());\n }\n const addPasteRules = getExtensionField(extension, 'addPasteRules', context);\n if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {\n pasteRules.push(...addPasteRules());\n }\n const addProseMirrorPlugins = getExtensionField(extension, 'addProseMirrorPlugins', context);\n if (addProseMirrorPlugins) {\n const proseMirrorPlugins = addProseMirrorPlugins();\n plugins.push(...proseMirrorPlugins);\n }\n return plugins;\n }).flat();\n return [inputRulesPlugin({\n editor,\n rules: inputRules\n }), ...pasteRulesPlugin({\n editor,\n rules: pasteRules\n }), ...allPlugins];\n }\n /**\n * Get all attributes from the extensions.\n * @returns An array of attributes\n */\n get attributes() {\n return getAttributesFromExtensions(this.extensions);\n }\n /**\n * Get all node views from the extensions.\n * @returns An object with all node views where the key is the node name and the value is the node view function\n */\n get nodeViews() {\n const {\n editor\n } = this;\n const {\n nodeExtensions\n } = splitExtensions(this.extensions);\n return Object.fromEntries(nodeExtensions.filter(extension => !!getExtensionField(extension, 'addNodeView')).map(extension => {\n const extensionAttributes = this.attributes.filter(attribute => attribute.type === extension.name);\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor,\n type: getNodeType(extension.name, this.schema)\n };\n const addNodeView = getExtensionField(extension, 'addNodeView', context);\n if (!addNodeView) {\n return [];\n }\n const nodeview = (node, view, getPos, decorations, innerDecorations) => {\n const HTMLAttributes = getRenderedAttributes(node, extensionAttributes);\n return addNodeView()({\n // pass-through\n node,\n view,\n getPos: getPos,\n decorations,\n innerDecorations,\n // tiptap-specific\n editor,\n extension,\n HTMLAttributes\n });\n };\n return [extension.name, nodeview];\n }));\n }\n /**\n * Go through all extensions, create extension storages & setup marks\n * & bind editor event listener.\n */\n setupExtensions() {\n this.extensions.forEach(extension => {\n var _a;\n // store extension storage in editor\n this.editor.extensionStorage[extension.name] = extension.storage;\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage,\n editor: this.editor,\n type: getSchemaTypeByName(extension.name, this.schema)\n };\n if (extension.type === 'mark') {\n const keepOnSplit = (_a = callOrReturn(getExtensionField(extension, 'keepOnSplit', context))) !== null && _a !== void 0 ? _a : true;\n if (keepOnSplit) {\n this.splittableMarks.push(extension.name);\n }\n }\n const onBeforeCreate = getExtensionField(extension, 'onBeforeCreate', context);\n const onCreate = getExtensionField(extension, 'onCreate', context);\n const onUpdate = getExtensionField(extension, 'onUpdate', context);\n const onSelectionUpdate = getExtensionField(extension, 'onSelectionUpdate', context);\n const onTransaction = getExtensionField(extension, 'onTransaction', context);\n const onFocus = getExtensionField(extension, 'onFocus', context);\n const onBlur = getExtensionField(extension, 'onBlur', context);\n const onDestroy = getExtensionField(extension, 'onDestroy', context);\n if (onBeforeCreate) {\n this.editor.on('beforeCreate', onBeforeCreate);\n }\n if (onCreate) {\n this.editor.on('create', onCreate);\n }\n if (onUpdate) {\n this.editor.on('update', onUpdate);\n }\n if (onSelectionUpdate) {\n this.editor.on('selectionUpdate', onSelectionUpdate);\n }\n if (onTransaction) {\n this.editor.on('transaction', onTransaction);\n }\n if (onFocus) {\n this.editor.on('focus', onFocus);\n }\n if (onBlur) {\n this.editor.on('blur', onBlur);\n }\n if (onDestroy) {\n this.editor.on('destroy', onDestroy);\n }\n });\n }\n}\n\n/**\n * The Extension class is the base class for all extensions.\n * @see https://tiptap.dev/api/extensions#create-a-new-extension\n */\nclass Extension {\n constructor(config = {}) {\n this.type = 'extension';\n this.name = 'extension';\n this.parent = null;\n this.child = null;\n this.config = {\n name: this.name,\n defaultOptions: {}\n };\n this.config = {\n ...this.config,\n ...config\n };\n this.name = this.config.name;\n if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${this.name}\".`);\n }\n // TODO: remove `addOptions` fallback\n this.options = this.config.defaultOptions;\n if (this.config.addOptions) {\n this.options = callOrReturn(getExtensionField(this, 'addOptions', {\n name: this.name\n }));\n }\n this.storage = callOrReturn(getExtensionField(this, 'addStorage', {\n name: this.name,\n options: this.options\n })) || {};\n }\n static create(config = {}) {\n return new Extension(config);\n }\n configure(options = {}) {\n // return a new instance so we can use the same extension\n // with different calls of `configure`\n const extension = this.extend({\n ...this.config,\n addOptions: () => {\n return mergeDeep(this.options, options);\n }\n });\n // Always preserve the current name\n extension.name = this.name;\n // Set the parent to be our parent\n extension.parent = this.parent;\n return extension;\n }\n extend(extendedConfig = {}) {\n const extension = new Extension({\n ...this.config,\n ...extendedConfig\n });\n extension.parent = this;\n this.child = extension;\n extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;\n if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${extension.name}\".`);\n }\n extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {\n name: extension.name\n }));\n extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {\n name: extension.name,\n options: extension.options\n }));\n return extension;\n }\n}\n\n/**\n * Gets the text between two positions in a Prosemirror node\n * and serializes it using the given text serializers and block separator (see getText)\n * @param startNode The Prosemirror node to start from\n * @param range The range of the text to get\n * @param options Options for the text serializer & block separator\n * @returns The text between the two positions\n */\nfunction getTextBetween(startNode, range, options) {\n const {\n from,\n to\n } = range;\n const {\n blockSeparator = '\\n\\n',\n textSerializers = {}\n } = options || {};\n let text = '';\n startNode.nodesBetween(from, to, (node, pos, parent, index) => {\n var _a;\n if (node.isBlock && pos > from) {\n text += blockSeparator;\n }\n const textSerializer = textSerializers === null || textSerializers === void 0 ? void 0 : textSerializers[node.type.name];\n if (textSerializer) {\n if (parent) {\n text += textSerializer({\n node,\n pos,\n parent,\n index,\n range\n });\n }\n // do not descend into child nodes when there exists a serializer\n return false;\n }\n if (node.isText) {\n text += (_a = node === null || node === void 0 ? void 0 : node.text) === null || _a === void 0 ? void 0 : _a.slice(Math.max(from, pos) - pos, to - pos); // eslint-disable-line\n }\n });\n return text;\n}\n\n/**\n * Find text serializers `toText` in a Prosemirror schema\n * @param schema The Prosemirror schema to search in\n * @returns A record of text serializers by node name\n */\nfunction getTextSerializersFromSchema(schema) {\n return Object.fromEntries(Object.entries(schema.nodes).filter(([, node]) => node.spec.toText).map(([name, node]) => [name, node.spec.toText]));\n}\nconst ClipboardTextSerializer = Extension.create({\n name: 'clipboardTextSerializer',\n addOptions() {\n return {\n blockSeparator: undefined\n };\n },\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('clipboardTextSerializer'),\n props: {\n clipboardTextSerializer: () => {\n const {\n editor\n } = this;\n const {\n state,\n schema\n } = editor;\n const {\n doc,\n selection\n } = state;\n const {\n ranges\n } = selection;\n const from = Math.min(...ranges.map(range => range.$from.pos));\n const to = Math.max(...ranges.map(range => range.$to.pos));\n const textSerializers = getTextSerializersFromSchema(schema);\n const range = {\n from,\n to\n };\n return getTextBetween(doc, range, {\n ...(this.options.blockSeparator !== undefined ? {\n blockSeparator: this.options.blockSeparator\n } : {}),\n textSerializers\n });\n }\n }\n })];\n }\n});\nconst blur = () => ({\n editor,\n view\n}) => {\n requestAnimationFrame(() => {\n var _a;\n if (!editor.isDestroyed) {\n view.dom.blur();\n // Browsers should remove the caret on blur but safari does not.\n // See: https://github.com/ueberdosis/tiptap/issues/2405\n (_a = window === null || window === void 0 ? void 0 : window.getSelection()) === null || _a === void 0 ? void 0 : _a.removeAllRanges();\n }\n });\n return true;\n};\nconst clearContent = (emitUpdate = false) => ({\n commands\n}) => {\n return commands.setContent('', emitUpdate);\n};\nconst clearNodes = () => ({\n state,\n tr,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const {\n ranges\n } = selection;\n if (!dispatch) {\n return true;\n }\n ranges.forEach(({\n $from,\n $to\n }) => {\n state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {\n if (node.type.isText) {\n return;\n }\n const {\n doc,\n mapping\n } = tr;\n const $mappedFrom = doc.resolve(mapping.map(pos));\n const $mappedTo = doc.resolve(mapping.map(pos + node.nodeSize));\n const nodeRange = $mappedFrom.blockRange($mappedTo);\n if (!nodeRange) {\n return;\n }\n const targetLiftDepth = liftTarget(nodeRange);\n if (node.type.isTextblock) {\n const {\n defaultType\n } = $mappedFrom.parent.contentMatchAt($mappedFrom.index());\n tr.setNodeMarkup(nodeRange.start, defaultType);\n }\n if (targetLiftDepth || targetLiftDepth === 0) {\n tr.lift(nodeRange, targetLiftDepth);\n }\n });\n });\n return true;\n};\nconst command = fn => props => {\n return fn(props);\n};\nconst createParagraphNear = () => ({\n state,\n dispatch\n}) => {\n return createParagraphNear$1(state, dispatch);\n};\nconst cut = (originRange, targetPos) => ({\n editor,\n tr\n}) => {\n const {\n state\n } = editor;\n const contentSlice = state.doc.slice(originRange.from, originRange.to);\n tr.deleteRange(originRange.from, originRange.to);\n const newPos = tr.mapping.map(targetPos);\n tr.insert(newPos, contentSlice.content);\n tr.setSelection(new TextSelection(tr.doc.resolve(newPos - 1)));\n return true;\n};\nconst deleteCurrentNode = () => ({\n tr,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const currentNode = selection.$anchor.node();\n // if there is content inside the current node, break out of this command\n if (currentNode.content.size > 0) {\n return false;\n }\n const $pos = tr.selection.$anchor;\n for (let depth = $pos.depth; depth > 0; depth -= 1) {\n const node = $pos.node(depth);\n if (node.type === currentNode.type) {\n if (dispatch) {\n const from = $pos.before(depth);\n const to = $pos.after(depth);\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n }\n }\n return false;\n};\nconst deleteNode = typeOrName => ({\n tr,\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const $pos = tr.selection.$anchor;\n for (let depth = $pos.depth; depth > 0; depth -= 1) {\n const node = $pos.node(depth);\n if (node.type === type) {\n if (dispatch) {\n const from = $pos.before(depth);\n const to = $pos.after(depth);\n tr.delete(from, to).scrollIntoView();\n }\n return true;\n }\n }\n return false;\n};\nconst deleteRange = range => ({\n tr,\n dispatch\n}) => {\n const {\n from,\n to\n } = range;\n if (dispatch) {\n tr.delete(from, to);\n }\n return true;\n};\nconst deleteSelection = () => ({\n state,\n dispatch\n}) => {\n return deleteSelection$1(state, dispatch);\n};\nconst enter = () => ({\n commands\n}) => {\n return commands.keyboardShortcut('Enter');\n};\nconst exitCode = () => ({\n state,\n dispatch\n}) => {\n return exitCode$1(state, dispatch);\n};\n\n/**\n * Check if object1 includes object2\n * @param object1 Object\n * @param object2 Object\n */\nfunction objectIncludes(object1, object2, options = {\n strict: true\n}) {\n const keys = Object.keys(object2);\n if (!keys.length) {\n return true;\n }\n return keys.every(key => {\n if (options.strict) {\n return object2[key] === object1[key];\n }\n if (isRegExp(object2[key])) {\n return object2[key].test(object1[key]);\n }\n return object2[key] === object1[key];\n });\n}\nfunction findMarkInSet(marks, type, attributes = {}) {\n return marks.find(item => {\n return item.type === type && objectIncludes(\n // Only check equality for the attributes that are provided\n Object.fromEntries(Object.keys(attributes).map(k => [k, item.attrs[k]])), attributes);\n });\n}\nfunction isMarkInSet(marks, type, attributes = {}) {\n return !!findMarkInSet(marks, type, attributes);\n}\n/**\n * Get the range of a mark at a resolved position.\n */\nfunction getMarkRange(\n/**\n * The position to get the mark range for.\n */\n$pos,\n/**\n * The mark type to get the range for.\n */\ntype,\n/**\n * The attributes to match against.\n * If not provided, only the first mark at the position will be matched.\n */\nattributes) {\n var _a;\n if (!$pos || !type) {\n return;\n }\n let start = $pos.parent.childAfter($pos.parentOffset);\n // If the cursor is at the start of a text node that does not have the mark, look backward\n if (!start.node || !start.node.marks.some(mark => mark.type === type)) {\n start = $pos.parent.childBefore($pos.parentOffset);\n }\n // If there is no text node with the mark even backward, return undefined\n if (!start.node || !start.node.marks.some(mark => mark.type === type)) {\n return;\n }\n // Default to only matching against the first mark's attributes\n attributes = attributes || ((_a = start.node.marks[0]) === null || _a === void 0 ? void 0 : _a.attrs);\n // We now know that the cursor is either at the start, middle or end of a text node with the specified mark\n // so we can look it up on the targeted mark\n const mark = findMarkInSet([...start.node.marks], type, attributes);\n if (!mark) {\n return;\n }\n let startIndex = start.index;\n let startPos = $pos.start() + start.offset;\n let endIndex = startIndex + 1;\n let endPos = startPos + start.node.nodeSize;\n while (startIndex > 0 && isMarkInSet([...$pos.parent.child(startIndex - 1).marks], type, attributes)) {\n startIndex -= 1;\n startPos -= $pos.parent.child(startIndex).nodeSize;\n }\n while (endIndex < $pos.parent.childCount && isMarkInSet([...$pos.parent.child(endIndex).marks], type, attributes)) {\n endPos += $pos.parent.child(endIndex).nodeSize;\n endIndex += 1;\n }\n return {\n from: startPos,\n to: endPos\n };\n}\nfunction getMarkType(nameOrType, schema) {\n if (typeof nameOrType === 'string') {\n if (!schema.marks[nameOrType]) {\n throw Error(`There is no mark type named '${nameOrType}'. Maybe you forgot to add the extension?`);\n }\n return schema.marks[nameOrType];\n }\n return nameOrType;\n}\nconst extendMarkRange = (typeOrName, attributes = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n const type = getMarkType(typeOrName, state.schema);\n const {\n doc,\n selection\n } = tr;\n const {\n $from,\n from,\n to\n } = selection;\n if (dispatch) {\n const range = getMarkRange($from, type, attributes);\n if (range && range.from <= from && range.to >= to) {\n const newSelection = TextSelection.create(doc, range.from, range.to);\n tr.setSelection(newSelection);\n }\n }\n return true;\n};\nconst first = commands => props => {\n const items = typeof commands === 'function' ? commands(props) : commands;\n for (let i = 0; i < items.length; i += 1) {\n if (items[i](props)) {\n return true;\n }\n }\n return false;\n};\nfunction isTextSelection(value) {\n return value instanceof TextSelection;\n}\nfunction minMax(value = 0, min = 0, max = 0) {\n return Math.min(Math.max(value, min), max);\n}\nfunction resolveFocusPosition(doc, position = null) {\n if (!position) {\n return null;\n }\n const selectionAtStart = Selection.atStart(doc);\n const selectionAtEnd = Selection.atEnd(doc);\n if (position === 'start' || position === true) {\n return selectionAtStart;\n }\n if (position === 'end') {\n return selectionAtEnd;\n }\n const minPos = selectionAtStart.from;\n const maxPos = selectionAtEnd.to;\n if (position === 'all') {\n return TextSelection.create(doc, minMax(0, minPos, maxPos), minMax(doc.content.size, minPos, maxPos));\n }\n return TextSelection.create(doc, minMax(position, minPos, maxPos), minMax(position, minPos, maxPos));\n}\nfunction isiOS() {\n return ['iPad Simulator', 'iPhone Simulator', 'iPod Simulator', 'iPad', 'iPhone', 'iPod'].includes(navigator.platform)\n // iPad on iOS 13 detection\n || navigator.userAgent.includes('Mac') && 'ontouchend' in document;\n}\nconst focus = (position = null, options = {}) => ({\n editor,\n view,\n tr,\n dispatch\n}) => {\n options = {\n scrollIntoView: true,\n ...options\n };\n const delayedFocus = () => {\n // focus within `requestAnimationFrame` breaks focus on iOS\n // so we have to call this\n if (isiOS()) {\n view.dom.focus();\n }\n // For React we have to focus asynchronously. Otherwise wild things happen.\n // see: https://github.com/ueberdosis/tiptap/issues/1520\n requestAnimationFrame(() => {\n if (!editor.isDestroyed) {\n view.focus();\n if (options === null || options === void 0 ? void 0 : options.scrollIntoView) {\n editor.commands.scrollIntoView();\n }\n }\n });\n };\n if (view.hasFocus() && position === null || position === false) {\n return true;\n }\n // we don’t try to resolve a NodeSelection or CellSelection\n if (dispatch && position === null && !isTextSelection(editor.state.selection)) {\n delayedFocus();\n return true;\n }\n // pass through tr.doc instead of editor.state.doc\n // since transactions could change the editors state before this command has been run\n const selection = resolveFocusPosition(tr.doc, position) || editor.state.selection;\n const isSameSelection = editor.state.selection.eq(selection);\n if (dispatch) {\n if (!isSameSelection) {\n tr.setSelection(selection);\n }\n // `tr.setSelection` resets the stored marks\n // so we’ll restore them if the selection is the same as before\n if (isSameSelection && tr.storedMarks) {\n tr.setStoredMarks(tr.storedMarks);\n }\n delayedFocus();\n }\n return true;\n};\nconst forEach = (items, fn) => props => {\n return items.every((item, index) => fn(item, {\n ...props,\n index\n }));\n};\nconst insertContent = (value, options) => ({\n tr,\n commands\n}) => {\n return commands.insertContentAt({\n from: tr.selection.from,\n to: tr.selection.to\n }, value, options);\n};\nconst removeWhitespaces = node => {\n const children = node.childNodes;\n for (let i = children.length - 1; i >= 0; i -= 1) {\n const child = children[i];\n if (child.nodeType === 3 && child.nodeValue && /^(\\n\\s\\s|\\n)$/.test(child.nodeValue)) {\n node.removeChild(child);\n } else if (child.nodeType === 1) {\n removeWhitespaces(child);\n }\n }\n return node;\n};\nfunction elementFromString(value) {\n // add a wrapper to preserve leading and trailing whitespace\n const wrappedValue = `${value}`;\n const html = new window.DOMParser().parseFromString(wrappedValue, 'text/html').body;\n return removeWhitespaces(html);\n}\n\n/**\n * Takes a JSON or HTML content and creates a Prosemirror node or fragment from it.\n * @param content The JSON or HTML content to create the node from\n * @param schema The Prosemirror schema to use for the node\n * @param options Options for the parser\n * @returns The created Prosemirror node or fragment\n */\nfunction createNodeFromContent(content, schema, options) {\n if (content instanceof Node$1 || content instanceof Fragment) {\n return content;\n }\n options = {\n slice: true,\n parseOptions: {},\n ...options\n };\n const isJSONContent = typeof content === 'object' && content !== null;\n const isTextContent = typeof content === 'string';\n if (isJSONContent) {\n try {\n const isArrayContent = Array.isArray(content) && content.length > 0;\n // if the JSON Content is an array of nodes, create a fragment for each node\n if (isArrayContent) {\n return Fragment.fromArray(content.map(item => schema.nodeFromJSON(item)));\n }\n const node = schema.nodeFromJSON(content);\n if (options.errorOnInvalidContent) {\n node.check();\n }\n return node;\n } catch (error) {\n if (options.errorOnInvalidContent) {\n throw new Error('[tiptap error]: Invalid JSON content', {\n cause: error\n });\n }\n console.warn('[tiptap warn]: Invalid content.', 'Passed value:', content, 'Error:', error);\n return createNodeFromContent('', schema, options);\n }\n }\n if (isTextContent) {\n // Check for invalid content\n if (options.errorOnInvalidContent) {\n let hasInvalidContent = false;\n let invalidContent = '';\n // A copy of the current schema with a catch-all node at the end\n const contentCheckSchema = new Schema({\n topNode: schema.spec.topNode,\n marks: schema.spec.marks,\n // Prosemirror's schemas are executed such that: the last to execute, matches last\n // This means that we can add a catch-all node at the end of the schema to catch any content that we don't know how to handle\n nodes: schema.spec.nodes.append({\n __tiptap__private__unknown__catch__all__node: {\n content: 'inline*',\n group: 'block',\n parseDOM: [{\n tag: '*',\n getAttrs: e => {\n // If this is ever called, we know that the content has something that we don't know how to handle in the schema\n hasInvalidContent = true;\n // Try to stringify the element for a more helpful error message\n invalidContent = typeof e === 'string' ? e : e.outerHTML;\n return null;\n }\n }]\n }\n })\n });\n if (options.slice) {\n DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options.parseOptions);\n } else {\n DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options.parseOptions);\n }\n if (options.errorOnInvalidContent && hasInvalidContent) {\n throw new Error('[tiptap error]: Invalid HTML content', {\n cause: new Error(`Invalid element found: ${invalidContent}`)\n });\n }\n }\n const parser = DOMParser.fromSchema(schema);\n if (options.slice) {\n return parser.parseSlice(elementFromString(content), options.parseOptions).content;\n }\n return parser.parse(elementFromString(content), options.parseOptions);\n }\n return createNodeFromContent('', schema, options);\n}\n\n// source: https://github.com/ProseMirror/prosemirror-state/blob/master/src/selection.js#L466\nfunction selectionToInsertionEnd(tr, startLen, bias) {\n const last = tr.steps.length - 1;\n if (last < startLen) {\n return;\n }\n const step = tr.steps[last];\n if (!(step instanceof ReplaceStep || step instanceof ReplaceAroundStep)) {\n return;\n }\n const map = tr.mapping.maps[last];\n let end = 0;\n map.forEach((_from, _to, _newFrom, newTo) => {\n if (end === 0) {\n end = newTo;\n }\n });\n tr.setSelection(Selection.near(tr.doc.resolve(end), bias));\n}\nconst isFragment = nodeOrFragment => {\n return !('type' in nodeOrFragment);\n};\nconst insertContentAt = (position, value, options) => ({\n tr,\n dispatch,\n editor\n}) => {\n var _a;\n if (dispatch) {\n options = {\n parseOptions: editor.options.parseOptions,\n updateSelection: true,\n applyInputRules: false,\n applyPasteRules: false,\n ...options\n };\n let content;\n try {\n content = createNodeFromContent(value, editor.schema, {\n parseOptions: {\n preserveWhitespace: 'full',\n ...options.parseOptions\n },\n errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck\n });\n } catch (e) {\n editor.emit('contentError', {\n editor,\n error: e,\n disableCollaboration: () => {\n if (editor.storage.collaboration) {\n editor.storage.collaboration.isDisabled = true;\n }\n }\n });\n return false;\n }\n let {\n from,\n to\n } = typeof position === 'number' ? {\n from: position,\n to: position\n } : {\n from: position.from,\n to: position.to\n };\n let isOnlyTextContent = true;\n let isOnlyBlockContent = true;\n const nodes = isFragment(content) ? content : [content];\n nodes.forEach(node => {\n // check if added node is valid\n node.check();\n isOnlyTextContent = isOnlyTextContent ? node.isText && node.marks.length === 0 : false;\n isOnlyBlockContent = isOnlyBlockContent ? node.isBlock : false;\n });\n // check if we can replace the wrapping node by\n // the newly inserted content\n // example:\n // replace an empty paragraph by an inserted image\n // instead of inserting the image below the paragraph\n if (from === to && isOnlyBlockContent) {\n const {\n parent\n } = tr.doc.resolve(from);\n const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;\n if (isEmptyTextBlock) {\n from -= 1;\n to += 1;\n }\n }\n let newContent;\n // if there is only plain text we have to use `insertText`\n // because this will keep the current marks\n if (isOnlyTextContent) {\n // if value is string, we can use it directly\n // otherwise if it is an array, we have to join it\n if (Array.isArray(value)) {\n newContent = value.map(v => v.text || '').join('');\n } else if (value instanceof Fragment) {\n let text = '';\n value.forEach(node => {\n if (node.text) {\n text += node.text;\n }\n });\n newContent = text;\n } else if (typeof value === 'object' && !!value && !!value.text) {\n newContent = value.text;\n } else {\n newContent = value;\n }\n tr.insertText(newContent, from, to);\n } else {\n newContent = content;\n tr.replaceWith(from, to, newContent);\n }\n // set cursor at end of inserted content\n if (options.updateSelection) {\n selectionToInsertionEnd(tr, tr.steps.length - 1, -1);\n }\n if (options.applyInputRules) {\n tr.setMeta('applyInputRules', {\n from,\n text: newContent\n });\n }\n if (options.applyPasteRules) {\n tr.setMeta('applyPasteRules', {\n from,\n text: newContent\n });\n }\n }\n return true;\n};\nconst joinUp = () => ({\n state,\n dispatch\n}) => {\n return joinUp$1(state, dispatch);\n};\nconst joinDown = () => ({\n state,\n dispatch\n}) => {\n return joinDown$1(state, dispatch);\n};\nconst joinBackward = () => ({\n state,\n dispatch\n}) => {\n return joinBackward$1(state, dispatch);\n};\nconst joinForward = () => ({\n state,\n dispatch\n}) => {\n return joinForward$1(state, dispatch);\n};\nconst joinItemBackward = () => ({\n state,\n dispatch,\n tr\n}) => {\n try {\n const point = joinPoint(state.doc, state.selection.$from.pos, -1);\n if (point === null || point === undefined) {\n return false;\n }\n tr.join(point, 2);\n if (dispatch) {\n dispatch(tr);\n }\n return true;\n } catch (e) {\n return false;\n }\n};\nconst joinItemForward = () => ({\n state,\n dispatch,\n tr\n}) => {\n try {\n const point = joinPoint(state.doc, state.selection.$from.pos, +1);\n if (point === null || point === undefined) {\n return false;\n }\n tr.join(point, 2);\n if (dispatch) {\n dispatch(tr);\n }\n return true;\n } catch (e) {\n return false;\n }\n};\nconst joinTextblockBackward = () => ({\n state,\n dispatch\n}) => {\n return joinTextblockBackward$1(state, dispatch);\n};\nconst joinTextblockForward = () => ({\n state,\n dispatch\n}) => {\n return joinTextblockForward$1(state, dispatch);\n};\nfunction isMacOS() {\n return typeof navigator !== 'undefined' ? /Mac/.test(navigator.platform) : false;\n}\nfunction normalizeKeyName(name) {\n const parts = name.split(/-(?!$)/);\n let result = parts[parts.length - 1];\n if (result === 'Space') {\n result = ' ';\n }\n let alt;\n let ctrl;\n let shift;\n let meta;\n for (let i = 0; i < parts.length - 1; i += 1) {\n const mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) {\n meta = true;\n } else if (/^a(lt)?$/i.test(mod)) {\n alt = true;\n } else if (/^(c|ctrl|control)$/i.test(mod)) {\n ctrl = true;\n } else if (/^s(hift)?$/i.test(mod)) {\n shift = true;\n } else if (/^mod$/i.test(mod)) {\n if (isiOS() || isMacOS()) {\n meta = true;\n } else {\n ctrl = true;\n }\n } else {\n throw new Error(`Unrecognized modifier name: ${mod}`);\n }\n }\n if (alt) {\n result = `Alt-${result}`;\n }\n if (ctrl) {\n result = `Ctrl-${result}`;\n }\n if (meta) {\n result = `Meta-${result}`;\n }\n if (shift) {\n result = `Shift-${result}`;\n }\n return result;\n}\nconst keyboardShortcut = name => ({\n editor,\n view,\n tr,\n dispatch\n}) => {\n const keys = normalizeKeyName(name).split(/-(?!$)/);\n const key = keys.find(item => !['Alt', 'Ctrl', 'Meta', 'Shift'].includes(item));\n const event = new KeyboardEvent('keydown', {\n key: key === 'Space' ? ' ' : key,\n altKey: keys.includes('Alt'),\n ctrlKey: keys.includes('Ctrl'),\n metaKey: keys.includes('Meta'),\n shiftKey: keys.includes('Shift'),\n bubbles: true,\n cancelable: true\n });\n const capturedTransaction = editor.captureTransaction(() => {\n view.someProp('handleKeyDown', f => f(view, event));\n });\n capturedTransaction === null || capturedTransaction === void 0 ? void 0 : capturedTransaction.steps.forEach(step => {\n const newStep = step.map(tr.mapping);\n if (newStep && dispatch) {\n tr.maybeStep(newStep);\n }\n });\n return true;\n};\nfunction isNodeActive(state, typeOrName, attributes = {}) {\n const {\n from,\n to,\n empty\n } = state.selection;\n const type = typeOrName ? getNodeType(typeOrName, state.schema) : null;\n const nodeRanges = [];\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isText) {\n return;\n }\n const relativeFrom = Math.max(from, pos);\n const relativeTo = Math.min(to, pos + node.nodeSize);\n nodeRanges.push({\n node,\n from: relativeFrom,\n to: relativeTo\n });\n });\n const selectionRange = to - from;\n const matchedNodeRanges = nodeRanges.filter(nodeRange => {\n if (!type) {\n return true;\n }\n return type.name === nodeRange.node.type.name;\n }).filter(nodeRange => objectIncludes(nodeRange.node.attrs, attributes, {\n strict: false\n }));\n if (empty) {\n return !!matchedNodeRanges.length;\n }\n const range = matchedNodeRanges.reduce((sum, nodeRange) => sum + nodeRange.to - nodeRange.from, 0);\n return range >= selectionRange;\n}\nconst lift = (typeOrName, attributes = {}) => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const isActive = isNodeActive(state, type, attributes);\n if (!isActive) {\n return false;\n }\n return lift$1(state, dispatch);\n};\nconst liftEmptyBlock = () => ({\n state,\n dispatch\n}) => {\n return liftEmptyBlock$1(state, dispatch);\n};\nconst liftListItem = typeOrName => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return liftListItem$1(type)(state, dispatch);\n};\nconst newlineInCode = () => ({\n state,\n dispatch\n}) => {\n return newlineInCode$1(state, dispatch);\n};\n\n/**\n * Get the type of a schema item by its name.\n * @param name The name of the schema item\n * @param schema The Prosemiror schema to search in\n * @returns The type of the schema item (`node` or `mark`), or null if it doesn't exist\n */\nfunction getSchemaTypeNameByName(name, schema) {\n if (schema.nodes[name]) {\n return 'node';\n }\n if (schema.marks[name]) {\n return 'mark';\n }\n return null;\n}\n\n/**\n * Remove a property or an array of properties from an object\n * @param obj Object\n * @param key Key to remove\n */\nfunction deleteProps(obj, propOrProps) {\n const props = typeof propOrProps === 'string' ? [propOrProps] : propOrProps;\n return Object.keys(obj).reduce((newObj, prop) => {\n if (!props.includes(prop)) {\n newObj[prop] = obj[prop];\n }\n return newObj;\n }, {});\n}\nconst resetAttributes = (typeOrName, attributes) => ({\n tr,\n state,\n dispatch\n}) => {\n let nodeType = null;\n let markType = null;\n const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);\n if (!schemaType) {\n return false;\n }\n if (schemaType === 'node') {\n nodeType = getNodeType(typeOrName, state.schema);\n }\n if (schemaType === 'mark') {\n markType = getMarkType(typeOrName, state.schema);\n }\n if (dispatch) {\n tr.selection.ranges.forEach(range => {\n state.doc.nodesBetween(range.$from.pos, range.$to.pos, (node, pos) => {\n if (nodeType && nodeType === node.type) {\n tr.setNodeMarkup(pos, undefined, deleteProps(node.attrs, attributes));\n }\n if (markType && node.marks.length) {\n node.marks.forEach(mark => {\n if (markType === mark.type) {\n tr.addMark(pos, pos + node.nodeSize, markType.create(deleteProps(mark.attrs, attributes)));\n }\n });\n }\n });\n });\n }\n return true;\n};\nconst scrollIntoView = () => ({\n tr,\n dispatch\n}) => {\n if (dispatch) {\n tr.scrollIntoView();\n }\n return true;\n};\nconst selectAll = () => ({\n tr,\n commands\n}) => {\n return commands.setTextSelection({\n from: 0,\n to: tr.doc.content.size\n });\n};\nconst selectNodeBackward = () => ({\n state,\n dispatch\n}) => {\n return selectNodeBackward$1(state, dispatch);\n};\nconst selectNodeForward = () => ({\n state,\n dispatch\n}) => {\n return selectNodeForward$1(state, dispatch);\n};\nconst selectParentNode = () => ({\n state,\n dispatch\n}) => {\n return selectParentNode$1(state, dispatch);\n};\n\n// @ts-ignore\n// TODO: add types to @types/prosemirror-commands\nconst selectTextblockEnd = () => ({\n state,\n dispatch\n}) => {\n return selectTextblockEnd$1(state, dispatch);\n};\n\n// @ts-ignore\n// TODO: add types to @types/prosemirror-commands\nconst selectTextblockStart = () => ({\n state,\n dispatch\n}) => {\n return selectTextblockStart$1(state, dispatch);\n};\n\n/**\n * Create a new Prosemirror document node from content.\n * @param content The JSON or HTML content to create the document from\n * @param schema The Prosemirror schema to use for the document\n * @param parseOptions Options for the parser\n * @returns The created Prosemirror document node\n */\nfunction createDocument(content, schema, parseOptions = {}, options = {}) {\n return createNodeFromContent(content, schema, {\n slice: false,\n parseOptions,\n errorOnInvalidContent: options.errorOnInvalidContent\n });\n}\nconst setContent = (content, emitUpdate = false, parseOptions = {}, options = {}) => ({\n editor,\n tr,\n dispatch,\n commands\n}) => {\n var _a, _b;\n const {\n doc\n } = tr;\n // This is to keep backward compatibility with the previous behavior\n // TODO remove this in the next major version\n if (parseOptions.preserveWhitespace !== 'full') {\n const document = createDocument(content, editor.schema, parseOptions, {\n errorOnInvalidContent: (_a = options.errorOnInvalidContent) !== null && _a !== void 0 ? _a : editor.options.enableContentCheck\n });\n if (dispatch) {\n tr.replaceWith(0, doc.content.size, document).setMeta('preventUpdate', !emitUpdate);\n }\n return true;\n }\n if (dispatch) {\n tr.setMeta('preventUpdate', !emitUpdate);\n }\n return commands.insertContentAt({\n from: 0,\n to: doc.content.size\n }, content, {\n parseOptions,\n errorOnInvalidContent: (_b = options.errorOnInvalidContent) !== null && _b !== void 0 ? _b : editor.options.enableContentCheck\n });\n};\nfunction getMarkAttributes(state, typeOrName) {\n const type = getMarkType(typeOrName, state.schema);\n const {\n from,\n to,\n empty\n } = state.selection;\n const marks = [];\n if (empty) {\n if (state.storedMarks) {\n marks.push(...state.storedMarks);\n }\n marks.push(...state.selection.$head.marks());\n } else {\n state.doc.nodesBetween(from, to, node => {\n marks.push(...node.marks);\n });\n }\n const mark = marks.find(markItem => markItem.type.name === type.name);\n if (!mark) {\n return {};\n }\n return {\n ...mark.attrs\n };\n}\n\n/**\n * Returns a new `Transform` based on all steps of the passed transactions.\n * @param oldDoc The Prosemirror node to start from\n * @param transactions The transactions to combine\n * @returns A new `Transform` with all steps of the passed transactions\n */\nfunction combineTransactionSteps(oldDoc, transactions) {\n const transform = new Transform(oldDoc);\n transactions.forEach(transaction => {\n transaction.steps.forEach(step => {\n transform.step(step);\n });\n });\n return transform;\n}\n\n/**\n * Gets the default block type at a given match\n * @param match The content match to get the default block type from\n * @returns The default block type or null\n */\nfunction defaultBlockAt(match) {\n for (let i = 0; i < match.edgeCount; i += 1) {\n const {\n type\n } = match.edge(i);\n if (type.isTextblock && !type.hasRequiredAttrs()) {\n return type;\n }\n }\n return null;\n}\n\n/**\n * Find children inside a Prosemirror node that match a predicate.\n * @param node The Prosemirror node to search in\n * @param predicate The predicate to match\n * @returns An array of nodes with their positions\n */\nfunction findChildren(node, predicate) {\n const nodesWithPos = [];\n node.descendants((child, pos) => {\n if (predicate(child)) {\n nodesWithPos.push({\n node: child,\n pos\n });\n }\n });\n return nodesWithPos;\n}\n\n/**\n * Same as `findChildren` but searches only within a `range`.\n * @param node The Prosemirror node to search in\n * @param range The range to search in\n * @param predicate The predicate to match\n * @returns An array of nodes with their positions\n */\nfunction findChildrenInRange(node, range, predicate) {\n const nodesWithPos = [];\n // if (range.from === range.to) {\n // const nodeAt = node.nodeAt(range.from)\n // if (nodeAt) {\n // nodesWithPos.push({\n // node: nodeAt,\n // pos: range.from,\n // })\n // }\n // }\n node.nodesBetween(range.from, range.to, (child, pos) => {\n if (predicate(child)) {\n nodesWithPos.push({\n node: child,\n pos\n });\n }\n });\n return nodesWithPos;\n}\n\n/**\n * Finds the closest parent node to a resolved position that matches a predicate.\n * @param $pos The resolved position to search from\n * @param predicate The predicate to match\n * @returns The closest parent node to the resolved position that matches the predicate\n * @example ```js\n * findParentNodeClosestToPos($from, node => node.type.name === 'paragraph')\n * ```\n */\nfunction findParentNodeClosestToPos($pos, predicate) {\n for (let i = $pos.depth; i > 0; i -= 1) {\n const node = $pos.node(i);\n if (predicate(node)) {\n return {\n pos: i > 0 ? $pos.before(i) : 0,\n start: $pos.start(i),\n depth: i,\n node\n };\n }\n }\n}\n\n/**\n * Finds the closest parent node to the current selection that matches a predicate.\n * @param predicate The predicate to match\n * @returns A command that finds the closest parent node to the current selection that matches the predicate\n * @example ```js\n * findParentNode(node => node.type.name === 'paragraph')\n * ```\n */\nfunction findParentNode(predicate) {\n return selection => findParentNodeClosestToPos(selection.$from, predicate);\n}\nfunction getSchema(extensions, editor) {\n const resolvedExtensions = ExtensionManager.resolve(extensions);\n return getSchemaByResolvedExtensions(resolvedExtensions, editor);\n}\n\n/**\n * Generate HTML from a JSONContent\n * @param doc The JSONContent to generate HTML from\n * @param extensions The extensions to use for the schema\n * @returns The generated HTML\n */\nfunction generateHTML(doc, extensions) {\n const schema = getSchema(extensions);\n const contentNode = Node$1.fromJSON(schema, doc);\n return getHTMLFromFragment(contentNode.content, schema);\n}\n\n/**\n * Generate JSONContent from HTML\n * @param html The HTML to generate JSONContent from\n * @param extensions The extensions to use for the schema\n * @returns The generated JSONContent\n */\nfunction generateJSON(html, extensions) {\n const schema = getSchema(extensions);\n const dom = elementFromString(html);\n return DOMParser.fromSchema(schema).parse(dom).toJSON();\n}\n\n/**\n * Gets the text of a Prosemirror node\n * @param node The Prosemirror node\n * @param options Options for the text serializer & block separator\n * @returns The text of the node\n * @example ```js\n * const text = getText(node, { blockSeparator: '\\n' })\n * ```\n */\nfunction getText(node, options) {\n const range = {\n from: 0,\n to: node.content.size\n };\n return getTextBetween(node, range, options);\n}\n\n/**\n * Generate raw text from a JSONContent\n * @param doc The JSONContent to generate text from\n * @param extensions The extensions to use for the schema\n * @param options Options for the text generation f.e. blockSeparator or textSerializers\n * @returns The generated text\n */\nfunction generateText(doc, extensions, options) {\n const {\n blockSeparator = '\\n\\n',\n textSerializers = {}\n } = options || {};\n const schema = getSchema(extensions);\n const contentNode = Node$1.fromJSON(schema, doc);\n return getText(contentNode, {\n blockSeparator,\n textSerializers: {\n ...getTextSerializersFromSchema(schema),\n ...textSerializers\n }\n });\n}\nfunction getNodeAttributes(state, typeOrName) {\n const type = getNodeType(typeOrName, state.schema);\n const {\n from,\n to\n } = state.selection;\n const nodes = [];\n state.doc.nodesBetween(from, to, node => {\n nodes.push(node);\n });\n const node = nodes.reverse().find(nodeItem => nodeItem.type.name === type.name);\n if (!node) {\n return {};\n }\n return {\n ...node.attrs\n };\n}\n\n/**\n * Get node or mark attributes by type or name on the current editor state\n * @param state The current editor state\n * @param typeOrName The node or mark type or name\n * @returns The attributes of the node or mark or an empty object\n */\nfunction getAttributes(state, typeOrName) {\n const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);\n if (schemaType === 'node') {\n return getNodeAttributes(state, typeOrName);\n }\n if (schemaType === 'mark') {\n return getMarkAttributes(state, typeOrName);\n }\n return {};\n}\n\n/**\n * Removes duplicated values within an array.\n * Supports numbers, strings and objects.\n */\nfunction removeDuplicates(array, by = JSON.stringify) {\n const seen = {};\n return array.filter(item => {\n const key = by(item);\n return Object.prototype.hasOwnProperty.call(seen, key) ? false : seen[key] = true;\n });\n}\n\n/**\n * Removes duplicated ranges and ranges that are\n * fully captured by other ranges.\n */\nfunction simplifyChangedRanges(changes) {\n const uniqueChanges = removeDuplicates(changes);\n return uniqueChanges.length === 1 ? uniqueChanges : uniqueChanges.filter((change, index) => {\n const rest = uniqueChanges.filter((_, i) => i !== index);\n return !rest.some(otherChange => {\n return change.oldRange.from >= otherChange.oldRange.from && change.oldRange.to <= otherChange.oldRange.to && change.newRange.from >= otherChange.newRange.from && change.newRange.to <= otherChange.newRange.to;\n });\n });\n}\n/**\n * Returns a list of changed ranges\n * based on the first and last state of all steps.\n */\nfunction getChangedRanges(transform) {\n const {\n mapping,\n steps\n } = transform;\n const changes = [];\n mapping.maps.forEach((stepMap, index) => {\n const ranges = [];\n // This accounts for step changes where no range was actually altered\n // e.g. when setting a mark, node attribute, etc.\n // @ts-ignore\n if (!stepMap.ranges.length) {\n const {\n from,\n to\n } = steps[index];\n if (from === undefined || to === undefined) {\n return;\n }\n ranges.push({\n from,\n to\n });\n } else {\n stepMap.forEach((from, to) => {\n ranges.push({\n from,\n to\n });\n });\n }\n ranges.forEach(({\n from,\n to\n }) => {\n const newStart = mapping.slice(index).map(from, -1);\n const newEnd = mapping.slice(index).map(to);\n const oldStart = mapping.invert().map(newStart, -1);\n const oldEnd = mapping.invert().map(newEnd);\n changes.push({\n oldRange: {\n from: oldStart,\n to: oldEnd\n },\n newRange: {\n from: newStart,\n to: newEnd\n }\n });\n });\n });\n return simplifyChangedRanges(changes);\n}\nfunction getDebugJSON(node, startOffset = 0) {\n const isTopNode = node.type === node.type.schema.topNodeType;\n const increment = isTopNode ? 0 : 1;\n const from = startOffset;\n const to = from + node.nodeSize;\n const marks = node.marks.map(mark => {\n const output = {\n type: mark.type.name\n };\n if (Object.keys(mark.attrs).length) {\n output.attrs = {\n ...mark.attrs\n };\n }\n return output;\n });\n const attrs = {\n ...node.attrs\n };\n const output = {\n type: node.type.name,\n from,\n to\n };\n if (Object.keys(attrs).length) {\n output.attrs = attrs;\n }\n if (marks.length) {\n output.marks = marks;\n }\n if (node.content.childCount) {\n output.content = [];\n node.forEach((child, offset) => {\n var _a;\n (_a = output.content) === null || _a === void 0 ? void 0 : _a.push(getDebugJSON(child, startOffset + offset + increment));\n });\n }\n if (node.text) {\n output.text = node.text;\n }\n return output;\n}\nfunction getMarksBetween(from, to, doc) {\n const marks = [];\n // get all inclusive marks on empty selection\n if (from === to) {\n doc.resolve(from).marks().forEach(mark => {\n const $pos = doc.resolve(from);\n const range = getMarkRange($pos, mark.type);\n if (!range) {\n return;\n }\n marks.push({\n mark,\n ...range\n });\n });\n } else {\n doc.nodesBetween(from, to, (node, pos) => {\n if (!node || (node === null || node === void 0 ? void 0 : node.nodeSize) === undefined) {\n return;\n }\n marks.push(...node.marks.map(mark => ({\n from: pos,\n to: pos + node.nodeSize,\n mark\n })));\n });\n }\n return marks;\n}\n\n/**\n * Finds the first node of a given type or name in the current selection.\n * @param state The editor state.\n * @param typeOrName The node type or name.\n * @param pos The position to start searching from.\n * @param maxDepth The maximum depth to search.\n * @returns The node and the depth as an array.\n */\nconst getNodeAtPosition = (state, typeOrName, pos, maxDepth = 20) => {\n const $pos = state.doc.resolve(pos);\n let currentDepth = maxDepth;\n let node = null;\n while (currentDepth > 0 && node === null) {\n const currentNode = $pos.node(currentDepth);\n if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type.name) === typeOrName) {\n node = currentNode;\n } else {\n currentDepth -= 1;\n }\n }\n return [node, currentDepth];\n};\n\n/**\n * Return attributes of an extension that should be splitted by keepOnSplit flag\n * @param extensionAttributes Array of extension attributes\n * @param typeName The type of the extension\n * @param attributes The attributes of the extension\n * @returns The splitted attributes\n */\nfunction getSplittedAttributes(extensionAttributes, typeName, attributes) {\n return Object.fromEntries(Object.entries(attributes).filter(([name]) => {\n const extensionAttribute = extensionAttributes.find(item => {\n return item.type === typeName && item.name === name;\n });\n if (!extensionAttribute) {\n return false;\n }\n return extensionAttribute.attribute.keepOnSplit;\n }));\n}\nfunction isMarkActive(state, typeOrName, attributes = {}) {\n const {\n empty,\n ranges\n } = state.selection;\n const type = typeOrName ? getMarkType(typeOrName, state.schema) : null;\n if (empty) {\n return !!(state.storedMarks || state.selection.$from.marks()).filter(mark => {\n if (!type) {\n return true;\n }\n return type.name === mark.type.name;\n }).find(mark => objectIncludes(mark.attrs, attributes, {\n strict: false\n }));\n }\n let selectionRange = 0;\n const markRanges = [];\n ranges.forEach(({\n $from,\n $to\n }) => {\n const from = $from.pos;\n const to = $to.pos;\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (!node.isText && !node.marks.length) {\n return;\n }\n const relativeFrom = Math.max(from, pos);\n const relativeTo = Math.min(to, pos + node.nodeSize);\n const range = relativeTo - relativeFrom;\n selectionRange += range;\n markRanges.push(...node.marks.map(mark => ({\n mark,\n from: relativeFrom,\n to: relativeTo\n })));\n });\n });\n if (selectionRange === 0) {\n return false;\n }\n // calculate range of matched mark\n const matchedRange = markRanges.filter(markRange => {\n if (!type) {\n return true;\n }\n return type.name === markRange.mark.type.name;\n }).filter(markRange => objectIncludes(markRange.mark.attrs, attributes, {\n strict: false\n })).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n // calculate range of marks that excludes the searched mark\n // for example `code` doesn’t allow any other marks\n const excludedRange = markRanges.filter(markRange => {\n if (!type) {\n return true;\n }\n return markRange.mark.type !== type && markRange.mark.type.excludes(type);\n }).reduce((sum, markRange) => sum + markRange.to - markRange.from, 0);\n // we only include the result of `excludedRange`\n // if there is a match at all\n const range = matchedRange > 0 ? matchedRange + excludedRange : matchedRange;\n return range >= selectionRange;\n}\nfunction isActive(state, name, attributes = {}) {\n if (!name) {\n return isNodeActive(state, null, attributes) || isMarkActive(state, null, attributes);\n }\n const schemaType = getSchemaTypeNameByName(name, state.schema);\n if (schemaType === 'node') {\n return isNodeActive(state, name, attributes);\n }\n if (schemaType === 'mark') {\n return isMarkActive(state, name, attributes);\n }\n return false;\n}\nconst isAtEndOfNode = (state, nodeType) => {\n const {\n $from,\n $to,\n $anchor\n } = state.selection;\n if (nodeType) {\n const parentNode = findParentNode(node => node.type.name === nodeType)(state.selection);\n if (!parentNode) {\n return false;\n }\n const $parentPos = state.doc.resolve(parentNode.pos + 1);\n if ($anchor.pos + 1 === $parentPos.end()) {\n return true;\n }\n return false;\n }\n if ($to.parentOffset < $to.parent.nodeSize - 2 || $from.pos !== $to.pos) {\n return false;\n }\n return true;\n};\nconst isAtStartOfNode = state => {\n const {\n $from,\n $to\n } = state.selection;\n if ($from.parentOffset > 0 || $from.pos !== $to.pos) {\n return false;\n }\n return true;\n};\nfunction isList(name, extensions) {\n const {\n nodeExtensions\n } = splitExtensions(extensions);\n const extension = nodeExtensions.find(item => item.name === name);\n if (!extension) {\n return false;\n }\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n const group = callOrReturn(getExtensionField(extension, 'group', context));\n if (typeof group !== 'string') {\n return false;\n }\n return group.split(' ').includes('list');\n}\n\n/**\n * Returns true if the given prosemirror node is empty.\n */\nfunction isNodeEmpty(node, {\n checkChildren = true,\n ignoreWhitespace = false\n} = {}) {\n var _a;\n if (ignoreWhitespace) {\n if (node.type.name === 'hardBreak') {\n // Hard breaks are considered empty\n return true;\n }\n if (node.isText) {\n return /^\\s*$/m.test((_a = node.text) !== null && _a !== void 0 ? _a : '');\n }\n }\n if (node.isText) {\n return !node.text;\n }\n if (node.isAtom || node.isLeaf) {\n return false;\n }\n if (node.content.childCount === 0) {\n return true;\n }\n if (checkChildren) {\n let isContentEmpty = true;\n node.content.forEach(childNode => {\n if (isContentEmpty === false) {\n // Exit early for perf\n return;\n }\n if (!isNodeEmpty(childNode, {\n ignoreWhitespace,\n checkChildren\n })) {\n isContentEmpty = false;\n }\n });\n return isContentEmpty;\n }\n return false;\n}\nfunction isNodeSelection(value) {\n return value instanceof NodeSelection;\n}\nfunction posToDOMRect(view, from, to) {\n const minPos = 0;\n const maxPos = view.state.doc.content.size;\n const resolvedFrom = minMax(from, minPos, maxPos);\n const resolvedEnd = minMax(to, minPos, maxPos);\n const start = view.coordsAtPos(resolvedFrom);\n const end = view.coordsAtPos(resolvedEnd, -1);\n const top = Math.min(start.top, end.top);\n const bottom = Math.max(start.bottom, end.bottom);\n const left = Math.min(start.left, end.left);\n const right = Math.max(start.right, end.right);\n const width = right - left;\n const height = bottom - top;\n const x = left;\n const y = top;\n const data = {\n top,\n bottom,\n left,\n right,\n width,\n height,\n x,\n y\n };\n return {\n ...data,\n toJSON: () => data\n };\n}\nfunction canSetMark(state, tr, newMarkType) {\n var _a;\n const {\n selection\n } = tr;\n let cursor = null;\n if (isTextSelection(selection)) {\n cursor = selection.$cursor;\n }\n if (cursor) {\n const currentMarks = (_a = state.storedMarks) !== null && _a !== void 0 ? _a : cursor.marks();\n // There can be no current marks that exclude the new mark\n return !!newMarkType.isInSet(currentMarks) || !currentMarks.some(mark => mark.type.excludes(newMarkType));\n }\n const {\n ranges\n } = selection;\n return ranges.some(({\n $from,\n $to\n }) => {\n let someNodeSupportsMark = $from.depth === 0 ? state.doc.inlineContent && state.doc.type.allowsMarkType(newMarkType) : false;\n state.doc.nodesBetween($from.pos, $to.pos, (node, _pos, parent) => {\n // If we already found a mark that we can enable, return false to bypass the remaining search\n if (someNodeSupportsMark) {\n return false;\n }\n if (node.isInline) {\n const parentAllowsMarkType = !parent || parent.type.allowsMarkType(newMarkType);\n const currentMarksAllowMarkType = !!newMarkType.isInSet(node.marks) || !node.marks.some(otherMark => otherMark.type.excludes(newMarkType));\n someNodeSupportsMark = parentAllowsMarkType && currentMarksAllowMarkType;\n }\n return !someNodeSupportsMark;\n });\n return someNodeSupportsMark;\n });\n}\nconst setMark = (typeOrName, attributes = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const {\n empty,\n ranges\n } = selection;\n const type = getMarkType(typeOrName, state.schema);\n if (dispatch) {\n if (empty) {\n const oldAttributes = getMarkAttributes(state, type);\n tr.addStoredMark(type.create({\n ...oldAttributes,\n ...attributes\n }));\n } else {\n ranges.forEach(range => {\n const from = range.$from.pos;\n const to = range.$to.pos;\n state.doc.nodesBetween(from, to, (node, pos) => {\n const trimmedFrom = Math.max(pos, from);\n const trimmedTo = Math.min(pos + node.nodeSize, to);\n const someHasMark = node.marks.find(mark => mark.type === type);\n // if there is already a mark of this type\n // we know that we have to merge its attributes\n // otherwise we add a fresh new mark\n if (someHasMark) {\n node.marks.forEach(mark => {\n if (type === mark.type) {\n tr.addMark(trimmedFrom, trimmedTo, type.create({\n ...mark.attrs,\n ...attributes\n }));\n }\n });\n } else {\n tr.addMark(trimmedFrom, trimmedTo, type.create(attributes));\n }\n });\n });\n }\n }\n return canSetMark(state, tr, type);\n};\nconst setMeta = (key, value) => ({\n tr\n}) => {\n tr.setMeta(key, value);\n return true;\n};\nconst setNode = (typeOrName, attributes = {}) => ({\n state,\n dispatch,\n chain\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n let attributesToCopy;\n if (state.selection.$anchor.sameParent(state.selection.$head)) {\n // only copy attributes if the selection is pointing to a node of the same type\n attributesToCopy = state.selection.$anchor.parent.attrs;\n }\n // TODO: use a fallback like insertContent?\n if (!type.isTextblock) {\n console.warn('[tiptap warn]: Currently \"setNode()\" only supports text block nodes.');\n return false;\n }\n return chain()\n // try to convert node to default node if needed\n .command(({\n commands\n }) => {\n const canSetBlock = setBlockType(type, {\n ...attributesToCopy,\n ...attributes\n })(state);\n if (canSetBlock) {\n return true;\n }\n return commands.clearNodes();\n }).command(({\n state: updatedState\n }) => {\n return setBlockType(type, {\n ...attributesToCopy,\n ...attributes\n })(updatedState, dispatch);\n }).run();\n};\nconst setNodeSelection = position => ({\n tr,\n dispatch\n}) => {\n if (dispatch) {\n const {\n doc\n } = tr;\n const from = minMax(position, 0, doc.content.size);\n const selection = NodeSelection.create(doc, from);\n tr.setSelection(selection);\n }\n return true;\n};\nconst setTextSelection = position => ({\n tr,\n dispatch\n}) => {\n if (dispatch) {\n const {\n doc\n } = tr;\n const {\n from,\n to\n } = typeof position === 'number' ? {\n from: position,\n to: position\n } : position;\n const minPos = TextSelection.atStart(doc).from;\n const maxPos = TextSelection.atEnd(doc).to;\n const resolvedFrom = minMax(from, minPos, maxPos);\n const resolvedEnd = minMax(to, minPos, maxPos);\n const selection = TextSelection.create(doc, resolvedFrom, resolvedEnd);\n tr.setSelection(selection);\n }\n return true;\n};\nconst sinkListItem = typeOrName => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return sinkListItem$1(type)(state, dispatch);\n};\nfunction ensureMarks(state, splittableMarks) {\n const marks = state.storedMarks || state.selection.$to.parentOffset && state.selection.$from.marks();\n if (marks) {\n const filteredMarks = marks.filter(mark => splittableMarks === null || splittableMarks === void 0 ? void 0 : splittableMarks.includes(mark.type.name));\n state.tr.ensureMarks(filteredMarks);\n }\n}\nconst splitBlock = ({\n keepMarks = true\n} = {}) => ({\n tr,\n state,\n dispatch,\n editor\n}) => {\n const {\n selection,\n doc\n } = tr;\n const {\n $from,\n $to\n } = selection;\n const extensionAttributes = editor.extensionManager.attributes;\n const newAttributes = getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs);\n if (selection instanceof NodeSelection && selection.node.isBlock) {\n if (!$from.parentOffset || !canSplit(doc, $from.pos)) {\n return false;\n }\n if (dispatch) {\n if (keepMarks) {\n ensureMarks(state, editor.extensionManager.splittableMarks);\n }\n tr.split($from.pos).scrollIntoView();\n }\n return true;\n }\n if (!$from.parent.isBlock) {\n return false;\n }\n const atEnd = $to.parentOffset === $to.parent.content.size;\n const deflt = $from.depth === 0 ? undefined : defaultBlockAt($from.node(-1).contentMatchAt($from.indexAfter(-1)));\n let types = atEnd && deflt ? [{\n type: deflt,\n attrs: newAttributes\n }] : undefined;\n let can = canSplit(tr.doc, tr.mapping.map($from.pos), 1, types);\n if (!types && !can && canSplit(tr.doc, tr.mapping.map($from.pos), 1, deflt ? [{\n type: deflt\n }] : undefined)) {\n can = true;\n types = deflt ? [{\n type: deflt,\n attrs: newAttributes\n }] : undefined;\n }\n if (dispatch) {\n if (can) {\n if (selection instanceof TextSelection) {\n tr.deleteSelection();\n }\n tr.split(tr.mapping.map($from.pos), 1, types);\n if (deflt && !atEnd && !$from.parentOffset && $from.parent.type !== deflt) {\n const first = tr.mapping.map($from.before());\n const $first = tr.doc.resolve(first);\n if ($from.node(-1).canReplaceWith($first.index(), $first.index() + 1, deflt)) {\n tr.setNodeMarkup(tr.mapping.map($from.before()), deflt);\n }\n }\n }\n if (keepMarks) {\n ensureMarks(state, editor.extensionManager.splittableMarks);\n }\n tr.scrollIntoView();\n }\n return can;\n};\nconst splitListItem = (typeOrName, overrideAttrs = {}) => ({\n tr,\n state,\n dispatch,\n editor\n}) => {\n var _a;\n const type = getNodeType(typeOrName, state.schema);\n const {\n $from,\n $to\n } = state.selection;\n // @ts-ignore\n // eslint-disable-next-line\n const node = state.selection.node;\n if (node && node.isBlock || $from.depth < 2 || !$from.sameParent($to)) {\n return false;\n }\n const grandParent = $from.node(-1);\n if (grandParent.type !== type) {\n return false;\n }\n const extensionAttributes = editor.extensionManager.attributes;\n if ($from.parent.content.size === 0 && $from.node(-1).childCount === $from.indexAfter(-1)) {\n // In an empty block. If this is a nested list, the wrapping\n // list item should be split. Otherwise, bail out and let next\n // command handle lifting.\n if ($from.depth === 2 || $from.node(-3).type !== type || $from.index(-2) !== $from.node(-2).childCount - 1) {\n return false;\n }\n if (dispatch) {\n let wrap = Fragment.empty;\n // eslint-disable-next-line\n const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;\n // Build a fragment containing empty versions of the structure\n // from the outer list item to the parent node of the cursor\n for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {\n wrap = Fragment.from($from.node(d).copy(wrap));\n }\n // eslint-disable-next-line\n const depthAfter = $from.indexAfter(-1) < $from.node(-2).childCount ? 1 : $from.indexAfter(-2) < $from.node(-3).childCount ? 2 : 3;\n // Add a second list item with an empty default start node\n const newNextTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n ...overrideAttrs\n };\n const nextType = ((_a = type.contentMatch.defaultType) === null || _a === void 0 ? void 0 : _a.createAndFill(newNextTypeAttributes)) || undefined;\n wrap = wrap.append(Fragment.from(type.createAndFill(null, nextType) || undefined));\n const start = $from.before($from.depth - (depthBefore - 1));\n tr.replace(start, $from.after(-depthAfter), new Slice(wrap, 4 - depthBefore, 0));\n let sel = -1;\n tr.doc.nodesBetween(start, tr.doc.content.size, (n, pos) => {\n if (sel > -1) {\n return false;\n }\n if (n.isTextblock && n.content.size === 0) {\n sel = pos + 1;\n }\n });\n if (sel > -1) {\n tr.setSelection(TextSelection.near(tr.doc.resolve(sel)));\n }\n tr.scrollIntoView();\n }\n return true;\n }\n const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;\n const newTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),\n ...overrideAttrs\n };\n const newNextTypeAttributes = {\n ...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),\n ...overrideAttrs\n };\n tr.delete($from.pos, $to.pos);\n const types = nextType ? [{\n type,\n attrs: newTypeAttributes\n }, {\n type: nextType,\n attrs: newNextTypeAttributes\n }] : [{\n type,\n attrs: newTypeAttributes\n }];\n if (!canSplit(tr.doc, $from.pos, 2)) {\n return false;\n }\n if (dispatch) {\n const {\n selection,\n storedMarks\n } = state;\n const {\n splittableMarks\n } = editor.extensionManager;\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n tr.split($from.pos, 2, types).scrollIntoView();\n if (!marks || !dispatch) {\n return true;\n }\n const filteredMarks = marks.filter(mark => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n }\n return true;\n};\nconst joinListBackwards = (tr, listType) => {\n const list = findParentNode(node => node.type === listType)(tr.selection);\n if (!list) {\n return true;\n }\n const before = tr.doc.resolve(Math.max(0, list.pos - 1)).before(list.depth);\n if (before === undefined) {\n return true;\n }\n const nodeBefore = tr.doc.nodeAt(before);\n const canJoinBackwards = list.node.type === (nodeBefore === null || nodeBefore === void 0 ? void 0 : nodeBefore.type) && canJoin(tr.doc, list.pos);\n if (!canJoinBackwards) {\n return true;\n }\n tr.join(list.pos);\n return true;\n};\nconst joinListForwards = (tr, listType) => {\n const list = findParentNode(node => node.type === listType)(tr.selection);\n if (!list) {\n return true;\n }\n const after = tr.doc.resolve(list.start).after(list.depth);\n if (after === undefined) {\n return true;\n }\n const nodeAfter = tr.doc.nodeAt(after);\n const canJoinForwards = list.node.type === (nodeAfter === null || nodeAfter === void 0 ? void 0 : nodeAfter.type) && canJoin(tr.doc, after);\n if (!canJoinForwards) {\n return true;\n }\n tr.join(after);\n return true;\n};\nconst toggleList = (listTypeOrName, itemTypeOrName, keepMarks, attributes = {}) => ({\n editor,\n tr,\n state,\n dispatch,\n chain,\n commands,\n can\n}) => {\n const {\n extensions,\n splittableMarks\n } = editor.extensionManager;\n const listType = getNodeType(listTypeOrName, state.schema);\n const itemType = getNodeType(itemTypeOrName, state.schema);\n const {\n selection,\n storedMarks\n } = state;\n const {\n $from,\n $to\n } = selection;\n const range = $from.blockRange($to);\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n if (!range) {\n return false;\n }\n const parentList = findParentNode(node => isList(node.type.name, extensions))(selection);\n if (range.depth >= 1 && parentList && range.depth - parentList.depth <= 1) {\n // remove list\n if (parentList.node.type === listType) {\n return commands.liftListItem(itemType);\n }\n // change list type\n if (isList(parentList.node.type.name, extensions) && listType.validContent(parentList.node.content) && dispatch) {\n return chain().command(() => {\n tr.setNodeMarkup(parentList.pos, listType);\n return true;\n }).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n }\n }\n if (!keepMarks || !marks || !dispatch) {\n return chain()\n // try to convert node to default node if needed\n .command(() => {\n const canWrapInList = can().wrapInList(listType, attributes);\n if (canWrapInList) {\n return true;\n }\n return commands.clearNodes();\n }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n }\n return chain()\n // try to convert node to default node if needed\n .command(() => {\n const canWrapInList = can().wrapInList(listType, attributes);\n const filteredMarks = marks.filter(mark => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n if (canWrapInList) {\n return true;\n }\n return commands.clearNodes();\n }).wrapInList(listType, attributes).command(() => joinListBackwards(tr, listType)).command(() => joinListForwards(tr, listType)).run();\n};\nconst toggleMark = (typeOrName, attributes = {}, options = {}) => ({\n state,\n commands\n}) => {\n const {\n extendEmptyMarkRange = false\n } = options;\n const type = getMarkType(typeOrName, state.schema);\n const isActive = isMarkActive(state, type, attributes);\n if (isActive) {\n return commands.unsetMark(type, {\n extendEmptyMarkRange\n });\n }\n return commands.setMark(type, attributes);\n};\nconst toggleNode = (typeOrName, toggleTypeOrName, attributes = {}) => ({\n state,\n commands\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const toggleType = getNodeType(toggleTypeOrName, state.schema);\n const isActive = isNodeActive(state, type, attributes);\n let attributesToCopy;\n if (state.selection.$anchor.sameParent(state.selection.$head)) {\n // only copy attributes if the selection is pointing to a node of the same type\n attributesToCopy = state.selection.$anchor.parent.attrs;\n }\n if (isActive) {\n return commands.setNode(toggleType, attributesToCopy);\n }\n // If the node is not active, we want to set the new node type with the given attributes\n // Copying over the attributes from the current node if the selection is pointing to a node of the same type\n return commands.setNode(type, {\n ...attributesToCopy,\n ...attributes\n });\n};\nconst toggleWrap = (typeOrName, attributes = {}) => ({\n state,\n commands\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n const isActive = isNodeActive(state, type, attributes);\n if (isActive) {\n return commands.lift(type);\n }\n return commands.wrapIn(type, attributes);\n};\nconst undoInputRule = () => ({\n state,\n dispatch\n}) => {\n const plugins = state.plugins;\n for (let i = 0; i < plugins.length; i += 1) {\n const plugin = plugins[i];\n let undoable;\n // @ts-ignore\n // eslint-disable-next-line\n if (plugin.spec.isInputRules && (undoable = plugin.getState(state))) {\n if (dispatch) {\n const tr = state.tr;\n const toUndo = undoable.transform;\n for (let j = toUndo.steps.length - 1; j >= 0; j -= 1) {\n tr.step(toUndo.steps[j].invert(toUndo.docs[j]));\n }\n if (undoable.text) {\n const marks = tr.doc.resolve(undoable.from).marks();\n tr.replaceWith(undoable.from, undoable.to, state.schema.text(undoable.text, marks));\n } else {\n tr.delete(undoable.from, undoable.to);\n }\n }\n return true;\n }\n }\n return false;\n};\nconst unsetAllMarks = () => ({\n tr,\n dispatch\n}) => {\n const {\n selection\n } = tr;\n const {\n empty,\n ranges\n } = selection;\n if (empty) {\n return true;\n }\n if (dispatch) {\n ranges.forEach(range => {\n tr.removeMark(range.$from.pos, range.$to.pos);\n });\n }\n return true;\n};\nconst unsetMark = (typeOrName, options = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n var _a;\n const {\n extendEmptyMarkRange = false\n } = options;\n const {\n selection\n } = tr;\n const type = getMarkType(typeOrName, state.schema);\n const {\n $from,\n empty,\n ranges\n } = selection;\n if (!dispatch) {\n return true;\n }\n if (empty && extendEmptyMarkRange) {\n let {\n from,\n to\n } = selection;\n const attrs = (_a = $from.marks().find(mark => mark.type === type)) === null || _a === void 0 ? void 0 : _a.attrs;\n const range = getMarkRange($from, type, attrs);\n if (range) {\n from = range.from;\n to = range.to;\n }\n tr.removeMark(from, to, type);\n } else {\n ranges.forEach(range => {\n tr.removeMark(range.$from.pos, range.$to.pos, type);\n });\n }\n tr.removeStoredMark(type);\n return true;\n};\nconst updateAttributes = (typeOrName, attributes = {}) => ({\n tr,\n state,\n dispatch\n}) => {\n let nodeType = null;\n let markType = null;\n const schemaType = getSchemaTypeNameByName(typeof typeOrName === 'string' ? typeOrName : typeOrName.name, state.schema);\n if (!schemaType) {\n return false;\n }\n if (schemaType === 'node') {\n nodeType = getNodeType(typeOrName, state.schema);\n }\n if (schemaType === 'mark') {\n markType = getMarkType(typeOrName, state.schema);\n }\n if (dispatch) {\n tr.selection.ranges.forEach(range => {\n const from = range.$from.pos;\n const to = range.$to.pos;\n let lastPos;\n let lastNode;\n let trimmedFrom;\n let trimmedTo;\n if (tr.selection.empty) {\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (nodeType && nodeType === node.type) {\n trimmedFrom = Math.max(pos, from);\n trimmedTo = Math.min(pos + node.nodeSize, to);\n lastPos = pos;\n lastNode = node;\n }\n });\n } else {\n state.doc.nodesBetween(from, to, (node, pos) => {\n if (pos < from && nodeType && nodeType === node.type) {\n trimmedFrom = Math.max(pos, from);\n trimmedTo = Math.min(pos + node.nodeSize, to);\n lastPos = pos;\n lastNode = node;\n }\n if (pos >= from && pos <= to) {\n if (nodeType && nodeType === node.type) {\n tr.setNodeMarkup(pos, undefined, {\n ...node.attrs,\n ...attributes\n });\n }\n if (markType && node.marks.length) {\n node.marks.forEach(mark => {\n if (markType === mark.type) {\n const trimmedFrom2 = Math.max(pos, from);\n const trimmedTo2 = Math.min(pos + node.nodeSize, to);\n tr.addMark(trimmedFrom2, trimmedTo2, markType.create({\n ...mark.attrs,\n ...attributes\n }));\n }\n });\n }\n }\n });\n }\n if (lastNode) {\n if (lastPos !== undefined) {\n tr.setNodeMarkup(lastPos, undefined, {\n ...lastNode.attrs,\n ...attributes\n });\n }\n if (markType && lastNode.marks.length) {\n lastNode.marks.forEach(mark => {\n if (markType === mark.type) {\n tr.addMark(trimmedFrom, trimmedTo, markType.create({\n ...mark.attrs,\n ...attributes\n }));\n }\n });\n }\n }\n });\n }\n return true;\n};\nconst wrapIn = (typeOrName, attributes = {}) => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return wrapIn$1(type, attributes)(state, dispatch);\n};\nconst wrapInList = (typeOrName, attributes = {}) => ({\n state,\n dispatch\n}) => {\n const type = getNodeType(typeOrName, state.schema);\n return wrapInList$1(type, attributes)(state, dispatch);\n};\nvar commands = /*#__PURE__*/Object.freeze({\n __proto__: null,\n blur: blur,\n clearContent: clearContent,\n clearNodes: clearNodes,\n command: command,\n createParagraphNear: createParagraphNear,\n cut: cut,\n deleteCurrentNode: deleteCurrentNode,\n deleteNode: deleteNode,\n deleteRange: deleteRange,\n deleteSelection: deleteSelection,\n enter: enter,\n exitCode: exitCode,\n extendMarkRange: extendMarkRange,\n first: first,\n focus: focus,\n forEach: forEach,\n insertContent: insertContent,\n insertContentAt: insertContentAt,\n joinBackward: joinBackward,\n joinDown: joinDown,\n joinForward: joinForward,\n joinItemBackward: joinItemBackward,\n joinItemForward: joinItemForward,\n joinTextblockBackward: joinTextblockBackward,\n joinTextblockForward: joinTextblockForward,\n joinUp: joinUp,\n keyboardShortcut: keyboardShortcut,\n lift: lift,\n liftEmptyBlock: liftEmptyBlock,\n liftListItem: liftListItem,\n newlineInCode: newlineInCode,\n resetAttributes: resetAttributes,\n scrollIntoView: scrollIntoView,\n selectAll: selectAll,\n selectNodeBackward: selectNodeBackward,\n selectNodeForward: selectNodeForward,\n selectParentNode: selectParentNode,\n selectTextblockEnd: selectTextblockEnd,\n selectTextblockStart: selectTextblockStart,\n setContent: setContent,\n setMark: setMark,\n setMeta: setMeta,\n setNode: setNode,\n setNodeSelection: setNodeSelection,\n setTextSelection: setTextSelection,\n sinkListItem: sinkListItem,\n splitBlock: splitBlock,\n splitListItem: splitListItem,\n toggleList: toggleList,\n toggleMark: toggleMark,\n toggleNode: toggleNode,\n toggleWrap: toggleWrap,\n undoInputRule: undoInputRule,\n unsetAllMarks: unsetAllMarks,\n unsetMark: unsetMark,\n updateAttributes: updateAttributes,\n wrapIn: wrapIn,\n wrapInList: wrapInList\n});\nconst Commands = Extension.create({\n name: 'commands',\n addCommands() {\n return {\n ...commands\n };\n }\n});\nconst Drop = Extension.create({\n name: 'drop',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('tiptapDrop'),\n props: {\n handleDrop: (_, e, slice, moved) => {\n this.editor.emit('drop', {\n editor: this.editor,\n event: e,\n slice,\n moved\n });\n }\n }\n })];\n }\n});\nconst Editable = Extension.create({\n name: 'editable',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('editable'),\n props: {\n editable: () => this.editor.options.editable\n }\n })];\n }\n});\nconst FocusEvents = Extension.create({\n name: 'focusEvents',\n addProseMirrorPlugins() {\n const {\n editor\n } = this;\n return [new Plugin({\n key: new PluginKey('focusEvents'),\n props: {\n handleDOMEvents: {\n focus: (view, event) => {\n editor.isFocused = true;\n const transaction = editor.state.tr.setMeta('focus', {\n event\n }).setMeta('addToHistory', false);\n view.dispatch(transaction);\n return false;\n },\n blur: (view, event) => {\n editor.isFocused = false;\n const transaction = editor.state.tr.setMeta('blur', {\n event\n }).setMeta('addToHistory', false);\n view.dispatch(transaction);\n return false;\n }\n }\n }\n })];\n }\n});\nconst Keymap = Extension.create({\n name: 'keymap',\n addKeyboardShortcuts() {\n const handleBackspace = () => this.editor.commands.first(({\n commands\n }) => [() => commands.undoInputRule(),\n // maybe convert first text block node to default node\n () => commands.command(({\n tr\n }) => {\n const {\n selection,\n doc\n } = tr;\n const {\n empty,\n $anchor\n } = selection;\n const {\n pos,\n parent\n } = $anchor;\n const $parentPos = $anchor.parent.isTextblock && pos > 0 ? tr.doc.resolve(pos - 1) : $anchor;\n const parentIsIsolating = $parentPos.parent.type.spec.isolating;\n const parentPos = $anchor.pos - $anchor.parentOffset;\n const isAtStart = parentIsIsolating && $parentPos.parent.childCount === 1 ? parentPos === $anchor.pos : Selection.atStart(doc).from === pos;\n if (!empty || !parent.type.isTextblock || parent.textContent.length || !isAtStart || isAtStart && $anchor.parent.type.name === 'paragraph' // prevent clearNodes when no nodes to clear, otherwise history stack is appended\n ) {\n return false;\n }\n return commands.clearNodes();\n }), () => commands.deleteSelection(), () => commands.joinBackward(), () => commands.selectNodeBackward()]);\n const handleDelete = () => this.editor.commands.first(({\n commands\n }) => [() => commands.deleteSelection(), () => commands.deleteCurrentNode(), () => commands.joinForward(), () => commands.selectNodeForward()]);\n const handleEnter = () => this.editor.commands.first(({\n commands\n }) => [() => commands.newlineInCode(), () => commands.createParagraphNear(), () => commands.liftEmptyBlock(), () => commands.splitBlock()]);\n const baseKeymap = {\n Enter: handleEnter,\n 'Mod-Enter': () => this.editor.commands.exitCode(),\n Backspace: handleBackspace,\n 'Mod-Backspace': handleBackspace,\n 'Shift-Backspace': handleBackspace,\n Delete: handleDelete,\n 'Mod-Delete': handleDelete,\n 'Mod-a': () => this.editor.commands.selectAll()\n };\n const pcKeymap = {\n ...baseKeymap\n };\n const macKeymap = {\n ...baseKeymap,\n 'Ctrl-h': handleBackspace,\n 'Alt-Backspace': handleBackspace,\n 'Ctrl-d': handleDelete,\n 'Ctrl-Alt-Backspace': handleDelete,\n 'Alt-Delete': handleDelete,\n 'Alt-d': handleDelete,\n 'Ctrl-a': () => this.editor.commands.selectTextblockStart(),\n 'Ctrl-e': () => this.editor.commands.selectTextblockEnd()\n };\n if (isiOS() || isMacOS()) {\n return macKeymap;\n }\n return pcKeymap;\n },\n addProseMirrorPlugins() {\n return [\n // With this plugin we check if the whole document was selected and deleted.\n // In this case we will additionally call `clearNodes()` to convert e.g. a heading\n // to a paragraph if necessary.\n // This is an alternative to ProseMirror's `AllSelection`, which doesn’t work well\n // with many other commands.\n new Plugin({\n key: new PluginKey('clearDocument'),\n appendTransaction: (transactions, oldState, newState) => {\n const docChanges = transactions.some(transaction => transaction.docChanged) && !oldState.doc.eq(newState.doc);\n const ignoreTr = transactions.some(transaction => transaction.getMeta('preventClearDocument'));\n if (!docChanges || ignoreTr) {\n return;\n }\n const {\n empty,\n from,\n to\n } = oldState.selection;\n const allFrom = Selection.atStart(oldState.doc).from;\n const allEnd = Selection.atEnd(oldState.doc).to;\n const allWasSelected = from === allFrom && to === allEnd;\n if (empty || !allWasSelected) {\n return;\n }\n const isEmpty = isNodeEmpty(newState.doc);\n if (!isEmpty) {\n return;\n }\n const tr = newState.tr;\n const state = createChainableState({\n state: newState,\n transaction: tr\n });\n const {\n commands\n } = new CommandManager({\n editor: this.editor,\n state\n });\n commands.clearNodes();\n if (!tr.steps.length) {\n return;\n }\n return tr;\n }\n })];\n }\n});\nconst Paste = Extension.create({\n name: 'paste',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('tiptapPaste'),\n props: {\n handlePaste: (_view, e, slice) => {\n this.editor.emit('paste', {\n editor: this.editor,\n event: e,\n slice\n });\n }\n }\n })];\n }\n});\nconst Tabindex = Extension.create({\n name: 'tabindex',\n addProseMirrorPlugins() {\n return [new Plugin({\n key: new PluginKey('tabindex'),\n props: {\n attributes: () => this.editor.isEditable ? {\n tabindex: '0'\n } : {}\n }\n })];\n }\n});\nvar index = /*#__PURE__*/Object.freeze({\n __proto__: null,\n ClipboardTextSerializer: ClipboardTextSerializer,\n Commands: Commands,\n Drop: Drop,\n Editable: Editable,\n FocusEvents: FocusEvents,\n Keymap: Keymap,\n Paste: Paste,\n Tabindex: Tabindex\n});\nclass NodePos {\n get name() {\n return this.node.type.name;\n }\n constructor(pos, editor, isBlock = false, node = null) {\n this.currentNode = null;\n this.actualDepth = null;\n this.isBlock = isBlock;\n this.resolvedPos = pos;\n this.editor = editor;\n this.currentNode = node;\n }\n get node() {\n return this.currentNode || this.resolvedPos.node();\n }\n get element() {\n return this.editor.view.domAtPos(this.pos).node;\n }\n get depth() {\n var _a;\n return (_a = this.actualDepth) !== null && _a !== void 0 ? _a : this.resolvedPos.depth;\n }\n get pos() {\n return this.resolvedPos.pos;\n }\n get content() {\n return this.node.content;\n }\n set content(content) {\n let from = this.from;\n let to = this.to;\n if (this.isBlock) {\n if (this.content.size === 0) {\n console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);\n return;\n }\n from = this.from + 1;\n to = this.to - 1;\n }\n this.editor.commands.insertContentAt({\n from,\n to\n }, content);\n }\n get attributes() {\n return this.node.attrs;\n }\n get textContent() {\n return this.node.textContent;\n }\n get size() {\n return this.node.nodeSize;\n }\n get from() {\n if (this.isBlock) {\n return this.pos;\n }\n return this.resolvedPos.start(this.resolvedPos.depth);\n }\n get range() {\n return {\n from: this.from,\n to: this.to\n };\n }\n get to() {\n if (this.isBlock) {\n return this.pos + this.size;\n }\n return this.resolvedPos.end(this.resolvedPos.depth) + (this.node.isText ? 0 : 1);\n }\n get parent() {\n if (this.depth === 0) {\n return null;\n }\n const parentPos = this.resolvedPos.start(this.resolvedPos.depth - 1);\n const $pos = this.resolvedPos.doc.resolve(parentPos);\n return new NodePos($pos, this.editor);\n }\n get before() {\n let $pos = this.resolvedPos.doc.resolve(this.from - (this.isBlock ? 1 : 2));\n if ($pos.depth !== this.depth) {\n $pos = this.resolvedPos.doc.resolve(this.from - 3);\n }\n return new NodePos($pos, this.editor);\n }\n get after() {\n let $pos = this.resolvedPos.doc.resolve(this.to + (this.isBlock ? 2 : 1));\n if ($pos.depth !== this.depth) {\n $pos = this.resolvedPos.doc.resolve(this.to + 3);\n }\n return new NodePos($pos, this.editor);\n }\n get children() {\n const children = [];\n this.node.content.forEach((node, offset) => {\n const isBlock = node.isBlock && !node.isTextblock;\n const isNonTextAtom = node.isAtom && !node.isText;\n const targetPos = this.pos + offset + (isNonTextAtom ? 0 : 1);\n const $pos = this.resolvedPos.doc.resolve(targetPos);\n if (!isBlock && $pos.depth <= this.depth) {\n return;\n }\n const childNodePos = new NodePos($pos, this.editor, isBlock, isBlock ? node : null);\n if (isBlock) {\n childNodePos.actualDepth = this.depth + 1;\n }\n children.push(new NodePos($pos, this.editor, isBlock, isBlock ? node : null));\n });\n return children;\n }\n get firstChild() {\n return this.children[0] || null;\n }\n get lastChild() {\n const children = this.children;\n return children[children.length - 1] || null;\n }\n closest(selector, attributes = {}) {\n let node = null;\n let currentNode = this.parent;\n while (currentNode && !node) {\n if (currentNode.node.type.name === selector) {\n if (Object.keys(attributes).length > 0) {\n const nodeAttributes = currentNode.node.attrs;\n const attrKeys = Object.keys(attributes);\n for (let index = 0; index < attrKeys.length; index += 1) {\n const key = attrKeys[index];\n if (nodeAttributes[key] !== attributes[key]) {\n break;\n }\n }\n } else {\n node = currentNode;\n }\n }\n currentNode = currentNode.parent;\n }\n return node;\n }\n querySelector(selector, attributes = {}) {\n return this.querySelectorAll(selector, attributes, true)[0] || null;\n }\n querySelectorAll(selector, attributes = {}, firstItemOnly = false) {\n let nodes = [];\n if (!this.children || this.children.length === 0) {\n return nodes;\n }\n const attrKeys = Object.keys(attributes);\n /**\n * Finds all children recursively that match the selector and attributes\n * If firstItemOnly is true, it will return the first item found\n */\n this.children.forEach(childPos => {\n // If we already found a node and we only want the first item, we dont need to keep going\n if (firstItemOnly && nodes.length > 0) {\n return;\n }\n if (childPos.node.type.name === selector) {\n const doesAllAttributesMatch = attrKeys.every(key => attributes[key] === childPos.node.attrs[key]);\n if (doesAllAttributesMatch) {\n nodes.push(childPos);\n }\n }\n // If we already found a node and we only want the first item, we can stop here and skip the recursion\n if (firstItemOnly && nodes.length > 0) {\n return;\n }\n nodes = nodes.concat(childPos.querySelectorAll(selector, attributes, firstItemOnly));\n });\n return nodes;\n }\n setAttribute(attributes) {\n const {\n tr\n } = this.editor.state;\n tr.setNodeMarkup(this.from, undefined, {\n ...this.node.attrs,\n ...attributes\n });\n this.editor.view.dispatch(tr);\n }\n}\nconst style = `.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: \"liga\" 0; /* the above doesn't seem to work in Edge */\n}\n\n.ProseMirror [contenteditable=\"false\"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable=\"false\"] [contenteditable=\"true\"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}`;\nfunction createStyleTag(style, nonce, suffix) {\n const tiptapStyleTag = document.querySelector(`style[data-tiptap-style${suffix ? `-${suffix}` : ''}]`);\n if (tiptapStyleTag !== null) {\n return tiptapStyleTag;\n }\n const styleNode = document.createElement('style');\n if (nonce) {\n styleNode.setAttribute('nonce', nonce);\n }\n styleNode.setAttribute(`data-tiptap-style${suffix ? `-${suffix}` : ''}`, '');\n styleNode.innerHTML = style;\n document.getElementsByTagName('head')[0].appendChild(styleNode);\n return styleNode;\n}\nclass Editor extends EventEmitter {\n constructor(options = {}) {\n super();\n this.isFocused = false;\n /**\n * The editor is considered initialized after the `create` event has been emitted.\n */\n this.isInitialized = false;\n this.extensionStorage = {};\n this.options = {\n element: document.createElement('div'),\n content: '',\n injectCSS: true,\n injectNonce: undefined,\n extensions: [],\n autofocus: false,\n editable: true,\n editorProps: {},\n parseOptions: {},\n coreExtensionOptions: {},\n enableInputRules: true,\n enablePasteRules: true,\n enableCoreExtensions: true,\n enableContentCheck: false,\n onBeforeCreate: () => null,\n onCreate: () => null,\n onUpdate: () => null,\n onSelectionUpdate: () => null,\n onTransaction: () => null,\n onFocus: () => null,\n onBlur: () => null,\n onDestroy: () => null,\n onContentError: ({\n error\n }) => {\n throw error;\n },\n onPaste: () => null,\n onDrop: () => null\n };\n this.isCapturingTransaction = false;\n this.capturedTransaction = null;\n this.setOptions(options);\n this.createExtensionManager();\n this.createCommandManager();\n this.createSchema();\n this.on('beforeCreate', this.options.onBeforeCreate);\n this.emit('beforeCreate', {\n editor: this\n });\n this.on('contentError', this.options.onContentError);\n this.createView();\n this.injectCSS();\n this.on('create', this.options.onCreate);\n this.on('update', this.options.onUpdate);\n this.on('selectionUpdate', this.options.onSelectionUpdate);\n this.on('transaction', this.options.onTransaction);\n this.on('focus', this.options.onFocus);\n this.on('blur', this.options.onBlur);\n this.on('destroy', this.options.onDestroy);\n this.on('drop', ({\n event,\n slice,\n moved\n }) => this.options.onDrop(event, slice, moved));\n this.on('paste', ({\n event,\n slice\n }) => this.options.onPaste(event, slice));\n window.setTimeout(() => {\n if (this.isDestroyed) {\n return;\n }\n this.commands.focus(this.options.autofocus);\n this.emit('create', {\n editor: this\n });\n this.isInitialized = true;\n }, 0);\n }\n /**\n * Returns the editor storage.\n */\n get storage() {\n return this.extensionStorage;\n }\n /**\n * An object of all registered commands.\n */\n get commands() {\n return this.commandManager.commands;\n }\n /**\n * Create a command chain to call multiple commands at once.\n */\n chain() {\n return this.commandManager.chain();\n }\n /**\n * Check if a command or a command chain can be executed. Without executing it.\n */\n can() {\n return this.commandManager.can();\n }\n /**\n * Inject CSS styles.\n */\n injectCSS() {\n if (this.options.injectCSS && document) {\n this.css = createStyleTag(style, this.options.injectNonce);\n }\n }\n /**\n * Update editor options.\n *\n * @param options A list of options\n */\n setOptions(options = {}) {\n this.options = {\n ...this.options,\n ...options\n };\n if (!this.view || !this.state || this.isDestroyed) {\n return;\n }\n if (this.options.editorProps) {\n this.view.setProps(this.options.editorProps);\n }\n this.view.updateState(this.state);\n }\n /**\n * Update editable state of the editor.\n */\n setEditable(editable, emitUpdate = true) {\n this.setOptions({\n editable\n });\n if (emitUpdate) {\n this.emit('update', {\n editor: this,\n transaction: this.state.tr\n });\n }\n }\n /**\n * Returns whether the editor is editable.\n */\n get isEditable() {\n // since plugins are applied after creating the view\n // `editable` is always `true` for one tick.\n // that’s why we also have to check for `options.editable`\n return this.options.editable && this.view && this.view.editable;\n }\n /**\n * Returns the editor state.\n */\n get state() {\n return this.view.state;\n }\n /**\n * Register a ProseMirror plugin.\n *\n * @param plugin A ProseMirror plugin\n * @param handlePlugins Control how to merge the plugin into the existing plugins.\n * @returns The new editor state\n */\n registerPlugin(plugin, handlePlugins) {\n const plugins = isFunction(handlePlugins) ? handlePlugins(plugin, [...this.state.plugins]) : [...this.state.plugins, plugin];\n const state = this.state.reconfigure({\n plugins\n });\n this.view.updateState(state);\n return state;\n }\n /**\n * Unregister a ProseMirror plugin.\n *\n * @param nameOrPluginKeyToRemove The plugins name\n * @returns The new editor state or undefined if the editor is destroyed\n */\n unregisterPlugin(nameOrPluginKeyToRemove) {\n if (this.isDestroyed) {\n return undefined;\n }\n const prevPlugins = this.state.plugins;\n let plugins = prevPlugins;\n [].concat(nameOrPluginKeyToRemove).forEach(nameOrPluginKey => {\n // @ts-ignore\n const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;\n // @ts-ignore\n plugins = prevPlugins.filter(plugin => !plugin.key.startsWith(name));\n });\n if (prevPlugins.length === plugins.length) {\n // No plugin was removed, so we don’t need to update the state\n return undefined;\n }\n const state = this.state.reconfigure({\n plugins\n });\n this.view.updateState(state);\n return state;\n }\n /**\n * Creates an extension manager.\n */\n createExtensionManager() {\n var _a, _b;\n const coreExtensions = this.options.enableCoreExtensions ? [Editable, ClipboardTextSerializer.configure({\n blockSeparator: (_b = (_a = this.options.coreExtensionOptions) === null || _a === void 0 ? void 0 : _a.clipboardTextSerializer) === null || _b === void 0 ? void 0 : _b.blockSeparator\n }), Commands, FocusEvents, Keymap, Tabindex, Drop, Paste].filter(ext => {\n if (typeof this.options.enableCoreExtensions === 'object') {\n return this.options.enableCoreExtensions[ext.name] !== false;\n }\n return true;\n }) : [];\n const allExtensions = [...coreExtensions, ...this.options.extensions].filter(extension => {\n return ['extension', 'node', 'mark'].includes(extension === null || extension === void 0 ? void 0 : extension.type);\n });\n this.extensionManager = new ExtensionManager(allExtensions, this);\n }\n /**\n * Creates an command manager.\n */\n createCommandManager() {\n this.commandManager = new CommandManager({\n editor: this\n });\n }\n /**\n * Creates a ProseMirror schema.\n */\n createSchema() {\n this.schema = this.extensionManager.schema;\n }\n /**\n * Creates a ProseMirror view.\n */\n createView() {\n var _a;\n let doc;\n try {\n doc = createDocument(this.options.content, this.schema, this.options.parseOptions, {\n errorOnInvalidContent: this.options.enableContentCheck\n });\n } catch (e) {\n if (!(e instanceof Error) || !['[tiptap error]: Invalid JSON content', '[tiptap error]: Invalid HTML content'].includes(e.message)) {\n // Not the content error we were expecting\n throw e;\n }\n this.emit('contentError', {\n editor: this,\n error: e,\n disableCollaboration: () => {\n if (this.storage.collaboration) {\n this.storage.collaboration.isDisabled = true;\n }\n // To avoid syncing back invalid content, reinitialize the extensions without the collaboration extension\n this.options.extensions = this.options.extensions.filter(extension => extension.name !== 'collaboration');\n // Restart the initialization process by recreating the extension manager with the new set of extensions\n this.createExtensionManager();\n }\n });\n // Content is invalid, but attempt to create it anyway, stripping out the invalid parts\n doc = createDocument(this.options.content, this.schema, this.options.parseOptions, {\n errorOnInvalidContent: false\n });\n }\n const selection = resolveFocusPosition(doc, this.options.autofocus);\n this.view = new EditorView(this.options.element, {\n ...this.options.editorProps,\n attributes: {\n // add `role=\"textbox\"` to the editor element\n role: 'textbox',\n ...((_a = this.options.editorProps) === null || _a === void 0 ? void 0 : _a.attributes)\n },\n dispatchTransaction: this.dispatchTransaction.bind(this),\n state: EditorState.create({\n doc,\n selection: selection || undefined\n })\n });\n // `editor.view` is not yet available at this time.\n // Therefore we will add all plugins and node views directly afterwards.\n const newState = this.state.reconfigure({\n plugins: this.extensionManager.plugins\n });\n this.view.updateState(newState);\n this.createNodeViews();\n this.prependClass();\n // Let’s store the editor instance in the DOM element.\n // So we’ll have access to it for tests.\n // @ts-ignore\n const dom = this.view.dom;\n dom.editor = this;\n }\n /**\n * Creates all node views.\n */\n createNodeViews() {\n if (this.view.isDestroyed) {\n return;\n }\n this.view.setProps({\n nodeViews: this.extensionManager.nodeViews\n });\n }\n /**\n * Prepend class name to element.\n */\n prependClass() {\n this.view.dom.className = `tiptap ${this.view.dom.className}`;\n }\n captureTransaction(fn) {\n this.isCapturingTransaction = true;\n fn();\n this.isCapturingTransaction = false;\n const tr = this.capturedTransaction;\n this.capturedTransaction = null;\n return tr;\n }\n /**\n * The callback over which to send transactions (state updates) produced by the view.\n *\n * @param transaction An editor state transaction\n */\n dispatchTransaction(transaction) {\n // if the editor / the view of the editor was destroyed\n // the transaction should not be dispatched as there is no view anymore.\n if (this.view.isDestroyed) {\n return;\n }\n if (this.isCapturingTransaction) {\n if (!this.capturedTransaction) {\n this.capturedTransaction = transaction;\n return;\n }\n transaction.steps.forEach(step => {\n var _a;\n return (_a = this.capturedTransaction) === null || _a === void 0 ? void 0 : _a.step(step);\n });\n return;\n }\n const state = this.state.apply(transaction);\n const selectionHasChanged = !this.state.selection.eq(state.selection);\n this.emit('beforeTransaction', {\n editor: this,\n transaction,\n nextState: state\n });\n this.view.updateState(state);\n this.emit('transaction', {\n editor: this,\n transaction\n });\n if (selectionHasChanged) {\n this.emit('selectionUpdate', {\n editor: this,\n transaction\n });\n }\n const focus = transaction.getMeta('focus');\n const blur = transaction.getMeta('blur');\n if (focus) {\n this.emit('focus', {\n editor: this,\n event: focus.event,\n transaction\n });\n }\n if (blur) {\n this.emit('blur', {\n editor: this,\n event: blur.event,\n transaction\n });\n }\n if (!transaction.docChanged || transaction.getMeta('preventUpdate')) {\n return;\n }\n this.emit('update', {\n editor: this,\n transaction\n });\n }\n /**\n * Get attributes of the currently selected node or mark.\n */\n getAttributes(nameOrType) {\n return getAttributes(this.state, nameOrType);\n }\n isActive(nameOrAttributes, attributesOrUndefined) {\n const name = typeof nameOrAttributes === 'string' ? nameOrAttributes : null;\n const attributes = typeof nameOrAttributes === 'string' ? attributesOrUndefined : nameOrAttributes;\n return isActive(this.state, name, attributes);\n }\n /**\n * Get the document as JSON.\n */\n getJSON() {\n return this.state.doc.toJSON();\n }\n /**\n * Get the document as HTML.\n */\n getHTML() {\n return getHTMLFromFragment(this.state.doc.content, this.schema);\n }\n /**\n * Get the document as text.\n */\n getText(options) {\n const {\n blockSeparator = '\\n\\n',\n textSerializers = {}\n } = options || {};\n return getText(this.state.doc, {\n blockSeparator,\n textSerializers: {\n ...getTextSerializersFromSchema(this.schema),\n ...textSerializers\n }\n });\n }\n /**\n * Check if there is no content.\n */\n get isEmpty() {\n return isNodeEmpty(this.state.doc);\n }\n /**\n * Get the number of characters for the current document.\n *\n * @deprecated\n */\n getCharacterCount() {\n console.warn('[tiptap warn]: \"editor.getCharacterCount()\" is deprecated. Please use \"editor.storage.characterCount.characters()\" instead.');\n return this.state.doc.content.size - 2;\n }\n /**\n * Destroy the editor.\n */\n destroy() {\n this.emit('destroy');\n if (this.view) {\n // Cleanup our reference to prevent circular references which caused memory leaks\n // @ts-ignore\n const dom = this.view.dom;\n if (dom && dom.editor) {\n delete dom.editor;\n }\n this.view.destroy();\n }\n this.removeAllListeners();\n }\n /**\n * Check if the editor is already destroyed.\n */\n get isDestroyed() {\n var _a;\n // @ts-ignore\n return !((_a = this.view) === null || _a === void 0 ? void 0 : _a.docView);\n }\n $node(selector, attributes) {\n var _a;\n return ((_a = this.$doc) === null || _a === void 0 ? void 0 : _a.querySelector(selector, attributes)) || null;\n }\n $nodes(selector, attributes) {\n var _a;\n return ((_a = this.$doc) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector, attributes)) || null;\n }\n $pos(pos) {\n const $pos = this.state.doc.resolve(pos);\n return new NodePos($pos, this);\n }\n get $doc() {\n return this.$pos(0);\n }\n}\n\n/**\n * Build an input rule that adds a mark when the\n * matched text is typed into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction markInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match);\n if (attributes === false || attributes === null) {\n return null;\n }\n const {\n tr\n } = state;\n const captureGroup = match[match.length - 1];\n const fullMatch = match[0];\n if (captureGroup) {\n const startSpaces = fullMatch.search(/\\S/);\n const textStart = range.from + fullMatch.indexOf(captureGroup);\n const textEnd = textStart + captureGroup.length;\n const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter(item => {\n // @ts-ignore\n const excluded = item.mark.type.excluded;\n return excluded.find(type => type === config.type && type !== item.mark.type);\n }).filter(item => item.to > textStart);\n if (excludedMarks.length) {\n return null;\n }\n if (textEnd < range.to) {\n tr.delete(textEnd, range.to);\n }\n if (textStart > range.from) {\n tr.delete(range.from + startSpaces, textStart);\n }\n const markEnd = range.from + startSpaces + captureGroup.length;\n tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n tr.removeStoredMark(config.type);\n }\n }\n });\n}\n\n/**\n * Build an input rule that adds a node when the\n * matched text is typed into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction nodeInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match) || {};\n const {\n tr\n } = state;\n const start = range.from;\n let end = range.to;\n const newNode = config.type.create(attributes);\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n let matchStart = start + offset;\n if (matchStart > end) {\n matchStart = end;\n } else {\n end = matchStart + match[1].length;\n }\n // insert last typed character\n const lastChar = match[0][match[0].length - 1];\n tr.insertText(lastChar, start + match[0].length - 1);\n // insert node from input rule\n tr.replaceWith(matchStart, end, newNode);\n } else if (match[0]) {\n const insertionStart = config.type.isInline ? start : start - 1;\n tr.insert(insertionStart, config.type.create(attributes)).delete(tr.mapping.map(start), tr.mapping.map(end));\n }\n tr.scrollIntoView();\n }\n });\n}\n\n/**\n * Build an input rule that changes the type of a textblock when the\n * matched text is typed into it. When using a regular expresion you’ll\n * probably want the regexp to start with `^`, so that the pattern can\n * only occur at the start of a textblock.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction textblockTypeInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n const $start = state.doc.resolve(range.from);\n const attributes = callOrReturn(config.getAttributes, undefined, match) || {};\n if (!$start.node(-1).canReplaceWith($start.index(-1), $start.indexAfter(-1), config.type)) {\n return null;\n }\n state.tr.delete(range.from, range.to).setBlockType(range.from, range.from, config.type, attributes);\n }\n });\n}\n\n/**\n * Build an input rule that replaces text when the\n * matched text is typed into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction textInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n let insert = config.replace;\n let start = range.from;\n const end = range.to;\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n const cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n state.tr.insertText(insert, start, end);\n }\n });\n}\n\n/**\n * Build an input rule for automatically wrapping a textblock when a\n * given string is typed. When using a regular expresion you’ll\n * probably want the regexp to start with `^`, so that the pattern can\n * only occur at the start of a textblock.\n *\n * `type` is the type of node to wrap in.\n *\n * By default, if there’s a node with the same type above the newly\n * wrapped node, the rule will try to join those\n * two nodes. You can pass a join predicate, which takes a regular\n * expression match and the node before the wrapped node, and can\n * return a boolean to indicate whether a join should happen.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#input-rules\n */\nfunction wrappingInputRule(config) {\n return new InputRule({\n find: config.find,\n handler: ({\n state,\n range,\n match,\n chain\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match) || {};\n const tr = state.tr.delete(range.from, range.to);\n const $start = tr.doc.resolve(range.from);\n const blockRange = $start.blockRange();\n const wrapping = blockRange && findWrapping(blockRange, config.type, attributes);\n if (!wrapping) {\n return null;\n }\n tr.wrap(blockRange, wrapping);\n if (config.keepMarks && config.editor) {\n const {\n selection,\n storedMarks\n } = state;\n const {\n splittableMarks\n } = config.editor.extensionManager;\n const marks = storedMarks || selection.$to.parentOffset && selection.$from.marks();\n if (marks) {\n const filteredMarks = marks.filter(mark => splittableMarks.includes(mark.type.name));\n tr.ensureMarks(filteredMarks);\n }\n }\n if (config.keepAttributes) {\n /** If the nodeType is `bulletList` or `orderedList` set the `nodeType` as `listItem` */\n const nodeType = config.type.name === 'bulletList' || config.type.name === 'orderedList' ? 'listItem' : 'taskList';\n chain().updateAttributes(nodeType, attributes).run();\n }\n const before = tr.doc.resolve(range.from - 1).nodeBefore;\n if (before && before.type === config.type && canJoin(tr.doc, range.from - 1) && (!config.joinPredicate || config.joinPredicate(match, before))) {\n tr.join(range.from - 1);\n }\n }\n });\n}\n\n/**\n * The Node class is used to create custom node extensions.\n * @see https://tiptap.dev/api/extensions#create-a-new-extension\n */\nclass Node {\n constructor(config = {}) {\n this.type = 'node';\n this.name = 'node';\n this.parent = null;\n this.child = null;\n this.config = {\n name: this.name,\n defaultOptions: {}\n };\n this.config = {\n ...this.config,\n ...config\n };\n this.name = this.config.name;\n if (config.defaultOptions && Object.keys(config.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${this.name}\".`);\n }\n // TODO: remove `addOptions` fallback\n this.options = this.config.defaultOptions;\n if (this.config.addOptions) {\n this.options = callOrReturn(getExtensionField(this, 'addOptions', {\n name: this.name\n }));\n }\n this.storage = callOrReturn(getExtensionField(this, 'addStorage', {\n name: this.name,\n options: this.options\n })) || {};\n }\n static create(config = {}) {\n return new Node(config);\n }\n configure(options = {}) {\n // return a new instance so we can use the same extension\n // with different calls of `configure`\n const extension = this.extend({\n ...this.config,\n addOptions: () => {\n return mergeDeep(this.options, options);\n }\n });\n // Always preserve the current name\n extension.name = this.name;\n // Set the parent to be our parent\n extension.parent = this.parent;\n return extension;\n }\n extend(extendedConfig = {}) {\n const extension = new Node(extendedConfig);\n extension.parent = this;\n this.child = extension;\n extension.name = extendedConfig.name ? extendedConfig.name : extension.parent.name;\n if (extendedConfig.defaultOptions && Object.keys(extendedConfig.defaultOptions).length > 0) {\n console.warn(`[tiptap warn]: BREAKING CHANGE: \"defaultOptions\" is deprecated. Please use \"addOptions\" instead. Found in extension: \"${extension.name}\".`);\n }\n extension.options = callOrReturn(getExtensionField(extension, 'addOptions', {\n name: extension.name\n }));\n extension.storage = callOrReturn(getExtensionField(extension, 'addStorage', {\n name: extension.name,\n options: extension.options\n }));\n return extension;\n }\n}\nfunction isAndroid() {\n return navigator.platform === 'Android' || /android/i.test(navigator.userAgent);\n}\n\n/**\n * Node views are used to customize the rendered DOM structure of a node.\n * @see https://tiptap.dev/guide/node-views\n */\nclass NodeView {\n constructor(component, props, options) {\n this.isDragging = false;\n this.component = component;\n this.editor = props.editor;\n this.options = {\n stopEvent: null,\n ignoreMutation: null,\n ...options\n };\n this.extension = props.extension;\n this.node = props.node;\n this.decorations = props.decorations;\n this.innerDecorations = props.innerDecorations;\n this.view = props.view;\n this.HTMLAttributes = props.HTMLAttributes;\n this.getPos = props.getPos;\n this.mount();\n }\n mount() {\n // eslint-disable-next-line\n return;\n }\n get dom() {\n return this.editor.view.dom;\n }\n get contentDOM() {\n return null;\n }\n onDragStart(event) {\n var _a, _b, _c, _d, _e, _f, _g;\n const {\n view\n } = this.editor;\n const target = event.target;\n // get the drag handle element\n // `closest` is not available for text nodes so we may have to use its parent\n const dragHandle = target.nodeType === 3 ? (_a = target.parentElement) === null || _a === void 0 ? void 0 : _a.closest('[data-drag-handle]') : target.closest('[data-drag-handle]');\n if (!this.dom || ((_b = this.contentDOM) === null || _b === void 0 ? void 0 : _b.contains(target)) || !dragHandle) {\n return;\n }\n let x = 0;\n let y = 0;\n // calculate offset for drag element if we use a different drag handle element\n if (this.dom !== dragHandle) {\n const domBox = this.dom.getBoundingClientRect();\n const handleBox = dragHandle.getBoundingClientRect();\n // In React, we have to go through nativeEvent to reach offsetX/offsetY.\n const offsetX = (_c = event.offsetX) !== null && _c !== void 0 ? _c : (_d = event.nativeEvent) === null || _d === void 0 ? void 0 : _d.offsetX;\n const offsetY = (_e = event.offsetY) !== null && _e !== void 0 ? _e : (_f = event.nativeEvent) === null || _f === void 0 ? void 0 : _f.offsetY;\n x = handleBox.x - domBox.x + offsetX;\n y = handleBox.y - domBox.y + offsetY;\n }\n (_g = event.dataTransfer) === null || _g === void 0 ? void 0 : _g.setDragImage(this.dom, x, y);\n const pos = this.getPos();\n if (typeof pos !== 'number') {\n return;\n }\n // we need to tell ProseMirror that we want to move the whole node\n // so we create a NodeSelection\n const selection = NodeSelection.create(view.state.doc, pos);\n const transaction = view.state.tr.setSelection(selection);\n view.dispatch(transaction);\n }\n stopEvent(event) {\n var _a;\n if (!this.dom) {\n return false;\n }\n if (typeof this.options.stopEvent === 'function') {\n return this.options.stopEvent({\n event\n });\n }\n const target = event.target;\n const isInElement = this.dom.contains(target) && !((_a = this.contentDOM) === null || _a === void 0 ? void 0 : _a.contains(target));\n // any event from child nodes should be handled by ProseMirror\n if (!isInElement) {\n return false;\n }\n const isDragEvent = event.type.startsWith('drag');\n const isDropEvent = event.type === 'drop';\n const isInput = ['INPUT', 'BUTTON', 'SELECT', 'TEXTAREA'].includes(target.tagName) || target.isContentEditable;\n // any input event within node views should be ignored by ProseMirror\n if (isInput && !isDropEvent && !isDragEvent) {\n return true;\n }\n const {\n isEditable\n } = this.editor;\n const {\n isDragging\n } = this;\n const isDraggable = !!this.node.type.spec.draggable;\n const isSelectable = NodeSelection.isSelectable(this.node);\n const isCopyEvent = event.type === 'copy';\n const isPasteEvent = event.type === 'paste';\n const isCutEvent = event.type === 'cut';\n const isClickEvent = event.type === 'mousedown';\n // ProseMirror tries to drag selectable nodes\n // even if `draggable` is set to `false`\n // this fix prevents that\n if (!isDraggable && isSelectable && isDragEvent) {\n event.preventDefault();\n }\n if (isDraggable && isDragEvent && !isDragging) {\n event.preventDefault();\n return false;\n }\n // we have to store that dragging started\n if (isDraggable && isEditable && !isDragging && isClickEvent) {\n const dragHandle = target.closest('[data-drag-handle]');\n const isValidDragHandle = dragHandle && (this.dom === dragHandle || this.dom.contains(dragHandle));\n if (isValidDragHandle) {\n this.isDragging = true;\n document.addEventListener('dragend', () => {\n this.isDragging = false;\n }, {\n once: true\n });\n document.addEventListener('drop', () => {\n this.isDragging = false;\n }, {\n once: true\n });\n document.addEventListener('mouseup', () => {\n this.isDragging = false;\n }, {\n once: true\n });\n }\n }\n // these events are handled by prosemirror\n if (isDragging || isDropEvent || isCopyEvent || isPasteEvent || isCutEvent || isClickEvent && isSelectable) {\n return false;\n }\n return true;\n }\n /**\n * Called when a DOM [mutation](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) or a selection change happens within the view.\n * @return `false` if the editor should re-read the selection or re-parse the range around the mutation\n * @return `true` if it can safely be ignored.\n */\n ignoreMutation(mutation) {\n if (!this.dom || !this.contentDOM) {\n return true;\n }\n if (typeof this.options.ignoreMutation === 'function') {\n return this.options.ignoreMutation({\n mutation\n });\n }\n // a leaf/atom node is like a black box for ProseMirror\n // and should be fully handled by the node view\n if (this.node.isLeaf || this.node.isAtom) {\n return true;\n }\n // ProseMirror should handle any selections\n if (mutation.type === 'selection') {\n return false;\n }\n // try to prevent a bug on iOS and Android that will break node views on enter\n // this is because ProseMirror can’t preventDispatch on enter\n // this will lead to a re-render of the node view on enter\n // see: https://github.com/ueberdosis/tiptap/issues/1214\n // see: https://github.com/ueberdosis/tiptap/issues/2534\n if (this.dom.contains(mutation.target) && mutation.type === 'childList' && (isiOS() || isAndroid()) && this.editor.isFocused) {\n const changedNodes = [...Array.from(mutation.addedNodes), ...Array.from(mutation.removedNodes)];\n // we’ll check if every changed node is contentEditable\n // to make sure it’s probably mutated by ProseMirror\n if (changedNodes.every(node => node.isContentEditable)) {\n return false;\n }\n }\n // we will allow mutation contentDOM with attributes\n // so we can for example adding classes within our node view\n if (this.contentDOM === mutation.target && mutation.type === 'attributes') {\n return true;\n }\n // ProseMirror should handle any changes within contentDOM\n if (this.contentDOM.contains(mutation.target)) {\n return false;\n }\n return true;\n }\n /**\n * Update the attributes of the prosemirror node.\n */\n updateAttributes(attributes) {\n this.editor.commands.command(({\n tr\n }) => {\n const pos = this.getPos();\n if (typeof pos !== 'number') {\n return false;\n }\n tr.setNodeMarkup(pos, undefined, {\n ...this.node.attrs,\n ...attributes\n });\n return true;\n });\n }\n /**\n * Delete the node.\n */\n deleteNode() {\n const from = this.getPos();\n if (typeof from !== 'number') {\n return;\n }\n const to = from + this.node.nodeSize;\n this.editor.commands.deleteRange({\n from,\n to\n });\n }\n}\n\n/**\n * Build an paste rule that adds a mark when the\n * matched text is pasted into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nfunction markPasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler: ({\n state,\n range,\n match,\n pasteEvent\n }) => {\n const attributes = callOrReturn(config.getAttributes, undefined, match, pasteEvent);\n if (attributes === false || attributes === null) {\n return null;\n }\n const {\n tr\n } = state;\n const captureGroup = match[match.length - 1];\n const fullMatch = match[0];\n let markEnd = range.to;\n if (captureGroup) {\n const startSpaces = fullMatch.search(/\\S/);\n const textStart = range.from + fullMatch.indexOf(captureGroup);\n const textEnd = textStart + captureGroup.length;\n const excludedMarks = getMarksBetween(range.from, range.to, state.doc).filter(item => {\n // @ts-ignore\n const excluded = item.mark.type.excluded;\n return excluded.find(type => type === config.type && type !== item.mark.type);\n }).filter(item => item.to > textStart);\n if (excludedMarks.length) {\n return null;\n }\n if (textEnd < range.to) {\n tr.delete(textEnd, range.to);\n }\n if (textStart > range.from) {\n tr.delete(range.from + startSpaces, textStart);\n }\n markEnd = range.from + startSpaces + captureGroup.length;\n tr.addMark(range.from + startSpaces, markEnd, config.type.create(attributes || {}));\n tr.removeStoredMark(config.type);\n }\n }\n });\n}\n\n// source: https://stackoverflow.com/a/6969486\nfunction escapeForRegEx(string) {\n return string.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n}\nfunction isString(value) {\n return typeof value === 'string';\n}\n\n/**\n * Build an paste rule that adds a node when the\n * matched text is pasted into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nfunction nodePasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler({\n match,\n chain,\n range,\n pasteEvent\n }) {\n const attributes = callOrReturn(config.getAttributes, undefined, match, pasteEvent);\n const content = callOrReturn(config.getContent, undefined, attributes);\n if (attributes === false || attributes === null) {\n return null;\n }\n const node = {\n type: config.type.name,\n attrs: attributes\n };\n if (content) {\n node.content = content;\n }\n if (match.input) {\n chain().deleteRange(range).insertContentAt(range.from, node);\n }\n }\n });\n}\n\n/**\n * Build an paste rule that replaces text when the\n * matched text is pasted into it.\n * @see https://tiptap.dev/docs/editor/extensions/custom-extensions/extend-existing#paste-rules\n */\nfunction textPasteRule(config) {\n return new PasteRule({\n find: config.find,\n handler: ({\n state,\n range,\n match\n }) => {\n let insert = config.replace;\n let start = range.from;\n const end = range.to;\n if (match[1]) {\n const offset = match[0].lastIndexOf(match[1]);\n insert += match[0].slice(offset + match[1].length);\n start += offset;\n const cutOff = start - end;\n if (cutOff > 0) {\n insert = match[0].slice(offset - cutOff, offset) + insert;\n start = end;\n }\n }\n state.tr.insertText(insert, start, end);\n }\n });\n}\nclass Tracker {\n constructor(transaction) {\n this.transaction = transaction;\n this.currentStep = this.transaction.steps.length;\n }\n map(position) {\n let deleted = false;\n const mappedPosition = this.transaction.steps.slice(this.currentStep).reduce((newPosition, step) => {\n const mapResult = step.getMap().mapResult(newPosition);\n if (mapResult.deleted) {\n deleted = true;\n }\n return mapResult.pos;\n }, position);\n return {\n position: mappedPosition,\n deleted\n };\n }\n}\nexport { CommandManager, Editor, Extension, InputRule, Mark, Node, NodePos, NodeView, PasteRule, Tracker, callOrReturn, combineTransactionSteps, createChainableState, createDocument, createNodeFromContent, createStyleTag, defaultBlockAt, deleteProps, elementFromString, escapeForRegEx, index as extensions, findChildren, findChildrenInRange, findDuplicates, findParentNode, findParentNodeClosestToPos, fromString, generateHTML, generateJSON, generateText, getAttributes, getAttributesFromExtensions, getChangedRanges, getDebugJSON, getExtensionField, getHTMLFromFragment, getMarkAttributes, getMarkRange, getMarkType, getMarksBetween, getNodeAtPosition, getNodeAttributes, getNodeType, getRenderedAttributes, getSchema, getSchemaByResolvedExtensions, getSchemaTypeByName, getSchemaTypeNameByName, getSplittedAttributes, getText, getTextBetween, getTextContentFromNodes, getTextSerializersFromSchema, injectExtensionAttributesToParseRule, inputRulesPlugin, isActive, isAtEndOfNode, isAtStartOfNode, isEmptyObject, isExtensionRulesEnabled, isFunction, isList, isMacOS, isMarkActive, isNodeActive, isNodeEmpty, isNodeSelection, isNumber, isPlainObject, isRegExp, isString, isTextSelection, isiOS, markInputRule, markPasteRule, mergeAttributes, mergeDeep, minMax, nodeInputRule, nodePasteRule, objectIncludes, pasteRulesPlugin, posToDOMRect, removeDuplicates, resolveFocusPosition, selectionToInsertionEnd, splitExtensions, textInputRule, textPasteRule, textblockTypeInputRule, wrappingInputRule };\n"],"mappings":"stBAEA,SAASA,EAAWC,EAAS,CAC3B,KAAK,QAAUA,CACjB,CACAD,EAAW,UAAY,CACrB,YAAaA,EACb,KAAM,SAAUE,EAAK,CACnB,QAASC,EAAI,EAAGA,EAAI,KAAK,QAAQ,OAAQA,GAAK,EAAG,GAAI,KAAK,QAAQA,CAAC,IAAMD,EAAK,OAAOC,EACrF,MAAO,EACT,EAIA,IAAK,SAAUD,EAAK,CAClB,IAAIE,EAAQ,KAAK,KAAKF,CAAG,EACzB,OAAOE,GAAS,GAAK,OAAY,KAAK,QAAQA,EAAQ,CAAC,CACzD,EAKA,OAAQ,SAAUF,EAAKG,EAAOC,EAAQ,CACpC,IAAIC,EAAOD,GAAUA,GAAUJ,EAAM,KAAK,OAAOI,CAAM,EAAI,KACvDF,EAAQG,EAAK,KAAKL,CAAG,EACvBD,EAAUM,EAAK,QAAQ,MAAM,EAC/B,OAAIH,GAAS,GACXH,EAAQ,KAAKK,GAAUJ,EAAKG,CAAK,GAEjCJ,EAAQG,EAAQ,CAAC,EAAIC,EACjBC,IAAQL,EAAQG,CAAK,EAAIE,IAExB,IAAIN,EAAWC,CAAO,CAC/B,EAGA,OAAQ,SAAUC,EAAK,CACrB,IAAIE,EAAQ,KAAK,KAAKF,CAAG,EACzB,GAAIE,GAAS,GAAI,OAAO,KACxB,IAAIH,EAAU,KAAK,QAAQ,MAAM,EACjC,OAAAA,EAAQ,OAAOG,EAAO,CAAC,EAChB,IAAIJ,EAAWC,CAAO,CAC/B,EAGA,WAAY,SAAUC,EAAKG,EAAO,CAChC,OAAO,IAAIL,EAAW,CAACE,EAAKG,CAAK,EAAE,OAAO,KAAK,OAAOH,CAAG,EAAE,OAAO,CAAC,CACrE,EAGA,SAAU,SAAUA,EAAKG,EAAO,CAC9B,IAAIJ,EAAU,KAAK,OAAOC,CAAG,EAAE,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mB,EAAQ9b,EAAOC,CAAG,CACxC,CACF,CAAC,CACH,CACA,IAAMoe,GAAN,KAAc,CACZ,YAAY9oB,EAAa,CACvB,KAAK,YAAcA,EACnB,KAAK,YAAc,KAAK,YAAY,MAAM,MAC5C,CACA,IAAIqS,EAAU,CACZ,IAAI0W,EAAU,GAQd,MAAO,CACL,SARqB,KAAK,YAAY,MAAM,MAAM,KAAK,WAAW,EAAE,OAAO,CAACC,EAAa3U,IAAS,CAClG,IAAM4U,EAAY5U,EAAK,OAAO,EAAE,UAAU2U,CAAW,EACrD,OAAIC,EAAU,UACZF,EAAU,IAELE,EAAU,GACnB,EAAG5W,CAAQ,EAGT,QAAA0W,CACF,CACF,CACF","names":["OrderedMap","content","key","i","found","value","newKey","self","place","without","f","map","result","prop","dist_default","findDiffStart","a","b","pos","i","childA","childB","j","inner","findDiffEnd","posA","posB","iA","iB","size","same","minSize","Fragment","_Fragment","content","from","to","f","nodeStart","parent","child","end","start","blockSeparator","leafText","text","first","node","nodeText","other","last","result","index","current","copy","found","p","otherPos","round","retIndex","curPos","cur","n","schema","value","array","joined","nodes","offset","compareDeep","Mark","type","attrs","set","placed","obj","_","json","mark","marks","ReplaceError","Slice","_Slice","openStart","openEnd","fragment","insertInto","removeRange","openIsolating","indexTo","offsetTo","dist","insert","replace","$from","$to","slice","replaceOuter","depth","close","prepareSliceForReplace","replaceThreeWay","replaceTwoWay","checkJoin","main","sub","joinable","$before","$after","addNode","target","addRange","$start","$end","startIndex","endIndex","$along","extra","ResolvedPos","_ResolvedPos","path","parentOffset","val","dOff","tmp","after","next","pred","d","NodeRange","str","doc","rem","cache","resolveCache","elt","ResolveCache","resolveCacheSize","emptyAttrs","Node","_Node","startPos","includeParents","name","wrapMarks","match","replacement","one","two","m","TextNode","_TextNode","base","ContentMatch","_ContentMatch","validEnd","string","nodeTypes","stream","TokenStream","expr","parseExpr","dfa","nfa","checkForDeadEnds","frag","toEnd","seen","search","types","finished","tp","computed","active","scan","out","tok","exprs","parseExprSeq","parseExprSubscript","parseExprAtom","parseExprRange","parseNum","min","max","resolveName","typeName","connect","compile","edge","term","edges","loop","cmp","nullFrom","labeled","explore","states","state","work","dead","defaultAttrs","defaults","attrName","attr","computeAttrs","built","given","checkAttrs","values","initAttrs","Attribute","NodeType","_NodeType","spec","group","before","matched","markType","topType","validateType","options","MarkType","_MarkType","rank","Schema","instanceSpec","prop","dist_default","contentExprCache","contentExpr","markExpr","gatherMarks","excl","ok","isTagRule","rule","isStyleRule","DOMParser","_DOMParser","rules","matchedStyles","r","dom","context","ParseContext","matches","style","priority","blockTags","ignoreTags","listTags","OPT_PRESERVE_WS","OPT_PRESERVE_WS_FULL","OPT_OPEN_LEFT","wsOptionsFor","preserveWhitespace","NodeContext","solid","fill","wrap","parser","isOpen","topNode","topContext","topOptions","top","preserveWS","nodeBefore","domNodeBefore","matchAfter","outerWS","ruleID","normalizeList","sync","oldNeedsBlock","innerMarks","styles","continueAfter","nodeType","startIn","contentDOM","route","cx","block","nodeMarks","markMayApply","applyMarks","textNode","parts","option","useRoot","minDepth","part","$context","deflt","prevItem","selector","DOMSerializer","_DOMSerializer","keep","rendered","add","markDOM","renderSpec","inline","toDOM","structure","xmlNS","blockArraysIn","gatherToDOM","suspiciousAttributeCache","suspiciousAttributes","suspiciousAttributesInner","tagName","suspicious","space","innerContent","lower16","factor16","makeRecover","index","offset","recoverIndex","value","recoverOffset","DEL_BEFORE","DEL_AFTER","DEL_ACROSS","DEL_SIDE","MapResult","pos","delInfo","recover","StepMap","_StepMap","ranges","inverted","diff","assoc","simple","oldIndex","newIndex","i","start","oldSize","newSize","end","side","result","del","f","oldStart","newStart","n","Mapping","_Mapping","maps","mirror","from","to","map","mirrors","mapping","startSize","mirr","m","totalSize","inverse","corr","stepsByID","Step","other","schema","json","type","id","stepClass","StepResult","_StepResult","doc","failed","message","slice","e","ReplaceError","mapFragment","fragment","parent","mapped","child","Fragment","AddMarkStep","_AddMarkStep","mark","oldSlice","$from","Slice","node","RemoveMarkStep","_RemoveMarkStep","AddNodeMarkStep","_AddNodeMarkStep","updated","newSet","RemoveNodeMarkStep","_RemoveNodeMarkStep","ReplaceStep","_ReplaceStep","structure","contentBetween","ReplaceAroundStep","_ReplaceAroundStep","gapFrom","gapTo","insert","gap","inserted","dist","depth","next","addMark","tr","removed","added","removing","adding","marks","s","removeMark","matched","step","toRemove","MarkType","set","found","style","j","clearIncompatible","parentType","match","clearNewlines","replSteps","cur","allowed","newline","fill","canCut","liftTarget","range","content","endIndex","lift","target","$to","gapStart","gapEnd","before","openStart","d","splitting","after","openEnd","findWrapping","nodeType","attrs","innerRange","around","findWrappingOutside","inner","findWrappingInside","withAttrs","startIndex","outer","inside","innerMatch","wrap","wrappers","setBlockType","mapFrom","attrsHere","canChangeType","convertNewlines","pre","supportLinebreak","replaceLinebreaks","startM","endM","replaceNewlines","$pos","setNodeMarkup","newNode","canSplit","typesAfter","base","innerType","rest","overrideChild","baseType","split","typeAfter","canJoin","joinable","canAppendWithSubstitutedLinebreaks","a","b","linebreakReplacement","joinPoint","dir","join","$before","beforeType","$after","$full","insertPoint","dropPoint","pass","bias","insertPos","fits","wrapping","replaceStep","fitsTrivially","Fitter","unplaced","fit","moveInline","placedSize","startDepth","sliceDepth","contentAt","first","frontierDepth","inject","openAtEnd","dropFromFragment","taken","add","openEndCount","matches","closeNodeStart","toEnd","addToFragment","top","level","contentAfterFits","scan","dropInner","close","count","frag","open","invalidMarks","definesContent","replaceRange","targetDepths","coveredDepths","preferredTarget","spec","preferredTargetIndex","leftNodes","preferredDepth","leftNode","def","openDepth","targetDepth","expand","closeFragment","startSteps","oldOpen","newOpen","replaceRangeWith","point","deleteRange","covered","last","minDepth","AttrStep","_AttrStep","attr","name","DocAttrStep","_DocAttrStep","TransformError","err","Transform","Mark","classesById","Selection","$anchor","$head","ranges","SelectionRange","i","tr","content","Slice","lastNode","lastParent","mapFrom","$from","$to","mapping","selectionToInsertionEnd","node","from","to","$pos","dir","textOnly","inner","TextSelection","findSelectionIn","depth","found","bias","AllSelection","doc","json","cls","id","selectionClass","warnedAboutTextSelection","checkTextSelection","_TextSelection","marks","other","TextBookmark","anchor","head","dPos","_TextBookmark","NodeSelection","_NodeSelection","$end","deleted","pos","Fragment","NodeBookmark","_NodeBookmark","_AllSelection","sel","AllBookmark","index","text","child","startLen","last","step","ReplaceStep","ReplaceAroundStep","map","end","_from","_to","_newFrom","newTo","UPDATED_SEL","UPDATED_MARKS","UPDATED_SCROLL","Transaction","Transform","state","selection","Mark","mark","time","slice","inheritMarks","schema","key","value","_","bind","f","self","FieldDesc","name","desc","baseFields","config","instance","_marks","_old","prev","Configuration","plugins","plugin","EditorState","_EditorState","ignore","rootTr","trs","newState","seen","haveNew","n","oldState","j","newInstance","fields","field","$config","pluginFields","result","m","prop","Node","bindProps","obj","target","val","Plugin","spec","createKey","keys","PluginKey","domIndex","node","index","parentNode","parent","reusedRange","textRange","from","to","range","clearReusedRange","isEquivalentPosition","off","targetNode","targetOff","scanFor","atomElements","dir","nodeSize","hasBlockDesc","textNodeBefore$1","offset","textNodeAfter$1","isOnEdge","atStart","atEnd","dom","desc","cur","selectionCollapsed","domSel","keyEvent","keyCode","key","event","deepActiveElement","doc","elt","caretFromPoint","x","y","pos","nav","agent","ie_edge","ie_upto10","ie_11up","ie","ie_version","gecko","_chrome","chrome","chrome_version","safari","ios","mac","windows","android","webkit","webkit_version","windowRect","vp","getSide","value","side","clientRect","rect","scaleX","scaleY","scrollRectIntoView","view","startDOM","scrollThreshold","scrollMargin","atTop","bounding","moveX","moveY","startX","startY","dX","dY","storeScrollPos","refDOM","refTop","localRect","scrollStack","stack","resetScrollPos","newRefTop","restoreScrollStack","dTop","i","top","left","preventScrollSupported","focusPreventScroll","stored","findOffsetInNode","coords","closest","dxClosest","coordsClosest","rowBot","rowTop","firstBelow","coordsBelow","child","childIndex","rects","dx","findOffsetInText","len","singleRect","inRect","targetKludge","posFromElement","bias","posFromCaret","outsideBlock","sawBlock","elementFromPoint","element","box","startI","j","posAtCoords","caret","p","next","prev","nonZero","target","first","BIDI","coordsAtPos","atom","supportEmptyRange","rectBefore","rectAfter","flattenV","takeSide","before","flattenH","after","withFlushedState","state","f","viewState","active","endOfTextblockVertical","sel","$pos","nearest","boxes","maybeRTL","endOfTextblockHorizontal","$head","oldNode","oldOff","anchorNode","anchorOffset","oldBidiLevel","parentDOM","newNode","newOff","result","cachedState","cachedDir","cachedResult","endOfTextblock","NOT_DIRTY","CHILD_DIRTY","CONTENT_DIRTY","NODE_DIRTY","ViewDesc","children","contentDOM","widget","mark","outerDeco","innerDeco","nodeName","size","domBefore","domAfter","search","onlyNodes","nodeDOM","scan","end","curPos","TrailingHackViewDesc","WidgetViewDesc","enter","base","fromOffset","toOffset","childBase","anchor","head","force","anchorDOM","headDOM","selRange","brKludge","domSelExtended","tmp","mutation","startInside","endInside","level","dirty","text","self","wrap","stop","CompositionViewDesc","textDOM","mut","MarkViewDesc","_MarkViewDesc","spec","inline","custom","DOMSerializer","copy","nodes","replaceNodes","NodeViewDesc","_NodeViewDesc","descObj","applyOuterDeco","CustomNodeViewDesc","TextViewDesc","rule","Fragment","sameOuterDeco","composition","localComposition","compositionInChild","updater","ViewTreeUpdater","iterDeco","insideNode","Mark","compIndex","renderDescs","iosHacks","TextSelection","textNode","textPos","findTextInFragment","topNode","needsWrap","oldDOM","patchOuterDeco","computeOuterDeco","docViewDesc","docView","_TextViewDesc","skip","n","descs","written","childDOM","rm","OuterDecoLevel","noDeco","attrs","name","val","outerDOM","prevComputed","curComputed","curDOM","deco","patchAttributes","prevList","curList","prop","m","a","b","lock","preMatch","start","marks","keep","depth","maxKeep","found","markDesc","targetDesc","e","domNode","nextDOM","updated","locked","wrapper","ch","lastChild","hack","frag","parentDesc","curDesc","descI","fI","matched","matches","outer","compareSide","onWidget","onNode","locals","decoIndex","restNode","parentIndex","widgets","cutAt","d","oldCSS","childStart","str","replacement","selectionFromDOM","origin","nearestDesc","inWidget","selection","nearestDescNode","NodeSelection","min","max","$anchor","selectionBetween","editorOwnsSelection","hasSelection","selectionToDOM","syncNodeSelection","curSel","selectCursorWrapper","resetEditableFrom","resetEditableTo","brokenSelectBetweenUneditable","temporarilyEditableNear","resetEditable","removeClassOnSelectionChange","setEditable","img","clearNodeSelection","hasFocusAndSelection","anchorInRightPlace","moveSelectionBlock","$side","$start","Selection","apply","selectHorizontally","mods","$newHead","nodePos","nodeLen","isIgnorable","skipIgnoredNodes","skipIgnoredNodesBefore","skipIgnoredNodesAfter","moveNode","moveOffset","isBlockNode","setSelFocus","textNodeAfter","textNodeBefore","findDirection","mid","selectVertically","$from","$to","beyond","AllSelection","stopNativeHorizontalDelete","empty","nextNode","tr","switchEditable","safariDownArrowBug","focusNode","focusOffset","getMods","captureKeyDown","code","serializeForClipboard","slice","context","content","openStart","openEnd","serializer","detachedDoc","firstChild","wrappers","wrapMap","parseFromClipboard","html","plainText","$context","inCode","asText","Slice","parsed","schema","block","readHTML","restoreReplacedSpaces","contextNode","sliceData","DOMParser","inlineParents","addContext","closeSlice","normalizeSiblings","fragment","match","lastWrap","inLast","addToSibling","closeRight","wrapped","withWrappers","sibling","inner","fill","closeRange","_detachedDoc","_policy","maybeWrapTrusted","trustedTypes","s","metas","firstTag","array","type","handlers","editHandlers","passiveHandlers","InputState","initInput","handler","eventBelongsToView","runCustomHandler","ensureListeners","setSelectionOrigin","destroyInput","currentHandlers","dispatchEvent","_event","inOrNearComposition","now","eventCoords","isNear","click","dy","runHandlerOnContext","propName","inside","updateSelection","selectClickedLeaf","selectClickedNode","selectedNode","selectAt","handleSingleClick","selectNode","handleDoubleClick","handleTripleClick","defaultTripleClick","forceDOMFlush","endComposition","selectNodeModifier","flushed","MouseDown","targetPos","timeoutComposition","scheduleComposeEnd","delay","clearComposition","timestampFromCustomEvent","findCompositionNode","textBefore","textAfter","descAfter","lastChanged","descBefore","restarting","captureCopy","brokenClipboardAPI","cut","data","sliceSingleNode","capturePaste","plain","doPaste","preferPlain","singleNode","getText","clipboardData","uris","Dragging","move","dragCopyModifier","mouseDown","draggedSlice","dragging","_","eventPos","$mouse","insertPos","dropPoint","isNode","beforeInsert","_from","_to","_newFrom","newTo","domChangeCount","$cursor","compareObjs","WidgetType","_WidgetType","toDOM","noSpec","mapping","span","oldOffset","deleted","Decoration","other","InlineType","_InlineType","NodeType","_NodeType","_Decoration","none","DecorationSet","_DecorationSet","local","decorations","buildTree","predicate","childOff","options","newLocal","mapped","mapChildren","byPos","childNode","childOffset","baseOffset","takeSpansForNode","moveSpans","withoutNulls","removed","dec","localSet","DecorationGroup","removeOverlap","_DecorationGroup","members","mappedDecos","member","sorted","r","oldChildren","moved","oldStart","oldEnd","newStart","newEnd","dSize","mustRebuild","fromLocal","toLocal","mapAndGatherRemainingDecorations","built","spans","gather","set","hasNulls","localStart","subtree","working","insertAhead","viewDecorations","observeOptions","useCharData","SelectionState","DOMObserver","handleDOMChange","mutations","take","ancestors","container","newSel","typeOver","added","brs","br","blockParent","readSel","checkCSS","previousSibling","nextSibling","cssChecked","cssCheckWarned","rangeToSelectionRange","currentAnchor","safariShadowSelectionRange","read","parseBetween","from_","to_","find","startDoc","parser","ruleFromNode","isInline","readDOMChange","addedNodes","compositionID","$before","shared","parse","compare","preferredPos","preferredSide","change","findDiff","resolveSelection","$fromA","inlineChange","nextSel","looksLikeBackspace","chFrom","chTo","storedMarks","markChange","isMarkChange","parsedSel","curMarks","prevMarks","update","old","$newStart","$newEnd","skipClosingAndOpening","$next","fromEnd","mayOpen","endA","endB","adjust","isSurrogatePair","EditorView","place","props","InputState","checkStateComponent","getEditable","updateCursorWrapper","buildNodeViews","docViewDesc","computeDocDeco","viewDecorations","DOMObserver","from","to","typeOver","added","readDOMChange","initInput","prev","name","ensureListeners","prevProps","updated","state","_a","redraw","updateSel","clearComposition","pluginsChanged","nodeViews","changedNodeViews","innerDeco","outerDeco","scroll","updateDoc","oldScrollPos","storeScrollPos","forceSelUpdate","ie","chrome","selectionContextChanged","chromeKludge","findCompositionNode","anchorInRightPlace","selectionToDOM","syncNodeSelection","resetScrollPos","startDOM","f","NodeSelection","target","scrollRectIntoView","view","prevState","i","plugin","pluginView","dragging","sel","found","movedPos","Dragging","propName","prop","value","plugins","node","focusPreventScroll","cached","search","coords","posAtCoords","pos","side","coordsAtPos","desc","offset","bias","dir","endOfTextblock","html","event","doPaste","text","destroyInput","clearReusedRange","dispatchEvent","tr","dispatchTransaction","safari","deepActiveElement","safariShadowSelectionRange","attrs","attr","Decoration","dom","sel1","sel2","depth","result","add","obj","a","b","nA","nB","_","base","shift","mac","ie","i","code","keyName","event","ignoreKey","name","mac","normalizeKeyName","name","parts","result","alt","ctrl","shift","meta","i","mod","normalize","map","copy","prop","modifiers","event","keymap","bindings","Plugin","keydownHandler","view","keyName","baseName","direct","noShift","base","fromCode","deleteSelection","state","dispatch","atBlockStart","view","$cursor","joinBackward","$cut","findCutBefore","range","target","liftTarget","before","deleteBarrier","textblockAt","NodeSelection","depth","delStep","replaceStep","Slice","tr","Selection","joinTextblockBackward","joinTextblocksAround","joinTextblockForward","atBlockEnd","findCutAfter","beforeText","beforePos","child","after","afterText","afterPos","step","ReplaceStep","TextSelection","node","side","only","scan","selectNodeBackward","$head","empty","$pos","i","joinForward","selectNodeForward","parent","joinUp","sel","nodeSel","point","canJoin","joinPoint","joinDown","lift","$from","$to","newlineInCode","$anchor","defaultBlockAt","match","type","exitCode","above","pos","createParagraphNear","AllSelection","liftEmptyBlock","canSplit","splitBlockAs","splitNode","types","splitDepth","deflt","atEnd","atStart","d","splitType","splitPos","can","first","$first","splitBlock","selectParentNode","state","dispatch","$from","to","pos","same","NodeSelection","selectAll","AllSelection","joinMaybeClear","$pos","before","after","index","canJoin","deleteBarrier","$cut","dir","conn","match","isolated","canDelAfter","end","wrap","Fragment","i","tr","ReplaceAroundStep","Slice","$joinAt","selAfter","Selection","range","target","liftTarget","textblockAt","at","afterText","afterDepth","selectTextblockSide","side","sel","depth","TextSelection","selectTextblockStart","selectTextblockEnd","wrapIn","nodeType","attrs","$to","wrapping","findWrapping","setBlockType","applicable","from","node","chainCommands","commands","state","dispatch","view","backspace","deleteSelection","joinBackward","selectNodeBackward","del","joinForward","selectNodeForward","pcBaseKeymap","newlineInCode","createParagraphNear","liftEmptyBlock","splitBlock","exitCode","selectAll","macBaseKeymap","selectTextblockStart","selectTextblockEnd","key","mac","wrapInList","listType","attrs","state","dispatch","$from","$to","range","tr","wrapRangeInList","doJoin","outerRange","doc","$insert","NodeRange","wrap","findWrapping","doWrapInList","wrappers","joinBefore","content","Fragment","i","ReplaceAroundStep","Slice","found","splitDepth","splitPos","parent","e","first","canSplit","liftListItem","itemType","state","dispatch","$from","$to","range","node","liftToOuterList","liftOutOfList","tr","end","endOfList","ReplaceAroundStep","Slice","Fragment","NodeRange","target","liftTarget","after","canJoin","list","pos","i","e","$start","item","atStart","atEnd","parent","indexBefore","start","sinkListItem","startIndex","nodeBefore","nestedBefore","inner","slice","before","createChainableState","config","state","transaction","selection","doc","storedMarks","__spreadProps","__spreadValues","CommandManager","props","rawCommands","editor","view","tr","name","command","args","callback","startTr","shouldDispatch","callbacks","hasStartTransaction","run","chain","dispatch","formattedCommands","EventEmitter","event","fn","onceFn","getExtensionField","extension","field","context","splitExtensions","extensions","baseExtensions","nodeExtensions","markExtensions","getAttributesFromExtensions","extensionAttributes","nodeAndMarkExtensions","defaultAttribute","addGlobalAttributes","globalAttribute","type","attribute","addAttributes","attributes","mergedAttr","getNodeType","nameOrType","schema","mergeAttributes","objects","item","items","mergedAttributes","key","value","valueClasses","existingClasses","insertClasses","valueClass","newStyles","style","existingStyles","styleMap","property","val","part","getRenderedAttributes","nodeOrMark","isFunction","callOrReturn","isEmptyObject","fromString","injectExtensionAttributesToParseRule","parseRule","node","oldAttributes","newAttributes","cleanUpSchemaItem","data","getSchemaByResolvedExtensions","_a","allAttributes","topNode","nodes","extraNodeFields","fields","e","extendNodeSchema","extensionAttribute","parseHTML","renderHTML","renderText","marks","extraMarkFields","extendMarkSchema","mark","Schema","getSchemaTypeByName","isExtensionRulesEnabled","enabled","enabledExtension","getHTMLFromFragment","fragment","documentFragment","DOMSerializer","container","getTextContentFromNodes","$from","maxMatch","textBefore","sliceEndPos","pos","parent","index","_b","chunk","isRegExp","InputRule","inputRuleMatcherHandler","text","find","inputRuleMatch","result","run$1","from","to","rules","plugin","matched","rule","match","range","commands","can","inputRulesPlugin","Plugin","prev","stored","simulatedInputMeta","Fragment","$cursor","getType","isPlainObject","mergeDeep","target","source","output","Mark","_Mark","options","extendedConfig","currentPos","currentMarks","m","removeMark","isNumber","PasteRule","pasteRuleMatcherHandler","matches","pasteRuleMatch","pasteEvent","dropEvent","handlers","resolvedFrom","resolvedTo","textToMatch","start","end","handler","createClipboardPasteEvent","pasteRulesPlugin","dragSourceElement","isPastedFromProseMirror","isDroppedFromProseMirror","processEvent","pasteEvt","chainableState","handleDragstart","_view","html","transactions","oldState","isPaste","isDrop","simulatedPasteMeta","isSimulatedPaste","findDuplicates","filtered","el","ExtensionManager","_ExtensionManager","resolvedExtensions","duplicatedNames","addExtensions","a","b","priorityA","priorityB","addCommands","inputRules","pasteRules","allPlugins","plugins","addKeyboardShortcuts","defaultBindings","bindings","shortcut","method","keyMapPlugin","keymap","addInputRules","addPasteRules","addProseMirrorPlugins","proseMirrorPlugins","addNodeView","nodeview","getPos","decorations","innerDecorations","HTMLAttributes","onBeforeCreate","onCreate","onUpdate","onSelectionUpdate","onTransaction","onFocus","onBlur","onDestroy","Extension","_Extension","getTextBetween","startNode","blockSeparator","textSerializers","textSerializer","getTextSerializersFromSchema","ClipboardTextSerializer","PluginKey","ranges","blur","clearContent","emitUpdate","clearNodes","$to","mapping","$mappedFrom","$mappedTo","nodeRange","targetLiftDepth","liftTarget","defaultType","createParagraphNear","cut","originRange","targetPos","contentSlice","newPos","TextSelection","deleteCurrentNode","currentNode","$pos","depth","deleteNode","typeOrName","deleteRange","deleteSelection","enter","exitCode","objectIncludes","object1","object2","keys","findMarkInSet","k","isMarkInSet","getMarkRange","startIndex","startPos","endIndex","endPos","getMarkType","extendMarkRange","newSelection","first","i","isTextSelection","minMax","min","max","resolveFocusPosition","position","selectionAtStart","Selection","selectionAtEnd","minPos","maxPos","isiOS","focus","delayedFocus","isSameSelection","forEach","insertContent","removeWhitespaces","children","child","elementFromString","wrappedValue","createNodeFromContent","content","Node","isJSONContent","isTextContent","error","hasInvalidContent","invalidContent","contentCheckSchema","DOMParser","parser","selectionToInsertionEnd","startLen","bias","last","step","ReplaceStep","ReplaceAroundStep","map","_from","_to","_newFrom","newTo","isFragment","nodeOrFragment","insertContentAt","isOnlyTextContent","isOnlyBlockContent","newContent","v","joinUp","joinDown","joinBackward","joinForward","joinItemBackward","point","joinPoint","joinItemForward","joinTextblockBackward","joinTextblockForward","isMacOS","normalizeKeyName","parts","alt","ctrl","shift","meta","mod","keyboardShortcut","capturedTransaction","f","newStep","isNodeActive","empty","nodeRanges","relativeFrom","relativeTo","selectionRange","matchedNodeRanges","sum","lift","liftEmptyBlock","liftListItem","newlineInCode","getSchemaTypeNameByName","deleteProps","obj","propOrProps","newObj","prop","resetAttributes","nodeType","markType","schemaType","scrollIntoView","selectAll","selectNodeBackward","selectNodeForward","selectParentNode","selectTextblockEnd","selectTextblockStart","createDocument","parseOptions","setContent","document","getMarkAttributes","markItem","combineTransactionSteps","oldDoc","transform","Transform","defaultBlockAt","findChildren","predicate","nodesWithPos","findChildrenInRange","findParentNodeClosestToPos","findParentNode","getSchema","generateHTML","contentNode","generateJSON","dom","getText","generateText","getNodeAttributes","nodeItem","getAttributes","removeDuplicates","array","by","seen","simplifyChangedRanges","changes","uniqueChanges","change","_","otherChange","getChangedRanges","steps","stepMap","newStart","newEnd","oldStart","oldEnd","getDebugJSON","startOffset","increment","attrs","offset","getMarksBetween","getNodeAtPosition","maxDepth","currentDepth","getSplittedAttributes","typeName","isMarkActive","markRanges","matchedRange","markRange","excludedRange","isActive","isAtEndOfNode","$anchor","parentNode","$parentPos","isAtStartOfNode","isList","group","isNodeEmpty","checkChildren","ignoreWhitespace","isContentEmpty","childNode","isNodeSelection","NodeSelection","posToDOMRect","resolvedEnd","top","bottom","left","right","width","height","canSetMark","newMarkType","cursor","someNodeSupportsMark","_pos","parentAllowsMarkType","currentMarksAllowMarkType","otherMark","setMark","trimmedFrom","trimmedTo","setMeta","setNode","attributesToCopy","setBlockType","updatedState","setNodeSelection","setTextSelection","sinkListItem","ensureMarks","splittableMarks","filteredMarks","splitBlock","keepMarks","canSplit","atEnd","deflt","types","$first","splitListItem","overrideAttrs","grandParent","wrap","depthBefore","d","depthAfter","newNextTypeAttributes","nextType","Slice","sel","n","newTypeAttributes","joinListBackwards","listType","list","before","nodeBefore","canJoin","joinListForwards","after","nodeAfter","toggleList","listTypeOrName","itemTypeOrName","itemType","parentList","canWrapInList","toggleMark","extendEmptyMarkRange","toggleNode","toggleTypeOrName","toggleType","toggleWrap","undoInputRule","undoable","toUndo","j","unsetAllMarks","unsetMark","updateAttributes","lastPos","lastNode","trimmedFrom2","trimmedTo2","wrapIn","wrapInList","Commands","Drop","slice","moved","Editable","FocusEvents","Keymap","handleBackspace","parentIsIsolating","parentPos","isAtStart","handleDelete","baseKeymap","pcKeymap","macKeymap","newState","docChanges","ignoreTr","allFrom","allEnd","Paste","Tabindex","NodePos","_NodePos","isBlock","isNonTextAtom","childNodePos","selector","nodeAttributes","attrKeys","firstItemOnly","childPos","createStyleTag","nonce","suffix","tiptapStyleTag","styleNode","Editor","editable","handlePlugins","nameOrPluginKeyToRemove","prevPlugins","nameOrPluginKey","allExtensions","ext","EditorView","EditorState","selectionHasChanged","nameOrAttributes","attributesOrUndefined","markInputRule","captureGroup","fullMatch","startSpaces","textStart","textEnd","markEnd","nodeInputRule","newNode","matchStart","lastChar","insertionStart","textblockTypeInputRule","$start","textInputRule","insert","cutOff","wrappingInputRule","blockRange","wrapping","findWrapping","_Node","isAndroid","NodeView","component","_c","_d","_e","_f","_g","dragHandle","x","y","domBox","handleBox","offsetX","offsetY","isDragEvent","isDropEvent","isEditable","isDragging","isDraggable","isSelectable","isCopyEvent","isPasteEvent","isCutEvent","isClickEvent","mutation","markPasteRule","escapeForRegEx","string","isString","nodePasteRule","textPasteRule","Tracker","deleted","newPosition","mapResult"],"x_google_ignoreList":[0,1,2,3,4,5,6,7,8,9]} \ No newline at end of file diff --git a/chunk-UQ26QW4E.js b/chunk-7PCLFWKE.js similarity index 67% rename from chunk-UQ26QW4E.js rename to chunk-7PCLFWKE.js index 9cccb14c..00805b51 100644 --- a/chunk-UQ26QW4E.js +++ b/chunk-7PCLFWKE.js @@ -1,40 +1,40 @@ -import{$a as X,A as oc,Da as D1,E as ee,Fa as E1,H as sc,Ha as w1,O as zs,Pa as T1,Qa as ac,Sa as x1,V as Zt,Wa as sr,Xa as uc,Ya as pu,_ as ft,_a as ar,a as M,ab as I1,b as U,bb as Vn,c as ho,d as nc,e as d,eb as S1,f as Bt,g as ic,h as Bn,i as d1,j as f1,k as p1,l as h1,m as m1,n as g1,o as nn,p as y1,q as Dt,r as Nr,ra as b1,s as v1,t as Rt,u as qt,ua as _1,v as Pr,va as C1,w as Fr,x as rc}from"./chunk-5XJ3NODC.js";function om(t,e){return Object.is(t,e)}var Vt=null,hu=!1,sm=1,zn=Symbol("SIGNAL");function Ue(t){let e=Vt;return Vt=t,e}function M1(){return Vt}function gO(){return hu}var Zo={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function cc(t){if(hu)throw new Error("");if(Vt===null)return;Vt.consumerOnSignalRead(t);let e=Vt.nextProducerIndex++;if(fc(Vt),et.nextProducerIndex;)t.producerNode.pop(),t.producerLastReadVersion.pop(),t.producerIndexOfThis.pop()}}function yu(t){fc(t);for(let e=0;e0}function fc(t){t.producerNode??(t.producerNode=[]),t.producerIndexOfThis??(t.producerIndexOfThis=[]),t.producerLastReadVersion??(t.producerLastReadVersion=[])}function P1(t){t.liveConsumerNode??(t.liveConsumerNode=[]),t.liveConsumerIndexOfThis??(t.liveConsumerIndexOfThis=[])}function F1(t){return t.producerNode!==void 0}function R1(t){let e=Object.create(vO);e.computation=t;let i=()=>{if(am(e),cc(e),e.value===lc)throw e.error;return e.value};return i[zn]=e,i}var em=Symbol("UNSET"),tm=Symbol("COMPUTING"),lc=Symbol("ERRORED"),vO=U(M({},Zo),{value:em,dirty:!0,error:null,equal:om,producerMustRecompute(t){return t.value===em||t.value===tm},producerRecomputeValue(t){if(t.value===tm)throw new Error("Detected cycle in computations.");let e=t.value;t.value=tm;let i=js(t),n;try{n=t.computation()}catch(r){n=lc,t.error=r}finally{gu(t,i)}if(e!==em&&e!==lc&&n!==lc&&t.equal(e,n)){t.value=e;return}t.value=n,t.version++}});function bO(){throw new Error}var L1=bO;function H1(){L1()}function B1(t){L1=t}var nm=null;function V1(t){let e=Object.create(um);e.value=t;let i=()=>(cc(e),e.value);return i[zn]=e,i}function pc(t,e){k1()||H1(),t.equal(t.value,e)||(t.value=e,_O(t))}function z1(t,e){k1()||H1(),pc(t,e(t.value))}var um=U(M({},Zo),{equal:om,value:void 0});function _O(t){t.version++,yO(),A1(t),nm==null||nm()}function j1(t,e,i){let n=Object.create(CO);i&&(n.consumerAllowSignalWrites=!0),n.fn=t,n.schedule=e;let r=u=>{n.cleanupFn=u};function o(u){return u.fn===null&&u.schedule===null}function s(u){o(u)||(Us(u),u.cleanupFn(),u.fn=null,u.schedule=null,u.cleanupFn=rm)}let a=()=>{if(n.fn===null)return;if(gO())throw new Error("Schedulers cannot synchronously execute watches while scheduling.");if(n.dirty=!1,n.hasRun&&!yu(n))return;n.hasRun=!0;let u=js(n);try{n.cleanupFn(),n.cleanupFn=rm,n.fn(r)}finally{gu(n,u)}};return n.ref={notify:()=>O1(n),run:a,cleanup:()=>n.cleanupFn(),destroy:()=>s(n),[zn]:n},n.ref}var rm=()=>{},CO=U(M({},Zo),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!1,consumerMarkedDirty:t=>{t.schedule!==null&&t.schedule(t.ref)},hasRun:!1,cleanupFn:rm});function le(t){return typeof t=="function"}function $s(t){let i=t(n=>{Error.call(n),n.stack=new Error().stack});return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i}var hc=$s(t=>function(i){t(this),this.message=i?`${i.length} errors occurred during unsubscription: +import{$a as X,A as oc,Da as D1,E as ee,Fa as E1,H as sc,Ha as w1,O as zs,Pa as T1,Qa as ac,Sa as x1,V as Zt,Wa as sr,Xa as uc,Ya as pu,_ as ft,_a as ar,a as M,ab as I1,b as U,bb as Vn,c as ho,d as nc,e as d,eb as S1,f as Bt,g as ic,h as Bn,i as d1,j as f1,k as p1,l as h1,m as m1,n as g1,o as nn,p as y1,q as Dt,r as Nr,ra as b1,s as v1,t as Rt,u as qt,ua as _1,v as Pr,va as C1,w as Fr,x as rc}from"./chunk-7OFBBPR7.js";function sm(t,e){return Object.is(t,e)}var Vt=null,hu=!1,am=1,zn=Symbol("SIGNAL");function Ue(t){let e=Vt;return Vt=t,e}function M1(){return Vt}function gO(){return hu}var Zo={version:0,lastCleanEpoch:0,dirty:!1,producerNode:void 0,producerLastReadVersion:void 0,producerIndexOfThis:void 0,nextProducerIndex:0,liveConsumerNode:void 0,liveConsumerIndexOfThis:void 0,consumerAllowSignalWrites:!1,consumerIsAlwaysLive:!1,producerMustRecompute:()=>!1,producerRecomputeValue:()=>{},consumerMarkedDirty:()=>{},consumerOnSignalRead:()=>{}};function cc(t){if(hu)throw new Error("");if(Vt===null)return;Vt.consumerOnSignalRead(t);let e=Vt.nextProducerIndex++;if(fc(Vt),et.nextProducerIndex;)t.producerNode.pop(),t.producerLastReadVersion.pop(),t.producerIndexOfThis.pop()}}function yu(t){fc(t);for(let e=0;e0}function fc(t){t.producerNode??(t.producerNode=[]),t.producerIndexOfThis??(t.producerIndexOfThis=[]),t.producerLastReadVersion??(t.producerLastReadVersion=[])}function P1(t){t.liveConsumerNode??(t.liveConsumerNode=[]),t.liveConsumerIndexOfThis??(t.liveConsumerIndexOfThis=[])}function F1(t){return t.producerNode!==void 0}function R1(t){let e=Object.create(vO);e.computation=t;let i=()=>{if(um(e),cc(e),e.value===lc)throw e.error;return e.value};return i[zn]=e,i}var tm=Symbol("UNSET"),nm=Symbol("COMPUTING"),lc=Symbol("ERRORED"),vO=U(M({},Zo),{value:tm,dirty:!0,error:null,equal:sm,producerMustRecompute(t){return t.value===tm||t.value===nm},producerRecomputeValue(t){if(t.value===nm)throw new Error("Detected cycle in computations.");let e=t.value;t.value=nm;let i=js(t),n;try{n=t.computation()}catch(r){n=lc,t.error=r}finally{gu(t,i)}if(e!==tm&&e!==lc&&n!==lc&&t.equal(e,n)){t.value=e;return}t.value=n,t.version++}});function bO(){throw new Error}var L1=bO;function H1(){L1()}function B1(t){L1=t}var im=null;function V1(t){let e=Object.create(lm);e.value=t;let i=()=>(cc(e),e.value);return i[zn]=e,i}function pc(t,e){k1()||H1(),t.equal(t.value,e)||(t.value=e,_O(t))}function z1(t,e){k1()||H1(),pc(t,e(t.value))}var lm=U(M({},Zo),{equal:sm,value:void 0});function _O(t){t.version++,yO(),A1(t),im==null||im()}function j1(t,e,i){let n=Object.create(CO);i&&(n.consumerAllowSignalWrites=!0),n.fn=t,n.schedule=e;let r=u=>{n.cleanupFn=u};function o(u){return u.fn===null&&u.schedule===null}function s(u){o(u)||(Us(u),u.cleanupFn(),u.fn=null,u.schedule=null,u.cleanupFn=om)}let a=()=>{if(n.fn===null)return;if(gO())throw new Error("Schedulers cannot synchronously execute watches while scheduling.");if(n.dirty=!1,n.hasRun&&!yu(n))return;n.hasRun=!0;let u=js(n);try{n.cleanupFn(),n.cleanupFn=om,n.fn(r)}finally{gu(n,u)}};return n.ref={notify:()=>O1(n),run:a,cleanup:()=>n.cleanupFn(),destroy:()=>s(n),[zn]:n},n.ref}var om=()=>{},CO=U(M({},Zo),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!1,consumerMarkedDirty:t=>{t.schedule!==null&&t.schedule(t.ref)},hasRun:!1,cleanupFn:om});function le(t){return typeof t=="function"}function $s(t){let i=t(n=>{Error.call(n),n.stack=new Error().stack});return i.prototype=Object.create(Error.prototype),i.prototype.constructor=i,i}var hc=$s(t=>function(i){t(this),this.message=i?`${i.length} errors occurred during unsubscription: ${i.map((n,r)=>`${r+1}) ${n.toString()}`).join(` - `)}`:"",this.name="UnsubscriptionError",this.errors=i});function Ko(t,e){if(t){let i=t.indexOf(e);0<=i&&t.splice(i,1)}}var Ut=class t{constructor(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}unsubscribe(){let e;if(!this.closed){this.closed=!0;let{_parentage:i}=this;if(i)if(this._parentage=null,Array.isArray(i))for(let o of i)o.remove(this);else i.remove(this);let{initialTeardown:n}=this;if(le(n))try{n()}catch(o){e=o instanceof hc?o.errors:[o]}let{_finalizers:r}=this;if(r){this._finalizers=null;for(let o of r)try{U1(o)}catch(s){e=e??[],s instanceof hc?e=[...e,...s.errors]:e.push(s)}}if(e)throw new hc(e)}}add(e){var i;if(e&&e!==this)if(this.closed)U1(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(i=this._finalizers)!==null&&i!==void 0?i:[]).push(e)}}_hasParent(e){let{_parentage:i}=this;return i===e||Array.isArray(i)&&i.includes(e)}_addParent(e){let{_parentage:i}=this;this._parentage=Array.isArray(i)?(i.push(e),i):i?[i,e]:e}_removeParent(e){let{_parentage:i}=this;i===e?this._parentage=null:Array.isArray(i)&&Ko(i,e)}remove(e){let{_finalizers:i}=this;i&&Ko(i,e),e instanceof t&&e._removeParent(this)}};Ut.EMPTY=(()=>{let t=new Ut;return t.closed=!0,t})();var lm=Ut.EMPTY;function mc(t){return t instanceof Ut||t&&"closed"in t&&le(t.remove)&&le(t.add)&&le(t.unsubscribe)}function U1(t){le(t)?t():t.unsubscribe()}var Pi={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Gs={setTimeout(t,e,...i){let{delegate:n}=Gs;return n!=null&&n.setTimeout?n.setTimeout(t,e,...i):setTimeout(t,e,...i)},clearTimeout(t){let{delegate:e}=Gs;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function gc(t){Gs.setTimeout(()=>{let{onUnhandledError:e}=Pi;if(e)e(t);else throw t})}function Xn(){}var $1=cm("C",void 0,void 0);function G1(t){return cm("E",void 0,t)}function W1(t){return cm("N",t,void 0)}function cm(t,e,i){return{kind:t,value:e,error:i}}var Yo=null;function Ws(t){if(Pi.useDeprecatedSynchronousErrorHandling){let e=!Yo;if(e&&(Yo={errorThrown:!1,error:null}),t(),e){let{errorThrown:i,error:n}=Yo;if(Yo=null,i)throw n}}else t()}function q1(t){Pi.useDeprecatedSynchronousErrorHandling&&Yo&&(Yo.errorThrown=!0,Yo.error=t)}var Qo=class extends Ut{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,mc(e)&&e.add(this)):this.destination=wO}static create(e,i,n){return new Rr(e,i,n)}next(e){this.isStopped?fm(W1(e),this):this._next(e)}error(e){this.isStopped?fm(G1(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?fm($1,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},DO=Function.prototype.bind;function dm(t,e){return DO.call(t,e)}var pm=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:i}=this;if(i.next)try{i.next(e)}catch(n){yc(n)}}error(e){let{partialObserver:i}=this;if(i.error)try{i.error(e)}catch(n){yc(n)}else yc(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(i){yc(i)}}},Rr=class extends Qo{constructor(e,i,n){super();let r;if(le(e)||!e)r={next:e??void 0,error:i??void 0,complete:n??void 0};else{let o;this&&Pi.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),r={next:e.next&&dm(e.next,o),error:e.error&&dm(e.error,o),complete:e.complete&&dm(e.complete,o)}):r=e}this.destination=new pm(r)}};function yc(t){Pi.useDeprecatedSynchronousErrorHandling?q1(t):gc(t)}function EO(t){throw t}function fm(t,e){let{onStoppedNotification:i}=Pi;i&&Gs.setTimeout(()=>i(t,e))}var wO={closed:!0,next:Xn,error:EO,complete:Xn};var qs=typeof Symbol=="function"&&Symbol.observable||"@@observable";function rn(t){return t}function vu(...t){return hm(t)}function hm(t){return t.length===0?rn:t.length===1?t[0]:function(i){return t.reduce((n,r)=>r(n),i)}}var te=(()=>{class t{constructor(i){i&&(this._subscribe=i)}lift(i){let n=new t;return n.source=this,n.operator=i,n}subscribe(i,n,r){let o=xO(i)?i:new Rr(i,n,r);return Ws(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(i){try{return this._subscribe(i)}catch(n){i.error(n)}}forEach(i,n){return n=Z1(n),new n((r,o)=>{let s=new Rr({next:a=>{try{i(a)}catch(u){o(u),s.unsubscribe()}},error:o,complete:r});this.subscribe(s)})}_subscribe(i){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(i)}[qs](){return this}pipe(...i){return hm(i)(this)}toPromise(i){return i=Z1(i),new i((n,r)=>{let o;this.subscribe(s=>o=s,s=>r(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Z1(t){var e;return(e=t??Pi.Promise)!==null&&e!==void 0?e:Promise}function TO(t){return t&&le(t.next)&&le(t.error)&&le(t.complete)}function xO(t){return t&&t instanceof Qo||TO(t)&&mc(t)}function mm(t){return le(t==null?void 0:t.lift)}function se(t){return e=>{if(mm(e))return e.lift(function(i){try{return t(i,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function ie(t,e,i,n,r){return new gm(t,e,i,n,r)}var gm=class extends Qo{constructor(e,i,n,r,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=i?function(a){try{i(a)}catch(u){e.error(u)}}:super._next,this._error=r?function(a){try{r(a)}catch(u){e.error(u)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:i}=this;super.unsubscribe(),!i&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};function ym(){return se((t,e)=>{let i=null;t._refCount++;let n=ie(e,void 0,void 0,void 0,()=>{if(!t||t._refCount<=0||0<--t._refCount){i=null;return}let r=t._connection,o=i;i=null,r&&(!o||r===o)&&r.unsubscribe(),e.unsubscribe()});t.subscribe(n),n.closed||(i=t.connect())})}var vm=class extends te{constructor(e,i){super(),this.source=e,this.subjectFactory=i,this._subject=null,this._refCount=0,this._connection=null,mm(e)&&(this.lift=e.lift)}_subscribe(e){return this.getSubject().subscribe(e)}getSubject(){let e=this._subject;return(!e||e.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;let{_connection:e}=this;this._subject=this._connection=null,e==null||e.unsubscribe()}connect(){let e=this._connection;if(!e){e=this._connection=new Ut;let i=this.getSubject();e.add(this.source.subscribe(ie(i,void 0,()=>{this._teardown(),i.complete()},n=>{this._teardown(),i.error(n)},()=>this._teardown()))),e.closed&&(this._connection=null,e=Ut.EMPTY)}return e}refCount(){return ym()(this)}};var K1=$s(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var tt=(()=>{class t extends te{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(i){let n=new vc(this,this);return n.operator=i,n}_throwIfClosed(){if(this.closed)throw new K1}next(i){Ws(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(i)}})}error(i){Ws(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=i;let{observers:n}=this;for(;n.length;)n.shift().error(i)}})}complete(){Ws(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:i}=this;for(;i.length;)i.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var i;return((i=this.observers)===null||i===void 0?void 0:i.length)>0}_trySubscribe(i){return this._throwIfClosed(),super._trySubscribe(i)}_subscribe(i){return this._throwIfClosed(),this._checkFinalizedStatuses(i),this._innerSubscribe(i)}_innerSubscribe(i){let{hasError:n,isStopped:r,observers:o}=this;return n||r?lm:(this.currentObservers=null,o.push(i),new Ut(()=>{this.currentObservers=null,Ko(o,i)}))}_checkFinalizedStatuses(i){let{hasError:n,thrownError:r,isStopped:o}=this;n?i.error(r):o&&i.complete()}asObservable(){let i=new te;return i.source=this,i}}return t.create=(e,i)=>new vc(e,i),t})(),vc=class extends tt{constructor(e,i){super(),this.destination=e,this.source=i}next(e){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.next)===null||n===void 0||n.call(i,e)}error(e){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.error)===null||n===void 0||n.call(i,e)}complete(){var e,i;(i=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||i===void 0||i.call(e)}_subscribe(e){var i,n;return(n=(i=this.source)===null||i===void 0?void 0:i.subscribe(e))!==null&&n!==void 0?n:lm}};var on=class extends tt{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let i=super._subscribe(e);return!i.closed&&e.next(this._value),i}getValue(){let{hasError:e,thrownError:i,_value:n}=this;if(e)throw i;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var bu={now(){return(bu.delegate||Date).now()},delegate:void 0};var ur=class extends tt{constructor(e=1/0,i=1/0,n=bu){super(),this._bufferSize=e,this._windowTime=i,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=i===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,i)}next(e){let{isStopped:i,_buffer:n,_infiniteTimeWindow:r,_timestampProvider:o,_windowTime:s}=this;i||(n.push(e),!r&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let i=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:r}=this,o=r.slice();for(let s=0;st.complete());function Dc(t){return t&&le(t.schedule)}function _m(t){return t[t.length-1]}function Ks(t){return le(_m(t))?t.pop():void 0}function lr(t){return Dc(_m(t))?t.pop():void 0}function Y1(t,e){return typeof _m(t)=="number"?t.pop():e}function Ot(t,e,i,n){var r=arguments.length,o=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,i,o):s(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function X1(t,e,i,n){function r(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{l(n.next(c))}catch(f){s(f)}}function u(c){try{l(n.throw(c))}catch(f){s(f)}}function l(c){c.done?o(c.value):r(c.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function Q1(t){var e=typeof Symbol=="function"&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xo(t){return this instanceof Xo?(this.v=t,this):new Xo(t)}function J1(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=i.apply(t,e||[]),r,o=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),r[Symbol.asyncIterator]=function(){return this},r;function s(m){return function(g){return Promise.resolve(g).then(m,f)}}function a(m,g){n[m]&&(r[m]=function(y){return new Promise(function(b,D){o.push([m,y,b,D])>1||u(m,y)})},g&&(r[m]=g(r[m])))}function u(m,g){try{l(n[m](g))}catch(y){p(o[0][3],y)}}function l(m){m.value instanceof Xo?Promise.resolve(m.value.v).then(c,f):p(o[0][2],m)}function c(m){u("next",m)}function f(m){u("throw",m)}function p(m,g){m(g),o.shift(),o.length&&u(o[0][0],o[0][1])}}function eC(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof Q1=="function"?Q1(t):t[Symbol.iterator](),i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i);function n(o){i[o]=t[o]&&function(s){return new Promise(function(a,u){s=t[o](s),r(a,u,s.done,s.value)})}}function r(o,s,a,u){Promise.resolve(u).then(function(l){o({value:l,done:a})},s)}}var Ys=t=>t&&typeof t.length=="number"&&typeof t!="function";function Ec(t){return le(t==null?void 0:t.then)}function wc(t){return le(t[qs])}function Tc(t){return Symbol.asyncIterator&&le(t==null?void 0:t[Symbol.asyncIterator])}function xc(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function IO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ic=IO();function Sc(t){return le(t==null?void 0:t[Ic])}function Mc(t){return J1(this,arguments,function*(){let i=t.getReader();try{for(;;){let{value:n,done:r}=yield Xo(i.read());if(r)return yield Xo(void 0);yield yield Xo(n)}}finally{i.releaseLock()}})}function Ac(t){return le(t==null?void 0:t.getReader)}function Ae(t){if(t instanceof te)return t;if(t!=null){if(wc(t))return SO(t);if(Ys(t))return MO(t);if(Ec(t))return AO(t);if(Tc(t))return tC(t);if(Sc(t))return kO(t);if(Ac(t))return OO(t)}throw xc(t)}function SO(t){return new te(e=>{let i=t[qs]();if(le(i.subscribe))return i.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function MO(t){return new te(e=>{for(let i=0;i{t.then(i=>{e.closed||(e.next(i),e.complete())},i=>e.error(i)).then(null,gc)})}function kO(t){return new te(e=>{for(let i of t)if(e.next(i),e.closed)return;e.complete()})}function tC(t){return new te(e=>{NO(t,e).catch(i=>e.error(i))})}function OO(t){return tC(Mc(t))}function NO(t,e){var i,n,r,o;return X1(this,void 0,void 0,function*(){try{for(i=eC(t);n=yield i.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){r={error:s}}finally{try{n&&!n.done&&(o=i.return)&&(yield o.call(i))}finally{if(r)throw r.error}}e.complete()})}function jn(t,e,i,n=0,r=!1){let o=e.schedule(function(){i(),r?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!r)return o}function kc(t,e=0){return se((i,n)=>{i.subscribe(ie(n,r=>jn(n,t,()=>n.next(r),e),()=>jn(n,t,()=>n.complete(),e),r=>jn(n,t,()=>n.error(r),e)))})}function Oc(t,e=0){return se((i,n)=>{n.add(t.schedule(()=>i.subscribe(n),e))})}function nC(t,e){return Ae(t).pipe(Oc(e),kc(e))}function iC(t,e){return Ae(t).pipe(Oc(e),kc(e))}function rC(t,e){return new te(i=>{let n=0;return e.schedule(function(){n===t.length?i.complete():(i.next(t[n++]),i.closed||this.schedule())})})}function oC(t,e){return new te(i=>{let n;return jn(i,e,()=>{n=t[Ic](),jn(i,e,()=>{let r,o;try{({value:r,done:o}=n.next())}catch(s){i.error(s);return}o?i.complete():i.next(r)},0,!0)}),()=>le(n==null?void 0:n.return)&&n.return()})}function Nc(t,e){if(!t)throw new Error("Iterable cannot be null");return new te(i=>{jn(i,e,()=>{let n=t[Symbol.asyncIterator]();jn(i,e,()=>{n.next().then(r=>{r.done?i.complete():i.next(r.value)})},0,!0)})})}function sC(t,e){return Nc(Mc(t),e)}function aC(t,e){if(t!=null){if(wc(t))return nC(t,e);if(Ys(t))return rC(t,e);if(Ec(t))return iC(t,e);if(Tc(t))return Nc(t,e);if(Sc(t))return oC(t,e);if(Ac(t))return sC(t,e)}throw xc(t)}function yn(t,e){return e?aC(t,e):Ae(t)}function ce(...t){let e=lr(t);return yn(t,e)}function PO(t,e){let i=le(t)?t:()=>t,n=r=>r.error(i());return new te(e?r=>e.schedule(n,0,r):n)}function FO(t){return!!t&&(t instanceof te||le(t.lift)&&le(t.subscribe))}var Jo=$s(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function uC(t){return t instanceof Date&&!isNaN(t)}function S(t,e){return se((i,n)=>{let r=0;i.subscribe(ie(n,o=>{n.next(t.call(e,o,r++))}))})}var{isArray:RO}=Array;function LO(t,e){return RO(e)?t(...e):t(e)}function Qs(t){return S(e=>LO(t,e))}var{isArray:HO}=Array,{getPrototypeOf:BO,prototype:VO,keys:zO}=Object;function Pc(t){if(t.length===1){let e=t[0];if(HO(e))return{args:e,keys:null};if(jO(e)){let i=zO(e);return{args:i.map(n=>e[n]),keys:i}}}return{args:t,keys:null}}function jO(t){return t&&typeof t=="object"&&BO(t)===VO}function Fc(t,e){return t.reduce((i,n,r)=>(i[n]=e[r],i),{})}function In(...t){let e=lr(t),i=Ks(t),{args:n,keys:r}=Pc(t);if(n.length===0)return yn([],e);let o=new te(UO(n,e,r?s=>Fc(r,s):rn));return i?o.pipe(Qs(i)):o}function UO(t,e,i=rn){return n=>{lC(e,()=>{let{length:r}=t,o=new Array(r),s=r,a=r;for(let u=0;u{let l=yn(t[u],e),c=!1;l.subscribe(ie(n,f=>{o[u]=f,c||(c=!0,a--),a||n.next(i(o.slice()))},()=>{--s||n.complete()}))},n)},n)}}function lC(t,e,i){t?jn(i,t,e):e()}function cC(t,e,i,n,r,o,s,a){let u=[],l=0,c=0,f=!1,p=()=>{f&&!u.length&&!l&&e.complete()},m=y=>l{o&&e.next(y),l++;let b=!1;Ae(i(y,c++)).subscribe(ie(e,D=>{r==null||r(D),o?m(D):e.next(D)},()=>{b=!0},void 0,()=>{if(b)try{for(l--;u.length&&lg(D)):g(D)}p()}catch(D){e.error(D)}}))};return t.subscribe(ie(e,m,()=>{f=!0,p()})),()=>{a==null||a()}}function Fi(t,e,i=1/0){return le(e)?Fi((n,r)=>S((o,s)=>e(n,o,r,s))(Ae(t(n,r))),i):(typeof e=="number"&&(i=e),se((n,r)=>cC(n,r,t,i)))}function Rc(t=1/0){return Fi(rn,t)}function dC(){return Rc(1)}function Hr(...t){return dC()(yn(t,lr(t)))}function Cu(t){return new te(e=>{Ae(t()).subscribe(e)})}function Cm(...t){let e=Ks(t),{args:i,keys:n}=Pc(t),r=new te(o=>{let{length:s}=i;if(!s){o.complete();return}let a=new Array(s),u=s,l=s;for(let c=0;c{f||(f=!0,l--),a[c]=p},()=>u--,void 0,()=>{(!u||!f)&&(l||o.next(n?Fc(n,a):a),o.complete())}))}});return e?r.pipe(Qs(e)):r}var $O=["addListener","removeListener"],GO=["addEventListener","removeEventListener"],WO=["on","off"];function ct(t,e,i,n){if(le(i)&&(n=i,i=void 0),n)return ct(t,e,i).pipe(Qs(n));let[r,o]=KO(t)?GO.map(s=>a=>t[s](e,a,i)):qO(t)?$O.map(fC(t,e)):ZO(t)?WO.map(fC(t,e)):[];if(!r&&Ys(t))return Fi(s=>ct(s,e,i))(Ae(t));if(!r)throw new TypeError("Invalid event target");return new te(s=>{let a=(...u)=>s.next(1o(a)})}function fC(t,e){return i=>n=>t[i](e,n)}function qO(t){return le(t.addListener)&&le(t.removeListener)}function ZO(t){return le(t.on)&&le(t.off)}function KO(t){return le(t.addEventListener)&&le(t.removeEventListener)}function gt(t=0,e,i=bm){let n=-1;return e!=null&&(Dc(e)?i=e:n=e),new te(r=>{let o=uC(t)?+t-i.now():t;o<0&&(o=0);let s=0;return i.schedule(function(){r.closed||(r.next(s++),0<=n?this.schedule(void 0,n):r.complete())},o)})}function nt(...t){let e=lr(t),i=Y1(t,1/0),n=t;return n.length?n.length===1?Ae(n[0]):Rc(i)(yn(n,e)):sn}var Du=new te(Xn);var{isArray:YO}=Array;function pC(t){return t.length===1&&YO(t[0])?t[0]:t}function ot(t,e){return se((i,n)=>{let r=0;i.subscribe(ie(n,o=>t.call(e,o,r++)&&n.next(o)))})}function Dm(...t){return t=pC(t),t.length===1?Ae(t[0]):new te(QO(t))}function QO(t){return e=>{let i=[];for(let n=0;i&&!e.closed&&n{if(i){for(let o=0;o{let n=null,r=!1,o;n=e.subscribe(ie(i,void 0,void 0,s=>{o=Ae(t(s,Eu(t)(e))),n?(n.unsubscribe(),n=null,o.subscribe(i)):r=!0})),r&&(n.unsubscribe(),n=null,o.subscribe(i))})}function hC(t,e,i,n,r){return(o,s)=>{let a=i,u=e,l=0;o.subscribe(ie(s,c=>{let f=l++;u=a?t(u,c,f):(a=!0,c),n&&s.next(u)},r&&(()=>{a&&s.next(u),s.complete()})))}}function mC(t,e){return le(e)?Fi(t,e,1):Fi(t,1)}function Em(t){return se((e,i)=>{let n=!1,r=null,o=null,s=()=>{if(o==null||o.unsubscribe(),o=null,n){n=!1;let a=r;r=null,i.next(a)}};e.subscribe(ie(i,a=>{o==null||o.unsubscribe(),n=!0,r=a,o=ie(i,s,Xn),Ae(t(a)).subscribe(o)},()=>{s(),i.complete()},void 0,()=>{r=o=null}))})}function mo(t){return se((e,i)=>{let n=!1;e.subscribe(ie(i,r=>{n=!0,i.next(r)},()=>{n||i.next(t),i.complete()}))})}function $t(t){return t<=0?()=>sn:se((e,i)=>{let n=0;e.subscribe(ie(i,r=>{++n<=t&&(i.next(r),t<=n&&i.complete())}))})}function gC(){return se((t,e)=>{t.subscribe(ie(e,Xn))})}function wm(t){return S(()=>t)}function Tm(t,e){return e?i=>Hr(e.pipe($t(1),gC()),i.pipe(Tm(t))):Fi((i,n)=>Ae(t(i,n)).pipe($t(1),wm(i)))}function Jn(t,e=Lr){let i=gt(t,e);return Tm(()=>i)}function ke(t,e=rn){return t=t??XO,se((i,n)=>{let r,o=!0;i.subscribe(ie(n,s=>{let a=e(s);(o||!t(r,a))&&(o=!1,r=a,n.next(s))}))})}function XO(t,e){return t===e}function Lc(t=JO){return se((e,i)=>{let n=!1;e.subscribe(ie(i,r=>{n=!0,i.next(r)},()=>n?i.complete():i.error(t())))})}function JO(){return new Jo}function Hc(...t){return e=>Hr(e,ce(...t))}function wu(t){return se((e,i)=>{try{e.subscribe(i)}finally{i.add(t)}})}function e3(t,e){let i=arguments.length>=2;return n=>n.pipe(t?ot((r,o)=>t(r,o,n)):rn,$t(1),i?mo(e):Lc(()=>new Jo))}function xm(t){return t<=0?()=>sn:se((e,i)=>{let n=[];e.subscribe(ie(i,r=>{n.push(r),t{for(let r of n)i.next(r);i.complete()},void 0,()=>{n=null}))})}function t3(t,e){let i=arguments.length>=2;return n=>n.pipe(t?ot((r,o)=>t(r,o,n)):rn,xm(1),i?mo(e):Lc(()=>new Jo))}function n3(){return se((t,e)=>{let i,n=!1;t.subscribe(ie(e,r=>{let o=i;i=r,n&&e.next([o,r]),n=!0}))})}function es(t){let e=1/0,i;return t!=null&&(typeof t=="object"?{count:e=1/0,delay:i}=t:e=t),e<=0?()=>sn:se((n,r)=>{let o=0,s,a=()=>{if(s==null||s.unsubscribe(),s=null,i!=null){let l=typeof i=="number"?gt(i):Ae(i(o)),c=ie(r,()=>{c.unsubscribe(),u()});l.subscribe(c)}else u()},u=()=>{let l=!1;s=n.subscribe(ie(r,void 0,()=>{++o=2,!0))}function Ri(t={}){let{connector:e=()=>new tt,resetOnError:i=!0,resetOnComplete:n=!0,resetOnRefCountZero:r=!0}=t;return o=>{let s,a,u,l=0,c=!1,f=!1,p=()=>{a==null||a.unsubscribe(),a=void 0},m=()=>{p(),s=u=void 0,c=f=!1},g=()=>{let y=s;m(),y==null||y.unsubscribe()};return se((y,b)=>{l++,!f&&!c&&p();let D=u=u??e();b.add(()=>{l--,l===0&&!f&&!c&&(a=Im(g,r))}),D.subscribe(b),!s&&l>0&&(s=new Rr({next:I=>D.next(I),error:I=>{f=!0,p(),a=Im(m,i,I),D.error(I)},complete:()=>{c=!0,p(),a=Im(m,n),D.complete()}}),Ae(y).subscribe(s))})(o)}}function Im(t,e,...i){if(e===!0){t();return}if(e===!1)return;let n=new Rr({next:()=>{n.unsubscribe(),t()}});return Ae(e(...i)).subscribe(n)}function Li(t,e,i){let n,r=!1;return t&&typeof t=="object"?{bufferSize:n=1/0,windowTime:e=1/0,refCount:r=!1,scheduler:i}=t:n=t??1/0,Ri({connector:()=>new ur(n,e,i),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:r})}function Tu(t){return ot((e,i)=>t<=i)}function Sm(t){return se((e,i)=>{let n=!1,r=0;e.subscribe(ie(i,o=>(n||(n=!t(o,r++)))&&i.next(o)))})}function dt(...t){let e=lr(t);return se((i,n)=>{(e?Hr(t,i,e):Hr(t,i)).subscribe(n)})}function bt(t,e){return se((i,n)=>{let r=null,o=0,s=!1,a=()=>s&&!r&&n.complete();i.subscribe(ie(n,u=>{r==null||r.unsubscribe();let l=0,c=o++;Ae(t(u,c)).subscribe(r=ie(n,f=>n.next(e?e(u,f,c,l++):f),()=>{r=null,a()}))},()=>{s=!0,a()}))})}function Kt(t){return se((e,i)=>{Ae(t).subscribe(ie(i,()=>i.complete(),Xn)),!i.closed&&e.subscribe(i)})}function go(t,e=!1){return se((i,n)=>{let r=0;i.subscribe(ie(n,o=>{let s=t(o,r++);(s||e)&&n.next(o),!s&&n.complete()}))})}function ei(t,e,i){let n=le(t)||e||i?{next:t,error:e,complete:i}:t;return n?se((r,o)=>{var s;(s=n.subscribe)===null||s===void 0||s.call(n);let a=!0;r.subscribe(ie(o,u=>{var l;(l=n.next)===null||l===void 0||l.call(n,u),o.next(u)},()=>{var u;a=!1,(u=n.complete)===null||u===void 0||u.call(n),o.complete()},u=>{var l;a=!1,(l=n.error)===null||l===void 0||l.call(n,u),o.error(u)},()=>{var u,l;a&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(l=n.finalize)===null||l===void 0||l.call(n)}))}):rn}function yC(t,e){return se((i,n)=>{let{leading:r=!0,trailing:o=!1}=e??{},s=!1,a=null,u=null,l=!1,c=()=>{u==null||u.unsubscribe(),u=null,o&&(m(),l&&n.complete())},f=()=>{u=null,l&&n.complete()},p=g=>u=Ae(t(g)).subscribe(ie(n,c,f)),m=()=>{if(s){s=!1;let g=a;a=null,n.next(g),!l&&p(g)}};i.subscribe(ie(n,g=>{s=!0,a=g,!(u&&!u.closed)&&(r?m():p(g))},()=>{l=!0,!(o&&s&&u&&!u.closed)&&n.complete()}))})}function gi(t,e=Lr,i){let n=gt(t,e);return yC(()=>n,i)}function Mm(...t){let e=Ks(t);return se((i,n)=>{let r=t.length,o=new Array(r),s=t.map(()=>!1),a=!1;for(let u=0;u{o[u]=l,!a&&!s[u]&&(s[u]=!0,(a=s.every(rn))&&(s=null))},Xn));i.subscribe(ie(n,u=>{if(a){let l=[u,...o];n.next(e?e(...l):l)}}))})}var mD="https://g.co/ng/security#xss",j=class extends Error{constructor(i,n){super(Od(i,n));d(this,"code");this.code=i}};function Od(t,e){return`${`NG0${Math.abs(t)}`}${e?": "+e:""}`}var gD=Symbol("InputSignalNode#UNSET"),r3=U(M({},um),{transformFn:void 0,applyValueToInputSignal(t,e){pc(t,e)}});function yD(t,e){let i=Object.create(r3);i.value=t,i.transformFn=e==null?void 0:e.transform;function n(){if(cc(i),i.value===gD)throw new j(-950,!1);return i.value}return n[zn]=i,n}function ju(t){return{toString:t}.toString()}var Bc="__parameters__";function o3(t){return function(...i){if(t){let n=t(...i);for(let r in n)this[r]=n[r]}}}function ig(t,e,i){return ju(()=>{let n=o3(e);function r(...o){if(this instanceof r)return n.apply(this,o),this;let s=new r(...o);return a.annotation=s,a;function a(u,l,c){let f=u.hasOwnProperty(Bc)?u[Bc]:Object.defineProperty(u,Bc,{value:[]})[Bc];for(;f.length<=c;)f.push(null);return(f[c]=f[c]||[]).push(s),u}}return i&&(r.prototype=Object.create(i.prototype)),r.prototype.ngMetadataName=t,r.annotationCls=r,r})}var Mu=globalThis;function yt(t){for(let e in t)if(t[e]===yt)return e;throw Error("Could not find renamed property on target object.")}function s3(t,e){for(let i in e)e.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=e[i])}function Mn(t){if(typeof t=="string")return t;if(Array.isArray(t))return"["+t.map(Mn).join(", ")+"]";if(t==null)return""+t;if(t.overriddenName)return`${t.overriddenName}`;if(t.name)return`${t.name}`;let e=t.toString();if(e==null)return""+e;let i=e.indexOf(` -`);return i===-1?e:e.substring(0,i)}function $m(t,e){return t==null||t===""?e===null?"":e:e==null||e===""?t:t+" "+e}var a3=yt({__forward_ref__:yt});function vi(t){return t.__forward_ref__=vi,t.toString=function(){return Mn(this())},t}function un(t){return vD(t)?t():t}function vD(t){return typeof t=="function"&&t.hasOwnProperty(a3)&&t.__forward_ref__===vi}function $(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}function vn(t){return{providers:t.providers||[],imports:t.imports||[]}}function Nd(t){return vC(t,bD)||vC(t,_D)}function $ee(t){return Nd(t)!==null}function vC(t,e){return t.hasOwnProperty(e)?t[e]:null}function u3(t){let e=t&&(t[bD]||t[_D]);return e||null}function bC(t){return t&&(t.hasOwnProperty(_C)||t.hasOwnProperty(l3))?t[_C]:null}var bD=yt({\u0275prov:yt}),_C=yt({\u0275inj:yt}),_D=yt({ngInjectableDef:yt}),l3=yt({ngInjectorDef:yt}),k=class{constructor(e,i){d(this,"_desc");d(this,"ngMetadataName","InjectionToken");d(this,"\u0275prov");this._desc=e,this.\u0275prov=void 0,typeof i=="number"?this.__NG_ELEMENT_ID__=i:i!==void 0&&(this.\u0275prov=$({token:this,providedIn:i.providedIn||"root",factory:i.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function CD(t){return t&&!!t.\u0275providers}var c3=yt({\u0275cmp:yt}),d3=yt({\u0275dir:yt}),f3=yt({\u0275pipe:yt}),p3=yt({\u0275mod:yt}),Jc=yt({\u0275fac:yt}),Su=yt({__NG_ELEMENT_ID__:yt}),CC=yt({__NG_ENV_ID__:yt});function is(t){return typeof t=="string"?t:t==null?"":String(t)}function h3(t){return typeof t=="function"?t.name||t.toString():typeof t=="object"&&t!=null&&typeof t.type=="function"?t.type.name||t.type.toString():is(t)}function m3(t,e){let i=e?`. Dependency path: ${e.join(" > ")} > ${t}`:"";throw new j(-200,t)}function rg(t,e){throw new j(-201,!1)}var Be=function(t){return t[t.Default=0]="Default",t[t.Host=1]="Host",t[t.Self=2]="Self",t[t.SkipSelf=4]="SkipSelf",t[t.Optional=8]="Optional",t}(Be||{}),Gm;function DD(){return Gm}function Un(t){let e=Gm;return Gm=t,e}function ED(t,e,i){let n=Nd(t);if(n&&n.providedIn=="root")return n.value===void 0?n.value=n.factory():n.value;if(i&Be.Optional)return null;if(e!==void 0)return e;rg(t,"Injector")}var g3={},Au=g3,Wm="__NG_DI_FLAG__",ed="ngTempTokenPath",y3="ngTokenPath",v3=/\n/gm,b3="\u0275",DC="__source",na;function _3(){return na}function yo(t){let e=na;return na=t,e}function C3(t,e=Be.Default){if(na===void 0)throw new j(-203,!1);return na===null?ED(t,void 0,e):na.get(t,e&Be.Optional?null:void 0,e)}function $e(t,e=Be.Default){return(DD()||C3)(un(t),e)}function h(t,e=Be.Default){return $e(t,Pd(e))}function Pd(t){return typeof t>"u"||typeof t=="number"?t:0|(t.optional&&8)|(t.host&&1)|(t.self&&2)|(t.skipSelf&&4)}function qm(t){let e=[];for(let i=0;i{let t=new Ut;return t.closed=!0,t})();var cm=Ut.EMPTY;function mc(t){return t instanceof Ut||t&&"closed"in t&&le(t.remove)&&le(t.add)&&le(t.unsubscribe)}function U1(t){le(t)?t():t.unsubscribe()}var Pi={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Gs={setTimeout(t,e,...i){let{delegate:n}=Gs;return n!=null&&n.setTimeout?n.setTimeout(t,e,...i):setTimeout(t,e,...i)},clearTimeout(t){let{delegate:e}=Gs;return((e==null?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function gc(t){Gs.setTimeout(()=>{let{onUnhandledError:e}=Pi;if(e)e(t);else throw t})}function Xn(){}var $1=dm("C",void 0,void 0);function G1(t){return dm("E",void 0,t)}function W1(t){return dm("N",t,void 0)}function dm(t,e,i){return{kind:t,value:e,error:i}}var Yo=null;function Ws(t){if(Pi.useDeprecatedSynchronousErrorHandling){let e=!Yo;if(e&&(Yo={errorThrown:!1,error:null}),t(),e){let{errorThrown:i,error:n}=Yo;if(Yo=null,i)throw n}}else t()}function q1(t){Pi.useDeprecatedSynchronousErrorHandling&&Yo&&(Yo.errorThrown=!0,Yo.error=t)}var Qo=class extends Ut{constructor(e){super(),this.isStopped=!1,e?(this.destination=e,mc(e)&&e.add(this)):this.destination=wO}static create(e,i,n){return new Rr(e,i,n)}next(e){this.isStopped?pm(W1(e),this):this._next(e)}error(e){this.isStopped?pm(G1(e),this):(this.isStopped=!0,this._error(e))}complete(){this.isStopped?pm($1,this):(this.isStopped=!0,this._complete())}unsubscribe(){this.closed||(this.isStopped=!0,super.unsubscribe(),this.destination=null)}_next(e){this.destination.next(e)}_error(e){try{this.destination.error(e)}finally{this.unsubscribe()}}_complete(){try{this.destination.complete()}finally{this.unsubscribe()}}},DO=Function.prototype.bind;function fm(t,e){return DO.call(t,e)}var hm=class{constructor(e){this.partialObserver=e}next(e){let{partialObserver:i}=this;if(i.next)try{i.next(e)}catch(n){yc(n)}}error(e){let{partialObserver:i}=this;if(i.error)try{i.error(e)}catch(n){yc(n)}else yc(e)}complete(){let{partialObserver:e}=this;if(e.complete)try{e.complete()}catch(i){yc(i)}}},Rr=class extends Qo{constructor(e,i,n){super();let r;if(le(e)||!e)r={next:e??void 0,error:i??void 0,complete:n??void 0};else{let o;this&&Pi.useDeprecatedNextContext?(o=Object.create(e),o.unsubscribe=()=>this.unsubscribe(),r={next:e.next&&fm(e.next,o),error:e.error&&fm(e.error,o),complete:e.complete&&fm(e.complete,o)}):r=e}this.destination=new hm(r)}};function yc(t){Pi.useDeprecatedSynchronousErrorHandling?q1(t):gc(t)}function EO(t){throw t}function pm(t,e){let{onStoppedNotification:i}=Pi;i&&Gs.setTimeout(()=>i(t,e))}var wO={closed:!0,next:Xn,error:EO,complete:Xn};var qs=typeof Symbol=="function"&&Symbol.observable||"@@observable";function rn(t){return t}function vu(...t){return mm(t)}function mm(t){return t.length===0?rn:t.length===1?t[0]:function(i){return t.reduce((n,r)=>r(n),i)}}var te=(()=>{class t{constructor(i){i&&(this._subscribe=i)}lift(i){let n=new t;return n.source=this,n.operator=i,n}subscribe(i,n,r){let o=xO(i)?i:new Rr(i,n,r);return Ws(()=>{let{operator:s,source:a}=this;o.add(s?s.call(o,a):a?this._subscribe(o):this._trySubscribe(o))}),o}_trySubscribe(i){try{return this._subscribe(i)}catch(n){i.error(n)}}forEach(i,n){return n=Z1(n),new n((r,o)=>{let s=new Rr({next:a=>{try{i(a)}catch(u){o(u),s.unsubscribe()}},error:o,complete:r});this.subscribe(s)})}_subscribe(i){var n;return(n=this.source)===null||n===void 0?void 0:n.subscribe(i)}[qs](){return this}pipe(...i){return mm(i)(this)}toPromise(i){return i=Z1(i),new i((n,r)=>{let o;this.subscribe(s=>o=s,s=>r(s),()=>n(o))})}}return t.create=e=>new t(e),t})();function Z1(t){var e;return(e=t??Pi.Promise)!==null&&e!==void 0?e:Promise}function TO(t){return t&&le(t.next)&&le(t.error)&&le(t.complete)}function xO(t){return t&&t instanceof Qo||TO(t)&&mc(t)}function gm(t){return le(t==null?void 0:t.lift)}function se(t){return e=>{if(gm(e))return e.lift(function(i){try{return t(i,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function ie(t,e,i,n,r){return new ym(t,e,i,n,r)}var ym=class extends Qo{constructor(e,i,n,r,o,s){super(e),this.onFinalize=o,this.shouldUnsubscribe=s,this._next=i?function(a){try{i(a)}catch(u){e.error(u)}}:super._next,this._error=r?function(a){try{r(a)}catch(u){e.error(u)}finally{this.unsubscribe()}}:super._error,this._complete=n?function(){try{n()}catch(a){e.error(a)}finally{this.unsubscribe()}}:super._complete}unsubscribe(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){let{closed:i}=this;super.unsubscribe(),!i&&((e=this.onFinalize)===null||e===void 0||e.call(this))}}};function vm(){return se((t,e)=>{let i=null;t._refCount++;let n=ie(e,void 0,void 0,void 0,()=>{if(!t||t._refCount<=0||0<--t._refCount){i=null;return}let r=t._connection,o=i;i=null,r&&(!o||r===o)&&r.unsubscribe(),e.unsubscribe()});t.subscribe(n),n.closed||(i=t.connect())})}var bm=class extends te{constructor(e,i){super(),this.source=e,this.subjectFactory=i,this._subject=null,this._refCount=0,this._connection=null,gm(e)&&(this.lift=e.lift)}_subscribe(e){return this.getSubject().subscribe(e)}getSubject(){let e=this._subject;return(!e||e.isStopped)&&(this._subject=this.subjectFactory()),this._subject}_teardown(){this._refCount=0;let{_connection:e}=this;this._subject=this._connection=null,e==null||e.unsubscribe()}connect(){let e=this._connection;if(!e){e=this._connection=new Ut;let i=this.getSubject();e.add(this.source.subscribe(ie(i,void 0,()=>{this._teardown(),i.complete()},n=>{this._teardown(),i.error(n)},()=>this._teardown()))),e.closed&&(this._connection=null,e=Ut.EMPTY)}return e}refCount(){return vm()(this)}};var K1=$s(t=>function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"});var tt=(()=>{class t extends te{constructor(){super(),this.closed=!1,this.currentObservers=null,this.observers=[],this.isStopped=!1,this.hasError=!1,this.thrownError=null}lift(i){let n=new vc(this,this);return n.operator=i,n}_throwIfClosed(){if(this.closed)throw new K1}next(i){Ws(()=>{if(this._throwIfClosed(),!this.isStopped){this.currentObservers||(this.currentObservers=Array.from(this.observers));for(let n of this.currentObservers)n.next(i)}})}error(i){Ws(()=>{if(this._throwIfClosed(),!this.isStopped){this.hasError=this.isStopped=!0,this.thrownError=i;let{observers:n}=this;for(;n.length;)n.shift().error(i)}})}complete(){Ws(()=>{if(this._throwIfClosed(),!this.isStopped){this.isStopped=!0;let{observers:i}=this;for(;i.length;)i.shift().complete()}})}unsubscribe(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null}get observed(){var i;return((i=this.observers)===null||i===void 0?void 0:i.length)>0}_trySubscribe(i){return this._throwIfClosed(),super._trySubscribe(i)}_subscribe(i){return this._throwIfClosed(),this._checkFinalizedStatuses(i),this._innerSubscribe(i)}_innerSubscribe(i){let{hasError:n,isStopped:r,observers:o}=this;return n||r?cm:(this.currentObservers=null,o.push(i),new Ut(()=>{this.currentObservers=null,Ko(o,i)}))}_checkFinalizedStatuses(i){let{hasError:n,thrownError:r,isStopped:o}=this;n?i.error(r):o&&i.complete()}asObservable(){let i=new te;return i.source=this,i}}return t.create=(e,i)=>new vc(e,i),t})(),vc=class extends tt{constructor(e,i){super(),this.destination=e,this.source=i}next(e){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.next)===null||n===void 0||n.call(i,e)}error(e){var i,n;(n=(i=this.destination)===null||i===void 0?void 0:i.error)===null||n===void 0||n.call(i,e)}complete(){var e,i;(i=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||i===void 0||i.call(e)}_subscribe(e){var i,n;return(n=(i=this.source)===null||i===void 0?void 0:i.subscribe(e))!==null&&n!==void 0?n:cm}};var on=class extends tt{constructor(e){super(),this._value=e}get value(){return this.getValue()}_subscribe(e){let i=super._subscribe(e);return!i.closed&&e.next(this._value),i}getValue(){let{hasError:e,thrownError:i,_value:n}=this;if(e)throw i;return this._throwIfClosed(),n}next(e){super.next(this._value=e)}};var bu={now(){return(bu.delegate||Date).now()},delegate:void 0};var ur=class extends tt{constructor(e=1/0,i=1/0,n=bu){super(),this._bufferSize=e,this._windowTime=i,this._timestampProvider=n,this._buffer=[],this._infiniteTimeWindow=!0,this._infiniteTimeWindow=i===1/0,this._bufferSize=Math.max(1,e),this._windowTime=Math.max(1,i)}next(e){let{isStopped:i,_buffer:n,_infiniteTimeWindow:r,_timestampProvider:o,_windowTime:s}=this;i||(n.push(e),!r&&n.push(o.now()+s)),this._trimBuffer(),super.next(e)}_subscribe(e){this._throwIfClosed(),this._trimBuffer();let i=this._innerSubscribe(e),{_infiniteTimeWindow:n,_buffer:r}=this,o=r.slice();for(let s=0;st.complete());function Dc(t){return t&&le(t.schedule)}function Cm(t){return t[t.length-1]}function Ks(t){return le(Cm(t))?t.pop():void 0}function lr(t){return Dc(Cm(t))?t.pop():void 0}function Y1(t,e){return typeof Cm(t)=="number"?t.pop():e}function Ot(t,e,i,n){var r=arguments.length,o=r<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,i):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,i,n);else for(var a=t.length-1;a>=0;a--)(s=t[a])&&(o=(r<3?s(o):r>3?s(e,i,o):s(e,i))||o);return r>3&&o&&Object.defineProperty(e,i,o),o}function X1(t,e,i,n){function r(o){return o instanceof i?o:new i(function(s){s(o)})}return new(i||(i=Promise))(function(o,s){function a(c){try{l(n.next(c))}catch(f){s(f)}}function u(c){try{l(n.throw(c))}catch(f){s(f)}}function l(c){c.done?o(c.value):r(c.value).then(a,u)}l((n=n.apply(t,e||[])).next())})}function Q1(t){var e=typeof Symbol=="function"&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Xo(t){return this instanceof Xo?(this.v=t,this):new Xo(t)}function J1(t,e,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=i.apply(t,e||[]),r,o=[];return r=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),r[Symbol.asyncIterator]=function(){return this},r;function s(m){return function(g){return Promise.resolve(g).then(m,f)}}function a(m,g){n[m]&&(r[m]=function(y){return new Promise(function(b,D){o.push([m,y,b,D])>1||u(m,y)})},g&&(r[m]=g(r[m])))}function u(m,g){try{l(n[m](g))}catch(y){p(o[0][3],y)}}function l(m){m.value instanceof Xo?Promise.resolve(m.value.v).then(c,f):p(o[0][2],m)}function c(m){u("next",m)}function f(m){u("throw",m)}function p(m,g){m(g),o.shift(),o.length&&u(o[0][0],o[0][1])}}function eC(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],i;return e?e.call(t):(t=typeof Q1=="function"?Q1(t):t[Symbol.iterator](),i={},n("next"),n("throw"),n("return"),i[Symbol.asyncIterator]=function(){return this},i);function n(o){i[o]=t[o]&&function(s){return new Promise(function(a,u){s=t[o](s),r(a,u,s.done,s.value)})}}function r(o,s,a,u){Promise.resolve(u).then(function(l){o({value:l,done:a})},s)}}var Ys=t=>t&&typeof t.length=="number"&&typeof t!="function";function Ec(t){return le(t==null?void 0:t.then)}function wc(t){return le(t[qs])}function Tc(t){return Symbol.asyncIterator&&le(t==null?void 0:t[Symbol.asyncIterator])}function xc(t){return new TypeError(`You provided ${t!==null&&typeof t=="object"?"an invalid object":`'${t}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`)}function IO(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ic=IO();function Sc(t){return le(t==null?void 0:t[Ic])}function Mc(t){return J1(this,arguments,function*(){let i=t.getReader();try{for(;;){let{value:n,done:r}=yield Xo(i.read());if(r)return yield Xo(void 0);yield yield Xo(n)}}finally{i.releaseLock()}})}function Ac(t){return le(t==null?void 0:t.getReader)}function Ae(t){if(t instanceof te)return t;if(t!=null){if(wc(t))return SO(t);if(Ys(t))return MO(t);if(Ec(t))return AO(t);if(Tc(t))return tC(t);if(Sc(t))return kO(t);if(Ac(t))return OO(t)}throw xc(t)}function SO(t){return new te(e=>{let i=t[qs]();if(le(i.subscribe))return i.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function MO(t){return new te(e=>{for(let i=0;i{t.then(i=>{e.closed||(e.next(i),e.complete())},i=>e.error(i)).then(null,gc)})}function kO(t){return new te(e=>{for(let i of t)if(e.next(i),e.closed)return;e.complete()})}function tC(t){return new te(e=>{NO(t,e).catch(i=>e.error(i))})}function OO(t){return tC(Mc(t))}function NO(t,e){var i,n,r,o;return X1(this,void 0,void 0,function*(){try{for(i=eC(t);n=yield i.next(),!n.done;){let s=n.value;if(e.next(s),e.closed)return}}catch(s){r={error:s}}finally{try{n&&!n.done&&(o=i.return)&&(yield o.call(i))}finally{if(r)throw r.error}}e.complete()})}function jn(t,e,i,n=0,r=!1){let o=e.schedule(function(){i(),r?t.add(this.schedule(null,n)):this.unsubscribe()},n);if(t.add(o),!r)return o}function kc(t,e=0){return se((i,n)=>{i.subscribe(ie(n,r=>jn(n,t,()=>n.next(r),e),()=>jn(n,t,()=>n.complete(),e),r=>jn(n,t,()=>n.error(r),e)))})}function Oc(t,e=0){return se((i,n)=>{n.add(t.schedule(()=>i.subscribe(n),e))})}function nC(t,e){return Ae(t).pipe(Oc(e),kc(e))}function iC(t,e){return Ae(t).pipe(Oc(e),kc(e))}function rC(t,e){return new te(i=>{let n=0;return e.schedule(function(){n===t.length?i.complete():(i.next(t[n++]),i.closed||this.schedule())})})}function oC(t,e){return new te(i=>{let n;return jn(i,e,()=>{n=t[Ic](),jn(i,e,()=>{let r,o;try{({value:r,done:o}=n.next())}catch(s){i.error(s);return}o?i.complete():i.next(r)},0,!0)}),()=>le(n==null?void 0:n.return)&&n.return()})}function Nc(t,e){if(!t)throw new Error("Iterable cannot be null");return new te(i=>{jn(i,e,()=>{let n=t[Symbol.asyncIterator]();jn(i,e,()=>{n.next().then(r=>{r.done?i.complete():i.next(r.value)})},0,!0)})})}function sC(t,e){return Nc(Mc(t),e)}function aC(t,e){if(t!=null){if(wc(t))return nC(t,e);if(Ys(t))return rC(t,e);if(Ec(t))return iC(t,e);if(Tc(t))return Nc(t,e);if(Sc(t))return oC(t,e);if(Ac(t))return sC(t,e)}throw xc(t)}function yn(t,e){return e?aC(t,e):Ae(t)}function ce(...t){let e=lr(t);return yn(t,e)}function PO(t,e){let i=le(t)?t:()=>t,n=r=>r.error(i());return new te(e?r=>e.schedule(n,0,r):n)}function FO(t){return!!t&&(t instanceof te||le(t.lift)&&le(t.subscribe))}var Jo=$s(t=>function(){t(this),this.name="EmptyError",this.message="no elements in sequence"});function uC(t){return t instanceof Date&&!isNaN(t)}function S(t,e){return se((i,n)=>{let r=0;i.subscribe(ie(n,o=>{n.next(t.call(e,o,r++))}))})}var{isArray:RO}=Array;function LO(t,e){return RO(e)?t(...e):t(e)}function Qs(t){return S(e=>LO(t,e))}var{isArray:HO}=Array,{getPrototypeOf:BO,prototype:VO,keys:zO}=Object;function Pc(t){if(t.length===1){let e=t[0];if(HO(e))return{args:e,keys:null};if(jO(e)){let i=zO(e);return{args:i.map(n=>e[n]),keys:i}}}return{args:t,keys:null}}function jO(t){return t&&typeof t=="object"&&BO(t)===VO}function Fc(t,e){return t.reduce((i,n,r)=>(i[n]=e[r],i),{})}function In(...t){let e=lr(t),i=Ks(t),{args:n,keys:r}=Pc(t);if(n.length===0)return yn([],e);let o=new te(UO(n,e,r?s=>Fc(r,s):rn));return i?o.pipe(Qs(i)):o}function UO(t,e,i=rn){return n=>{lC(e,()=>{let{length:r}=t,o=new Array(r),s=r,a=r;for(let u=0;u{let l=yn(t[u],e),c=!1;l.subscribe(ie(n,f=>{o[u]=f,c||(c=!0,a--),a||n.next(i(o.slice()))},()=>{--s||n.complete()}))},n)},n)}}function lC(t,e,i){t?jn(i,t,e):e()}function cC(t,e,i,n,r,o,s,a){let u=[],l=0,c=0,f=!1,p=()=>{f&&!u.length&&!l&&e.complete()},m=y=>l{o&&e.next(y),l++;let b=!1;Ae(i(y,c++)).subscribe(ie(e,D=>{r==null||r(D),o?m(D):e.next(D)},()=>{b=!0},void 0,()=>{if(b)try{for(l--;u.length&&lg(D)):g(D)}p()}catch(D){e.error(D)}}))};return t.subscribe(ie(e,m,()=>{f=!0,p()})),()=>{a==null||a()}}function Fi(t,e,i=1/0){return le(e)?Fi((n,r)=>S((o,s)=>e(n,o,r,s))(Ae(t(n,r))),i):(typeof e=="number"&&(i=e),se((n,r)=>cC(n,r,t,i)))}function Rc(t=1/0){return Fi(rn,t)}function dC(){return Rc(1)}function Hr(...t){return dC()(yn(t,lr(t)))}function Cu(t){return new te(e=>{Ae(t()).subscribe(e)})}function Dm(...t){let e=Ks(t),{args:i,keys:n}=Pc(t),r=new te(o=>{let{length:s}=i;if(!s){o.complete();return}let a=new Array(s),u=s,l=s;for(let c=0;c{f||(f=!0,l--),a[c]=p},()=>u--,void 0,()=>{(!u||!f)&&(l||o.next(n?Fc(n,a):a),o.complete())}))}});return e?r.pipe(Qs(e)):r}var $O=["addListener","removeListener"],GO=["addEventListener","removeEventListener"],WO=["on","off"];function ct(t,e,i,n){if(le(i)&&(n=i,i=void 0),n)return ct(t,e,i).pipe(Qs(n));let[r,o]=KO(t)?GO.map(s=>a=>t[s](e,a,i)):qO(t)?$O.map(fC(t,e)):ZO(t)?WO.map(fC(t,e)):[];if(!r&&Ys(t))return Fi(s=>ct(s,e,i))(Ae(t));if(!r)throw new TypeError("Invalid event target");return new te(s=>{let a=(...u)=>s.next(1o(a)})}function fC(t,e){return i=>n=>t[i](e,n)}function qO(t){return le(t.addListener)&&le(t.removeListener)}function ZO(t){return le(t.on)&&le(t.off)}function KO(t){return le(t.addEventListener)&&le(t.removeEventListener)}function gt(t=0,e,i=_m){let n=-1;return e!=null&&(Dc(e)?i=e:n=e),new te(r=>{let o=uC(t)?+t-i.now():t;o<0&&(o=0);let s=0;return i.schedule(function(){r.closed||(r.next(s++),0<=n?this.schedule(void 0,n):r.complete())},o)})}function nt(...t){let e=lr(t),i=Y1(t,1/0),n=t;return n.length?n.length===1?Ae(n[0]):Rc(i)(yn(n,e)):sn}var Du=new te(Xn);var{isArray:YO}=Array;function pC(t){return t.length===1&&YO(t[0])?t[0]:t}function ot(t,e){return se((i,n)=>{let r=0;i.subscribe(ie(n,o=>t.call(e,o,r++)&&n.next(o)))})}function Em(...t){return t=pC(t),t.length===1?Ae(t[0]):new te(QO(t))}function QO(t){return e=>{let i=[];for(let n=0;i&&!e.closed&&n{if(i){for(let o=0;o{let n=null,r=!1,o;n=e.subscribe(ie(i,void 0,void 0,s=>{o=Ae(t(s,Eu(t)(e))),n?(n.unsubscribe(),n=null,o.subscribe(i)):r=!0})),r&&(n.unsubscribe(),n=null,o.subscribe(i))})}function hC(t,e,i,n,r){return(o,s)=>{let a=i,u=e,l=0;o.subscribe(ie(s,c=>{let f=l++;u=a?t(u,c,f):(a=!0,c),n&&s.next(u)},r&&(()=>{a&&s.next(u),s.complete()})))}}function mC(t,e){return le(e)?Fi(t,e,1):Fi(t,1)}function wm(t){return se((e,i)=>{let n=!1,r=null,o=null,s=()=>{if(o==null||o.unsubscribe(),o=null,n){n=!1;let a=r;r=null,i.next(a)}};e.subscribe(ie(i,a=>{o==null||o.unsubscribe(),n=!0,r=a,o=ie(i,s,Xn),Ae(t(a)).subscribe(o)},()=>{s(),i.complete()},void 0,()=>{r=o=null}))})}function mo(t){return se((e,i)=>{let n=!1;e.subscribe(ie(i,r=>{n=!0,i.next(r)},()=>{n||i.next(t),i.complete()}))})}function $t(t){return t<=0?()=>sn:se((e,i)=>{let n=0;e.subscribe(ie(i,r=>{++n<=t&&(i.next(r),t<=n&&i.complete())}))})}function gC(){return se((t,e)=>{t.subscribe(ie(e,Xn))})}function Tm(t){return S(()=>t)}function xm(t,e){return e?i=>Hr(e.pipe($t(1),gC()),i.pipe(xm(t))):Fi((i,n)=>Ae(t(i,n)).pipe($t(1),Tm(i)))}function Jn(t,e=Lr){let i=gt(t,e);return xm(()=>i)}function ke(t,e=rn){return t=t??XO,se((i,n)=>{let r,o=!0;i.subscribe(ie(n,s=>{let a=e(s);(o||!t(r,a))&&(o=!1,r=a,n.next(s))}))})}function XO(t,e){return t===e}function Lc(t=JO){return se((e,i)=>{let n=!1;e.subscribe(ie(i,r=>{n=!0,i.next(r)},()=>n?i.complete():i.error(t())))})}function JO(){return new Jo}function Hc(...t){return e=>Hr(e,ce(...t))}function wu(t){return se((e,i)=>{try{e.subscribe(i)}finally{i.add(t)}})}function e3(t,e){let i=arguments.length>=2;return n=>n.pipe(t?ot((r,o)=>t(r,o,n)):rn,$t(1),i?mo(e):Lc(()=>new Jo))}function Im(t){return t<=0?()=>sn:se((e,i)=>{let n=[];e.subscribe(ie(i,r=>{n.push(r),t{for(let r of n)i.next(r);i.complete()},void 0,()=>{n=null}))})}function t3(t,e){let i=arguments.length>=2;return n=>n.pipe(t?ot((r,o)=>t(r,o,n)):rn,Im(1),i?mo(e):Lc(()=>new Jo))}function n3(){return se((t,e)=>{let i,n=!1;t.subscribe(ie(e,r=>{let o=i;i=r,n&&e.next([o,r]),n=!0}))})}function es(t){let e=1/0,i;return t!=null&&(typeof t=="object"?{count:e=1/0,delay:i}=t:e=t),e<=0?()=>sn:se((n,r)=>{let o=0,s,a=()=>{if(s==null||s.unsubscribe(),s=null,i!=null){let l=typeof i=="number"?gt(i):Ae(i(o)),c=ie(r,()=>{c.unsubscribe(),u()});l.subscribe(c)}else u()},u=()=>{let l=!1;s=n.subscribe(ie(r,void 0,()=>{++o=2,!0))}function Ri(t={}){let{connector:e=()=>new tt,resetOnError:i=!0,resetOnComplete:n=!0,resetOnRefCountZero:r=!0}=t;return o=>{let s,a,u,l=0,c=!1,f=!1,p=()=>{a==null||a.unsubscribe(),a=void 0},m=()=>{p(),s=u=void 0,c=f=!1},g=()=>{let y=s;m(),y==null||y.unsubscribe()};return se((y,b)=>{l++,!f&&!c&&p();let D=u=u??e();b.add(()=>{l--,l===0&&!f&&!c&&(a=Sm(g,r))}),D.subscribe(b),!s&&l>0&&(s=new Rr({next:I=>D.next(I),error:I=>{f=!0,p(),a=Sm(m,i,I),D.error(I)},complete:()=>{c=!0,p(),a=Sm(m,n),D.complete()}}),Ae(y).subscribe(s))})(o)}}function Sm(t,e,...i){if(e===!0){t();return}if(e===!1)return;let n=new Rr({next:()=>{n.unsubscribe(),t()}});return Ae(e(...i)).subscribe(n)}function Li(t,e,i){let n,r=!1;return t&&typeof t=="object"?{bufferSize:n=1/0,windowTime:e=1/0,refCount:r=!1,scheduler:i}=t:n=t??1/0,Ri({connector:()=>new ur(n,e,i),resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:r})}function Tu(t){return ot((e,i)=>t<=i)}function Mm(t){return se((e,i)=>{let n=!1,r=0;e.subscribe(ie(i,o=>(n||(n=!t(o,r++)))&&i.next(o)))})}function dt(...t){let e=lr(t);return se((i,n)=>{(e?Hr(t,i,e):Hr(t,i)).subscribe(n)})}function bt(t,e){return se((i,n)=>{let r=null,o=0,s=!1,a=()=>s&&!r&&n.complete();i.subscribe(ie(n,u=>{r==null||r.unsubscribe();let l=0,c=o++;Ae(t(u,c)).subscribe(r=ie(n,f=>n.next(e?e(u,f,c,l++):f),()=>{r=null,a()}))},()=>{s=!0,a()}))})}function Kt(t){return se((e,i)=>{Ae(t).subscribe(ie(i,()=>i.complete(),Xn)),!i.closed&&e.subscribe(i)})}function go(t,e=!1){return se((i,n)=>{let r=0;i.subscribe(ie(n,o=>{let s=t(o,r++);(s||e)&&n.next(o),!s&&n.complete()}))})}function ei(t,e,i){let n=le(t)||e||i?{next:t,error:e,complete:i}:t;return n?se((r,o)=>{var s;(s=n.subscribe)===null||s===void 0||s.call(n);let a=!0;r.subscribe(ie(o,u=>{var l;(l=n.next)===null||l===void 0||l.call(n,u),o.next(u)},()=>{var u;a=!1,(u=n.complete)===null||u===void 0||u.call(n),o.complete()},u=>{var l;a=!1,(l=n.error)===null||l===void 0||l.call(n,u),o.error(u)},()=>{var u,l;a&&((u=n.unsubscribe)===null||u===void 0||u.call(n)),(l=n.finalize)===null||l===void 0||l.call(n)}))}):rn}function yC(t,e){return se((i,n)=>{let{leading:r=!0,trailing:o=!1}=e??{},s=!1,a=null,u=null,l=!1,c=()=>{u==null||u.unsubscribe(),u=null,o&&(m(),l&&n.complete())},f=()=>{u=null,l&&n.complete()},p=g=>u=Ae(t(g)).subscribe(ie(n,c,f)),m=()=>{if(s){s=!1;let g=a;a=null,n.next(g),!l&&p(g)}};i.subscribe(ie(n,g=>{s=!0,a=g,!(u&&!u.closed)&&(r?m():p(g))},()=>{l=!0,!(o&&s&&u&&!u.closed)&&n.complete()}))})}function gi(t,e=Lr,i){let n=gt(t,e);return yC(()=>n,i)}function Am(...t){let e=Ks(t);return se((i,n)=>{let r=t.length,o=new Array(r),s=t.map(()=>!1),a=!1;for(let u=0;u{o[u]=l,!a&&!s[u]&&(s[u]=!0,(a=s.every(rn))&&(s=null))},Xn));i.subscribe(ie(n,u=>{if(a){let l=[u,...o];n.next(e?e(...l):l)}}))})}var mD="https://g.co/ng/security#xss",j=class extends Error{constructor(i,n){super(Od(i,n));d(this,"code");this.code=i}};function Od(t,e){return`${`NG0${Math.abs(t)}`}${e?": "+e:""}`}var gD=Symbol("InputSignalNode#UNSET"),r3=U(M({},lm),{transformFn:void 0,applyValueToInputSignal(t,e){pc(t,e)}});function yD(t,e){let i=Object.create(r3);i.value=t,i.transformFn=e==null?void 0:e.transform;function n(){if(cc(i),i.value===gD)throw new j(-950,!1);return i.value}return n[zn]=i,n}function ju(t){return{toString:t}.toString()}var Bc="__parameters__";function o3(t){return function(...i){if(t){let n=t(...i);for(let r in n)this[r]=n[r]}}}function rg(t,e,i){return ju(()=>{let n=o3(e);function r(...o){if(this instanceof r)return n.apply(this,o),this;let s=new r(...o);return a.annotation=s,a;function a(u,l,c){let f=u.hasOwnProperty(Bc)?u[Bc]:Object.defineProperty(u,Bc,{value:[]})[Bc];for(;f.length<=c;)f.push(null);return(f[c]=f[c]||[]).push(s),u}}return i&&(r.prototype=Object.create(i.prototype)),r.prototype.ngMetadataName=t,r.annotationCls=r,r})}var Mu=globalThis;function yt(t){for(let e in t)if(t[e]===yt)return e;throw Error("Could not find renamed property on target object.")}function s3(t,e){for(let i in e)e.hasOwnProperty(i)&&!t.hasOwnProperty(i)&&(t[i]=e[i])}function Mn(t){if(typeof t=="string")return t;if(Array.isArray(t))return"["+t.map(Mn).join(", ")+"]";if(t==null)return""+t;if(t.overriddenName)return`${t.overriddenName}`;if(t.name)return`${t.name}`;let e=t.toString();if(e==null)return""+e;let i=e.indexOf(` +`);return i===-1?e:e.substring(0,i)}function Gm(t,e){return t==null||t===""?e===null?"":e:e==null||e===""?t:t+" "+e}var a3=yt({__forward_ref__:yt});function vi(t){return t.__forward_ref__=vi,t.toString=function(){return Mn(this())},t}function un(t){return vD(t)?t():t}function vD(t){return typeof t=="function"&&t.hasOwnProperty(a3)&&t.__forward_ref__===vi}function $(t){return{token:t.token,providedIn:t.providedIn||null,factory:t.factory,value:void 0}}function vn(t){return{providers:t.providers||[],imports:t.imports||[]}}function Nd(t){return vC(t,bD)||vC(t,_D)}function $ee(t){return Nd(t)!==null}function vC(t,e){return t.hasOwnProperty(e)?t[e]:null}function u3(t){let e=t&&(t[bD]||t[_D]);return e||null}function bC(t){return t&&(t.hasOwnProperty(_C)||t.hasOwnProperty(l3))?t[_C]:null}var bD=yt({\u0275prov:yt}),_C=yt({\u0275inj:yt}),_D=yt({ngInjectableDef:yt}),l3=yt({ngInjectorDef:yt}),k=class{constructor(e,i){d(this,"_desc");d(this,"ngMetadataName","InjectionToken");d(this,"\u0275prov");this._desc=e,this.\u0275prov=void 0,typeof i=="number"?this.__NG_ELEMENT_ID__=i:i!==void 0&&(this.\u0275prov=$({token:this,providedIn:i.providedIn||"root",factory:i.factory}))}get multi(){return this}toString(){return`InjectionToken ${this._desc}`}};function CD(t){return t&&!!t.\u0275providers}var c3=yt({\u0275cmp:yt}),d3=yt({\u0275dir:yt}),f3=yt({\u0275pipe:yt}),p3=yt({\u0275mod:yt}),Jc=yt({\u0275fac:yt}),Su=yt({__NG_ELEMENT_ID__:yt}),CC=yt({__NG_ENV_ID__:yt});function is(t){return typeof t=="string"?t:t==null?"":String(t)}function h3(t){return typeof t=="function"?t.name||t.toString():typeof t=="object"&&t!=null&&typeof t.type=="function"?t.type.name||t.type.toString():is(t)}function m3(t,e){let i=e?`. Dependency path: ${e.join(" > ")} > ${t}`:"";throw new j(-200,t)}function og(t,e){throw new j(-201,!1)}var Be=function(t){return t[t.Default=0]="Default",t[t.Host=1]="Host",t[t.Self=2]="Self",t[t.SkipSelf=4]="SkipSelf",t[t.Optional=8]="Optional",t}(Be||{}),Wm;function DD(){return Wm}function Un(t){let e=Wm;return Wm=t,e}function ED(t,e,i){let n=Nd(t);if(n&&n.providedIn=="root")return n.value===void 0?n.value=n.factory():n.value;if(i&Be.Optional)return null;if(e!==void 0)return e;og(t,"Injector")}var g3={},Au=g3,qm="__NG_DI_FLAG__",ed="ngTempTokenPath",y3="ngTokenPath",v3=/\n/gm,b3="\u0275",DC="__source",na;function _3(){return na}function yo(t){let e=na;return na=t,e}function C3(t,e=Be.Default){if(na===void 0)throw new j(-203,!1);return na===null?ED(t,void 0,e):na.get(t,e&Be.Optional?null:void 0,e)}function $e(t,e=Be.Default){return(DD()||C3)(un(t),e)}function h(t,e=Be.Default){return $e(t,Pd(e))}function Pd(t){return typeof t>"u"||typeof t=="number"?t:0|(t.optional&&8)|(t.host&&1)|(t.self&&2)|(t.skipSelf&&4)}function Zm(t){let e=[];for(let i=0;i ");else if(typeof e=="object"){let o=[];for(let s in e)if(e.hasOwnProperty(s)){let a=e[s];o.push(s+":"+(typeof a=="string"?JSON.stringify(a):Mn(a)))}r=`{${o.join(", ")}}`}return`${i}${n?"("+n+")":""}[${r}]: ${t.replace(v3,` - `)}`}var qn=og(ig("Optional"),8),Uu=og(ig("Self"),2),qr=og(ig("SkipSelf"),4);function rs(t,e){let i=t.hasOwnProperty(Jc);return i?t[Jc]:null}function T3(t,e,i){if(t.length!==e.length)return!1;for(let n=0;nArray.isArray(i)?sg(i,e):e(i))}function wD(t,e,i){e>=t.length?t.push(i):t.splice(e,0,i)}function td(t,e){return e>=t.length-1?t.pop():t.splice(e,1)[0]}function I3(t,e){let i=[];for(let n=0;ne;){let o=r-2;t[r]=t[o],r--}t[e]=i,t[e+1]=n}}function TD(t,e,i){let n=$u(t,e);return n>=0?t[n|1]=i:(n=~n,S3(t,n,e,i)),n}function Am(t,e){let i=$u(t,e);if(i>=0)return t[i|1]}function $u(t,e){return M3(t,e,1)}function M3(t,e,i){let n=0,r=t.length>>i;for(;r!==n;){let o=n+(r-n>>1),s=t[o<e?r=o:n=o+1}return~(r<{i.push(s)};return sg(e,s=>{let a=s;Zm(a,o,[],n)&&(r||(r=[]),r.push(a))}),r!==void 0&&AD(r,o),i}function AD(t,e){for(let i=0;i{e(o,n)})}}function Zm(t,e,i,n){if(t=un(t),!t)return!1;let r=null,o=bC(t),s=!o&&bo(t);if(!o&&!s){let u=t.ngModule;if(o=bC(u),o)r=u;else return!1}else{if(s&&!s.standalone)return!1;r=t}let a=n.has(r);if(s){if(a)return!1;if(n.add(r),s.dependencies){let u=typeof s.dependencies=="function"?s.dependencies():s.dependencies;for(let l of u)Zm(l,e,i,n)}}else if(o){if(o.imports!=null&&!a){n.add(r);let l;try{sg(o.imports,c=>{Zm(c,e,i,n)&&(l||(l=[]),l.push(c))})}finally{}l!==void 0&&AD(l,e)}if(!a){let l=rs(r)||(()=>new r);e({provide:r,useFactory:l,deps:$n},r),e({provide:xD,useValue:r,multi:!0},r),e({provide:sa,useValue:()=>$e(r),multi:!0},r)}let u=o.providers;if(u!=null&&!a){let l=t;ug(u,c=>{e(c,l)})}}else return!1;return r!==t&&t.providers!==void 0}function ug(t,e){for(let i of t)CD(i)&&(i=i.\u0275providers),Array.isArray(i)?ug(i,e):e(i)}var O3=yt({provide:String,useValue:yt});function kD(t){return t!==null&&typeof t=="object"&&O3 in t}function N3(t){return!!(t&&t.useExisting)}function P3(t){return!!(t&&t.useFactory)}function aa(t){return typeof t=="function"}function F3(t){return!!t.useClass}var Fd=new k(""),qc={},R3={},km;function Rd(){return km===void 0&&(km=new nd),km}var fr=class{},ku=class extends fr{constructor(i,n,r,o){super();d(this,"parent");d(this,"source");d(this,"scopes");d(this,"records",new Map);d(this,"_ngOnDestroyHooks",new Set);d(this,"_onDestroyHooks",[]);d(this,"_destroyed",!1);d(this,"injectorDefTypes");this.parent=n,this.source=r,this.scopes=o,Ym(i,a=>this.processProvider(a)),this.records.set(gr,Xs(void 0,this)),o.has("environment")&&this.records.set(fr,Xs(void 0,this));let s=this.records.get(Fd);s!=null&&typeof s.value=="string"&&this.scopes.add(s.value),this.injectorDefTypes=new Set(this.get(xD,$n,Be.Self))}get destroyed(){return this._destroyed}destroy(){xu(this),this._destroyed=!0;let i=Ue(null);try{for(let r of this._ngOnDestroyHooks)r.ngOnDestroy();let n=this._onDestroyHooks;this._onDestroyHooks=[];for(let r of n)r()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),Ue(i)}}onDestroy(i){return xu(this),this._onDestroyHooks.push(i),()=>this.removeOnDestroy(i)}runInContext(i){xu(this);let n=yo(this),r=Un(void 0),o;try{return i()}finally{yo(n),Un(r)}}get(i,n=Au,r=Be.Default){if(xu(this),i.hasOwnProperty(CC))return i[CC](this);r=Pd(r);let o,s=yo(this),a=Un(void 0);try{if(!(r&Be.SkipSelf)){let l=this.records.get(i);if(l===void 0){let c=z3(i)&&Nd(i);c&&this.injectableDefInScope(c)?l=Xs(Km(i),qc):l=null,this.records.set(i,l)}if(l!=null)return this.hydrate(i,l)}let u=r&Be.Self?Rd():this.parent;return n=r&Be.Optional&&n===Au?null:n,u.get(i,n)}catch(u){if(u.name==="NullInjectorError"){if((u[ed]=u[ed]||[]).unshift(Mn(i)),s)throw u;return E3(u,i,"R3InjectorError",this.source)}else throw u}finally{Un(a),yo(s)}}resolveInjectorInitializers(){let i=Ue(null),n=yo(this),r=Un(void 0),o;try{let s=this.get(sa,$n,Be.Self);for(let a of s)a()}finally{yo(n),Un(r),Ue(i)}}toString(){let i=[],n=this.records;for(let r of n.keys())i.push(Mn(r));return`R3Injector[${i.join(", ")}]`}processProvider(i){i=un(i);let n=aa(i)?i:un(i&&i.provide),r=H3(i);if(!aa(i)&&i.multi===!0){let o=this.records.get(n);o||(o=Xs(void 0,qc,!0),o.factory=()=>qm(o.multi),this.records.set(n,o)),n=i,o.multi.push(i)}this.records.set(n,r)}hydrate(i,n){let r=Ue(null);try{return n.value===qc&&(n.value=R3,n.value=n.factory()),typeof n.value=="object"&&n.value&&V3(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{Ue(r)}}injectableDefInScope(i){if(!i.providedIn)return!1;let n=un(i.providedIn);return typeof n=="string"?n==="any"||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(i){let n=this._onDestroyHooks.indexOf(i);n!==-1&&this._onDestroyHooks.splice(n,1)}};function Km(t){let e=Nd(t),i=e!==null?e.factory:rs(t);if(i!==null)return i;if(t instanceof k)throw new j(204,!1);if(t instanceof Function)return L3(t);throw new j(204,!1)}function L3(t){if(t.length>0)throw new j(204,!1);let i=u3(t);return i!==null?()=>i.factory(t):()=>new t}function H3(t){if(kD(t))return Xs(void 0,t.useValue);{let e=OD(t);return Xs(e,qc)}}function OD(t,e,i){let n;if(aa(t)){let r=un(t);return rs(r)||Km(r)}else if(kD(t))n=()=>un(t.useValue);else if(P3(t))n=()=>t.useFactory(...qm(t.deps||[]));else if(N3(t))n=()=>$e(un(t.useExisting));else{let r=un(t&&(t.useClass||t.provide));if(B3(t))n=()=>new r(...qm(t.deps));else return rs(r)||Km(r)}return n}function xu(t){if(t.destroyed)throw new j(205,!1)}function Xs(t,e,i=!1){return{factory:t,value:e,multi:i?[]:void 0}}function B3(t){return!!t.deps}function V3(t){return t!==null&&typeof t=="object"&&typeof t.ngOnDestroy=="function"}function z3(t){return typeof t=="function"||typeof t=="object"&&t instanceof k}function Ym(t,e){for(let i of t)Array.isArray(i)?Ym(i,e):i&&CD(i)?Ym(i.\u0275providers,e):e(i)}function lg(t,e){t instanceof ku&&xu(t);let i,n=yo(t),r=Un(void 0);try{return e()}finally{yo(n),Un(r)}}function ND(){return DD()!==void 0||_3()!=null}function ha(t){if(!ND())throw new j(-203,!1)}function j3(t){return typeof t=="function"}var Gn=0,ve=1,fe=2,cn=3,Bi=4,Zn=5,yi=6,ia=7,An=8,ua=9,jr=10,pt=11,Ou=12,EC=13,ma=14,kn=15,os=16,Js=17,Vi=18,Ld=19,PD=20,vo=21,ra=22,Br=23,ti=24,Et=25,cg=1,Nu=6,Ur=7,id=8,la=9,ln=10,rd=function(t){return t[t.None=0]="None",t[t.HasTransplantedViews=2]="HasTransplantedViews",t}(rd||{});function zi(t){return Array.isArray(t)&&typeof t[cg]=="object"}function yr(t){return Array.isArray(t)&&t[cg]===!0}function dg(t){return(t.flags&4)!==0}function Wu(t){return t.componentOffset>-1}function Hd(t){return(t.flags&1)===1}function $r(t){return!!t.template}function od(t){return(t[fe]&512)!==0}var Qm=class{constructor(e,i,n){d(this,"previousValue");d(this,"currentValue");d(this,"firstChange");this.previousValue=e,this.currentValue=i,this.firstChange=n}isFirstChange(){return this.firstChange}};function FD(t,e,i,n){e!==null?e.applyValueToInputSignal(e,n):t[i]=n}var Yt=(()=>{let t=()=>RD;return t.ngInherit=!0,t})();function RD(t){return t.type.prototype.ngOnChanges&&(t.setInput=$3),U3}function U3(){let t=HD(this),e=t==null?void 0:t.current;if(e){let i=t.previous;if(i===zr)t.previous=e;else for(let n in e)i[n]=e[n];t.current=null,this.ngOnChanges(e)}}function $3(t,e,i,n,r){let o=this.declaredInputs[n],s=HD(t)||G3(t,{previous:zr,current:null}),a=s.current||(s.current={}),u=s.previous,l=u[o];a[o]=new Qm(l&&l.currentValue,i,u===zr),FD(t,e,r,i)}var LD="__ngSimpleChanges__";function HD(t){return t[LD]||null}function G3(t,e){return t[LD]=e}var wC=null;var cr=function(t,e,i){wC!=null&&wC(t,e,i)},BD="svg",W3="math";function ji(t){for(;Array.isArray(t);)t=t[Gn];return t}function q3(t){for(;Array.isArray(t);){if(typeof t[cg]=="object")return t;t=t[Gn]}return null}function VD(t,e){return ji(e[t])}function ni(t,e){return ji(e[t.index])}function fg(t,e){return t.data[e]}function ga(t,e){return t[e]}function wo(t,e){let i=e[t];return zi(i)?i:i[Gn]}function Z3(t){return(t[fe]&4)===4}function pg(t){return(t[fe]&128)===128}function K3(t){return yr(t[cn])}function _o(t,e){return e==null?null:t[e]}function zD(t){t[Js]=0}function hg(t){t[fe]&1024||(t[fe]|=1024,pg(t)&&qu(t))}function Y3(t,e){for(;t>0;)e=e[ma],t--;return e}function Bd(t){var e;return!!(t[fe]&9216||(e=t[ti])!=null&&e.dirty)}function Xm(t){var e;(e=t[jr].changeDetectionScheduler)==null||e.notify(9),t[fe]&64&&(t[fe]|=1024),Bd(t)&&qu(t)}function qu(t){var i;(i=t[jr].changeDetectionScheduler)==null||i.notify(0);let e=ss(t);for(;e!==null&&!(e[fe]&8192||(e[fe]|=8192,!pg(e)));)e=ss(e)}function jD(t,e){if((t[fe]&256)===256)throw new j(911,!1);t[vo]===null&&(t[vo]=[]),t[vo].push(e)}function Q3(t,e){if(t[vo]===null)return;let i=t[vo].indexOf(e);i!==-1&&t[vo].splice(i,1)}function ss(t){let e=t[cn];return yr(e)?e[cn]:e}var Ie={lFrame:YD(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var Jm=!1;function X3(){return Ie.lFrame.elementDepthCount}function J3(){Ie.lFrame.elementDepthCount++}function eN(){Ie.lFrame.elementDepthCount--}function UD(){return Ie.bindingsEnabled}function ya(){return Ie.skipHydrationRootTNode!==null}function tN(t){return Ie.skipHydrationRootTNode===t}function nN(t){Ie.skipHydrationRootTNode=t}function iN(){Ie.skipHydrationRootTNode=null}function pe(){return Ie.lFrame.lView}function St(){return Ie.lFrame.tView}function P(t){return Ie.lFrame.contextLView=t,t[An]}function F(t){return Ie.lFrame.contextLView=null,t}function dn(){let t=$D();for(;t!==null&&t.type===64;)t=t.parent;return t}function $D(){return Ie.lFrame.currentTNode}function rN(){let t=Ie.lFrame,e=t.currentTNode;return t.isParent?e:e.parent}function fs(t,e){let i=Ie.lFrame;i.currentTNode=t,i.isParent=e}function mg(){return Ie.lFrame.isParent}function gg(){Ie.lFrame.isParent=!1}function oN(){return Ie.lFrame.contextLView}function GD(){return Jm}function sd(t){let e=Jm;return Jm=t,e}function To(){let t=Ie.lFrame,e=t.bindingRootIndex;return e===-1&&(e=t.bindingRootIndex=t.tView.bindingStartIndex),e}function sN(){return Ie.lFrame.bindingIndex}function aN(t){return Ie.lFrame.bindingIndex=t}function ps(){return Ie.lFrame.bindingIndex++}function yg(t){let e=Ie.lFrame,i=e.bindingIndex;return e.bindingIndex=e.bindingIndex+t,i}function uN(){return Ie.lFrame.inI18n}function lN(t,e){let i=Ie.lFrame;i.bindingIndex=i.bindingRootIndex=t,e0(e)}function cN(){return Ie.lFrame.currentDirectiveIndex}function e0(t){Ie.lFrame.currentDirectiveIndex=t}function WD(t){let e=Ie.lFrame.currentDirectiveIndex;return e===-1?null:t[e]}function qD(){return Ie.lFrame.currentQueryIndex}function vg(t){Ie.lFrame.currentQueryIndex=t}function dN(t){let e=t[ve];return e.type===2?e.declTNode:e.type===1?t[Zn]:null}function ZD(t,e,i){if(i&Be.SkipSelf){let r=e,o=t;for(;r=r.parent,r===null&&!(i&Be.Host);)if(r=dN(o),r===null||(o=o[ma],r.type&10))break;if(r===null)return!1;e=r,t=o}let n=Ie.lFrame=KD();return n.currentTNode=e,n.lView=t,!0}function bg(t){let e=KD(),i=t[ve];Ie.lFrame=e,e.currentTNode=i.firstChild,e.lView=t,e.tView=i,e.contextLView=t,e.bindingIndex=i.bindingStartIndex,e.inI18n=!1}function KD(){let t=Ie.lFrame,e=t===null?null:t.child;return e===null?YD(t):e}function YD(t){let e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:t,child:null,inI18n:!1};return t!==null&&(t.child=e),e}function QD(){let t=Ie.lFrame;return Ie.lFrame=t.parent,t.currentTNode=null,t.lView=null,t}var XD=QD;function _g(){let t=QD();t.isParent=!0,t.tView=null,t.selectedIndex=-1,t.contextLView=null,t.elementDepthCount=0,t.currentDirectiveIndex=-1,t.currentNamespace=null,t.bindingRootIndex=-1,t.bindingIndex=-1,t.currentQueryIndex=0}function fN(t){return(Ie.lFrame.contextLView=Y3(t,Ie.lFrame.contextLView))[An]}function Zr(){return Ie.lFrame.selectedIndex}function as(t){Ie.lFrame.selectedIndex=t}function Zu(){let t=Ie.lFrame;return fg(t.tView,t.selectedIndex)}function Gee(){Ie.lFrame.currentNamespace=BD}function JD(){return Ie.lFrame.currentNamespace}var eE=!0;function Vd(){return eE}function xo(t){eE=t}function pN(t,e,i){let{ngOnChanges:n,ngOnInit:r,ngDoCheck:o}=e.type.prototype;if(n){let s=RD(e);(i.preOrderHooks??(i.preOrderHooks=[])).push(t,s),(i.preOrderCheckHooks??(i.preOrderCheckHooks=[])).push(t,s)}r&&(i.preOrderHooks??(i.preOrderHooks=[])).push(0-t,r),o&&((i.preOrderHooks??(i.preOrderHooks=[])).push(t,o),(i.preOrderCheckHooks??(i.preOrderCheckHooks=[])).push(t,o))}function zd(t,e){for(let i=e.directiveStart,n=e.directiveEnd;i=n)break}else e[u]<0&&(t[Js]+=65536),(a>14>16&&(t[fe]&3)===e&&(t[fe]+=16384,TC(a,o)):TC(a,o)}var oa=-1,us=class{constructor(e,i,n){d(this,"factory");d(this,"injectImpl");d(this,"resolving",!1);d(this,"canSeeViewProviders");d(this,"multi");d(this,"componentProviders");d(this,"index");d(this,"providerFactory");this.factory=e,this.canSeeViewProviders=i,this.injectImpl=n}};function mN(t){return t instanceof us}function gN(t){return(t.flags&8)!==0}function yN(t){return(t.flags&16)!==0}function t0(t,e,i){let n=0;for(;ne){s=o-1;break}}}for(;o>16}function ud(t,e){let i=_N(t),n=e;for(;i>0;)n=n[ma],i--;return n}var i0=!0;function ld(t){let e=i0;return i0=t,e}var CN=256,iE=CN-1,rE=5,DN=0,dr={};function EN(t,e,i){let n;typeof i=="string"?n=i.charCodeAt(0)||0:i.hasOwnProperty(Su)&&(n=i[Su]),n==null&&(n=i[Su]=DN++);let r=n&iE,o=1<>rE)]|=o}function cd(t,e){let i=oE(t,e);if(i!==-1)return i;let n=e[ve];n.firstCreatePass&&(t.injectorIndex=e.length,Pm(n.data,t),Pm(e,null),Pm(n.blueprint,null));let r=Cg(t,e),o=t.injectorIndex;if(nE(r)){let s=ad(r),a=ud(r,e),u=a[ve].data;for(let l=0;l<8;l++)e[o+l]=a[s+l]|u[s+l]}return e[o+8]=r,o}function Pm(t,e){t.push(0,0,0,0,0,0,0,0,e)}function oE(t,e){return t.injectorIndex===-1||t.parent&&t.parent.injectorIndex===t.injectorIndex||e[t.injectorIndex+8]===null?-1:t.injectorIndex}function Cg(t,e){if(t.parent&&t.parent.injectorIndex!==-1)return t.parent.injectorIndex;let i=0,n=null,r=e;for(;r!==null;){if(n=cE(r),n===null)return oa;if(i++,r=r[ma],n.injectorIndex!==-1)return n.injectorIndex|i<<16}return oa}function r0(t,e,i){EN(t,e,i)}function sE(t,e,i){if(i&Be.Optional||t!==void 0)return t;rg(e,"NodeInjector")}function aE(t,e,i,n){if(i&Be.Optional&&n===void 0&&(n=null),!(i&(Be.Self|Be.Host))){let r=t[ua],o=Un(void 0);try{return r?r.get(e,n,i&Be.Optional):ED(e,n,i&Be.Optional)}finally{Un(o)}}return sE(n,e,i)}function uE(t,e,i,n=Be.Default,r){if(t!==null){if(e[fe]&2048&&!(n&Be.Self)){let s=IN(t,e,i,n,dr);if(s!==dr)return s}let o=lE(t,e,i,n,dr);if(o!==dr)return o}return aE(e,i,n,r)}function lE(t,e,i,n,r){let o=TN(i);if(typeof o=="function"){if(!ZD(e,t,n))return n&Be.Host?sE(r,i,n):aE(e,i,n,r);try{let s;if(s=o(n),s==null&&!(n&Be.Optional))rg(i);else return s}finally{XD()}}else if(typeof o=="number"){let s=null,a=oE(t,e),u=oa,l=n&Be.Host?e[kn][Zn]:null;for((a===-1||n&Be.SkipSelf)&&(u=a===-1?Cg(t,e):e[a+8],u===oa||!SC(n,!1)?a=-1:(s=e[ve],a=ad(u),e=ud(u,e)));a!==-1;){let c=e[ve];if(IC(o,a,c.data)){let f=wN(a,e,i,s,n,l);if(f!==dr)return f}u=e[a+8],u!==oa&&SC(n,e[ve].data[a+8]===l)&&IC(o,a,e)?(s=c,a=ad(u),e=ud(u,e)):a=-1}}return r}function wN(t,e,i,n,r,o){let s=e[ve],a=s.data[t+8],u=n==null?Wu(a)&&i0:n!=s&&(a.type&3)!==0,l=r&Be.Host&&o===a,c=Yc(a,s,i,u,l);return c!==null?ls(e,s,c,a):dr}function Yc(t,e,i,n,r){let o=t.providerIndexes,s=e.data,a=o&1048575,u=t.directiveStart,l=t.directiveEnd,c=o>>20,f=n?a:a+c,p=r?a+c:l;for(let m=f;m=u&&g.type===i)return m}if(r){let m=s[u];if(m&&$r(m)&&m.type===i)return u}return null}function ls(t,e,i,n){let r=t[i],o=e.data;if(mN(r)){let s=r;s.resolving&&m3(h3(o[i]));let a=ld(s.canSeeViewProviders);s.resolving=!0;let u,l=s.injectImpl?Un(s.injectImpl):null,c=ZD(t,n,Be.Default);try{r=t[i]=s.factory(void 0,o,t,n),e.firstCreatePass&&i>=n.directiveStart&&pN(i,o[i],e)}finally{l!==null&&Un(l),ld(a),s.resolving=!1,XD()}}return r}function TN(t){if(typeof t=="string")return t.charCodeAt(0)||0;let e=t.hasOwnProperty(Su)?t[Su]:void 0;return typeof e=="number"?e>=0?e&iE:xN:e}function IC(t,e,i){let n=1<>rE)]&n)}function SC(t,e){return!(t&Be.Self)&&!(t&Be.Host&&e)}var ns=class{constructor(e,i){d(this,"_tNode");d(this,"_lView");this._tNode=e,this._lView=i}get(e,i,n){return uE(this._tNode,this._lView,e,Pd(n),i)}};function xN(){return new ns(dn(),pe())}function re(t){return ju(()=>{let e=t.prototype.constructor,i=e[Jc]||o0(e),n=Object.prototype,r=Object.getPrototypeOf(t.prototype).constructor;for(;r&&r!==n;){let o=r[Jc]||o0(r);if(o&&o!==i)return o;r=Object.getPrototypeOf(r)}return o=>new o})}function o0(t){return vD(t)?()=>{let e=o0(un(t));return e&&e()}:rs(t)}function IN(t,e,i,n,r){let o=t,s=e;for(;o!==null&&s!==null&&s[fe]&2048&&!(s[fe]&512);){let a=lE(o,s,i,n|Be.Self,dr);if(a!==dr)return a;let u=o.parent;if(!u){let l=s[PD];if(l){let c=l.get(i,dr,n);if(c!==dr)return c}u=cE(s),s=s[ma]}o=u}return r}function cE(t){let e=t[ve],i=e.type;return i===2?e.declTNode:i===1?t[Zn]:null}function MC(t,e=null,i=null,n){let r=dE(t,e,i,n);return r.resolveInjectorInitializers(),r}function dE(t,e=null,i=null,n,r=new Set){let o=[i||$n,k3(t)];return n=n||(typeof t=="object"?void 0:Mn(t)),new ku(o,e||Rd(),n||null,r)}var ts=class ts{static create(e,i){if(Array.isArray(e))return MC({name:""},i,e,"");{let n=e.name??"";return MC({name:n},e.parent,e.providers,n)}}};d(ts,"THROW_IF_NOT_FOUND",Au),d(ts,"NULL",new nd),d(ts,"\u0275prov",$({token:ts,providedIn:"any",factory:()=>$e(gr)})),d(ts,"__NG_ELEMENT_ID__",-1);var Wn=ts;var SN=new k("");SN.__NG_ELEMENT_ID__=t=>{let e=dn();if(e===null)throw new j(204,!1);if(e.type&2)return e.value;if(t&Be.Optional)return null;throw new j(204,!1)};var fE=!1,it=(()=>{class t{}return d(t,"__NG_ELEMENT_ID__",MN),d(t,"__NG_ENV_ID__",i=>i),t})(),dd=class extends it{constructor(i){super();d(this,"_lView");this._lView=i}onDestroy(i){return jD(this._lView,i),()=>Q3(this._lView,i)}};function MN(){return new dd(pe())}var Co=class{},jd=new k("",{providedIn:"root",factory:()=>!1});var pE=new k(""),Dg=new k(""),va=(()=>{let e=class e{constructor(){d(this,"taskId",0);d(this,"pendingTasks",new Set);d(this,"hasPendingTasks",new on(!1))}get _hasPendingTasks(){return this.hasPendingTasks.value}add(){this._hasPendingTasks||this.hasPendingTasks.next(!0);let n=this.taskId++;return this.pendingTasks.add(n),n}has(n){return this.pendingTasks.has(n)}remove(n){this.pendingTasks.delete(n),this.pendingTasks.size===0&&this._hasPendingTasks&&this.hasPendingTasks.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this._hasPendingTasks&&this.hasPendingTasks.next(!1)}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})();var s0=class extends tt{constructor(i=!1){super();d(this,"__isAsync");d(this,"destroyRef");d(this,"pendingTasks");this.__isAsync=i,ND()&&(this.destroyRef=h(it,{optional:!0})??void 0,this.pendingTasks=h(va,{optional:!0})??void 0)}emit(i){let n=Ue(null);try{super.next(i)}finally{Ue(n)}}subscribe(i,n,r){var l,c,f;let o=i,s=n||(()=>null),a=r;if(i&&typeof i=="object"){let p=i;o=(l=p.next)==null?void 0:l.bind(p),s=(c=p.error)==null?void 0:c.bind(p),a=(f=p.complete)==null?void 0:f.bind(p)}this.__isAsync&&(s=this.wrapInTimeout(s),o&&(o=this.wrapInTimeout(o)),a&&(a=this.wrapInTimeout(a)));let u=super.subscribe({next:o,error:s,complete:a});return i instanceof Ut&&i.add(u),u}wrapInTimeout(i){return n=>{var o;let r=(o=this.pendingTasks)==null?void 0:o.add();setTimeout(()=>{var s;i(n),r!==void 0&&((s=this.pendingTasks)==null||s.remove(r))})}}},_e=s0;function Fu(...t){}function hE(t){let e,i;function n(){t=Fu;try{i!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(i),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{t(),n()}),typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(()=>{t(),n()})),()=>n()}function AC(t){return queueMicrotask(()=>t()),()=>{t=Fu}}var Eg="isAngularZone",fd=Eg+"_ID",AN=0,me=class t{constructor(e){d(this,"hasPendingMacrotasks",!1);d(this,"hasPendingMicrotasks",!1);d(this,"isStable",!0);d(this,"onUnstable",new _e(!1));d(this,"onMicrotaskEmpty",new _e(!1));d(this,"onStable",new _e(!1));d(this,"onError",new _e(!1));let{enableLongStackTrace:i=!1,shouldCoalesceEventChangeDetection:n=!1,shouldCoalesceRunChangeDetection:r=!1,scheduleInRootZone:o=fE}=e;if(typeof Zone>"u")throw new j(908,!1);Zone.assertZonePatched();let s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),i&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!r&&n,s.shouldCoalesceRunChangeDetection=r,s.callbackScheduled=!1,s.scheduleInRootZone=o,NN(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(Eg)===!0}static assertInAngularZone(){if(!t.isInAngularZone())throw new j(909,!1)}static assertNotInAngularZone(){if(t.isInAngularZone())throw new j(909,!1)}run(e,i,n){return this._inner.run(e,i,n)}runTask(e,i,n,r){let o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+r,e,kN,Fu,Fu);try{return o.runTask(s,i,n)}finally{o.cancelTask(s)}}runGuarded(e,i,n){return this._inner.runGuarded(e,i,n)}runOutsideAngular(e){return this._outer.run(e)}},kN={};function wg(t){if(t._nesting==0&&!t.hasPendingMicrotasks&&!t.isStable)try{t._nesting++,t.onMicrotaskEmpty.emit(null)}finally{if(t._nesting--,!t.hasPendingMicrotasks)try{t.runOutsideAngular(()=>t.onStable.emit(null))}finally{t.isStable=!0}}}function ON(t){if(t.isCheckStableRunning||t.callbackScheduled)return;t.callbackScheduled=!0;function e(){hE(()=>{t.callbackScheduled=!1,a0(t),t.isCheckStableRunning=!0,wg(t),t.isCheckStableRunning=!1})}t.scheduleInRootZone?Zone.root.run(()=>{e()}):t._outer.run(()=>{e()}),a0(t)}function NN(t){let e=()=>{ON(t)},i=AN++;t._inner=t._inner.fork({name:"angular",properties:{[Eg]:!0,[fd]:i,[fd+i]:!0},onInvokeTask:(n,r,o,s,a,u)=>{if(PN(u))return n.invokeTask(o,s,a,u);try{return kC(t),n.invokeTask(o,s,a,u)}finally{(t.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||t.shouldCoalesceRunChangeDetection)&&e(),OC(t)}},onInvoke:(n,r,o,s,a,u,l)=>{try{return kC(t),n.invoke(o,s,a,u,l)}finally{t.shouldCoalesceRunChangeDetection&&!t.callbackScheduled&&!FN(u)&&e(),OC(t)}},onHasTask:(n,r,o,s)=>{n.hasTask(o,s),r===o&&(s.change=="microTask"?(t._hasPendingMicrotasks=s.microTask,a0(t),wg(t)):s.change=="macroTask"&&(t.hasPendingMacrotasks=s.macroTask))},onHandleError:(n,r,o,s)=>(n.handleError(o,s),t.runOutsideAngular(()=>t.onError.emit(s)),!1)})}function a0(t){t._hasPendingMicrotasks||(t.shouldCoalesceEventChangeDetection||t.shouldCoalesceRunChangeDetection)&&t.callbackScheduled===!0?t.hasPendingMicrotasks=!0:t.hasPendingMicrotasks=!1}function kC(t){t._nesting++,t.isStable&&(t.isStable=!1,t.onUnstable.emit(null))}function OC(t){t._nesting--,wg(t)}var pd=class{constructor(){d(this,"hasPendingMicrotasks",!1);d(this,"hasPendingMacrotasks",!1);d(this,"isStable",!0);d(this,"onUnstable",new _e);d(this,"onMicrotaskEmpty",new _e);d(this,"onStable",new _e);d(this,"onError",new _e)}run(e,i,n){return e.apply(i,n)}runGuarded(e,i,n){return e.apply(i,n)}runOutsideAngular(e){return e()}runTask(e,i,n,r){return e.apply(i,n)}};function PN(t){return mE(t,"__ignore_ng_zone__")}function FN(t){return mE(t,"__scheduler_tick__")}function mE(t,e){var i,n;return!Array.isArray(t)||t.length!==1?!1:((n=(i=t[0])==null?void 0:i.data)==null?void 0:n[e])===!0}var pr=class{constructor(){d(this,"_console",console)}handleError(e){this._console.error("ERROR",e)}},RN=new k("",{providedIn:"root",factory:()=>{let t=h(me),e=h(pr);return i=>t.runOutsideAngular(()=>e.handleError(i))}});function NC(t,e){return yD(t,e)}function LN(t){return yD(gD,t)}var Wee=(NC.required=LN,NC);function HN(){return ba(dn(),pe())}function ba(t,e){return new de(ni(t,e))}var de=(()=>{class t{constructor(i){d(this,"nativeElement");this.nativeElement=i}}return d(t,"__NG_ELEMENT_ID__",HN),t})();function BN(t){return t instanceof de?t.nativeElement:t}function VN(){return this._results[Symbol.iterator]()}var pD;pD=Symbol.iterator;var Ru=class{constructor(e=!1){d(this,"_emitDistinctChangesOnly");d(this,"dirty",!0);d(this,"_onDirty");d(this,"_results",[]);d(this,"_changesDetected",!1);d(this,"_changes");d(this,"length",0);d(this,"first");d(this,"last");d(this,pD,VN);this._emitDistinctChangesOnly=e}get changes(){return this._changes??(this._changes=new tt)}get(e){return this._results[e]}map(e){return this._results.map(e)}filter(e){return this._results.filter(e)}find(e){return this._results.find(e)}reduce(e,i){return this._results.reduce(e,i)}forEach(e){this._results.forEach(e)}some(e){return this._results.some(e)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(e,i){this.dirty=!1;let n=x3(e);(this._changesDetected=!T3(this._results,n,i))&&(this._results=n,this.length=n.length,this.last=n[this.length-1],this.first=n[0])}notifyOnChanges(){this._changes!==void 0&&(this._changesDetected||!this._emitDistinctChangesOnly)&&this._changes.next(this)}onDirty(e){this._onDirty=e}setDirty(){var e;this.dirty=!0,(e=this._onDirty)==null||e.call(this)}destroy(){this._changes!==void 0&&(this._changes.complete(),this._changes.unsubscribe())}},zN="ngSkipHydration",jN="ngskiphydration";function gE(t){let e=t.mergedAttrs;if(e===null)return!1;for(let i=0;iqN}),qN="ng",Tg=new k(""),Ui=new k("",{providedIn:"platform",factory:()=>"unknown"});var qee=new k(""),xg=new k("",{providedIn:"root",factory:()=>{var t,e;return((e=(t=Ku().body)==null?void 0:t.querySelector("[ngCspNonce]"))==null?void 0:e.getAttribute("ngCspNonce"))||null}});function ZN(){let t=new _a;return h(Ui)==="browser"&&(t.store=KN(Ku(),h(Ud))),t}var _a=(()=>{let e=class e{constructor(){d(this,"store",{});d(this,"onSerializeCallbacks",{})}get(n,r){return this.store[n]!==void 0?this.store[n]:r}set(n,r){this.store[n]=r}remove(n){delete this.store[n]}hasKey(n){return this.store.hasOwnProperty(n)}get isEmpty(){return Object.keys(this.store).length===0}onSerialize(n,r){this.onSerializeCallbacks[n]=r}toJson(){for(let n in this.onSerializeCallbacks)if(this.onSerializeCallbacks.hasOwnProperty(n))try{this.store[n]=this.onSerializeCallbacks[n]()}catch(r){console.warn("Exception in onSerialize callback: ",r)}return JSON.stringify(this.store).replace(/SE});var Sg=function(t){return t[t.CHANGE_DETECTION=0]="CHANGE_DETECTION",t[t.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",t}(Sg||{}),$d=new k(""),FC=new Set;function bi(t){var e;FC.has(t)||(FC.add(t),(e=performance==null?void 0:performance.mark)==null||e.call(performance,"mark_feature_usage",{detail:{feature:t}}))}var ea=function(t){return t[t.EarlyRead=0]="EarlyRead",t[t.Write=1]="Write",t[t.MixedReadWrite=2]="MixedReadWrite",t[t.Read=3]="Read",t}(ea||{}),AE=(()=>{let e=class e{constructor(){d(this,"impl",null)}execute(){var n;(n=this.impl)==null||n.execute()}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})(),tP=[ea.EarlyRead,ea.Write,ea.MixedReadWrite,ea.Read],nP=(()=>{let e=class e{constructor(){d(this,"ngZone",h(me));d(this,"scheduler",h(Co));d(this,"errorHandler",h(pr,{optional:!0}));d(this,"sequences",new Set);d(this,"deferredRegistrations",new Set);d(this,"executing",!1);h($d,{optional:!0})}execute(){var n;this.executing=!0;for(let r of tP)for(let o of this.sequences)if(!(o.erroredOrDestroyed||!o.hooks[r]))try{o.pipelinedValue=this.ngZone.runOutsideAngular(()=>this.maybeTrace(()=>o.hooks[r](o.pipelinedValue),o.snapshot))}catch(s){o.erroredOrDestroyed=!0,(n=this.errorHandler)==null||n.handleError(s)}this.executing=!1;for(let r of this.sequences)r.afterRun(),r.once&&(this.sequences.delete(r),r.destroy());for(let r of this.deferredRegistrations)this.sequences.add(r);this.deferredRegistrations.size>0&&this.scheduler.notify(8),this.deferredRegistrations.clear()}register(n){this.executing?this.deferredRegistrations.add(n):(this.sequences.add(n),this.scheduler.notify(7))}unregister(n){this.executing&&this.sequences.has(n)?(n.erroredOrDestroyed=!0,n.pipelinedValue=void 0,n.once=!0):(this.sequences.delete(n),this.deferredRegistrations.delete(n))}maybeTrace(n,r){return(r==null?void 0:r.run(Sg.AFTER_NEXT_RENDER,n))??n()}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})(),d0=class{constructor(e,i,n,r,o=null){d(this,"impl");d(this,"hooks");d(this,"once");d(this,"snapshot");d(this,"erroredOrDestroyed",!1);d(this,"pipelinedValue");d(this,"unregisterOnDestroy");this.impl=e,this.hooks=i,this.once=n,this.snapshot=o,this.unregisterOnDestroy=r==null?void 0:r.onDestroy(()=>this.destroy())}afterRun(){var e;this.erroredOrDestroyed=!1,this.pipelinedValue=void 0,(e=this.snapshot)==null||e.dispose(),this.snapshot=null}destroy(){var e;this.impl.unregister(this),(e=this.unregisterOnDestroy)==null||e.call(this)}};function Mg(t,e){!(e!=null&&e.injector)&&ha(Mg);let i=(e==null?void 0:e.injector)??h(Wn);return bi("NgAfterNextRender"),rP(t,i,e,!0)}function iP(t,e){if(t instanceof Function){let i=[void 0,void 0,void 0,void 0];return i[e]=t,i}else return[t.earlyRead,t.write,t.mixedReadWrite,t.read]}function rP(t,e,i,n){let r=e.get(AE);r.impl??(r.impl=e.get(nP));let o=e.get($d,null,{optional:!0}),s=(i==null?void 0:i.phase)??ea.MixedReadWrite,a=(i==null?void 0:i.manualCleanup)!==!0?e.get(it):null,u=new d0(r.impl,iP(t,s),n,a,o==null?void 0:o.snapshot(null));return r.impl.register(u),u}var oP="__nghData__",kE=oP,sP="__nghDeferData__",aP=sP,Fm="ngh",uP="nghm",OE=()=>null;function lP(t,e,i=!1){let n=t.getAttribute(Fm);if(n==null)return null;let[r,o]=n.split("|");if(n=i?o:r,!n)return null;let s=o?`|${o}`:"",a=i?r:s,u={},l;if(n!==""){let f=e.get(_a,null,{optional:!0});if(f!==null){let p=f.get(kE,[]);l=f.get(aP,{}),u=p[Number(n)]}}let c={data:u,firstChild:t.firstChild??null};return i&&(c.firstChild=t,Gd(c,0,t.nextSibling)),a?t.setAttribute(Fm,a):t.removeAttribute(Fm),c}function cP(){OE=lP}function Ag(t,e,i=!1){return OE(t,e,i)}function dP(t){let e=t._lView;return e[ve].type===2?null:(od(e)&&(e=e[Et]),e)}function fP(t){var e;return(e=t.textContent)==null?void 0:e.replace(/\s/gm,"")}function pP(t){let e=Ku(),i=e.createNodeIterator(t,NodeFilter.SHOW_COMMENT,{acceptNode(o){let s=fP(o);return s==="ngetn"||s==="ngtns"?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),n,r=[];for(;n=i.nextNode();)r.push(n);for(let o of r)o.textContent==="ngetn"?o.replaceWith(e.createTextNode("")):o.remove()}function Gd(t,e,i){t.segmentHeads??(t.segmentHeads={}),t.segmentHeads[e]=i}function f0(t,e){var i;return((i=t.segmentHeads)==null?void 0:i[e])??null}function hP(t,e){var r,o;let i=t.data,n=((r=i[YN])==null?void 0:r[e])??null;return n===null&&((o=i[Ig])!=null&&o[e])&&(n=kg(t,e)),n}function NE(t,e){var i;return((i=t.data[Ig])==null?void 0:i[e])??null}function kg(t,e){let i=NE(t,e)??[],n=0;for(let r of i)n+=r[md]*(r[xE]??1);return n}function mP(t){if(typeof t.disconnectedNodes>"u"){let e=t.data[IE];t.disconnectedNodes=e?new Set(e):null}return t.disconnectedNodes}function Yu(t,e){var i;if(typeof t.disconnectedNodes>"u"){let n=t.data[IE];t.disconnectedNodes=n?new Set(n):null}return!!((i=mP(t))!=null&&i.has(e))}var hr=function(t){return t[t.Emulated=0]="Emulated",t[t.None=2]="None",t[t.ShadowDom=3]="ShadowDom",t}(hr||{}),zc;function gP(){if(zc===void 0&&(zc=null,Mu.trustedTypes))try{zc=Mu.trustedTypes.createPolicy("angular",{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t})}catch{}return zc}function Wd(t){var e;return((e=gP())==null?void 0:e.createHTML(t))||t}var jc;function PE(){if(jc===void 0&&(jc=null,Mu.trustedTypes))try{jc=Mu.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t})}catch{}return jc}function RC(t){var e;return((e=PE())==null?void 0:e.createHTML(t))||t}function LC(t){var e;return((e=PE())==null?void 0:e.createScriptURL(t))||t}var Gr=class{constructor(e){d(this,"changingThisBreaksApplicationSecurity");this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${mD})`}},p0=class extends Gr{getTypeName(){return"HTML"}},h0=class extends Gr{getTypeName(){return"Style"}},m0=class extends Gr{getTypeName(){return"Script"}},g0=class extends Gr{getTypeName(){return"URL"}},y0=class extends Gr{getTypeName(){return"ResourceURL"}};function ii(t){return t instanceof Gr?t.changingThisBreaksApplicationSecurity:t}function Kr(t,e){let i=yP(t);if(i!=null&&i!==e){if(i==="ResourceURL"&&e==="URL")return!0;throw new Error(`Required a safe ${e}, got a ${i} (see ${mD})`)}return i===e}function yP(t){return t instanceof Gr&&t.getTypeName()||null}function FE(t){return new p0(t)}function RE(t){return new h0(t)}function LE(t){return new m0(t)}function HE(t){return new g0(t)}function BE(t){return new y0(t)}function vP(t){let e=new b0(t);return bP()?new v0(e):e}var v0=class{constructor(e){d(this,"inertDocumentHelper");this.inertDocumentHelper=e}getInertBodyElement(e){var i;e=""+e;try{let n=new window.DOMParser().parseFromString(Wd(e),"text/html").body;return n===null?this.inertDocumentHelper.getInertBodyElement(e):((i=n.firstChild)==null||i.remove(),n)}catch{return null}}},b0=class{constructor(e){d(this,"defaultDoc");d(this,"inertDocument");this.defaultDoc=e,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert")}getInertBodyElement(e){let i=this.inertDocument.createElement("template");return i.innerHTML=Wd(e),i}};function bP(){try{return!!new window.DOMParser().parseFromString(Wd(""),"text/html")}catch{return!1}}var _P=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;function qd(t){return t=String(t),t.match(_P)?t:"unsafe:"+t}function Yr(t){let e={};for(let i of t.split(","))e[i]=!0;return e}function Qu(...t){let e={};for(let i of t)for(let n in i)i.hasOwnProperty(n)&&(e[n]=!0);return e}var VE=Yr("area,br,col,hr,img,wbr"),zE=Yr("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),jE=Yr("rp,rt"),CP=Qu(jE,zE),DP=Qu(zE,Yr("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul")),EP=Qu(jE,Yr("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video")),HC=Qu(VE,DP,EP,CP),UE=Yr("background,cite,href,itemtype,longdesc,poster,src,xlink:href"),wP=Yr("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width"),TP=Yr("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext"),xP=Qu(UE,wP,TP),IP=Yr("script,style,template"),_0=class{constructor(){d(this,"sanitizedSomething",!1);d(this,"buf",[])}sanitizeChildren(e){let i=e.firstChild,n=!0,r=[];for(;i;){if(i.nodeType===Node.ELEMENT_NODE?n=this.startElement(i):i.nodeType===Node.TEXT_NODE?this.chars(i.nodeValue):this.sanitizedSomething=!0,n&&i.firstChild){r.push(i),i=AP(i);continue}for(;i;){i.nodeType===Node.ELEMENT_NODE&&this.endElement(i);let o=MP(i);if(o){i=o;break}i=r.pop()}}return this.buf.join("")}startElement(e){let i=BC(e).toLowerCase();if(!HC.hasOwnProperty(i))return this.sanitizedSomething=!0,!IP.hasOwnProperty(i);this.buf.push("<"),this.buf.push(i);let n=e.attributes;for(let r=0;r"),!0}endElement(e){let i=BC(e).toLowerCase();HC.hasOwnProperty(i)&&!VE.hasOwnProperty(i)&&(this.buf.push(""))}chars(e){this.buf.push(VC(e))}};function SP(t,e){return(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)!==Node.DOCUMENT_POSITION_CONTAINED_BY}function MP(t){let e=t.nextSibling;if(e&&t!==e.previousSibling)throw $E(e);return e}function AP(t){let e=t.firstChild;if(e&&SP(t,e))throw $E(e);return e}function BC(t){let e=t.nodeName;return typeof e=="string"?e:"FORM"}function $E(t){return new Error(`Failed to sanitize html because the element is clobbered: ${t.outerHTML}`)}var kP=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,OP=/([^\#-~ |!])/g;function VC(t){return t.replace(/&/g,"&").replace(kP,function(e){let i=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+((i-55296)*1024+(n-56320)+65536)+";"}).replace(OP,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(//g,">")}var Uc;function Og(t,e){let i=null;try{Uc=Uc||vP(t);let n=e?String(e):"";i=Uc.getInertBodyElement(n);let r=5,o=n;do{if(r===0)throw new Error("Failed to sanitize html because the input is unstable");r--,n=o,o=i.innerHTML,i=Uc.getInertBodyElement(n)}while(n!==o);let a=new _0().sanitizeChildren(zC(i)||i);return Wd(a)}finally{if(i){let n=zC(i)||i;for(;n.firstChild;)n.firstChild.remove()}}}function zC(t){return"content"in t&&NP(t)?t.content:null}function NP(t){return t.nodeType===Node.ELEMENT_NODE&&t.nodeName==="TEMPLATE"}var ri=function(t){return t[t.NONE=0]="NONE",t[t.HTML=1]="HTML",t[t.STYLE=2]="STYLE",t[t.SCRIPT=3]="SCRIPT",t[t.URL=4]="URL",t[t.RESOURCE_URL=5]="RESOURCE_URL",t}(ri||{});function Zd(t){let e=Ng();return e?RC(e.sanitize(ri.HTML,t)||""):Kr(t,"HTML")?RC(ii(t)):Og(Ku(),is(t))}function Kd(t){let e=Ng();return e?e.sanitize(ri.URL,t)||"":Kr(t,"URL")?ii(t):qd(is(t))}function GE(t){let e=Ng();if(e)return LC(e.sanitize(ri.RESOURCE_URL,t)||"");if(Kr(t,"ResourceURL"))return LC(ii(t));throw new j(904,!1)}function Ng(){let t=pe();return t&&t[jr].sanitizer}var PP=/^>|^->||--!>|)/g,RP="\u200B$1\u200B";function LP(t){return t.replace(PP,e=>e.replace(FP,RP))}function Zee(t){return t.ownerDocument.defaultView}function Nn(t){return t.ownerDocument}function HP(t){return t.ownerDocument.body}function WE(t){return t instanceof Function?t():t}var Eo=function(t){return t[t.None=0]="None",t[t.SignalBased=1]="SignalBased",t[t.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",t}(Eo||{}),mr=function(t){return t[t.Important=1]="Important",t[t.DashCase=2]="DashCase",t}(mr||{}),BP;function Pg(t,e){return BP(t,e)}function ta(t,e,i,n,r){if(n!=null){let o,s=!1;yr(n)?o=n:zi(n)&&(s=!0,n=n[Gn]);let a=ji(n);t===0&&i!==null?r==null?XE(e,i,a):gd(e,i,a,r||null,!0):t===1&&i!==null?gd(e,i,a,r||null,!0):t===2?Lg(e,a,s):t===3&&e.destroyNode(a),o!=null&&XP(e,t,o,i,r)}}function qE(t,e){return t.createText(e)}function VP(t,e,i){t.setValue(e,i)}function ZE(t,e){return t.createComment(LP(e))}function Fg(t,e,i){return t.createElement(e,i)}function zP(t,e){KE(t,e),e[Gn]=null,e[Zn]=null}function jP(t,e,i,n,r,o){n[Gn]=r,n[Zn]=e,Xd(t,n,i,1,r,o)}function KE(t,e){var i;(i=e[jr].changeDetectionScheduler)==null||i.notify(10),Xd(t,e,e[pt],2,null,null)}function UP(t){let e=t[Ou];if(!e)return Rm(t[ve],t);for(;e;){let i=null;if(zi(e))i=e[Ou];else{let n=e[ln];n&&(i=n)}if(!i){for(;e&&!e[Bi]&&e!==t;)zi(e)&&Rm(e[ve],e),e=e[cn];e===null&&(e=t),zi(e)&&Rm(e[ve],e),i=e&&e[Bi]}e=i}}function $P(t,e,i,n){let r=ln+n,o=i.length;n>0&&(i[r-1][Bi]=e),n0&&(t[i-1][Bi]=n[Bi]);let o=td(t,ln+e);zP(n[ve],n);let s=o[Vi];s!==null&&s.detachView(o[ve]),n[cn]=null,n[Bi]=null,n[fe]&=-129}return n}function Yd(t,e){if(!(e[fe]&256)){let i=e[pt];i.destroyNode&&Xd(t,e,i,3,null,null),UP(e)}}function Rm(t,e){if(e[fe]&256)return;let i=Ue(null);try{e[fe]&=-129,e[fe]|=256,e[ti]&&Us(e[ti]),WP(t,e),GP(t,e),e[ve].type===1&&e[pt].destroy();let n=e[os];if(n!==null&&yr(e[cn])){n!==e[cn]&&Rg(n,e);let r=e[Vi];r!==null&&r.detachView(t)}u0(e)}finally{Ue(i)}}function GP(t,e){let i=t.cleanup,n=e[ia];if(i!==null)for(let s=0;s=0?n[a]():n[-a].unsubscribe(),s+=2}else{let a=n[i[s+1]];i[s].call(a)}n!==null&&(e[ia]=null);let r=e[vo];if(r!==null){e[vo]=null;for(let s=0;s-1){let{encapsulation:o}=t.data[n.directiveStart+r];if(o===hr.None||o===hr.Emulated)return null}return ni(n,i)}}function gd(t,e,i,n,r){t.insertBefore(e,i,n,r)}function XE(t,e,i){t.appendChild(e,i)}function jC(t,e,i,n,r){n!==null?gd(t,e,i,n,r):XE(t,e,i)}function JE(t,e){return t.parentNode(e)}function ZP(t,e){return t.nextSibling(e)}function ew(t,e,i){return YP(t,e,i)}function KP(t,e,i){return t.type&40?ni(t,i):null}var YP=KP,UC;function Qd(t,e,i,n){let r=QE(t,n,e),o=e[pt],s=n.parent||e[Zn],a=ew(s,n,e);if(r!=null)if(Array.isArray(i))for(let u=0;u-1){let o;for(;++ro?f="":f=r[c+1].toLowerCase(),n&2&&l!==f){if(Hi(n))return!1;s=!0}}}}return Hi(n)||s}function Hi(t){return(t&1)===0}function oF(t,e,i,n){if(e===null)return-1;let r=0;if(n||!i){let o=!1;for(;r-1)for(i++;i0?'="'+a+'"':"")+"]"}else n&8?r+="."+s:n&4&&(r+=" "+s);else r!==""&&!Hi(s)&&(e+=$C(o,r),r=""),n=s,o=o||!Hi(n);i++}return r!==""&&(e+=$C(o,r)),e}function dF(t){return t.map(cF).join(",")}function fF(t){let e=[],i=[],n=1,r=2;for(;nEt&&uw(t,e,Et,!1),cr(s?2:0,r),i(n,r)}finally{as(o),cr(s?3:1,r)}}function Vg(t,e,i){if(dg(e)){let n=Ue(null);try{let r=e.directiveStart,o=e.directiveEnd;for(let s=r;snull;function vF(t){yE(t)?nw(t):pP(t)}function bF(){hw=vF}function _F(t,e,i,n){let r=_w(e);r.push(i),t.firstCreatePass&&Cw(t).push(n,r.length-1)}function CF(t,e,i,n,r,o){let s=e?e.injectorIndex:-1,a=0;return ya()&&(a|=128),{type:i,index:n,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOffset:-1,propertyBindings:null,flags:a,providerIndexes:0,value:r,attrs:o,mergedAttrs:null,localNames:null,initialInputs:void 0,inputs:null,outputs:null,tView:null,next:null,prev:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}function GC(t,e,i,n,r){for(let o in e){if(!e.hasOwnProperty(o))continue;let s=e[o];if(s===void 0)continue;n??(n={});let a,u=Eo.None;Array.isArray(s)?(a=s[0],u=s[1]):a=s;let l=o;if(r!==null){if(!r.hasOwnProperty(o))continue;l=r[o]}t===0?WC(n,i,l,a,u):WC(n,i,l,a)}return n}function WC(t,e,i,n,r){let o;t.hasOwnProperty(i)?(o=t[i]).push(e,n):o=t[i]=[e,n],r!==void 0&&o.push(r)}function DF(t,e,i){let n=e.directiveStart,r=e.directiveEnd,o=t.data,s=e.attrs,a=[],u=null,l=null;for(let c=n;c0;){let i=t[--e];if(typeof i=="number"&&i<0)return i}return 0}function IF(t,e,i,n){let r=i.directiveStart,o=i.directiveEnd;Wu(i)&&PF(e,i,t.data[r+i.componentOffset]),t.firstCreatePass||cd(i,e),Do(n,e);let s=i.initialInputs;for(let a=r;a{qu(t.lView)},consumerOnSignalRead(){this.lView[ti]=this}});function YF(t){let e=t[ti]??Object.create(QF);return e.lView=t,e}var QF=U(M({},Zo),{consumerIsAlwaysLive:!0,consumerMarkedDirty:t=>{let e=ss(t.lView);for(;e&&!Tw(e[ve]);)e=ss(e);e&&hg(e)},consumerOnSignalRead(){this.lView[ti]=this}});function Tw(t){return t.type!==2}function xw(t){if(t[Br]===null)return;let e=!0;for(;e;){let i=!1;for(let n of t[Br])n.dirty&&(i=!0,n.zone===null||Zone.current===n.zone?n.run():n.zone.run(()=>n.run()));e=i&&!!(t[fe]&8192)}}var XF=100;function Iw(t,e=!0,i=0){var s,a;let r=t[jr].rendererFactory,o=!1;o||(s=r.begin)==null||s.call(r);try{JF(t,i)}catch(u){throw e&&Dw(t,u),u}finally{o||(a=r.end)==null||a.call(r)}}function JF(t,e){let i=GD();try{sd(!0),w0(t,e);let n=0;for(;Bd(t);){if(n===XF)throw new j(103,!1);n++,w0(t,1)}}finally{sd(i)}}function eR(t,e,i,n){let r=e[fe];if((r&256)===256)return;let o=!1,s=!1;bg(e);let a=!0,u=null,l=null;o||(Tw(t)?(l=WF(e),u=js(l)):M1()===null?(a=!1,l=YF(e),u=js(l)):e[ti]&&(Us(e[ti]),e[ti]=null));try{zD(e),aN(t.bindingStartIndex),i!==null&&fw(t,e,i,2,n);let c=(r&3)===3;if(!o)if(c){let m=t.preOrderCheckHooks;m!==null&&Zc(e,m,null)}else{let m=t.preOrderHooks;m!==null&&Kc(e,m,0,null),Om(e,0)}if(s||tR(e),xw(e),Sw(e,0),t.contentQueries!==null&&bw(t,e),!o)if(c){let m=t.contentCheckHooks;m!==null&&Zc(e,m)}else{let m=t.contentHooks;m!==null&&Kc(e,m,1),Om(e,1)}pF(t,e);let f=t.components;f!==null&&Aw(e,f,0);let p=t.viewQuery;if(p!==null&&E0(2,p,n),!o)if(c){let m=t.viewCheckHooks;m!==null&&Zc(e,m)}else{let m=t.viewHooks;m!==null&&Kc(e,m,2),Om(e,2)}if(t.firstUpdatePass===!0&&(t.firstUpdatePass=!1),e[ra]){for(let m of e[ra])m();e[ra]=null}o||(e[fe]&=-73)}catch(c){throw o||qu(e),c}finally{l!==null&&(gu(l,u),a&&ZF(l)),_g()}}function Sw(t,e){for(let i=_E(t);i!==null;i=CE(i))for(let n=ln;n-1&&(Lu(e,n),td(i,n))}this._attachedToViewContainer=!1}Yd(this._lView[ve],this._lView)}onDestroy(e){jD(this._lView,e)}markForCheck(){qg(this._cdRefInjectingView||this._lView,4)}markForRefresh(){hg(this._cdRefInjectingView||this._lView)}detach(){this._lView[fe]&=-129}reattach(){Xm(this._lView),this._lView[fe]|=128}detectChanges(){this._lView[fe]|=1024,Iw(this._lView,this.notifyErrorHandler)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new j(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=od(this._lView),i=this._lView[os];i!==null&&!e&&Rg(i,this._lView),KE(this._lView[ve],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new j(902,!1);this._appRef=e;let i=od(this._lView),n=this._lView[os];n!==null&&!i&&YE(n,this._lView),Xm(this._lView)}},It=(()=>{class t{}return d(t,"__NG_ELEMENT_ID__",oR),t})(),iR=It,rR=class extends iR{constructor(i,n,r){super();d(this,"_declarationLView");d(this,"_declarationTContainer");d(this,"elementRef");this._declarationLView=i,this._declarationTContainer=n,this.elementRef=r}get ssrId(){var i;return((i=this._declarationTContainer.tView)==null?void 0:i.ssrId)||null}createEmbeddedView(i,n){return this.createEmbeddedViewImpl(i,n)}createEmbeddedViewImpl(i,n,r){let o=nf(this._declarationLView,this._declarationTContainer,i,{embeddedViewInjector:n,dehydratedView:r});return new cs(o)}};function oR(){return of(dn(),pe())}function of(t,e){return t.type&4?new rR(e,t,ba(t,e)):null}var sR=new RegExp(`^(\\d+)*(${TE}|${wE})*(.*)`);function aR(t){let e=t.match(sR),[i,n,r,o]=e,s=n?parseInt(n,10):r,a=[];for(let[u,l,c]of o.matchAll(/(f|n)(\d*)/g)){let f=parseInt(c,10)||1;a.push(l,f)}return[s,...a]}function uR(t){var e;return!t.prev&&((e=t.parent)==null?void 0:e.type)===8}function Lm(t){return t.index-Et}function lR(t,e){let i=t.i18nNodes;if(i)return i.get(e)}function sf(t,e,i,n){let r=Lm(n),o=lR(t,r);if(o===void 0){let s=t.data[JN];if(s!=null&&s[r])o=dR(s[r],i);else if(e.firstChild===n)o=t.firstChild;else{let a=n.prev===null,u=n.prev??n.parent;if(uR(n)){let l=Lm(n.parent);o=f0(t,l)}else{let l=ni(u,i);if(a)o=l.firstChild;else{let c=Lm(u),f=f0(t,c);if(u.type===2&&f){let m=kg(t,c)+1;o=af(m,f)}else o=l.nextSibling}}}}return o}function af(t,e){let i=e;for(let n=0;n0&&(o.firstChild=t,t=af(n[md],t)),i.push(o)}return[t,i]}var Nw=()=>null;function bR(t,e){let i=t[Nu];return!e||i===null||i.length===0?null:i[0].data[XN]===e?i.shift():(kw(t),null)}function _R(){Nw=bR}function Bu(t,e){return Nw(t,e)}var T0=class{},bd=class{},x0=class{resolveComponentFactory(e){throw Error(`No component factory found for ${Mn(e)}.`)}},Vr=class{};d(Vr,"NULL",new x0);var ca=class{},oi=(()=>{class t{constructor(){d(this,"destroyNode",null)}}return d(t,"__NG_ELEMENT_ID__",()=>CR()),t})();function CR(){let t=pe(),e=dn(),i=wo(e.index,t);return(zi(i)?i:t)[pt]}var DR=(()=>{let e=class e{};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>null}));let t=e;return t})();function _d(t,e,i){let n=i?t.styles:null,r=i?t.classes:null,o=0;if(e!==null)for(let s=0;s0&&rw(t,i,o.join(" "))}}function MR(t,e,i){let n=t.projection=[];for(let r=0;r{class t{}return d(t,"__NG_ELEMENT_ID__",kR),t})();function kR(){let t=dn();return Fw(t,pe())}var OR=zt,Pw=class extends OR{constructor(i,n,r){super();d(this,"_lContainer");d(this,"_hostTNode");d(this,"_hostLView");this._lContainer=i,this._hostTNode=n,this._hostLView=r}get element(){return ba(this._hostTNode,this._hostLView)}get injector(){return new ns(this._hostTNode,this._hostLView)}get parentInjector(){let i=Cg(this._hostTNode,this._hostLView);if(nE(i)){let n=ud(i,this._hostLView),r=ad(i),o=n[ve].data[r+8];return new ns(o,n)}else return new ns(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(i){let n=ZC(this._lContainer);return n!==null&&n[i]||null}get length(){return this._lContainer.length-ln}createEmbeddedView(i,n,r){let o,s;typeof r=="number"?o=r:r!=null&&(o=r.index,s=r.injector);let a=Bu(this._lContainer,i.ssrId),u=i.createEmbeddedViewImpl(n||{},s,a);return this.insertImpl(u,o,Hu(this._hostTNode,a)),u}createComponent(i,n,r,o,s){let a=i&&!j3(i),u;if(a)u=n;else{let y=n||{};u=y.index,r=y.injector,o=y.projectableNodes,s=y.environmentInjector||y.ngModuleRef}let l=a?i:new da(bo(i)),c=r||this.parentInjector;if(!s&&l.ngModule==null){let b=(a?c:this.parentInjector).get(fr,null);b&&(s=b)}let f=bo(l.componentType??{}),p=Bu(this._lContainer,(f==null?void 0:f.id)??null),m=(p==null?void 0:p.firstChild)??null,g=l.create(c,o,m,s);return this.insertImpl(g.hostView,u,Hu(this._hostTNode,p)),g}insert(i,n){return this.insertImpl(i,n,!0)}insertImpl(i,n,r){let o=i._lView;if(K3(o)){let u=this.indexOf(i);if(u!==-1)this.detach(u);else{let l=o[cn],c=new Pw(l,l[Zn],l[cn]);c.detach(c.indexOf(i))}}let s=this._adjustIndex(n),a=this._lContainer;return rf(a,o,s,r),i.attachToViewContainerRef(),wD(Hm(a),s,i),i}move(i,n){return this.insert(i,n)}indexOf(i){let n=ZC(this._lContainer);return n!==null?n.indexOf(i):-1}remove(i){let n=this._adjustIndex(i,-1),r=Lu(this._lContainer,n);r&&(td(Hm(this._lContainer),n),Yd(r[ve],r))}detach(i){let n=this._adjustIndex(i,-1),r=Lu(this._lContainer,n);return r&&td(Hm(this._lContainer),n)!=null?new cs(r):null}_adjustIndex(i,n=0){return i??this.length+n}};function ZC(t){return t[id]}function Hm(t){return t[id]||(t[id]=[])}function Fw(t,e){let i,n=e[t.index];return yr(n)?i=n:(i=vw(n,e,null,t),e[t.index]=i,tf(e,i)),Rw(i,e,t,n),new Pw(i,t,e)}function NR(t,e){let i=t[pt],n=i.createComment(""),r=ni(e,t),o=JE(i,r);return gd(i,o,n,ZP(i,r),!1),n}var Rw=Lw,Zg=()=>!1;function PR(t,e,i){return Zg(t,e,i)}function Lw(t,e,i,n){if(t[Ur])return;let r;i.type&8?r=ji(n):r=NR(e,i),t[Ur]=r}function FR(t,e,i){var c;if(t[Ur]&&t[Nu])return!0;let n=i[yi],r=e.index-Et;if(!n||UN(e)||Yu(n,r))return!1;let s=f0(n,r),a=(c=n.data[Ig])==null?void 0:c[r],[u,l]=vR(s,a);return t[Ur]=u,t[Nu]=l,!0}function RR(t,e,i,n){Zg(t,i,e)||Lw(t,e,i,n)}function LR(){Rw=RR,Zg=FR}var S0=class t{constructor(e){d(this,"queryList");d(this,"matches",null);this.queryList=e}clone(){return new t(this.queryList)}setDirty(){this.queryList.setDirty()}},M0=class t{constructor(e=[]){d(this,"queries");this.queries=e}createEmbeddedView(e){let i=e.queries;if(i!==null){let n=e.contentQueries!==null?e.contentQueries[0]:i.length,r=[];for(let o=0;o0)n.push(s[a/2]);else{let l=o[a+1],c=e[-u];for(let f=ln;fe.trim())}function Vw(t,e,i){t.queries===null&&(t.queries=new A0),t.queries.track(new k0(e,i))}function WR(t,e){let i=t.contentQueries||(t.contentQueries=[]),n=i.length?i[i.length-1]:-1;e!==n&&i.push(t.queries.length-1,e)}function Kg(t,e){return t.queries.getByIndex(e)}function qR(t,e){let i=t[ve],n=Kg(i,e);return n.crossesNgTemplate?O0(i,t,e,[]):Hw(i,t,n,e)}function uf(t){return typeof t=="function"&&t[zn]!==void 0}function ge(t,e){bi("NgSignals");let i=V1(t),n=i[zn];return e!=null&&e.equal&&(n.equal=e.equal),i.set=r=>pc(n,r),i.update=r=>z1(n,r),i.asReadonly=ZR.bind(i),i}function ZR(){let t=this[zn];if(t.readonlyFn===void 0){let e=()=>this();e[zn]=t,t.readonlyFn=e}return t.readonlyFn}function zw(t){return uf(t)&&typeof t.set=="function"}var Wr=class{},N0=class{};function jw(t,e){return new Ed(t,e??null,[])}var Ed=class extends Wr{constructor(i,n,r,o=!0){super();d(this,"ngModuleType");d(this,"_parent");d(this,"_bootstrapComponents",[]);d(this,"_r3Injector");d(this,"instance");d(this,"destroyCbs",[]);d(this,"componentFactoryResolver",new Cd(this));this.ngModuleType=i,this._parent=n;let s=ID(i);this._bootstrapComponents=WE(s.bootstrap),this._r3Injector=dE(i,n,[{provide:Wr,useValue:this},{provide:Vr,useValue:this.componentFactoryResolver},...r],Mn(i),new Set(["environment"])),o&&this.resolveInjectorInitializers()}resolveInjectorInitializers(){this._r3Injector.resolveInjectorInitializers(),this.instance=this._r3Injector.get(this.ngModuleType)}get injector(){return this._r3Injector}destroy(){let i=this._r3Injector;!i.destroyed&&i.destroy(),this.destroyCbs.forEach(n=>n()),this.destroyCbs=null}onDestroy(i){this.destroyCbs.push(i)}},P0=class extends N0{constructor(i){super();d(this,"moduleType");this.moduleType=i}create(i){return new Ed(this.moduleType,i,[])}};var wd=class extends Wr{constructor(i){super();d(this,"injector");d(this,"componentFactoryResolver",new Cd(this));d(this,"instance",null);let n=new ku([...i.providers,{provide:Wr,useValue:this},{provide:Vr,useValue:this.componentFactoryResolver}],i.parent||Rd(),i.debugName,new Set(["environment"]));this.injector=n,i.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(i){this.injector.onDestroy(i)}};function KR(t,e,i=null){return new wd({providers:t,parent:e,debugName:i,runEnvironmentInitializers:!0}).injector}var YR=(()=>{let e=class e{constructor(n){d(this,"_injector");d(this,"cachedInjectors",new Map);this._injector=n}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){let r=MD(!1,n.type),o=r.length>0?KR([r],this._injector,`Standalone[${n.type.name}]`):null;this.cachedInjectors.set(n,o)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(let n of this.cachedInjectors.values())n!==null&&n.destroy()}finally{this.cachedInjectors.clear()}}};d(e,"\u0275prov",$({token:e,providedIn:"environment",factory:()=>new e($e(fr))}));let t=e;return t})();function H(t){return ju(()=>{let e=Uw(t),i=U(M({},e),{decls:t.decls,vars:t.vars,template:t.template,consts:t.consts||null,ngContentSelectors:t.ngContentSelectors,onPush:t.changeDetection===vE.OnPush,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&t.dependencies||null,getStandaloneInjector:e.standalone?r=>r.get(YR).getOrCreateStandaloneInjector(i):null,getExternalStyles:null,signals:t.signals??!1,data:t.data||{},encapsulation:t.encapsulation||hr.Emulated,styles:t.styles||$n,_:null,schemas:t.schemas||null,tView:null,id:""});e.standalone&&bi("NgStandalone"),$w(i);let n=t.dependencies;return i.directiveDefs=YC(n,!1),i.pipeDefs=YC(n,!0),i.id=JR(i),i})}function QR(t){return bo(t)||ag(t)}function XR(t){return t!==null}function bn(t){return ju(()=>({type:t.type,bootstrap:t.bootstrap||$n,declarations:t.declarations||$n,imports:t.imports||$n,exports:t.exports||$n,transitiveCompileScopes:null,schemas:t.schemas||null,id:t.id||null}))}function KC(t,e){if(t==null)return zr;let i={};for(let n in t)if(t.hasOwnProperty(n)){let r=t[n],o,s,a=Eo.None;Array.isArray(r)?(a=r[0],o=r[1],s=r[2]??o):(o=r,s=r),e?(i[o]=a!==Eo.None?[n,a]:n,e[o]=s):i[o]=n}return i}function T(t){return ju(()=>{let e=Uw(t);return $w(e),e})}function $i(t){return{type:t.type,name:t.name,factory:null,pure:t.pure!==!1,standalone:t.standalone??!0,onDestroy:t.type.prototype.ngOnDestroy||null}}function Uw(t){let e={};return{type:t.type,providersResolver:null,factory:null,hostBindings:t.hostBindings||null,hostVars:t.hostVars||0,hostAttrs:t.hostAttrs||null,contentQueries:t.contentQueries||null,declaredInputs:e,inputTransforms:null,inputConfig:t.inputs||zr,exportAs:t.exportAs||null,standalone:t.standalone??!0,signals:t.signals===!0,selectors:t.selectors||$n,viewQuery:t.viewQuery||null,features:t.features||null,setInput:null,findHostDirectiveDefs:null,hostDirectives:null,inputs:KC(t.inputs,e),outputs:KC(t.outputs),debugInfo:null}}function $w(t){var e;(e=t.features)==null||e.forEach(i=>i(t))}function YC(t,e){if(!t)return null;let i=e?SD:QR;return()=>(typeof t=="function"?t():t).map(n=>i(n)).filter(XR)}function JR(t){let e=0,i=typeof t.consts=="function"?"":t.consts,n=[t.selectors,t.ngContentSelectors,t.hostVars,t.hostAttrs,i,t.vars,t.decls,t.encapsulation,t.standalone,t.signals,t.exportAs,JSON.stringify(t.inputs),JSON.stringify(t.outputs),Object.getOwnPropertyNames(t.type.prototype),!!t.contentQueries,!!t.viewQuery];for(let o of n.join("|"))e=Math.imul(31,e)+o.charCodeAt(0)<<0;return e+=2147483648,"c"+e}function eL(t){return Object.getPrototypeOf(t.prototype).constructor}function oe(t){let e=eL(t.type),i=!0,n=[t];for(;e;){let r;if($r(t))r=e.\u0275cmp||e.\u0275dir;else{if(e.\u0275cmp)throw new j(903,!1);r=e.\u0275dir}if(r){if(i){n.push(r);let s=t;s.inputs=$c(t.inputs),s.inputTransforms=$c(t.inputTransforms),s.declaredInputs=$c(t.declaredInputs),s.outputs=$c(t.outputs);let a=r.hostBindings;a&&oL(t,a);let u=r.viewQuery,l=r.contentQueries;if(u&&iL(t,u),l&&rL(t,l),tL(t,r),s3(t.outputs,r.outputs),$r(r)&&r.data.animation){let c=t.data;c.animation=(c.animation||[]).concat(r.data.animation)}}let o=r.features;if(o)for(let s=0;s=0;n--){let r=t[n];r.hostVars=e+=r.hostVars,r.hostAttrs=Pu(r.hostAttrs,i=Pu(i,r.hostAttrs))}}function $c(t){return t===zr?{}:t===$n?[]:t}function iL(t,e){let i=t.viewQuery;i?t.viewQuery=(n,r)=>{e(n,r),i(n,r)}:t.viewQuery=e}function rL(t,e){let i=t.contentQueries;i?t.contentQueries=(n,r,o)=>{e(n,r,o),i(n,r,o)}:t.contentQueries=e}function oL(t,e){let i=t.hostBindings;i?t.hostBindings=(n,r)=>{e(n,r),i(n,r)}:t.hostBindings=e}function Mt(t){let e=i=>{let n=Array.isArray(t);i.hostDirectives===null?(i.findHostDirectiveDefs=Gw,i.hostDirectives=n?t.map(F0):[t]):n?i.hostDirectives.unshift(...t.map(F0)):i.hostDirectives.unshift(t)};return e.ngInherit=!0,e}function Gw(t,e,i){if(t.hostDirectives!==null)for(let n of t.hostDirectives)if(typeof n=="function"){let r=n();for(let o of r)QC(F0(o),e,i)}else QC(n,e,i)}function QC(t,e,i){let n=ag(t.directive);sL(n.declaredInputs,t.inputs),Gw(n,e,i),i.set(n,t),e.push(n)}function F0(t){return typeof t=="function"?{directive:un(t),inputs:zr,outputs:zr}:{directive:un(t.directive),inputs:XC(t.inputs),outputs:XC(t.outputs)}}function XC(t){if(t===void 0||t.length===0)return zr;let e={};for(let i=0;i{let e=class e{log(n){console.log(n)}warn(n){console.warn(n)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"platform"}));let t=e;return t})();var Xw=new k("");function Da(t){return!!t&&typeof t.then=="function"}function Xg(t){return!!t&&typeof t.subscribe=="function"}var fL=new k("");var Jw=(()=>{let e=class e{constructor(){d(this,"resolve");d(this,"reject");d(this,"initialized",!1);d(this,"done",!1);d(this,"donePromise",new Promise((n,r)=>{this.resolve=n,this.reject=r}));d(this,"appInits",h(fL,{optional:!0})??[]);d(this,"injector",h(Wn))}runInitializers(){if(this.initialized)return;let n=[];for(let o of this.appInits){let s=lg(this.injector,o);if(Da(s))n.push(s);else if(Xg(s)){let a=new Promise((u,l)=>{s.subscribe({complete:u,error:l})});n.push(a)}}let r=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{r()}).catch(o=>{this.reject(o)}),n.length===0&&r(),this.initialized=!0}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})(),eT=(()=>{let e=class e{};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new xd}));let t=e;return t})(),xd=class{constructor(){d(this,"queuedEffectCount",0);d(this,"queues",new Map)}schedule(e){this.enqueue(e)}enqueue(e){let i=e.zone;this.queues.has(i)||this.queues.set(i,new Set);let n=this.queues.get(i);n.has(e)||(this.queuedEffectCount++,n.add(e))}flush(){for(;this.queuedEffectCount>0;)for(let[e,i]of this.queues)e===null?this.flushQueue(i):e.run(()=>this.flushQueue(i))}flushQueue(e){for(let i of e)e.delete(i),this.queuedEffectCount--,i.run()}},lf=new k("");function pL(){B1(()=>{throw new j(600,!1)})}function hL(t){return t.isBoundToModule}var mL=10;function gL(t,e,i){try{let n=i();return Da(n)?n.catch(r=>{throw e.runOutsideAngular(()=>t.handleError(r)),r}):n}catch(n){throw e.runOutsideAngular(()=>t.handleError(n)),n}}var vr=(()=>{let e=class e{constructor(){d(this,"_runningTick",!1);d(this,"_destroyed",!1);d(this,"_destroyListeners",[]);d(this,"_views",[]);d(this,"internalErrorHandler",h(RN));d(this,"afterRenderManager",h(AE));d(this,"zonelessEnabled",h(jd));d(this,"rootEffectScheduler",h(eT));d(this,"dirtyFlags",0);d(this,"deferredDirtyFlags",0);d(this,"tracingSnapshot",null);d(this,"externalTestViews",new Set);d(this,"afterTick",new tt);d(this,"componentTypes",[]);d(this,"components",[]);d(this,"isStable",h(va).hasPendingTasks.pipe(S(n=>!n)));d(this,"_injector",h(fr));d(this,"_rendererFactory",null);d(this,"_tick",()=>{if(this.tracingSnapshot!==null){let r=this.tracingSnapshot;this.tracingSnapshot=null,r.run(Sg.CHANGE_DETECTION,this._tick),r.dispose();return}if(this._runningTick)throw new j(101,!1);let n=Ue(null);try{this._runningTick=!0,this.synchronize()}catch(r){this.internalErrorHandler(r)}finally{this._runningTick=!1,Ue(n),this.afterTick.next()}});h($d,{optional:!0})}get allViews(){return[...this.externalTestViews.keys(),...this._views]}get destroyed(){return this._destroyed}whenStable(){let n;return new Promise(r=>{n=this.isStable.subscribe({next:o=>{o&&r()}})}).finally(()=>{n.unsubscribe()})}get injector(){return this._injector}bootstrap(n,r){let o=n instanceof bd;if(!this._injector.get(Jw).done){let m=!o&&A3(n),g=!1;throw new j(405,g)}let a;o?a=n:a=this._injector.get(Vr).resolveComponentFactory(n),this.componentTypes.push(a.componentType);let u=hL(a)?void 0:this._injector.get(Wr),l=r||a.selector,c=a.create(Wn.NULL,[],l,u),f=c.location.nativeElement,p=c.injector.get(Xw,null);return p==null||p.registerApplication(f),c.onDestroy(()=>{this.detachView(c.hostView),Qc(this.components,c),p==null||p.unregisterApplication(f)}),this._loadComponent(c),c}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(ca,null,{optional:!0})),this.dirtyFlags|=this.deferredDirtyFlags,this.deferredDirtyFlags=0;let n=0;for(;this.dirtyFlags!==0&&n++Bd(n))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(n){let r=n;this._views.push(r),r.attachToAppRef(this)}detachView(n){let r=n;Qc(this._views,r),r.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView),this.tick(),this.components.push(n),this._injector.get(lf,[]).forEach(o=>o(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>Qc(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new j(406,!1);let n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}warnIfDestroyed(){}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();function Qc(t,e){let i=t.indexOf(e);i>-1&&t.splice(i,1)}function yL(t,e,i,n){if(!i&&!Bd(t))return;Iw(t,e,i&&!n?0:1)}function Ke(t,e,i,n){let r=pe(),o=ps();if(On(r,o,e)){let s=St(),a=Zu();FF(a,r,t,e,i,n)}return Ke}function vL(t,e,i,n){return On(t,ps(),i)?e+is(i)+n:_i}function bL(t,e,i,n,r,o){let s=sN(),a=Vu(t,s,i,r);return yg(2),a?e+is(i)+n+is(r)+o:_i}function Gc(t,e){return t<<17|e<<2}function ds(t){return t>>17&32767}function _L(t){return(t&2)==2}function CL(t,e){return t&131071|e<<17}function R0(t){return t|2}function fa(t){return(t&131068)>>2}function Bm(t,e){return t&-131069|e<<2}function DL(t){return(t&1)===1}function L0(t){return t|1}function EL(t,e,i,n,r,o){let s=o?e.classBindings:e.styleBindings,a=ds(s),u=fa(s);t[n]=i;let l=!1,c;if(Array.isArray(i)){let f=i;c=f[1],(c===null||$u(f,c)>0)&&(l=!0)}else c=i;if(r)if(u!==0){let p=ds(t[a+1]);t[n+1]=Gc(p,a),p!==0&&(t[p+1]=Bm(t[p+1],n)),t[a+1]=CL(t[a+1],n)}else t[n+1]=Gc(a,0),a!==0&&(t[a+1]=Bm(t[a+1],n)),a=n;else t[n+1]=Gc(u,0),a===0?a=n:t[u+1]=Bm(t[u+1],n),u=n;l&&(t[n+1]=R0(t[n+1])),JC(t,c,n,!0),JC(t,c,n,!1),wL(e,c,t,n,o),s=Gc(a,u),o?e.classBindings=s:e.styleBindings=s}function wL(t,e,i,n,r){let o=r?t.residualClasses:t.residualStyles;o!=null&&typeof e=="string"&&$u(o,e)>=0&&(i[n+1]=L0(i[n+1]))}function JC(t,e,i,n){let r=t[i+1],o=e===null,s=n?ds(r):fa(r),a=!1;for(;s!==0&&(a===!1||o);){let u=t[s],l=t[s+1];TL(u,e)&&(a=!0,t[s+1]=n?L0(l):R0(l)),s=n?ds(l):fa(l)}a&&(t[i+1]=n?R0(r):L0(r))}function TL(t,e){return t===null||e==null||(Array.isArray(t)?t[1]:t)===e?!0:Array.isArray(t)&&typeof e=="string"?$u(t,e)>=0:!1}var Sn={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function xL(t){return t.substring(Sn.key,Sn.keyEnd)}function IL(t){return t.substring(Sn.value,Sn.valueEnd)}function SL(t){return ML(t),tT(t,Id(t,0,Sn.textEnd))}function tT(t,e){let i=Sn.textEnd,n=Sn.key=Id(t,e,i);return i===n?-1:(n=Sn.keyEnd=AL(t,n,i),n=eD(t,n,i,58),n=Sn.value=Id(t,n,i),n=Sn.valueEnd=kL(t,n,i),eD(t,n,i,59))}function ML(t){Sn.key=0,Sn.keyEnd=0,Sn.value=0,Sn.valueEnd=0,Sn.textEnd=t.length}function Id(t,e,i){for(;e=65&&(n&-33)<=90||n>=48&&n<=57);)e++;return e}function eD(t,e,i,n){return e=Id(t,e,i),e32&&(a=s),o=r,r=n,n=u&-33}return a}function tD(t,e,i,n){let r=-1,o=i;for(;o=0;i=tT(e,i))oT(t,xL(e),IL(e))}function nT(t,e,i,n){let r=pe(),o=St(),s=yg(2);if(o.firstUpdatePass&&rT(o,t,s,n),e!==_i&&On(r,s,e)){let a=o.data[Zr()];sT(o,a,r,r[pt],t,r[s+1]=VL(e,i),n,s)}}function NL(t,e,i,n){let r=St(),o=yg(2);r.firstUpdatePass&&rT(r,null,o,n);let s=pe();if(i!==_i&&On(s,o,i)){let a=r.data[Zr()];if(aT(a,n)&&!iT(r,o)){let u=n?a.classesWithoutHost:a.stylesWithoutHost;u!==null&&(i=$m(u,i||"")),H0(r,a,s,i,n)}else BL(r,a,s,s[pt],s[o+1],s[o+1]=HL(t,e,i),n,o)}}function iT(t,e){return e>=t.expandoStartIndex}function rT(t,e,i,n){let r=t.data;if(r[i+1]===null){let o=r[Zr()],s=iT(t,i);aT(o,n)&&e===null&&!s&&(e=!1),e=PL(r,o,e,n),EL(r,o,e,i,s,n)}}function PL(t,e,i,n){let r=WD(t),o=n?e.residualClasses:e.residualStyles;if(r===null)(n?e.classBindings:e.styleBindings)===0&&(i=Vm(null,t,e,i,n),i=zu(i,e.attrs,n),o=null);else{let s=e.directiveStylingLast;if(s===-1||t[s]!==r)if(i=Vm(r,t,e,i,n),o===null){let u=FL(t,e,n);u!==void 0&&Array.isArray(u)&&(u=Vm(null,t,e,u[1],n),u=zu(u,e.attrs,n),RL(t,e,n,u))}else o=LL(t,e,n)}return o!==void 0&&(n?e.residualClasses=o:e.residualStyles=o),i}function FL(t,e,i){let n=i?e.classBindings:e.styleBindings;if(fa(n)!==0)return t[ds(n)]}function RL(t,e,i,n){let r=i?e.classBindings:e.styleBindings;t[ds(r)]=n}function LL(t,e,i){let n,r=e.directiveEnd;for(let o=1+e.directiveStylingLast;o0;){let u=t[r],l=Array.isArray(u),c=l?u[1]:u,f=c===null,p=i[r+1];p===_i&&(p=f?$n:void 0);let m=f?Am(p,n):c===n?p:void 0;if(l&&!Sd(m)&&(m=Am(u,n)),Sd(m)&&(a=m,s))return a;let g=t[r+1];r=s?ds(g):fa(g)}if(e!==null){let u=o?e.residualClasses:e.residualStyles;u!=null&&(a=Am(u,n))}return a}function Sd(t){return t!==void 0}function VL(t,e){return t==null||t===""||(typeof e=="string"?t=t+e:typeof t=="object"&&(t=Mn(ii(t)))),t}function aT(t,e){return(t.flags&(e?8:16))!==0}var B0=class{destroy(e){}updateValue(e,i){}swap(e,i){let n=Math.min(e,i),r=Math.max(e,i),o=this.detach(r);if(r-n>1){let s=this.detach(n);this.attach(n,o),this.attach(r,s)}else this.attach(n,o)}move(e,i){this.attach(i,this.detach(e))}};function zm(t,e,i,n,r){return t===i&&Object.is(e,n)?1:Object.is(r(t,e),r(i,n))?-1:0}function zL(t,e,i){let n,r,o=0,s=t.length-1,a=void 0;if(Array.isArray(e)){let u=e.length-1;for(;o<=s&&o<=u;){let l=t.at(o),c=e[o],f=zm(o,l,o,c,i);if(f!==0){f<0&&t.updateValue(o,c),o++;continue}let p=t.at(s),m=e[u],g=zm(s,p,u,m,i);if(g!==0){g<0&&t.updateValue(s,m),s--,u--;continue}let y=i(o,l),b=i(s,p),D=i(o,c);if(Object.is(D,b)){let I=i(u,m);Object.is(I,y)?(t.swap(o,s),t.updateValue(s,m),u--,s--):t.move(s,o),t.updateValue(o,c),o++;continue}if(n??(n=new Md),r??(r=rD(t,o,s,i)),V0(t,n,o,D))t.updateValue(o,c),o++,s++;else if(r.has(D))n.set(y,t.detach(o)),s--;else{let I=t.create(o,e[o]);t.attach(o,I),o++,s++}}for(;o<=u;)iD(t,n,i,o,e[o]),o++}else if(e!=null){let u=e[Symbol.iterator](),l=u.next();for(;!l.done&&o<=s;){let c=t.at(o),f=l.value,p=zm(o,c,o,f,i);if(p!==0)p<0&&t.updateValue(o,f),o++,l=u.next();else{n??(n=new Md),r??(r=rD(t,o,s,i));let m=i(o,f);if(V0(t,n,o,m))t.updateValue(o,f),o++,s++,l=u.next();else if(!r.has(m))t.attach(o,t.create(o,f)),o++,s++,l=u.next();else{let g=i(o,c);n.set(g,t.detach(o)),s--}}}for(;!l.done;)iD(t,n,i,t.length,l.value),l=u.next()}for(;o<=s;)t.destroy(t.detach(s--));n==null||n.forEach(u=>{t.destroy(u)})}function V0(t,e,i,n){return e!==void 0&&e.has(n)?(t.attach(i,e.get(n)),e.delete(n),!0):!1}function iD(t,e,i,n,r){if(V0(t,e,n,i(n,r)))t.updateValue(n,r);else{let o=t.create(n,r);t.attach(n,o)}}function rD(t,e,i,n){let r=new Set;for(let o=e;o<=i;o++)r.add(n(o,t.at(o)));return r}var Md=class{constructor(){d(this,"kvMap",new Map);d(this,"_vMap")}has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let i=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(i)?(this.kvMap.set(e,this._vMap.get(i)),this._vMap.delete(i)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,i){if(this.kvMap.has(e)){let n=this.kvMap.get(e);this._vMap===void 0&&(this._vMap=new Map);let r=this._vMap;for(;r.has(n);)n=r.get(n);r.set(n,i)}else this.kvMap.set(e,i)}forEach(e){for(let[i,n]of this.kvMap)if(e(n,i),this._vMap!==void 0){let r=this._vMap;for(;r.has(n);)n=r.get(n),e(n,i)}}};var z0=class{constructor(e,i,n){d(this,"lContainer");d(this,"$implicit");d(this,"$index");this.lContainer=e,this.$implicit=i,this.$index=n}get $count(){return this.lContainer.length-ln}};function Qee(t){return t}var j0=class{constructor(e,i,n){d(this,"hasEmptyBlock");d(this,"trackByFn");d(this,"liveCollection");this.hasEmptyBlock=e,this.trackByFn=i,this.liveCollection=n}};function Xee(t,e,i,n,r,o,s,a,u,l,c,f,p){bi("NgControlFlow");let m=pe(),g=St(),y=u!==void 0,b=pe(),D=a?s.bind(b[kn][An]):s,I=new j0(y,D);b[Et+t]=I,Td(m,g,t+1,e,i,n,r,_o(g.consts,o)),y&&Td(m,g,t+2,u,l,c,f,_o(g.consts,p))}var U0=class extends B0{constructor(i,n,r){super();d(this,"lContainer");d(this,"hostLView");d(this,"templateTNode");d(this,"operationsCounter");d(this,"needsIndexUpdate",!1);this.lContainer=i,this.hostLView=n,this.templateTNode=r}get length(){return this.lContainer.length-ln}at(i){return this.getLView(i)[An].$implicit}attach(i,n){let r=n[yi];this.needsIndexUpdate||(this.needsIndexUpdate=i!==this.length),rf(this.lContainer,n,i,Hu(this.templateTNode,r))}detach(i){return this.needsIndexUpdate||(this.needsIndexUpdate=i!==this.length-1),jL(this.lContainer,i)}create(i,n){var s;let r=Bu(this.lContainer,this.templateTNode.tView.ssrId),o=nf(this.hostLView,this.templateTNode,new z0(this.lContainer,n,i),{dehydratedView:r});return(s=this.operationsCounter)==null||s.recordCreate(),o}destroy(i){var n;Yd(i[ve],i),(n=this.operationsCounter)==null||n.recordDestroy()}updateValue(i,n){this.getLView(i)[An].$implicit=n}reset(){var i;this.needsIndexUpdate=!1,(i=this.operationsCounter)==null||i.reset()}updateIndexes(){if(this.needsIndexUpdate)for(let i=0;i(xo(!0),Fg(n,r,JD()));function GL(t,e,i,n,r,o){let s=e[yi],a=!s||ya()||Xu(i)||Yu(s,o);if(xo(a),a)return Fg(n,r,JD());let u=sf(s,t,e,i);return NE(s,o)&&Gd(s,o,u.nextSibling),s&&(gE(i)||yE(u))&&Wu(i)&&(nN(i),nw(u)),u}function WL(){uT=GL}function qL(t,e,i,n,r){let o=e.consts,s=_o(o,n),a=Ca(e,t,8,"ng-container",s);s!==null&&_d(a,s,!0);let u=_o(o,r);return $g(e,i,a,u),e.queries!==null&&e.queries.elementStart(e,a),a}function _t(t,e,i){let n=pe(),r=St(),o=t+Et,s=r.firstCreatePass?qL(o,r,n,e,i):r.data[o];fs(s,!0);let a=lT(r,n,s,t);return n[o]=a,Vd()&&Qd(r,n,a,s),Do(a,n),Hd(s)&&(zg(r,n,s),Vg(r,s,n)),i!=null&&jg(n,s),_t}function Ct(){let t=dn(),e=St();return mg()?gg():(t=t.parent,fs(t,!1)),e.firstCreatePass&&(zd(e,t),dg(t)&&e.queries.elementEnd(t)),Ct}function Qt(t,e,i){return _t(t,e,i),Ct(),Qt}var lT=(t,e,i,n)=>(xo(!0),ZE(e[pt],""));function ZL(t,e,i,n){let r,o=e[yi],s=!o||ya()||Yu(o,n)||Xu(i);if(xo(s),s)return ZE(e[pt],"");let a=sf(o,t,e,i),u=hP(o,n);return Gd(o,n,a),r=af(u,a),r}function KL(){lT=ZL}function q(){return pe()}function ms(t,e,i){let n=pe(),r=ps();if(On(n,r,e)){let o=St(),s=Zu();ef(o,s,n,t,e,n[pt],i,!0)}return ms}function Ea(t,e,i){let n=pe(),r=ps();if(On(n,r,e)){let o=St(),s=Zu(),a=WD(o.data),u=BF(a,s,n);ef(o,s,n,t,e,u,i,!0)}return Ea}var Ad="en-US";var YL=Ad;function QL(t){typeof t=="string"&&(YL=t.toLowerCase().replace(/_/g,"-"))}var XL=(t,e,i)=>{};function x(t,e,i,n){let r=pe(),o=St(),s=dn();return cT(o,r,r[pt],s,t,e,n),x}function JL(t,e,i,n){let r=t.cleanup;if(r!=null)for(let o=0;ou?a[u]:null}typeof s=="string"&&(o+=2)}return null}function cT(t,e,i,n,r,o,s){let a=Hd(n),l=t.firstCreatePass&&Cw(t),c=e[An],f=_w(e),p=!0;if(n.type&3||s){let y=ni(n,e),b=s?s(y):y,D=f.length,I=s?A=>s(ji(A[n.index])):n.index,N=null;if(!s&&a&&(N=JL(t,e,r,n.index)),N!==null){let A=N.__ngLastListenerFn__||N;A.__ngNextListenerFn__=o,N.__ngLastListenerFn__=o,p=!1}else{o=uD(n,e,c,o),XL(y,r,o);let A=i.listen(b,r,o);f.push(o,A),l&&l.push(r,I,D,D+1)}}else o=uD(n,e,c,o);let m=n.outputs,g;if(p&&m!==null&&(g=m[r])){let y=g.length;if(y)for(let b=0;b-1?wo(t.index,e):e;qg(s,5);let a=aD(e,i,n,o),u=r.__ngNextListenerFn__;for(;u;)a=aD(e,i,u,o)&&a,u=u.__ngNextListenerFn__;return a}}function _(t=1){return fN(t)}function e6(t,e){let i=null,n=sF(t);for(let r=0;r=t.data.length&&(t.data[i]=null,t.blueprint[i]=null),e[i]=n}function be(t){let e=oN();return ga(e,Et+t)}function he(t,e=""){let i=pe(),n=St(),r=t+Et,o=n.firstCreatePass?Ca(n,r,1,e,null):n.data[r],s=dT(n,i,o,e,t);i[r]=s,Vd()&&Qd(n,i,s,o),fs(o,!1)}var dT=(t,e,i,n,r)=>(xo(!0),qE(e[pt],n));function i6(t,e,i,n,r){let o=e[yi],s=!o||ya()||Xu(i)||Yu(o,r);return xo(s),s?qE(e[pt],n):sf(o,t,e,i)}function r6(){dT=i6}function ey(t){return Nt("",t,""),ey}function Nt(t,e,i){let n=pe(),r=vL(n,t,e,i);return r!==_i&&Ew(n,Zr(),r),Nt}function ty(t,e,i,n,r){let o=pe(),s=bL(o,t,e,i,n,r);return s!==_i&&Ew(o,Zr(),s),ty}function cf(t,e,i){zw(e)&&(e=e());let n=pe(),r=ps();if(On(n,r,e)){let o=St(),s=Zu();ef(o,s,n,t,e,n[pt],i,!1)}return cf}function ny(t,e){let i=zw(t);return i&&t.set(e),i}function df(t,e){let i=pe(),n=St(),r=dn();return cT(n,i,i[pt],r,t,e),df}function o6(t,e,i){let n=St();if(n.firstCreatePass){let r=$r(t);$0(i,n.data,n.blueprint,r,!0),$0(e,n.data,n.blueprint,r,!1)}}function $0(t,e,i,n,r){if(t=un(t),Array.isArray(t))for(let o=0;o>20;if(aa(t)||!t.multi){let m=new us(l,r,Ge),g=Um(u,e,r?c:c+p,f);g===-1?(r0(cd(a,s),o,u),jm(o,t,e.length),e.push(u),a.directiveStart++,a.directiveEnd++,r&&(a.providerIndexes+=1048576),i.push(m),s.push(m)):(i[g]=m,s[g]=m)}else{let m=Um(u,e,c+p,f),g=Um(u,e,c,c+p),y=m>=0&&i[m],b=g>=0&&i[g];if(r&&!b||!r&&!y){r0(cd(a,s),o,u);let D=u6(r?a6:s6,i.length,r,n,l);!r&&b&&(i[g].providerFactory=D),jm(o,t,e.length,0),e.push(u),a.directiveStart++,a.directiveEnd++,r&&(a.providerIndexes+=1048576),i.push(D),s.push(D)}else{let D=fT(i[r?g:m],l,!r&&n);jm(o,t,m>-1?m:g,D)}!r&&n&&b&&i[g].componentProviders++}}}function jm(t,e,i,n){let r=aa(e),o=F3(e);if(r||o){let u=(o?un(e.useClass):e).prototype.ngOnDestroy;if(u){let l=t.destroyHooks||(t.destroyHooks=[]);if(!r&&e.multi){let c=l.indexOf(i);c===-1?l.push(i,[n,u]):l[c+1].push(n,u)}else l.push(i,u)}}}function fT(t,e,i){return i&&t.componentProviders++,t.multi.push(e)-1}function Um(t,e,i,n){for(let r=i;r{i.providersResolver=(n,r)=>o6(n,r?r(t):t,e)}}function Qr(t,e,i){let n=To()+t,r=pe();return r[n]===_i?hs(r,n,i?e.call(i):e()):qw(r,n)}function Kn(t,e,i,n){return pT(pe(),To(),t,e,i,n)}function ete(t,e,i,n,r,o,s,a){let u=To()+t,l=pe(),c=Zw(l,u,i,n,r,o);return On(l,u+4,s)||c?hs(l,u+5,a?e.call(a,i,n,r,o,s):e(i,n,r,o,s)):qw(l,u+5)}function Ju(t,e){let i=t[e];return i===_i?void 0:i}function pT(t,e,i,n,r,o){let s=e+i;return On(t,s,r)?hs(t,s+1,o?n.call(o,r):n(r)):Ju(t,s+1)}function l6(t,e,i,n,r,o,s){let a=e+i;return Vu(t,a,r,o)?hs(t,a+2,s?n.call(s,r,o):n(r,o)):Ju(t,a+2)}function c6(t,e,i,n,r,o,s,a){let u=e+i;return uL(t,u,r,o,s)?hs(t,u+3,a?n.call(a,r,o,s):n(r,o,s)):Ju(t,u+3)}function d6(t,e,i,n,r,o,s,a,u){let l=e+i;return Zw(t,l,r,o,s,a)?hs(t,l+4,u?n.call(u,r,o,s,a):n(r,o,s,a)):Ju(t,l+4)}function f6(t,e,i,n,r,o){let s=e+i,a=!1;for(let u=0;u=0;i--){let n=e[i];if(t===n.name)return n}}function J(t,e,i){let n=t+Et,r=pe(),o=ga(r,n);return el(r,n)?pT(r,To(),e,o.transform,i,o):o.transform(i)}function hT(t,e,i,n){let r=t+Et,o=pe(),s=ga(o,r);return el(o,r)?l6(o,To(),e,s.transform,i,n,s):s.transform(i,n)}function mT(t,e,i,n,r){let o=t+Et,s=pe(),a=ga(s,o);return el(s,o)?c6(s,To(),e,a.transform,i,n,r,a):a.transform(i,n,r)}function tte(t,e,i,n,r,o){let s=t+Et,a=pe(),u=ga(a,s);return el(a,s)?d6(a,To(),e,u.transform,i,n,r,o,u):u.transform(i,n,r,o)}function nte(t,e,i){let n=t+Et,r=pe(),o=ga(r,n);return el(r,n)?f6(r,To(),e,o.transform,i,o):o.transform.apply(o,i)}function el(t,e){return t[ve].data[e].pure}function We(t,e){return of(t,e)}var pa=class{constructor(e){d(this,"full");d(this,"major");d(this,"minor");d(this,"patch");this.full=e;let i=e.split(".");this.major=i[0],this.minor=i[1],this.patch=i.slice(2).join(".")}},gT=new pa("19.0.3"),W0=class{constructor(e,i){d(this,"ngModuleFactory");d(this,"componentFactories");this.ngModuleFactory=e,this.componentFactories=i}},ite=(()=>{let e=class e{compileModuleSync(n){return new P0(n)}compileModuleAsync(n){return Promise.resolve(this.compileModuleSync(n))}compileModuleAndAllComponentsSync(n){let r=this.compileModuleSync(n),o=ID(n),s=WE(o.declarations).reduce((a,u)=>{let l=bo(u);return l&&a.push(new da(l)),a},[]);return new W0(r,s)}compileModuleAndAllComponentsAsync(n){return Promise.resolve(this.compileModuleAndAllComponentsSync(n))}clearCache(){}clearCacheFor(n){}getModuleId(n){}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var h6=(()=>{let e=class e{constructor(){d(this,"zone",h(me));d(this,"changeDetectionScheduler",h(Co));d(this,"applicationRef",h(vr));d(this,"_onMicrotaskEmptySubscription")}initialize(){this._onMicrotaskEmptySubscription||(this._onMicrotaskEmptySubscription=this.zone.onMicrotaskEmpty.subscribe({next:()=>{this.changeDetectionScheduler.runningTick||this.zone.run(()=>{this.applicationRef.tick()})}}))}ngOnDestroy(){var n;(n=this._onMicrotaskEmptySubscription)==null||n.unsubscribe()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();function m6({ngZoneFactory:t,ignoreChangesOutsideZone:e,scheduleInRootZone:i}){return t??(t=()=>new me(U(M({},g6()),{scheduleInRootZone:i}))),[{provide:me,useFactory:t},{provide:sa,multi:!0,useFactory:()=>{let n=h(h6,{optional:!0});return()=>n.initialize()}},{provide:sa,multi:!0,useFactory:()=>{let n=h(y6);return()=>{n.initialize()}}},e===!0?{provide:pE,useValue:!0}:[],{provide:Dg,useValue:i??fE}]}function g6(t){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:(t==null?void 0:t.eventCoalescing)??!1,shouldCoalesceRunChangeDetection:(t==null?void 0:t.runCoalescing)??!1}}var y6=(()=>{let e=class e{constructor(){d(this,"subscription",new Ut);d(this,"initialized",!1);d(this,"zone",h(me));d(this,"pendingTasks",h(va))}initialize(){if(this.initialized)return;this.initialized=!0;let n=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(n=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{me.assertNotInAngularZone(),queueMicrotask(()=>{n!==null&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(n),n=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{me.assertInAngularZone(),n??(n=this.pendingTasks.add())}))}ngOnDestroy(){this.subscription.unsubscribe()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var yT=(()=>{var e;let i=class i{constructor(){d(this,"appRef",h(vr));d(this,"taskService",h(va));d(this,"ngZone",h(me));d(this,"zonelessEnabled",h(jd));d(this,"tracing",h($d,{optional:!0}));d(this,"disableScheduling",h(pE,{optional:!0})??!1);d(this,"zoneIsDefined",typeof Zone<"u"&&!!Zone.root.run);d(this,"schedulerTickApplyArgs",[{data:{__scheduler_tick__:!0}}]);d(this,"subscriptions",new Ut);d(this,"angularZoneId",this.zoneIsDefined?(e=this.ngZone._inner)==null?void 0:e.get(fd):null);d(this,"scheduleInRootZone",!this.zonelessEnabled&&this.zoneIsDefined&&(h(Dg,{optional:!0})??!1));d(this,"cancelScheduledCallback",null);d(this,"useMicrotaskScheduler",!1);d(this,"runningTick",!1);d(this,"pendingRenderTaskId",null);this.subscriptions.add(this.appRef.afterTick.subscribe(()=>{this.runningTick||this.cleanup()})),this.subscriptions.add(this.ngZone.onUnstable.subscribe(()=>{this.runningTick||this.cleanup()})),this.disableScheduling||(this.disableScheduling=!this.zonelessEnabled&&(this.ngZone instanceof pd||!this.zoneIsDefined))}notify(r){var a;if(!this.zonelessEnabled&&r===5)return;let o=!1;switch(r){case 0:{this.appRef.dirtyFlags|=2;break}case 3:case 2:case 4:case 5:case 1:{this.appRef.dirtyFlags|=4;break}case 8:{this.appRef.deferredDirtyFlags|=8;break}case 6:{this.appRef.dirtyFlags|=2,o=!0;break}case 13:{this.appRef.dirtyFlags|=16,o=!0;break}case 14:{this.appRef.dirtyFlags|=2,o=!0;break}case 12:{o=!0;break}case 10:case 9:case 7:case 11:default:this.appRef.dirtyFlags|=8}if(this.appRef.tracingSnapshot=((a=this.tracing)==null?void 0:a.snapshot(this.appRef.tracingSnapshot))??null,!this.shouldScheduleTick(o))return;let s=this.useMicrotaskScheduler?AC:hE;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>s(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>s(()=>this.tick()))}shouldScheduleTick(r){return!(this.disableScheduling&&!r||this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(fd+this.angularZoneId))}tick(){if(this.runningTick||this.appRef.destroyed)return;if(this.appRef.dirtyFlags===0){this.cleanup();return}!this.zonelessEnabled&&this.appRef.dirtyFlags&7&&(this.appRef.dirtyFlags|=1);let r=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(o){throw this.taskService.remove(r),o}finally{this.cleanup()}this.useMicrotaskScheduler=!0,AC(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(r)})}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){var r;if(this.runningTick=!1,(r=this.cancelScheduledCallback)==null||r.call(this),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let o=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(o)}}};d(i,"\u0275fac",function(o){return new(o||i)}),d(i,"\u0275prov",$({token:i,factory:i.\u0275fac,providedIn:"root"}));let t=i;return t})();function rte(){return bi("NgZoneless"),Gu([{provide:Co,useExisting:yT},{provide:me,useClass:pd},{provide:jd,useValue:!0},{provide:Dg,useValue:!1},[]])}function v6(){return typeof $localize<"u"&&$localize.locale||Ad}var tl=new k("",{providedIn:"root",factory:()=>h(tl,Be.Optional|Be.SkipSelf)||v6()});var q0=new k("");function Wc(t){return!t.moduleRef}function b6(t){let e=Wc(t)?t.r3Injector:t.moduleRef.injector,i=e.get(me);return i.run(()=>{Wc(t)?t.r3Injector.resolveInjectorInitializers():t.moduleRef.resolveInjectorInitializers();let n=e.get(pr,null),r;if(i.runOutsideAngular(()=>{r=i.onError.subscribe({next:o=>{n.handleError(o)}})}),Wc(t)){let o=()=>e.destroy(),s=t.platformInjector.get(q0);s.add(o),e.onDestroy(()=>{r.unsubscribe(),s.delete(o)})}else{let o=()=>t.moduleRef.destroy(),s=t.platformInjector.get(q0);s.add(o),t.moduleRef.onDestroy(()=>{Qc(t.allPlatformModules,t.moduleRef),r.unsubscribe(),s.delete(o)})}return gL(n,i,()=>{let o=e.get(Jw);return o.runInitializers(),o.donePromise.then(()=>{let s=e.get(tl,Ad);if(QL(s||Ad),Wc(t)){let a=e.get(vr);return t.rootComponent!==void 0&&a.bootstrap(t.rootComponent),a}else return _6(t.moduleRef,t.allPlatformModules),t.moduleRef})})})}function _6(t,e){let i=t.injector.get(vr);if(t._bootstrapComponents.length>0)t._bootstrapComponents.forEach(n=>i.bootstrap(n));else if(t.instance.ngDoBootstrap)t.instance.ngDoBootstrap(i);else throw new j(-403,!1);e.push(t)}var Xc=null;function C6(t=[],e){return Wn.create({name:e,providers:[{provide:Fd,useValue:"platform"},{provide:q0,useValue:new Set([()=>Xc=null])},...t]})}function D6(t=[]){if(Xc)return Xc;let e=C6(t);return Xc=e,pL(),E6(e),e}function E6(t){let e=t.get(Tg,null);lg(t,()=>{e==null||e.forEach(i=>i())})}var st=(()=>{class t{}return d(t,"__NG_ELEMENT_ID__",w6),t})();function w6(t){return T6(dn(),pe(),(t&16)===16)}function T6(t,e,i){if(Wu(t)&&!i){let n=wo(t.index,e);return new cs(n,n)}else if(t.type&175){let n=e[kn];return new cs(n,e)}return null}var Z0=class{constructor(){}supports(e){return Ww(e)}create(e){return new K0(e)}},x6=(t,e)=>e,K0=class{constructor(e){d(this,"length",0);d(this,"collection");d(this,"_linkedRecords",null);d(this,"_unlinkedRecords",null);d(this,"_previousItHead",null);d(this,"_itHead",null);d(this,"_itTail",null);d(this,"_additionsHead",null);d(this,"_additionsTail",null);d(this,"_movesHead",null);d(this,"_movesTail",null);d(this,"_removalsHead",null);d(this,"_removalsTail",null);d(this,"_identityChangesHead",null);d(this,"_identityChangesTail",null);d(this,"_trackByFn");this._trackByFn=e||x6}forEachItem(e){let i;for(i=this._itHead;i!==null;i=i._next)e(i)}forEachOperation(e){let i=this._itHead,n=this._removalsHead,r=0,o=null;for(;i||n;){let s=!n||i&&i.currentIndex{s=this._trackByFn(r,a),i===null||!Object.is(i.trackById,s)?(i=this._mismatch(i,a,s,r),n=!0):(n&&(i=this._verifyReinsertion(i,a,s,r)),Object.is(i.item,a)||this._addIdentityChange(i,a)),i=i._next,r++}),this.length=r;return this._truncate(i),this.collection=e,this.isDirty}get isDirty(){return this._additionsHead!==null||this._movesHead!==null||this._removalsHead!==null||this._identityChangesHead!==null}_reset(){if(this.isDirty){let e;for(e=this._previousItHead=this._itHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._additionsHead;e!==null;e=e._nextAdded)e.previousIndex=e.currentIndex;for(this._additionsHead=this._additionsTail=null,e=this._movesHead;e!==null;e=e._nextMoved)e.previousIndex=e.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(e,i,n,r){let o;return e===null?o=this._itTail:(o=e._prev,this._remove(e)),e=this._unlinkedRecords===null?null:this._unlinkedRecords.get(n,null),e!==null?(Object.is(e.item,i)||this._addIdentityChange(e,i),this._reinsertAfter(e,o,r)):(e=this._linkedRecords===null?null:this._linkedRecords.get(n,r),e!==null?(Object.is(e.item,i)||this._addIdentityChange(e,i),this._moveAfter(e,o,r)):e=this._addAfter(new Y0(i,n),o,r)),e}_verifyReinsertion(e,i,n,r){let o=this._unlinkedRecords===null?null:this._unlinkedRecords.get(n,null);return o!==null?e=this._reinsertAfter(o,e._prev,r):e.currentIndex!=r&&(e.currentIndex=r,this._addToMoves(e,r)),e}_truncate(e){for(;e!==null;){let i=e._next;this._addToRemovals(this._unlink(e)),e=i}this._unlinkedRecords!==null&&this._unlinkedRecords.clear(),this._additionsTail!==null&&(this._additionsTail._nextAdded=null),this._movesTail!==null&&(this._movesTail._nextMoved=null),this._itTail!==null&&(this._itTail._next=null),this._removalsTail!==null&&(this._removalsTail._nextRemoved=null),this._identityChangesTail!==null&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(e,i,n){this._unlinkedRecords!==null&&this._unlinkedRecords.remove(e);let r=e._prevRemoved,o=e._nextRemoved;return r===null?this._removalsHead=o:r._nextRemoved=o,o===null?this._removalsTail=r:o._prevRemoved=r,this._insertAfter(e,i,n),this._addToMoves(e,n),e}_moveAfter(e,i,n){return this._unlink(e),this._insertAfter(e,i,n),this._addToMoves(e,n),e}_addAfter(e,i,n){return this._insertAfter(e,i,n),this._additionsTail===null?this._additionsTail=this._additionsHead=e:this._additionsTail=this._additionsTail._nextAdded=e,e}_insertAfter(e,i,n){let r=i===null?this._itHead:i._next;return e._next=r,e._prev=i,r===null?this._itTail=e:r._prev=e,i===null?this._itHead=e:i._next=e,this._linkedRecords===null&&(this._linkedRecords=new kd),this._linkedRecords.put(e),e.currentIndex=n,e}_remove(e){return this._addToRemovals(this._unlink(e))}_unlink(e){this._linkedRecords!==null&&this._linkedRecords.remove(e);let i=e._prev,n=e._next;return i===null?this._itHead=n:i._next=n,n===null?this._itTail=i:n._prev=i,e}_addToMoves(e,i){return e.previousIndex===i||(this._movesTail===null?this._movesTail=this._movesHead=e:this._movesTail=this._movesTail._nextMoved=e),e}_addToRemovals(e){return this._unlinkedRecords===null&&(this._unlinkedRecords=new kd),this._unlinkedRecords.put(e),e.currentIndex=null,e._nextRemoved=null,this._removalsTail===null?(this._removalsTail=this._removalsHead=e,e._prevRemoved=null):(e._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=e),e}_addIdentityChange(e,i){return e.item=i,this._identityChangesTail===null?this._identityChangesTail=this._identityChangesHead=e:this._identityChangesTail=this._identityChangesTail._nextIdentityChange=e,e}},Y0=class{constructor(e,i){d(this,"item");d(this,"trackById");d(this,"currentIndex",null);d(this,"previousIndex",null);d(this,"_nextPrevious",null);d(this,"_prev",null);d(this,"_next",null);d(this,"_prevDup",null);d(this,"_nextDup",null);d(this,"_prevRemoved",null);d(this,"_nextRemoved",null);d(this,"_nextAdded",null);d(this,"_nextMoved",null);d(this,"_nextIdentityChange",null);this.item=e,this.trackById=i}},Q0=class{constructor(){d(this,"_head",null);d(this,"_tail",null)}add(e){this._head===null?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)}get(e,i){let n;for(n=this._head;n!==null;n=n._nextDup)if((i===null||i<=n.currentIndex)&&Object.is(n.trackById,e))return n;return null}remove(e){let i=e._prevDup,n=e._nextDup;return i===null?this._head=n:i._nextDup=n,n===null?this._tail=i:n._prevDup=i,this._head===null}},kd=class{constructor(){d(this,"map",new Map)}put(e){let i=e.trackById,n=this.map.get(i);n||(n=new Q0,this.map.set(i,n)),n.add(e)}get(e,i){let n=e,r=this.map.get(n);return r?r.get(e,i):null}remove(e){let i=e.trackById;return this.map.get(i).remove(e)&&this.map.delete(i),e}get isEmpty(){return this.map.size===0}clear(){this.map.clear()}};function lD(t,e,i){let n=t.previousIndex;if(n===null)return n;let r=0;return i&&n{if(i&&i.key===r)this._maybeAddToChanges(i,n),this._appendAfter=i,i=i._next;else{let o=this._getOrCreateRecordForKey(r,n);i=this._insertBeforeOrAppend(i,o)}}),i){i._prev&&(i._prev._next=null),this._removalsHead=i;for(let n=i;n!==null;n=n._nextRemoved)n===this._mapHead&&(this._mapHead=null),this._records.delete(n.key),n._nextRemoved=n._next,n.previousValue=n.currentValue,n.currentValue=null,n._prev=null,n._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(e,i){if(e){let n=e._prev;return i._next=e,i._prev=n,e._prev=i,n&&(n._next=i),e===this._mapHead&&(this._mapHead=i),this._appendAfter=e,e}return this._appendAfter?(this._appendAfter._next=i,i._prev=this._appendAfter):this._mapHead=i,this._appendAfter=i,null}_getOrCreateRecordForKey(e,i){if(this._records.has(e)){let r=this._records.get(e);this._maybeAddToChanges(r,i);let o=r._prev,s=r._next;return o&&(o._next=s),s&&(s._prev=o),r._next=null,r._prev=null,r}let n=new eg(e);return this._records.set(e,n),n.currentValue=i,this._addToAdditions(n),n}_reset(){if(this.isDirty){let e;for(this._previousMapHead=this._mapHead,e=this._previousMapHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._changesHead;e!==null;e=e._nextChanged)e.previousValue=e.currentValue;for(e=this._additionsHead;e!=null;e=e._nextAdded)e.previousValue=e.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(e,i){Object.is(i,e.currentValue)||(e.previousValue=e.currentValue,e.currentValue=i,this._addToChanges(e))}_addToAdditions(e){this._additionsHead===null?this._additionsHead=this._additionsTail=e:(this._additionsTail._nextAdded=e,this._additionsTail=e)}_addToChanges(e){this._changesHead===null?this._changesHead=this._changesTail=e:(this._changesTail._nextChanged=e,this._changesTail=e)}_forEach(e,i){e instanceof Map?e.forEach(i):Object.keys(e).forEach(n=>i(e[n],n))}},eg=class{constructor(e){d(this,"key");d(this,"previousValue",null);d(this,"currentValue",null);d(this,"_nextPrevious",null);d(this,"_next",null);d(this,"_prev",null);d(this,"_nextAdded",null);d(this,"_nextRemoved",null);d(this,"_nextChanged",null);this.key=e}};function cD(){return new iy([new Z0])}var iy=(()=>{let e=class e{constructor(n){d(this,"factories");this.factories=n}static create(n,r){if(r!=null){let o=r.factories.slice();n=n.concat(o)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||cD()),deps:[[e,new qr,new qn]]}}find(n){let r=this.factories.find(o=>o.supports(n));if(r!=null)return r;throw new j(901,!1)}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:cD}));let t=e;return t})();function dD(){return new ff([new X0])}var ff=(()=>{let e=class e{constructor(n){d(this,"factories");this.factories=n}static create(n,r){if(r){let o=r.factories.slice();n=n.concat(o)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||dD()),deps:[[e,new qr,new qn]]}}find(n){let r=this.factories.find(o=>o.supports(n));if(r)return r;throw new j(901,!1)}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:dD}));let t=e;return t})();function vT(t){try{let{rootComponent:e,appProviders:i,platformProviders:n}=t,r=D6(n),o=[m6({}),{provide:Co,useExisting:yT},...i||[]],s=new wd({providers:o,parent:r,debugName:"",runEnvironmentInitializers:!1});return b6({r3Injector:s.injector,platformInjector:r,rootComponent:e})}catch(e){return Promise.reject(e)}}var fD=!1;function I6(){fD||(fD=!0,cP(),WL(),r6(),KL(),dL(),LR(),_R(),bF())}function S6(t,e){return t.whenStable()}function bT(){let t=[{provide:Vc,useFactory:()=>{let e=!0;{let i=h(_a,{optional:!0});e=!!(i!=null&&i.get(kE,null))}return e&&bi("NgHydration"),e}},{provide:sa,useValue:()=>{pR(!1),h(Vc)&&(M6(),I6())},multi:!0}];return t.push({provide:ME,useFactory:()=>h(Vc)},{provide:lf,useFactory:()=>{if(h(Vc)){let e=h(vr),i=h(Wn);return()=>{S6(e,i).then(()=>{yR(e)})}}return()=>{}},multi:!0}),Gu(t)}function M6(){var i;let t=Ku(),e;for(let n of t.body.childNodes)if(n.nodeType===Node.COMMENT_NODE&&((i=n.textContent)==null?void 0:i.trim())===uP){e=n;break}if(!e)throw new j(-507,!1)}function pf(t){return typeof t=="boolean"?t:t!=null&&t!=="false"}function Pt(t,e){bi("NgSignals");let i=R1(t);return e!=null&&e.equal&&(i[zn].equal=e.equal),i}function Gi(t){let e=Ue(null);try{return t()}finally{Ue(e)}}var _T=(()=>{class t{constructor(i,n){d(this,"view");d(this,"node");this.view=i,this.node=n}}return d(t,"__NG_ELEMENT_ID__",A6),t})();function A6(){return new _T(pe(),dn())}var k6=!1,O6=(()=>{let e=class e extends xd{constructor(){super(...arguments);d(this,"pendingTasks",h(va));d(this,"taskId",null)}schedule(r){super.schedule(r),this.taskId===null&&(this.taskId=this.pendingTasks.add(),queueMicrotask(()=>this.flush()))}flush(){try{super.flush()}finally{this.taskId!==null&&(this.pendingTasks.remove(this.taskId),this.taskId=null)}}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})(),tg=class{constructor(e,i,n,r,o,s){d(this,"scheduler");d(this,"effectFn");d(this,"zone");d(this,"injector");d(this,"unregisterOnDestroy");d(this,"watcher");this.scheduler=e,this.effectFn=i,this.zone=n,this.injector=o,this.watcher=j1(a=>this.runEffect(a),()=>this.schedule(),s),this.unregisterOnDestroy=r==null?void 0:r.onDestroy(()=>this.destroy())}runEffect(e){try{this.effectFn(e)}catch(i){let n=this.injector.get(pr,null,{optional:!0});n==null||n.handleError(i)}}run(){this.watcher.run()}schedule(){this.scheduler.schedule(this)}destroy(){var e;this.watcher.destroy(),(e=this.unregisterOnDestroy)==null||e.call(this)}};function N6(){}function CT(t,e){var s;bi("NgSignals"),!(e!=null&&e.injector)&&ha(N6);let i=(e==null?void 0:e.injector)??h(Wn),n=(e==null?void 0:e.manualCleanup)!==!0?i.get(it):null,r=new tg(i.get(O6),t,typeof Zone>"u"?null:Zone.current,n,i,(e==null?void 0:e.allowSignalWrites)??!1),o=i.get(st,null,{optional:!0});return!o||!(o._lView[fe]&8)?r.watcher.notify():((s=o._lView)[ra]??(s[ra]=[])).push(r.watcher.notify),r}var P6=k6;var hD;hD=zn;var ng=class{constructor(e){d(this,hD);this[zn]=e}destroy(){this[zn].destroy()}};function Io(t,e){if(P6)return CT(t,e);bi("NgSignals"),!(e!=null&&e.injector)&&ha(Io);let i=(e==null?void 0:e.injector)??h(Wn),n=(e==null?void 0:e.manualCleanup)!==!0?i.get(it):null,r,o=i.get(_T,null,{optional:!0}),s=i.get(Co);return o!==null&&!(e!=null&&e.forceRoot)?(r=L6(o.view,s,t),n instanceof dd&&n._lView===o.view&&(n=null)):r=H6(t,i.get(eT),s),r.injector=i,n!==null&&(r.onDestroyFn=n.onDestroy(()=>r.destroy())),new ng(r)}var DT=U(M({},Zo),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,hasRun:!1,cleanupFns:void 0,zone:null,onDestroyFn:Fu,run(){if(this.dirty=!1,this.hasRun&&!yu(this))return;this.hasRun=!0;let t=n=>(this.cleanupFns??(this.cleanupFns=[])).push(n),e=js(this),i=sd(!1);try{this.maybeCleanup(),this.fn(t)}finally{sd(i),gu(this,e)}},maybeCleanup(){var t;if((t=this.cleanupFns)!=null&&t.length)try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[]}}}),F6=U(M({},DT),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(13)},destroy(){Us(this),this.onDestroyFn(),this.maybeCleanup()}}),R6=U(M({},DT),{consumerMarkedDirty(){this.view[fe]|=8192,qu(this.view),this.notifier.notify(14)},destroy(){var t;Us(this),this.onDestroyFn(),this.maybeCleanup(),(t=this.view[Br])==null||t.delete(this)}});function L6(t,e,i){let n=Object.create(R6);return n.view=t,n.zone=typeof Zone<"u"?Zone.current:null,n.notifier=e,n.fn=i,t[Br]??(t[Br]=new Set),t[Br].add(n),n.consumerMarkedDirty(n),n}function H6(t,e,i){let n=Object.create(F6);return n.fn=t,n.scheduler=e,n.notifier=i,n.zone=typeof Zone<"u"?Zone.current:null,n.scheduler.schedule(n),n.notifier.notify(13),n}function ET(t,e){let i=bo(t),n=e.elementInjector||Rd();return new da(i).create(n,e.projectableNodes,e.hostElement,e.environmentInjector)}function Se(t){t||(ha(Se),t=h(it));let e=new te(i=>t.onDestroy(i.next.bind(i)));return i=>i.pipe(Kt(e))}function Cn(t,e){var a;let i=!(e!=null&&e.manualCleanup);i&&!(e!=null&&e.injector)&&ha(Cn);let n=i?((a=e==null?void 0:e.injector)==null?void 0:a.get(it))??h(it):null,r=B6(e==null?void 0:e.equal),o;e!=null&&e.requireSync?o=ge({kind:0},{equal:r}):o=ge({kind:1,value:e==null?void 0:e.initialValue},{equal:r});let s=t.subscribe({next:u=>o.set({kind:1,value:u}),error:u=>{if(e!=null&&e.rejectErrors)throw u;o.set({kind:2,error:u})}});if(e!=null&&e.requireSync&&o().kind===0)throw new j(601,!1);return n==null||n.onDestroy(s.unsubscribe.bind(s)),Pt(()=>{let u=o();switch(u.kind){case 1:return u.value;case 2:throw u.error;case 0:throw new j(601,!1)}},{equal:e==null?void 0:e.equal})}function B6(t=Object.is){return(e,i)=>e.kind===1&&i.kind===1&&t(e.value,i.value)}var kT=null;function br(){return kT}function OT(t){kT??(kT=t)}var hf=class{};var qe=new k(""),NT=(()=>{let e=class e{historyGo(n){throw new Error("")}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:()=>h(V6),providedIn:"platform"}));let t=e;return t})();var V6=(()=>{let e=class e extends NT{constructor(){super();d(this,"_location");d(this,"_history");d(this,"_doc",h(qe));this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return br().getBaseHref(this._doc)}onPopState(r){let o=br().getGlobalEventTarget(this._doc,"window");return o.addEventListener("popstate",r,!1),()=>o.removeEventListener("popstate",r)}onHashChange(r){let o=br().getGlobalEventTarget(this._doc,"window");return o.addEventListener("hashchange",r,!1),()=>o.removeEventListener("hashchange",r)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(r){this._location.pathname=r}pushState(r,o,s){this._history.pushState(r,o,s)}replaceState(r,o,s){this._history.replaceState(r,o,s)}forward(){this._history.forward()}back(){this._history.back()}historyGo(r=0){this._history.go(r)}getState(){return this._history.state}};d(e,"\u0275fac",function(o){return new(o||e)}),d(e,"\u0275prov",$({token:e,factory:()=>new e,providedIn:"platform"}));let t=e;return t})();function PT(t,e){if(t.length==0)return e;if(e.length==0)return t;let i=0;return t.endsWith("/")&&i++,e.startsWith("/")&&i++,i==2?t+e.substring(1):i==1?t+e:t+"/"+e}function wT(t){let e=t.match(/#|\?|$/),i=e&&e.index||t.length,n=i-(t[i-1]==="/"?1:0);return t.slice(0,n)+t.slice(i)}function gs(t){return t&&t[0]!=="?"?"?"+t:t}var ly=(()=>{let e=class e{historyGo(n){throw new Error("")}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:()=>h(j6),providedIn:"root"}));let t=e;return t})(),z6=new k(""),j6=(()=>{let e=class e extends ly{constructor(r,o){var s;super();d(this,"_platformLocation");d(this,"_baseHref");d(this,"_removeListenerFns",[]);this._platformLocation=r,this._baseHref=o??this._platformLocation.getBaseHrefFromDOM()??((s=h(qe).location)==null?void 0:s.origin)??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(r){this._removeListenerFns.push(this._platformLocation.onPopState(r),this._platformLocation.onHashChange(r))}getBaseHref(){return this._baseHref}prepareExternalUrl(r){return PT(this._baseHref,r)}path(r=!1){let o=this._platformLocation.pathname+gs(this._platformLocation.search),s=this._platformLocation.hash;return s&&r?`${o}${s}`:o}pushState(r,o,s,a){let u=this.prepareExternalUrl(s+gs(a));this._platformLocation.pushState(r,o,u)}replaceState(r,o,s,a){let u=this.prepareExternalUrl(s+gs(a));this._platformLocation.replaceState(r,o,u)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(r=0){var o,s;(s=(o=this._platformLocation).historyGo)==null||s.call(o,r)}};d(e,"\u0275fac",function(o){return new(o||e)($e(NT),$e(z6,8))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var U6=(()=>{let e=class e{constructor(n){d(this,"_subject",new tt);d(this,"_basePath");d(this,"_locationStrategy");d(this,"_urlChangeListeners",[]);d(this,"_urlChangeSubscription",null);this._locationStrategy=n;let r=this._locationStrategy.getBaseHref();this._basePath=W6(wT(TT(r))),this._locationStrategy.onPopState(o=>{this._subject.next({url:this.path(!0),pop:!0,state:o.state,type:o.type})})}ngOnDestroy(){var n;(n=this._urlChangeSubscription)==null||n.unsubscribe(),this._urlChangeListeners=[]}path(n=!1){return this.normalize(this._locationStrategy.path(n))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(n,r=""){return this.path()==this.normalize(n+gs(r))}normalize(n){return e.stripTrailingSlash(G6(this._basePath,TT(n)))}prepareExternalUrl(n){return n&&n[0]!=="/"&&(n="/"+n),this._locationStrategy.prepareExternalUrl(n)}go(n,r="",o=null){this._locationStrategy.pushState(o,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+gs(r)),o)}replaceState(n,r="",o=null){this._locationStrategy.replaceState(o,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+gs(r)),o)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(n=0){var r,o;(o=(r=this._locationStrategy).historyGo)==null||o.call(r,n)}onUrlChange(n){return this._urlChangeListeners.push(n),this._urlChangeSubscription??(this._urlChangeSubscription=this.subscribe(r=>{this._notifyUrlChangeListeners(r.url,r.state)})),()=>{var o;let r=this._urlChangeListeners.indexOf(n);this._urlChangeListeners.splice(r,1),this._urlChangeListeners.length===0&&((o=this._urlChangeSubscription)==null||o.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(n="",r){this._urlChangeListeners.forEach(o=>o(n,r))}subscribe(n,r,o){return this._subject.subscribe({next:n,error:r??void 0,complete:o??void 0})}};d(e,"normalizeQueryParams",gs),d(e,"joinWithSlash",PT),d(e,"stripTrailingSlash",wT),d(e,"\u0275fac",function(r){return new(r||e)($e(ly))}),d(e,"\u0275prov",$({token:e,factory:()=>$6(),providedIn:"root"}));let t=e;return t})();function $6(){return new U6($e(ly))}function G6(t,e){if(!t||!e.startsWith(t))return e;let i=e.substring(t.length);return i===""||["/",";","?","#"].includes(i[0])?i:e}function TT(t){return t.replace(/\/index.html$/,"")}function W6(t){if(new RegExp("^(https?:)?//").test(t)){let[,i]=t.split(/\/\/[^\/]+/);return i}return t}function cy(t,e){e=encodeURIComponent(e);for(let i of t.split(";")){let n=i.indexOf("="),[r,o]=n==-1?[i,""]:[i.slice(0,n),i.slice(n+1)];if(r.trim()===e)return decodeURIComponent(o)}return null}var ry=/\s+/,xT=[],FT=(()=>{let e=class e{constructor(n,r){d(this,"_ngEl");d(this,"_renderer");d(this,"initialClasses",xT);d(this,"rawClass");d(this,"stateMap",new Map);this._ngEl=n,this._renderer=r}set klass(n){this.initialClasses=n!=null?n.trim().split(ry):xT}set ngClass(n){this.rawClass=typeof n=="string"?n.trim().split(ry):n}ngDoCheck(){for(let r of this.initialClasses)this._updateState(r,!0);let n=this.rawClass;if(Array.isArray(n)||n instanceof Set)for(let r of n)this._updateState(r,!0);else if(n!=null)for(let r of Object.keys(n))this._updateState(r,!!n[r]);this._applyStateDiff()}_updateState(n,r){let o=this.stateMap.get(n);o!==void 0?(o.enabled!==r&&(o.changed=!0,o.enabled=r),o.touched=!0):this.stateMap.set(n,{enabled:r,changed:!0,touched:!0})}_applyStateDiff(){for(let n of this.stateMap){let r=n[0],o=n[1];o.changed?(this._toggleClass(r,o.enabled),o.changed=!1):o.touched||(o.enabled&&this._toggleClass(r,!1),this.stateMap.delete(r)),o.touched=!1}}_toggleClass(n,r){n=n.trim(),n.length>0&&n.split(ry).forEach(o=>{r?this._renderer.addClass(this._ngEl.nativeElement,o):this._renderer.removeClass(this._ngEl.nativeElement,o)})}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(de),Ge(oi))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}}));let t=e;return t})(),Lte=(()=>{let e=class e{constructor(n){d(this,"_viewContainerRef");d(this,"ngComponentOutlet",null);d(this,"ngComponentOutletInputs");d(this,"ngComponentOutletInjector");d(this,"ngComponentOutletContent");d(this,"ngComponentOutletNgModule");d(this,"ngComponentOutletNgModuleFactory");d(this,"_componentRef");d(this,"_moduleRef");d(this,"_inputsUsed",new Map);this._viewContainerRef=n}_needToReCreateNgModuleInstance(n){return n.ngComponentOutletNgModule!==void 0||n.ngComponentOutletNgModuleFactory!==void 0}_needToReCreateComponentInstance(n){return n.ngComponentOutlet!==void 0||n.ngComponentOutletContent!==void 0||n.ngComponentOutletInjector!==void 0||this._needToReCreateNgModuleInstance(n)}ngOnChanges(n){var r;if(this._needToReCreateComponentInstance(n)&&(this._viewContainerRef.clear(),this._inputsUsed.clear(),this._componentRef=void 0,this.ngComponentOutlet)){let o=this.ngComponentOutletInjector||this._viewContainerRef.parentInjector;this._needToReCreateNgModuleInstance(n)&&((r=this._moduleRef)==null||r.destroy(),this.ngComponentOutletNgModule?this._moduleRef=jw(this.ngComponentOutletNgModule,IT(o)):this.ngComponentOutletNgModuleFactory?this._moduleRef=this.ngComponentOutletNgModuleFactory.create(IT(o)):this._moduleRef=void 0),this._componentRef=this._viewContainerRef.createComponent(this.ngComponentOutlet,{injector:o,ngModuleRef:this._moduleRef,projectableNodes:this.ngComponentOutletContent})}}ngDoCheck(){if(this._componentRef){if(this.ngComponentOutletInputs)for(let n of Object.keys(this.ngComponentOutletInputs))this._inputsUsed.set(n,!0);this._applyInputStateDiff(this._componentRef)}}ngOnDestroy(){var n;(n=this._moduleRef)==null||n.destroy()}_applyInputStateDiff(n){for(let[r,o]of this._inputsUsed)o?(n.setInput(r,this.ngComponentOutletInputs[r]),this._inputsUsed.set(r,!1)):(n.setInput(r,void 0),this._inputsUsed.delete(r))}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngComponentOutlet",""]],inputs:{ngComponentOutlet:"ngComponentOutlet",ngComponentOutletInputs:"ngComponentOutletInputs",ngComponentOutletInjector:"ngComponentOutletInjector",ngComponentOutletContent:"ngComponentOutletContent",ngComponentOutletNgModule:"ngComponentOutletNgModule",ngComponentOutletNgModuleFactory:"ngComponentOutletNgModuleFactory"},features:[Yt]}));let t=e;return t})();function IT(t){return t.get(Wr).injector}var oy=class{constructor(e,i,n,r){d(this,"$implicit");d(this,"ngForOf");d(this,"index");d(this,"count");this.$implicit=e,this.ngForOf=i,this.index=n,this.count=r}get first(){return this.index===0}get last(){return this.index===this.count-1}get even(){return this.index%2===0}get odd(){return!this.even}},Ci=(()=>{let e=class e{constructor(n,r,o){d(this,"_viewContainer");d(this,"_template");d(this,"_differs");d(this,"_ngForOf",null);d(this,"_ngForOfDirty",!0);d(this,"_differ",null);d(this,"_trackByFn");this._viewContainer=n,this._template=r,this._differs=o}set ngForOf(n){this._ngForOf=n,this._ngForOfDirty=!0}set ngForTrackBy(n){this._trackByFn=n}get ngForTrackBy(){return this._trackByFn}set ngForTemplate(n){n&&(this._template=n)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;let n=this._ngForOf;if(!this._differ&&n)if(0)try{}catch{}else this._differ=this._differs.find(n).create(this.ngForTrackBy)}if(this._differ){let n=this._differ.diff(this._ngForOf);n&&this._applyChanges(n)}}_applyChanges(n){let r=this._viewContainer;n.forEachOperation((o,s,a)=>{if(o.previousIndex==null)r.createEmbeddedView(this._template,new oy(o.item,this._ngForOf,-1,-1),a===null?void 0:a);else if(a==null)r.remove(s===null?void 0:s);else if(s!==null){let u=r.get(s);r.move(u,a),ST(u,o)}});for(let o=0,s=r.length;o{let s=r.get(o.currentIndex);ST(s,o)})}static ngTemplateContextGuard(n,r){return!0}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt),Ge(It),Ge(iy))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}}));let t=e;return t})();function ST(t,e){t.context.$implicit=e.item}var ut=(()=>{let e=class e{constructor(n,r){d(this,"_viewContainer");d(this,"_context",new sy);d(this,"_thenTemplateRef",null);d(this,"_elseTemplateRef",null);d(this,"_thenViewRef",null);d(this,"_elseViewRef",null);this._viewContainer=n,this._thenTemplateRef=r}set ngIf(n){this._context.$implicit=this._context.ngIf=n,this._updateView()}set ngIfThen(n){MT("ngIfThen",n),this._thenTemplateRef=n,this._thenViewRef=null,this._updateView()}set ngIfElse(n){MT("ngIfElse",n),this._elseTemplateRef=n,this._elseViewRef=null,this._updateView()}_updateView(){this._context.$implicit?this._thenViewRef||(this._viewContainer.clear(),this._elseViewRef=null,this._thenTemplateRef&&(this._thenViewRef=this._viewContainer.createEmbeddedView(this._thenTemplateRef,this._context))):this._elseViewRef||(this._viewContainer.clear(),this._thenViewRef=null,this._elseTemplateRef&&(this._elseViewRef=this._viewContainer.createEmbeddedView(this._elseTemplateRef,this._context)))}static ngTemplateContextGuard(n,r){return!0}};d(e,"ngIfUseIfTypeGuard"),d(e,"ngTemplateGuard_ngIf"),d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt),Ge(It))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}}));let t=e;return t})(),sy=class{constructor(){d(this,"$implicit",null);d(this,"ngIf",null)}};function MT(t,e){if(!!!(!e||e.createEmbeddedView))throw new Error(`${t} must be a TemplateRef, but received '${Mn(e)}'.`)}var RT=(()=>{let e=class e{constructor(n,r,o){d(this,"_ngEl");d(this,"_differs");d(this,"_renderer");d(this,"_ngStyle",null);d(this,"_differ",null);this._ngEl=n,this._differs=r,this._renderer=o}set ngStyle(n){this._ngStyle=n,!this._differ&&n&&(this._differ=this._differs.find(n).create())}ngDoCheck(){if(this._differ){let n=this._differ.diff(this._ngStyle);n&&this._applyChanges(n)}}_setStyle(n,r){let[o,s]=n.split("."),a=o.indexOf("-")===-1?void 0:mr.DashCase;r!=null?this._renderer.setStyle(this._ngEl.nativeElement,o,s?`${r}${s}`:r,a):this._renderer.removeStyle(this._ngEl.nativeElement,o,a)}_applyChanges(n){n.forEachRemovedItem(r=>this._setStyle(r.key,null)),n.forEachAddedItem(r=>this._setStyle(r.key,r.currentValue)),n.forEachChangedItem(r=>this._setStyle(r.key,r.currentValue))}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(de),Ge(ff),Ge(oi))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}}));let t=e;return t})(),LT=(()=>{let e=class e{constructor(n){d(this,"_viewContainerRef");d(this,"_viewRef",null);d(this,"ngTemplateOutletContext",null);d(this,"ngTemplateOutlet",null);d(this,"ngTemplateOutletInjector",null);this._viewContainerRef=n}ngOnChanges(n){if(this._shouldRecreateView(n)){let r=this._viewContainerRef;if(this._viewRef&&r.remove(r.indexOf(this._viewRef)),!this.ngTemplateOutlet){this._viewRef=null;return}let o=this._createContextForwardProxy();this._viewRef=r.createEmbeddedView(this.ngTemplateOutlet,o,{injector:this.ngTemplateOutletInjector??void 0})}}_shouldRecreateView(n){return!!n.ngTemplateOutlet||!!n.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(n,r,o)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,r,o):!1,get:(n,r,o)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,r,o)}})}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[Yt]}));let t=e;return t})();function HT(t,e){return new j(2100,!1)}var ay=class{createSubscription(e,i){return Gi(()=>e.subscribe({next:i,error:n=>{throw n}}))}dispose(e){Gi(()=>e.unsubscribe())}},uy=class{createSubscription(e,i){return e.then(i,n=>{throw n})}dispose(e){}},q6=new uy,Z6=new ay,Re=(()=>{let e=class e{constructor(n){d(this,"_ref");d(this,"_latestValue",null);d(this,"markForCheckOnValueUpdate",!0);d(this,"_subscription",null);d(this,"_obj",null);d(this,"_strategy",null);this._ref=n}ngOnDestroy(){this._subscription&&this._dispose(),this._ref=null}transform(n){if(!this._obj){if(n)try{this.markForCheckOnValueUpdate=!1,this._subscribe(n)}finally{this.markForCheckOnValueUpdate=!0}return this._latestValue}return n!==this._obj?(this._dispose(),this.transform(n)):this._latestValue}_subscribe(n){this._obj=n,this._strategy=this._selectStrategy(n),this._subscription=this._strategy.createSubscription(n,r=>this._updateLatestValue(n,r))}_selectStrategy(n){if(Da(n))return q6;if(Xg(n))return Z6;throw HT(e,n)}_dispose(){this._strategy.dispose(this._subscription),this._latestValue=null,this._subscription=null,this._obj=null}_updateLatestValue(n,r){var o;n===this._obj&&(this._latestValue=r,this.markForCheckOnValueUpdate&&((o=this._ref)==null||o.markForCheck()))}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(st,16))}),d(e,"\u0275pipe",$i({name:"async",type:e,pure:!1}));let t=e;return t})(),BT=(()=>{let e=class e{transform(n){if(n==null)return null;if(typeof n!="string")throw HT(e,n);return n.toLowerCase()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275pipe",$i({name:"lowercase",type:e,pure:!0}));let t=e;return t})();function K6(t,e){return{key:t,value:e}}var VT=(()=>{let e=class e{constructor(n){d(this,"differs");d(this,"differ");d(this,"keyValues",[]);d(this,"compareFn",AT);this.differs=n}transform(n,r=AT){if(!n||!(n instanceof Map)&&typeof n!="object")return null;this.differ??(this.differ=this.differs.find(n).create());let o=this.differ.diff(n),s=r!==this.compareFn;return o&&(this.keyValues=[],o.forEachItem(a=>{this.keyValues.push(K6(a.key,a.currentValue))})),(o||s)&&(r&&this.keyValues.sort(r),this.compareFn=r),this.keyValues}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(ff,16))}),d(e,"\u0275pipe",$i({name:"keyvalue",type:e,pure:!1}));let t=e;return t})();function AT(t,e){let i=t.key,n=e.key;if(i===n)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(i===null)return 1;if(n===null)return-1;if(typeof i=="string"&&typeof n=="string")return i{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",bn({type:e})),d(e,"\u0275inj",vn({}));let t=e;return t})(),dy="browser",Y6="server";function zT(t){return t===dy}function nl(t){return t===Y6}var mf=class{};var QT=(()=>{let e=class e{constructor(n,r){d(this,"_renderer");d(this,"_elementRef");d(this,"onChange",n=>{});d(this,"onTouched",()=>{});this._renderer=n,this._elementRef=r}setProperty(n,r){this._renderer.setProperty(this._elementRef.nativeElement,n,r)}registerOnTouched(n){this.onTouched=n}registerOnChange(n){this.onChange=n}setDisabledState(n){this.setProperty("disabled",n)}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(oi),Ge(de))}),d(e,"\u0275dir",T({type:e}));let t=e;return t})(),gy=(()=>{let e=class e extends QT{};d(e,"\u0275fac",(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})()),d(e,"\u0275dir",T({type:e,features:[oe]}));let t=e;return t})(),_f=new k(""),Q6={provide:_f,useExisting:vi(()=>X6),multi:!0},X6=(()=>{let e=class e extends gy{writeValue(n){this.setProperty("checked",n)}};d(e,"\u0275fac",(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})()),d(e,"\u0275dir",T({type:e,selectors:[["input","type","checkbox","formControlName",""],["input","type","checkbox","formControl",""],["input","type","checkbox","ngModel",""]],hostBindings:function(r,o){r&1&&x("change",function(a){return o.onChange(a.target.checked)})("blur",function(){return o.onTouched()})},standalone:!1,features:[Z([Q6]),oe]}));let t=e;return t})(),J6={provide:_f,useExisting:vi(()=>So),multi:!0};function e4(){let t=br()?br().getUserAgent():"";return/android (\d+)/.test(t.toLowerCase())}var t4=new k(""),So=(()=>{let e=class e extends QT{constructor(r,o,s){super(r,o);d(this,"_compositionMode");d(this,"_composing",!1);this._compositionMode=s,this._compositionMode==null&&(this._compositionMode=!e4())}writeValue(r){let o=r??"";this.setProperty("value",o)}_handleInput(r){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(r)}_compositionStart(){this._composing=!0}_compositionEnd(r){this._composing=!1,this._compositionMode&&this.onChange(r)}};d(e,"\u0275fac",function(o){return new(o||e)(Ge(oi),Ge(de),Ge(t4,8))}),d(e,"\u0275dir",T({type:e,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(o,s){o&1&&x("input",function(u){return s._handleInput(u.target.value)})("blur",function(){return s.onTouched()})("compositionstart",function(){return s._compositionStart()})("compositionend",function(u){return s._compositionEnd(u.target.value)})},standalone:!1,features:[Z([J6]),oe]}));let t=e;return t})();function n4(t){return t==null||(typeof t=="string"||Array.isArray(t))&&t.length===0}var Cf=new k(""),i4=new k("");function r4(t){return n4(t.value)?{required:!0}:null}function UT(t){return null}function XT(t){return t!=null}function JT(t){return Da(t)?yn(t):t}function ex(t){let e={};return t.forEach(i=>{e=i!=null?M(M({},e),i):e}),Object.keys(e).length===0?null:e}function tx(t,e){return e.map(i=>i(t))}function o4(t){return!t.validate}function nx(t){return t.map(e=>o4(e)?e:i=>e.validate(i))}function s4(t){if(!t)return null;let e=t.filter(XT);return e.length==0?null:function(i){return ex(tx(i,e))}}function ix(t){return t!=null?s4(nx(t)):null}function a4(t){if(!t)return null;let e=t.filter(XT);return e.length==0?null:function(i){let n=tx(i,e).map(JT);return Cm(n).pipe(S(ex))}}function rx(t){return t!=null?a4(nx(t)):null}function $T(t,e){return t===null?[e]:Array.isArray(t)?[...t,e]:[t,e]}function u4(t){return t._rawValidators}function l4(t){return t._rawAsyncValidators}function fy(t){return t?Array.isArray(t)?t:[t]:[]}function yf(t,e){return Array.isArray(t)?t.includes(e):t===e}function GT(t,e){let i=fy(e);return fy(t).forEach(r=>{yf(i,r)||i.push(r)}),i}function WT(t,e){return fy(e).filter(i=>!yf(t,i))}var vf=class{constructor(){d(this,"_composedValidatorFn");d(this,"_composedAsyncValidatorFn");d(this,"_rawValidators",[]);d(this,"_rawAsyncValidators",[]);d(this,"_onDestroyCallbacks",[])}get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_setValidators(e){this._rawValidators=e||[],this._composedValidatorFn=ix(this._rawValidators)}_setAsyncValidators(e){this._rawAsyncValidators=e||[],this._composedAsyncValidatorFn=rx(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_registerOnDestroy(e){this._onDestroyCallbacks.push(e)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(e=>e()),this._onDestroyCallbacks=[]}reset(e=void 0){this.control&&this.control.reset(e)}hasError(e,i){return this.control?this.control.hasError(e,i):!1}getError(e,i){return this.control?this.control.getError(e,i):null}},py=class extends vf{constructor(){super(...arguments);d(this,"name")}get formDirective(){return null}get path(){return null}},an=class extends vf{constructor(){super(...arguments);d(this,"_parent",null);d(this,"name",null);d(this,"valueAccessor",null)}},hy=class{constructor(e){d(this,"_cd");this._cd=e}get isTouched(){var e,i,n,r,o;return(n=(i=(e=this._cd)==null?void 0:e.control)==null?void 0:i._touched)==null||n.call(i),!!((o=(r=this._cd)==null?void 0:r.control)!=null&&o.touched)}get isUntouched(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.untouched)}get isPristine(){var e,i,n,r,o;return(n=(i=(e=this._cd)==null?void 0:e.control)==null?void 0:i._pristine)==null||n.call(i),!!((o=(r=this._cd)==null?void 0:r.control)!=null&&o.pristine)}get isDirty(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.dirty)}get isValid(){var e,i,n,r,o;return(n=(i=(e=this._cd)==null?void 0:e.control)==null?void 0:i._status)==null||n.call(i),!!((o=(r=this._cd)==null?void 0:r.control)!=null&&o.valid)}get isInvalid(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.invalid)}get isPending(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.pending)}get isSubmitted(){var e,i,n;return(i=(e=this._cd)==null?void 0:e._submitted)==null||i.call(e),!!((n=this._cd)!=null&&n.submitted)}},c4={"[class.ng-untouched]":"isUntouched","[class.ng-touched]":"isTouched","[class.ng-pristine]":"isPristine","[class.ng-dirty]":"isDirty","[class.ng-valid]":"isValid","[class.ng-invalid]":"isInvalid","[class.ng-pending]":"isPending"},ene=U(M({},c4),{"[class.ng-submitted]":"isSubmitted"}),Df=(()=>{let e=class e extends hy{constructor(n){super(n)}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(an,2))}),d(e,"\u0275dir",T({type:e,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(r,o){r&2&&Te("ng-untouched",o.isUntouched)("ng-touched",o.isTouched)("ng-pristine",o.isPristine)("ng-dirty",o.isDirty)("ng-valid",o.isValid)("ng-invalid",o.isInvalid)("ng-pending",o.isPending)},standalone:!1,features:[oe]}));let t=e;return t})();var il="VALID",gf="INVALID",Ta="PENDING",rl="DISABLED",Ia=class{},bf=class extends Ia{constructor(i,n){super();d(this,"value");d(this,"source");this.value=i,this.source=n}},ol=class extends Ia{constructor(i,n){super();d(this,"pristine");d(this,"source");this.pristine=i,this.source=n}},sl=class extends Ia{constructor(i,n){super();d(this,"touched");d(this,"source");this.touched=i,this.source=n}},xa=class extends Ia{constructor(i,n){super();d(this,"status");d(this,"source");this.status=i,this.source=n}};function d4(t){return(Ef(t)?t.validators:t)||null}function f4(t){return Array.isArray(t)?ix(t):t||null}function p4(t,e){return(Ef(e)?e.asyncValidators:t)||null}function h4(t){return Array.isArray(t)?rx(t):t||null}function Ef(t){return t!=null&&!Array.isArray(t)&&typeof t=="object"}var my=class{constructor(e,i){d(this,"_pendingDirty",!1);d(this,"_hasOwnPendingAsyncValidator",null);d(this,"_pendingTouched",!1);d(this,"_onCollectionChange",()=>{});d(this,"_updateOn");d(this,"_parent",null);d(this,"_asyncValidationSubscription");d(this,"_composedValidatorFn");d(this,"_composedAsyncValidatorFn");d(this,"_rawValidators");d(this,"_rawAsyncValidators");d(this,"value");d(this,"_status",Pt(()=>this.statusReactive()));d(this,"statusReactive",ge(void 0));d(this,"errors");d(this,"_pristine",Pt(()=>this.pristineReactive()));d(this,"pristineReactive",ge(!0));d(this,"_touched",Pt(()=>this.touchedReactive()));d(this,"touchedReactive",ge(!1));d(this,"_events",new tt);d(this,"events",this._events.asObservable());d(this,"valueChanges");d(this,"statusChanges");d(this,"_onDisabledChange",[]);this._assignValidators(e),this._assignAsyncValidators(i)}get validator(){return this._composedValidatorFn}set validator(e){this._rawValidators=this._composedValidatorFn=e}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(e){this._rawAsyncValidators=this._composedAsyncValidatorFn=e}get parent(){return this._parent}get status(){return Gi(this.statusReactive)}set status(e){Gi(()=>this.statusReactive.set(e))}get valid(){return this.status===il}get invalid(){return this.status===gf}get pending(){return this.status==Ta}get disabled(){return this.status===rl}get enabled(){return this.status!==rl}get pristine(){return Gi(this.pristineReactive)}set pristine(e){Gi(()=>this.pristineReactive.set(e))}get dirty(){return!this.pristine}get touched(){return Gi(this.touchedReactive)}set touched(e){Gi(()=>this.touchedReactive.set(e))}get untouched(){return!this.touched}get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(e){this._assignValidators(e)}setAsyncValidators(e){this._assignAsyncValidators(e)}addValidators(e){this.setValidators(GT(e,this._rawValidators))}addAsyncValidators(e){this.setAsyncValidators(GT(e,this._rawAsyncValidators))}removeValidators(e){this.setValidators(WT(e,this._rawValidators))}removeAsyncValidators(e){this.setAsyncValidators(WT(e,this._rawAsyncValidators))}hasValidator(e){return yf(this._rawValidators,e)}hasAsyncValidator(e){return yf(this._rawAsyncValidators,e)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(e={}){let i=this.touched===!1;this.touched=!0;let n=e.sourceControl??this;this._parent&&!e.onlySelf&&this._parent.markAsTouched(U(M({},e),{sourceControl:n})),i&&e.emitEvent!==!1&&this._events.next(new sl(!0,n))}markAllAsTouched(e={}){this.markAsTouched({onlySelf:!0,emitEvent:e.emitEvent,sourceControl:this}),this._forEachChild(i=>i.markAllAsTouched(e))}markAsUntouched(e={}){let i=this.touched===!0;this.touched=!1,this._pendingTouched=!1;let n=e.sourceControl??this;this._forEachChild(r=>{r.markAsUntouched({onlySelf:!0,emitEvent:e.emitEvent,sourceControl:n})}),this._parent&&!e.onlySelf&&this._parent._updateTouched(e,n),i&&e.emitEvent!==!1&&this._events.next(new sl(!1,n))}markAsDirty(e={}){let i=this.pristine===!0;this.pristine=!1;let n=e.sourceControl??this;this._parent&&!e.onlySelf&&this._parent.markAsDirty(U(M({},e),{sourceControl:n})),i&&e.emitEvent!==!1&&this._events.next(new ol(!1,n))}markAsPristine(e={}){let i=this.pristine===!1;this.pristine=!0,this._pendingDirty=!1;let n=e.sourceControl??this;this._forEachChild(r=>{r.markAsPristine({onlySelf:!0,emitEvent:e.emitEvent})}),this._parent&&!e.onlySelf&&this._parent._updatePristine(e,n),i&&e.emitEvent!==!1&&this._events.next(new ol(!0,n))}markAsPending(e={}){this.status=Ta;let i=e.sourceControl??this;e.emitEvent!==!1&&(this._events.next(new xa(this.status,i)),this.statusChanges.emit(this.status)),this._parent&&!e.onlySelf&&this._parent.markAsPending(U(M({},e),{sourceControl:i}))}disable(e={}){let i=this._parentMarkedDirty(e.onlySelf);this.status=rl,this.errors=null,this._forEachChild(r=>{r.disable(U(M({},e),{onlySelf:!0}))}),this._updateValue();let n=e.sourceControl??this;e.emitEvent!==!1&&(this._events.next(new bf(this.value,n)),this._events.next(new xa(this.status,n)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(U(M({},e),{skipPristineCheck:i}),this),this._onDisabledChange.forEach(r=>r(!0))}enable(e={}){let i=this._parentMarkedDirty(e.onlySelf);this.status=il,this._forEachChild(n=>{n.enable(U(M({},e),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent}),this._updateAncestors(U(M({},e),{skipPristineCheck:i}),this),this._onDisabledChange.forEach(n=>n(!1))}_updateAncestors(e,i){this._parent&&!e.onlySelf&&(this._parent.updateValueAndValidity(e),e.skipPristineCheck||this._parent._updatePristine({},i),this._parent._updateTouched({},i))}setParent(e){this._parent=e}getRawValue(){return this.value}updateValueAndValidity(e={}){if(this._setInitialStatus(),this._updateValue(),this.enabled){let n=this._cancelExistingSubscription();this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===il||this.status===Ta)&&this._runAsyncValidator(n,e.emitEvent)}let i=e.sourceControl??this;e.emitEvent!==!1&&(this._events.next(new bf(this.value,i)),this._events.next(new xa(this.status,i)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!e.onlySelf&&this._parent.updateValueAndValidity(U(M({},e),{sourceControl:i}))}_updateTreeValidity(e={emitEvent:!0}){this._forEachChild(i=>i._updateTreeValidity(e)),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?rl:il}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(e,i){if(this.asyncValidator){this.status=Ta,this._hasOwnPendingAsyncValidator={emitEvent:i!==!1};let n=JT(this.asyncValidator(this));this._asyncValidationSubscription=n.subscribe(r=>{this._hasOwnPendingAsyncValidator=null,this.setErrors(r,{emitEvent:i,shouldHaveEmitted:e})})}}_cancelExistingSubscription(){var e;if(this._asyncValidationSubscription){this._asyncValidationSubscription.unsubscribe();let i=((e=this._hasOwnPendingAsyncValidator)==null?void 0:e.emitEvent)??!1;return this._hasOwnPendingAsyncValidator=null,i}return!1}setErrors(e,i={}){this.errors=e,this._updateControlsErrors(i.emitEvent!==!1,this,i.shouldHaveEmitted)}get(e){let i=e;return i==null||(Array.isArray(i)||(i=i.split(".")),i.length===0)?null:i.reduce((n,r)=>n&&n._find(r),this)}getError(e,i){let n=i?this.get(i):this;return n&&n.errors?n.errors[e]:null}hasError(e,i){return!!this.getError(e,i)}get root(){let e=this;for(;e._parent;)e=e._parent;return e}_updateControlsErrors(e,i,n){this.status=this._calculateStatus(),e&&this.statusChanges.emit(this.status),(e||n)&&this._events.next(new xa(this.status,i)),this._parent&&this._parent._updateControlsErrors(e,i,n)}_initObservables(){this.valueChanges=new _e,this.statusChanges=new _e}_calculateStatus(){return this._allControlsDisabled()?rl:this.errors?gf:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(Ta)?Ta:this._anyControlsHaveStatus(gf)?gf:il}_anyControlsHaveStatus(e){return this._anyControls(i=>i.status===e)}_anyControlsDirty(){return this._anyControls(e=>e.dirty)}_anyControlsTouched(){return this._anyControls(e=>e.touched)}_updatePristine(e,i){let n=!this._anyControlsDirty(),r=this.pristine!==n;this.pristine=n,this._parent&&!e.onlySelf&&this._parent._updatePristine(e,i),r&&this._events.next(new ol(this.pristine,i))}_updateTouched(e={},i){this.touched=this._anyControlsTouched(),this._events.next(new sl(this.touched,i)),this._parent&&!e.onlySelf&&this._parent._updateTouched(e,i)}_registerOnCollectionChange(e){this._onCollectionChange=e}_setUpdateStrategy(e){Ef(e)&&e.updateOn!=null&&(this._updateOn=e.updateOn)}_parentMarkedDirty(e){let i=this._parent&&this._parent.dirty;return!e&&!!i&&!this._parent._anyControlsDirty()}_find(e){return null}_assignValidators(e){this._rawValidators=Array.isArray(e)?e.slice():e,this._composedValidatorFn=f4(this._rawValidators)}_assignAsyncValidators(e){this._rawAsyncValidators=Array.isArray(e)?e.slice():e,this._composedAsyncValidatorFn=h4(this._rawAsyncValidators)}};var ox=new k("CallSetDisabledState",{providedIn:"root",factory:()=>yy}),yy="always";function m4(t,e){return[...e.path,t]}function g4(t,e,i=yy){var n,r;v4(t,e),e.valueAccessor.writeValue(t.value),(t.disabled||i==="always")&&((r=(n=e.valueAccessor).setDisabledState)==null||r.call(n,t.disabled)),b4(t,e),C4(t,e),_4(t,e),y4(t,e)}function qT(t,e){t.forEach(i=>{i.registerOnValidatorChange&&i.registerOnValidatorChange(e)})}function y4(t,e){if(e.valueAccessor.setDisabledState){let i=n=>{e.valueAccessor.setDisabledState(n)};t.registerOnDisabledChange(i),e._registerOnDestroy(()=>{t._unregisterOnDisabledChange(i)})}}function v4(t,e){let i=u4(t);e.validator!==null?t.setValidators($T(i,e.validator)):typeof i=="function"&&t.setValidators([i]);let n=l4(t);e.asyncValidator!==null?t.setAsyncValidators($T(n,e.asyncValidator)):typeof n=="function"&&t.setAsyncValidators([n]);let r=()=>t.updateValueAndValidity();qT(e._rawValidators,r),qT(e._rawAsyncValidators,r)}function b4(t,e){e.valueAccessor.registerOnChange(i=>{t._pendingValue=i,t._pendingChange=!0,t._pendingDirty=!0,t.updateOn==="change"&&sx(t,e)})}function _4(t,e){e.valueAccessor.registerOnTouched(()=>{t._pendingTouched=!0,t.updateOn==="blur"&&t._pendingChange&&sx(t,e),t.updateOn!=="submit"&&t.markAsTouched()})}function sx(t,e){t._pendingDirty&&t.markAsDirty(),t.setValue(t._pendingValue,{emitModelToViewChange:!1}),e.viewToModelUpdate(t._pendingValue),t._pendingChange=!1}function C4(t,e){let i=(n,r)=>{e.valueAccessor.writeValue(n),r&&e.viewToModelUpdate(n)};t.registerOnChange(i),e._registerOnDestroy(()=>{t._unregisterOnChange(i)})}function D4(t,e){if(!t.hasOwnProperty("model"))return!1;let i=t.model;return i.isFirstChange()?!0:!Object.is(e,i.currentValue)}function E4(t){return Object.getPrototypeOf(t.constructor)===gy}function w4(t,e){if(!e)return null;Array.isArray(e);let i,n,r;return e.forEach(o=>{o.constructor===So?i=o:E4(o)?n=o:r=o}),r||n||i||null}function ZT(t,e){let i=t.indexOf(e);i>-1&&t.splice(i,1)}function KT(t){return typeof t=="object"&&t!==null&&Object.keys(t).length===2&&"value"in t&&"disabled"in t}var T4=class extends my{constructor(i=null,n,r){super(d4(n),p4(r,n));d(this,"defaultValue",null);d(this,"_onChange",[]);d(this,"_pendingValue");d(this,"_pendingChange",!1);this._applyFormState(i),this._setUpdateStrategy(n),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator}),Ef(n)&&(n.nonNullable||n.initialValueIsDefault)&&(KT(i)?this.defaultValue=i.value:this.defaultValue=i)}setValue(i,n={}){this.value=this._pendingValue=i,this._onChange.length&&n.emitModelToViewChange!==!1&&this._onChange.forEach(r=>r(this.value,n.emitViewToModelChange!==!1)),this.updateValueAndValidity(n)}patchValue(i,n={}){this.setValue(i,n)}reset(i=this.defaultValue,n={}){this._applyFormState(i),this.markAsPristine(n),this.markAsUntouched(n),this.setValue(this.value,n),this._pendingChange=!1}_updateValue(){}_anyControls(i){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(i){this._onChange.push(i)}_unregisterOnChange(i){ZT(this._onChange,i)}registerOnDisabledChange(i){this._onDisabledChange.push(i)}_unregisterOnDisabledChange(i){ZT(this._onDisabledChange,i)}_forEachChild(i){}_syncPendingControls(){return this.updateOn==="submit"&&(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),this._pendingChange)?(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),!0):!1}_applyFormState(i){KT(i)?(this.value=this._pendingValue=i.value,i.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=i}};var x4={provide:an,useExisting:vi(()=>_r)},YT=Promise.resolve(),_r=(()=>{let e=class e extends an{constructor(r,o,s,a,u,l){super();d(this,"_changeDetectorRef");d(this,"callSetDisabledState");d(this,"control",new T4);d(this,"_registered",!1);d(this,"viewModel");d(this,"name","");d(this,"isDisabled");d(this,"model");d(this,"options");d(this,"update",new _e);this._changeDetectorRef=u,this.callSetDisabledState=l,this._parent=r,this._setValidators(o),this._setAsyncValidators(s),this.valueAccessor=w4(this,a)}ngOnChanges(r){if(this._checkForErrors(),!this._registered||"name"in r){if(this._registered&&(this._checkName(),this.formDirective)){let o=r.name.previousValue;this.formDirective.removeControl({name:o,path:this._getPath(o)})}this._setUpControl()}"isDisabled"in r&&this._updateDisabled(r),D4(r,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._getPath(this.name)}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(r){this.viewModel=r,this.update.emit(r)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&this.options.updateOn!=null&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!!(this.options&&this.options.standalone)}_setUpStandalone(){g4(this.control,this,this.callSetDisabledState),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._isStandalone()||this._checkParentType(),this._checkName()}_checkParentType(){}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),!this._isStandalone()&&this.name}_updateValue(r){YT.then(()=>{var o;this.control.setValue(r,{emitViewToModelChange:!1}),(o=this._changeDetectorRef)==null||o.markForCheck()})}_updateDisabled(r){let o=r.isDisabled.currentValue,s=o!==0&&pf(o);YT.then(()=>{var a;s&&!this.control.disabled?this.control.disable():!s&&this.control.disabled&&this.control.enable(),(a=this._changeDetectorRef)==null||a.markForCheck()})}_getPath(r){return this._parent?m4(r,this._parent):[r]}};d(e,"ngAcceptInputType_isDisabled"),d(e,"\u0275fac",function(o){return new(o||e)(Ge(py,9),Ge(Cf,10),Ge(i4,10),Ge(_f,10),Ge(st,8),Ge(ox,8))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:[0,"disabled","isDisabled"],model:[0,"ngModel","model"],options:[0,"ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],standalone:!1,features:[Z([x4]),oe,Yt]}));let t=e;return t})();var I4={provide:_f,useExisting:vi(()=>S4),multi:!0},S4=(()=>{let e=class e extends gy{writeValue(n){this.setProperty("value",parseFloat(n))}registerOnChange(n){this.onChange=r=>{n(r==""?null:parseFloat(r))}}};d(e,"\u0275fac",(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})()),d(e,"\u0275dir",T({type:e,selectors:[["input","type","range","formControlName",""],["input","type","range","formControl",""],["input","type","range","ngModel",""]],hostBindings:function(r,o){r&1&&x("change",function(a){return o.onChange(a.target.value)})("input",function(a){return o.onChange(a.target.value)})("blur",function(){return o.onTouched()})},standalone:!1,features:[Z([I4]),oe]}));let t=e;return t})();var M4=(()=>{let e=class e{constructor(){d(this,"_validator",UT);d(this,"_onChange");d(this,"_enabled")}ngOnChanges(n){if(this.inputName in n){let r=this.normalizeInput(n[this.inputName].currentValue);this._enabled=this.enabled(r),this._validator=this._enabled?this.createValidator(r):UT,this._onChange&&this._onChange()}}validate(n){return this._validator(n)}registerOnValidatorChange(n){this._onChange=n}enabled(n){return n!=null}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275dir",T({type:e,features:[Yt]}));let t=e;return t})();var A4={provide:Cf,useExisting:vi(()=>k4),multi:!0};var k4=(()=>{let e=class e extends M4{constructor(){super(...arguments);d(this,"required");d(this,"inputName","required");d(this,"normalizeInput",pf);d(this,"createValidator",r=>r4)}enabled(r){return r}};d(e,"\u0275fac",(()=>{let r;return function(s){return(r||(r=re(e)))(s||e)}})()),d(e,"\u0275dir",T({type:e,selectors:[["","required","","formControlName","",3,"type","checkbox"],["","required","","formControl","",3,"type","checkbox"],["","required","","ngModel","",3,"type","checkbox"]],hostVars:1,hostBindings:function(o,s){o&2&&Ke("required",s._enabled?"":null)},inputs:{required:"required"},standalone:!1,features:[Z([A4]),oe]}));let t=e;return t})();var O4=(()=>{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",bn({type:e})),d(e,"\u0275inj",vn({}));let t=e;return t})();var wf=(()=>{let e=class e{static withConfig(n){return{ngModule:e,providers:[{provide:ox,useValue:n.callSetDisabledState??yy}]}}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",bn({type:e})),d(e,"\u0275inj",vn({imports:[O4]}));let t=e;return t})();var ux={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},Tf=new Ru;var Sa=()=>{},Wi=U(M({},ux),{toJSON:()=>ux}),Di=()=>!1,Mo=()=>!0;function N4(t,e){return Array.isArray(t)&&Array.isArray(e)&&!t.length&&!e.length}var lx=(t,e)=>t===e||N4(t,e);var xf={acceptNode(t){return"ownerSVGElement"in t?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},Xr="\xA0",cx="\u2013";var If="\u200B";var dx="4.18.0";var Je=new k("[WA_WINDOW]",{factory:()=>{let{defaultView:t}=h(qe);if(!t)throw new Error("Window is not available");return t}}),Pn=Je,qi=new k("[WA_ANIMATION_FRAME]",{factory:()=>{let{requestAnimationFrame:t,cancelAnimationFrame:e}=h(Pn);return new te(n=>{let r=NaN,o=s=>{n.next(s),r=t(o)};return r=t(o),()=>{e(r)}}).pipe(Ri())}});var lne=new k("[WA_CACHES]",{factory:()=>h(Pn).caches});var cne=new k("[WA_CRYPTO]",{factory:()=>h(Pn).crypto});var dne=new k("[WA_CSS]",{factory:()=>h(Pn).CSS??{escape:t=>t,supports:()=>!1}});var fne=new k("[WA_HISTORY]",{factory:()=>h(Pn).history});var fx=new k("[WA_LOCAL_STORAGE]",{factory:()=>h(Pn).localStorage});var pne=new k("[WA_LOCATION]",{factory:()=>h(Pn).location});var Ao=new k("[WA_NAVIGATOR]",{factory:()=>h(Pn).navigator}),px=Ao,hne=new k("[WA_MEDIA_DEVICES]",{factory:()=>h(px).mediaDevices});var mne=new k("[WA_NETWORK_INFORMATION]",{factory:()=>h(Ao).connection||null});var gne=new k("[WA_PAGE_VISIBILITY]",{factory:()=>{let t=h(qe);return ct(t,"visibilitychange").pipe(dt(0),S(()=>t.visibilityState!=="hidden"),ke(),Li({refCount:!1,bufferSize:1}))}});var hx=new k("[WA_PERFORMANCE]",{factory:()=>h(Pn).performance});var yne=new k("[WA_SCREEN]",{factory:()=>h(Pn).screen});var vne=new k("[WA_SESSION_STORAGE]",{factory:()=>h(Pn).sessionStorage});var bne=new k("[WA_SPEECH_RECOGNITION]: [SPEECH_RECOGNITION]",{factory:()=>{let t=h(Pn);return t.speechRecognition||t.webkitSpeechRecognition||null}});var _ne=new k("[WA_SPEECH_SYNTHESIS]",{factory:()=>h(Pn).speechSynthesis});var Ma=new k("[WA_USER_AGENT]",{factory:()=>h(px).userAgent});function Jt(t,e,i){return Math.min(i,Math.max(e,t))}function al(t,e,i){return t>=e&&t=i?i:Math.round(t)}var P4=292;function F4(t,e,i){if(t===1/0)return t;e=Math.min(e,P4);let n=`${t}e`.split("e"),o=`${i(+`${n[0]}e${Number(n[1])+e}`)}e`.split("e");return+`${o[0]}e${Number(o[1])-e}`}function Dne(t,e=0){return F4(t,e,Math.round)}function gx(t,e){return t.slice(0,Math.max(e,0)).concat(t.slice(Math.max(e+1,0)))}var Tne=(t,e)=>t.replaceAll(/[^0-9A-Za-zА-Яа-я]/gi,e);function W(t){return B(()=>t)}function B(t){return t?new k("",{factory:t}):new k("")}function ul(t){return typeof t=="string"}function ko(t,e,i,n={self:!0}){let r=uf(i)?i:ge(i),o=h(t,n),s=o[`${e.toString()}Change`],l=parseInt(gT.major,10)>=19?{}:{allowSignalWrites:!0},c;return Io(()=>{var p,m;let f=r();c!==f&&(uf(o[e])?o[e].set(f):o[e]=f,(p=o.ngOnChanges)==null||p.call(o,{}),(m=s==null?void 0:s.emit)==null||m.call(s,f),c=f)},l),r}function yx(t){return t<.5?2*t*t:-1+(4-2*t)*t}function vx(t){let e=[];return t.find((i,n,r)=>(e=r,!0)),e}function vy(t){return typeof t=="number"}function si(t){return t!=null}function xne(t,e,i){return t===null?e===null:e===null?!1:i(t,e)}function De(t,e,i=!1){return{provide:t,useExisting:e,multi:i}}function Zi(t,e,i){return{provide:t,useFactory:()=>M(M({},h(t,{optional:!0,skipSelf:!0})||i),h(e,{optional:!0})||e)}}function R4(t){let e=[],i=!1,n;return function(...o){return i&&e.length===o.length&&o.every((a,u)=>a===e[u])||(e=o,n=t.apply(this,o),i=!0),n}}function mx(t,e,i=!0){return function(){let r=t.call(this);return Object.defineProperty(this,e,{enumerable:i,value:r}),r}}function Ft(t,e,i){if(typeof t=="function"){let u=e;if(u.kind==="getter")return mx(t,u.name);if(u.kind==="method")return R4(t);throw new Mf}let{get:n,enumerable:r,value:o}=i,s=e;if(n)return{configurable:!0,enumerable:r,get:mx(n,s,r)};if(typeof o!="function")throw new Mf;let a=o;return{configurable:!0,enumerable:r,get(){let u=[],l=!1,c,f=(...p)=>(l&&u.length===p.length&&p.every((g,y)=>g===u[y])||(u=p,c=a.apply(this,p),l=!0),c);return Object.defineProperty(this,s,{configurable:!0,value:f}),f}}}var Mf=class extends Error{constructor(){super("")}};function ht(t){return`${t}px`}var L4=B(()=>{let t=new Map;return h(it).onDestroy(()=>t.forEach(e=>e.destroy())),t});function Dn(t){let e=h(L4),i=h(fr);e.has(t)||e.set(t,ET(t,{environmentInjector:i}))}function Aa(t){return new te(e=>{var i;return(i=t==null?void 0:t.valueChanges)==null?void 0:i.pipe(dt(t.value)).subscribe(e)})}function rt(t,e,i={}){return ct(t,e,i)}function Af(t,e=Boolean){return vu(bt(i=>e(i)?t(i):sn))}function Nne(t){return t.changes.pipe(dt(null),S(()=>vx(t)))}function bx(t){return rt(t===t.ownerDocument.documentElement?t.ownerDocument:t,"scroll")}function kf(t){return vu(Kt(Du.pipe(Se(t),Eu(()=>sn),mo(null))))}function Jr(t=h(st)){return ei(()=>t.markForCheck())}function H4(t=h(me)){return e=>new te(i=>e.subscribe({next:n=>t.run(()=>i.next(n)),error:n=>t.run(()=>i.error(n)),complete:()=>t.run(()=>i.complete())}))}function Ei(t=h(me)){return e=>new te(i=>t.runOutsideAngular(()=>e.subscribe(i)))}function ai(t=h(me)){return vu(Ei(t),H4(t))}var by=class{constructor(e,i=Lr){this.zoneConditionFn=e,this.scheduler=i}now(){return this.scheduler.now()}schedule(...e){return this.zoneConditionFn(()=>this.scheduler.schedule(...e))}};function Fn(t=h(me),e=Lr){return new by(t.runOutsideAngular.bind(t),e)}var _x=/^((?!chrome|android).)*safari/i,B4=/ipad|iphone|ipod/i;function Of({userAgent:t,maxTouchPoints:e}){return B4.test(t)||_x.test(t)&&e>1}var V4=new k("",{factory:()=>Of(h(Ao))}),z4=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/,j4=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/,U4=new k("",{factory:()=>z4.test(h(Ma).toLowerCase())||j4.test(h(Ma).slice(0,4).toLowerCase())}),Bne=new k("",{factory:()=>h(U4)&&!h(V4)});function Cx(t){return Of(t)||_x.test(t.userAgent)}var Vne=new k("",{factory:()=>{let t=h(Je).matchMedia("(pointer: coarse)");return Cn(ct(t,"change").pipe(S(()=>t.matches)),{initialValue:t.matches})}}),zne=new k("",{factory:()=>{var t;return!!((t=h(Je))!=null&&t.webkitConvertPointFromNodeToPage)}});var ll=[0,0,0,1];function Dx(t){let e=t.replace("#","").replace("rgba(","").replace("rgb(","").replace(")",""),i=e.split(",").map(o=>parseFloat(o));if(i.length===4)return i;if(i.length===3)return i.concat(1);let n=e.match(new RegExp(`(.{${e.length/3}})`,"g"));if(!n)return ll;let r=n.map(o=>parseInt(e.length%2?o+o:o,16));return[r[0]??ll[0],r[1]??ll[1],r[2]??ll[2],r[3]??ll[3]]}var $4=String.raw`\s*,\s*`,G4="#(?:[a-f0-9]{6}|[a-f0-9]{3})",W4=String.raw`\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)`,q4=String.raw`\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*,\s*\d*\.?\d+\)`,Z4=String.raw`(?:[+-]?\d*\.?\d+)(?:%|[a-z]+)?`,K4="[_a-z-][_a-z0-9-]*",Y4=["(?:",G4,"|","(?:rgb|hsl)",W4,"|","(?:rgba|hsla)",q4,"|",K4,")"],Une=[String.raw`\s*(`,...Y4,")",String.raw`(?:\s+`,"(",Z4,"))?","(?:",$4,String.raw`\s*)?`];function Oo(t){let e=W(t);return[e,i=>Zi(e,i,t)]}function Yne(t,e){try{return t.contains(e)||!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}catch{return!1}}function Q4(t){return t.matches("input")}function X4(t){return t.matches("textarea")}function wx(t){return Q4(t)||X4(t)}function ui(t){return!!t&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function No(t){let e=t==null?void 0:t.ownerDocument.defaultView;return!!t&&!!e&&t instanceof e.HTMLElement}function Nf(t){return t.nodeType===Node.TEXT_NODE}function ka(t){return t.composedPath()[0]}var Ex="text/plain";function Qne(t,e=Ex){return"clipboardData"in t&&t.clipboardData!==null?t.clipboardData.getData(e)||t.clipboardData.getData(Ex):t.target.ownerDocument.defaultView.clipboardData.getData("text")}function Pf(t){return"getRootNode"in t&&t.isConnected?t.getRootNode():t.ownerDocument}function Ff(t){let{ownerDocument:e}=t;if(!(e!=null&&e.defaultView)||!t.getBoundingClientRect)return null;let{innerWidth:i,innerHeight:n}=e.defaultView,r=Pf(t),o=t.getBoundingClientRect();if(o.width===0&&o.height===0)return null;let s=Jt(Math.round(o.left)+2,0,i),a=Jt(Math.round(o.top)+2,0,n),u=Jt(Math.round(o.right)-2,0,i),l=Jt(Math.round(o.bottom)-2,0,n),c=Jt(Math.round(o.left+o.width/2),0,i),f=Jt(Math.round(o.top+o.height/2),0,n),m=[r.elementFromPoint(c,a),r.elementFromPoint(c,l),r.elementFromPoint(s,f),r.elementFromPoint(u,f)].filter(si);if(!m.length)return[];let g=m.filter(y=>!t.contains(y)&&!y.contains(t));return g.length===4?g:null}function Tx(t,e){let{offsetTop:i,offsetLeft:n,offsetParent:r}=e;for(;No(r)&&r!==t;)i+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{offsetTop:i,offsetLeft:n}}function Ee(){return h(de).nativeElement}function _y(t){return wx(t)&&!t.readOnly||!!t.isContentEditable}function Cy(t,e){var i;return Nf(t)?!!((i=t.parentElement)!=null&&i.closest(e)):ui(t)&&!!t.closest(e)}function Dy(t=0,e=0){let i={x:t,y:e,left:t,right:t,top:e,bottom:e,width:0,height:0};return U(M({},i),{toJSON:()=>i})}function xx(t){return"explicitOriginalTarget"in t?(t==null?void 0:t.explicitOriginalTarget)!==t.target:"pointerId"in t?t.pointerId===-1:"detail"in t&&"webkitForce"in t?(t==null?void 0:t.detail)===0:!1}function Rf({activeElement:t}){if(!(t!=null&&t.shadowRoot))return t;let e=t.shadowRoot.activeElement;for(;e!=null&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rie(t){let e=Rf(t);No(e)&&e.blur()}function Ix(t){return Cn(nt(ct(t,"focusin").pipe(S(Mo)),ct(t,"focusout").pipe(S(Di))),{initialValue:!1})}function Lf(t){if(t.hasAttribute("disabled")||t.getAttribute("tabIndex")==="-1")return!1;if(No(t)&&t.isContentEditable||t.getAttribute("tabIndex")==="0")return!0;switch(t.tagName){case"A":case"LINK":return t.hasAttribute("href");case"AUDIO":case"VIDEO":return t.hasAttribute("controls");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;case"INPUT":return t.getAttribute("type")!=="hidden";default:return!1}}function ys(t){return!t.hasAttribute("disabled")&&(t.getAttribute("tabIndex")==="-1"||Lf(t))}function Po({initial:t,root:e,previous:i=!1,keyboard:n=!0}){if(!e.ownerDocument)return null;let r=n?Lf:ys,o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,xf);o.currentNode=t;do if(No(o.currentNode)&&(t=o.currentNode),No(t)&&r(t))return t;while(i?o.previousNode():o.nextNode());return null}function cl(t){return!!(t!=null&&t.ownerDocument)&&Rf(t.ownerDocument)===t&&t.ownerDocument.hasFocus()}function Ki(t){var i;let e=(t==null?void 0:t.ownerDocument)&&Rf(t.ownerDocument);return!!e&&t.contains(e)&&!!((i=t.ownerDocument)!=null&&i.hasFocus())}function Sx(t,e,i){var n;for(t+=i;t>=0&&te()),this._onDoneFns=[])}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(e=>e()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(e){this._position=this.totalTime?e*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(e){let i=e=="start"?this._onStartFns:this._onDoneFns;i.forEach(n=>n()),i.length=0}},dl=class{constructor(e){d(this,"_onDoneFns",[]);d(this,"_onStartFns",[]);d(this,"_finished",!1);d(this,"_started",!1);d(this,"_destroyed",!1);d(this,"_onDestroyFns",[]);d(this,"parentPlayer",null);d(this,"totalTime",0);d(this,"players");this.players=e;let i=0,n=0,r=0,o=this.players.length;o==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(s=>{s.onDone(()=>{++i==o&&this._onFinish()}),s.onDestroy(()=>{++n==o&&this._onDestroy()}),s.onStart(()=>{++r==o&&this._onStart()})}),this.totalTime=this.players.reduce((s,a)=>Math.max(s,a.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this.players.forEach(e=>e.init())}onStart(e){this._onStartFns.push(e)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(e=>e()),this._onStartFns=[])}onDone(e){this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(e=>e.play())}pause(){this.players.forEach(e=>e.pause())}restart(){this.players.forEach(e=>e.restart())}finish(){this._onFinish(),this.players.forEach(e=>e.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(e=>e.destroy()),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this.players.forEach(e=>e.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(e){let i=e*this.totalTime;this.players.forEach(n=>{let r=n.totalTime?Math.min(1,i/n.totalTime):1;n.setPosition(r)})}getPosition(){let e=this.players.reduce((i,n)=>i===null||n.totalTime>i.totalTime?n:i,null);return e!=null?e.getPosition():0}beforeDestroy(){this.players.forEach(e=>{e.beforeDestroy&&e.beforeDestroy()})}triggerCallback(e){let i=e=="start"?this._onStartFns:this._onDoneFns;i.forEach(n=>n()),i.length=0}},Bf="!";function Ax(t){return new j(3e3,!1)}function J4(){return new j(3100,!1)}function e5(){return new j(3101,!1)}function t5(t){return new j(3001,!1)}function n5(t){return new j(3003,!1)}function i5(t){return new j(3004,!1)}function r5(t,e){return new j(3005,!1)}function o5(){return new j(3006,!1)}function s5(){return new j(3007,!1)}function a5(t,e){return new j(3008,!1)}function u5(t){return new j(3002,!1)}function l5(t,e,i,n,r){return new j(3010,!1)}function c5(){return new j(3011,!1)}function d5(){return new j(3012,!1)}function f5(){return new j(3200,!1)}function p5(){return new j(3202,!1)}function h5(){return new j(3013,!1)}function m5(t){return new j(3014,!1)}function g5(t){return new j(3015,!1)}function y5(t){return new j(3016,!1)}function v5(t,e){return new j(3404,!1)}function b5(t){return new j(3502,!1)}function _5(t){return new j(3503,!1)}function C5(){return new j(3300,!1)}function D5(t){return new j(3504,!1)}function E5(t){return new j(3301,!1)}function w5(t,e){return new j(3302,!1)}function T5(t){return new j(3303,!1)}function x5(t,e){return new j(3400,!1)}function I5(t){return new j(3401,!1)}function S5(t){return new j(3402,!1)}function M5(t,e){return new j(3505,!1)}function Ro(t){switch(t.length){case 0:return new Fo;case 1:return t[0];default:return new dl(t)}}function qx(t,e,i=new Map,n=new Map){let r=[],o=[],s=-1,a=null;if(e.forEach(u=>{let l=u.get("offset"),c=l==s,f=c&&a||new Map;u.forEach((p,m)=>{let g=m,y=p;if(m!=="offset")switch(g=t.normalizePropertyName(g,r),y){case Bf:y=i.get(m);break;case Cr:y=n.get(m);break;default:y=t.normalizeStyleValue(m,g,y,r);break}f.set(g,y)}),c||o.push(f),a=f,s=l}),r.length)throw b5(r);return o}function Wy(t,e,i,n){switch(e){case"start":t.onStart(()=>n(i&&Ey(i,"start",t)));break;case"done":t.onDone(()=>n(i&&Ey(i,"done",t)));break;case"destroy":t.onDestroy(()=>n(i&&Ey(i,"destroy",t)));break}}function Ey(t,e,i){let n=i.totalTime,r=!!i.disabled,o=qy(t.element,t.triggerName,t.fromState,t.toState,e||t.phaseName,n??t.totalTime,r),s=t._data;return s!=null&&(o._data=s),o}function qy(t,e,i,n,r="",o=0,s){return{element:t,triggerName:e,fromState:i,toState:n,phaseName:r,totalTime:o,disabled:!!s}}function ci(t,e,i){let n=t.get(e);return n||t.set(e,n=i),n}function kx(t){let e=t.indexOf(":"),i=t.substring(1,e),n=t.slice(e+1);return[i,n]}var A5=typeof document>"u"?null:document.documentElement;function Zy(t){let e=t.parentNode||t.host||null;return e===A5?null:e}function k5(t){return t.substring(1,6)=="ebkit"}var vs=null,Ox=!1;function O5(t){vs||(vs=N5()||{},Ox=vs.style?"WebkitAppearance"in vs.style:!1);let e=!0;return vs.style&&!k5(t)&&(e=t in vs.style,!e&&Ox&&(e="Webkit"+t.charAt(0).toUpperCase()+t.slice(1)in vs.style)),e}function N5(){return typeof document<"u"?document.body:null}function Zx(t,e){for(;e;){if(e===t)return!0;e=Zy(e)}return!1}function Kx(t,e,i){if(i)return Array.from(t.querySelectorAll(e));let n=t.querySelector(e);return n?[n]:[]}var P5=(()=>{let e=class e{validateStyleProperty(n){return O5(n)}containsElement(n,r){return Zx(n,r)}getParentElement(n){return Zy(n)}query(n,r,o){return Kx(n,r,o)}computeStyle(n,r,o){return o||""}animate(n,r,o,s,a,u=[],l){return new Fo(o,s)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),wy=class{};d(wy,"NOOP",new P5);var Ay=class{};var F5=1e3,Yx="{{",R5="}}",Qx="ng-enter",ky="ng-leave",Vf="ng-trigger",Gf=".ng-trigger",Nx="ng-animating",Oy=".ng-animating";function eo(t){if(typeof t=="number")return t;let e=t.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:Ny(parseFloat(e[1]),e[2])}function Ny(t,e){switch(e){case"s":return t*F5;default:return t}}function Wf(t,e,i){return t.hasOwnProperty("duration")?t:L5(t,e,i)}function L5(t,e,i){let n=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i,r,o=0,s="";if(typeof t=="string"){let a=t.match(n);if(a===null)return e.push(Ax(t)),{duration:0,delay:0,easing:""};r=Ny(parseFloat(a[1]),a[2]);let u=a[3];u!=null&&(o=Ny(parseFloat(u),a[4]));let l=a[5];l&&(s=l)}else r=t;if(!i){let a=!1,u=e.length;r<0&&(e.push(J4()),a=!0),o<0&&(e.push(e5()),a=!0),a&&e.splice(u,0,Ax(t))}return{duration:r,delay:o,easing:s}}function H5(t){return t.length?t[0]instanceof Map?t:t.map(e=>new Map(Object.entries(e))):[]}function Dr(t,e,i){e.forEach((n,r)=>{let o=Ky(r);i&&!i.has(r)&&i.set(r,t.style[o]),t.style[o]=n})}function _s(t,e){e.forEach((i,n)=>{let r=Ky(n);t.style[r]=""})}function fl(t){return Array.isArray(t)?t.length==1?t[0]:Mx(t):t}function B5(t,e,i){let n=e.params||{},r=Xx(t);r.length&&r.forEach(o=>{n.hasOwnProperty(o)||i.push(t5(o))})}var Py=new RegExp(`${Yx}\\s*(.+?)\\s*${R5}`,"g");function Xx(t){let e=[];if(typeof t=="string"){let i;for(;i=Py.exec(t);)e.push(i[1]);Py.lastIndex=0}return e}function hl(t,e,i){let n=`${t}`,r=n.replace(Py,(o,s)=>{let a=e[s];return a==null&&(i.push(n5(s)),a=""),a.toString()});return r==n?t:r}var V5=/-+([a-z0-9])/g;function Ky(t){return t.replace(V5,(...e)=>e[1].toUpperCase())}function z5(t,e){return t===0||e===0}function j5(t,e,i){if(i.size&&e.length){let n=e[0],r=[];if(i.forEach((o,s)=>{n.has(s)||r.push(s),n.set(s,o)}),r.length)for(let o=1;os.set(a,Yy(t,a)))}}return e}function li(t,e,i){switch(e.type){case we.Trigger:return t.visitTrigger(e,i);case we.State:return t.visitState(e,i);case we.Transition:return t.visitTransition(e,i);case we.Sequence:return t.visitSequence(e,i);case we.Group:return t.visitGroup(e,i);case we.Animate:return t.visitAnimate(e,i);case we.Keyframes:return t.visitKeyframes(e,i);case we.Style:return t.visitStyle(e,i);case we.Reference:return t.visitReference(e,i);case we.AnimateChild:return t.visitAnimateChild(e,i);case we.AnimateRef:return t.visitAnimateRef(e,i);case we.Query:return t.visitQuery(e,i);case we.Stagger:return t.visitStagger(e,i);default:throw i5(e.type)}}function Yy(t,e){return window.getComputedStyle(t)[e]}var U5=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),Px=class extends Ay{normalizePropertyName(e,i){return Ky(e)}normalizeStyleValue(e,i,n,r){let o="",s=n.toString().trim();if(U5.has(i)&&n!==0&&n!=="0")if(typeof n=="number")o="px";else{let a=n.match(/^[+-]?[\d\.]+([a-z]*)$/);a&&a[1].length==0&&r.push(r5(e,n))}return s+o}};var qf="*";function $5(t,e){let i=[];return typeof t=="string"?t.split(/\s*,\s*/).forEach(n=>G5(n,i,e)):i.push(t),i}function G5(t,e,i){if(t[0]==":"){let u=W5(t,i);if(typeof u=="function"){e.push(u);return}t=u}let n=t.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/);if(n==null||n.length<4)return i.push(g5(t)),e;let r=n[1],o=n[2],s=n[3];e.push(Fx(r,s));let a=r==qf&&s==qf;o[0]=="<"&&!a&&e.push(Fx(s,r))}function W5(t,e){switch(t){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(i,n)=>parseFloat(n)>parseFloat(i);case":decrement":return(i,n)=>parseFloat(n) *"}}var zf=new Set(["true","1"]),jf=new Set(["false","0"]);function Fx(t,e){let i=zf.has(t)||jf.has(t),n=zf.has(e)||jf.has(e);return(r,o)=>{let s=t==qf||t==r,a=e==qf||e==o;return!s&&i&&typeof r=="boolean"&&(s=r?zf.has(t):jf.has(t)),!a&&n&&typeof o=="boolean"&&(a=o?zf.has(e):jf.has(e)),s&&a}}var Jx=":self",q5=new RegExp(`s*${Jx}s*,?`,"g");function eI(t,e,i,n){return new Fy(t).build(e,i,n)}var Rx="",Fy=class{constructor(e){d(this,"_driver");this._driver=e}build(e,i,n){let r=new Ry(i);return this._resetContextStyleTimingState(r),li(this,fl(e),r)}_resetContextStyleTimingState(e){e.currentQuerySelector=Rx,e.collectedStyles=new Map,e.collectedStyles.set(Rx,new Map),e.currentTime=0}visitTrigger(e,i){let n=i.queryCount=0,r=i.depCount=0,o=[],s=[];return e.name.charAt(0)=="@"&&i.errors.push(o5()),e.definitions.forEach(a=>{if(this._resetContextStyleTimingState(i),a.type==we.State){let u=a,l=u.name;l.toString().split(/\s*,\s*/).forEach(c=>{u.name=c,o.push(this.visitState(u,i))}),u.name=l}else if(a.type==we.Transition){let u=this.visitTransition(a,i);n+=u.queryCount,r+=u.depCount,s.push(u)}else i.errors.push(s5())}),{type:we.Trigger,name:e.name,states:o,transitions:s,queryCount:n,depCount:r,options:null}}visitState(e,i){let n=this.visitStyle(e.styles,i),r=e.options&&e.options.params||null;if(n.containsDynamicStyles){let o=new Set,s=r||{};n.styles.forEach(a=>{a instanceof Map&&a.forEach(u=>{Xx(u).forEach(l=>{s.hasOwnProperty(l)||o.add(l)})})}),o.size&&i.errors.push(a5(e.name,[...o.values()]))}return{type:we.State,name:e.name,style:n,options:r?{params:r}:null}}visitTransition(e,i){i.queryCount=0,i.depCount=0;let n=li(this,fl(e.animation),i),r=$5(e.expr,i.errors);return{type:we.Transition,matchers:r,animation:n,queryCount:i.queryCount,depCount:i.depCount,options:bs(e.options)}}visitSequence(e,i){return{type:we.Sequence,steps:e.steps.map(n=>li(this,n,i)),options:bs(e.options)}}visitGroup(e,i){let n=i.currentTime,r=0,o=e.steps.map(s=>{i.currentTime=n;let a=li(this,s,i);return r=Math.max(r,i.currentTime),a});return i.currentTime=r,{type:we.Group,steps:o,options:bs(e.options)}}visitAnimate(e,i){let n=Q5(e.timings,i.errors);i.currentAnimateTimings=n;let r,o=e.styles?e.styles:R({});if(o.type==we.Keyframes)r=this.visitKeyframes(o,i);else{let s=e.styles,a=!1;if(!s){a=!0;let l={};n.easing&&(l.easing=n.easing),s=R(l)}i.currentTime+=n.duration+n.delay;let u=this.visitStyle(s,i);u.isEmptyStep=a,r=u}return i.currentAnimateTimings=null,{type:we.Animate,timings:n,style:r,options:null}}visitStyle(e,i){let n=this._makeStyleAst(e,i);return this._validateStyleAst(n,i),n}_makeStyleAst(e,i){let n=[],r=Array.isArray(e.styles)?e.styles:[e.styles];for(let a of r)typeof a=="string"?a===Cr?n.push(a):i.errors.push(u5(a)):n.push(new Map(Object.entries(a)));let o=!1,s=null;return n.forEach(a=>{if(a instanceof Map&&(a.has("easing")&&(s=a.get("easing"),a.delete("easing")),!o)){for(let u of a.values())if(u.toString().indexOf(Yx)>=0){o=!0;break}}}),{type:we.Style,styles:n,easing:s,offset:e.offset,containsDynamicStyles:o,options:null}}_validateStyleAst(e,i){let n=i.currentAnimateTimings,r=i.currentTime,o=i.currentTime;n&&o>0&&(o-=n.duration+n.delay),e.styles.forEach(s=>{typeof s!="string"&&s.forEach((a,u)=>{let l=i.collectedStyles.get(i.currentQuerySelector),c=l.get(u),f=!0;c&&(o!=r&&o>=c.startTime&&r<=c.endTime&&(i.errors.push(l5(u,c.startTime,c.endTime,o,r)),f=!1),o=c.startTime),f&&l.set(u,{startTime:o,endTime:r}),i.options&&B5(a,i.options,i.errors)})})}visitKeyframes(e,i){let n={type:we.Keyframes,styles:[],options:null};if(!i.currentAnimateTimings)return i.errors.push(c5()),n;let r=1,o=0,s=[],a=!1,u=!1,l=0,c=e.steps.map(D=>{let I=this._makeStyleAst(D,i),N=I.offset!=null?I.offset:Y5(I.styles),A=0;return N!=null&&(o++,A=I.offset=N),u=u||A<0||A>1,a=a||A0&&o{let N=p>0?I==m?1:p*I:s[I],A=N*b;i.currentTime=g+y.delay+A,y.duration=A,this._validateStyleAst(D,i),D.offset=N,n.styles.push(D)}),n}visitReference(e,i){return{type:we.Reference,animation:li(this,fl(e.animation),i),options:bs(e.options)}}visitAnimateChild(e,i){return i.depCount++,{type:we.AnimateChild,options:bs(e.options)}}visitAnimateRef(e,i){return{type:we.AnimateRef,animation:this.visitReference(e.animation,i),options:bs(e.options)}}visitQuery(e,i){let n=i.currentQuerySelector,r=e.options||{};i.queryCount++,i.currentQuery=e;let[o,s]=Z5(e.selector);i.currentQuerySelector=n.length?n+" "+o:o,ci(i.collectedStyles,i.currentQuerySelector,new Map);let a=li(this,fl(e.animation),i);return i.currentQuery=null,i.currentQuerySelector=n,{type:we.Query,selector:o,limit:r.limit||0,optional:!!r.optional,includeSelf:s,animation:a,originalSelector:e.selector,options:bs(e.options)}}visitStagger(e,i){i.currentQuery||i.errors.push(h5());let n=e.timings==="full"?{duration:0,delay:0,easing:"full"}:Wf(e.timings,i.errors,!0);return{type:we.Stagger,animation:li(this,fl(e.animation),i),timings:n,options:null}}};function Z5(t){let e=!!t.split(/\s*,\s*/).find(i=>i==Jx);return e&&(t=t.replace(q5,"")),t=t.replace(/@\*/g,Gf).replace(/@\w+/g,i=>Gf+"-"+i.slice(1)).replace(/:animating/g,Oy),[t,e]}function K5(t){return t?M({},t):null}var Ry=class{constructor(e){d(this,"errors");d(this,"queryCount",0);d(this,"depCount",0);d(this,"currentTransition",null);d(this,"currentQuery",null);d(this,"currentQuerySelector",null);d(this,"currentAnimateTimings",null);d(this,"currentTime",0);d(this,"collectedStyles",new Map);d(this,"options",null);d(this,"unsupportedCSSPropertiesFound",new Set);this.errors=e}};function Y5(t){if(typeof t=="string")return null;let e=null;if(Array.isArray(t))t.forEach(i=>{if(i instanceof Map&&i.has("offset")){let n=i;e=parseFloat(n.get("offset")),n.delete("offset")}});else if(t instanceof Map&&t.has("offset")){let i=t;e=parseFloat(i.get("offset")),i.delete("offset")}return e}function Q5(t,e){if(t.hasOwnProperty("duration"))return t;if(typeof t=="number"){let o=Wf(t,e).duration;return Ty(o,0,"")}let i=t;if(i.split(/\s+/).some(o=>o.charAt(0)=="{"&&o.charAt(1)=="{")){let o=Ty(0,0,"");return o.dynamic=!0,o.strValue=i,o}let r=Wf(i,e);return Ty(r.duration,r.delay,r.easing)}function bs(t){return t?(t=M({},t),t.params&&(t.params=K5(t.params))):t={},t}function Ty(t,e,i){return{duration:t,delay:e,easing:i}}function Qy(t,e,i,n,r,o,s=null,a=!1){return{type:1,element:t,keyframes:e,preStyleProps:i,postStyleProps:n,duration:r,delay:o,totalTime:r+o,easing:s,subTimeline:a}}var ml=class{constructor(){d(this,"_map",new Map)}get(e){return this._map.get(e)||[]}append(e,i){let n=this._map.get(e);n||this._map.set(e,n=[]),n.push(...i)}has(e){return this._map.has(e)}clear(){this._map.clear()}},X5=1,J5=":enter",e8=new RegExp(J5,"g"),t8=":leave",n8=new RegExp(t8,"g");function tI(t,e,i,n,r,o=new Map,s=new Map,a,u,l=[]){return new Ly().buildKeyframes(t,e,i,n,r,o,s,a,u,l)}var Ly=class{buildKeyframes(e,i,n,r,o,s,a,u,l,c=[]){l=l||new ml;let f=new Hy(e,i,l,r,o,c,[]);f.options=u;let p=u.delay?eo(u.delay):0;f.currentTimeline.delayNextStep(p),f.currentTimeline.setStyles([s],null,f.errors,u),li(this,n,f);let m=f.timelines.filter(g=>g.containsAnimation());if(m.length&&a.size){let g;for(let y=m.length-1;y>=0;y--){let b=m[y];if(b.element===i){g=b;break}}g&&!g.allowOnlyTimelineStyles()&&g.setStyles([a],null,f.errors,u)}return m.length?m.map(g=>g.buildKeyframes()):[Qy(i,[],[],[],0,p,"",!1)]}visitTrigger(e,i){}visitState(e,i){}visitTransition(e,i){}visitAnimateChild(e,i){let n=i.subInstructions.get(i.element);if(n){let r=i.createSubContext(e.options),o=i.currentTimeline.currentTime,s=this._visitSubInstructions(n,r,r.options);o!=s&&i.transformIntoNewTimeline(s)}i.previousNode=e}visitAnimateRef(e,i){let n=i.createSubContext(e.options);n.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],i,n),this.visitReference(e.animation,n),i.transformIntoNewTimeline(n.currentTimeline.currentTime),i.previousNode=e}_applyAnimationRefDelays(e,i,n){for(let r of e){let o=r==null?void 0:r.delay;if(o){let s=typeof o=="number"?o:eo(hl(o,(r==null?void 0:r.params)??{},i.errors));n.delayNextStep(s)}}}_visitSubInstructions(e,i,n){let o=i.currentTimeline.currentTime,s=n.duration!=null?eo(n.duration):null,a=n.delay!=null?eo(n.delay):null;return s!==0&&e.forEach(u=>{let l=i.appendInstructionToTimeline(u,s,a);o=Math.max(o,l.duration+l.delay)}),o}visitReference(e,i){i.updateOptions(e.options,!0),li(this,e.animation,i),i.previousNode=e}visitSequence(e,i){let n=i.subContextCount,r=i,o=e.options;if(o&&(o.params||o.delay)&&(r=i.createSubContext(o),r.transformIntoNewTimeline(),o.delay!=null)){r.previousNode.type==we.Style&&(r.currentTimeline.snapshotCurrentStyles(),r.previousNode=Zf);let s=eo(o.delay);r.delayNextStep(s)}e.steps.length&&(e.steps.forEach(s=>li(this,s,r)),r.currentTimeline.applyStylesToKeyframe(),r.subContextCount>n&&r.transformIntoNewTimeline()),i.previousNode=e}visitGroup(e,i){let n=[],r=i.currentTimeline.currentTime,o=e.options&&e.options.delay?eo(e.options.delay):0;e.steps.forEach(s=>{let a=i.createSubContext(e.options);o&&a.delayNextStep(o),li(this,s,a),r=Math.max(r,a.currentTimeline.currentTime),n.push(a.currentTimeline)}),n.forEach(s=>i.currentTimeline.mergeTimelineCollectedStyles(s)),i.transformIntoNewTimeline(r),i.previousNode=e}_visitTiming(e,i){if(e.dynamic){let n=e.strValue,r=i.params?hl(n,i.params,i.errors):n;return Wf(r,i.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,i){let n=i.currentAnimateTimings=this._visitTiming(e.timings,i),r=i.currentTimeline;n.delay&&(i.incrementTime(n.delay),r.snapshotCurrentStyles());let o=e.style;o.type==we.Keyframes?this.visitKeyframes(o,i):(i.incrementTime(n.duration),this.visitStyle(o,i),r.applyStylesToKeyframe()),i.currentAnimateTimings=null,i.previousNode=e}visitStyle(e,i){let n=i.currentTimeline,r=i.currentAnimateTimings;!r&&n.hasCurrentStyleProperties()&&n.forwardFrame();let o=r&&r.easing||e.easing;e.isEmptyStep?n.applyEmptyStep(o):n.setStyles(e.styles,o,i.errors,i.options),i.previousNode=e}visitKeyframes(e,i){let n=i.currentAnimateTimings,r=i.currentTimeline.duration,o=n.duration,a=i.createSubContext().currentTimeline;a.easing=n.easing,e.styles.forEach(u=>{let l=u.offset||0;a.forwardTime(l*o),a.setStyles(u.styles,u.easing,i.errors,i.options),a.applyStylesToKeyframe()}),i.currentTimeline.mergeTimelineCollectedStyles(a),i.transformIntoNewTimeline(r+o),i.previousNode=e}visitQuery(e,i){let n=i.currentTimeline.currentTime,r=e.options||{},o=r.delay?eo(r.delay):0;o&&(i.previousNode.type===we.Style||n==0&&i.currentTimeline.hasCurrentStyleProperties())&&(i.currentTimeline.snapshotCurrentStyles(),i.previousNode=Zf);let s=n,a=i.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!r.optional,i.errors);i.currentQueryTotal=a.length;let u=null;a.forEach((l,c)=>{i.currentQueryIndex=c;let f=i.createSubContext(e.options,l);o&&f.delayNextStep(o),l===i.element&&(u=f.currentTimeline),li(this,e.animation,f),f.currentTimeline.applyStylesToKeyframe();let p=f.currentTimeline.currentTime;s=Math.max(s,p)}),i.currentQueryIndex=0,i.currentQueryTotal=0,i.transformIntoNewTimeline(s),u&&(i.currentTimeline.mergeTimelineCollectedStyles(u),i.currentTimeline.snapshotCurrentStyles()),i.previousNode=e}visitStagger(e,i){let n=i.parentContext,r=i.currentTimeline,o=e.timings,s=Math.abs(o.duration),a=s*(i.currentQueryTotal-1),u=s*i.currentQueryIndex;switch(o.duration<0?"reverse":o.easing){case"reverse":u=a-u;break;case"full":u=n.currentStaggerTime;break}let c=i.currentTimeline;u&&c.delayNextStep(u);let f=c.currentTime;li(this,e.animation,i),i.previousNode=e,n.currentStaggerTime=r.currentTime-f+(r.startTime-n.currentTimeline.startTime)}},Zf={},Hy=class t{constructor(e,i,n,r,o,s,a,u){d(this,"_driver");d(this,"element");d(this,"subInstructions");d(this,"_enterClassName");d(this,"_leaveClassName");d(this,"errors");d(this,"timelines");d(this,"parentContext",null);d(this,"currentTimeline");d(this,"currentAnimateTimings",null);d(this,"previousNode",Zf);d(this,"subContextCount",0);d(this,"options",{});d(this,"currentQueryIndex",0);d(this,"currentQueryTotal",0);d(this,"currentStaggerTime",0);this._driver=e,this.element=i,this.subInstructions=n,this._enterClassName=r,this._leaveClassName=o,this.errors=s,this.timelines=a,this.currentTimeline=u||new Kf(this._driver,i,0),a.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,i){if(!e)return;let n=e,r=this.options;n.duration!=null&&(r.duration=eo(n.duration)),n.delay!=null&&(r.delay=eo(n.delay));let o=n.params;if(o){let s=r.params;s||(s=this.options.params={}),Object.keys(o).forEach(a=>{(!i||!s.hasOwnProperty(a))&&(s[a]=hl(o[a],s,this.errors))})}}_copyOptions(){let e={};if(this.options){let i=this.options.params;if(i){let n=e.params={};Object.keys(i).forEach(r=>{n[r]=i[r]})}}return e}createSubContext(e=null,i,n){let r=i||this.element,o=new t(this._driver,r,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(r,n||0));return o.previousNode=this.previousNode,o.currentAnimateTimings=this.currentAnimateTimings,o.options=this._copyOptions(),o.updateOptions(e),o.currentQueryIndex=this.currentQueryIndex,o.currentQueryTotal=this.currentQueryTotal,o.parentContext=this,this.subContextCount++,o}transformIntoNewTimeline(e){return this.previousNode=Zf,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,i,n){let r={duration:i??e.duration,delay:this.currentTimeline.currentTime+(n??0)+e.delay,easing:""},o=new By(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,r,e.stretchStartingKeyframe);return this.timelines.push(o),r}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,i,n,r,o,s){let a=[];if(r&&a.push(this.element),e.length>0){e=e.replace(e8,"."+this._enterClassName),e=e.replace(n8,"."+this._leaveClassName);let u=n!=1,l=this._driver.query(this.element,e,u);n!==0&&(l=n<0?l.slice(l.length+n,l.length):l.slice(0,n)),a.push(...l)}return!o&&a.length==0&&s.push(m5(i)),a}},Kf=class t{constructor(e,i,n,r){d(this,"_driver");d(this,"element");d(this,"startTime");d(this,"_elementTimelineStylesLookup");d(this,"duration",0);d(this,"easing",null);d(this,"_previousKeyframe",new Map);d(this,"_currentKeyframe",new Map);d(this,"_keyframes",new Map);d(this,"_styleSummary",new Map);d(this,"_localTimelineStyles",new Map);d(this,"_globalTimelineStyles");d(this,"_pendingStyles",new Map);d(this,"_backFill",new Map);d(this,"_currentEmptyStepKeyframe",null);this._driver=e,this.element=i,this.startTime=n,this._elementTimelineStylesLookup=r,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(i),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(i,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let i=this._keyframes.size===1&&this._pendingStyles.size;this.duration||i?(this.forwardTime(this.currentTime+e),i&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,i){return this.applyStylesToKeyframe(),new t(this._driver,e,i||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=X5,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,i){this._localTimelineStyles.set(e,i),this._globalTimelineStyles.set(e,i),this._styleSummary.set(e,{time:this.currentTime,value:i})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[i,n]of this._globalTimelineStyles)this._backFill.set(i,n||Cr),this._currentKeyframe.set(i,Cr);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,i,n,r){i&&this._previousKeyframe.set("easing",i);let o=r&&r.params||{},s=i8(e,this._globalTimelineStyles);for(let[a,u]of s){let l=hl(u,o,n);this._pendingStyles.set(a,l),this._localTimelineStyles.has(a)||this._backFill.set(a,this._globalTimelineStyles.get(a)??Cr),this._updateStyle(a,l)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,i)=>{this._currentKeyframe.set(i,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,i)=>{this._currentKeyframe.has(i)||this._currentKeyframe.set(i,e)}))}snapshotCurrentStyles(){for(let[e,i]of this._localTimelineStyles)this._pendingStyles.set(e,i),this._updateStyle(e,i)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let i in this._currentKeyframe)e.push(i);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((i,n)=>{let r=this._styleSummary.get(n);(!r||i.time>r.time)&&this._updateStyle(n,i.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,i=new Set,n=this._keyframes.size===1&&this.duration===0,r=[];this._keyframes.forEach((a,u)=>{let l=new Map([...this._backFill,...a]);l.forEach((c,f)=>{c===Bf?e.add(f):c===Cr&&i.add(f)}),n||l.set("offset",u/this.duration),r.push(l)});let o=[...e.values()],s=[...i.values()];if(n){let a=r[0],u=new Map(a);a.set("offset",0),u.set("offset",1),r=[a,u]}return Qy(this.element,r,o,s,this.duration,this.startTime,this.easing,!1)}},By=class extends Kf{constructor(i,n,r,o,s,a,u=!1){super(i,n,a.delay);d(this,"keyframes");d(this,"preStyleProps");d(this,"postStyleProps");d(this,"_stretchStartingKeyframe");d(this,"timings");this.keyframes=r,this.preStyleProps=o,this.postStyleProps=s,this._stretchStartingKeyframe=u,this.timings={duration:a.duration,delay:a.delay,easing:a.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let i=this.keyframes,{delay:n,duration:r,easing:o}=this.timings;if(this._stretchStartingKeyframe&&n){let s=[],a=r+n,u=n/a,l=new Map(i[0]);l.set("offset",0),s.push(l);let c=new Map(i[0]);c.set("offset",Lx(u)),s.push(c);let f=i.length-1;for(let p=1;p<=f;p++){let m=new Map(i[p]),g=m.get("offset"),y=n+g*r;m.set("offset",Lx(y/a)),s.push(m)}r=a,n=0,o="",i=s}return Qy(this.element,i,this.preStyleProps,this.postStyleProps,r,n,o,!0)}};function Lx(t,e=3){let i=Math.pow(10,e-1);return Math.round(t*i)/i}function i8(t,e){let i=new Map,n;return t.forEach(r=>{if(r==="*"){n??(n=e.keys());for(let o of n)i.set(o,Cr)}else for(let[o,s]of r)i.set(o,s)}),i}function Hx(t,e,i,n,r,o,s,a,u,l,c,f,p){return{type:0,element:t,triggerName:e,isRemovalTransition:r,fromState:i,fromStyles:o,toState:n,toStyles:s,timelines:a,queriedElements:u,preStyleProps:l,postStyleProps:c,totalTime:f,errors:p}}var xy={},Yf=class{constructor(e,i,n){d(this,"_triggerName");d(this,"ast");d(this,"_stateStyles");this._triggerName=e,this.ast=i,this._stateStyles=n}match(e,i,n,r){return r8(this.ast.matchers,e,i,n,r)}buildStyles(e,i,n){let r=this._stateStyles.get("*");return e!==void 0&&(r=this._stateStyles.get(e==null?void 0:e.toString())||r),r?r.buildStyles(i,n):new Map}build(e,i,n,r,o,s,a,u,l,c){var Pe;let f=[],p=this.ast.options&&this.ast.options.params||xy,m=a&&a.params||xy,g=this.buildStyles(n,m,f),y=u&&u.params||xy,b=this.buildStyles(r,y,f),D=new Set,I=new Map,N=new Map,A=r==="void",V={params:nI(y,p),delay:(Pe=this.ast.options)==null?void 0:Pe.delay},z=c?[]:tI(e,i,this.ast.animation,o,s,g,b,V,l,f),ae=0;return z.forEach(mt=>{ae=Math.max(mt.duration+mt.delay,ae)}),f.length?Hx(i,this._triggerName,n,r,A,g,b,[],[],I,N,ae,f):(z.forEach(mt=>{let At=mt.element,Oi=ci(I,At,new Set);mt.preStyleProps.forEach(hi=>Oi.add(hi));let Ni=ci(N,At,new Set);mt.postStyleProps.forEach(hi=>Ni.add(hi)),At!==i&&D.add(At)}),Hx(i,this._triggerName,n,r,A,g,b,z,[...D.values()],I,N,ae))}};function r8(t,e,i,n,r){return t.some(o=>o(e,i,n,r))}function nI(t,e){let i=M({},e);return Object.entries(t).forEach(([n,r])=>{r!=null&&(i[n]=r)}),i}var Vy=class{constructor(e,i,n){d(this,"styles");d(this,"defaultParams");d(this,"normalizer");this.styles=e,this.defaultParams=i,this.normalizer=n}buildStyles(e,i){let n=new Map,r=nI(e,this.defaultParams);return this.styles.styles.forEach(o=>{typeof o!="string"&&o.forEach((s,a)=>{s&&(s=hl(s,r,i));let u=this.normalizer.normalizePropertyName(a,i);s=this.normalizer.normalizeStyleValue(a,u,s,i),n.set(a,s)})}),n}};function o8(t,e,i){return new zy(t,e,i)}var zy=class{constructor(e,i,n){d(this,"name");d(this,"ast");d(this,"_normalizer");d(this,"transitionFactories",[]);d(this,"fallbackTransition");d(this,"states",new Map);this.name=e,this.ast=i,this._normalizer=n,i.states.forEach(r=>{let o=r.options&&r.options.params||{};this.states.set(r.name,new Vy(r.style,o,n))}),Bx(this.states,"true","1"),Bx(this.states,"false","0"),i.transitions.forEach(r=>{this.transitionFactories.push(new Yf(e,r,this.states))}),this.fallbackTransition=s8(e,this.states,this._normalizer)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,i,n,r){return this.transitionFactories.find(s=>s.match(e,i,n,r))||null}matchStyles(e,i,n){return this.fallbackTransition.buildStyles(e,i,n)}};function s8(t,e,i){let n=[(s,a)=>!0],r={type:we.Sequence,steps:[],options:null},o={type:we.Transition,animation:r,matchers:n,options:null,queryCount:0,depCount:0};return new Yf(t,o,e)}function Bx(t,e,i){t.has(e)?t.has(i)||t.set(i,t.get(e)):t.has(i)&&t.set(e,t.get(i))}var a8=new ml,jy=class{constructor(e,i,n){d(this,"bodyNode");d(this,"_driver");d(this,"_normalizer");d(this,"_animations",new Map);d(this,"_playersById",new Map);d(this,"players",[]);this.bodyNode=e,this._driver=i,this._normalizer=n}register(e,i){let n=[],r=[],o=eI(this._driver,i,n,r);if(n.length)throw _5(n);r.length&&void 0,this._animations.set(e,o)}_buildPlayer(e,i,n){let r=e.element,o=qx(this._normalizer,e.keyframes,i,n);return this._driver.animate(r,o,e.duration,e.delay,e.easing,[],!0)}create(e,i,n={}){let r=[],o=this._animations.get(e),s,a=new Map;if(o?(s=tI(this._driver,i,o,Qx,ky,new Map,new Map,n,a8,r),s.forEach(c=>{let f=ci(a,c.element,new Map);c.postStyleProps.forEach(p=>f.set(p,null))})):(r.push(C5()),s=[]),r.length)throw D5(r);a.forEach((c,f)=>{c.forEach((p,m)=>{c.set(m,this._driver.computeStyle(f,m,Cr))})});let u=s.map(c=>{let f=a.get(c.element);return this._buildPlayer(c,new Map,f)}),l=Ro(u);return this._playersById.set(e,l),l.onDestroy(()=>this.destroy(e)),this.players.push(l),l}destroy(e){let i=this._getPlayer(e);i.destroy(),this._playersById.delete(e);let n=this.players.indexOf(i);n>=0&&this.players.splice(n,1)}_getPlayer(e){let i=this._playersById.get(e);if(!i)throw E5(e);return i}listen(e,i,n,r){let o=qy(i,"","","");return Wy(this._getPlayer(e),n,o,r),()=>{}}command(e,i,n,r){if(n=="register"){this.register(e,r[0]);return}if(n=="create"){let s=r[0]||{};this.create(e,i,s);return}let o=this._getPlayer(e);switch(n){case"play":o.play();break;case"pause":o.pause();break;case"reset":o.reset();break;case"restart":o.restart();break;case"finish":o.finish();break;case"init":o.init();break;case"setPosition":o.setPosition(parseFloat(r[0]));break;case"destroy":this.destroy(e);break}}},Vx="ng-animate-queued",u8=".ng-animate-queued",Iy="ng-animate-disabled",l8=".ng-animate-disabled",c8="ng-star-inserted",d8=".ng-star-inserted",f8=[],iI={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},p8={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},Yi="__ng_removed",gl=class{constructor(e,i=""){d(this,"namespaceId");d(this,"value");d(this,"options");this.namespaceId=i;let n=e&&e.hasOwnProperty("value"),r=n?e.value:e;if(this.value=m8(r),n){let o=e,{value:s}=o,a=ho(o,["value"]);this.options=a}else this.options={};this.options.params||(this.options.params={})}get params(){return this.options.params}absorbOptions(e){let i=e.params;if(i){let n=this.options.params;Object.keys(i).forEach(r=>{n[r]==null&&(n[r]=i[r])})}}},pl="void",Sy=new gl(pl),Uy=class{constructor(e,i,n){d(this,"id");d(this,"hostElement");d(this,"_engine");d(this,"players",[]);d(this,"_triggers",new Map);d(this,"_queue",[]);d(this,"_elementListeners",new Map);d(this,"_hostClassName");this.id=e,this.hostElement=i,this._engine=n,this._hostClassName="ng-tns-"+e,wi(i,this._hostClassName)}listen(e,i,n,r){if(!this._triggers.has(i))throw w5(n,i);if(n==null||n.length==0)throw T5(i);if(!g8(n))throw x5(n,i);let o=ci(this._elementListeners,e,[]),s={name:i,phase:n,callback:r};o.push(s);let a=ci(this._engine.statesByElement,e,new Map);return a.has(i)||(wi(e,Vf),wi(e,Vf+"-"+i),a.set(i,Sy)),()=>{this._engine.afterFlush(()=>{let u=o.indexOf(s);u>=0&&o.splice(u,1),this._triggers.has(i)||a.delete(i)})}}register(e,i){return this._triggers.has(e)?!1:(this._triggers.set(e,i),!0)}_getTrigger(e){let i=this._triggers.get(e);if(!i)throw I5(e);return i}trigger(e,i,n,r=!0){let o=this._getTrigger(i),s=new yl(this.id,i,e),a=this._engine.statesByElement.get(e);a||(wi(e,Vf),wi(e,Vf+"-"+i),this._engine.statesByElement.set(e,a=new Map));let u=a.get(i),l=new gl(n,this.id);if(!(n&&n.hasOwnProperty("value"))&&u&&l.absorbOptions(u.options),a.set(i,l),u||(u=Sy),!(l.value===pl)&&u.value===l.value){if(!b8(u.params,l.params)){let y=[],b=o.matchStyles(u.value,u.params,y),D=o.matchStyles(l.value,l.params,y);y.length?this._engine.reportError(y):this._engine.afterFlush(()=>{_s(e,b),Dr(e,D)})}return}let p=ci(this._engine.playersByElement,e,[]);p.forEach(y=>{y.namespaceId==this.id&&y.triggerName==i&&y.queued&&y.destroy()});let m=o.matchTransition(u.value,l.value,e,l.params),g=!1;if(!m){if(!r)return;m=o.fallbackTransition,g=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:i,transition:m,fromState:u,toState:l,player:s,isFallbackTransition:g}),g||(wi(e,Vx),s.onStart(()=>{Oa(e,Vx)})),s.onDone(()=>{let y=this.players.indexOf(s);y>=0&&this.players.splice(y,1);let b=this._engine.playersByElement.get(e);if(b){let D=b.indexOf(s);D>=0&&b.splice(D,1)}}),this.players.push(s),p.push(s),s}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(i=>i.delete(e)),this._elementListeners.forEach((i,n)=>{this._elementListeners.set(n,i.filter(r=>r.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let i=this._engine.playersByElement.get(e);i&&(i.forEach(n=>n.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,i){let n=this._engine.driver.query(e,Gf,!0);n.forEach(r=>{if(r[Yi])return;let o=this._engine.fetchNamespacesByElement(r);o.size?o.forEach(s=>s.triggerLeaveAnimation(r,i,!1,!0)):this.clearElementCache(r)}),this._engine.afterFlushAnimationsDone(()=>n.forEach(r=>this.clearElementCache(r)))}triggerLeaveAnimation(e,i,n,r){let o=this._engine.statesByElement.get(e),s=new Map;if(o){let a=[];if(o.forEach((u,l)=>{if(s.set(l,u.value),this._triggers.has(l)){let c=this.trigger(e,l,pl,r);c&&a.push(c)}}),a.length)return this._engine.markElementAsRemoved(this.id,e,!0,i,s),n&&Ro(a).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let i=this._elementListeners.get(e),n=this._engine.statesByElement.get(e);if(i&&n){let r=new Set;i.forEach(o=>{let s=o.name;if(r.has(s))return;r.add(s);let u=this._triggers.get(s).fallbackTransition,l=n.get(s)||Sy,c=new gl(pl),f=new yl(this.id,s,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:s,transition:u,fromState:l,toState:c,player:f,isFallbackTransition:!0})})}}removeNode(e,i){let n=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,i),this.triggerLeaveAnimation(e,i,!0))return;let r=!1;if(n.totalAnimations){let o=n.players.length?n.playersByQueriedElement.get(e):[];if(o&&o.length)r=!0;else{let s=e;for(;s=s.parentNode;)if(n.statesByElement.get(s)){r=!0;break}}}if(this.prepareLeaveAnimationListeners(e),r)n.markElementAsRemoved(this.id,e,!1,i);else{let o=e[Yi];(!o||o===iI)&&(n.afterFlush(()=>this.clearElementCache(e)),n.destroyInnerAnimations(e),n._onRemovalComplete(e,i))}}insertNode(e,i){wi(e,this._hostClassName)}drainQueuedTransitions(e){let i=[];return this._queue.forEach(n=>{let r=n.player;if(r.destroyed)return;let o=n.element,s=this._elementListeners.get(o);s&&s.forEach(a=>{if(a.name==n.triggerName){let u=qy(o,n.triggerName,n.fromState.value,n.toState.value);u._data=e,Wy(n.player,a.phase,u,a.callback)}}),r.markedForDestroy?this._engine.afterFlush(()=>{r.destroy()}):i.push(n)}),this._queue=[],i.sort((n,r)=>{let o=n.transition.ast.depCount,s=r.transition.ast.depCount;return o==0||s==0?o-s:this._engine.driver.containsElement(n.element,r.element)?1:-1})}destroy(e){this.players.forEach(i=>i.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},$y=class{constructor(e,i,n){d(this,"bodyNode");d(this,"driver");d(this,"_normalizer");d(this,"players",[]);d(this,"newHostElements",new Map);d(this,"playersByElement",new Map);d(this,"playersByQueriedElement",new Map);d(this,"statesByElement",new Map);d(this,"disabledNodes",new Set);d(this,"totalAnimations",0);d(this,"totalQueuedPlayers",0);d(this,"_namespaceLookup",{});d(this,"_namespaceList",[]);d(this,"_flushFns",[]);d(this,"_whenQuietFns",[]);d(this,"namespacesByHostElement",new Map);d(this,"collectedEnterElements",[]);d(this,"collectedLeaveElements",[]);d(this,"onRemovalComplete",(e,i)=>{});this.bodyNode=e,this.driver=i,this._normalizer=n}_onRemovalComplete(e,i){this.onRemovalComplete(e,i)}get queuedPlayers(){let e=[];return this._namespaceList.forEach(i=>{i.players.forEach(n=>{n.queued&&e.push(n)})}),e}createNamespace(e,i){let n=new Uy(e,i,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,i)?this._balanceNamespaceList(n,i):(this.newHostElements.set(i,n),this.collectEnterElement(i)),this._namespaceLookup[e]=n}_balanceNamespaceList(e,i){let n=this._namespaceList,r=this.namespacesByHostElement;if(n.length-1>=0){let s=!1,a=this.driver.getParentElement(i);for(;a;){let u=r.get(a);if(u){let l=n.indexOf(u);n.splice(l+1,0,e),s=!0;break}a=this.driver.getParentElement(a)}s||n.unshift(e)}else n.push(e);return r.set(i,e),e}register(e,i){let n=this._namespaceLookup[e];return n||(n=this.createNamespace(e,i)),n}registerTrigger(e,i,n){let r=this._namespaceLookup[e];r&&r.register(i,n)&&this.totalAnimations++}destroy(e,i){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let n=this._fetchNamespace(e);this.namespacesByHostElement.delete(n.hostElement);let r=this._namespaceList.indexOf(n);r>=0&&this._namespaceList.splice(r,1),n.destroy(i),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let i=new Set,n=this.statesByElement.get(e);if(n){for(let r of n.values())if(r.namespaceId){let o=this._fetchNamespace(r.namespaceId);o&&i.add(o)}}return i}trigger(e,i,n,r){if(Uf(i)){let o=this._fetchNamespace(e);if(o)return o.trigger(i,n,r),!0}return!1}insertNode(e,i,n,r){if(!Uf(i))return;let o=i[Yi];if(o&&o.setForRemoval){o.setForRemoval=!1,o.setForMove=!0;let s=this.collectedLeaveElements.indexOf(i);s>=0&&this.collectedLeaveElements.splice(s,1)}if(e){let s=this._fetchNamespace(e);s&&s.insertNode(i,n)}r&&this.collectEnterElement(i)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,i){i?this.disabledNodes.has(e)||(this.disabledNodes.add(e),wi(e,Iy)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),Oa(e,Iy))}removeNode(e,i,n){if(Uf(i)){let r=e?this._fetchNamespace(e):null;r?r.removeNode(i,n):this.markElementAsRemoved(e,i,!1,n);let o=this.namespacesByHostElement.get(i);o&&o.id!==e&&o.removeNode(i,n)}else this._onRemovalComplete(i,n)}markElementAsRemoved(e,i,n,r,o){this.collectedLeaveElements.push(i),i[Yi]={namespaceId:e,setForRemoval:r,hasAnimation:n,removedBeforeQueried:!1,previousTriggersValues:o}}listen(e,i,n,r,o){return Uf(i)?this._fetchNamespace(e).listen(i,n,r,o):()=>{}}_buildInstruction(e,i,n,r,o){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,n,r,e.fromState.options,e.toState.options,i,o)}destroyInnerAnimations(e){let i=this.driver.query(e,Gf,!0);i.forEach(n=>this.destroyActiveAnimationsForElement(n)),this.playersByQueriedElement.size!=0&&(i=this.driver.query(e,Oy,!0),i.forEach(n=>this.finishActiveQueriedAnimationOnElement(n)))}destroyActiveAnimationsForElement(e){let i=this.playersByElement.get(e);i&&i.forEach(n=>{n.queued?n.markedForDestroy=!0:n.destroy()})}finishActiveQueriedAnimationOnElement(e){let i=this.playersByQueriedElement.get(e);i&&i.forEach(n=>n.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return Ro(this.players).onDone(()=>e());e()})}processLeaveNode(e){var n;let i=e[Yi];if(i&&i.setForRemoval){if(e[Yi]=iI,i.namespaceId){this.destroyInnerAnimations(e);let r=this._fetchNamespace(i.namespaceId);r&&r.clearElementCache(e)}this._onRemovalComplete(e,i.setForRemoval)}(n=e.classList)!=null&&n.contains(Iy)&&this.markElementAsDisabled(e,!1),this.driver.query(e,l8,!0).forEach(r=>{this.markElementAsDisabled(r,!1)})}flush(e=-1){let i=[];if(this.newHostElements.size&&(this.newHostElements.forEach((n,r)=>this._balanceNamespaceList(n,r)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let n=0;nn()),this._flushFns=[],this._whenQuietFns.length){let n=this._whenQuietFns;this._whenQuietFns=[],i.length?Ro(i).onDone(()=>{n.forEach(r=>r())}):n.forEach(r=>r())}}reportError(e){throw S5(e)}_flushAnimations(e,i){let n=new ml,r=[],o=new Map,s=[],a=new Map,u=new Map,l=new Map,c=new Set;this.disabledNodes.forEach(G=>{c.add(G);let ne=this.driver.query(G,u8,!0);for(let ue=0;ue{let ue=Qx+y++;g.set(ne,ue),G.forEach(et=>wi(et,ue))});let b=[],D=new Set,I=new Set;for(let G=0;GD.add(et)):I.add(ne))}let N=new Map,A=Ux(p,Array.from(D));A.forEach((G,ne)=>{let ue=ky+y++;N.set(ne,ue),G.forEach(et=>wi(et,ue))}),e.push(()=>{m.forEach((G,ne)=>{let ue=g.get(ne);G.forEach(et=>Oa(et,ue))}),A.forEach((G,ne)=>{let ue=N.get(ne);G.forEach(et=>Oa(et,ue))}),b.forEach(G=>{this.processLeaveNode(G)})});let V=[],z=[];for(let G=this._namespaceList.length-1;G>=0;G--)this._namespaceList[G].drainQueuedTransitions(i).forEach(ue=>{let et=ue.player,tn=ue.element;if(V.push(et),this.collectedEnterElements.length){let gn=tn[Yi];if(gn&&gn.setForMove){if(gn.previousTriggersValues&&gn.previousTriggersValues.has(ue.triggerName)){let qo=gn.previousTriggersValues.get(ue.triggerName),mi=this.statesByElement.get(ue.element);if(mi&&mi.has(ue.triggerName)){let tc=mi.get(ue.triggerName);tc.value=qo,mi.set(ue.triggerName,tc)}}et.destroy();return}}let or=!f||!this.driver.containsElement(f,tn),Qn=N.get(tn),po=g.get(tn),kt=this._buildInstruction(ue,n,po,Qn,or);if(kt.errors&&kt.errors.length){z.push(kt);return}if(or){et.onStart(()=>_s(tn,kt.fromStyles)),et.onDestroy(()=>Dr(tn,kt.toStyles)),r.push(et);return}if(ue.isFallbackTransition){et.onStart(()=>_s(tn,kt.fromStyles)),et.onDestroy(()=>Dr(tn,kt.toStyles)),r.push(et);return}let c1=[];kt.timelines.forEach(gn=>{gn.stretchStartingKeyframe=!0,this.disabledNodes.has(gn.element)||c1.push(gn)}),kt.timelines=c1,n.append(tn,kt.timelines);let mO={instruction:kt,player:et,element:tn};s.push(mO),kt.queriedElements.forEach(gn=>ci(a,gn,[]).push(et)),kt.preStyleProps.forEach((gn,qo)=>{if(gn.size){let mi=u.get(qo);mi||u.set(qo,mi=new Set),gn.forEach((tc,Jh)=>mi.add(Jh))}}),kt.postStyleProps.forEach((gn,qo)=>{let mi=l.get(qo);mi||l.set(qo,mi=new Set),gn.forEach((tc,Jh)=>mi.add(Jh))})});if(z.length){let G=[];z.forEach(ne=>{G.push(M5(ne.triggerName,ne.errors))}),V.forEach(ne=>ne.destroy()),this.reportError(G)}let ae=new Map,Pe=new Map;s.forEach(G=>{let ne=G.element;n.has(ne)&&(Pe.set(ne,ne),this._beforeAnimationBuild(G.player.namespaceId,G.instruction,ae))}),r.forEach(G=>{let ne=G.element;this._getPreviousPlayers(ne,!1,G.namespaceId,G.triggerName,null).forEach(et=>{ci(ae,ne,[]).push(et),et.destroy()})});let mt=b.filter(G=>$x(G,u,l)),At=new Map;jx(At,this.driver,I,l,Cr).forEach(G=>{$x(G,u,l)&&mt.push(G)});let Ni=new Map;m.forEach((G,ne)=>{jx(Ni,this.driver,new Set(G),u,Bf)}),mt.forEach(G=>{let ne=At.get(G),ue=Ni.get(G);At.set(G,new Map([...(ne==null?void 0:ne.entries())??[],...(ue==null?void 0:ue.entries())??[]]))});let hi=[],Or=[],Hn={};s.forEach(G=>{let{element:ne,player:ue,instruction:et}=G;if(n.has(ne)){if(c.has(ne)){ue.onDestroy(()=>Dr(ne,et.toStyles)),ue.disabled=!0,ue.overrideTotalTime(et.totalTime),r.push(ue);return}let tn=Hn;if(Pe.size>1){let Qn=ne,po=[];for(;Qn=Qn.parentNode;){let kt=Pe.get(Qn);if(kt){tn=kt;break}po.push(Qn)}po.forEach(kt=>Pe.set(kt,tn))}let or=this._buildAnimation(ue.namespaceId,et,ae,o,Ni,At);if(ue.setRealPlayer(or),tn===Hn)hi.push(ue);else{let Qn=this.playersByElement.get(tn);Qn&&Qn.length&&(ue.parentPlayer=Ro(Qn)),r.push(ue)}}else _s(ne,et.fromStyles),ue.onDestroy(()=>Dr(ne,et.toStyles)),Or.push(ue),c.has(ne)&&r.push(ue)}),Or.forEach(G=>{let ne=o.get(G.element);if(ne&&ne.length){let ue=Ro(ne);G.setRealPlayer(ue)}}),r.forEach(G=>{G.parentPlayer?G.syncPlayerEvents(G.parentPlayer):G.destroy()});for(let G=0;G!or.destroyed);tn.length?y8(this,ne,tn):this.processLeaveNode(ne)}return b.length=0,hi.forEach(G=>{this.players.push(G),G.onDone(()=>{G.destroy();let ne=this.players.indexOf(G);this.players.splice(ne,1)}),G.play()}),hi}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,i,n,r,o){let s=[];if(i){let a=this.playersByQueriedElement.get(e);a&&(s=a)}else{let a=this.playersByElement.get(e);if(a){let u=!o||o==pl;a.forEach(l=>{l.queued||!u&&l.triggerName!=r||s.push(l)})}}return(n||r)&&(s=s.filter(a=>!(n&&n!=a.namespaceId||r&&r!=a.triggerName))),s}_beforeAnimationBuild(e,i,n){let r=i.triggerName,o=i.element,s=i.isRemovalTransition?void 0:e,a=i.isRemovalTransition?void 0:r;for(let u of i.timelines){let l=u.element,c=l!==o,f=ci(n,l,[]);this._getPreviousPlayers(l,c,s,a,i.toState).forEach(m=>{let g=m.getRealPlayer();g.beforeDestroy&&g.beforeDestroy(),m.destroy(),f.push(m)})}_s(o,i.fromStyles)}_buildAnimation(e,i,n,r,o,s){let a=i.triggerName,u=i.element,l=[],c=new Set,f=new Set,p=i.timelines.map(g=>{let y=g.element;c.add(y);let b=y[Yi];if(b&&b.removedBeforeQueried)return new Fo(g.duration,g.delay);let D=y!==u,I=v8((n.get(y)||f8).map(ae=>ae.getRealPlayer())).filter(ae=>{let Pe=ae;return Pe.element?Pe.element===y:!1}),N=o.get(y),A=s.get(y),V=qx(this._normalizer,g.keyframes,N,A),z=this._buildPlayer(g,V,I);if(g.subTimeline&&r&&f.add(y),D){let ae=new yl(e,a,y);ae.setRealPlayer(z),l.push(ae)}return z});l.forEach(g=>{ci(this.playersByQueriedElement,g.element,[]).push(g),g.onDone(()=>h8(this.playersByQueriedElement,g.element,g))}),c.forEach(g=>wi(g,Nx));let m=Ro(p);return m.onDestroy(()=>{c.forEach(g=>Oa(g,Nx)),Dr(u,i.toStyles)}),f.forEach(g=>{ci(r,g,[]).push(m)}),m}_buildPlayer(e,i,n){return i.length>0?this.driver.animate(e.element,i,e.duration,e.delay,e.easing,n):new Fo(e.duration,e.delay)}},yl=class{constructor(e,i,n){d(this,"namespaceId");d(this,"triggerName");d(this,"element");d(this,"_player",new Fo);d(this,"_containsRealPlayer",!1);d(this,"_queuedCallbacks",new Map);d(this,"destroyed",!1);d(this,"parentPlayer",null);d(this,"markedForDestroy",!1);d(this,"disabled",!1);d(this,"queued",!0);d(this,"totalTime",0);this.namespaceId=e,this.triggerName=i,this.element=n}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((i,n)=>{i.forEach(r=>Wy(e,n,void 0,r))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let i=this._player;i.triggerCallback&&e.onStart(()=>i.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,i){ci(this._queuedCallbacks,e,[]).push(i)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let i=this._player;i.triggerCallback&&i.triggerCallback(e)}};function h8(t,e,i){let n=t.get(e);if(n){if(n.length){let r=n.indexOf(i);n.splice(r,1)}n.length==0&&t.delete(e)}return n}function m8(t){return t??null}function Uf(t){return t&&t.nodeType===1}function g8(t){return t=="start"||t=="done"}function zx(t,e){let i=t.style.display;return t.style.display=e??"none",i}function jx(t,e,i,n,r){let o=[];i.forEach(u=>o.push(zx(u)));let s=[];n.forEach((u,l)=>{let c=new Map;u.forEach(f=>{let p=e.computeStyle(l,f,r);c.set(f,p),(!p||p.length==0)&&(l[Yi]=p8,s.push(l))}),t.set(l,c)});let a=0;return i.forEach(u=>zx(u,o[a++])),s}function Ux(t,e){let i=new Map;if(t.forEach(a=>i.set(a,[])),e.length==0)return i;let n=1,r=new Set(e),o=new Map;function s(a){if(!a)return n;let u=o.get(a);if(u)return u;let l=a.parentNode;return i.has(l)?u=l:r.has(l)?u=n:u=s(l),o.set(a,u),u}return e.forEach(a=>{let u=s(a);u!==n&&i.get(u).push(a)}),i}function wi(t,e){var i;(i=t.classList)==null||i.add(e)}function Oa(t,e){var i;(i=t.classList)==null||i.remove(e)}function y8(t,e,i){Ro(i).onDone(()=>t.processLeaveNode(e))}function v8(t){let e=[];return rI(t,e),e}function rI(t,e){for(let i=0;ir.add(o)):e.set(t,n),i.delete(t),!0}var Qf=class{constructor(e,i,n){d(this,"_driver");d(this,"_normalizer");d(this,"_transitionEngine");d(this,"_timelineEngine");d(this,"_triggerCache",{});d(this,"onRemovalComplete",(e,i)=>{});this._driver=i,this._normalizer=n,this._transitionEngine=new $y(e.body,i,n),this._timelineEngine=new jy(e.body,i,n),this._transitionEngine.onRemovalComplete=(r,o)=>this.onRemovalComplete(r,o)}registerTrigger(e,i,n,r,o){let s=e+"-"+r,a=this._triggerCache[s];if(!a){let u=[],l=[],c=eI(this._driver,o,u,l);if(u.length)throw v5(r,u);l.length&&void 0,a=o8(r,c,this._normalizer),this._triggerCache[s]=a}this._transitionEngine.registerTrigger(i,r,a)}register(e,i){this._transitionEngine.register(e,i)}destroy(e,i){this._transitionEngine.destroy(e,i)}onInsert(e,i,n,r){this._transitionEngine.insertNode(e,i,n,r)}onRemove(e,i,n){this._transitionEngine.removeNode(e,i,n)}disableAnimations(e,i){this._transitionEngine.markElementAsDisabled(e,i)}process(e,i,n,r){if(n.charAt(0)=="@"){let[o,s]=kx(n),a=r;this._timelineEngine.command(o,i,s,a)}else this._transitionEngine.trigger(e,i,n,r)}listen(e,i,n,r,o){if(n.charAt(0)=="@"){let[s,a]=kx(n);return this._timelineEngine.listen(s,i,a,o)}return this._transitionEngine.listen(e,i,n,r,o)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function _8(t,e){let i=null,n=null;return Array.isArray(e)&&e.length?(i=My(e[0]),e.length>1&&(n=My(e[e.length-1]))):e instanceof Map&&(i=My(e)),i||n?new C8(t,i,n):null}var C8=(()=>{let e=class e{constructor(n,r,o){d(this,"_element");d(this,"_startStyles");d(this,"_endStyles");d(this,"_state",0);d(this,"_initialStyles");this._element=n,this._startStyles=r,this._endStyles=o;let s=e.initialStylesByElement.get(n);s||e.initialStylesByElement.set(n,s=new Map),this._initialStyles=s}start(){this._state<1&&(this._startStyles&&Dr(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(Dr(this._element,this._initialStyles),this._endStyles&&(Dr(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(e.initialStylesByElement.delete(this._element),this._startStyles&&(_s(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(_s(this._element,this._endStyles),this._endStyles=null),Dr(this._element,this._initialStyles),this._state=3)}};d(e,"initialStylesByElement",new WeakMap);let t=e;return t})();function My(t){let e=null;return t.forEach((i,n)=>{D8(n)&&(e=e||new Map,e.set(n,i))}),e}function D8(t){return t==="display"||t==="position"}var Xf=class{constructor(e,i,n,r){d(this,"element");d(this,"keyframes");d(this,"options");d(this,"_specialStyles");d(this,"_onDoneFns",[]);d(this,"_onStartFns",[]);d(this,"_onDestroyFns",[]);d(this,"_duration");d(this,"_delay");d(this,"_initialized",!1);d(this,"_finished",!1);d(this,"_started",!1);d(this,"_destroyed",!1);d(this,"_finalKeyframe");d(this,"_originalOnDoneFns",[]);d(this,"_originalOnStartFns",[]);d(this,"domPlayer");d(this,"time",0);d(this,"parentPlayer",null);d(this,"currentSnapshot",new Map);this.element=e,this.keyframes=i,this.options=n,this._specialStyles=r,this._duration=n.duration,this._delay=n.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let e=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,e,this.options),this._finalKeyframe=e.length?e[e.length-1]:new Map;let i=()=>this._onFinish();this.domPlayer.addEventListener("finish",i),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",i)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(e){let i=[];return e.forEach(n=>{i.push(Object.fromEntries(n))}),i}_triggerWebAnimation(e,i,n){return e.animate(this._convertKeyframesToObject(i),n)}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(e=>e()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=e*this.time}getPosition(){return+(this.domPlayer.currentTime??0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((n,r)=>{r!=="offset"&&e.set(r,this._finished?n:Yy(this.element,r))}),this.currentSnapshot=e}triggerCallback(e){let i=e==="start"?this._onStartFns:this._onDoneFns;i.forEach(n=>n()),i.length=0}},Gx=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,i){return Zx(e,i)}getParentElement(e){return Zy(e)}query(e,i,n){return Kx(e,i,n)}computeStyle(e,i,n){return Yy(e,i)}animate(e,i,n,r,o,s=[]){let a=r==0?"both":"forwards",u={duration:n,delay:r,fill:a};o&&(u.easing=o);let l=new Map,c=s.filter(m=>m instanceof Xf);z5(n,r)&&c.forEach(m=>{m.currentSnapshot.forEach((g,y)=>l.set(y,g))});let f=H5(i).map(m=>new Map(m));f=j5(e,f,l);let p=_8(e,f);return new Xf(e,f,u,p)}};var $f="@",oI="@.disabled",Jf=class{constructor(e,i,n,r){d(this,"namespaceId");d(this,"delegate");d(this,"engine");d(this,"_onDestroy");d(this,"\u0275type",0);this.namespaceId=e,this.delegate=i,this.engine=n,this._onDestroy=r}get data(){return this.delegate.data}destroyNode(e){var i,n;(n=(i=this.delegate).destroyNode)==null||n.call(i,e)}destroy(){var e;this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),(e=this._onDestroy)==null||e.call(this)}createElement(e,i){return this.delegate.createElement(e,i)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,i){this.delegate.appendChild(e,i),this.engine.onInsert(this.namespaceId,i,e,!1)}insertBefore(e,i,n,r=!0){this.delegate.insertBefore(e,i,n),this.engine.onInsert(this.namespaceId,i,e,r)}removeChild(e,i,n){this.parentNode(i)&&this.engine.onRemove(this.namespaceId,i,this.delegate)}selectRootElement(e,i){return this.delegate.selectRootElement(e,i)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,i,n,r){this.delegate.setAttribute(e,i,n,r)}removeAttribute(e,i,n){this.delegate.removeAttribute(e,i,n)}addClass(e,i){this.delegate.addClass(e,i)}removeClass(e,i){this.delegate.removeClass(e,i)}setStyle(e,i,n,r){this.delegate.setStyle(e,i,n,r)}removeStyle(e,i,n){this.delegate.removeStyle(e,i,n)}setProperty(e,i,n){i.charAt(0)==$f&&i==oI?this.disableAnimations(e,!!n):this.delegate.setProperty(e,i,n)}setValue(e,i){this.delegate.setValue(e,i)}listen(e,i,n){return this.delegate.listen(e,i,n)}disableAnimations(e,i){this.engine.disableAnimations(e,i)}},Gy=class extends Jf{constructor(i,n,r,o,s){super(n,r,o,s);d(this,"factory");this.factory=i,this.namespaceId=n}setProperty(i,n,r){n.charAt(0)==$f?n.charAt(1)=="."&&n==oI?(r=r===void 0?!0:!!r,this.disableAnimations(i,r)):this.engine.process(this.namespaceId,i,n.slice(1),r):this.delegate.setProperty(i,n,r)}listen(i,n,r){if(n.charAt(0)==$f){let o=E8(i),s=n.slice(1),a="";return s.charAt(0)!=$f&&([s,a]=w8(s)),this.engine.listen(this.namespaceId,o,s,a,u=>{let l=u._data||-1;this.factory.scheduleListenerCallback(l,r,u)})}return this.delegate.listen(i,n,r)}};function E8(t){switch(t){case"body":return document.body;case"document":return document;case"window":return window;default:return t}}function w8(t){let e=t.indexOf("."),i=t.substring(0,e),n=t.slice(e+1);return[i,n]}var Wx=class{constructor(e,i,n){d(this,"delegate");d(this,"engine");d(this,"_zone");d(this,"_currentId",0);d(this,"_microtaskId",1);d(this,"_animationCallbacksBuffer",[]);d(this,"_rendererCache",new Map);d(this,"_cdRecurDepth",0);this.delegate=e,this.engine=i,this._zone=n,i.onRemovalComplete=(r,o)=>{o==null||o.removeChild(null,r)}}createRenderer(e,i){var l;let n="",r=this.delegate.createRenderer(e,i);if(!e||!((l=i==null?void 0:i.data)!=null&&l.animation)){let c=this._rendererCache,f=c.get(r);if(!f){let p=()=>c.delete(r);f=new Jf(n,r,this.engine,p),c.set(r,f)}return f}let o=i.id,s=i.id+"-"+this._currentId;this._currentId++,this.engine.register(s,e);let a=c=>{Array.isArray(c)?c.forEach(a):this.engine.registerTrigger(o,s,e,c.name,c)};return i.data.animation.forEach(a),new Gy(this,s,r,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,i,n){if(e>=0&&ei(n));return}let r=this._animationCallbacksBuffer;r.length==0&&queueMicrotask(()=>{this._zone.run(()=>{r.forEach(o=>{let[s,a]=o;s(a)}),this._animationCallbacksBuffer=[]})}),r.push([i,n])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}};var T8=B(()=>{let t={onRemovalComplete:()=>{}},e=new on(null),i=h(Qf,{optional:!0})||t,{onRemovalComplete:n=t.onRemovalComplete}=i;return i.onRemovalComplete=(r,o)=>{e.next(r),n.call(i,r,o)},e.pipe(bt(r=>gt(0).pipe(S(()=>null),dt(r))),Ri())});function sI(t,e=null){return Pf(t).activeElement!==t&&!t.matches(":disabled")&&!(e!=null&&e.contains(t))&&ys(t)}function x8(t){return nt(rt(t,"focusin").pipe(S(({target:e})=>e)),rt(t,"focusout").pipe(ot(({target:e,relatedTarget:i})=>!!i&&sI(e)),S(({relatedTarget:e})=>e)))}var aI=B(()=>{let t=h(T8),e=h(Je),i=h(qe),n=h(me),r=rt(e,"focusout",{capture:!0}),o=rt(e,"focusin",{capture:!0}),s=rt(e,"blur"),a=rt(e,"mousedown"),u=rt(e,"mouseup");return nt(r.pipe(Kt(a),es({delay:()=>u}),Mm(t),ot(([l,c])=>sI(ka(l),c)),S(([{relatedTarget:l}])=>l)),s.pipe(S(()=>i.activeElement),ot(l=>!!(l!=null&&l.matches("iframe")))),o.pipe(bt(l=>{let c=ka(l),f=Pf(c);return f===i?ce(c):x8(f).pipe(dt(c))})),a.pipe(bt(l=>{let c=ka(l);return!i.activeElement||i.activeElement===i.body?ce(c):r.pipe($t(1),S(()=>c),Kt(gt(0,Fn(n))))}))).pipe(ke(),Ri())}),wie=B(()=>{var t;return((t=h(qe).querySelector("base"))==null?void 0:t.href)??""}),I8=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/,S8=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/,Qi=B(()=>I8.test(h(Ma).toLowerCase())||S8.test(h(Ma).slice(0,4).toLowerCase())),Na=B(()=>Of(h(Ao))),M8=B(()=>h(Qi)&&!h(Na)),uI=B(()=>{var t;return!!((t=h(Je))!=null&&t.webkitConvertPointFromNodeToPage)}),Tie=B(()=>h(Na)?"ios":h(M8)?"android":"web"),xie=B(()=>{let t=h(Je).matchMedia("(pointer: coarse)");return Cn(ct(t,"change").pipe(S(()=>t.matches)),{initialValue:t.matches})}),A8=B(()=>!!h(Je).Cypress),k8=B(Di),Iie=B(()=>h(A8)||h(k8)),Xy=W(null);function Sie(t){return{provide:Xy,useValue:t}}var lI=B(()=>zT(h(Ui))?new Range:{}),cI=B(()=>{let t=h(Je);return rt(t,"resize").pipe(dt(null),S(()=>{var r,o;let e=Math.max(t.document.documentElement.clientWidth||0,t.innerWidth||0,((r=t.visualViewport)==null?void 0:r.width)||0),i=Math.max(t.document.documentElement.clientHeight||0,t.innerHeight||0,((o=t.visualViewport)==null?void 0:o.height)||0),n={width:e,height:i,top:0,left:0,right:e,bottom:i,x:0,y:0};return U(M({},n),{toJSON:()=>JSON.stringify(n)})}),Li({bufferSize:1,refCount:!0}))});var O8=["viewContainer"],vl=class{},dI={self:!0,optional:!0},bl=(()=>{let e=class e{constructor(){this.fallback=h(Xy,dI),this.refresh$=new tt,this.pseudoInvalid=ge(null),this.internal=ge(this.fallback),this.control=h(an,{self:!0}),this.cdr=h(st),this.transformer=h(vl,dI),this.value=Pt(()=>this.internal()??this.fallback),this.readOnly=ge(!1),this.touched=ge(!1),this.status=ge(void 0),this.disabled=Pt(()=>this.status()==="DISABLED"),this.interactive=Pt(()=>!this.disabled()&&!this.readOnly()),this.invalid=Pt(()=>this.pseudoInvalid()!==null?!!this.pseudoInvalid()&&this.interactive():this.interactive()&&this.touched()&&this.status()==="INVALID"),this.mode=Pt(()=>this.readOnly()?"readonly":this.invalid()?"invalid":"valid"),this.onTouched=Sa,this.onChange=Sa,this.control.valueAccessor=this,this.refresh$.pipe(Jn(0),dt(null),S(()=>this.control.control),ot(Boolean),ke(),bt(n=>nt(n.valueChanges,n.statusChanges,n.events||sn).pipe(dt(null))),Se()).subscribe(()=>this.update())}set readOnlySetter(n){this.readOnly.set(n)}set invalidSetter(n){this.pseudoInvalid.set(n)}registerOnChange(n){this.refresh$.next(),this.onChange=r=>{r!==this.internal()&&(n(this.toControlValue(r)),this.internal.set(r),this.update())}}registerOnTouched(n){this.onTouched=()=>{n(),this.update()}}setDisabledState(){this.update()}writeValue(n){let r=this.control instanceof _r?this.control.model:n;this.internal.set(this.fromControlValue(r)),this.update()}fromControlValue(n){return this.transformer?this.transformer.fromControlValue(n):n}toControlValue(n){return this.transformer?this.transformer.toControlValue(n):n}update(){var n,r;this.status.set((n=this.control.control)==null?void 0:n.status),this.touched.set(!!((r=this.control.control)!=null&&r.touched)),this.cdr.markForCheck()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,inputs:{readOnlySetter:[0,"readOnly","readOnlySetter"],invalidSetter:[0,"invalid","invalidSetter"]},standalone:!1});let t=e;return Ot([Ft],t.prototype,"fromControlValue",null),Ot([Ft],t.prototype,"toControlValue",null),t})();function Uie(t){return De(bl,t)}var _l=(()=>{let e=class e{constructor(){this.injector=h(gr),this.nothing=h(Cs).attach(this)}addComponentChild(n){let r=n.createInjector(this.injector),o=this.vcr.createComponent(n.component,{injector:r});return o.changeDetectorRef.detectChanges(),o}addTemplateChild(n,r){return this.vcr.createEmbeddedView(n,r)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,viewQuery:function(r,o){if(r&1&&Gt(O8,5,zt),r&2){let s;Qe(s=Xe())&&(o.vcr=s.first)}},standalone:!1});let t=e;return t})(),Cs=(()=>{let e=class e{attach(n){this.host=n}add(n){return this.safeHost.addComponentChild(n)}remove({hostView:n}){n.destroyed||n.destroy()}addTemplate(n,r){return this.safeHost.addTemplateChild(n,r)}removeTemplate(n){n.destroyed||n.destroy()}get safeHost(){if(!this.host)throw new Jy;return this.host}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();function fI(t){return De(Cs,t)}var Jy=class extends Error{constructor(){super("")}};function qie(t,e,i){return i&&it?e:t}var Zie=7;var Pa=12,ep=1,ev=0,tp=11,tv=0,nv=9999,N8=2099,np=`${Xr}${cx}${Xr}`,P8=1e3,F8=60,R8=60,L8=24,H8=P8*F8,B8=H8*R8,Kie=B8*L8,iv=10,V8=2*iv+np.length,ip={Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6},to={January:0,February:1,March:2,April:3,May:4,June:5,July:6,August:7,September:8,October:9,November:10,December:11},Ti=class t{constructor(e){this.year=e}static isValidYear(e){return Number.isInteger(e)&&al(e,tv,nv+1)}static isLeapYear(e){return e%400===0||e%4===0&&e%100!==0}static getAbsoluteLeapYears(e){return Math.ceil(e/400)+(Math.ceil(e/4)-Math.ceil(e/100))}static lengthBetween(e,i){return i.year-e.year}static normalizeYearPart(e){return Sf(e,tv,nv)}get formattedYear(){return String(this.year).padStart(4,"0")}get isLeapYear(){return t.isLeapYear(this.year)}get absoluteLeapYears(){return t.getAbsoluteLeapYears(this.year)}yearBefore({year:e}){return this.year=e}yearAfter({year:e}){return this.year>e}append({year:e=0}){let i=this.year+e;return new t(i)}toString(){return this.formattedYear}valueOf(){return this.year}[Symbol.toPrimitive](e){return Date.prototype[Symbol.toPrimitive].call(this,e)}toJSON(){return this.formattedYear}},di=class t extends Ti{constructor(e,i){super(e),this.month=i}static isValidMonth(e,i){return Ti.isValidYear(e)&&t.isValidMonthPart(i)}static getMonthDaysCount(e,i){switch(e){case to.April:case to.June:case to.November:case to.September:return 30;case to.February:return i?29:28;default:return 31}}static currentLocal(){let e=new Date;return new t(e.getFullYear(),e.getMonth())}static currentUtc(){let e=new Date;return new t(e.getUTCFullYear(),e.getUTCMonth())}static lengthBetween(e,i){let n=e.month+e.year*12;return i.month+i.year*12-n}static normalizeMonthPart(e){return Sf(e,ev,tp)}static isValidMonthPart(e){return Number.isInteger(e)&&al(e,ev,tp+1)}get formattedMonthPart(){return String(this.month+1).padStart(2,"0")}get daysCount(){return t.getMonthDaysCount(this.month,this.isLeapYear)}monthBefore(e){return this.yearBefore(e)||this.yearSame(e)&&this.month=e.month}monthAfter(e){return this.yearAfter(e)||this.yearSame(e)&&this.month>e.month}append({year:e=0,month:i=0}){let n=(this.year+e)*Pa+this.month+i;return new t(Math.floor(n/Pa),n%Pa)}toString(){return`${this.formattedMonthPart}.${this.formattedYear}`}valueOf(){return this.toLocalNativeDate().valueOf()}toJSON(){return`${super.toJSON()}-${this.formattedMonthPart}`}toLocalNativeDate(){return new Date(this.year,this.month)}toUtcNativeDate(){return new Date(Date.UTC(this.year,this.month))}},Ds=class t extends di{constructor(e,i,n){super(e,i),this.day=n}static fromLocalNativeDate(e){return new t(e.getFullYear(),e.getMonth(),e.getDate())}static fromUtcNativeDate(e){return new t(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}static isValidDay(e,i,n){return di.isValidMonth(e,i)&&Number.isInteger(n)&&al(n,ep,di.getMonthDaysCount(i,Ti.isLeapYear(e))+1)}static currentLocal(){let e=new Date,i=e.getFullYear(),n=e.getMonth(),r=e.getDate();return new t(i,n,r)}static currentUtc(){let e=new Date,i=e.getUTCFullYear(),n=e.getUTCMonth(),r=e.getUTCDate();return new t(i,n,r)}static normalizeOf(e,i,n){let r=Ti.normalizeYearPart(e),o=di.normalizeMonthPart(i),s=t.normalizeDayPart(n,o,r);return new t(r,o,s)}static lengthBetween(e,i){return Math.round((i.toLocalNativeDate().getTime()-e.toLocalNativeDate().getTime())/(1e3*60*60*24))}static parseRawDateString(e,i="DMY"){switch(i){case"MDY":return{day:parseInt(e.slice(3,5),10),month:parseInt(e.slice(0,2),10)-1,year:parseInt(e.slice(6,10),10)};case"YMD":return{day:parseInt(e.slice(8,10),10),month:parseInt(e.slice(5,7),10)-1,year:parseInt(e.slice(0,4),10)};case"DMY":default:return{day:parseInt(e.slice(0,2),10),month:parseInt(e.slice(3,5),10)-1,year:parseInt(e.slice(6,10),10)}}}static normalizeParse(e,i="DMY"){let{day:n,month:r,year:o}=this.parseRawDateString(e,i);return t.normalizeOf(o,r,n)}static jsonParse(e){let{day:i,month:n,year:r}=this.parseRawDateString(e,"YMD");if(!di.isValidMonth(r,n)||!Number.isInteger(i)||!al(i,ep,di.getMonthDaysCount(n,Ti.isLeapYear(r))+1))throw new rv(r,n,i);return new t(r,n,i)}static normalizeDayPart(e,i,n){let r=di.getMonthDaysCount(i,Ti.isLeapYear(n));return Sf(e,1,r)}get formattedDayPart(){return String(this.day).padStart(2,"0")}get isWeekend(){let e=this.dayOfWeek(!1);return e===ip.Saturday||e===ip.Sunday}dayOfWeek(e=!0){let i=e?this.toLocalNativeDate().getDay()-1:this.toLocalNativeDate().getDay();return i<0?6:i}dayBefore(e){return this.monthBefore(e)||this.monthSame(e)&&this.day=e.day}dayAfter(e){return this.monthAfter(e)||this.monthSame(e)&&this.day>e.day}dayLimit(e,i){return e!==null&&this.dayBefore(e)?e:i!==null&&this.dayAfter(i)?i:this}append({year:e=0,month:i=0,day:n=0}){let r=(this.year+e)*Pa+this.month+i,o=Math.floor(r/Pa),s=r%Pa,a=Math.min(this.day,di.getMonthDaysCount(s,Ti.isLeapYear(o)))+n;for(;a>di.getMonthDaysCount(s,Ti.isLeapYear(o));)a-=di.getMonthDaysCount(s,Ti.isLeapYear(o)),s===to.December?(o++,s=to.January):s++;for(;a{let e=class e{constructor(){var n;this.control=h(an,{self:!0,optional:!0}),this.active$=h(aI),this.zone=h(me),this.el=Ee(),this.tuiActiveZoneParent=null,this.subActiveZones=[],this.directParentActiveZone=h(e,{skipSelf:!0,optional:!0}),this.tuiActiveZoneChange=this.active$.pipe(S(r=>!!r&&this.contains(r)),dt(!1),ke(),Tu(1),ei(r=>{var o;!r&&typeof((o=this.control)==null?void 0:o.valueAccessor.onTouched)=="function"&&this.control.valueAccessor.onTouched()}),ai(this.zone)),(n=this.directParentActiveZone)==null||n.addSubActiveZone(this)}set tuiActiveZoneParentSetter(n){this.setZone(n)}ngOnDestroy(){var n,r;(n=this.directParentActiveZone)==null||n.removeSubActiveZone(this),(r=this.tuiActiveZoneParent)==null||r.removeSubActiveZone(this)}contains(n){return this.el.contains(n)||this.subActiveZones.some((r,o,s)=>s.indexOf(r)===o&&r.contains(n))}setZone(n){var r;(r=this.tuiActiveZoneParent)==null||r.removeSubActiveZone(this),n==null||n.addSubActiveZone(this),this.tuiActiveZoneParent=n}addSubActiveZone(n){this.subActiveZones=[...this.subActiveZones,n]}removeSubActiveZone(n){this.subActiveZones=gx(this.subActiveZones,this.subActiveZones.indexOf(n))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiActiveZone","",5,"ng-container"],["","tuiActiveZoneChange","",5,"ng-container"],["","tuiActiveZoneParent","",5,"ng-container"]],hostBindings:function(r,o){r&1&&x("mousedown.silent",function(){return 0},!1,Nn)},inputs:{tuiActiveZoneParentSetter:[0,"tuiActiveZoneParent","tuiActiveZoneParentSetter"]},outputs:{tuiActiveZoneChange:"tuiActiveZoneChange"},exportAs:["tuiActiveZone"]});let t=e;return Ot([Ft],t.prototype,"setZone",null),t})();function gI(t){return t!=null&&`${t}`!="false"}var rp=class{constructor(e,i){this.el=e,this.options=i}get element(){return(this.el.nativeElement.tagName.includes("-")?this.el.nativeElement.querySelector(this.options.query):this.el.nativeElement)||this.el.nativeElement}get isTextFieldElement(){return this.element.matches(this.options.query)}},j8=1e3,U8=".ng-animating",sv=class extends rp{constructor(e,i,n,r){super(e,r),this.animationFrame$=i,this.zone=n}setFocus(){this.isTextFieldElement?Dm(gt(this.options.delay||j8),this.animationFrame$.pipe(gi(100,Fn(this.zone)),S(()=>this.element.closest(U8)),Sm(Boolean),$t(1))).subscribe(()=>this.element.focus({preventScroll:this.options.preventScroll})):this.element.focus({preventScroll:!0})}},$8=["type","inputMode","autocomplete","accept","min","max","step","pattern","size","maxlength"],av=class extends rp{constructor(e,i,n,r,o){super(e,o),this.renderer=i,this.zone=n,this.win=r}setFocus(){this.isTextFieldElement?this.zone.runOutsideAngular(()=>this.iosWebkitAutofocus()):this.element.focus({preventScroll:!0})}iosWebkitAutofocus(){var a;let e=this.makeFakeInput(),i=this.getDurationTimeBeforeFocus(),n=0,r=0,o=()=>e.focus({preventScroll:!0}),s=()=>{clearTimeout(n),n=this.win.setTimeout(()=>{clearTimeout(r),e.removeEventListener("blur",o),e.removeEventListener("focus",s),r=this.win.setTimeout(()=>{this.element.focus({preventScroll:this.options.preventScroll}),e.remove()},i)})};e.addEventListener("blur",o,{once:!0}),e.addEventListener("focus",s),this.insideDialog()?this.win.document.body.appendChild(e):(a=this.element.parentElement)==null||a.appendChild(e),e.focus({preventScroll:!0})}makeFakeInput(){let e=this.renderer.createElement("input"),i=this.element.getBoundingClientRect();return this.patchFakeInputFromFocusableElement(e),e.style.height=ht(i.height),e.style.width=ht(i.width/2),e.style.position="fixed",e.style.zIndex="-99999999",e.style.caretColor="transparent",e.style.border="none",e.style.outline="none",e.style.color="transparent",e.style.background="transparent",e.style.cursor="none",e.style.fontSize=ht(16),e.style.top=ht(i.top),e.style.left=ht(i.left),e}getDurationTimeBeforeFocus(){return parseFloat(this.win.getComputedStyle(this.element).getPropertyValue("--tui-duration"))||0}insideDialog(){return!!this.element.closest("tui-dialog")}patchFakeInputFromFocusableElement(e){$8.forEach(i=>{let n=this.element.getAttribute(i);si(n)&&e.setAttribute(i,n)})}},[yI,vI]=Oo({delay:NaN,query:"input, textarea, select, [contenteditable]",preventScroll:!1}),bI=W(),G8=[{provide:bI,deps:[de,qi,oi,me,Je,Na,yI],useFactory:(t,e,i,n,r,o,s)=>o?new av(t,i,n,r,s):new sv(t,e,n,s)}],_I=(()=>{let e=class e{constructor(){this.handler=h(bI),this.options=h(yI),this.destroyRef=h(it)}ngAfterViewInit(){this.autoFocus&&this.focus()}focus(){Number.isNaN(this.options.delay)?Promise.resolve().then(()=>this.handler.setFocus()):gt(this.options.delay).pipe(Se(this.destroyRef)).subscribe(()=>this.handler.setFocus())}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiAutoFocus",""]],inputs:{autoFocus:[2,"tuiAutoFocus","autoFocus",gI]},features:[Z(G8),Yg]});let t=e;return t})();var CI=(()=>{let e=class e{constructor(){return this.nativeElement=Ee(),new de(this.nativeElement)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiElement",""]],exportAs:["elementRef"]});let t=e;return t})();function W8({currentTarget:t,relatedTarget:e}){return!ui(e)||!ui(t)||!t.contains(e)}var Es=(()=>{let e=class e extends te{constructor(){super(n=>this.stream$.subscribe(n)),this.el=Ee(),this.zone=h(me),this.stream$=nt(rt(this.el,"mouseenter").pipe(S(Mo)),rt(this.el,"mouseleave").pipe(S(Di)),rt(this.el,"mouseout").pipe(ot(W8),S(Di))).pipe(ke(),ai(this.zone))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();var Ore=(()=>{let e=class e{constructor(){this.tuiHoveredChange=h(Es)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHoveredChange",""]],outputs:{tuiHoveredChange:"tuiHoveredChange"},features:[Z([Es])]});let t=e;return t})();var DI=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiItem",""]]});let t=e;return t})();var uv=class{constructor(e){this.internalDirectiveInstance=e}get $implicit(){return this.internalDirectiveInstance.tuiLet}get tuiLet(){return this.internalDirectiveInstance.tuiLet}},EI=(()=>{let e=class e{constructor(){h(zt).createEmbeddedView(h(It),new uv(this))}static ngTemplateContextGuard(n,r){return!0}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiLet",""]],inputs:{tuiLet:"tuiLet"}});let t=e;return t})();var wI=(()=>{let e=class e{constructor(){this.destroyRef=h(it),this.zone=h(me),this.el=Ee(),this.tuiNativeValidator="Invalid"}validate(n){return this.control=n,gt(0).pipe(Ei(this.zone),kf(this.destroyRef)).subscribe(()=>this.handleValidation()),null}handleValidation(){var n,r,o,s;(s=(o=this.el).setCustomValidity)==null||s.call(o,(n=this.control)!=null&&n.touched&&((r=this.control)!=null&&r.invalid)?this.tuiNativeValidator:"")}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiNativeValidator",""]],hostBindings:function(r,o){r&1&&x("focusout",function(){return o.handleValidation()})},inputs:{tuiNativeValidator:"tuiNativeValidator"},features:[Z([De(Cf,e,!0)])]});let t=e;return t})();var TI=(()=>{let e=class e extends te{constructor(){super(n=>this.obscured$.subscribe(n)),this.el=Ee(),this.obscured$=h(qi).pipe(gi(100,Fn()),S(()=>Ff(this.el)),dt(null),ke(),ai())}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),op=(()=>{let e=class e{constructor(){this.activeZone=h(xi,{optional:!0}),this.enabled$=new tt,this.obscured$=h(TI,{self:!0}).pipe(S(n=>!!(n!=null&&n.every(r=>{var o;return!((o=this.activeZone)!=null&&o.contains(r))})))),this.tuiObscured=this.enabled$.pipe(Af(()=>this.obscured$))}set tuiObscuredEnabled(n){this.enabled$.next(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiObscured",""]],inputs:{tuiObscuredEnabled:"tuiObscuredEnabled"},outputs:{tuiObscured:"tuiObscured"},features:[Z([TI])]});let t=e;return t})();var II=new k("");function cv(t={}){return h(II,t)}var Xi=class{constructor(e,i){this.component=e,this.i=i}createInjector(e,i){return Wn.create({parent:this.i||e,providers:[{provide:II,useValue:i}]})}},sp=class{constructor(e){this.$implicit=e}get polymorpheusOutlet(){return this.$implicit}};var dv=(()=>{let e=class e{constructor(n=h(It,{self:!0}),r=h(st)){this.template=n,this.cdr=r,this.polymorpheus=""}static ngTemplateContextGuard(n,r){return!0}check(){this.cdr.markForCheck()}};e.\u0275fac=function(r){return new(r||e)(Ge(It),Ge(st))},e.\u0275dir=T({type:e,selectors:[["ng-template","polymorpheus",""]],inputs:{polymorpheus:"polymorpheus"},exportAs:["polymorpheus"]});let t=e;return t})(),Rn=(()=>{let e=class e{constructor(){this.vcr=h(zt),this.i=h(gr),this.t=h(It),this.content=""}static ngTemplateContextGuard(n,r){return!0}ngOnChanges({content:n}){var s;let r=this.getContext();if((s=this.c)==null||s.injector.get(st).markForCheck(),!n)return;this.vcr.clear();let o=r&&new Proxy(r,{get:(a,u)=>{var l;return(l=this.getContext())==null?void 0:l[u]}});xI(this.content)?this.process(this.content,o):(r instanceof sp&&r.$implicit)!=null&&this.vcr.createEmbeddedView(this.template,o,{injector:this.i})}ngDoCheck(){lv(this.content)&&this.content.check()}get template(){return lv(this.content)?this.content.template:this.content instanceof It?this.content:this.t}getContext(){return K8(this.content)||xI(this.content)?this.context:new sp(this.context&&typeof this.content=="function"?this.content(this.context):this.content)}process(n,r){let o=n.createInjector(this.i,r);this.c=this.vcr.createComponent(n.component,{injector:o})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","polymorpheusOutlet",""]],inputs:{content:[0,"polymorpheusOutlet","content"],context:[0,"polymorpheusOutletContext","context"]},features:[Yt]});let t=e;return t})();function lv(t){return t instanceof dv}function xI(t){return t instanceof Xi}function K8(t){return lv(t)||t instanceof It}var up=class t{constructor(e){d(this,"headers");d(this,"normalizedNames",new Map);d(this,"lazyInit");d(this,"lazyUpdate",null);e?typeof e=="string"?this.lazyInit=()=>{this.headers=new Map,e.split(` -`).forEach(i=>{let n=i.indexOf(":");if(n>0){let r=i.slice(0,n),o=i.slice(n+1).trim();this.addHeaderEntry(r,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((i,n)=>{this.addHeaderEntry(n,i)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([i,n])=>{this.setHeaderEntries(i,n)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let i=this.headers.get(e.toLowerCase());return i&&i.length>0?i[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,i){return this.clone({name:e,value:i,op:"a"})}set(e,i){return this.clone({name:e,value:i,op:"s"})}delete(e,i){return this.clone({name:e,value:i,op:"d"})}maybeSetNormalizedName(e,i){this.normalizedNames.has(i)||this.normalizedNames.set(i,e)}init(){this.lazyInit&&(this.lazyInit instanceof t?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(e=>this.applyUpdate(e)),this.lazyUpdate=null))}copyFrom(e){e.init(),Array.from(e.headers.keys()).forEach(i=>{this.headers.set(i,e.headers.get(i)),this.normalizedNames.set(i,e.normalizedNames.get(i))})}clone(e){let i=new t;return i.lazyInit=this.lazyInit&&this.lazyInit instanceof t?this.lazyInit:this,i.lazyUpdate=(this.lazyUpdate||[]).concat([e]),i}applyUpdate(e){let i=e.name.toLowerCase();switch(e.op){case"a":case"s":let n=e.value;if(typeof n=="string"&&(n=[n]),n.length===0)return;this.maybeSetNormalizedName(e.name,i);let r=(e.op==="a"?this.headers.get(i):void 0)||[];r.push(...n),this.headers.set(i,r);break;case"d":let o=e.value;if(!o)this.headers.delete(i),this.normalizedNames.delete(i);else{let s=this.headers.get(i);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(i),this.normalizedNames.delete(i)):this.headers.set(i,s)}break}}addHeaderEntry(e,i){let n=e.toLowerCase();this.maybeSetNormalizedName(e,n),this.headers.has(n)?this.headers.get(n).push(i):this.headers.set(n,[i])}setHeaderEntries(e,i){let n=(Array.isArray(i)?i:[i]).map(o=>o.toString()),r=e.toLowerCase();this.headers.set(r,n),this.maybeSetNormalizedName(e,r)}forEach(e){this.init(),Array.from(this.normalizedNames.keys()).forEach(i=>e(this.normalizedNames.get(i),this.headers.get(i)))}};var FI=function(t){return t[t.Sent=0]="Sent",t[t.UploadProgress=1]="UploadProgress",t[t.ResponseHeader=2]="ResponseHeader",t[t.DownloadProgress=3]="DownloadProgress",t[t.Response=4]="Response",t[t.User=5]="User",t}(FI||{}),fv=class{constructor(e,i=200,n="OK"){d(this,"headers");d(this,"status");d(this,"statusText");d(this,"url");d(this,"ok");d(this,"type");this.headers=e.headers||new up,this.status=e.status!==void 0?e.status:i,this.statusText=e.statusText||n,this.url=e.url||null,this.ok=this.status>=200&&this.status<300}};var lp=class t extends fv{constructor(i={}){super(i);d(this,"body");d(this,"type",FI.Response);this.body=i.body!==void 0?i.body:null}clone(i={}){return new t({body:i.body!==void 0?i.body:this.body,headers:i.headers||this.headers,status:i.status!==void 0?i.status:this.status,statusText:i.statusText||this.statusText,url:i.url||this.url||void 0})}};var Q8=new k("");var X8=new k(""),SI="b",MI="h",AI="s",kI="st",OI="u",NI="rt",ap=new k(""),J8=["GET","HEAD"];function eH(t,e){var g;let m=h(ap),{isCacheActive:i}=m,n=ho(m,["isCacheActive"]),{transferCache:r,method:o}=t;if(!i||r===!1||o==="POST"&&!n.includePostRequests&&!r||o!=="POST"&&!J8.includes(o)||!n.includeRequestsWithAuthHeaders&&tH(t)||((g=n.filter)==null?void 0:g.call(n,t))===!1)return e(t);let s=h(_a),a=h(X8,{optional:!0}),u=nl(h(Ui));if(a&&!u)throw new j(2803,!1);let l=u&&a?oH(t.url,a):t.url,c=iH(t,l),f=s.get(c,null),p=n.includeHeaders;if(typeof r=="object"&&r.includeHeaders&&(p=r.includeHeaders),f){let{[SI]:y,[NI]:b,[MI]:D,[AI]:I,[kI]:N,[OI]:A}=f,V=y;switch(b){case"arraybuffer":V=new TextEncoder().encode(y).buffer;break;case"blob":V=new Blob([y]);break}let z=new up(D);return ce(new lp({body:V,headers:z,status:I,statusText:N,url:A}))}return e(t).pipe(ei(y=>{y instanceof lp&&u&&s.set(c,{[SI]:y.body,[MI]:nH(y.headers,p),[AI]:y.status,[kI]:y.statusText,[OI]:l,[NI]:t.responseType})}))}function tH(t){return t.headers.has("authorization")||t.headers.has("proxy-authorization")}function nH(t,e){if(!e)return{};let i={};for(let n of e){let r=t.getAll(n);r!==null&&(i[n]=r)}return i}function PI(t){return[...t.keys()].sort().map(e=>`${e}=${t.getAll(e)}`).join("&")}function iH(t,e){let{params:i,method:n,responseType:r}=t,o=PI(i),s=t.serializeBody();s instanceof URLSearchParams?s=PI(s):typeof s!="string"&&(s="");let a=[n,r,e,s,o].join("|"),u=rH(a);return u}function rH(t){let e=0;for(let i of t)e=Math.imul(31,e)+i.charCodeAt(0)<<0;return e+=2147483648,e.toString()}function RI(t){return[{provide:ap,useFactory:()=>(bi("NgHttpTransferCache"),M({isCacheActive:!0},t))},{provide:Q8,useValue:eH,multi:!0,deps:[_a,ap]},{provide:lf,multi:!0,useFactory:()=>{let e=h(vr),i=h(ap);return()=>{e.whenStable().then(()=>{i.isCacheActive=!1})}}}]}function oH(t,e){let i=new URL(t,"resolve://").origin,n=e[i];return n?t.replace(i,n):t}var hv=class extends hf{constructor(){super(...arguments);d(this,"supportsDOMEvents",!0)}},mv=class t extends hv{static makeCurrent(){OT(new t)}onAndCancel(e,i,n){return e.addEventListener(i,n),()=>{e.removeEventListener(i,n)}}dispatchEvent(e,i){e.dispatchEvent(i)}remove(e){e.remove()}createElement(e,i){return i=i||this.getDefaultDocument(),i.createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,i){return i==="window"?window:i==="document"?e:i==="body"?e.body:null}getBaseHref(e){let i=sH();return i==null?null:aH(i)}resetBaseElement(){Cl=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return cy(document.cookie,e)}},Cl=null;function sH(){return Cl=Cl||document.querySelector("base"),Cl?Cl.getAttribute("href"):null}function aH(t){return new URL(t,document.baseURI).pathname}var uH=(()=>{let e=class e{build(){return new XMLHttpRequest}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),Dl=new k(""),jI=(()=>{let e=class e{constructor(n,r){d(this,"_zone");d(this,"_plugins");d(this,"_eventNameToPlugin",new Map);this._zone=r,n.forEach(o=>{o.manager=this}),this._plugins=n.slice().reverse()}addEventListener(n,r,o){return this._findPluginFor(r).addEventListener(n,r,o)}getZone(){return this._zone}_findPluginFor(n){let r=this._eventNameToPlugin.get(n);if(r)return r;if(r=this._plugins.find(s=>s.supports(n)),!r)throw new j(5101,!1);return this._eventNameToPlugin.set(n,r),r}};d(e,"\u0275fac",function(r){return new(r||e)($e(Dl),$e(me))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),cp=class{constructor(e){d(this,"_doc");d(this,"manager");this._doc=e}},gv="ng-app-id";function LI(t){for(let e of t)e.remove()}function HI(t,e){let i=e.createElement("style");return i.textContent=t,i}function lH(t,e,i){var r;let n=(r=t.head)==null?void 0:r.querySelectorAll(`style[${gv}="${e}"]`);if(n)for(let o of n)o.textContent&&(o.removeAttribute(gv),i.set(o.textContent,{usage:0,elements:[o]}))}function yv(t,e){let i=e.createElement("link");return i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),i}var UI=(()=>{let e=class e{constructor(n,r,o,s={}){d(this,"doc");d(this,"appId");d(this,"nonce");d(this,"inline",new Map);d(this,"external",new Map);d(this,"hosts",new Set);d(this,"isServer");this.doc=n,this.appId=r,this.nonce=o,this.isServer=nl(s),lH(n,r,this.inline),this.hosts.add(n.head)}addStyles(n,r){for(let o of n)this.addUsage(o,this.inline,HI);r==null||r.forEach(o=>this.addUsage(o,this.external,yv))}removeStyles(n,r){for(let o of n)this.removeUsage(o,this.inline);r==null||r.forEach(o=>this.removeUsage(o,this.external))}addUsage(n,r,o){let s=r.get(n);s?s.usage++:r.set(n,{usage:1,elements:[...this.hosts].map(a=>this.addElement(a,o(n,this.doc)))})}removeUsage(n,r){let o=r.get(n);o&&(o.usage--,o.usage<=0&&(LI(o.elements),r.delete(n)))}ngOnDestroy(){for(let[,{elements:n}]of[...this.inline,...this.external])LI(n);this.hosts.clear()}addHost(n){this.hosts.add(n);for(let[r,{elements:o}]of this.inline)o.push(this.addElement(n,HI(r,this.doc)));for(let[r,{elements:o}]of this.external)o.push(this.addElement(n,yv(r,this.doc)))}removeHost(n){this.hosts.delete(n)}addElement(n,r){return this.nonce&&r.setAttribute("nonce",this.nonce),this.isServer&&r.setAttribute(gv,this.appId),n.appendChild(r)}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe),$e(Ud),$e(xg,8),$e(Ui))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),pv={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},_v=/%COMP%/g,$I="%COMP%",cH=`_nghost-${$I}`,dH=`_ngcontent-${$I}`,fH=!0,pH=new k("",{providedIn:"root",factory:()=>fH});function hH(t){return dH.replace(_v,t)}function mH(t){return cH.replace(_v,t)}function GI(t,e){return e.map(i=>i.replace(_v,t))}var BI=(()=>{let e=class e{constructor(n,r,o,s,a,u,l,c=null){d(this,"eventManager");d(this,"sharedStylesHost");d(this,"appId");d(this,"removeStylesOnCompDestroy");d(this,"doc");d(this,"platformId");d(this,"ngZone");d(this,"nonce");d(this,"rendererByCompId",new Map);d(this,"defaultRenderer");d(this,"platformIsServer");this.eventManager=n,this.sharedStylesHost=r,this.appId=o,this.removeStylesOnCompDestroy=s,this.doc=a,this.platformId=u,this.ngZone=l,this.nonce=c,this.platformIsServer=nl(u),this.defaultRenderer=new El(n,a,l,this.platformIsServer)}createRenderer(n,r){if(!n||!r)return this.defaultRenderer;this.platformIsServer&&r.encapsulation===hr.ShadowDom&&(r=U(M({},r),{encapsulation:hr.Emulated}));let o=this.getOrCreateRenderer(n,r);return o instanceof dp?o.applyToHost(n):o instanceof wl&&o.applyStyles(),o}getOrCreateRenderer(n,r){let o=this.rendererByCompId,s=o.get(r.id);if(!s){let a=this.doc,u=this.ngZone,l=this.eventManager,c=this.sharedStylesHost,f=this.removeStylesOnCompDestroy,p=this.platformIsServer;switch(r.encapsulation){case hr.Emulated:s=new dp(l,c,r,this.appId,f,a,u,p);break;case hr.ShadowDom:return new vv(l,c,n,r,a,u,this.nonce,p);default:s=new wl(l,c,r,f,a,u,p);break}o.set(r.id,s)}return s}ngOnDestroy(){this.rendererByCompId.clear()}};d(e,"\u0275fac",function(r){return new(r||e)($e(jI),$e(UI),$e(Ud),$e(pH),$e(qe),$e(Ui),$e(me),$e(xg))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),El=class{constructor(e,i,n,r){d(this,"eventManager");d(this,"doc");d(this,"ngZone");d(this,"platformIsServer");d(this,"data",Object.create(null));d(this,"throwOnSyntheticProps",!0);d(this,"destroyNode",null);this.eventManager=e,this.doc=i,this.ngZone=n,this.platformIsServer=r}destroy(){}createElement(e,i){return i?this.doc.createElementNS(pv[i]||i,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,i){(VI(e)?e.content:e).appendChild(i)}insertBefore(e,i,n){e&&(VI(e)?e.content:e).insertBefore(i,n)}removeChild(e,i){i.remove()}selectRootElement(e,i){let n=typeof e=="string"?this.doc.querySelector(e):e;if(!n)throw new j(-5104,!1);return i||(n.textContent=""),n}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,i,n,r){if(r){i=r+":"+i;let o=pv[r];o?e.setAttributeNS(o,i,n):e.setAttribute(i,n)}else e.setAttribute(i,n)}removeAttribute(e,i,n){if(n){let r=pv[n];r?e.removeAttributeNS(r,i):e.removeAttribute(`${n}:${i}`)}else e.removeAttribute(i)}addClass(e,i){e.classList.add(i)}removeClass(e,i){e.classList.remove(i)}setStyle(e,i,n,r){r&(mr.DashCase|mr.Important)?e.style.setProperty(i,n,r&mr.Important?"important":""):e.style[i]=n}removeStyle(e,i,n){n&mr.DashCase?e.style.removeProperty(i):e.style[i]=""}setProperty(e,i,n){e!=null&&(e[i]=n)}setValue(e,i){e.nodeValue=i}listen(e,i,n){if(typeof e=="string"&&(e=br().getGlobalEventTarget(this.doc,e),!e))throw new Error(`Unsupported event target ${e} for event ${i}`);return this.eventManager.addEventListener(e,i,this.decoratePreventDefault(n))}decoratePreventDefault(e){return i=>{if(i==="__ngUnwrap__")return e;(this.platformIsServer?this.ngZone.runGuarded(()=>e(i)):e(i))===!1&&i.preventDefault()}}};function VI(t){return t.tagName==="TEMPLATE"&&t.content!==void 0}var vv=class extends El{constructor(i,n,r,o,s,a,u,l){var p;super(i,s,a,l);d(this,"sharedStylesHost");d(this,"hostEl");d(this,"shadowRoot");this.sharedStylesHost=n,this.hostEl=r,this.shadowRoot=r.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);let c=GI(o.id,o.styles);for(let m of c){let g=document.createElement("style");u&&g.setAttribute("nonce",u),g.textContent=m,this.shadowRoot.appendChild(g)}let f=(p=o.getExternalStyles)==null?void 0:p.call(o);if(f)for(let m of f){let g=yv(m,s);u&&g.setAttribute("nonce",u),this.shadowRoot.appendChild(g)}}nodeOrShadowRoot(i){return i===this.hostEl?this.shadowRoot:i}appendChild(i,n){return super.appendChild(this.nodeOrShadowRoot(i),n)}insertBefore(i,n,r){return super.insertBefore(this.nodeOrShadowRoot(i),n,r)}removeChild(i,n){return super.removeChild(null,n)}parentNode(i){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(i)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}},wl=class extends El{constructor(i,n,r,o,s,a,u,l){var c;super(i,s,a,u);d(this,"sharedStylesHost");d(this,"removeStylesOnCompDestroy");d(this,"styles");d(this,"styleUrls");this.sharedStylesHost=n,this.removeStylesOnCompDestroy=o,this.styles=l?GI(l,r.styles):r.styles,this.styleUrls=(c=r.getExternalStyles)==null?void 0:c.call(r,l)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},dp=class extends wl{constructor(i,n,r,o,s,a,u,l){let c=o+"-"+r.id;super(i,n,r,s,a,u,l,c);d(this,"contentAttr");d(this,"hostAttr");this.contentAttr=hH(c),this.hostAttr=mH(c)}applyToHost(i){this.applyStyles(),this.setAttribute(i,this.hostAttr,"")}createElement(i,n){let r=super.createElement(i,n);return super.setAttribute(r,this.contentAttr,""),r}},gH=(()=>{let e=class e extends cp{constructor(n){super(n)}supports(n){return!0}addEventListener(n,r,o){return n.addEventListener(r,o,!1),()=>this.removeEventListener(n,r,o)}removeEventListener(n,r,o){return n.removeEventListener(r,o)}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),zI=["alt","control","meta","shift"],yH={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},vH={alt:t=>t.altKey,control:t=>t.ctrlKey,meta:t=>t.metaKey,shift:t=>t.shiftKey},bH=(()=>{let e=class e extends cp{constructor(n){super(n)}supports(n){return e.parseEventName(n)!=null}addEventListener(n,r,o){let s=e.parseEventName(r),a=e.eventCallback(s.fullKey,o,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>br().onAndCancel(n,s.domEventName,a))}static parseEventName(n){let r=n.toLowerCase().split("."),o=r.shift();if(r.length===0||!(o==="keydown"||o==="keyup"))return null;let s=e._normalizeKey(r.pop()),a="",u=r.indexOf("code");if(u>-1&&(r.splice(u,1),a="code."),zI.forEach(c=>{let f=r.indexOf(c);f>-1&&(r.splice(f,1),a+=c+".")}),a+=s,r.length!=0||s.length===0)return null;let l={};return l.domEventName=o,l.fullKey=a,l}static matchEventFullKeyCode(n,r){let o=yH[n.key]||n.key,s="";return r.indexOf("code.")>-1&&(o=n.code,s="code."),o==null||!o?!1:(o=o.toLowerCase(),o===" "?o="space":o==="."&&(o="dot"),zI.forEach(a=>{if(a!==o){let u=vH[a];u(n)&&(s+=a+".")}}),s+=o,s===r)}static eventCallback(n,r,o){return s=>{e.matchEventFullKeyCode(s,n)&&o.runGuarded(()=>r(s))}}static _normalizeKey(n){return n==="esc"?"escape":n}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})();function Foe(t,e){return vT(M({rootComponent:t},_H(e)))}function _H(t){return{appProviders:[...TH,...(t==null?void 0:t.providers)??[]],platformProviders:wH}}function CH(){mv.makeCurrent()}function DH(){return new pr}function EH(){return EE(document),document}var wH=[{provide:Ui,useValue:dy},{provide:Tg,useValue:CH,multi:!0},{provide:qe,useFactory:EH,deps:[]}];var TH=[{provide:Fd,useValue:"root"},{provide:pr,useFactory:DH,deps:[]},{provide:Dl,useClass:gH,multi:!0,deps:[qe,me,Ui]},{provide:Dl,useClass:bH,multi:!0,deps:[qe]},BI,UI,jI,{provide:ca,useExisting:BI},{provide:mf,useClass:uH,deps:[]},[]];var WI=(()=>{let e=class e{constructor(n){d(this,"_doc");d(this,"_dom");this._doc=n,this._dom=br()}addTag(n,r=!1){return n?this._getOrCreateElement(n,r):null}addTags(n,r=!1){return n?n.reduce((o,s)=>(s&&o.push(this._getOrCreateElement(s,r)),o),[]):[]}getTag(n){return n&&this._doc.querySelector(`meta[${n}]`)||null}getTags(n){if(!n)return[];let r=this._doc.querySelectorAll(`meta[${n}]`);return r?[].slice.call(r):[]}updateTag(n,r){if(!n)return null;r=r||this._parseSelector(n);let o=this.getTag(r);return o?this._setMetaElementAttributes(n,o):this._getOrCreateElement(n,!0)}removeTag(n){this.removeTagElement(this.getTag(n))}removeTagElement(n){n&&this._dom.remove(n)}_getOrCreateElement(n,r=!1){if(!r){let a=this._parseSelector(n),u=this.getTags(a).filter(l=>this._containsAttributes(n,l))[0];if(u!==void 0)return u}let o=this._dom.createElement("meta");return this._setMetaElementAttributes(n,o),this._doc.getElementsByTagName("head")[0].appendChild(o),o}_setMetaElementAttributes(n,r){return Object.keys(n).forEach(o=>r.setAttribute(this._getMetaKeyMap(o),n[o])),r}_parseSelector(n){let r=n.name?"name":"property";return`${r}="${n[r]}"`}_containsAttributes(n,r){return Object.keys(n).every(o=>r.getAttribute(this._getMetaKeyMap(o))===n[o])}_getMetaKeyMap(n){return xH[n]||n}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})(),xH={httpEquiv:"http-equiv"},Roe=(()=>{let e=class e{constructor(n){d(this,"_doc");this._doc=n}getTitle(){return this._doc.title}setTitle(n){this._doc.title=n||""}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var ws=(()=>{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:function(r){let o=null;return r?o=new(r||e):o=$e(IH),o},providedIn:"root"}));let t=e;return t})(),IH=(()=>{let e=class e extends ws{constructor(r){super();d(this,"_doc");this._doc=r}sanitize(r,o){if(o==null)return null;switch(r){case ri.NONE:return o;case ri.HTML:return Kr(o,"HTML")?ii(o):Og(this._doc,String(o)).toString();case ri.STYLE:return Kr(o,"Style")?ii(o):o;case ri.SCRIPT:if(Kr(o,"Script"))return ii(o);throw new j(5200,!1);case ri.URL:return Kr(o,"URL")?ii(o):qd(String(o));case ri.RESOURCE_URL:if(Kr(o,"ResourceURL"))return ii(o);throw new j(5201,!1);default:throw new j(5202,!1)}}bypassSecurityTrustHtml(r){return FE(r)}bypassSecurityTrustStyle(r){return RE(r)}bypassSecurityTrustScript(r){return LE(r)}bypassSecurityTrustUrl(r){return HE(r)}bypassSecurityTrustResourceUrl(r){return BE(r)}};d(e,"\u0275fac",function(o){return new(o||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})(),bv=function(t){return t[t.NoHttpTransferCache=0]="NoHttpTransferCache",t[t.HttpTransferCacheOptions=1]="HttpTransferCacheOptions",t[t.I18nSupport=2]="I18nSupport",t[t.EventReplay=3]="EventReplay",t[t.IncrementalHydration=4]="IncrementalHydration",t}(bv||{});function Loe(...t){let e=[],i=new Set,n=i.has(bv.HttpTransferCacheOptions);for(let{\u0275providers:r,\u0275kind:o}of t)i.add(o),r.length&&e.push(r);return Gu([[],bT(),i.has(bv.NoHttpTransferCache)||n?[]:RI({}),e])}var ZI=(()=>{let e=class e{generate(){return`tui_${e.autoId++}${Date.now()}`}};e.autoId=0,e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function KI(){return h(ZI).generate()}var Yoe=(()=>{let e=class e{constructor(n,r,o={}){this.options=o,this.id=h(ZI),this.component=new Xi(r),this.items$=h(n)}open(n,r={}){return new te(o=>{let s=U(M(M({},this.options),r),{content:n,$implicit:o,component:this.component,createdAt:Date.now(),id:this.id.generate(),completeWith:a=>{o.next(a),o.complete()}});return this.items$.next([...this.items$.value,s]),()=>{this.items$.next(this.items$.value.filter(a=>a!==s))}})}};e.\u0275fac=function(r){lw()},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();var SH=300;function qI(t){return"scrollX"in t?t.scrollX:t.scrollLeft}function MH(t){return"scrollY"in t?t.scrollY:t.scrollTop}var Qoe=(()=>{let e=class e{constructor(){this.performanceRef=h(hx),this.animationFrame$=h(qi),this.zone=h(me)}scroll$(n,r,o=qI(n),s=SH){let a=MH(n),u=qI(n),l=r-a,c=o-u;return(s?Cu(()=>ce(this.performanceRef.now())).pipe(bt(p=>this.animationFrame$.pipe(S(m=>m-p))),S(p=>yx(Jt(p/s,0,1))),S(p=>[a+l*p,u+c*p]),Kt(gt(s,Fn(this.zone))),Hc([r,o])):ce([r,o])).pipe(ei(([p,m])=>{var g;(g=n.scrollTo)==null||g.call(n,m,p)}))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),Xoe=B(()=>{var t;return((t=h(WI).getTag('name="theme-color"'))==null?void 0:t.content)??""});var AH=65536,Cv=class{constructor(e){this.$implicit=e}},YI=(()=>{let e=class e{constructor(){this.viewContainer=h(zt),this.templateRef=h(It)}set tuiRepeatTimesOf(n){let r=Math.floor(Jt(n,0,AH)),{length:o}=this.viewContainer;n{let e=class e extends CI{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiResizable",""]],features:[oe]});let t=e;return t})(),QI=(()=>{let e=class e{constructor(){this.resizable=h(Dv),this.x=NaN,this.y=NaN,this.width=0,this.height=0,this.tuiResizer=[0,0],this.tuiSizeChange=new _e}get cursor(){return this.tuiResizer[0]?this.tuiResizer[1]?this.tuiResizer[0]*this.tuiResizer[1]>0?"nwse-resize":"nesw-resize":"ew-resize":"ns-resize"}onPointerDown(n,r){this.x=n,this.y=r,this.width=this.resizable.nativeElement.clientWidth,this.height=this.resizable.nativeElement.clientHeight}onPointerMove({x:n,y:r,buttons:o}){o?this.onMove(n,r):this.onPointerUp()}onPointerUp(){this.x=NaN}onMove(n,r){if(Number.isNaN(this.x))return;let{style:o}=this.resizable.nativeElement,s=[this.width+this.tuiResizer[0]*(n-this.x),this.height+this.tuiResizer[1]*(r-this.y)];this.tuiResizer[0]&&(o.width=ht(s[0])),this.tuiResizer[1]&&(o.height=ht(s[1])),this.tuiSizeChange.emit(s)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiResizer",""]],hostVars:4,hostBindings:function(r,o){r&1&&x("pointerdown.silent.prevent",function(a){return o.onPointerDown(a.x,a.y)})("pointermove.silent",function(a){return o.onPointerMove(a)},!1,Nn)("pointerup.silent",function(){return o.onPointerUp()},!1,Nn),r&2&&Ye("cursor",o.cursor)("touch-action","none")},inputs:{tuiResizer:"tuiResizer"},outputs:{tuiSizeChange:"tuiSizeChange"}});let t=e;return t})();var kH={cardNumber:["Number","Card number"],cardExpiry:["Expires","Valid through"]},OH={colorSelectorModeNames:["Solid color","Gradient"],toolbarTools:{undo:"Undo",redo:"Redo",font:"Font",fontStyle:"Font style",fontSize:"Font size",bold:"Bold",italic:"Italic",underline:"Underline",strikeThrough:"Strike through",justify:"Justify",justifyLeft:"Justify left",justifyCenter:"Justify center",justifyRight:"Justify right",justifyFull:"Justify full",list:"List",indent:"Indent",outdent:"Outdent",unorderedList:"Unordered list",orderedList:"Ordered list",quote:"Quote",foreColor:"Color",backColor:"Background color",hiliteColor:"Highlight color",clear:"Clear",link:"Link",attach:"Attach file",tex:"Insert TeX",code:"Code",image:"Insert image",insertHorizontalRule:"Insert horizontal rule",superscript:"Superscript",subscript:"Subscript",insertTable:"Insert table",insertGroup:"Insert group",hiliteGroup:"Hilite group",removeGroup:"Remove group",insertAnchor:"Insert anchor",mergeCells:"Merge cells",splitCells:"Split cells",rowsColumnsManaging:"Managing rows and columns",cellColor:"Cell color",setDetails:"Details",removeDetails:"Remove details"},editorEditLink:{urlExample:"example.com",anchorExample:"anchor"},editorTableCommands:[["Insert column before","Insert column after"],["Insert row before","Insert row after"],["Delete column","Delete row"]],editorCodeOptions:["Code in the text","Code in block"],editorFontOptions:{small:"Small",large:"Large",normal:"Normal",title:"Title",subtitle:"Subtitle"}},NH={showHideText:"Show/Hide",paginationTexts:{pages:"Pages",linesPerPage:"Lines per page",of:"of"}},PH={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua & Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AT:"Austria",AU:"Australia",AW:"Aruba",AZ:"Azerbaijan",BA:"Bosnia & Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"St. Barth\xE9lemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"Congo - Kinshasa",CF:"Central African Republic",CG:"Congo - Brazzaville",CH:"Switzerland",CI:"C\xF4te d\u2019Ivoire",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cape Verde",CW:"Cura\xE7ao",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Federated States of Micronesia",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KM:"Comoros",KN:"St. Kitts & Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"St. Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"St. Martin",MG:"Madagascar",MK:"North Macedonia",ML:"Mali",MM:"Myanmar (Burma)",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"R\xE9union",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"St. Helena",SI:"Slovenia",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",ST:"S\xE3o Tom\xE9 & Pr\xEDncipe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks & Caicos Islands",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"T\xFCrkiye",TT:"Trinidad & Tobago",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VC:"St. Vincent & Grenadines",VE:"Venezuela",VG:"British Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WS:"Samoa",XK:"Kosovo",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe",AC:"Ascension Island",AS:"American Samoa",AX:"\xC5land Islands",CC:"Cocos (Keeling) Islands",CK:"Cook Islands",CX:"Christmas Island",EH:"Western Sahara",FO:"Faroe Islands",GG:"Guernsey",GU:"Guam",IM:"Isle of Man",JE:"Jersey",IO:"British Indian Ocean Territory",KI:"Kiribati",MH:"Marshall Islands",MP:"Northern Mariana Islands",NF:"Norfolk Island",NR:"Nauru",NU:"Niue",PM:"Saint Pierre and Miquelon",PR:"Puerto Rico",PS:"Palestine",SJ:"Svalbard and Jan Mayen",SS:"South Sudan",TA:"Tristan da Cunha",TK:"Tokelau",TV:"Tuvalu",VA:"Holy See",VI:"Virgin Islands",WF:"Wallis and Futuna"},FH={months:["January","February","March","April","May","June","July","August","September","October","November","December"],close:"Close",clear:"Clear",nothingFoundMessage:"Nothing found",defaultErrorMessage:"Value is invalid",spinTexts:["Previous","Next"],shortWeekDays:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],countries:PH},RH={cancel:"Cancel",done:"Done",more:"More",otherDate:"Other date...",showAll:"Show all",hide:"Hide",mobileCalendarTexts:["Choose day","Choose range","Choose days"],range:["from","to"],countTexts:["Plus","Minus"],time:{"HH:MM":"HH:MM","HH:MM AA":"HH:MM AA","HH:MM:SS":"HH:MM:SS","HH:MM:SS AA":"HH:MM:SS AA","HH:MM:SS.MSS":"HH:MM:SS.MSS","HH:MM:SS.MSS AA":"HH:MM:SS.MSS AA"},dateTexts:{DMY:"dd.mm.yyyy",MDY:"mm.dd.yyyy",YMD:"yyyy.mm.dd"},digitalInformationUnits:["B","KiB","MiB"],passwordTexts:["Show password","Hide password"],copyTexts:["Copy","Copied"],shortCalendarMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],pagination:["Previous page","Next page"],fileTexts:{loadingError:"Upload failed",preview:"Preview",remove:"Remove"},inputFileTexts:{defaultLabelSingle:"or drop\xA0it\xA0here",defaultLabelMultiple:"or drop\xA0them\xA0here",defaultLinkSingle:"Choose a file",defaultLinkMultiple:"Choose files",maxSizeRejectionReason:"File is larger than",formatRejectionReason:"Wrong file type",drop:"Drop file here",dropMultiple:"Drop files here"},multiSelectTexts:{all:"Select all",none:"Select none"},confirm:{yes:"Yes",no:"No"},previewTexts:{rotate:"Rotate"},zoomTexts:{zoomOut:"Zoom out",zoomIn:"Zoom in",reset:"Reset"},phoneSearch:"Type country or code"},XI=M(M(M(M(M({name:"english"},FH),RH),NH),kH),OH);var JI=B(()=>XI),eS=B(()=>ce(h(JI))),LH=W(),HH=W("tuiLanguage");function Fe(t){return()=>h(eS).pipe(S(e=>e[t]))}var BH=new Map([["color-black-100","#909090"],["color-black-200","#666666"],["color-black-300","#333333"],["color-blue-100","#1771e6"],["color-blue-200","#1464cc"],["color-blue-300","#0953b3"],["color-gray-100","#f5f5f6"],["color-gray-200","#e7e8ea"],["color-gray-300","#cbcfd3"],["color-gray-400","#959ba4"],["color-gray-500","#79818c"],["color-gray-600","#616871"],["color-green-100","#39b54a"],["color-green-200","#2ca53a"],["color-green-300","#168a21"],["color-light-blue-100","#ecf1f7"],["color-light-blue-200","#e4ebf3"],["color-light-blue-300","#dde4ed"],["color-red-100","#e01f19"],["color-red-200","#d3120e"],["color-red-300","#c40b08"],["color-yellow-100","#FFDD2C"],["color-yellow-200","#FCC521"],["color-yellow-300","#FAB618"],["transparent","transparent"]]),Fa="rgb(51, 51, 51)",Oe={Align:"justify",Anchor:"anchor",Attach:"attach",Bold:"bold",Clear:"clear",Code:"code",Color:"foreColor",Details:"details",Group:"group",HR:"insertHorizontalRule",Hilite:"hiliteColor",Img:"image",Italic:"italic",Link:"link",List:"list",MergeCells:"mergeCells",Quote:"quote",RowsColumnsManaging:"rowsColumnsManaging",Size:"fontSize",SplitCells:"splitCells",Strikethrough:"strikeThrough",Sub:"subscript",Sup:"superscript",Table:"insertTable",CellColor:"cellColor",Tex:"tex",Underline:"underline",Undo:"undo"},Tl=new Set([Oe.Align,Oe.Anchor,Oe.Bold,Oe.CellColor,Oe.Clear,Oe.Code,Oe.Color,Oe.Details,Oe.Hilite,Oe.HR,Oe.Img,Oe.Italic,Oe.Link,Oe.List,Oe.Quote,Oe.Size,Oe.Strikethrough,Oe.Sub,Oe.Sup,Oe.Table,Oe.Underline,Oe.Undo]),Lo="tui_editor_resize";function VH(t){return[{px:13,name:t.small},{px:15,name:t.normal},{px:17,name:t.large},{px:24,family:"var(--tui-font-heading)",name:t.subtitle,headingLevel:2,weight:"bold"},{px:30,family:"var(--tui-font-heading)",name:t.title,headingLevel:1,weight:"bold"}]}var Ev=["id","class","src","style","controls","loop","muted","preload","autoplay","width","height","controlsList"],Ln="#",kse="http://",wv="https://",tS=":",xl="://",zH={protocol:wv},nS=(()=>{let e=class e{constructor(){this.stateChange$=new tt,this.valueChange$=new tt}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1});let t=e;return t})(),iS=new k("[TUI_EDITOR_EXTENSIONS]"),Tv=new k("[LAZY_EDITOR_EXTENSIONS]"),rS={translate:"no",spellcheck:!1,exampleText:"",placeholder:"",enableDefaultStyles:!0,tools:Tl,colors:BH,blankColor:Fa,linkOptions:zH,fontOptions:VH,floatingToolbar:!1,parseOptions:{},icons:{undo:"@tui.undo",redo:"@tui.redo",quote:"@tui.quote",link:"@tui.link",anchor:"@tui.anchor",attach:"@tui.paperclip",sub:"@tui.subscript",sup:"@tui.superscript",tex:"@tui.whole-word",image:"@tui.image",hr:"@tui.minus",clear:"@tui.remove-formatting",groupAdd:"@tui.plus",groupRemove:"@tui.circle-minus",detailsAdd:"@tui.copy-plus",detailsRemove:"@tui.square-minus",popupLinkSave:"@tui.save",popupLinkRemove:"@tui.x",popupPreviewLinkEdit:"@tui.pencil",popupPreviewLinkClear:"@tui.x",paint:"@tui.paint-bucket",hash:"@tui.hash",externalLink:"@tui.external-link",textAlignPreview:"@tui.align-left",textAlignLeft:"@tui.align-left",textAlignCenter:"@tui.align-center",textAlignRight:"@tui.align-right",textAlignJustify:"@tui.align-justify",textColor:"@tui.baseline",textHilite:"@tui.paint-roller",listPreview:"@tui.list",listUnOrdered:"@tui.list",listOrdered:"@tui.list-ordered",taskList:"@tui.check-check",indent:"@tui.indent-increase",outdent:"@tui.indent-decrease",fontSize:"@tui.a-large-small",insertTable:"@tui.table",tableCellMerge:"@tui.table-cells-merge",tableCellSplit:"@tui.table-rows-split",addRowTable:"@tui.between-horizontal-start",code:"@tui.code",fontStylePreview:"@tui.type-outline",fontStyleBold:"@tui.bold",fontStyleItalic:"@tui.italic",fontStyleUnderline:"@tui.underline",fontStyleStrike:"@tui.strikethrough",colorSelectorDropdownChevron:"@tui.chevron-down",colorSelectorDropdownCheck:"@tui.check",imageExtension:{settings:"@tui.settings",alignJustify:"@tui.align-justify",alignCenter:"@tui.align-center",alignLeft:"@tui.align-left",alignRight:"@tui.align-right"}}},xe=W(rS);function Ose(t){return Zi(xe,t,rS)}var oS=B(()=>null),sS=new k("[TUI_EDITOR_VALUE_TRANSFORMER]"),aS=new k("[TUI_ATTACH_FILES_OPTIONS]",{factory:()=>({accept:"*/*",multiple:!0})}),uS=new k("[TUI_ATTACH_FILES_LOADER]"),fp=' ',Nse=new k("[TUI_EDITOR_COLOR_SELECTOR_MODE_NAMES]",{factory:()=>["Solid color","Gradient"]}),lt=new k("[TUI_EDITOR_TOOLBAR_TEXTS]",{factory:Fe("toolbarTools")}),lS=new k("[TUI_EDITOR_TABLE_COMMANDS]",{factory:Fe("editorTableCommands")}),cS=new k("[TUI_EDITOR_LINK_TEXTS]",{factory:Fe("editorEditLink")}),dS=new k("[TUI_EDITOR_CODE_OPTIONS]",{factory:Fe("editorCodeOptions")}),fS=new k("[TUI_EDITOR_FONT_OPTIONS]",{factory:Fe("editorFontOptions")}),pp=new k("[TUI_IMAGE_LOADER]",{factory:()=>t=>{let e=new FileReader;return e.readAsDataURL(t),rt(e,"load").pipe(S(()=>String(e.result)))}}),Ra=new k("[TIPTAP_EDITOR]"),pS=new k("[LAZY_TIPTAP_EDITOR]",{factory:()=>{let t=new ur(1);return import("./chunk-RECXUFHK.js").then(({Editor:e})=>t.next(e)).catch(()=>t.complete()),t}}),Il=new k("[INITIALIZATION_TIPTAP_CONTAINER]");var Ce="{{duration}}ms ease-in-out",no={params:{duration:300}},En=300,xv=wt("tuiParentAnimation",[Me(":leave",[Wt(":scope > *",[Hf()],{optional:!0})])]),Rse=wt("tuiParentStop",[Me(":enter",[])]),Lse=wt("tuiHost",[Me(":enter",[R({overflow:"clip"}),Wt(":scope > *",[Hf()],{optional:!0})]),Me(":leave",[Wt(":scope > *",[Hf()],{optional:!0})])]),Hse=wt("tuiHeightCollapse",[Me(":enter",[R({height:0}),ye(Ce,R({height:"*"}))],no),Me(":leave",[R({height:"*"}),ye(Ce,R({height:0}))],no)]),Bse=wt("tuiHeightCollapseList",[Me("* => *",[Wt(":enter",[R({height:0}),fn(En,[ye(Ce,R({height:"*"}))])],{optional:!0}),Wt(":leave",[R({height:"*"}),fn(En,[ye(Ce,R({height:0}))])],{optional:!0})],no)]),Vse=wt("tuiWidthCollapse",[Me(":enter",[R({width:0}),ye(Ce,R({width:"*"}))],no),Me(":leave",[R({width:"*"}),ye(Ce,R({width:0}))],no)]),zse=wt("tuiWidthCollapseList",[Me("* => *",[Wt(":enter",[R({width:0}),fn(En,[ye(Ce,R({width:"*"}))])],{optional:!0}),Wt(":leave",[R({width:"*"}),fn(En,[ye(Ce,R({width:0}))])],{optional:!0})],no)]),hp=wt("tuiFadeIn",[Me(":enter",[R({opacity:0}),ye(Ce,R({opacity:1}))],no),Me(":leave",[R({opacity:1}),ye(Ce,R({opacity:0}))],no)]),jse=wt("tuiFadeInList",[Me("* => *",[Wt(":enter",[R({opacity:0}),fn(En,[ye(Ce,R({opacity:1}))])],{optional:!0}),Wt(":leave",[R({opacity:1}),fn(En,[ye(Ce,R({opacity:0}))])],{optional:!0})],no)]),Use=wt("tuiFadeInTop",[Me(":enter",[R({transform:"translateY(-{{start}}px)",opacity:0}),ye(Ce,R({transform:"translateY({{end}})",opacity:1}))],{params:{end:0,start:10,duration:300}}),Me(":leave",[R({transform:"translateY({{end}})",opacity:1}),ye(Ce,R({transform:"translateY(-{{start}}px)",opacity:0}))],{params:{end:0,start:10,duration:300}})]),$se=wt("tuiFadeInBottom",[Me(":enter",[R({transform:"translateY({{start}}px)",opacity:0}),ye(Ce,R({transform:"translateY({{end}})",opacity:1}))],{params:{end:0,start:10,duration:300}}),Me(":leave",[R({transform:"translateY({{end}})",opacity:1}),ye(Ce,R({transform:"translateY({{start}}px)",opacity:0}))],{params:{end:0,start:10,duration:300}})]),hS=wt("tuiDropdownAnimation",[Me(":enter",[R({transform:"translateY(-{{start}}px)",opacity:0}),ye(Ce,R({transform:"translateY({{end}})",opacity:1}))],{params:{end:0,start:10,duration:300}}),Me(":leave",[R({transform:"translateY({{end}})",opacity:1}),ye(Ce,R({transform:"translateY(-{{start}}px)",opacity:0}))],{params:{end:0,start:10,duration:300}})]),mS=wt("tuiScaleIn",[Me(":enter",[R({transform:"scale({{start}})"}),ye("{{duration}}ms {{easing}}",R({transform:"scale({{end}})"}))],{params:{end:1,start:0,duration:300,easing:"ease-in-out"}}),Me(":leave",[R({transform:"scale({{end}})"}),ye(Ce,R({transform:"scale({{start}})"}))],{params:{end:1,start:0,duration:300}})]),Gse=wt("tuiPop",[Me(":enter",[R({transform:"scale({{start}})"}),ye(Ce,R({transform:"scale({{middle}})"})),ye(Ce,R({transform:"scale({{end}})"}))],{params:{end:1,middle:1.1,start:0,duration:300}}),Me(":leave",[R({transform:"scale({{end}})"}),ye(Ce,R({transform:"scale({{middle}})"})),ye(Ce,R({transform:"scale({{start}})"}))],{params:{end:1,middle:1.1,start:0,duration:300}})]),Wse=wt("tuiScaleInList",[Me("* => *",[Wt(":enter",[R({transform:"scale({{start}})"}),fn(En,[ye(Ce,R({transform:"scale({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"scale({{end}})"}),fn(En,[ye(Ce,R({transform:"scale({{start}})"}))])],{optional:!0})],{params:{end:1,start:0,duration:300}})]),qse=wt("tuiSlideIn",[Me("* => left",[R({transform:"translateX(-{{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me("left => *",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX(-{{start}})"}))],{params:{end:0,start:"100%",duration:300}}),Me("* => right",[R({transform:"translateX({{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me("right => *",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX({{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),Zse=wt("tuiSlideInLeft",[Me(":enter",[R({transform:"translateX(-{{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX(-{{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),Kse=wt("tuiSlideInLeftList",[Me("* => *",[Wt(":enter",[R({transform:"translateX(-{{start}})"}),fn(En,[ye(Ce,R({transform:"translateX({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateX({{end}})"}),fn(En,[ye(Ce,R({transform:"translateX(-{{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]),Yse=wt("tuiSlideInRight",[Me(":enter",[R({transform:"translateX({{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX({{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),Qse=wt("tuiSlideInRightList",[Me("* => *",[Wt(":enter",[R({transform:"translateX({{start}})"}),fn(En,[ye(Ce,R({transform:"translateX({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateX({{end}})"}),fn(En,[ye(Ce,R({transform:"translateX({{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]),Xse=wt("tuiSlideInTop",[Me(":enter",[R({transform:"translate3d(0,{{start}},0)",pointerEvents:"none"}),ye(Ce,R({transform:"translate3d(0,{{end}},0)"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translate3d(0,{{end}},0)"}),ye(Ce,R({transform:"translate3d(0,{{start}},0)"}))],{params:{end:0,start:"100%",duration:300}})]),Jse=wt("tuiSlideInTopList",[Me("* => *",[Wt(":enter",[R({transform:"translateY({{start}})"}),fn(En,[ye(Ce,R({transform:"translateY({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateY({{end}})"}),fn(En,[ye(Ce,R({transform:"translateY({{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]),eae=wt("tuiSlideInBottom",[Me(":enter",[R({transform:"translateY(-{{start}})"}),ye(Ce,R({transform:"translateY({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translateY({{end}})"}),ye(Ce,R({transform:"translateY(-{{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),tae=wt("tuiSlideInBottomList",[Me("* => *",[Wt(":enter",[R({transform:"translateY(-{{start}})"}),fn(En,[ye(Ce,R({transform:"translateY({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateY({{end}})"}),fn(En,[ye(Ce,R({transform:"translateY(-{{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]);var mp=class{},Ii=class extends mp{},Si=class extends mp{};function gS(t,e,i){return{provide:t,deps:[[new qr,new qn,t],i],useFactory:Sl(e)}}function Sl(t){return(e,i)=>{var n;return((n=e==null?void 0:e.find)==null?void 0:n.call(e,r=>r!==i&&r.type===t))||i}}function yp(t,e){return gS(Ii,t,e)}function vp(t,e){return gS(Si,t,e)}function Iv(t){return De(Ii,t,!0)}function Ts(t){return De(Si,t,!0)}var gp=class{};function bp(t){return De(gp,t,!0)}var Er=class extends te{};function Ho(t){return De(Er,t,!0)}var _p=(()=>{let e=class e{constructor(){this.destroyRef=h(it),this.drivers=h(Er,{self:!0,optional:!0})||[],this.vehicles=h(gp,{self:!0,optional:!0})}ngAfterViewInit(){var r;let n=(r=this.vehicles)==null?void 0:r.find(({type:o})=>o===this.type);nt(...this.drivers.filter(({type:o})=>o===this.type)).pipe(ke(),Se(this.destroyRef)).subscribe(o=>{n==null||n.toggle(o)})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1});let t=e;return t})();var jH={appearance:""},Cp=W(jH);function La(t){return De(Cp,t)}var UH=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-appearance"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiAppearance]{transition-property:color,background,opacity,box-shadow,border;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;-webkit-appearance:none;appearance:none;outline:.125rem solid transparent;outline-offset:-.125rem}[tuiAppearance].tui-appearance-initializing{transition:none!important}[tuiAppearance]:focus-visible:not([data-focus=false]){outline-color:var(--tui-border-focus)}[tuiAppearance][data-focus=true]{outline-color:var(--tui-border-focus)}[tuiAppearance][tuiWrapper]:not(._focused):has(:focus-visible),[tuiAppearance][tuiWrapper]._focused{outline-color:var(--tui-border-focus)}[tuiAppearance]:disabled:not([data-state]),[tuiAppearance][data-state=disabled]{pointer-events:none;opacity:var(--tui-disabled-opacity)}[tuiAppearance][tuiWrapper]:disabled:not([data-state]),[tuiAppearance][tuiWrapper][data-state=disabled]{pointer-events:none;opacity:var(--tui-disabled-opacity)} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),Ji=(()=>{let e=class e{constructor(){this.el=Ee(),this.nothing=Dn(UH),this.modes=Pt((n=this.mode())=>!n||ul(n)?n:n.join(" ")),this.appearance=ge(h(Cp).appearance),this.state=ge(null),this.focus=ge(null),this.mode=ge(null),Mg(()=>{this.el.classList.toggle("tui-appearance-initializing",!!this.el.offsetWidth&&!1)})}set tuiAppearance(n){this.appearance.set(n)}set tuiAppearanceState(n){this.state.set(n)}set tuiAppearanceFocus(n){this.focus.set(n)}set tuiAppearanceMode(n){this.mode.set(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiAppearance",""]],hostAttrs:["tuiAppearance","",1,"tui-appearance-initializing"],hostVars:4,hostBindings:function(r,o){r&2&&Ke("data-appearance",o.appearance())("data-state",o.state())("data-focus",o.focus())("data-mode",o.modes())},inputs:{tuiAppearance:"tuiAppearance",tuiAppearanceState:"tuiAppearanceState",tuiAppearanceFocus:"tuiAppearanceFocus",tuiAppearanceMode:"tuiAppearanceMode"}});let t=e;return t})();function yS(t){return ko(Ji,"appearance",t)}function Ha(t){return ko(Ji,"state",t)}function Dp(t){return ko(Ji,"focus",t)}function Ep(t){return ko(Ji,"mode",t)}var Ba=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Mt([{directive:Ji,inputs:["tuiAppearance","appearance","tuiAppearanceState","tuiAppearanceState","tuiAppearanceFocus","tuiAppearanceFocus","tuiAppearanceMode","tuiAppearanceMode"]}])]});let t=e;return t})();var $H=B(()=>{var t,e;return((e=(t=h(qe).defaultView)==null?void 0:t.matchMedia)==null?void 0:e.call(t,"(prefers-reduced-motion: reduce)").matches)??!1}),Va=B(()=>h($H)?0:1),GH=W("assets/taiga-ui/icons");var WH={check:"@tui.check",close:"@tui.x",error:"@tui.circle-alert",more:"@tui.chevron-right",search:"@tui.search",ellipsis:"@tui.ellipsis"},vS=W(WH);var qH="tuiDark",ZH=W(qH),Iae=B(()=>{let t=!0,e=h(fx),i=h(ZH),n=e.getItem(i),r=h(Je).matchMedia("(prefers-color-scheme: dark)"),o=ge(!!((n&&JSON.parse(n))??r.matches));return ct(r,"change").pipe(ot(()=>!e.getItem(i)),Se()).subscribe(()=>{t=!0,o.set(r.matches)}),Io(()=>{let s=String(o());t?t=!1:e.setItem(i,s)}),Object.assign(o,{reset:()=>{e.removeItem(i),t=!0,o.set(r.matches)}})}),KH={mode:"DMY",separator:"."},Sae=W(ce(KH));var Mae=W(t=>t.isWeekend?"weekend":"weekday"),Aae=W(ip.Monday),bS=B(Fe("months")),kae=B(Fe("close")),_S=B(Fe("clear")),CS=B(Fe("nothingFoundMessage")),Oae=B(Fe("defaultErrorMessage")),Nae=B(Fe("spinTexts")),Pae=B(Fe("shortWeekDays")),za=W(""),ja=W(""),YH=W({});var QH=B(()=>{let t=h(GH);return e=>`${t}/${e.replace("@tui.","").split(".").join("/")}.svg`});function wp(){let t=h(YH),e=h(QH);return i=>!i||i.includes("/")?i:t[i]??e(i)}var DS=W({mobile:768,desktopSmall:1024,desktopLarge:1280}),XH={precision:NaN,decimalSeparator:".",thousandSeparator:Xr,rounding:"truncate",decimalMode:"pad"},Fae=W(ce(XH));var Ua=B(()=>new de(h(qe).documentElement)),Sv=B(()=>{let t=h(qe);return nt(rt(t,"selectionchange"),rt(t,"mouseup"),rt(t,"mousedown").pipe(bt(()=>rt(t,"mousemove").pipe(Kt(rt(t,"mouseup"))))),rt(t,"keydown"),rt(t,"keyup")).pipe(Ri())}),Rae=W({decrement:"@tui.chevron-left",increment:"@tui.chevron-right"}),Lae=W("Taiga UI"),$a=B(()=>{let t=h(Je);return{type:"viewport",getClientRect(){let e={top:0,left:0,right:t.innerWidth,bottom:t.innerHeight,width:t.innerWidth,height:t.innerHeight,x:0,y:0};return U(M({},e),{toJSON:()=>JSON.stringify(e)})}}});function ES(t){return De($a,t)}var JH=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-icons"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiIcons]{--t-icon-start: none;--t-icon-end: none}[tuiIcons]:before,[tuiIcons]:after{content:"";display:var(--t-icon-start);inline-size:1em;block-size:1em;line-height:1em;font-size:1.5rem;flex-shrink:0;background:currentColor;-webkit-mask:var(--t-icon-start) no-repeat center / contain;mask:var(--t-icon-start) no-repeat center / contain}[tuiIcons]:after{display:var(--t-icon-end);-webkit-mask:var(--t-icon-end) no-repeat center / contain;mask:var(--t-icon-end) no-repeat center / contain} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),eB=(()=>{let e=class e{constructor(){this.nothing=Dn(JH),this.resolver=wp(),this.iconStart=h(za,{self:!0,optional:!0})||"",this.iconEnd=h(ja,{self:!0,optional:!0})||""}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,hostAttrs:["tuiIcons",""],hostVars:4,hostBindings:function(r,o){r&2&&Ye("--t-icon-start",o.iconStart?"url("+o.resolver(o.iconStart)+")":null)("--t-icon-end",o.iconEnd?"url("+o.resolver(o.iconEnd)+")":null)},inputs:{iconStart:"iconStart",iconEnd:"iconEnd"}});let t=e;return t})(),Bo=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Mt([{directive:eB,inputs:["iconStart","iconStart","iconEnd","iconEnd"]}])]});let t=e;return t})();var tB={appearance:"primary",size:"l"},[wS,TS]=Oo(tB),nB=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-button"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiButton],[tuiIconButton]{--t-size: var(--tui-height-l);--t-radius: var(--tui-radius-l);--t-gap: .25rem;--t-padding: 0 1.25rem;--t-margin: -.25rem;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;position:relative;display:inline-flex;align-items:center;flex-shrink:0;box-sizing:border-box;white-space:nowrap;overflow:hidden;vertical-align:middle;max-inline-size:100%;gap:calc(var(--t-gap, var(--t-0, 0rem)) - 2 * var(--t-margin, 0rem));block-size:var(--t-size);justify-content:center;border-radius:var(--t-radius);padding:var(--t-padding);-webkit-user-select:none;user-select:none;cursor:pointer;font:var(--tui-font-text-m);font-weight:700}[tuiButton]>img,[tuiIconButton]>img,[tuiButton]>tui-svg,[tuiIconButton]>tui-svg,[tuiButton]>tui-icon,[tuiIconButton]>tui-icon,[tuiButton]>tui-avatar,[tuiIconButton]>tui-avatar,[tuiButton]>tui-badge,[tuiIconButton]>tui-badge,[tuiButton]>[tuiBadge],[tuiIconButton]>[tuiBadge],[tuiButton]>[tuiRadio],[tuiIconButton]>[tuiRadio],[tuiButton]>[tuiSwitch],[tuiIconButton]>[tuiSwitch],[tuiButton]>[tuiCheckbox],[tuiIconButton]>[tuiCheckbox],[tuiButton][tuiIcons]:before,[tuiIconButton][tuiIcons]:before,[tuiButton][tuiIcons]:after,[tuiIconButton][tuiIcons]:after{margin:var(--t-margin)}[tuiButton]>.t-loader,[tuiIconButton]>.t-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}[tuiButton]>.t-loader .t-text,[tuiIconButton]>.t-loader .t-text{position:absolute}[tuiButton][data-size=xs],[tuiIconButton][data-size=xs]{--t-size: var(--tui-height-xs);--t-radius: var(--tui-radius-xs);--t-gap: .125rem;--t-padding: 0 .375rem;--t-margin: -.125rem;font:var(--tui-font-text-s)}[tuiButton][data-size=xs] tui-svg,[tuiIconButton][data-size=xs] tui-svg,[tuiButton][data-size=xs] tui-icon,[tuiIconButton][data-size=xs] tui-icon,[tuiButton][data-size=xs]:before,[tuiIconButton][data-size=xs]:before{font-size:1rem}[tuiButton][data-size=s],[tuiIconButton][data-size=s]{--t-size: var(--tui-height-s);--t-radius: var(--tui-radius-s);--t-gap: .125rem;--t-padding: 0 .625rem;--t-margin: -.125rem;font:var(--tui-font-text-s)}[tuiButton][data-size=s] tui-svg,[tuiIconButton][data-size=s] tui-svg,[tuiButton][data-size=s] tui-icon,[tuiIconButton][data-size=s] tui-icon,[tuiButton][data-size=s]:not([tuiIconButton][data-appearance=icon]):not([tuiIconButton][data-appearance=link]):before,[tuiIconButton][data-size=s]:not([tuiIconButton][data-appearance=icon]):not([tuiIconButton][data-appearance=link]):before{font-size:1rem}[tuiButton][data-size=m],[tuiIconButton][data-size=m]{--t-size: var(--tui-height-m);--t-radius: var(--tui-radius-m);--t-gap: .125rem;--t-padding: 0 1rem;--t-margin: -.375rem;font:var(--tui-font-text-m);font-weight:700}[tuiButton][data-size=m]:after,[tuiIconButton][data-size=m]:after{margin-inline-end:-.125rem}[tuiButton]._loading,[tuiIconButton]._loading{--tui-disabled-opacity: 1;-webkit-text-fill-color:transparent}[tuiButton]._loading>*,[tuiIconButton]._loading>*,[tuiButton]._loading:before,[tuiIconButton]._loading:before,[tuiButton]._loading:after,[tuiIconButton]._loading:after{opacity:0}[tuiButton]._loading>.t-loader,[tuiIconButton]._loading>.t-loader{opacity:1}[tuiButton][tuiIcons]:after,[tuiIconButton][tuiIcons]:after{font-size:1rem}[tuiButton][tuiButtonVertical],[tuiIconButton][tuiButtonVertical]{--t-line-height: 1rem;--t-margin: var(--t-0, 0rem) !important;flex-direction:column;flex-shrink:1;block-size:auto;padding:.75rem;gap:.375rem;min-inline-size:5rem;white-space:pre-line;font:var(--tui-font-text-ui-s)}[tuiButton][tuiButtonVertical]>*,[tuiIconButton][tuiButtonVertical]>*{max-block-size:calc(var(--t-line-height) * 2)}[tuiIconButton]{gap:0;inline-size:var(--t-size);font-size:0!important;padding:0}[tuiIconButton][data-size=l]:after{margin:0}[tuiIconButton][tuiIconButton][style*="--t-icon-start:"]:after{display:none} + `)}`}var qn=sg(rg("Optional"),8),Uu=sg(rg("Self"),2),qr=sg(rg("SkipSelf"),4);function rs(t,e){let i=t.hasOwnProperty(Jc);return i?t[Jc]:null}function T3(t,e,i){if(t.length!==e.length)return!1;for(let n=0;nArray.isArray(i)?ag(i,e):e(i))}function wD(t,e,i){e>=t.length?t.push(i):t.splice(e,0,i)}function td(t,e){return e>=t.length-1?t.pop():t.splice(e,1)[0]}function I3(t,e){let i=[];for(let n=0;ne;){let o=r-2;t[r]=t[o],r--}t[e]=i,t[e+1]=n}}function TD(t,e,i){let n=$u(t,e);return n>=0?t[n|1]=i:(n=~n,S3(t,n,e,i)),n}function km(t,e){let i=$u(t,e);if(i>=0)return t[i|1]}function $u(t,e){return M3(t,e,1)}function M3(t,e,i){let n=0,r=t.length>>i;for(;r!==n;){let o=n+(r-n>>1),s=t[o<e?r=o:n=o+1}return~(r<{i.push(s)};return ag(e,s=>{let a=s;Km(a,o,[],n)&&(r||(r=[]),r.push(a))}),r!==void 0&&AD(r,o),i}function AD(t,e){for(let i=0;i{e(o,n)})}}function Km(t,e,i,n){if(t=un(t),!t)return!1;let r=null,o=bC(t),s=!o&&bo(t);if(!o&&!s){let u=t.ngModule;if(o=bC(u),o)r=u;else return!1}else{if(s&&!s.standalone)return!1;r=t}let a=n.has(r);if(s){if(a)return!1;if(n.add(r),s.dependencies){let u=typeof s.dependencies=="function"?s.dependencies():s.dependencies;for(let l of u)Km(l,e,i,n)}}else if(o){if(o.imports!=null&&!a){n.add(r);let l;try{ag(o.imports,c=>{Km(c,e,i,n)&&(l||(l=[]),l.push(c))})}finally{}l!==void 0&&AD(l,e)}if(!a){let l=rs(r)||(()=>new r);e({provide:r,useFactory:l,deps:$n},r),e({provide:xD,useValue:r,multi:!0},r),e({provide:sa,useValue:()=>$e(r),multi:!0},r)}let u=o.providers;if(u!=null&&!a){let l=t;lg(u,c=>{e(c,l)})}}else return!1;return r!==t&&t.providers!==void 0}function lg(t,e){for(let i of t)CD(i)&&(i=i.\u0275providers),Array.isArray(i)?lg(i,e):e(i)}var O3=yt({provide:String,useValue:yt});function kD(t){return t!==null&&typeof t=="object"&&O3 in t}function N3(t){return!!(t&&t.useExisting)}function P3(t){return!!(t&&t.useFactory)}function aa(t){return typeof t=="function"}function F3(t){return!!t.useClass}var Fd=new k(""),qc={},R3={},Om;function Rd(){return Om===void 0&&(Om=new nd),Om}var fr=class{},ku=class extends fr{constructor(i,n,r,o){super();d(this,"parent");d(this,"source");d(this,"scopes");d(this,"records",new Map);d(this,"_ngOnDestroyHooks",new Set);d(this,"_onDestroyHooks",[]);d(this,"_destroyed",!1);d(this,"injectorDefTypes");this.parent=n,this.source=r,this.scopes=o,Qm(i,a=>this.processProvider(a)),this.records.set(gr,Xs(void 0,this)),o.has("environment")&&this.records.set(fr,Xs(void 0,this));let s=this.records.get(Fd);s!=null&&typeof s.value=="string"&&this.scopes.add(s.value),this.injectorDefTypes=new Set(this.get(xD,$n,Be.Self))}get destroyed(){return this._destroyed}destroy(){xu(this),this._destroyed=!0;let i=Ue(null);try{for(let r of this._ngOnDestroyHooks)r.ngOnDestroy();let n=this._onDestroyHooks;this._onDestroyHooks=[];for(let r of n)r()}finally{this.records.clear(),this._ngOnDestroyHooks.clear(),this.injectorDefTypes.clear(),Ue(i)}}onDestroy(i){return xu(this),this._onDestroyHooks.push(i),()=>this.removeOnDestroy(i)}runInContext(i){xu(this);let n=yo(this),r=Un(void 0),o;try{return i()}finally{yo(n),Un(r)}}get(i,n=Au,r=Be.Default){if(xu(this),i.hasOwnProperty(CC))return i[CC](this);r=Pd(r);let o,s=yo(this),a=Un(void 0);try{if(!(r&Be.SkipSelf)){let l=this.records.get(i);if(l===void 0){let c=z3(i)&&Nd(i);c&&this.injectableDefInScope(c)?l=Xs(Ym(i),qc):l=null,this.records.set(i,l)}if(l!=null)return this.hydrate(i,l)}let u=r&Be.Self?Rd():this.parent;return n=r&Be.Optional&&n===Au?null:n,u.get(i,n)}catch(u){if(u.name==="NullInjectorError"){if((u[ed]=u[ed]||[]).unshift(Mn(i)),s)throw u;return E3(u,i,"R3InjectorError",this.source)}else throw u}finally{Un(a),yo(s)}}resolveInjectorInitializers(){let i=Ue(null),n=yo(this),r=Un(void 0),o;try{let s=this.get(sa,$n,Be.Self);for(let a of s)a()}finally{yo(n),Un(r),Ue(i)}}toString(){let i=[],n=this.records;for(let r of n.keys())i.push(Mn(r));return`R3Injector[${i.join(", ")}]`}processProvider(i){i=un(i);let n=aa(i)?i:un(i&&i.provide),r=H3(i);if(!aa(i)&&i.multi===!0){let o=this.records.get(n);o||(o=Xs(void 0,qc,!0),o.factory=()=>Zm(o.multi),this.records.set(n,o)),n=i,o.multi.push(i)}this.records.set(n,r)}hydrate(i,n){let r=Ue(null);try{return n.value===qc&&(n.value=R3,n.value=n.factory()),typeof n.value=="object"&&n.value&&V3(n.value)&&this._ngOnDestroyHooks.add(n.value),n.value}finally{Ue(r)}}injectableDefInScope(i){if(!i.providedIn)return!1;let n=un(i.providedIn);return typeof n=="string"?n==="any"||this.scopes.has(n):this.injectorDefTypes.has(n)}removeOnDestroy(i){let n=this._onDestroyHooks.indexOf(i);n!==-1&&this._onDestroyHooks.splice(n,1)}};function Ym(t){let e=Nd(t),i=e!==null?e.factory:rs(t);if(i!==null)return i;if(t instanceof k)throw new j(204,!1);if(t instanceof Function)return L3(t);throw new j(204,!1)}function L3(t){if(t.length>0)throw new j(204,!1);let i=u3(t);return i!==null?()=>i.factory(t):()=>new t}function H3(t){if(kD(t))return Xs(void 0,t.useValue);{let e=OD(t);return Xs(e,qc)}}function OD(t,e,i){let n;if(aa(t)){let r=un(t);return rs(r)||Ym(r)}else if(kD(t))n=()=>un(t.useValue);else if(P3(t))n=()=>t.useFactory(...Zm(t.deps||[]));else if(N3(t))n=()=>$e(un(t.useExisting));else{let r=un(t&&(t.useClass||t.provide));if(B3(t))n=()=>new r(...Zm(t.deps));else return rs(r)||Ym(r)}return n}function xu(t){if(t.destroyed)throw new j(205,!1)}function Xs(t,e,i=!1){return{factory:t,value:e,multi:i?[]:void 0}}function B3(t){return!!t.deps}function V3(t){return t!==null&&typeof t=="object"&&typeof t.ngOnDestroy=="function"}function z3(t){return typeof t=="function"||typeof t=="object"&&t instanceof k}function Qm(t,e){for(let i of t)Array.isArray(i)?Qm(i,e):i&&CD(i)?Qm(i.\u0275providers,e):e(i)}function cg(t,e){t instanceof ku&&xu(t);let i,n=yo(t),r=Un(void 0);try{return e()}finally{yo(n),Un(r)}}function ND(){return DD()!==void 0||_3()!=null}function ha(t){if(!ND())throw new j(-203,!1)}function j3(t){return typeof t=="function"}var Gn=0,ve=1,fe=2,cn=3,Bi=4,Zn=5,yi=6,ia=7,An=8,ua=9,jr=10,pt=11,Ou=12,EC=13,ma=14,kn=15,os=16,Js=17,Vi=18,Ld=19,PD=20,vo=21,ra=22,Br=23,ti=24,Et=25,dg=1,Nu=6,Ur=7,id=8,la=9,ln=10,rd=function(t){return t[t.None=0]="None",t[t.HasTransplantedViews=2]="HasTransplantedViews",t}(rd||{});function zi(t){return Array.isArray(t)&&typeof t[dg]=="object"}function yr(t){return Array.isArray(t)&&t[dg]===!0}function fg(t){return(t.flags&4)!==0}function Wu(t){return t.componentOffset>-1}function Hd(t){return(t.flags&1)===1}function $r(t){return!!t.template}function od(t){return(t[fe]&512)!==0}var Xm=class{constructor(e,i,n){d(this,"previousValue");d(this,"currentValue");d(this,"firstChange");this.previousValue=e,this.currentValue=i,this.firstChange=n}isFirstChange(){return this.firstChange}};function FD(t,e,i,n){e!==null?e.applyValueToInputSignal(e,n):t[i]=n}var Yt=(()=>{let t=()=>RD;return t.ngInherit=!0,t})();function RD(t){return t.type.prototype.ngOnChanges&&(t.setInput=$3),U3}function U3(){let t=HD(this),e=t==null?void 0:t.current;if(e){let i=t.previous;if(i===zr)t.previous=e;else for(let n in e)i[n]=e[n];t.current=null,this.ngOnChanges(e)}}function $3(t,e,i,n,r){let o=this.declaredInputs[n],s=HD(t)||G3(t,{previous:zr,current:null}),a=s.current||(s.current={}),u=s.previous,l=u[o];a[o]=new Xm(l&&l.currentValue,i,u===zr),FD(t,e,r,i)}var LD="__ngSimpleChanges__";function HD(t){return t[LD]||null}function G3(t,e){return t[LD]=e}var wC=null;var cr=function(t,e,i){wC!=null&&wC(t,e,i)},BD="svg",W3="math";function ji(t){for(;Array.isArray(t);)t=t[Gn];return t}function q3(t){for(;Array.isArray(t);){if(typeof t[dg]=="object")return t;t=t[Gn]}return null}function VD(t,e){return ji(e[t])}function ni(t,e){return ji(e[t.index])}function pg(t,e){return t.data[e]}function ga(t,e){return t[e]}function wo(t,e){let i=e[t];return zi(i)?i:i[Gn]}function Z3(t){return(t[fe]&4)===4}function hg(t){return(t[fe]&128)===128}function K3(t){return yr(t[cn])}function _o(t,e){return e==null?null:t[e]}function zD(t){t[Js]=0}function mg(t){t[fe]&1024||(t[fe]|=1024,hg(t)&&qu(t))}function Y3(t,e){for(;t>0;)e=e[ma],t--;return e}function Bd(t){var e;return!!(t[fe]&9216||(e=t[ti])!=null&&e.dirty)}function Jm(t){var e;(e=t[jr].changeDetectionScheduler)==null||e.notify(9),t[fe]&64&&(t[fe]|=1024),Bd(t)&&qu(t)}function qu(t){var i;(i=t[jr].changeDetectionScheduler)==null||i.notify(0);let e=ss(t);for(;e!==null&&!(e[fe]&8192||(e[fe]|=8192,!hg(e)));)e=ss(e)}function jD(t,e){if((t[fe]&256)===256)throw new j(911,!1);t[vo]===null&&(t[vo]=[]),t[vo].push(e)}function Q3(t,e){if(t[vo]===null)return;let i=t[vo].indexOf(e);i!==-1&&t[vo].splice(i,1)}function ss(t){let e=t[cn];return yr(e)?e[cn]:e}var Ie={lFrame:YD(null),bindingsEnabled:!0,skipHydrationRootTNode:null};var e0=!1;function X3(){return Ie.lFrame.elementDepthCount}function J3(){Ie.lFrame.elementDepthCount++}function eN(){Ie.lFrame.elementDepthCount--}function UD(){return Ie.bindingsEnabled}function ya(){return Ie.skipHydrationRootTNode!==null}function tN(t){return Ie.skipHydrationRootTNode===t}function nN(t){Ie.skipHydrationRootTNode=t}function iN(){Ie.skipHydrationRootTNode=null}function pe(){return Ie.lFrame.lView}function St(){return Ie.lFrame.tView}function P(t){return Ie.lFrame.contextLView=t,t[An]}function F(t){return Ie.lFrame.contextLView=null,t}function dn(){let t=$D();for(;t!==null&&t.type===64;)t=t.parent;return t}function $D(){return Ie.lFrame.currentTNode}function rN(){let t=Ie.lFrame,e=t.currentTNode;return t.isParent?e:e.parent}function fs(t,e){let i=Ie.lFrame;i.currentTNode=t,i.isParent=e}function gg(){return Ie.lFrame.isParent}function yg(){Ie.lFrame.isParent=!1}function oN(){return Ie.lFrame.contextLView}function GD(){return e0}function sd(t){let e=e0;return e0=t,e}function To(){let t=Ie.lFrame,e=t.bindingRootIndex;return e===-1&&(e=t.bindingRootIndex=t.tView.bindingStartIndex),e}function sN(){return Ie.lFrame.bindingIndex}function aN(t){return Ie.lFrame.bindingIndex=t}function ps(){return Ie.lFrame.bindingIndex++}function vg(t){let e=Ie.lFrame,i=e.bindingIndex;return e.bindingIndex=e.bindingIndex+t,i}function uN(){return Ie.lFrame.inI18n}function lN(t,e){let i=Ie.lFrame;i.bindingIndex=i.bindingRootIndex=t,t0(e)}function cN(){return Ie.lFrame.currentDirectiveIndex}function t0(t){Ie.lFrame.currentDirectiveIndex=t}function WD(t){let e=Ie.lFrame.currentDirectiveIndex;return e===-1?null:t[e]}function qD(){return Ie.lFrame.currentQueryIndex}function bg(t){Ie.lFrame.currentQueryIndex=t}function dN(t){let e=t[ve];return e.type===2?e.declTNode:e.type===1?t[Zn]:null}function ZD(t,e,i){if(i&Be.SkipSelf){let r=e,o=t;for(;r=r.parent,r===null&&!(i&Be.Host);)if(r=dN(o),r===null||(o=o[ma],r.type&10))break;if(r===null)return!1;e=r,t=o}let n=Ie.lFrame=KD();return n.currentTNode=e,n.lView=t,!0}function _g(t){let e=KD(),i=t[ve];Ie.lFrame=e,e.currentTNode=i.firstChild,e.lView=t,e.tView=i,e.contextLView=t,e.bindingIndex=i.bindingStartIndex,e.inI18n=!1}function KD(){let t=Ie.lFrame,e=t===null?null:t.child;return e===null?YD(t):e}function YD(t){let e={currentTNode:null,isParent:!0,lView:null,tView:null,selectedIndex:-1,contextLView:null,elementDepthCount:0,currentNamespace:null,currentDirectiveIndex:-1,bindingRootIndex:-1,bindingIndex:-1,currentQueryIndex:0,parent:t,child:null,inI18n:!1};return t!==null&&(t.child=e),e}function QD(){let t=Ie.lFrame;return Ie.lFrame=t.parent,t.currentTNode=null,t.lView=null,t}var XD=QD;function Cg(){let t=QD();t.isParent=!0,t.tView=null,t.selectedIndex=-1,t.contextLView=null,t.elementDepthCount=0,t.currentDirectiveIndex=-1,t.currentNamespace=null,t.bindingRootIndex=-1,t.bindingIndex=-1,t.currentQueryIndex=0}function fN(t){return(Ie.lFrame.contextLView=Y3(t,Ie.lFrame.contextLView))[An]}function Zr(){return Ie.lFrame.selectedIndex}function as(t){Ie.lFrame.selectedIndex=t}function Zu(){let t=Ie.lFrame;return pg(t.tView,t.selectedIndex)}function Gee(){Ie.lFrame.currentNamespace=BD}function JD(){return Ie.lFrame.currentNamespace}var eE=!0;function Vd(){return eE}function xo(t){eE=t}function pN(t,e,i){let{ngOnChanges:n,ngOnInit:r,ngDoCheck:o}=e.type.prototype;if(n){let s=RD(e);(i.preOrderHooks??(i.preOrderHooks=[])).push(t,s),(i.preOrderCheckHooks??(i.preOrderCheckHooks=[])).push(t,s)}r&&(i.preOrderHooks??(i.preOrderHooks=[])).push(0-t,r),o&&((i.preOrderHooks??(i.preOrderHooks=[])).push(t,o),(i.preOrderCheckHooks??(i.preOrderCheckHooks=[])).push(t,o))}function zd(t,e){for(let i=e.directiveStart,n=e.directiveEnd;i=n)break}else e[u]<0&&(t[Js]+=65536),(a>14>16&&(t[fe]&3)===e&&(t[fe]+=16384,TC(a,o)):TC(a,o)}var oa=-1,us=class{constructor(e,i,n){d(this,"factory");d(this,"injectImpl");d(this,"resolving",!1);d(this,"canSeeViewProviders");d(this,"multi");d(this,"componentProviders");d(this,"index");d(this,"providerFactory");this.factory=e,this.canSeeViewProviders=i,this.injectImpl=n}};function mN(t){return t instanceof us}function gN(t){return(t.flags&8)!==0}function yN(t){return(t.flags&16)!==0}function n0(t,e,i){let n=0;for(;ne){s=o-1;break}}}for(;o>16}function ud(t,e){let i=_N(t),n=e;for(;i>0;)n=n[ma],i--;return n}var r0=!0;function ld(t){let e=r0;return r0=t,e}var CN=256,iE=CN-1,rE=5,DN=0,dr={};function EN(t,e,i){let n;typeof i=="string"?n=i.charCodeAt(0)||0:i.hasOwnProperty(Su)&&(n=i[Su]),n==null&&(n=i[Su]=DN++);let r=n&iE,o=1<>rE)]|=o}function cd(t,e){let i=oE(t,e);if(i!==-1)return i;let n=e[ve];n.firstCreatePass&&(t.injectorIndex=e.length,Fm(n.data,t),Fm(e,null),Fm(n.blueprint,null));let r=Dg(t,e),o=t.injectorIndex;if(nE(r)){let s=ad(r),a=ud(r,e),u=a[ve].data;for(let l=0;l<8;l++)e[o+l]=a[s+l]|u[s+l]}return e[o+8]=r,o}function Fm(t,e){t.push(0,0,0,0,0,0,0,0,e)}function oE(t,e){return t.injectorIndex===-1||t.parent&&t.parent.injectorIndex===t.injectorIndex||e[t.injectorIndex+8]===null?-1:t.injectorIndex}function Dg(t,e){if(t.parent&&t.parent.injectorIndex!==-1)return t.parent.injectorIndex;let i=0,n=null,r=e;for(;r!==null;){if(n=cE(r),n===null)return oa;if(i++,r=r[ma],n.injectorIndex!==-1)return n.injectorIndex|i<<16}return oa}function o0(t,e,i){EN(t,e,i)}function sE(t,e,i){if(i&Be.Optional||t!==void 0)return t;og(e,"NodeInjector")}function aE(t,e,i,n){if(i&Be.Optional&&n===void 0&&(n=null),!(i&(Be.Self|Be.Host))){let r=t[ua],o=Un(void 0);try{return r?r.get(e,n,i&Be.Optional):ED(e,n,i&Be.Optional)}finally{Un(o)}}return sE(n,e,i)}function uE(t,e,i,n=Be.Default,r){if(t!==null){if(e[fe]&2048&&!(n&Be.Self)){let s=IN(t,e,i,n,dr);if(s!==dr)return s}let o=lE(t,e,i,n,dr);if(o!==dr)return o}return aE(e,i,n,r)}function lE(t,e,i,n,r){let o=TN(i);if(typeof o=="function"){if(!ZD(e,t,n))return n&Be.Host?sE(r,i,n):aE(e,i,n,r);try{let s;if(s=o(n),s==null&&!(n&Be.Optional))og(i);else return s}finally{XD()}}else if(typeof o=="number"){let s=null,a=oE(t,e),u=oa,l=n&Be.Host?e[kn][Zn]:null;for((a===-1||n&Be.SkipSelf)&&(u=a===-1?Dg(t,e):e[a+8],u===oa||!SC(n,!1)?a=-1:(s=e[ve],a=ad(u),e=ud(u,e)));a!==-1;){let c=e[ve];if(IC(o,a,c.data)){let f=wN(a,e,i,s,n,l);if(f!==dr)return f}u=e[a+8],u!==oa&&SC(n,e[ve].data[a+8]===l)&&IC(o,a,e)?(s=c,a=ad(u),e=ud(u,e)):a=-1}}return r}function wN(t,e,i,n,r,o){let s=e[ve],a=s.data[t+8],u=n==null?Wu(a)&&r0:n!=s&&(a.type&3)!==0,l=r&Be.Host&&o===a,c=Yc(a,s,i,u,l);return c!==null?ls(e,s,c,a):dr}function Yc(t,e,i,n,r){let o=t.providerIndexes,s=e.data,a=o&1048575,u=t.directiveStart,l=t.directiveEnd,c=o>>20,f=n?a:a+c,p=r?a+c:l;for(let m=f;m=u&&g.type===i)return m}if(r){let m=s[u];if(m&&$r(m)&&m.type===i)return u}return null}function ls(t,e,i,n){let r=t[i],o=e.data;if(mN(r)){let s=r;s.resolving&&m3(h3(o[i]));let a=ld(s.canSeeViewProviders);s.resolving=!0;let u,l=s.injectImpl?Un(s.injectImpl):null,c=ZD(t,n,Be.Default);try{r=t[i]=s.factory(void 0,o,t,n),e.firstCreatePass&&i>=n.directiveStart&&pN(i,o[i],e)}finally{l!==null&&Un(l),ld(a),s.resolving=!1,XD()}}return r}function TN(t){if(typeof t=="string")return t.charCodeAt(0)||0;let e=t.hasOwnProperty(Su)?t[Su]:void 0;return typeof e=="number"?e>=0?e&iE:xN:e}function IC(t,e,i){let n=1<>rE)]&n)}function SC(t,e){return!(t&Be.Self)&&!(t&Be.Host&&e)}var ns=class{constructor(e,i){d(this,"_tNode");d(this,"_lView");this._tNode=e,this._lView=i}get(e,i,n){return uE(this._tNode,this._lView,e,Pd(n),i)}};function xN(){return new ns(dn(),pe())}function re(t){return ju(()=>{let e=t.prototype.constructor,i=e[Jc]||s0(e),n=Object.prototype,r=Object.getPrototypeOf(t.prototype).constructor;for(;r&&r!==n;){let o=r[Jc]||s0(r);if(o&&o!==i)return o;r=Object.getPrototypeOf(r)}return o=>new o})}function s0(t){return vD(t)?()=>{let e=s0(un(t));return e&&e()}:rs(t)}function IN(t,e,i,n,r){let o=t,s=e;for(;o!==null&&s!==null&&s[fe]&2048&&!(s[fe]&512);){let a=lE(o,s,i,n|Be.Self,dr);if(a!==dr)return a;let u=o.parent;if(!u){let l=s[PD];if(l){let c=l.get(i,dr,n);if(c!==dr)return c}u=cE(s),s=s[ma]}o=u}return r}function cE(t){let e=t[ve],i=e.type;return i===2?e.declTNode:i===1?t[Zn]:null}function MC(t,e=null,i=null,n){let r=dE(t,e,i,n);return r.resolveInjectorInitializers(),r}function dE(t,e=null,i=null,n,r=new Set){let o=[i||$n,k3(t)];return n=n||(typeof t=="object"?void 0:Mn(t)),new ku(o,e||Rd(),n||null,r)}var ts=class ts{static create(e,i){if(Array.isArray(e))return MC({name:""},i,e,"");{let n=e.name??"";return MC({name:n},e.parent,e.providers,n)}}};d(ts,"THROW_IF_NOT_FOUND",Au),d(ts,"NULL",new nd),d(ts,"\u0275prov",$({token:ts,providedIn:"any",factory:()=>$e(gr)})),d(ts,"__NG_ELEMENT_ID__",-1);var Wn=ts;var SN=new k("");SN.__NG_ELEMENT_ID__=t=>{let e=dn();if(e===null)throw new j(204,!1);if(e.type&2)return e.value;if(t&Be.Optional)return null;throw new j(204,!1)};var fE=!1,it=(()=>{class t{}return d(t,"__NG_ELEMENT_ID__",MN),d(t,"__NG_ENV_ID__",i=>i),t})(),dd=class extends it{constructor(i){super();d(this,"_lView");this._lView=i}onDestroy(i){return jD(this._lView,i),()=>Q3(this._lView,i)}};function MN(){return new dd(pe())}var Co=class{},jd=new k("",{providedIn:"root",factory:()=>!1});var pE=new k(""),Eg=new k(""),va=(()=>{let e=class e{constructor(){d(this,"taskId",0);d(this,"pendingTasks",new Set);d(this,"hasPendingTasks",new on(!1))}get _hasPendingTasks(){return this.hasPendingTasks.value}add(){this._hasPendingTasks||this.hasPendingTasks.next(!0);let n=this.taskId++;return this.pendingTasks.add(n),n}has(n){return this.pendingTasks.has(n)}remove(n){this.pendingTasks.delete(n),this.pendingTasks.size===0&&this._hasPendingTasks&&this.hasPendingTasks.next(!1)}ngOnDestroy(){this.pendingTasks.clear(),this._hasPendingTasks&&this.hasPendingTasks.next(!1)}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})();var a0=class extends tt{constructor(i=!1){super();d(this,"__isAsync");d(this,"destroyRef");d(this,"pendingTasks");this.__isAsync=i,ND()&&(this.destroyRef=h(it,{optional:!0})??void 0,this.pendingTasks=h(va,{optional:!0})??void 0)}emit(i){let n=Ue(null);try{super.next(i)}finally{Ue(n)}}subscribe(i,n,r){var l,c,f;let o=i,s=n||(()=>null),a=r;if(i&&typeof i=="object"){let p=i;o=(l=p.next)==null?void 0:l.bind(p),s=(c=p.error)==null?void 0:c.bind(p),a=(f=p.complete)==null?void 0:f.bind(p)}this.__isAsync&&(s=this.wrapInTimeout(s),o&&(o=this.wrapInTimeout(o)),a&&(a=this.wrapInTimeout(a)));let u=super.subscribe({next:o,error:s,complete:a});return i instanceof Ut&&i.add(u),u}wrapInTimeout(i){return n=>{var o;let r=(o=this.pendingTasks)==null?void 0:o.add();setTimeout(()=>{var s;i(n),r!==void 0&&((s=this.pendingTasks)==null||s.remove(r))})}}},_e=a0;function Fu(...t){}function hE(t){let e,i;function n(){t=Fu;try{i!==void 0&&typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(i),e!==void 0&&clearTimeout(e)}catch{}}return e=setTimeout(()=>{t(),n()}),typeof requestAnimationFrame=="function"&&(i=requestAnimationFrame(()=>{t(),n()})),()=>n()}function AC(t){return queueMicrotask(()=>t()),()=>{t=Fu}}var wg="isAngularZone",fd=wg+"_ID",AN=0,me=class t{constructor(e){d(this,"hasPendingMacrotasks",!1);d(this,"hasPendingMicrotasks",!1);d(this,"isStable",!0);d(this,"onUnstable",new _e(!1));d(this,"onMicrotaskEmpty",new _e(!1));d(this,"onStable",new _e(!1));d(this,"onError",new _e(!1));let{enableLongStackTrace:i=!1,shouldCoalesceEventChangeDetection:n=!1,shouldCoalesceRunChangeDetection:r=!1,scheduleInRootZone:o=fE}=e;if(typeof Zone>"u")throw new j(908,!1);Zone.assertZonePatched();let s=this;s._nesting=0,s._outer=s._inner=Zone.current,Zone.TaskTrackingZoneSpec&&(s._inner=s._inner.fork(new Zone.TaskTrackingZoneSpec)),i&&Zone.longStackTraceZoneSpec&&(s._inner=s._inner.fork(Zone.longStackTraceZoneSpec)),s.shouldCoalesceEventChangeDetection=!r&&n,s.shouldCoalesceRunChangeDetection=r,s.callbackScheduled=!1,s.scheduleInRootZone=o,NN(s)}static isInAngularZone(){return typeof Zone<"u"&&Zone.current.get(wg)===!0}static assertInAngularZone(){if(!t.isInAngularZone())throw new j(909,!1)}static assertNotInAngularZone(){if(t.isInAngularZone())throw new j(909,!1)}run(e,i,n){return this._inner.run(e,i,n)}runTask(e,i,n,r){let o=this._inner,s=o.scheduleEventTask("NgZoneEvent: "+r,e,kN,Fu,Fu);try{return o.runTask(s,i,n)}finally{o.cancelTask(s)}}runGuarded(e,i,n){return this._inner.runGuarded(e,i,n)}runOutsideAngular(e){return this._outer.run(e)}},kN={};function Tg(t){if(t._nesting==0&&!t.hasPendingMicrotasks&&!t.isStable)try{t._nesting++,t.onMicrotaskEmpty.emit(null)}finally{if(t._nesting--,!t.hasPendingMicrotasks)try{t.runOutsideAngular(()=>t.onStable.emit(null))}finally{t.isStable=!0}}}function ON(t){if(t.isCheckStableRunning||t.callbackScheduled)return;t.callbackScheduled=!0;function e(){hE(()=>{t.callbackScheduled=!1,u0(t),t.isCheckStableRunning=!0,Tg(t),t.isCheckStableRunning=!1})}t.scheduleInRootZone?Zone.root.run(()=>{e()}):t._outer.run(()=>{e()}),u0(t)}function NN(t){let e=()=>{ON(t)},i=AN++;t._inner=t._inner.fork({name:"angular",properties:{[wg]:!0,[fd]:i,[fd+i]:!0},onInvokeTask:(n,r,o,s,a,u)=>{if(PN(u))return n.invokeTask(o,s,a,u);try{return kC(t),n.invokeTask(o,s,a,u)}finally{(t.shouldCoalesceEventChangeDetection&&s.type==="eventTask"||t.shouldCoalesceRunChangeDetection)&&e(),OC(t)}},onInvoke:(n,r,o,s,a,u,l)=>{try{return kC(t),n.invoke(o,s,a,u,l)}finally{t.shouldCoalesceRunChangeDetection&&!t.callbackScheduled&&!FN(u)&&e(),OC(t)}},onHasTask:(n,r,o,s)=>{n.hasTask(o,s),r===o&&(s.change=="microTask"?(t._hasPendingMicrotasks=s.microTask,u0(t),Tg(t)):s.change=="macroTask"&&(t.hasPendingMacrotasks=s.macroTask))},onHandleError:(n,r,o,s)=>(n.handleError(o,s),t.runOutsideAngular(()=>t.onError.emit(s)),!1)})}function u0(t){t._hasPendingMicrotasks||(t.shouldCoalesceEventChangeDetection||t.shouldCoalesceRunChangeDetection)&&t.callbackScheduled===!0?t.hasPendingMicrotasks=!0:t.hasPendingMicrotasks=!1}function kC(t){t._nesting++,t.isStable&&(t.isStable=!1,t.onUnstable.emit(null))}function OC(t){t._nesting--,Tg(t)}var pd=class{constructor(){d(this,"hasPendingMicrotasks",!1);d(this,"hasPendingMacrotasks",!1);d(this,"isStable",!0);d(this,"onUnstable",new _e);d(this,"onMicrotaskEmpty",new _e);d(this,"onStable",new _e);d(this,"onError",new _e)}run(e,i,n){return e.apply(i,n)}runGuarded(e,i,n){return e.apply(i,n)}runOutsideAngular(e){return e()}runTask(e,i,n,r){return e.apply(i,n)}};function PN(t){return mE(t,"__ignore_ng_zone__")}function FN(t){return mE(t,"__scheduler_tick__")}function mE(t,e){var i,n;return!Array.isArray(t)||t.length!==1?!1:((n=(i=t[0])==null?void 0:i.data)==null?void 0:n[e])===!0}var pr=class{constructor(){d(this,"_console",console)}handleError(e){this._console.error("ERROR",e)}},RN=new k("",{providedIn:"root",factory:()=>{let t=h(me),e=h(pr);return i=>t.runOutsideAngular(()=>e.handleError(i))}});function NC(t,e){return yD(t,e)}function LN(t){return yD(gD,t)}var Wee=(NC.required=LN,NC);function HN(){return ba(dn(),pe())}function ba(t,e){return new de(ni(t,e))}var de=(()=>{class t{constructor(i){d(this,"nativeElement");this.nativeElement=i}}return d(t,"__NG_ELEMENT_ID__",HN),t})();function BN(t){return t instanceof de?t.nativeElement:t}function VN(){return this._results[Symbol.iterator]()}var pD;pD=Symbol.iterator;var Ru=class{constructor(e=!1){d(this,"_emitDistinctChangesOnly");d(this,"dirty",!0);d(this,"_onDirty");d(this,"_results",[]);d(this,"_changesDetected",!1);d(this,"_changes");d(this,"length",0);d(this,"first");d(this,"last");d(this,pD,VN);this._emitDistinctChangesOnly=e}get changes(){return this._changes??(this._changes=new tt)}get(e){return this._results[e]}map(e){return this._results.map(e)}filter(e){return this._results.filter(e)}find(e){return this._results.find(e)}reduce(e,i){return this._results.reduce(e,i)}forEach(e){this._results.forEach(e)}some(e){return this._results.some(e)}toArray(){return this._results.slice()}toString(){return this._results.toString()}reset(e,i){this.dirty=!1;let n=x3(e);(this._changesDetected=!T3(this._results,n,i))&&(this._results=n,this.length=n.length,this.last=n[this.length-1],this.first=n[0])}notifyOnChanges(){this._changes!==void 0&&(this._changesDetected||!this._emitDistinctChangesOnly)&&this._changes.next(this)}onDirty(e){this._onDirty=e}setDirty(){var e;this.dirty=!0,(e=this._onDirty)==null||e.call(this)}destroy(){this._changes!==void 0&&(this._changes.complete(),this._changes.unsubscribe())}},zN="ngSkipHydration",jN="ngskiphydration";function gE(t){let e=t.mergedAttrs;if(e===null)return!1;for(let i=0;iqN}),qN="ng",xg=new k(""),Ui=new k("",{providedIn:"platform",factory:()=>"unknown"});var qee=new k(""),Ig=new k("",{providedIn:"root",factory:()=>{var t,e;return((e=(t=Ku().body)==null?void 0:t.querySelector("[ngCspNonce]"))==null?void 0:e.getAttribute("ngCspNonce"))||null}});function ZN(){let t=new _a;return h(Ui)==="browser"&&(t.store=KN(Ku(),h(Ud))),t}var _a=(()=>{let e=class e{constructor(){d(this,"store",{});d(this,"onSerializeCallbacks",{})}get(n,r){return this.store[n]!==void 0?this.store[n]:r}set(n,r){this.store[n]=r}remove(n){delete this.store[n]}hasKey(n){return this.store.hasOwnProperty(n)}get isEmpty(){return Object.keys(this.store).length===0}onSerialize(n,r){this.onSerializeCallbacks[n]=r}toJson(){for(let n in this.onSerializeCallbacks)if(this.onSerializeCallbacks.hasOwnProperty(n))try{this.store[n]=this.onSerializeCallbacks[n]()}catch(r){console.warn("Exception in onSerialize callback: ",r)}return JSON.stringify(this.store).replace(/SE});var Mg=function(t){return t[t.CHANGE_DETECTION=0]="CHANGE_DETECTION",t[t.AFTER_NEXT_RENDER=1]="AFTER_NEXT_RENDER",t}(Mg||{}),$d=new k(""),FC=new Set;function bi(t){var e;FC.has(t)||(FC.add(t),(e=performance==null?void 0:performance.mark)==null||e.call(performance,"mark_feature_usage",{detail:{feature:t}}))}var ea=function(t){return t[t.EarlyRead=0]="EarlyRead",t[t.Write=1]="Write",t[t.MixedReadWrite=2]="MixedReadWrite",t[t.Read=3]="Read",t}(ea||{}),AE=(()=>{let e=class e{constructor(){d(this,"impl",null)}execute(){var n;(n=this.impl)==null||n.execute()}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})(),tP=[ea.EarlyRead,ea.Write,ea.MixedReadWrite,ea.Read],nP=(()=>{let e=class e{constructor(){d(this,"ngZone",h(me));d(this,"scheduler",h(Co));d(this,"errorHandler",h(pr,{optional:!0}));d(this,"sequences",new Set);d(this,"deferredRegistrations",new Set);d(this,"executing",!1);h($d,{optional:!0})}execute(){var n;this.executing=!0;for(let r of tP)for(let o of this.sequences)if(!(o.erroredOrDestroyed||!o.hooks[r]))try{o.pipelinedValue=this.ngZone.runOutsideAngular(()=>this.maybeTrace(()=>o.hooks[r](o.pipelinedValue),o.snapshot))}catch(s){o.erroredOrDestroyed=!0,(n=this.errorHandler)==null||n.handleError(s)}this.executing=!1;for(let r of this.sequences)r.afterRun(),r.once&&(this.sequences.delete(r),r.destroy());for(let r of this.deferredRegistrations)this.sequences.add(r);this.deferredRegistrations.size>0&&this.scheduler.notify(8),this.deferredRegistrations.clear()}register(n){this.executing?this.deferredRegistrations.add(n):(this.sequences.add(n),this.scheduler.notify(7))}unregister(n){this.executing&&this.sequences.has(n)?(n.erroredOrDestroyed=!0,n.pipelinedValue=void 0,n.once=!0):(this.sequences.delete(n),this.deferredRegistrations.delete(n))}maybeTrace(n,r){return r?r.run(Mg.AFTER_NEXT_RENDER,n):n()}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})(),f0=class{constructor(e,i,n,r,o=null){d(this,"impl");d(this,"hooks");d(this,"once");d(this,"snapshot");d(this,"erroredOrDestroyed",!1);d(this,"pipelinedValue");d(this,"unregisterOnDestroy");this.impl=e,this.hooks=i,this.once=n,this.snapshot=o,this.unregisterOnDestroy=r==null?void 0:r.onDestroy(()=>this.destroy())}afterRun(){var e;this.erroredOrDestroyed=!1,this.pipelinedValue=void 0,(e=this.snapshot)==null||e.dispose(),this.snapshot=null}destroy(){var e;this.impl.unregister(this),(e=this.unregisterOnDestroy)==null||e.call(this)}};function Ag(t,e){!(e!=null&&e.injector)&&ha(Ag);let i=(e==null?void 0:e.injector)??h(Wn);return bi("NgAfterNextRender"),rP(t,i,e,!0)}function iP(t,e){if(t instanceof Function){let i=[void 0,void 0,void 0,void 0];return i[e]=t,i}else return[t.earlyRead,t.write,t.mixedReadWrite,t.read]}function rP(t,e,i,n){let r=e.get(AE);r.impl??(r.impl=e.get(nP));let o=e.get($d,null,{optional:!0}),s=(i==null?void 0:i.phase)??ea.MixedReadWrite,a=(i==null?void 0:i.manualCleanup)!==!0?e.get(it):null,u=new f0(r.impl,iP(t,s),n,a,o==null?void 0:o.snapshot(null));return r.impl.register(u),u}var oP="__nghData__",kE=oP,sP="__nghDeferData__",aP=sP,Rm="ngh",uP="nghm",OE=()=>null;function lP(t,e,i=!1){let n=t.getAttribute(Rm);if(n==null)return null;let[r,o]=n.split("|");if(n=i?o:r,!n)return null;let s=o?`|${o}`:"",a=i?r:s,u={},l;if(n!==""){let f=e.get(_a,null,{optional:!0});if(f!==null){let p=f.get(kE,[]);l=f.get(aP,{}),u=p[Number(n)]}}let c={data:u,firstChild:t.firstChild??null};return i&&(c.firstChild=t,Gd(c,0,t.nextSibling)),a?t.setAttribute(Rm,a):t.removeAttribute(Rm),c}function cP(){OE=lP}function kg(t,e,i=!1){return OE(t,e,i)}function dP(t){let e=t._lView;return e[ve].type===2?null:(od(e)&&(e=e[Et]),e)}function fP(t){var e;return(e=t.textContent)==null?void 0:e.replace(/\s/gm,"")}function pP(t){let e=Ku(),i=e.createNodeIterator(t,NodeFilter.SHOW_COMMENT,{acceptNode(o){let s=fP(o);return s==="ngetn"||s==="ngtns"?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),n,r=[];for(;n=i.nextNode();)r.push(n);for(let o of r)o.textContent==="ngetn"?o.replaceWith(e.createTextNode("")):o.remove()}function Gd(t,e,i){t.segmentHeads??(t.segmentHeads={}),t.segmentHeads[e]=i}function p0(t,e){var i;return((i=t.segmentHeads)==null?void 0:i[e])??null}function hP(t,e){var r,o;let i=t.data,n=((r=i[YN])==null?void 0:r[e])??null;return n===null&&((o=i[Sg])!=null&&o[e])&&(n=Og(t,e)),n}function NE(t,e){var i;return((i=t.data[Sg])==null?void 0:i[e])??null}function Og(t,e){let i=NE(t,e)??[],n=0;for(let r of i)n+=r[md]*(r[xE]??1);return n}function mP(t){if(typeof t.disconnectedNodes>"u"){let e=t.data[IE];t.disconnectedNodes=e?new Set(e):null}return t.disconnectedNodes}function Yu(t,e){var i;if(typeof t.disconnectedNodes>"u"){let n=t.data[IE];t.disconnectedNodes=n?new Set(n):null}return!!((i=mP(t))!=null&&i.has(e))}var hr=function(t){return t[t.Emulated=0]="Emulated",t[t.None=2]="None",t[t.ShadowDom=3]="ShadowDom",t}(hr||{}),zc;function gP(){if(zc===void 0&&(zc=null,Mu.trustedTypes))try{zc=Mu.trustedTypes.createPolicy("angular",{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t})}catch{}return zc}function Wd(t){var e;return((e=gP())==null?void 0:e.createHTML(t))||t}var jc;function PE(){if(jc===void 0&&(jc=null,Mu.trustedTypes))try{jc=Mu.trustedTypes.createPolicy("angular#unsafe-bypass",{createHTML:t=>t,createScript:t=>t,createScriptURL:t=>t})}catch{}return jc}function RC(t){var e;return((e=PE())==null?void 0:e.createHTML(t))||t}function LC(t){var e;return((e=PE())==null?void 0:e.createScriptURL(t))||t}var Gr=class{constructor(e){d(this,"changingThisBreaksApplicationSecurity");this.changingThisBreaksApplicationSecurity=e}toString(){return`SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity} (see ${mD})`}},h0=class extends Gr{getTypeName(){return"HTML"}},m0=class extends Gr{getTypeName(){return"Style"}},g0=class extends Gr{getTypeName(){return"Script"}},y0=class extends Gr{getTypeName(){return"URL"}},v0=class extends Gr{getTypeName(){return"ResourceURL"}};function ii(t){return t instanceof Gr?t.changingThisBreaksApplicationSecurity:t}function Kr(t,e){let i=yP(t);if(i!=null&&i!==e){if(i==="ResourceURL"&&e==="URL")return!0;throw new Error(`Required a safe ${e}, got a ${i} (see ${mD})`)}return i===e}function yP(t){return t instanceof Gr&&t.getTypeName()||null}function FE(t){return new h0(t)}function RE(t){return new m0(t)}function LE(t){return new g0(t)}function HE(t){return new y0(t)}function BE(t){return new v0(t)}function vP(t){let e=new _0(t);return bP()?new b0(e):e}var b0=class{constructor(e){d(this,"inertDocumentHelper");this.inertDocumentHelper=e}getInertBodyElement(e){var i;e=""+e;try{let n=new window.DOMParser().parseFromString(Wd(e),"text/html").body;return n===null?this.inertDocumentHelper.getInertBodyElement(e):((i=n.firstChild)==null||i.remove(),n)}catch{return null}}},_0=class{constructor(e){d(this,"defaultDoc");d(this,"inertDocument");this.defaultDoc=e,this.inertDocument=this.defaultDoc.implementation.createHTMLDocument("sanitization-inert")}getInertBodyElement(e){let i=this.inertDocument.createElement("template");return i.innerHTML=Wd(e),i}};function bP(){try{return!!new window.DOMParser().parseFromString(Wd(""),"text/html")}catch{return!1}}var _P=/^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:\/?#]*(?:[\/?#]|$))/i;function qd(t){return t=String(t),t.match(_P)?t:"unsafe:"+t}function Yr(t){let e={};for(let i of t.split(","))e[i]=!0;return e}function Qu(...t){let e={};for(let i of t)for(let n in i)i.hasOwnProperty(n)&&(e[n]=!0);return e}var VE=Yr("area,br,col,hr,img,wbr"),zE=Yr("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),jE=Yr("rp,rt"),CP=Qu(jE,zE),DP=Qu(zE,Yr("address,article,aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul")),EP=Qu(jE,Yr("a,abbr,acronym,audio,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video")),HC=Qu(VE,DP,EP,CP),UE=Yr("background,cite,href,itemtype,longdesc,poster,src,xlink:href"),wP=Yr("abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,scope,scrolling,shape,size,sizes,span,srclang,srcset,start,summary,tabindex,target,title,translate,type,usemap,valign,value,vspace,width"),TP=Yr("aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext"),xP=Qu(UE,wP,TP),IP=Yr("script,style,template"),C0=class{constructor(){d(this,"sanitizedSomething",!1);d(this,"buf",[])}sanitizeChildren(e){let i=e.firstChild,n=!0,r=[];for(;i;){if(i.nodeType===Node.ELEMENT_NODE?n=this.startElement(i):i.nodeType===Node.TEXT_NODE?this.chars(i.nodeValue):this.sanitizedSomething=!0,n&&i.firstChild){r.push(i),i=AP(i);continue}for(;i;){i.nodeType===Node.ELEMENT_NODE&&this.endElement(i);let o=MP(i);if(o){i=o;break}i=r.pop()}}return this.buf.join("")}startElement(e){let i=BC(e).toLowerCase();if(!HC.hasOwnProperty(i))return this.sanitizedSomething=!0,!IP.hasOwnProperty(i);this.buf.push("<"),this.buf.push(i);let n=e.attributes;for(let r=0;r"),!0}endElement(e){let i=BC(e).toLowerCase();HC.hasOwnProperty(i)&&!VE.hasOwnProperty(i)&&(this.buf.push(""))}chars(e){this.buf.push(VC(e))}};function SP(t,e){return(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY)!==Node.DOCUMENT_POSITION_CONTAINED_BY}function MP(t){let e=t.nextSibling;if(e&&t!==e.previousSibling)throw $E(e);return e}function AP(t){let e=t.firstChild;if(e&&SP(t,e))throw $E(e);return e}function BC(t){let e=t.nodeName;return typeof e=="string"?e:"FORM"}function $E(t){return new Error(`Failed to sanitize html because the element is clobbered: ${t.outerHTML}`)}var kP=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,OP=/([^\#-~ |!])/g;function VC(t){return t.replace(/&/g,"&").replace(kP,function(e){let i=e.charCodeAt(0),n=e.charCodeAt(1);return"&#"+((i-55296)*1024+(n-56320)+65536)+";"}).replace(OP,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(//g,">")}var Uc;function Ng(t,e){let i=null;try{Uc=Uc||vP(t);let n=e?String(e):"";i=Uc.getInertBodyElement(n);let r=5,o=n;do{if(r===0)throw new Error("Failed to sanitize html because the input is unstable");r--,n=o,o=i.innerHTML,i=Uc.getInertBodyElement(n)}while(n!==o);let a=new C0().sanitizeChildren(zC(i)||i);return Wd(a)}finally{if(i){let n=zC(i)||i;for(;n.firstChild;)n.firstChild.remove()}}}function zC(t){return"content"in t&&NP(t)?t.content:null}function NP(t){return t.nodeType===Node.ELEMENT_NODE&&t.nodeName==="TEMPLATE"}var ri=function(t){return t[t.NONE=0]="NONE",t[t.HTML=1]="HTML",t[t.STYLE=2]="STYLE",t[t.SCRIPT=3]="SCRIPT",t[t.URL=4]="URL",t[t.RESOURCE_URL=5]="RESOURCE_URL",t}(ri||{});function Zd(t){let e=Pg();return e?RC(e.sanitize(ri.HTML,t)||""):Kr(t,"HTML")?RC(ii(t)):Ng(Ku(),is(t))}function Kd(t){let e=Pg();return e?e.sanitize(ri.URL,t)||"":Kr(t,"URL")?ii(t):qd(is(t))}function GE(t){let e=Pg();if(e)return LC(e.sanitize(ri.RESOURCE_URL,t)||"");if(Kr(t,"ResourceURL"))return LC(ii(t));throw new j(904,!1)}function Pg(){let t=pe();return t&&t[jr].sanitizer}var PP=/^>|^->||--!>|)/g,RP="\u200B$1\u200B";function LP(t){return t.replace(PP,e=>e.replace(FP,RP))}function Zee(t){return t.ownerDocument.defaultView}function Nn(t){return t.ownerDocument}function HP(t){return t.ownerDocument.body}function WE(t){return t instanceof Function?t():t}var Eo=function(t){return t[t.None=0]="None",t[t.SignalBased=1]="SignalBased",t[t.HasDecoratorInputTransform=2]="HasDecoratorInputTransform",t}(Eo||{}),mr=function(t){return t[t.Important=1]="Important",t[t.DashCase=2]="DashCase",t}(mr||{}),BP;function Fg(t,e){return BP(t,e)}function ta(t,e,i,n,r){if(n!=null){let o,s=!1;yr(n)?o=n:zi(n)&&(s=!0,n=n[Gn]);let a=ji(n);t===0&&i!==null?r==null?XE(e,i,a):gd(e,i,a,r||null,!0):t===1&&i!==null?gd(e,i,a,r||null,!0):t===2?Hg(e,a,s):t===3&&e.destroyNode(a),o!=null&&XP(e,t,o,i,r)}}function qE(t,e){return t.createText(e)}function VP(t,e,i){t.setValue(e,i)}function ZE(t,e){return t.createComment(LP(e))}function Rg(t,e,i){return t.createElement(e,i)}function zP(t,e){KE(t,e),e[Gn]=null,e[Zn]=null}function jP(t,e,i,n,r,o){n[Gn]=r,n[Zn]=e,Xd(t,n,i,1,r,o)}function KE(t,e){var i;(i=e[jr].changeDetectionScheduler)==null||i.notify(10),Xd(t,e,e[pt],2,null,null)}function UP(t){let e=t[Ou];if(!e)return Lm(t[ve],t);for(;e;){let i=null;if(zi(e))i=e[Ou];else{let n=e[ln];n&&(i=n)}if(!i){for(;e&&!e[Bi]&&e!==t;)zi(e)&&Lm(e[ve],e),e=e[cn];e===null&&(e=t),zi(e)&&Lm(e[ve],e),i=e&&e[Bi]}e=i}}function $P(t,e,i,n){let r=ln+n,o=i.length;n>0&&(i[r-1][Bi]=e),n0&&(t[i-1][Bi]=n[Bi]);let o=td(t,ln+e);zP(n[ve],n);let s=o[Vi];s!==null&&s.detachView(o[ve]),n[cn]=null,n[Bi]=null,n[fe]&=-129}return n}function Yd(t,e){if(!(e[fe]&256)){let i=e[pt];i.destroyNode&&Xd(t,e,i,3,null,null),UP(e)}}function Lm(t,e){if(e[fe]&256)return;let i=Ue(null);try{e[fe]&=-129,e[fe]|=256,e[ti]&&Us(e[ti]),WP(t,e),GP(t,e),e[ve].type===1&&e[pt].destroy();let n=e[os];if(n!==null&&yr(e[cn])){n!==e[cn]&&Lg(n,e);let r=e[Vi];r!==null&&r.detachView(t)}l0(e)}finally{Ue(i)}}function GP(t,e){let i=t.cleanup,n=e[ia];if(i!==null)for(let s=0;s=0?n[a]():n[-a].unsubscribe(),s+=2}else{let a=n[i[s+1]];i[s].call(a)}n!==null&&(e[ia]=null);let r=e[vo];if(r!==null){e[vo]=null;for(let s=0;s-1){let{encapsulation:o}=t.data[n.directiveStart+r];if(o===hr.None||o===hr.Emulated)return null}return ni(n,i)}}function gd(t,e,i,n,r){t.insertBefore(e,i,n,r)}function XE(t,e,i){t.appendChild(e,i)}function jC(t,e,i,n,r){n!==null?gd(t,e,i,n,r):XE(t,e,i)}function JE(t,e){return t.parentNode(e)}function ZP(t,e){return t.nextSibling(e)}function ew(t,e,i){return YP(t,e,i)}function KP(t,e,i){return t.type&40?ni(t,i):null}var YP=KP,UC;function Qd(t,e,i,n){let r=QE(t,n,e),o=e[pt],s=n.parent||e[Zn],a=ew(s,n,e);if(r!=null)if(Array.isArray(i))for(let u=0;u-1){let o;for(;++ro?f="":f=r[c+1].toLowerCase(),n&2&&l!==f){if(Hi(n))return!1;s=!0}}}}return Hi(n)||s}function Hi(t){return(t&1)===0}function oF(t,e,i,n){if(e===null)return-1;let r=0;if(n||!i){let o=!1;for(;r-1)for(i++;i0?'="'+a+'"':"")+"]"}else n&8?r+="."+s:n&4&&(r+=" "+s);else r!==""&&!Hi(s)&&(e+=$C(o,r),r=""),n=s,o=o||!Hi(n);i++}return r!==""&&(e+=$C(o,r)),e}function dF(t){return t.map(cF).join(",")}function fF(t){let e=[],i=[],n=1,r=2;for(;nEt&&uw(t,e,Et,!1),cr(s?2:0,r),i(n,r)}finally{as(o),cr(s?3:1,r)}}function zg(t,e,i){if(fg(e)){let n=Ue(null);try{let r=e.directiveStart,o=e.directiveEnd;for(let s=r;snull;function vF(t){yE(t)?nw(t):pP(t)}function bF(){hw=vF}function _F(t,e,i,n){let r=_w(e);r.push(i),t.firstCreatePass&&Cw(t).push(n,r.length-1)}function CF(t,e,i,n,r,o){let s=e?e.injectorIndex:-1,a=0;return ya()&&(a|=128),{type:i,index:n,insertBeforeIndex:null,injectorIndex:s,directiveStart:-1,directiveEnd:-1,directiveStylingLast:-1,componentOffset:-1,propertyBindings:null,flags:a,providerIndexes:0,value:r,attrs:o,mergedAttrs:null,localNames:null,initialInputs:void 0,inputs:null,outputs:null,tView:null,next:null,prev:null,projectionNext:null,child:null,parent:e,projection:null,styles:null,stylesWithoutHost:null,residualStyles:void 0,classes:null,classesWithoutHost:null,residualClasses:void 0,classBindings:0,styleBindings:0}}function GC(t,e,i,n,r){for(let o in e){if(!e.hasOwnProperty(o))continue;let s=e[o];if(s===void 0)continue;n??(n={});let a,u=Eo.None;Array.isArray(s)?(a=s[0],u=s[1]):a=s;let l=o;if(r!==null){if(!r.hasOwnProperty(o))continue;l=r[o]}t===0?WC(n,i,l,a,u):WC(n,i,l,a)}return n}function WC(t,e,i,n,r){let o;t.hasOwnProperty(i)?(o=t[i]).push(e,n):o=t[i]=[e,n],r!==void 0&&o.push(r)}function DF(t,e,i){let n=e.directiveStart,r=e.directiveEnd,o=t.data,s=e.attrs,a=[],u=null,l=null;for(let c=n;c0;){let i=t[--e];if(typeof i=="number"&&i<0)return i}return 0}function IF(t,e,i,n){let r=i.directiveStart,o=i.directiveEnd;Wu(i)&&PF(e,i,t.data[r+i.componentOffset]),t.firstCreatePass||cd(i,e),Do(n,e);let s=i.initialInputs;for(let a=r;a{qu(t.lView)},consumerOnSignalRead(){this.lView[ti]=this}});function YF(t){let e=t[ti]??Object.create(QF);return e.lView=t,e}var QF=U(M({},Zo),{consumerIsAlwaysLive:!0,consumerMarkedDirty:t=>{let e=ss(t.lView);for(;e&&!Tw(e[ve]);)e=ss(e);e&&mg(e)},consumerOnSignalRead(){this.lView[ti]=this}});function Tw(t){return t.type!==2}function xw(t){if(t[Br]===null)return;let e=!0;for(;e;){let i=!1;for(let n of t[Br])n.dirty&&(i=!0,n.zone===null||Zone.current===n.zone?n.run():n.zone.run(()=>n.run()));e=i&&!!(t[fe]&8192)}}var XF=100;function Iw(t,e=!0,i=0){var s,a;let r=t[jr].rendererFactory,o=!1;o||(s=r.begin)==null||s.call(r);try{JF(t,i)}catch(u){throw e&&Dw(t,u),u}finally{o||(a=r.end)==null||a.call(r)}}function JF(t,e){let i=GD();try{sd(!0),T0(t,e);let n=0;for(;Bd(t);){if(n===XF)throw new j(103,!1);n++,T0(t,1)}}finally{sd(i)}}function eR(t,e,i,n){let r=e[fe];if((r&256)===256)return;let o=!1,s=!1;_g(e);let a=!0,u=null,l=null;o||(Tw(t)?(l=WF(e),u=js(l)):M1()===null?(a=!1,l=YF(e),u=js(l)):e[ti]&&(Us(e[ti]),e[ti]=null));try{zD(e),aN(t.bindingStartIndex),i!==null&&fw(t,e,i,2,n);let c=(r&3)===3;if(!o)if(c){let m=t.preOrderCheckHooks;m!==null&&Zc(e,m,null)}else{let m=t.preOrderHooks;m!==null&&Kc(e,m,0,null),Nm(e,0)}if(s||tR(e),xw(e),Sw(e,0),t.contentQueries!==null&&bw(t,e),!o)if(c){let m=t.contentCheckHooks;m!==null&&Zc(e,m)}else{let m=t.contentHooks;m!==null&&Kc(e,m,1),Nm(e,1)}pF(t,e);let f=t.components;f!==null&&Aw(e,f,0);let p=t.viewQuery;if(p!==null&&w0(2,p,n),!o)if(c){let m=t.viewCheckHooks;m!==null&&Zc(e,m)}else{let m=t.viewHooks;m!==null&&Kc(e,m,2),Nm(e,2)}if(t.firstUpdatePass===!0&&(t.firstUpdatePass=!1),e[ra]){for(let m of e[ra])m();e[ra]=null}o||(e[fe]&=-73)}catch(c){throw o||qu(e),c}finally{l!==null&&(gu(l,u),a&&ZF(l)),Cg()}}function Sw(t,e){for(let i=_E(t);i!==null;i=CE(i))for(let n=ln;n-1&&(Lu(e,n),td(i,n))}this._attachedToViewContainer=!1}Yd(this._lView[ve],this._lView)}onDestroy(e){jD(this._lView,e)}markForCheck(){Zg(this._cdRefInjectingView||this._lView,4)}markForRefresh(){mg(this._cdRefInjectingView||this._lView)}detach(){this._lView[fe]&=-129}reattach(){Jm(this._lView),this._lView[fe]|=128}detectChanges(){this._lView[fe]|=1024,Iw(this._lView,this.notifyErrorHandler)}checkNoChanges(){}attachToViewContainerRef(){if(this._appRef)throw new j(902,!1);this._attachedToViewContainer=!0}detachFromAppRef(){this._appRef=null;let e=od(this._lView),i=this._lView[os];i!==null&&!e&&Lg(i,this._lView),KE(this._lView[ve],this._lView)}attachToAppRef(e){if(this._attachedToViewContainer)throw new j(902,!1);this._appRef=e;let i=od(this._lView),n=this._lView[os];n!==null&&!i&&YE(n,this._lView),Jm(this._lView)}},It=(()=>{class t{}return d(t,"__NG_ELEMENT_ID__",oR),t})(),iR=It,rR=class extends iR{constructor(i,n,r){super();d(this,"_declarationLView");d(this,"_declarationTContainer");d(this,"elementRef");this._declarationLView=i,this._declarationTContainer=n,this.elementRef=r}get ssrId(){var i;return((i=this._declarationTContainer.tView)==null?void 0:i.ssrId)||null}createEmbeddedView(i,n){return this.createEmbeddedViewImpl(i,n)}createEmbeddedViewImpl(i,n,r){let o=nf(this._declarationLView,this._declarationTContainer,i,{embeddedViewInjector:n,dehydratedView:r});return new cs(o)}};function oR(){return of(dn(),pe())}function of(t,e){return t.type&4?new rR(e,t,ba(t,e)):null}var sR=new RegExp(`^(\\d+)*(${TE}|${wE})*(.*)`);function aR(t){let e=t.match(sR),[i,n,r,o]=e,s=n?parseInt(n,10):r,a=[];for(let[u,l,c]of o.matchAll(/(f|n)(\d*)/g)){let f=parseInt(c,10)||1;a.push(l,f)}return[s,...a]}function uR(t){var e;return!t.prev&&((e=t.parent)==null?void 0:e.type)===8}function Hm(t){return t.index-Et}function lR(t,e){let i=t.i18nNodes;if(i)return i.get(e)}function sf(t,e,i,n){let r=Hm(n),o=lR(t,r);if(o===void 0){let s=t.data[JN];if(s!=null&&s[r])o=dR(s[r],i);else if(e.firstChild===n)o=t.firstChild;else{let a=n.prev===null,u=n.prev??n.parent;if(uR(n)){let l=Hm(n.parent);o=p0(t,l)}else{let l=ni(u,i);if(a)o=l.firstChild;else{let c=Hm(u),f=p0(t,c);if(u.type===2&&f){let m=Og(t,c)+1;o=af(m,f)}else o=l.nextSibling}}}}return o}function af(t,e){let i=e;for(let n=0;n0&&(o.firstChild=t,t=af(n[md],t)),i.push(o)}return[t,i]}var Nw=()=>null;function bR(t,e){let i=t[Nu];return!e||i===null||i.length===0?null:i[0].data[XN]===e?i.shift():(kw(t),null)}function _R(){Nw=bR}function Bu(t,e){return Nw(t,e)}var x0=class{},bd=class{},I0=class{resolveComponentFactory(e){throw Error(`No component factory found for ${Mn(e)}.`)}},Vr=class{};d(Vr,"NULL",new I0);var ca=class{},oi=(()=>{class t{constructor(){d(this,"destroyNode",null)}}return d(t,"__NG_ELEMENT_ID__",()=>CR()),t})();function CR(){let t=pe(),e=dn(),i=wo(e.index,t);return(zi(i)?i:t)[pt]}var DR=(()=>{let e=class e{};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>null}));let t=e;return t})();function _d(t,e,i){let n=i?t.styles:null,r=i?t.classes:null,o=0;if(e!==null)for(let s=0;s0&&rw(t,i,o.join(" "))}}function MR(t,e,i){let n=t.projection=[];for(let r=0;r{class t{}return d(t,"__NG_ELEMENT_ID__",kR),t})();function kR(){let t=dn();return Fw(t,pe())}var OR=zt,Pw=class extends OR{constructor(i,n,r){super();d(this,"_lContainer");d(this,"_hostTNode");d(this,"_hostLView");this._lContainer=i,this._hostTNode=n,this._hostLView=r}get element(){return ba(this._hostTNode,this._hostLView)}get injector(){return new ns(this._hostTNode,this._hostLView)}get parentInjector(){let i=Dg(this._hostTNode,this._hostLView);if(nE(i)){let n=ud(i,this._hostLView),r=ad(i),o=n[ve].data[r+8];return new ns(o,n)}else return new ns(null,this._hostLView)}clear(){for(;this.length>0;)this.remove(this.length-1)}get(i){let n=ZC(this._lContainer);return n!==null&&n[i]||null}get length(){return this._lContainer.length-ln}createEmbeddedView(i,n,r){let o,s;typeof r=="number"?o=r:r!=null&&(o=r.index,s=r.injector);let a=Bu(this._lContainer,i.ssrId),u=i.createEmbeddedViewImpl(n||{},s,a);return this.insertImpl(u,o,Hu(this._hostTNode,a)),u}createComponent(i,n,r,o,s){let a=i&&!j3(i),u;if(a)u=n;else{let y=n||{};u=y.index,r=y.injector,o=y.projectableNodes,s=y.environmentInjector||y.ngModuleRef}let l=a?i:new da(bo(i)),c=r||this.parentInjector;if(!s&&l.ngModule==null){let b=(a?c:this.parentInjector).get(fr,null);b&&(s=b)}let f=bo(l.componentType??{}),p=Bu(this._lContainer,(f==null?void 0:f.id)??null),m=(p==null?void 0:p.firstChild)??null,g=l.create(c,o,m,s);return this.insertImpl(g.hostView,u,Hu(this._hostTNode,p)),g}insert(i,n){return this.insertImpl(i,n,!0)}insertImpl(i,n,r){let o=i._lView;if(K3(o)){let u=this.indexOf(i);if(u!==-1)this.detach(u);else{let l=o[cn],c=new Pw(l,l[Zn],l[cn]);c.detach(c.indexOf(i))}}let s=this._adjustIndex(n),a=this._lContainer;return rf(a,o,s,r),i.attachToViewContainerRef(),wD(Bm(a),s,i),i}move(i,n){return this.insert(i,n)}indexOf(i){let n=ZC(this._lContainer);return n!==null?n.indexOf(i):-1}remove(i){let n=this._adjustIndex(i,-1),r=Lu(this._lContainer,n);r&&(td(Bm(this._lContainer),n),Yd(r[ve],r))}detach(i){let n=this._adjustIndex(i,-1),r=Lu(this._lContainer,n);return r&&td(Bm(this._lContainer),n)!=null?new cs(r):null}_adjustIndex(i,n=0){return i??this.length+n}};function ZC(t){return t[id]}function Bm(t){return t[id]||(t[id]=[])}function Fw(t,e){let i,n=e[t.index];return yr(n)?i=n:(i=vw(n,e,null,t),e[t.index]=i,tf(e,i)),Rw(i,e,t,n),new Pw(i,t,e)}function NR(t,e){let i=t[pt],n=i.createComment(""),r=ni(e,t),o=JE(i,r);return gd(i,o,n,ZP(i,r),!1),n}var Rw=Lw,Kg=()=>!1;function PR(t,e,i){return Kg(t,e,i)}function Lw(t,e,i,n){if(t[Ur])return;let r;i.type&8?r=ji(n):r=NR(e,i),t[Ur]=r}function FR(t,e,i){var c;if(t[Ur]&&t[Nu])return!0;let n=i[yi],r=e.index-Et;if(!n||UN(e)||Yu(n,r))return!1;let s=p0(n,r),a=(c=n.data[Sg])==null?void 0:c[r],[u,l]=vR(s,a);return t[Ur]=u,t[Nu]=l,!0}function RR(t,e,i,n){Kg(t,i,e)||Lw(t,e,i,n)}function LR(){Rw=RR,Kg=FR}var M0=class t{constructor(e){d(this,"queryList");d(this,"matches",null);this.queryList=e}clone(){return new t(this.queryList)}setDirty(){this.queryList.setDirty()}},A0=class t{constructor(e=[]){d(this,"queries");this.queries=e}createEmbeddedView(e){let i=e.queries;if(i!==null){let n=e.contentQueries!==null?e.contentQueries[0]:i.length,r=[];for(let o=0;o0)n.push(s[a/2]);else{let l=o[a+1],c=e[-u];for(let f=ln;fe.trim())}function Vw(t,e,i){t.queries===null&&(t.queries=new k0),t.queries.track(new O0(e,i))}function WR(t,e){let i=t.contentQueries||(t.contentQueries=[]),n=i.length?i[i.length-1]:-1;e!==n&&i.push(t.queries.length-1,e)}function Yg(t,e){return t.queries.getByIndex(e)}function qR(t,e){let i=t[ve],n=Yg(i,e);return n.crossesNgTemplate?N0(i,t,e,[]):Hw(i,t,n,e)}function uf(t){return typeof t=="function"&&t[zn]!==void 0}function ge(t,e){bi("NgSignals");let i=V1(t),n=i[zn];return e!=null&&e.equal&&(n.equal=e.equal),i.set=r=>pc(n,r),i.update=r=>z1(n,r),i.asReadonly=ZR.bind(i),i}function ZR(){let t=this[zn];if(t.readonlyFn===void 0){let e=()=>this();e[zn]=t,t.readonlyFn=e}return t.readonlyFn}function zw(t){return uf(t)&&typeof t.set=="function"}var Wr=class{},P0=class{};function jw(t,e){return new Ed(t,e??null,[])}var Ed=class extends Wr{constructor(i,n,r,o=!0){super();d(this,"ngModuleType");d(this,"_parent");d(this,"_bootstrapComponents",[]);d(this,"_r3Injector");d(this,"instance");d(this,"destroyCbs",[]);d(this,"componentFactoryResolver",new Cd(this));this.ngModuleType=i,this._parent=n;let s=ID(i);this._bootstrapComponents=WE(s.bootstrap),this._r3Injector=dE(i,n,[{provide:Wr,useValue:this},{provide:Vr,useValue:this.componentFactoryResolver},...r],Mn(i),new Set(["environment"])),o&&this.resolveInjectorInitializers()}resolveInjectorInitializers(){this._r3Injector.resolveInjectorInitializers(),this.instance=this._r3Injector.get(this.ngModuleType)}get injector(){return this._r3Injector}destroy(){let i=this._r3Injector;!i.destroyed&&i.destroy(),this.destroyCbs.forEach(n=>n()),this.destroyCbs=null}onDestroy(i){this.destroyCbs.push(i)}},F0=class extends P0{constructor(i){super();d(this,"moduleType");this.moduleType=i}create(i){return new Ed(this.moduleType,i,[])}};var wd=class extends Wr{constructor(i){super();d(this,"injector");d(this,"componentFactoryResolver",new Cd(this));d(this,"instance",null);let n=new ku([...i.providers,{provide:Wr,useValue:this},{provide:Vr,useValue:this.componentFactoryResolver}],i.parent||Rd(),i.debugName,new Set(["environment"]));this.injector=n,i.runEnvironmentInitializers&&n.resolveInjectorInitializers()}destroy(){this.injector.destroy()}onDestroy(i){this.injector.onDestroy(i)}};function KR(t,e,i=null){return new wd({providers:t,parent:e,debugName:i,runEnvironmentInitializers:!0}).injector}var YR=(()=>{let e=class e{constructor(n){d(this,"_injector");d(this,"cachedInjectors",new Map);this._injector=n}getOrCreateStandaloneInjector(n){if(!n.standalone)return null;if(!this.cachedInjectors.has(n)){let r=MD(!1,n.type),o=r.length>0?KR([r],this._injector,`Standalone[${n.type.name}]`):null;this.cachedInjectors.set(n,o)}return this.cachedInjectors.get(n)}ngOnDestroy(){try{for(let n of this.cachedInjectors.values())n!==null&&n.destroy()}finally{this.cachedInjectors.clear()}}};d(e,"\u0275prov",$({token:e,providedIn:"environment",factory:()=>new e($e(fr))}));let t=e;return t})();function H(t){return ju(()=>{let e=Uw(t),i=U(M({},e),{decls:t.decls,vars:t.vars,template:t.template,consts:t.consts||null,ngContentSelectors:t.ngContentSelectors,onPush:t.changeDetection===vE.OnPush,directiveDefs:null,pipeDefs:null,dependencies:e.standalone&&t.dependencies||null,getStandaloneInjector:e.standalone?r=>r.get(YR).getOrCreateStandaloneInjector(i):null,getExternalStyles:null,signals:t.signals??!1,data:t.data||{},encapsulation:t.encapsulation||hr.Emulated,styles:t.styles||$n,_:null,schemas:t.schemas||null,tView:null,id:""});e.standalone&&bi("NgStandalone"),$w(i);let n=t.dependencies;return i.directiveDefs=YC(n,!1),i.pipeDefs=YC(n,!0),i.id=JR(i),i})}function QR(t){return bo(t)||ug(t)}function XR(t){return t!==null}function bn(t){return ju(()=>({type:t.type,bootstrap:t.bootstrap||$n,declarations:t.declarations||$n,imports:t.imports||$n,exports:t.exports||$n,transitiveCompileScopes:null,schemas:t.schemas||null,id:t.id||null}))}function KC(t,e){if(t==null)return zr;let i={};for(let n in t)if(t.hasOwnProperty(n)){let r=t[n],o,s,a=Eo.None;Array.isArray(r)?(a=r[0],o=r[1],s=r[2]??o):(o=r,s=r),e?(i[o]=a!==Eo.None?[n,a]:n,e[o]=s):i[o]=n}return i}function T(t){return ju(()=>{let e=Uw(t);return $w(e),e})}function $i(t){return{type:t.type,name:t.name,factory:null,pure:t.pure!==!1,standalone:t.standalone??!0,onDestroy:t.type.prototype.ngOnDestroy||null}}function Uw(t){let e={};return{type:t.type,providersResolver:null,factory:null,hostBindings:t.hostBindings||null,hostVars:t.hostVars||0,hostAttrs:t.hostAttrs||null,contentQueries:t.contentQueries||null,declaredInputs:e,inputTransforms:null,inputConfig:t.inputs||zr,exportAs:t.exportAs||null,standalone:t.standalone??!0,signals:t.signals===!0,selectors:t.selectors||$n,viewQuery:t.viewQuery||null,features:t.features||null,setInput:null,findHostDirectiveDefs:null,hostDirectives:null,inputs:KC(t.inputs,e),outputs:KC(t.outputs),debugInfo:null}}function $w(t){var e;(e=t.features)==null||e.forEach(i=>i(t))}function YC(t,e){if(!t)return null;let i=e?SD:QR;return()=>(typeof t=="function"?t():t).map(n=>i(n)).filter(XR)}function JR(t){let e=0,i=typeof t.consts=="function"?"":t.consts,n=[t.selectors,t.ngContentSelectors,t.hostVars,t.hostAttrs,i,t.vars,t.decls,t.encapsulation,t.standalone,t.signals,t.exportAs,JSON.stringify(t.inputs),JSON.stringify(t.outputs),Object.getOwnPropertyNames(t.type.prototype),!!t.contentQueries,!!t.viewQuery];for(let o of n.join("|"))e=Math.imul(31,e)+o.charCodeAt(0)<<0;return e+=2147483648,"c"+e}function eL(t){return Object.getPrototypeOf(t.prototype).constructor}function oe(t){let e=eL(t.type),i=!0,n=[t];for(;e;){let r;if($r(t))r=e.\u0275cmp||e.\u0275dir;else{if(e.\u0275cmp)throw new j(903,!1);r=e.\u0275dir}if(r){if(i){n.push(r);let s=t;s.inputs=$c(t.inputs),s.inputTransforms=$c(t.inputTransforms),s.declaredInputs=$c(t.declaredInputs),s.outputs=$c(t.outputs);let a=r.hostBindings;a&&oL(t,a);let u=r.viewQuery,l=r.contentQueries;if(u&&iL(t,u),l&&rL(t,l),tL(t,r),s3(t.outputs,r.outputs),$r(r)&&r.data.animation){let c=t.data;c.animation=(c.animation||[]).concat(r.data.animation)}}let o=r.features;if(o)for(let s=0;s=0;n--){let r=t[n];r.hostVars=e+=r.hostVars,r.hostAttrs=Pu(r.hostAttrs,i=Pu(i,r.hostAttrs))}}function $c(t){return t===zr?{}:t===$n?[]:t}function iL(t,e){let i=t.viewQuery;i?t.viewQuery=(n,r)=>{e(n,r),i(n,r)}:t.viewQuery=e}function rL(t,e){let i=t.contentQueries;i?t.contentQueries=(n,r,o)=>{e(n,r,o),i(n,r,o)}:t.contentQueries=e}function oL(t,e){let i=t.hostBindings;i?t.hostBindings=(n,r)=>{e(n,r),i(n,r)}:t.hostBindings=e}function Mt(t){let e=i=>{let n=Array.isArray(t);i.hostDirectives===null?(i.findHostDirectiveDefs=Gw,i.hostDirectives=n?t.map(R0):[t]):n?i.hostDirectives.unshift(...t.map(R0)):i.hostDirectives.unshift(t)};return e.ngInherit=!0,e}function Gw(t,e,i){if(t.hostDirectives!==null)for(let n of t.hostDirectives)if(typeof n=="function"){let r=n();for(let o of r)QC(R0(o),e,i)}else QC(n,e,i)}function QC(t,e,i){let n=ug(t.directive);sL(n.declaredInputs,t.inputs),Gw(n,e,i),i.set(n,t),e.push(n)}function R0(t){return typeof t=="function"?{directive:un(t),inputs:zr,outputs:zr}:{directive:un(t.directive),inputs:XC(t.inputs),outputs:XC(t.outputs)}}function XC(t){if(t===void 0||t.length===0)return zr;let e={};for(let i=0;i{let e=class e{log(n){console.log(n)}warn(n){console.warn(n)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"platform"}));let t=e;return t})();var Xw=new k("");function Da(t){return!!t&&typeof t.then=="function"}function Jg(t){return!!t&&typeof t.subscribe=="function"}var fL=new k("");var Jw=(()=>{let e=class e{constructor(){d(this,"resolve");d(this,"reject");d(this,"initialized",!1);d(this,"done",!1);d(this,"donePromise",new Promise((n,r)=>{this.resolve=n,this.reject=r}));d(this,"appInits",h(fL,{optional:!0})??[]);d(this,"injector",h(Wn))}runInitializers(){if(this.initialized)return;let n=[];for(let o of this.appInits){let s=cg(this.injector,o);if(Da(s))n.push(s);else if(Jg(s)){let a=new Promise((u,l)=>{s.subscribe({complete:u,error:l})});n.push(a)}}let r=()=>{this.done=!0,this.resolve()};Promise.all(n).then(()=>{r()}).catch(o=>{this.reject(o)}),n.length===0&&r(),this.initialized=!0}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})(),eT=(()=>{let e=class e{};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new xd}));let t=e;return t})(),xd=class{constructor(){d(this,"queuedEffectCount",0);d(this,"queues",new Map)}schedule(e){this.enqueue(e)}enqueue(e){let i=e.zone;this.queues.has(i)||this.queues.set(i,new Set);let n=this.queues.get(i);n.has(e)||(this.queuedEffectCount++,n.add(e))}flush(){for(;this.queuedEffectCount>0;)for(let[e,i]of this.queues)e===null?this.flushQueue(i):e.run(()=>this.flushQueue(i))}flushQueue(e){for(let i of e)e.delete(i),this.queuedEffectCount--,i.run()}},lf=new k("");function pL(){B1(()=>{throw new j(600,!1)})}function hL(t){return t.isBoundToModule}var mL=10;function gL(t,e,i){try{let n=i();return Da(n)?n.catch(r=>{throw e.runOutsideAngular(()=>t.handleError(r)),r}):n}catch(n){throw e.runOutsideAngular(()=>t.handleError(n)),n}}var vr=(()=>{let e=class e{constructor(){d(this,"_runningTick",!1);d(this,"_destroyed",!1);d(this,"_destroyListeners",[]);d(this,"_views",[]);d(this,"internalErrorHandler",h(RN));d(this,"afterRenderManager",h(AE));d(this,"zonelessEnabled",h(jd));d(this,"rootEffectScheduler",h(eT));d(this,"dirtyFlags",0);d(this,"deferredDirtyFlags",0);d(this,"tracingSnapshot",null);d(this,"externalTestViews",new Set);d(this,"afterTick",new tt);d(this,"componentTypes",[]);d(this,"components",[]);d(this,"isStable",h(va).hasPendingTasks.pipe(S(n=>!n)));d(this,"_injector",h(fr));d(this,"_rendererFactory",null);d(this,"_tick",()=>{if(this.tracingSnapshot!==null){let r=this.tracingSnapshot;this.tracingSnapshot=null,r.run(Mg.CHANGE_DETECTION,this._tick),r.dispose();return}if(this._runningTick)throw new j(101,!1);let n=Ue(null);try{this._runningTick=!0,this.synchronize()}catch(r){this.internalErrorHandler(r)}finally{this._runningTick=!1,Ue(n),this.afterTick.next()}});h($d,{optional:!0})}get allViews(){return[...this.externalTestViews.keys(),...this._views]}get destroyed(){return this._destroyed}whenStable(){let n;return new Promise(r=>{n=this.isStable.subscribe({next:o=>{o&&r()}})}).finally(()=>{n.unsubscribe()})}get injector(){return this._injector}bootstrap(n,r){let o=n instanceof bd;if(!this._injector.get(Jw).done){let m=!o&&A3(n),g=!1;throw new j(405,g)}let a;o?a=n:a=this._injector.get(Vr).resolveComponentFactory(n),this.componentTypes.push(a.componentType);let u=hL(a)?void 0:this._injector.get(Wr),l=r||a.selector,c=a.create(Wn.NULL,[],l,u),f=c.location.nativeElement,p=c.injector.get(Xw,null);return p==null||p.registerApplication(f),c.onDestroy(()=>{this.detachView(c.hostView),Qc(this.components,c),p==null||p.unregisterApplication(f)}),this._loadComponent(c),c}tick(){this.zonelessEnabled||(this.dirtyFlags|=1),this._tick()}synchronize(){this._rendererFactory===null&&!this._injector.destroyed&&(this._rendererFactory=this._injector.get(ca,null,{optional:!0})),this.dirtyFlags|=this.deferredDirtyFlags,this.deferredDirtyFlags=0;let n=0;for(;this.dirtyFlags!==0&&n++Bd(n))){this.dirtyFlags|=2;return}else this.dirtyFlags&=-8}attachView(n){let r=n;this._views.push(r),r.attachToAppRef(this)}detachView(n){let r=n;Qc(this._views,r),r.detachFromAppRef()}_loadComponent(n){this.attachView(n.hostView),this.tick(),this.components.push(n),this._injector.get(lf,[]).forEach(o=>o(n))}ngOnDestroy(){if(!this._destroyed)try{this._destroyListeners.forEach(n=>n()),this._views.slice().forEach(n=>n.destroy())}finally{this._destroyed=!0,this._views=[],this._destroyListeners=[]}}onDestroy(n){return this._destroyListeners.push(n),()=>Qc(this._destroyListeners,n)}destroy(){if(this._destroyed)throw new j(406,!1);let n=this._injector;n.destroy&&!n.destroyed&&n.destroy()}get viewCount(){return this._views.length}warnIfDestroyed(){}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();function Qc(t,e){let i=t.indexOf(e);i>-1&&t.splice(i,1)}function yL(t,e,i,n){if(!i&&!Bd(t))return;Iw(t,e,i&&!n?0:1)}function Ke(t,e,i,n){let r=pe(),o=ps();if(On(r,o,e)){let s=St(),a=Zu();FF(a,r,t,e,i,n)}return Ke}function vL(t,e,i,n){return On(t,ps(),i)?e+is(i)+n:_i}function bL(t,e,i,n,r,o){let s=sN(),a=Vu(t,s,i,r);return vg(2),a?e+is(i)+n+is(r)+o:_i}function Gc(t,e){return t<<17|e<<2}function ds(t){return t>>17&32767}function _L(t){return(t&2)==2}function CL(t,e){return t&131071|e<<17}function L0(t){return t|2}function fa(t){return(t&131068)>>2}function Vm(t,e){return t&-131069|e<<2}function DL(t){return(t&1)===1}function H0(t){return t|1}function EL(t,e,i,n,r,o){let s=o?e.classBindings:e.styleBindings,a=ds(s),u=fa(s);t[n]=i;let l=!1,c;if(Array.isArray(i)){let f=i;c=f[1],(c===null||$u(f,c)>0)&&(l=!0)}else c=i;if(r)if(u!==0){let p=ds(t[a+1]);t[n+1]=Gc(p,a),p!==0&&(t[p+1]=Vm(t[p+1],n)),t[a+1]=CL(t[a+1],n)}else t[n+1]=Gc(a,0),a!==0&&(t[a+1]=Vm(t[a+1],n)),a=n;else t[n+1]=Gc(u,0),a===0?a=n:t[u+1]=Vm(t[u+1],n),u=n;l&&(t[n+1]=L0(t[n+1])),JC(t,c,n,!0),JC(t,c,n,!1),wL(e,c,t,n,o),s=Gc(a,u),o?e.classBindings=s:e.styleBindings=s}function wL(t,e,i,n,r){let o=r?t.residualClasses:t.residualStyles;o!=null&&typeof e=="string"&&$u(o,e)>=0&&(i[n+1]=H0(i[n+1]))}function JC(t,e,i,n){let r=t[i+1],o=e===null,s=n?ds(r):fa(r),a=!1;for(;s!==0&&(a===!1||o);){let u=t[s],l=t[s+1];TL(u,e)&&(a=!0,t[s+1]=n?H0(l):L0(l)),s=n?ds(l):fa(l)}a&&(t[i+1]=n?L0(r):H0(r))}function TL(t,e){return t===null||e==null||(Array.isArray(t)?t[1]:t)===e?!0:Array.isArray(t)&&typeof e=="string"?$u(t,e)>=0:!1}var Sn={textEnd:0,key:0,keyEnd:0,value:0,valueEnd:0};function xL(t){return t.substring(Sn.key,Sn.keyEnd)}function IL(t){return t.substring(Sn.value,Sn.valueEnd)}function SL(t){return ML(t),tT(t,Id(t,0,Sn.textEnd))}function tT(t,e){let i=Sn.textEnd,n=Sn.key=Id(t,e,i);return i===n?-1:(n=Sn.keyEnd=AL(t,n,i),n=eD(t,n,i,58),n=Sn.value=Id(t,n,i),n=Sn.valueEnd=kL(t,n,i),eD(t,n,i,59))}function ML(t){Sn.key=0,Sn.keyEnd=0,Sn.value=0,Sn.valueEnd=0,Sn.textEnd=t.length}function Id(t,e,i){for(;e=65&&(n&-33)<=90||n>=48&&n<=57);)e++;return e}function eD(t,e,i,n){return e=Id(t,e,i),e32&&(a=s),o=r,r=n,n=u&-33}return a}function tD(t,e,i,n){let r=-1,o=i;for(;o=0;i=tT(e,i))oT(t,xL(e),IL(e))}function nT(t,e,i,n){let r=pe(),o=St(),s=vg(2);if(o.firstUpdatePass&&rT(o,t,s,n),e!==_i&&On(r,s,e)){let a=o.data[Zr()];sT(o,a,r,r[pt],t,r[s+1]=VL(e,i),n,s)}}function NL(t,e,i,n){let r=St(),o=vg(2);r.firstUpdatePass&&rT(r,null,o,n);let s=pe();if(i!==_i&&On(s,o,i)){let a=r.data[Zr()];if(aT(a,n)&&!iT(r,o)){let u=n?a.classesWithoutHost:a.stylesWithoutHost;u!==null&&(i=Gm(u,i||"")),B0(r,a,s,i,n)}else BL(r,a,s,s[pt],s[o+1],s[o+1]=HL(t,e,i),n,o)}}function iT(t,e){return e>=t.expandoStartIndex}function rT(t,e,i,n){let r=t.data;if(r[i+1]===null){let o=r[Zr()],s=iT(t,i);aT(o,n)&&e===null&&!s&&(e=!1),e=PL(r,o,e,n),EL(r,o,e,i,s,n)}}function PL(t,e,i,n){let r=WD(t),o=n?e.residualClasses:e.residualStyles;if(r===null)(n?e.classBindings:e.styleBindings)===0&&(i=zm(null,t,e,i,n),i=zu(i,e.attrs,n),o=null);else{let s=e.directiveStylingLast;if(s===-1||t[s]!==r)if(i=zm(r,t,e,i,n),o===null){let u=FL(t,e,n);u!==void 0&&Array.isArray(u)&&(u=zm(null,t,e,u[1],n),u=zu(u,e.attrs,n),RL(t,e,n,u))}else o=LL(t,e,n)}return o!==void 0&&(n?e.residualClasses=o:e.residualStyles=o),i}function FL(t,e,i){let n=i?e.classBindings:e.styleBindings;if(fa(n)!==0)return t[ds(n)]}function RL(t,e,i,n){let r=i?e.classBindings:e.styleBindings;t[ds(r)]=n}function LL(t,e,i){let n,r=e.directiveEnd;for(let o=1+e.directiveStylingLast;o0;){let u=t[r],l=Array.isArray(u),c=l?u[1]:u,f=c===null,p=i[r+1];p===_i&&(p=f?$n:void 0);let m=f?km(p,n):c===n?p:void 0;if(l&&!Sd(m)&&(m=km(u,n)),Sd(m)&&(a=m,s))return a;let g=t[r+1];r=s?ds(g):fa(g)}if(e!==null){let u=o?e.residualClasses:e.residualStyles;u!=null&&(a=km(u,n))}return a}function Sd(t){return t!==void 0}function VL(t,e){return t==null||t===""||(typeof e=="string"?t=t+e:typeof t=="object"&&(t=Mn(ii(t)))),t}function aT(t,e){return(t.flags&(e?8:16))!==0}var V0=class{destroy(e){}updateValue(e,i){}swap(e,i){let n=Math.min(e,i),r=Math.max(e,i),o=this.detach(r);if(r-n>1){let s=this.detach(n);this.attach(n,o),this.attach(r,s)}else this.attach(n,o)}move(e,i){this.attach(i,this.detach(e))}};function jm(t,e,i,n,r){return t===i&&Object.is(e,n)?1:Object.is(r(t,e),r(i,n))?-1:0}function zL(t,e,i){let n,r,o=0,s=t.length-1,a=void 0;if(Array.isArray(e)){let u=e.length-1;for(;o<=s&&o<=u;){let l=t.at(o),c=e[o],f=jm(o,l,o,c,i);if(f!==0){f<0&&t.updateValue(o,c),o++;continue}let p=t.at(s),m=e[u],g=jm(s,p,u,m,i);if(g!==0){g<0&&t.updateValue(s,m),s--,u--;continue}let y=i(o,l),b=i(s,p),D=i(o,c);if(Object.is(D,b)){let I=i(u,m);Object.is(I,y)?(t.swap(o,s),t.updateValue(s,m),u--,s--):t.move(s,o),t.updateValue(o,c),o++;continue}if(n??(n=new Md),r??(r=rD(t,o,s,i)),z0(t,n,o,D))t.updateValue(o,c),o++,s++;else if(r.has(D))n.set(y,t.detach(o)),s--;else{let I=t.create(o,e[o]);t.attach(o,I),o++,s++}}for(;o<=u;)iD(t,n,i,o,e[o]),o++}else if(e!=null){let u=e[Symbol.iterator](),l=u.next();for(;!l.done&&o<=s;){let c=t.at(o),f=l.value,p=jm(o,c,o,f,i);if(p!==0)p<0&&t.updateValue(o,f),o++,l=u.next();else{n??(n=new Md),r??(r=rD(t,o,s,i));let m=i(o,f);if(z0(t,n,o,m))t.updateValue(o,f),o++,s++,l=u.next();else if(!r.has(m))t.attach(o,t.create(o,f)),o++,s++,l=u.next();else{let g=i(o,c);n.set(g,t.detach(o)),s--}}}for(;!l.done;)iD(t,n,i,t.length,l.value),l=u.next()}for(;o<=s;)t.destroy(t.detach(s--));n==null||n.forEach(u=>{t.destroy(u)})}function z0(t,e,i,n){return e!==void 0&&e.has(n)?(t.attach(i,e.get(n)),e.delete(n),!0):!1}function iD(t,e,i,n,r){if(z0(t,e,n,i(n,r)))t.updateValue(n,r);else{let o=t.create(n,r);t.attach(n,o)}}function rD(t,e,i,n){let r=new Set;for(let o=e;o<=i;o++)r.add(n(o,t.at(o)));return r}var Md=class{constructor(){d(this,"kvMap",new Map);d(this,"_vMap")}has(e){return this.kvMap.has(e)}delete(e){if(!this.has(e))return!1;let i=this.kvMap.get(e);return this._vMap!==void 0&&this._vMap.has(i)?(this.kvMap.set(e,this._vMap.get(i)),this._vMap.delete(i)):this.kvMap.delete(e),!0}get(e){return this.kvMap.get(e)}set(e,i){if(this.kvMap.has(e)){let n=this.kvMap.get(e);this._vMap===void 0&&(this._vMap=new Map);let r=this._vMap;for(;r.has(n);)n=r.get(n);r.set(n,i)}else this.kvMap.set(e,i)}forEach(e){for(let[i,n]of this.kvMap)if(e(n,i),this._vMap!==void 0){let r=this._vMap;for(;r.has(n);)n=r.get(n),e(n,i)}}};var j0=class{constructor(e,i,n){d(this,"lContainer");d(this,"$implicit");d(this,"$index");this.lContainer=e,this.$implicit=i,this.$index=n}get $count(){return this.lContainer.length-ln}};function Qee(t){return t}var U0=class{constructor(e,i,n){d(this,"hasEmptyBlock");d(this,"trackByFn");d(this,"liveCollection");this.hasEmptyBlock=e,this.trackByFn=i,this.liveCollection=n}};function Xee(t,e,i,n,r,o,s,a,u,l,c,f,p){bi("NgControlFlow");let m=pe(),g=St(),y=u!==void 0,b=pe(),D=a?s.bind(b[kn][An]):s,I=new U0(y,D);b[Et+t]=I,Td(m,g,t+1,e,i,n,r,_o(g.consts,o)),y&&Td(m,g,t+2,u,l,c,f,_o(g.consts,p))}var $0=class extends V0{constructor(i,n,r){super();d(this,"lContainer");d(this,"hostLView");d(this,"templateTNode");d(this,"operationsCounter");d(this,"needsIndexUpdate",!1);this.lContainer=i,this.hostLView=n,this.templateTNode=r}get length(){return this.lContainer.length-ln}at(i){return this.getLView(i)[An].$implicit}attach(i,n){let r=n[yi];this.needsIndexUpdate||(this.needsIndexUpdate=i!==this.length),rf(this.lContainer,n,i,Hu(this.templateTNode,r))}detach(i){return this.needsIndexUpdate||(this.needsIndexUpdate=i!==this.length-1),jL(this.lContainer,i)}create(i,n){var s;let r=Bu(this.lContainer,this.templateTNode.tView.ssrId),o=nf(this.hostLView,this.templateTNode,new j0(this.lContainer,n,i),{dehydratedView:r});return(s=this.operationsCounter)==null||s.recordCreate(),o}destroy(i){var n;Yd(i[ve],i),(n=this.operationsCounter)==null||n.recordDestroy()}updateValue(i,n){this.getLView(i)[An].$implicit=n}reset(){var i;this.needsIndexUpdate=!1,(i=this.operationsCounter)==null||i.reset()}updateIndexes(){if(this.needsIndexUpdate)for(let i=0;i(xo(!0),Rg(n,r,JD()));function GL(t,e,i,n,r,o){let s=e[yi],a=!s||ya()||Xu(i)||Yu(s,o);if(xo(a),a)return Rg(n,r,JD());let u=sf(s,t,e,i);return NE(s,o)&&Gd(s,o,u.nextSibling),s&&(gE(i)||yE(u))&&Wu(i)&&(nN(i),nw(u)),u}function WL(){uT=GL}function qL(t,e,i,n,r){let o=e.consts,s=_o(o,n),a=Ca(e,t,8,"ng-container",s);s!==null&&_d(a,s,!0);let u=_o(o,r);return Gg(e,i,a,u),e.queries!==null&&e.queries.elementStart(e,a),a}function _t(t,e,i){let n=pe(),r=St(),o=t+Et,s=r.firstCreatePass?qL(o,r,n,e,i):r.data[o];fs(s,!0);let a=lT(r,n,s,t);return n[o]=a,Vd()&&Qd(r,n,a,s),Do(a,n),Hd(s)&&(jg(r,n,s),zg(r,s,n)),i!=null&&Ug(n,s),_t}function Ct(){let t=dn(),e=St();return gg()?yg():(t=t.parent,fs(t,!1)),e.firstCreatePass&&(zd(e,t),fg(t)&&e.queries.elementEnd(t)),Ct}function Qt(t,e,i){return _t(t,e,i),Ct(),Qt}var lT=(t,e,i,n)=>(xo(!0),ZE(e[pt],""));function ZL(t,e,i,n){let r,o=e[yi],s=!o||ya()||Yu(o,n)||Xu(i);if(xo(s),s)return ZE(e[pt],"");let a=sf(o,t,e,i),u=hP(o,n);return Gd(o,n,a),r=af(u,a),r}function KL(){lT=ZL}function q(){return pe()}function ms(t,e,i){let n=pe(),r=ps();if(On(n,r,e)){let o=St(),s=Zu();ef(o,s,n,t,e,n[pt],i,!0)}return ms}function Ea(t,e,i){let n=pe(),r=ps();if(On(n,r,e)){let o=St(),s=Zu(),a=WD(o.data),u=BF(a,s,n);ef(o,s,n,t,e,u,i,!0)}return Ea}var Ad="en-US";var YL=Ad;function QL(t){typeof t=="string"&&(YL=t.toLowerCase().replace(/_/g,"-"))}var XL=(t,e,i)=>{};function x(t,e,i,n){let r=pe(),o=St(),s=dn();return cT(o,r,r[pt],s,t,e,n),x}function JL(t,e,i,n){let r=t.cleanup;if(r!=null)for(let o=0;ou?a[u]:null}typeof s=="string"&&(o+=2)}return null}function cT(t,e,i,n,r,o,s){let a=Hd(n),l=t.firstCreatePass&&Cw(t),c=e[An],f=_w(e),p=!0;if(n.type&3||s){let y=ni(n,e),b=s?s(y):y,D=f.length,I=s?A=>s(ji(A[n.index])):n.index,N=null;if(!s&&a&&(N=JL(t,e,r,n.index)),N!==null){let A=N.__ngLastListenerFn__||N;A.__ngNextListenerFn__=o,N.__ngLastListenerFn__=o,p=!1}else{o=uD(n,e,c,o),XL(y,r,o);let A=i.listen(b,r,o);f.push(o,A),l&&l.push(r,I,D,D+1)}}else o=uD(n,e,c,o);let m=n.outputs,g;if(p&&m!==null&&(g=m[r])){let y=g.length;if(y)for(let b=0;b-1?wo(t.index,e):e;Zg(s,5);let a=aD(e,i,n,o),u=r.__ngNextListenerFn__;for(;u;)a=aD(e,i,u,o)&&a,u=u.__ngNextListenerFn__;return a}}function _(t=1){return fN(t)}function e6(t,e){let i=null,n=sF(t);for(let r=0;r=t.data.length&&(t.data[i]=null,t.blueprint[i]=null),e[i]=n}function be(t){let e=oN();return ga(e,Et+t)}function he(t,e=""){let i=pe(),n=St(),r=t+Et,o=n.firstCreatePass?Ca(n,r,1,e,null):n.data[r],s=dT(n,i,o,e,t);i[r]=s,Vd()&&Qd(n,i,s,o),fs(o,!1)}var dT=(t,e,i,n,r)=>(xo(!0),qE(e[pt],n));function i6(t,e,i,n,r){let o=e[yi],s=!o||ya()||Xu(i)||Yu(o,r);return xo(s),s?qE(e[pt],n):sf(o,t,e,i)}function r6(){dT=i6}function ty(t){return Nt("",t,""),ty}function Nt(t,e,i){let n=pe(),r=vL(n,t,e,i);return r!==_i&&Ew(n,Zr(),r),Nt}function ny(t,e,i,n,r){let o=pe(),s=bL(o,t,e,i,n,r);return s!==_i&&Ew(o,Zr(),s),ny}function cf(t,e,i){zw(e)&&(e=e());let n=pe(),r=ps();if(On(n,r,e)){let o=St(),s=Zu();ef(o,s,n,t,e,n[pt],i,!1)}return cf}function iy(t,e){let i=zw(t);return i&&t.set(e),i}function df(t,e){let i=pe(),n=St(),r=dn();return cT(n,i,i[pt],r,t,e),df}function o6(t,e,i){let n=St();if(n.firstCreatePass){let r=$r(t);G0(i,n.data,n.blueprint,r,!0),G0(e,n.data,n.blueprint,r,!1)}}function G0(t,e,i,n,r){if(t=un(t),Array.isArray(t))for(let o=0;o>20;if(aa(t)||!t.multi){let m=new us(l,r,Ge),g=$m(u,e,r?c:c+p,f);g===-1?(o0(cd(a,s),o,u),Um(o,t,e.length),e.push(u),a.directiveStart++,a.directiveEnd++,r&&(a.providerIndexes+=1048576),i.push(m),s.push(m)):(i[g]=m,s[g]=m)}else{let m=$m(u,e,c+p,f),g=$m(u,e,c,c+p),y=m>=0&&i[m],b=g>=0&&i[g];if(r&&!b||!r&&!y){o0(cd(a,s),o,u);let D=u6(r?a6:s6,i.length,r,n,l);!r&&b&&(i[g].providerFactory=D),Um(o,t,e.length,0),e.push(u),a.directiveStart++,a.directiveEnd++,r&&(a.providerIndexes+=1048576),i.push(D),s.push(D)}else{let D=fT(i[r?g:m],l,!r&&n);Um(o,t,m>-1?m:g,D)}!r&&n&&b&&i[g].componentProviders++}}}function Um(t,e,i,n){let r=aa(e),o=F3(e);if(r||o){let u=(o?un(e.useClass):e).prototype.ngOnDestroy;if(u){let l=t.destroyHooks||(t.destroyHooks=[]);if(!r&&e.multi){let c=l.indexOf(i);c===-1?l.push(i,[n,u]):l[c+1].push(n,u)}else l.push(i,u)}}}function fT(t,e,i){return i&&t.componentProviders++,t.multi.push(e)-1}function $m(t,e,i,n){for(let r=i;r{i.providersResolver=(n,r)=>o6(n,r?r(t):t,e)}}function Qr(t,e,i){let n=To()+t,r=pe();return r[n]===_i?hs(r,n,i?e.call(i):e()):qw(r,n)}function Kn(t,e,i,n){return pT(pe(),To(),t,e,i,n)}function ete(t,e,i,n,r,o,s,a){let u=To()+t,l=pe(),c=Zw(l,u,i,n,r,o);return On(l,u+4,s)||c?hs(l,u+5,a?e.call(a,i,n,r,o,s):e(i,n,r,o,s)):qw(l,u+5)}function Ju(t,e){let i=t[e];return i===_i?void 0:i}function pT(t,e,i,n,r,o){let s=e+i;return On(t,s,r)?hs(t,s+1,o?n.call(o,r):n(r)):Ju(t,s+1)}function l6(t,e,i,n,r,o,s){let a=e+i;return Vu(t,a,r,o)?hs(t,a+2,s?n.call(s,r,o):n(r,o)):Ju(t,a+2)}function c6(t,e,i,n,r,o,s,a){let u=e+i;return uL(t,u,r,o,s)?hs(t,u+3,a?n.call(a,r,o,s):n(r,o,s)):Ju(t,u+3)}function d6(t,e,i,n,r,o,s,a,u){let l=e+i;return Zw(t,l,r,o,s,a)?hs(t,l+4,u?n.call(u,r,o,s,a):n(r,o,s,a)):Ju(t,l+4)}function f6(t,e,i,n,r,o){let s=e+i,a=!1;for(let u=0;u=0;i--){let n=e[i];if(t===n.name)return n}}function J(t,e,i){let n=t+Et,r=pe(),o=ga(r,n);return el(r,n)?pT(r,To(),e,o.transform,i,o):o.transform(i)}function hT(t,e,i,n){let r=t+Et,o=pe(),s=ga(o,r);return el(o,r)?l6(o,To(),e,s.transform,i,n,s):s.transform(i,n)}function mT(t,e,i,n,r){let o=t+Et,s=pe(),a=ga(s,o);return el(s,o)?c6(s,To(),e,a.transform,i,n,r,a):a.transform(i,n,r)}function tte(t,e,i,n,r,o){let s=t+Et,a=pe(),u=ga(a,s);return el(a,s)?d6(a,To(),e,u.transform,i,n,r,o,u):u.transform(i,n,r,o)}function nte(t,e,i){let n=t+Et,r=pe(),o=ga(r,n);return el(r,n)?f6(r,To(),e,o.transform,i,o):o.transform.apply(o,i)}function el(t,e){return t[ve].data[e].pure}function We(t,e){return of(t,e)}var pa=class{constructor(e){d(this,"full");d(this,"major");d(this,"minor");d(this,"patch");this.full=e;let i=e.split(".");this.major=i[0],this.minor=i[1],this.patch=i.slice(2).join(".")}},gT=new pa("19.0.4"),q0=class{constructor(e,i){d(this,"ngModuleFactory");d(this,"componentFactories");this.ngModuleFactory=e,this.componentFactories=i}},ite=(()=>{let e=class e{compileModuleSync(n){return new F0(n)}compileModuleAsync(n){return Promise.resolve(this.compileModuleSync(n))}compileModuleAndAllComponentsSync(n){let r=this.compileModuleSync(n),o=ID(n),s=WE(o.declarations).reduce((a,u)=>{let l=bo(u);return l&&a.push(new da(l)),a},[]);return new q0(r,s)}compileModuleAndAllComponentsAsync(n){return Promise.resolve(this.compileModuleAndAllComponentsSync(n))}clearCache(){}clearCacheFor(n){}getModuleId(n){}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var h6=(()=>{let e=class e{constructor(){d(this,"zone",h(me));d(this,"changeDetectionScheduler",h(Co));d(this,"applicationRef",h(vr));d(this,"_onMicrotaskEmptySubscription")}initialize(){this._onMicrotaskEmptySubscription||(this._onMicrotaskEmptySubscription=this.zone.onMicrotaskEmpty.subscribe({next:()=>{this.changeDetectionScheduler.runningTick||this.zone.run(()=>{this.applicationRef.tick()})}}))}ngOnDestroy(){var n;(n=this._onMicrotaskEmptySubscription)==null||n.unsubscribe()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();function m6({ngZoneFactory:t,ignoreChangesOutsideZone:e,scheduleInRootZone:i}){return t??(t=()=>new me(U(M({},g6()),{scheduleInRootZone:i}))),[{provide:me,useFactory:t},{provide:sa,multi:!0,useFactory:()=>{let n=h(h6,{optional:!0});return()=>n.initialize()}},{provide:sa,multi:!0,useFactory:()=>{let n=h(y6);return()=>{n.initialize()}}},e===!0?{provide:pE,useValue:!0}:[],{provide:Eg,useValue:i??fE}]}function g6(t){return{enableLongStackTrace:!1,shouldCoalesceEventChangeDetection:(t==null?void 0:t.eventCoalescing)??!1,shouldCoalesceRunChangeDetection:(t==null?void 0:t.runCoalescing)??!1}}var y6=(()=>{let e=class e{constructor(){d(this,"subscription",new Ut);d(this,"initialized",!1);d(this,"zone",h(me));d(this,"pendingTasks",h(va))}initialize(){if(this.initialized)return;this.initialized=!0;let n=null;!this.zone.isStable&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(n=this.pendingTasks.add()),this.zone.runOutsideAngular(()=>{this.subscription.add(this.zone.onStable.subscribe(()=>{me.assertNotInAngularZone(),queueMicrotask(()=>{n!==null&&!this.zone.hasPendingMacrotasks&&!this.zone.hasPendingMicrotasks&&(this.pendingTasks.remove(n),n=null)})}))}),this.subscription.add(this.zone.onUnstable.subscribe(()=>{me.assertInAngularZone(),n??(n=this.pendingTasks.add())}))}ngOnDestroy(){this.subscription.unsubscribe()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var yT=(()=>{var e;let i=class i{constructor(){d(this,"appRef",h(vr));d(this,"taskService",h(va));d(this,"ngZone",h(me));d(this,"zonelessEnabled",h(jd));d(this,"tracing",h($d,{optional:!0}));d(this,"disableScheduling",h(pE,{optional:!0})??!1);d(this,"zoneIsDefined",typeof Zone<"u"&&!!Zone.root.run);d(this,"schedulerTickApplyArgs",[{data:{__scheduler_tick__:!0}}]);d(this,"subscriptions",new Ut);d(this,"angularZoneId",this.zoneIsDefined?(e=this.ngZone._inner)==null?void 0:e.get(fd):null);d(this,"scheduleInRootZone",!this.zonelessEnabled&&this.zoneIsDefined&&(h(Eg,{optional:!0})??!1));d(this,"cancelScheduledCallback",null);d(this,"useMicrotaskScheduler",!1);d(this,"runningTick",!1);d(this,"pendingRenderTaskId",null);this.subscriptions.add(this.appRef.afterTick.subscribe(()=>{this.runningTick||this.cleanup()})),this.subscriptions.add(this.ngZone.onUnstable.subscribe(()=>{this.runningTick||this.cleanup()})),this.disableScheduling||(this.disableScheduling=!this.zonelessEnabled&&(this.ngZone instanceof pd||!this.zoneIsDefined))}notify(r){var a;if(!this.zonelessEnabled&&r===5)return;let o=!1;switch(r){case 0:{this.appRef.dirtyFlags|=2;break}case 3:case 2:case 4:case 5:case 1:{this.appRef.dirtyFlags|=4;break}case 8:{this.appRef.deferredDirtyFlags|=8;break}case 6:{this.appRef.dirtyFlags|=2,o=!0;break}case 13:{this.appRef.dirtyFlags|=16,o=!0;break}case 14:{this.appRef.dirtyFlags|=2,o=!0;break}case 12:{o=!0;break}case 10:case 9:case 7:case 11:default:this.appRef.dirtyFlags|=8}if(this.appRef.tracingSnapshot=((a=this.tracing)==null?void 0:a.snapshot(this.appRef.tracingSnapshot))??null,!this.shouldScheduleTick(o))return;let s=this.useMicrotaskScheduler?AC:hE;this.pendingRenderTaskId=this.taskService.add(),this.scheduleInRootZone?this.cancelScheduledCallback=Zone.root.run(()=>s(()=>this.tick())):this.cancelScheduledCallback=this.ngZone.runOutsideAngular(()=>s(()=>this.tick()))}shouldScheduleTick(r){return!(this.disableScheduling&&!r||this.appRef.destroyed||this.pendingRenderTaskId!==null||this.runningTick||this.appRef._runningTick||!this.zonelessEnabled&&this.zoneIsDefined&&Zone.current.get(fd+this.angularZoneId))}tick(){if(this.runningTick||this.appRef.destroyed)return;if(this.appRef.dirtyFlags===0){this.cleanup();return}!this.zonelessEnabled&&this.appRef.dirtyFlags&7&&(this.appRef.dirtyFlags|=1);let r=this.taskService.add();try{this.ngZone.run(()=>{this.runningTick=!0,this.appRef._tick()},void 0,this.schedulerTickApplyArgs)}catch(o){throw this.taskService.remove(r),o}finally{this.cleanup()}this.useMicrotaskScheduler=!0,AC(()=>{this.useMicrotaskScheduler=!1,this.taskService.remove(r)})}ngOnDestroy(){this.subscriptions.unsubscribe(),this.cleanup()}cleanup(){var r;if(this.runningTick=!1,(r=this.cancelScheduledCallback)==null||r.call(this),this.cancelScheduledCallback=null,this.pendingRenderTaskId!==null){let o=this.pendingRenderTaskId;this.pendingRenderTaskId=null,this.taskService.remove(o)}}};d(i,"\u0275fac",function(o){return new(o||i)}),d(i,"\u0275prov",$({token:i,factory:i.\u0275fac,providedIn:"root"}));let t=i;return t})();function rte(){return bi("NgZoneless"),Gu([{provide:Co,useExisting:yT},{provide:me,useClass:pd},{provide:jd,useValue:!0},{provide:Eg,useValue:!1},[]])}function v6(){return typeof $localize<"u"&&$localize.locale||Ad}var tl=new k("",{providedIn:"root",factory:()=>h(tl,Be.Optional|Be.SkipSelf)||v6()});var Z0=new k("");function Wc(t){return!t.moduleRef}function b6(t){let e=Wc(t)?t.r3Injector:t.moduleRef.injector,i=e.get(me);return i.run(()=>{Wc(t)?t.r3Injector.resolveInjectorInitializers():t.moduleRef.resolveInjectorInitializers();let n=e.get(pr,null),r;if(i.runOutsideAngular(()=>{r=i.onError.subscribe({next:o=>{n.handleError(o)}})}),Wc(t)){let o=()=>e.destroy(),s=t.platformInjector.get(Z0);s.add(o),e.onDestroy(()=>{r.unsubscribe(),s.delete(o)})}else{let o=()=>t.moduleRef.destroy(),s=t.platformInjector.get(Z0);s.add(o),t.moduleRef.onDestroy(()=>{Qc(t.allPlatformModules,t.moduleRef),r.unsubscribe(),s.delete(o)})}return gL(n,i,()=>{let o=e.get(Jw);return o.runInitializers(),o.donePromise.then(()=>{let s=e.get(tl,Ad);if(QL(s||Ad),Wc(t)){let a=e.get(vr);return t.rootComponent!==void 0&&a.bootstrap(t.rootComponent),a}else return _6(t.moduleRef,t.allPlatformModules),t.moduleRef})})})}function _6(t,e){let i=t.injector.get(vr);if(t._bootstrapComponents.length>0)t._bootstrapComponents.forEach(n=>i.bootstrap(n));else if(t.instance.ngDoBootstrap)t.instance.ngDoBootstrap(i);else throw new j(-403,!1);e.push(t)}var Xc=null;function C6(t=[],e){return Wn.create({name:e,providers:[{provide:Fd,useValue:"platform"},{provide:Z0,useValue:new Set([()=>Xc=null])},...t]})}function D6(t=[]){if(Xc)return Xc;let e=C6(t);return Xc=e,pL(),E6(e),e}function E6(t){let e=t.get(xg,null);cg(t,()=>{e==null||e.forEach(i=>i())})}var st=(()=>{class t{}return d(t,"__NG_ELEMENT_ID__",w6),t})();function w6(t){return T6(dn(),pe(),(t&16)===16)}function T6(t,e,i){if(Wu(t)&&!i){let n=wo(t.index,e);return new cs(n,n)}else if(t.type&175){let n=e[kn];return new cs(n,e)}return null}var K0=class{constructor(){}supports(e){return Ww(e)}create(e){return new Y0(e)}},x6=(t,e)=>e,Y0=class{constructor(e){d(this,"length",0);d(this,"collection");d(this,"_linkedRecords",null);d(this,"_unlinkedRecords",null);d(this,"_previousItHead",null);d(this,"_itHead",null);d(this,"_itTail",null);d(this,"_additionsHead",null);d(this,"_additionsTail",null);d(this,"_movesHead",null);d(this,"_movesTail",null);d(this,"_removalsHead",null);d(this,"_removalsTail",null);d(this,"_identityChangesHead",null);d(this,"_identityChangesTail",null);d(this,"_trackByFn");this._trackByFn=e||x6}forEachItem(e){let i;for(i=this._itHead;i!==null;i=i._next)e(i)}forEachOperation(e){let i=this._itHead,n=this._removalsHead,r=0,o=null;for(;i||n;){let s=!n||i&&i.currentIndex{s=this._trackByFn(r,a),i===null||!Object.is(i.trackById,s)?(i=this._mismatch(i,a,s,r),n=!0):(n&&(i=this._verifyReinsertion(i,a,s,r)),Object.is(i.item,a)||this._addIdentityChange(i,a)),i=i._next,r++}),this.length=r;return this._truncate(i),this.collection=e,this.isDirty}get isDirty(){return this._additionsHead!==null||this._movesHead!==null||this._removalsHead!==null||this._identityChangesHead!==null}_reset(){if(this.isDirty){let e;for(e=this._previousItHead=this._itHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._additionsHead;e!==null;e=e._nextAdded)e.previousIndex=e.currentIndex;for(this._additionsHead=this._additionsTail=null,e=this._movesHead;e!==null;e=e._nextMoved)e.previousIndex=e.currentIndex;this._movesHead=this._movesTail=null,this._removalsHead=this._removalsTail=null,this._identityChangesHead=this._identityChangesTail=null}}_mismatch(e,i,n,r){let o;return e===null?o=this._itTail:(o=e._prev,this._remove(e)),e=this._unlinkedRecords===null?null:this._unlinkedRecords.get(n,null),e!==null?(Object.is(e.item,i)||this._addIdentityChange(e,i),this._reinsertAfter(e,o,r)):(e=this._linkedRecords===null?null:this._linkedRecords.get(n,r),e!==null?(Object.is(e.item,i)||this._addIdentityChange(e,i),this._moveAfter(e,o,r)):e=this._addAfter(new Q0(i,n),o,r)),e}_verifyReinsertion(e,i,n,r){let o=this._unlinkedRecords===null?null:this._unlinkedRecords.get(n,null);return o!==null?e=this._reinsertAfter(o,e._prev,r):e.currentIndex!=r&&(e.currentIndex=r,this._addToMoves(e,r)),e}_truncate(e){for(;e!==null;){let i=e._next;this._addToRemovals(this._unlink(e)),e=i}this._unlinkedRecords!==null&&this._unlinkedRecords.clear(),this._additionsTail!==null&&(this._additionsTail._nextAdded=null),this._movesTail!==null&&(this._movesTail._nextMoved=null),this._itTail!==null&&(this._itTail._next=null),this._removalsTail!==null&&(this._removalsTail._nextRemoved=null),this._identityChangesTail!==null&&(this._identityChangesTail._nextIdentityChange=null)}_reinsertAfter(e,i,n){this._unlinkedRecords!==null&&this._unlinkedRecords.remove(e);let r=e._prevRemoved,o=e._nextRemoved;return r===null?this._removalsHead=o:r._nextRemoved=o,o===null?this._removalsTail=r:o._prevRemoved=r,this._insertAfter(e,i,n),this._addToMoves(e,n),e}_moveAfter(e,i,n){return this._unlink(e),this._insertAfter(e,i,n),this._addToMoves(e,n),e}_addAfter(e,i,n){return this._insertAfter(e,i,n),this._additionsTail===null?this._additionsTail=this._additionsHead=e:this._additionsTail=this._additionsTail._nextAdded=e,e}_insertAfter(e,i,n){let r=i===null?this._itHead:i._next;return e._next=r,e._prev=i,r===null?this._itTail=e:r._prev=e,i===null?this._itHead=e:i._next=e,this._linkedRecords===null&&(this._linkedRecords=new kd),this._linkedRecords.put(e),e.currentIndex=n,e}_remove(e){return this._addToRemovals(this._unlink(e))}_unlink(e){this._linkedRecords!==null&&this._linkedRecords.remove(e);let i=e._prev,n=e._next;return i===null?this._itHead=n:i._next=n,n===null?this._itTail=i:n._prev=i,e}_addToMoves(e,i){return e.previousIndex===i||(this._movesTail===null?this._movesTail=this._movesHead=e:this._movesTail=this._movesTail._nextMoved=e),e}_addToRemovals(e){return this._unlinkedRecords===null&&(this._unlinkedRecords=new kd),this._unlinkedRecords.put(e),e.currentIndex=null,e._nextRemoved=null,this._removalsTail===null?(this._removalsTail=this._removalsHead=e,e._prevRemoved=null):(e._prevRemoved=this._removalsTail,this._removalsTail=this._removalsTail._nextRemoved=e),e}_addIdentityChange(e,i){return e.item=i,this._identityChangesTail===null?this._identityChangesTail=this._identityChangesHead=e:this._identityChangesTail=this._identityChangesTail._nextIdentityChange=e,e}},Q0=class{constructor(e,i){d(this,"item");d(this,"trackById");d(this,"currentIndex",null);d(this,"previousIndex",null);d(this,"_nextPrevious",null);d(this,"_prev",null);d(this,"_next",null);d(this,"_prevDup",null);d(this,"_nextDup",null);d(this,"_prevRemoved",null);d(this,"_nextRemoved",null);d(this,"_nextAdded",null);d(this,"_nextMoved",null);d(this,"_nextIdentityChange",null);this.item=e,this.trackById=i}},X0=class{constructor(){d(this,"_head",null);d(this,"_tail",null)}add(e){this._head===null?(this._head=this._tail=e,e._nextDup=null,e._prevDup=null):(this._tail._nextDup=e,e._prevDup=this._tail,e._nextDup=null,this._tail=e)}get(e,i){let n;for(n=this._head;n!==null;n=n._nextDup)if((i===null||i<=n.currentIndex)&&Object.is(n.trackById,e))return n;return null}remove(e){let i=e._prevDup,n=e._nextDup;return i===null?this._head=n:i._nextDup=n,n===null?this._tail=i:n._prevDup=i,this._head===null}},kd=class{constructor(){d(this,"map",new Map)}put(e){let i=e.trackById,n=this.map.get(i);n||(n=new X0,this.map.set(i,n)),n.add(e)}get(e,i){let n=e,r=this.map.get(n);return r?r.get(e,i):null}remove(e){let i=e.trackById;return this.map.get(i).remove(e)&&this.map.delete(i),e}get isEmpty(){return this.map.size===0}clear(){this.map.clear()}};function lD(t,e,i){let n=t.previousIndex;if(n===null)return n;let r=0;return i&&n{if(i&&i.key===r)this._maybeAddToChanges(i,n),this._appendAfter=i,i=i._next;else{let o=this._getOrCreateRecordForKey(r,n);i=this._insertBeforeOrAppend(i,o)}}),i){i._prev&&(i._prev._next=null),this._removalsHead=i;for(let n=i;n!==null;n=n._nextRemoved)n===this._mapHead&&(this._mapHead=null),this._records.delete(n.key),n._nextRemoved=n._next,n.previousValue=n.currentValue,n.currentValue=null,n._prev=null,n._next=null}return this._changesTail&&(this._changesTail._nextChanged=null),this._additionsTail&&(this._additionsTail._nextAdded=null),this.isDirty}_insertBeforeOrAppend(e,i){if(e){let n=e._prev;return i._next=e,i._prev=n,e._prev=i,n&&(n._next=i),e===this._mapHead&&(this._mapHead=i),this._appendAfter=e,e}return this._appendAfter?(this._appendAfter._next=i,i._prev=this._appendAfter):this._mapHead=i,this._appendAfter=i,null}_getOrCreateRecordForKey(e,i){if(this._records.has(e)){let r=this._records.get(e);this._maybeAddToChanges(r,i);let o=r._prev,s=r._next;return o&&(o._next=s),s&&(s._prev=o),r._next=null,r._prev=null,r}let n=new tg(e);return this._records.set(e,n),n.currentValue=i,this._addToAdditions(n),n}_reset(){if(this.isDirty){let e;for(this._previousMapHead=this._mapHead,e=this._previousMapHead;e!==null;e=e._next)e._nextPrevious=e._next;for(e=this._changesHead;e!==null;e=e._nextChanged)e.previousValue=e.currentValue;for(e=this._additionsHead;e!=null;e=e._nextAdded)e.previousValue=e.currentValue;this._changesHead=this._changesTail=null,this._additionsHead=this._additionsTail=null,this._removalsHead=null}}_maybeAddToChanges(e,i){Object.is(i,e.currentValue)||(e.previousValue=e.currentValue,e.currentValue=i,this._addToChanges(e))}_addToAdditions(e){this._additionsHead===null?this._additionsHead=this._additionsTail=e:(this._additionsTail._nextAdded=e,this._additionsTail=e)}_addToChanges(e){this._changesHead===null?this._changesHead=this._changesTail=e:(this._changesTail._nextChanged=e,this._changesTail=e)}_forEach(e,i){e instanceof Map?e.forEach(i):Object.keys(e).forEach(n=>i(e[n],n))}},tg=class{constructor(e){d(this,"key");d(this,"previousValue",null);d(this,"currentValue",null);d(this,"_nextPrevious",null);d(this,"_next",null);d(this,"_prev",null);d(this,"_nextAdded",null);d(this,"_nextRemoved",null);d(this,"_nextChanged",null);this.key=e}};function cD(){return new ry([new K0])}var ry=(()=>{let e=class e{constructor(n){d(this,"factories");this.factories=n}static create(n,r){if(r!=null){let o=r.factories.slice();n=n.concat(o)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||cD()),deps:[[e,new qr,new qn]]}}find(n){let r=this.factories.find(o=>o.supports(n));if(r!=null)return r;throw new j(901,!1)}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:cD}));let t=e;return t})();function dD(){return new ff([new J0])}var ff=(()=>{let e=class e{constructor(n){d(this,"factories");this.factories=n}static create(n,r){if(r){let o=r.factories.slice();n=n.concat(o)}return new e(n)}static extend(n){return{provide:e,useFactory:r=>e.create(n,r||dD()),deps:[[e,new qr,new qn]]}}find(n){let r=this.factories.find(o=>o.supports(n));if(r)return r;throw new j(901,!1)}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:dD}));let t=e;return t})();function vT(t){try{let{rootComponent:e,appProviders:i,platformProviders:n}=t,r=D6(n),o=[m6({}),{provide:Co,useExisting:yT},...i||[]],s=new wd({providers:o,parent:r,debugName:"",runEnvironmentInitializers:!1});return b6({r3Injector:s.injector,platformInjector:r,rootComponent:e})}catch(e){return Promise.reject(e)}}var fD=!1;function I6(){fD||(fD=!0,cP(),WL(),r6(),KL(),dL(),LR(),_R(),bF())}function S6(t,e){return t.whenStable()}function bT(){let t=[{provide:Vc,useFactory:()=>{let e=!0;{let i=h(_a,{optional:!0});e=!!(i!=null&&i.get(kE,null))}return e&&bi("NgHydration"),e}},{provide:sa,useValue:()=>{pR(!1),h(Vc)&&(M6(),I6())},multi:!0}];return t.push({provide:ME,useFactory:()=>h(Vc)},{provide:lf,useFactory:()=>{if(h(Vc)){let e=h(vr),i=h(Wn);return()=>{S6(e,i).then(()=>{yR(e)})}}return()=>{}},multi:!0}),Gu(t)}function M6(){var i;let t=Ku(),e;for(let n of t.body.childNodes)if(n.nodeType===Node.COMMENT_NODE&&((i=n.textContent)==null?void 0:i.trim())===uP){e=n;break}if(!e)throw new j(-507,!1)}function pf(t){return typeof t=="boolean"?t:t!=null&&t!=="false"}function Pt(t,e){bi("NgSignals");let i=R1(t);return e!=null&&e.equal&&(i[zn].equal=e.equal),i}function Gi(t){let e=Ue(null);try{return t()}finally{Ue(e)}}var _T=(()=>{class t{constructor(i,n){d(this,"view");d(this,"node");this.view=i,this.node=n}}return d(t,"__NG_ELEMENT_ID__",A6),t})();function A6(){return new _T(pe(),dn())}var k6=!1,O6=(()=>{let e=class e extends xd{constructor(){super(...arguments);d(this,"pendingTasks",h(va));d(this,"taskId",null)}schedule(r){super.schedule(r),this.taskId===null&&(this.taskId=this.pendingTasks.add(),queueMicrotask(()=>this.flush()))}flush(){try{super.flush()}finally{this.taskId!==null&&(this.pendingTasks.remove(this.taskId),this.taskId=null)}}};d(e,"\u0275prov",$({token:e,providedIn:"root",factory:()=>new e}));let t=e;return t})(),ng=class{constructor(e,i,n,r,o,s){d(this,"scheduler");d(this,"effectFn");d(this,"zone");d(this,"injector");d(this,"unregisterOnDestroy");d(this,"watcher");this.scheduler=e,this.effectFn=i,this.zone=n,this.injector=o,this.watcher=j1(a=>this.runEffect(a),()=>this.schedule(),s),this.unregisterOnDestroy=r==null?void 0:r.onDestroy(()=>this.destroy())}runEffect(e){try{this.effectFn(e)}catch(i){let n=this.injector.get(pr,null,{optional:!0});n==null||n.handleError(i)}}run(){this.watcher.run()}schedule(){this.scheduler.schedule(this)}destroy(){var e;this.watcher.destroy(),(e=this.unregisterOnDestroy)==null||e.call(this)}};function N6(){}function CT(t,e){var s;bi("NgSignals"),!(e!=null&&e.injector)&&ha(N6);let i=(e==null?void 0:e.injector)??h(Wn),n=(e==null?void 0:e.manualCleanup)!==!0?i.get(it):null,r=new ng(i.get(O6),t,typeof Zone>"u"?null:Zone.current,n,i,(e==null?void 0:e.allowSignalWrites)??!1),o=i.get(st,null,{optional:!0});return!o||!(o._lView[fe]&8)?r.watcher.notify():((s=o._lView)[ra]??(s[ra]=[])).push(r.watcher.notify),r}var P6=k6;var hD;hD=zn;var ig=class{constructor(e){d(this,hD);this[zn]=e}destroy(){this[zn].destroy()}};function Io(t,e){if(P6)return CT(t,e);bi("NgSignals"),!(e!=null&&e.injector)&&ha(Io);let i=(e==null?void 0:e.injector)??h(Wn),n=(e==null?void 0:e.manualCleanup)!==!0?i.get(it):null,r,o=i.get(_T,null,{optional:!0}),s=i.get(Co);return o!==null&&!(e!=null&&e.forceRoot)?(r=L6(o.view,s,t),n instanceof dd&&n._lView===o.view&&(n=null)):r=H6(t,i.get(eT),s),r.injector=i,n!==null&&(r.onDestroyFn=n.onDestroy(()=>r.destroy())),new ig(r)}var DT=U(M({},Zo),{consumerIsAlwaysLive:!0,consumerAllowSignalWrites:!0,dirty:!0,hasRun:!1,cleanupFns:void 0,zone:null,onDestroyFn:Fu,run(){if(this.dirty=!1,this.hasRun&&!yu(this))return;this.hasRun=!0;let t=n=>(this.cleanupFns??(this.cleanupFns=[])).push(n),e=js(this),i=sd(!1);try{this.maybeCleanup(),this.fn(t)}finally{sd(i),gu(this,e)}},maybeCleanup(){var t;if((t=this.cleanupFns)!=null&&t.length)try{for(;this.cleanupFns.length;)this.cleanupFns.pop()()}finally{this.cleanupFns=[]}}}),F6=U(M({},DT),{consumerMarkedDirty(){this.scheduler.schedule(this),this.notifier.notify(13)},destroy(){Us(this),this.onDestroyFn(),this.maybeCleanup()}}),R6=U(M({},DT),{consumerMarkedDirty(){this.view[fe]|=8192,qu(this.view),this.notifier.notify(14)},destroy(){var t;Us(this),this.onDestroyFn(),this.maybeCleanup(),(t=this.view[Br])==null||t.delete(this)}});function L6(t,e,i){let n=Object.create(R6);return n.view=t,n.zone=typeof Zone<"u"?Zone.current:null,n.notifier=e,n.fn=i,t[Br]??(t[Br]=new Set),t[Br].add(n),n.consumerMarkedDirty(n),n}function H6(t,e,i){let n=Object.create(F6);return n.fn=t,n.scheduler=e,n.notifier=i,n.zone=typeof Zone<"u"?Zone.current:null,n.scheduler.schedule(n),n.notifier.notify(13),n}function ET(t,e){let i=bo(t),n=e.elementInjector||Rd();return new da(i).create(n,e.projectableNodes,e.hostElement,e.environmentInjector)}function Se(t){t||(ha(Se),t=h(it));let e=new te(i=>t.onDestroy(i.next.bind(i)));return i=>i.pipe(Kt(e))}function Cn(t,e){var a;let i=!(e!=null&&e.manualCleanup);i&&!(e!=null&&e.injector)&&ha(Cn);let n=i?((a=e==null?void 0:e.injector)==null?void 0:a.get(it))??h(it):null,r=B6(e==null?void 0:e.equal),o;e!=null&&e.requireSync?o=ge({kind:0},{equal:r}):o=ge({kind:1,value:e==null?void 0:e.initialValue},{equal:r});let s=t.subscribe({next:u=>o.set({kind:1,value:u}),error:u=>{if(e!=null&&e.rejectErrors)throw u;o.set({kind:2,error:u})}});if(e!=null&&e.requireSync&&o().kind===0)throw new j(601,!1);return n==null||n.onDestroy(s.unsubscribe.bind(s)),Pt(()=>{let u=o();switch(u.kind){case 1:return u.value;case 2:throw u.error;case 0:throw new j(601,!1)}},{equal:e==null?void 0:e.equal})}function B6(t=Object.is){return(e,i)=>e.kind===1&&i.kind===1&&t(e.value,i.value)}var kT=null;function br(){return kT}function OT(t){kT??(kT=t)}var hf=class{};var qe=new k(""),NT=(()=>{let e=class e{historyGo(n){throw new Error("")}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:()=>h(V6),providedIn:"platform"}));let t=e;return t})();var V6=(()=>{let e=class e extends NT{constructor(){super();d(this,"_location");d(this,"_history");d(this,"_doc",h(qe));this._location=window.location,this._history=window.history}getBaseHrefFromDOM(){return br().getBaseHref(this._doc)}onPopState(r){let o=br().getGlobalEventTarget(this._doc,"window");return o.addEventListener("popstate",r,!1),()=>o.removeEventListener("popstate",r)}onHashChange(r){let o=br().getGlobalEventTarget(this._doc,"window");return o.addEventListener("hashchange",r,!1),()=>o.removeEventListener("hashchange",r)}get href(){return this._location.href}get protocol(){return this._location.protocol}get hostname(){return this._location.hostname}get port(){return this._location.port}get pathname(){return this._location.pathname}get search(){return this._location.search}get hash(){return this._location.hash}set pathname(r){this._location.pathname=r}pushState(r,o,s){this._history.pushState(r,o,s)}replaceState(r,o,s){this._history.replaceState(r,o,s)}forward(){this._history.forward()}back(){this._history.back()}historyGo(r=0){this._history.go(r)}getState(){return this._history.state}};d(e,"\u0275fac",function(o){return new(o||e)}),d(e,"\u0275prov",$({token:e,factory:()=>new e,providedIn:"platform"}));let t=e;return t})();function PT(t,e){if(t.length==0)return e;if(e.length==0)return t;let i=0;return t.endsWith("/")&&i++,e.startsWith("/")&&i++,i==2?t+e.substring(1):i==1?t+e:t+"/"+e}function wT(t){let e=t.match(/#|\?|$/),i=e&&e.index||t.length,n=i-(t[i-1]==="/"?1:0);return t.slice(0,n)+t.slice(i)}function gs(t){return t&&t[0]!=="?"?"?"+t:t}var cy=(()=>{let e=class e{historyGo(n){throw new Error("")}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:()=>h(j6),providedIn:"root"}));let t=e;return t})(),z6=new k(""),j6=(()=>{let e=class e extends cy{constructor(r,o){var s;super();d(this,"_platformLocation");d(this,"_baseHref");d(this,"_removeListenerFns",[]);this._platformLocation=r,this._baseHref=o??this._platformLocation.getBaseHrefFromDOM()??((s=h(qe).location)==null?void 0:s.origin)??""}ngOnDestroy(){for(;this._removeListenerFns.length;)this._removeListenerFns.pop()()}onPopState(r){this._removeListenerFns.push(this._platformLocation.onPopState(r),this._platformLocation.onHashChange(r))}getBaseHref(){return this._baseHref}prepareExternalUrl(r){return PT(this._baseHref,r)}path(r=!1){let o=this._platformLocation.pathname+gs(this._platformLocation.search),s=this._platformLocation.hash;return s&&r?`${o}${s}`:o}pushState(r,o,s,a){let u=this.prepareExternalUrl(s+gs(a));this._platformLocation.pushState(r,o,u)}replaceState(r,o,s,a){let u=this.prepareExternalUrl(s+gs(a));this._platformLocation.replaceState(r,o,u)}forward(){this._platformLocation.forward()}back(){this._platformLocation.back()}getState(){return this._platformLocation.getState()}historyGo(r=0){var o,s;(s=(o=this._platformLocation).historyGo)==null||s.call(o,r)}};d(e,"\u0275fac",function(o){return new(o||e)($e(NT),$e(z6,8))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var U6=(()=>{let e=class e{constructor(n){d(this,"_subject",new tt);d(this,"_basePath");d(this,"_locationStrategy");d(this,"_urlChangeListeners",[]);d(this,"_urlChangeSubscription",null);this._locationStrategy=n;let r=this._locationStrategy.getBaseHref();this._basePath=W6(wT(TT(r))),this._locationStrategy.onPopState(o=>{this._subject.next({url:this.path(!0),pop:!0,state:o.state,type:o.type})})}ngOnDestroy(){var n;(n=this._urlChangeSubscription)==null||n.unsubscribe(),this._urlChangeListeners=[]}path(n=!1){return this.normalize(this._locationStrategy.path(n))}getState(){return this._locationStrategy.getState()}isCurrentPathEqualTo(n,r=""){return this.path()==this.normalize(n+gs(r))}normalize(n){return e.stripTrailingSlash(G6(this._basePath,TT(n)))}prepareExternalUrl(n){return n&&n[0]!=="/"&&(n="/"+n),this._locationStrategy.prepareExternalUrl(n)}go(n,r="",o=null){this._locationStrategy.pushState(o,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+gs(r)),o)}replaceState(n,r="",o=null){this._locationStrategy.replaceState(o,"",n,r),this._notifyUrlChangeListeners(this.prepareExternalUrl(n+gs(r)),o)}forward(){this._locationStrategy.forward()}back(){this._locationStrategy.back()}historyGo(n=0){var r,o;(o=(r=this._locationStrategy).historyGo)==null||o.call(r,n)}onUrlChange(n){return this._urlChangeListeners.push(n),this._urlChangeSubscription??(this._urlChangeSubscription=this.subscribe(r=>{this._notifyUrlChangeListeners(r.url,r.state)})),()=>{var o;let r=this._urlChangeListeners.indexOf(n);this._urlChangeListeners.splice(r,1),this._urlChangeListeners.length===0&&((o=this._urlChangeSubscription)==null||o.unsubscribe(),this._urlChangeSubscription=null)}}_notifyUrlChangeListeners(n="",r){this._urlChangeListeners.forEach(o=>o(n,r))}subscribe(n,r,o){return this._subject.subscribe({next:n,error:r??void 0,complete:o??void 0})}};d(e,"normalizeQueryParams",gs),d(e,"joinWithSlash",PT),d(e,"stripTrailingSlash",wT),d(e,"\u0275fac",function(r){return new(r||e)($e(cy))}),d(e,"\u0275prov",$({token:e,factory:()=>$6(),providedIn:"root"}));let t=e;return t})();function $6(){return new U6($e(cy))}function G6(t,e){if(!t||!e.startsWith(t))return e;let i=e.substring(t.length);return i===""||["/",";","?","#"].includes(i[0])?i:e}function TT(t){return t.replace(/\/index.html$/,"")}function W6(t){if(new RegExp("^(https?:)?//").test(t)){let[,i]=t.split(/\/\/[^\/]+/);return i}return t}function dy(t,e){e=encodeURIComponent(e);for(let i of t.split(";")){let n=i.indexOf("="),[r,o]=n==-1?[i,""]:[i.slice(0,n),i.slice(n+1)];if(r.trim()===e)return decodeURIComponent(o)}return null}var oy=/\s+/,xT=[],FT=(()=>{let e=class e{constructor(n,r){d(this,"_ngEl");d(this,"_renderer");d(this,"initialClasses",xT);d(this,"rawClass");d(this,"stateMap",new Map);this._ngEl=n,this._renderer=r}set klass(n){this.initialClasses=n!=null?n.trim().split(oy):xT}set ngClass(n){this.rawClass=typeof n=="string"?n.trim().split(oy):n}ngDoCheck(){for(let r of this.initialClasses)this._updateState(r,!0);let n=this.rawClass;if(Array.isArray(n)||n instanceof Set)for(let r of n)this._updateState(r,!0);else if(n!=null)for(let r of Object.keys(n))this._updateState(r,!!n[r]);this._applyStateDiff()}_updateState(n,r){let o=this.stateMap.get(n);o!==void 0?(o.enabled!==r&&(o.changed=!0,o.enabled=r),o.touched=!0):this.stateMap.set(n,{enabled:r,changed:!0,touched:!0})}_applyStateDiff(){for(let n of this.stateMap){let r=n[0],o=n[1];o.changed?(this._toggleClass(r,o.enabled),o.changed=!1):o.touched||(o.enabled&&this._toggleClass(r,!1),this.stateMap.delete(r)),o.touched=!1}}_toggleClass(n,r){n=n.trim(),n.length>0&&n.split(oy).forEach(o=>{r?this._renderer.addClass(this._ngEl.nativeElement,o):this._renderer.removeClass(this._ngEl.nativeElement,o)})}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(de),Ge(oi))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngClass",""]],inputs:{klass:[0,"class","klass"],ngClass:"ngClass"}}));let t=e;return t})(),Lte=(()=>{let e=class e{constructor(n){d(this,"_viewContainerRef");d(this,"ngComponentOutlet",null);d(this,"ngComponentOutletInputs");d(this,"ngComponentOutletInjector");d(this,"ngComponentOutletContent");d(this,"ngComponentOutletNgModule");d(this,"ngComponentOutletNgModuleFactory");d(this,"_componentRef");d(this,"_moduleRef");d(this,"_inputsUsed",new Map);this._viewContainerRef=n}_needToReCreateNgModuleInstance(n){return n.ngComponentOutletNgModule!==void 0||n.ngComponentOutletNgModuleFactory!==void 0}_needToReCreateComponentInstance(n){return n.ngComponentOutlet!==void 0||n.ngComponentOutletContent!==void 0||n.ngComponentOutletInjector!==void 0||this._needToReCreateNgModuleInstance(n)}ngOnChanges(n){var r;if(this._needToReCreateComponentInstance(n)&&(this._viewContainerRef.clear(),this._inputsUsed.clear(),this._componentRef=void 0,this.ngComponentOutlet)){let o=this.ngComponentOutletInjector||this._viewContainerRef.parentInjector;this._needToReCreateNgModuleInstance(n)&&((r=this._moduleRef)==null||r.destroy(),this.ngComponentOutletNgModule?this._moduleRef=jw(this.ngComponentOutletNgModule,IT(o)):this.ngComponentOutletNgModuleFactory?this._moduleRef=this.ngComponentOutletNgModuleFactory.create(IT(o)):this._moduleRef=void 0),this._componentRef=this._viewContainerRef.createComponent(this.ngComponentOutlet,{injector:o,ngModuleRef:this._moduleRef,projectableNodes:this.ngComponentOutletContent})}}ngDoCheck(){if(this._componentRef){if(this.ngComponentOutletInputs)for(let n of Object.keys(this.ngComponentOutletInputs))this._inputsUsed.set(n,!0);this._applyInputStateDiff(this._componentRef)}}ngOnDestroy(){var n;(n=this._moduleRef)==null||n.destroy()}_applyInputStateDiff(n){for(let[r,o]of this._inputsUsed)o?(n.setInput(r,this.ngComponentOutletInputs[r]),this._inputsUsed.set(r,!1)):(n.setInput(r,void 0),this._inputsUsed.delete(r))}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngComponentOutlet",""]],inputs:{ngComponentOutlet:"ngComponentOutlet",ngComponentOutletInputs:"ngComponentOutletInputs",ngComponentOutletInjector:"ngComponentOutletInjector",ngComponentOutletContent:"ngComponentOutletContent",ngComponentOutletNgModule:"ngComponentOutletNgModule",ngComponentOutletNgModuleFactory:"ngComponentOutletNgModuleFactory"},features:[Yt]}));let t=e;return t})();function IT(t){return t.get(Wr).injector}var sy=class{constructor(e,i,n,r){d(this,"$implicit");d(this,"ngForOf");d(this,"index");d(this,"count");this.$implicit=e,this.ngForOf=i,this.index=n,this.count=r}get first(){return this.index===0}get last(){return this.index===this.count-1}get even(){return this.index%2===0}get odd(){return!this.even}},Ci=(()=>{let e=class e{constructor(n,r,o){d(this,"_viewContainer");d(this,"_template");d(this,"_differs");d(this,"_ngForOf",null);d(this,"_ngForOfDirty",!0);d(this,"_differ",null);d(this,"_trackByFn");this._viewContainer=n,this._template=r,this._differs=o}set ngForOf(n){this._ngForOf=n,this._ngForOfDirty=!0}set ngForTrackBy(n){this._trackByFn=n}get ngForTrackBy(){return this._trackByFn}set ngForTemplate(n){n&&(this._template=n)}ngDoCheck(){if(this._ngForOfDirty){this._ngForOfDirty=!1;let n=this._ngForOf;if(!this._differ&&n)if(0)try{}catch{}else this._differ=this._differs.find(n).create(this.ngForTrackBy)}if(this._differ){let n=this._differ.diff(this._ngForOf);n&&this._applyChanges(n)}}_applyChanges(n){let r=this._viewContainer;n.forEachOperation((o,s,a)=>{if(o.previousIndex==null)r.createEmbeddedView(this._template,new sy(o.item,this._ngForOf,-1,-1),a===null?void 0:a);else if(a==null)r.remove(s===null?void 0:s);else if(s!==null){let u=r.get(s);r.move(u,a),ST(u,o)}});for(let o=0,s=r.length;o{let s=r.get(o.currentIndex);ST(s,o)})}static ngTemplateContextGuard(n,r){return!0}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt),Ge(It),Ge(ry))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngFor","","ngForOf",""]],inputs:{ngForOf:"ngForOf",ngForTrackBy:"ngForTrackBy",ngForTemplate:"ngForTemplate"}}));let t=e;return t})();function ST(t,e){t.context.$implicit=e.item}var ut=(()=>{let e=class e{constructor(n,r){d(this,"_viewContainer");d(this,"_context",new ay);d(this,"_thenTemplateRef",null);d(this,"_elseTemplateRef",null);d(this,"_thenViewRef",null);d(this,"_elseViewRef",null);this._viewContainer=n,this._thenTemplateRef=r}set ngIf(n){this._context.$implicit=this._context.ngIf=n,this._updateView()}set ngIfThen(n){MT("ngIfThen",n),this._thenTemplateRef=n,this._thenViewRef=null,this._updateView()}set ngIfElse(n){MT("ngIfElse",n),this._elseTemplateRef=n,this._elseViewRef=null,this._updateView()}_updateView(){this._context.$implicit?this._thenViewRef||(this._viewContainer.clear(),this._elseViewRef=null,this._thenTemplateRef&&(this._thenViewRef=this._viewContainer.createEmbeddedView(this._thenTemplateRef,this._context))):this._elseViewRef||(this._viewContainer.clear(),this._thenViewRef=null,this._elseTemplateRef&&(this._elseViewRef=this._viewContainer.createEmbeddedView(this._elseTemplateRef,this._context)))}static ngTemplateContextGuard(n,r){return!0}};d(e,"ngIfUseIfTypeGuard"),d(e,"ngTemplateGuard_ngIf"),d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt),Ge(It))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngIf",""]],inputs:{ngIf:"ngIf",ngIfThen:"ngIfThen",ngIfElse:"ngIfElse"}}));let t=e;return t})(),ay=class{constructor(){d(this,"$implicit",null);d(this,"ngIf",null)}};function MT(t,e){if(!!!(!e||e.createEmbeddedView))throw new Error(`${t} must be a TemplateRef, but received '${Mn(e)}'.`)}var RT=(()=>{let e=class e{constructor(n,r,o){d(this,"_ngEl");d(this,"_differs");d(this,"_renderer");d(this,"_ngStyle",null);d(this,"_differ",null);this._ngEl=n,this._differs=r,this._renderer=o}set ngStyle(n){this._ngStyle=n,!this._differ&&n&&(this._differ=this._differs.find(n).create())}ngDoCheck(){if(this._differ){let n=this._differ.diff(this._ngStyle);n&&this._applyChanges(n)}}_setStyle(n,r){let[o,s]=n.split("."),a=o.indexOf("-")===-1?void 0:mr.DashCase;r!=null?this._renderer.setStyle(this._ngEl.nativeElement,o,s?`${r}${s}`:r,a):this._renderer.removeStyle(this._ngEl.nativeElement,o,a)}_applyChanges(n){n.forEachRemovedItem(r=>this._setStyle(r.key,null)),n.forEachAddedItem(r=>this._setStyle(r.key,r.currentValue)),n.forEachChangedItem(r=>this._setStyle(r.key,r.currentValue))}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(de),Ge(ff),Ge(oi))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngStyle",""]],inputs:{ngStyle:"ngStyle"}}));let t=e;return t})(),LT=(()=>{let e=class e{constructor(n){d(this,"_viewContainerRef");d(this,"_viewRef",null);d(this,"ngTemplateOutletContext",null);d(this,"ngTemplateOutlet",null);d(this,"ngTemplateOutletInjector",null);this._viewContainerRef=n}ngOnChanges(n){if(this._shouldRecreateView(n)){let r=this._viewContainerRef;if(this._viewRef&&r.remove(r.indexOf(this._viewRef)),!this.ngTemplateOutlet){this._viewRef=null;return}let o=this._createContextForwardProxy();this._viewRef=r.createEmbeddedView(this.ngTemplateOutlet,o,{injector:this.ngTemplateOutletInjector??void 0})}}_shouldRecreateView(n){return!!n.ngTemplateOutlet||!!n.ngTemplateOutletInjector}_createContextForwardProxy(){return new Proxy({},{set:(n,r,o)=>this.ngTemplateOutletContext?Reflect.set(this.ngTemplateOutletContext,r,o):!1,get:(n,r,o)=>{if(this.ngTemplateOutletContext)return Reflect.get(this.ngTemplateOutletContext,r,o)}})}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(zt))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngTemplateOutlet",""]],inputs:{ngTemplateOutletContext:"ngTemplateOutletContext",ngTemplateOutlet:"ngTemplateOutlet",ngTemplateOutletInjector:"ngTemplateOutletInjector"},features:[Yt]}));let t=e;return t})();function HT(t,e){return new j(2100,!1)}var uy=class{createSubscription(e,i){return Gi(()=>e.subscribe({next:i,error:n=>{throw n}}))}dispose(e){Gi(()=>e.unsubscribe())}},ly=class{createSubscription(e,i){return e.then(i,n=>{throw n})}dispose(e){}},q6=new ly,Z6=new uy,Re=(()=>{let e=class e{constructor(n){d(this,"_ref");d(this,"_latestValue",null);d(this,"markForCheckOnValueUpdate",!0);d(this,"_subscription",null);d(this,"_obj",null);d(this,"_strategy",null);this._ref=n}ngOnDestroy(){this._subscription&&this._dispose(),this._ref=null}transform(n){if(!this._obj){if(n)try{this.markForCheckOnValueUpdate=!1,this._subscribe(n)}finally{this.markForCheckOnValueUpdate=!0}return this._latestValue}return n!==this._obj?(this._dispose(),this.transform(n)):this._latestValue}_subscribe(n){this._obj=n,this._strategy=this._selectStrategy(n),this._subscription=this._strategy.createSubscription(n,r=>this._updateLatestValue(n,r))}_selectStrategy(n){if(Da(n))return q6;if(Jg(n))return Z6;throw HT(e,n)}_dispose(){this._strategy.dispose(this._subscription),this._latestValue=null,this._subscription=null,this._obj=null}_updateLatestValue(n,r){var o;n===this._obj&&(this._latestValue=r,this.markForCheckOnValueUpdate&&((o=this._ref)==null||o.markForCheck()))}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(st,16))}),d(e,"\u0275pipe",$i({name:"async",type:e,pure:!1}));let t=e;return t})(),BT=(()=>{let e=class e{transform(n){if(n==null)return null;if(typeof n!="string")throw HT(e,n);return n.toLowerCase()}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275pipe",$i({name:"lowercase",type:e,pure:!0}));let t=e;return t})();function K6(t,e){return{key:t,value:e}}var VT=(()=>{let e=class e{constructor(n){d(this,"differs");d(this,"differ");d(this,"keyValues",[]);d(this,"compareFn",AT);this.differs=n}transform(n,r=AT){if(!n||!(n instanceof Map)&&typeof n!="object")return null;this.differ??(this.differ=this.differs.find(n).create());let o=this.differ.diff(n),s=r!==this.compareFn;return o&&(this.keyValues=[],o.forEachItem(a=>{this.keyValues.push(K6(a.key,a.currentValue))})),(o||s)&&(r&&this.keyValues.sort(r),this.compareFn=r),this.keyValues}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(ff,16))}),d(e,"\u0275pipe",$i({name:"keyvalue",type:e,pure:!1}));let t=e;return t})();function AT(t,e){let i=t.key,n=e.key;if(i===n)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(i===null)return 1;if(n===null)return-1;if(typeof i=="string"&&typeof n=="string")return i{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",bn({type:e})),d(e,"\u0275inj",vn({}));let t=e;return t})(),fy="browser",Y6="server";function zT(t){return t===fy}function nl(t){return t===Y6}var mf=class{};var QT=(()=>{let e=class e{constructor(n,r){d(this,"_renderer");d(this,"_elementRef");d(this,"onChange",n=>{});d(this,"onTouched",()=>{});this._renderer=n,this._elementRef=r}setProperty(n,r){this._renderer.setProperty(this._elementRef.nativeElement,n,r)}registerOnTouched(n){this.onTouched=n}registerOnChange(n){this.onChange=n}setDisabledState(n){this.setProperty("disabled",n)}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(oi),Ge(de))}),d(e,"\u0275dir",T({type:e}));let t=e;return t})(),yy=(()=>{let e=class e extends QT{};d(e,"\u0275fac",(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})()),d(e,"\u0275dir",T({type:e,features:[oe]}));let t=e;return t})(),_f=new k(""),Q6={provide:_f,useExisting:vi(()=>X6),multi:!0},X6=(()=>{let e=class e extends yy{writeValue(n){this.setProperty("checked",n)}};d(e,"\u0275fac",(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})()),d(e,"\u0275dir",T({type:e,selectors:[["input","type","checkbox","formControlName",""],["input","type","checkbox","formControl",""],["input","type","checkbox","ngModel",""]],hostBindings:function(r,o){r&1&&x("change",function(a){return o.onChange(a.target.checked)})("blur",function(){return o.onTouched()})},standalone:!1,features:[Z([Q6]),oe]}));let t=e;return t})(),J6={provide:_f,useExisting:vi(()=>So),multi:!0};function e4(){let t=br()?br().getUserAgent():"";return/android (\d+)/.test(t.toLowerCase())}var t4=new k(""),So=(()=>{let e=class e extends QT{constructor(r,o,s){super(r,o);d(this,"_compositionMode");d(this,"_composing",!1);this._compositionMode=s,this._compositionMode==null&&(this._compositionMode=!e4())}writeValue(r){let o=r??"";this.setProperty("value",o)}_handleInput(r){(!this._compositionMode||this._compositionMode&&!this._composing)&&this.onChange(r)}_compositionStart(){this._composing=!0}_compositionEnd(r){this._composing=!1,this._compositionMode&&this.onChange(r)}};d(e,"\u0275fac",function(o){return new(o||e)(Ge(oi),Ge(de),Ge(t4,8))}),d(e,"\u0275dir",T({type:e,selectors:[["input","formControlName","",3,"type","checkbox"],["textarea","formControlName",""],["input","formControl","",3,"type","checkbox"],["textarea","formControl",""],["input","ngModel","",3,"type","checkbox"],["textarea","ngModel",""],["","ngDefaultControl",""]],hostBindings:function(o,s){o&1&&x("input",function(u){return s._handleInput(u.target.value)})("blur",function(){return s.onTouched()})("compositionstart",function(){return s._compositionStart()})("compositionend",function(u){return s._compositionEnd(u.target.value)})},standalone:!1,features:[Z([J6]),oe]}));let t=e;return t})();function n4(t){return t==null||(typeof t=="string"||Array.isArray(t))&&t.length===0}var Cf=new k(""),i4=new k("");function r4(t){return n4(t.value)?{required:!0}:null}function UT(t){return null}function XT(t){return t!=null}function JT(t){return Da(t)?yn(t):t}function ex(t){let e={};return t.forEach(i=>{e=i!=null?M(M({},e),i):e}),Object.keys(e).length===0?null:e}function tx(t,e){return e.map(i=>i(t))}function o4(t){return!t.validate}function nx(t){return t.map(e=>o4(e)?e:i=>e.validate(i))}function s4(t){if(!t)return null;let e=t.filter(XT);return e.length==0?null:function(i){return ex(tx(i,e))}}function ix(t){return t!=null?s4(nx(t)):null}function a4(t){if(!t)return null;let e=t.filter(XT);return e.length==0?null:function(i){let n=tx(i,e).map(JT);return Dm(n).pipe(S(ex))}}function rx(t){return t!=null?a4(nx(t)):null}function $T(t,e){return t===null?[e]:Array.isArray(t)?[...t,e]:[t,e]}function u4(t){return t._rawValidators}function l4(t){return t._rawAsyncValidators}function py(t){return t?Array.isArray(t)?t:[t]:[]}function yf(t,e){return Array.isArray(t)?t.includes(e):t===e}function GT(t,e){let i=py(e);return py(t).forEach(r=>{yf(i,r)||i.push(r)}),i}function WT(t,e){return py(e).filter(i=>!yf(t,i))}var vf=class{constructor(){d(this,"_composedValidatorFn");d(this,"_composedAsyncValidatorFn");d(this,"_rawValidators",[]);d(this,"_rawAsyncValidators",[]);d(this,"_onDestroyCallbacks",[])}get value(){return this.control?this.control.value:null}get valid(){return this.control?this.control.valid:null}get invalid(){return this.control?this.control.invalid:null}get pending(){return this.control?this.control.pending:null}get disabled(){return this.control?this.control.disabled:null}get enabled(){return this.control?this.control.enabled:null}get errors(){return this.control?this.control.errors:null}get pristine(){return this.control?this.control.pristine:null}get dirty(){return this.control?this.control.dirty:null}get touched(){return this.control?this.control.touched:null}get status(){return this.control?this.control.status:null}get untouched(){return this.control?this.control.untouched:null}get statusChanges(){return this.control?this.control.statusChanges:null}get valueChanges(){return this.control?this.control.valueChanges:null}get path(){return null}_setValidators(e){this._rawValidators=e||[],this._composedValidatorFn=ix(this._rawValidators)}_setAsyncValidators(e){this._rawAsyncValidators=e||[],this._composedAsyncValidatorFn=rx(this._rawAsyncValidators)}get validator(){return this._composedValidatorFn||null}get asyncValidator(){return this._composedAsyncValidatorFn||null}_registerOnDestroy(e){this._onDestroyCallbacks.push(e)}_invokeOnDestroyCallbacks(){this._onDestroyCallbacks.forEach(e=>e()),this._onDestroyCallbacks=[]}reset(e=void 0){this.control&&this.control.reset(e)}hasError(e,i){return this.control?this.control.hasError(e,i):!1}getError(e,i){return this.control?this.control.getError(e,i):null}},hy=class extends vf{constructor(){super(...arguments);d(this,"name")}get formDirective(){return null}get path(){return null}},an=class extends vf{constructor(){super(...arguments);d(this,"_parent",null);d(this,"name",null);d(this,"valueAccessor",null)}},my=class{constructor(e){d(this,"_cd");this._cd=e}get isTouched(){var e,i,n,r,o;return(n=(i=(e=this._cd)==null?void 0:e.control)==null?void 0:i._touched)==null||n.call(i),!!((o=(r=this._cd)==null?void 0:r.control)!=null&&o.touched)}get isUntouched(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.untouched)}get isPristine(){var e,i,n,r,o;return(n=(i=(e=this._cd)==null?void 0:e.control)==null?void 0:i._pristine)==null||n.call(i),!!((o=(r=this._cd)==null?void 0:r.control)!=null&&o.pristine)}get isDirty(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.dirty)}get isValid(){var e,i,n,r,o;return(n=(i=(e=this._cd)==null?void 0:e.control)==null?void 0:i._status)==null||n.call(i),!!((o=(r=this._cd)==null?void 0:r.control)!=null&&o.valid)}get isInvalid(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.invalid)}get isPending(){var e,i;return!!((i=(e=this._cd)==null?void 0:e.control)!=null&&i.pending)}get isSubmitted(){var e,i,n;return(i=(e=this._cd)==null?void 0:e._submitted)==null||i.call(e),!!((n=this._cd)!=null&&n.submitted)}},c4={"[class.ng-untouched]":"isUntouched","[class.ng-touched]":"isTouched","[class.ng-pristine]":"isPristine","[class.ng-dirty]":"isDirty","[class.ng-valid]":"isValid","[class.ng-invalid]":"isInvalid","[class.ng-pending]":"isPending"},ene=U(M({},c4),{"[class.ng-submitted]":"isSubmitted"}),Df=(()=>{let e=class e extends my{constructor(n){super(n)}};d(e,"\u0275fac",function(r){return new(r||e)(Ge(an,2))}),d(e,"\u0275dir",T({type:e,selectors:[["","formControlName",""],["","ngModel",""],["","formControl",""]],hostVars:14,hostBindings:function(r,o){r&2&&Te("ng-untouched",o.isUntouched)("ng-touched",o.isTouched)("ng-pristine",o.isPristine)("ng-dirty",o.isDirty)("ng-valid",o.isValid)("ng-invalid",o.isInvalid)("ng-pending",o.isPending)},standalone:!1,features:[oe]}));let t=e;return t})();var il="VALID",gf="INVALID",Ta="PENDING",rl="DISABLED",Ia=class{},bf=class extends Ia{constructor(i,n){super();d(this,"value");d(this,"source");this.value=i,this.source=n}},ol=class extends Ia{constructor(i,n){super();d(this,"pristine");d(this,"source");this.pristine=i,this.source=n}},sl=class extends Ia{constructor(i,n){super();d(this,"touched");d(this,"source");this.touched=i,this.source=n}},xa=class extends Ia{constructor(i,n){super();d(this,"status");d(this,"source");this.status=i,this.source=n}};function d4(t){return(Ef(t)?t.validators:t)||null}function f4(t){return Array.isArray(t)?ix(t):t||null}function p4(t,e){return(Ef(e)?e.asyncValidators:t)||null}function h4(t){return Array.isArray(t)?rx(t):t||null}function Ef(t){return t!=null&&!Array.isArray(t)&&typeof t=="object"}var gy=class{constructor(e,i){d(this,"_pendingDirty",!1);d(this,"_hasOwnPendingAsyncValidator",null);d(this,"_pendingTouched",!1);d(this,"_onCollectionChange",()=>{});d(this,"_updateOn");d(this,"_parent",null);d(this,"_asyncValidationSubscription");d(this,"_composedValidatorFn");d(this,"_composedAsyncValidatorFn");d(this,"_rawValidators");d(this,"_rawAsyncValidators");d(this,"value");d(this,"_status",Pt(()=>this.statusReactive()));d(this,"statusReactive",ge(void 0));d(this,"errors");d(this,"_pristine",Pt(()=>this.pristineReactive()));d(this,"pristineReactive",ge(!0));d(this,"_touched",Pt(()=>this.touchedReactive()));d(this,"touchedReactive",ge(!1));d(this,"_events",new tt);d(this,"events",this._events.asObservable());d(this,"valueChanges");d(this,"statusChanges");d(this,"_onDisabledChange",[]);this._assignValidators(e),this._assignAsyncValidators(i)}get validator(){return this._composedValidatorFn}set validator(e){this._rawValidators=this._composedValidatorFn=e}get asyncValidator(){return this._composedAsyncValidatorFn}set asyncValidator(e){this._rawAsyncValidators=this._composedAsyncValidatorFn=e}get parent(){return this._parent}get status(){return Gi(this.statusReactive)}set status(e){Gi(()=>this.statusReactive.set(e))}get valid(){return this.status===il}get invalid(){return this.status===gf}get pending(){return this.status==Ta}get disabled(){return this.status===rl}get enabled(){return this.status!==rl}get pristine(){return Gi(this.pristineReactive)}set pristine(e){Gi(()=>this.pristineReactive.set(e))}get dirty(){return!this.pristine}get touched(){return Gi(this.touchedReactive)}set touched(e){Gi(()=>this.touchedReactive.set(e))}get untouched(){return!this.touched}get updateOn(){return this._updateOn?this._updateOn:this.parent?this.parent.updateOn:"change"}setValidators(e){this._assignValidators(e)}setAsyncValidators(e){this._assignAsyncValidators(e)}addValidators(e){this.setValidators(GT(e,this._rawValidators))}addAsyncValidators(e){this.setAsyncValidators(GT(e,this._rawAsyncValidators))}removeValidators(e){this.setValidators(WT(e,this._rawValidators))}removeAsyncValidators(e){this.setAsyncValidators(WT(e,this._rawAsyncValidators))}hasValidator(e){return yf(this._rawValidators,e)}hasAsyncValidator(e){return yf(this._rawAsyncValidators,e)}clearValidators(){this.validator=null}clearAsyncValidators(){this.asyncValidator=null}markAsTouched(e={}){let i=this.touched===!1;this.touched=!0;let n=e.sourceControl??this;this._parent&&!e.onlySelf&&this._parent.markAsTouched(U(M({},e),{sourceControl:n})),i&&e.emitEvent!==!1&&this._events.next(new sl(!0,n))}markAllAsTouched(e={}){this.markAsTouched({onlySelf:!0,emitEvent:e.emitEvent,sourceControl:this}),this._forEachChild(i=>i.markAllAsTouched(e))}markAsUntouched(e={}){let i=this.touched===!0;this.touched=!1,this._pendingTouched=!1;let n=e.sourceControl??this;this._forEachChild(r=>{r.markAsUntouched({onlySelf:!0,emitEvent:e.emitEvent,sourceControl:n})}),this._parent&&!e.onlySelf&&this._parent._updateTouched(e,n),i&&e.emitEvent!==!1&&this._events.next(new sl(!1,n))}markAsDirty(e={}){let i=this.pristine===!0;this.pristine=!1;let n=e.sourceControl??this;this._parent&&!e.onlySelf&&this._parent.markAsDirty(U(M({},e),{sourceControl:n})),i&&e.emitEvent!==!1&&this._events.next(new ol(!1,n))}markAsPristine(e={}){let i=this.pristine===!1;this.pristine=!0,this._pendingDirty=!1;let n=e.sourceControl??this;this._forEachChild(r=>{r.markAsPristine({onlySelf:!0,emitEvent:e.emitEvent})}),this._parent&&!e.onlySelf&&this._parent._updatePristine(e,n),i&&e.emitEvent!==!1&&this._events.next(new ol(!0,n))}markAsPending(e={}){this.status=Ta;let i=e.sourceControl??this;e.emitEvent!==!1&&(this._events.next(new xa(this.status,i)),this.statusChanges.emit(this.status)),this._parent&&!e.onlySelf&&this._parent.markAsPending(U(M({},e),{sourceControl:i}))}disable(e={}){let i=this._parentMarkedDirty(e.onlySelf);this.status=rl,this.errors=null,this._forEachChild(r=>{r.disable(U(M({},e),{onlySelf:!0}))}),this._updateValue();let n=e.sourceControl??this;e.emitEvent!==!1&&(this._events.next(new bf(this.value,n)),this._events.next(new xa(this.status,n)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._updateAncestors(U(M({},e),{skipPristineCheck:i}),this),this._onDisabledChange.forEach(r=>r(!0))}enable(e={}){let i=this._parentMarkedDirty(e.onlySelf);this.status=il,this._forEachChild(n=>{n.enable(U(M({},e),{onlySelf:!0}))}),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent}),this._updateAncestors(U(M({},e),{skipPristineCheck:i}),this),this._onDisabledChange.forEach(n=>n(!1))}_updateAncestors(e,i){this._parent&&!e.onlySelf&&(this._parent.updateValueAndValidity(e),e.skipPristineCheck||this._parent._updatePristine({},i),this._parent._updateTouched({},i))}setParent(e){this._parent=e}getRawValue(){return this.value}updateValueAndValidity(e={}){if(this._setInitialStatus(),this._updateValue(),this.enabled){let n=this._cancelExistingSubscription();this.errors=this._runValidator(),this.status=this._calculateStatus(),(this.status===il||this.status===Ta)&&this._runAsyncValidator(n,e.emitEvent)}let i=e.sourceControl??this;e.emitEvent!==!1&&(this._events.next(new bf(this.value,i)),this._events.next(new xa(this.status,i)),this.valueChanges.emit(this.value),this.statusChanges.emit(this.status)),this._parent&&!e.onlySelf&&this._parent.updateValueAndValidity(U(M({},e),{sourceControl:i}))}_updateTreeValidity(e={emitEvent:!0}){this._forEachChild(i=>i._updateTreeValidity(e)),this.updateValueAndValidity({onlySelf:!0,emitEvent:e.emitEvent})}_setInitialStatus(){this.status=this._allControlsDisabled()?rl:il}_runValidator(){return this.validator?this.validator(this):null}_runAsyncValidator(e,i){if(this.asyncValidator){this.status=Ta,this._hasOwnPendingAsyncValidator={emitEvent:i!==!1};let n=JT(this.asyncValidator(this));this._asyncValidationSubscription=n.subscribe(r=>{this._hasOwnPendingAsyncValidator=null,this.setErrors(r,{emitEvent:i,shouldHaveEmitted:e})})}}_cancelExistingSubscription(){var e;if(this._asyncValidationSubscription){this._asyncValidationSubscription.unsubscribe();let i=((e=this._hasOwnPendingAsyncValidator)==null?void 0:e.emitEvent)??!1;return this._hasOwnPendingAsyncValidator=null,i}return!1}setErrors(e,i={}){this.errors=e,this._updateControlsErrors(i.emitEvent!==!1,this,i.shouldHaveEmitted)}get(e){let i=e;return i==null||(Array.isArray(i)||(i=i.split(".")),i.length===0)?null:i.reduce((n,r)=>n&&n._find(r),this)}getError(e,i){let n=i?this.get(i):this;return n&&n.errors?n.errors[e]:null}hasError(e,i){return!!this.getError(e,i)}get root(){let e=this;for(;e._parent;)e=e._parent;return e}_updateControlsErrors(e,i,n){this.status=this._calculateStatus(),e&&this.statusChanges.emit(this.status),(e||n)&&this._events.next(new xa(this.status,i)),this._parent&&this._parent._updateControlsErrors(e,i,n)}_initObservables(){this.valueChanges=new _e,this.statusChanges=new _e}_calculateStatus(){return this._allControlsDisabled()?rl:this.errors?gf:this._hasOwnPendingAsyncValidator||this._anyControlsHaveStatus(Ta)?Ta:this._anyControlsHaveStatus(gf)?gf:il}_anyControlsHaveStatus(e){return this._anyControls(i=>i.status===e)}_anyControlsDirty(){return this._anyControls(e=>e.dirty)}_anyControlsTouched(){return this._anyControls(e=>e.touched)}_updatePristine(e,i){let n=!this._anyControlsDirty(),r=this.pristine!==n;this.pristine=n,this._parent&&!e.onlySelf&&this._parent._updatePristine(e,i),r&&this._events.next(new ol(this.pristine,i))}_updateTouched(e={},i){this.touched=this._anyControlsTouched(),this._events.next(new sl(this.touched,i)),this._parent&&!e.onlySelf&&this._parent._updateTouched(e,i)}_registerOnCollectionChange(e){this._onCollectionChange=e}_setUpdateStrategy(e){Ef(e)&&e.updateOn!=null&&(this._updateOn=e.updateOn)}_parentMarkedDirty(e){let i=this._parent&&this._parent.dirty;return!e&&!!i&&!this._parent._anyControlsDirty()}_find(e){return null}_assignValidators(e){this._rawValidators=Array.isArray(e)?e.slice():e,this._composedValidatorFn=f4(this._rawValidators)}_assignAsyncValidators(e){this._rawAsyncValidators=Array.isArray(e)?e.slice():e,this._composedAsyncValidatorFn=h4(this._rawAsyncValidators)}};var ox=new k("CallSetDisabledState",{providedIn:"root",factory:()=>vy}),vy="always";function m4(t,e){return[...e.path,t]}function g4(t,e,i=vy){var n,r;v4(t,e),e.valueAccessor.writeValue(t.value),(t.disabled||i==="always")&&((r=(n=e.valueAccessor).setDisabledState)==null||r.call(n,t.disabled)),b4(t,e),C4(t,e),_4(t,e),y4(t,e)}function qT(t,e){t.forEach(i=>{i.registerOnValidatorChange&&i.registerOnValidatorChange(e)})}function y4(t,e){if(e.valueAccessor.setDisabledState){let i=n=>{e.valueAccessor.setDisabledState(n)};t.registerOnDisabledChange(i),e._registerOnDestroy(()=>{t._unregisterOnDisabledChange(i)})}}function v4(t,e){let i=u4(t);e.validator!==null?t.setValidators($T(i,e.validator)):typeof i=="function"&&t.setValidators([i]);let n=l4(t);e.asyncValidator!==null?t.setAsyncValidators($T(n,e.asyncValidator)):typeof n=="function"&&t.setAsyncValidators([n]);let r=()=>t.updateValueAndValidity();qT(e._rawValidators,r),qT(e._rawAsyncValidators,r)}function b4(t,e){e.valueAccessor.registerOnChange(i=>{t._pendingValue=i,t._pendingChange=!0,t._pendingDirty=!0,t.updateOn==="change"&&sx(t,e)})}function _4(t,e){e.valueAccessor.registerOnTouched(()=>{t._pendingTouched=!0,t.updateOn==="blur"&&t._pendingChange&&sx(t,e),t.updateOn!=="submit"&&t.markAsTouched()})}function sx(t,e){t._pendingDirty&&t.markAsDirty(),t.setValue(t._pendingValue,{emitModelToViewChange:!1}),e.viewToModelUpdate(t._pendingValue),t._pendingChange=!1}function C4(t,e){let i=(n,r)=>{e.valueAccessor.writeValue(n),r&&e.viewToModelUpdate(n)};t.registerOnChange(i),e._registerOnDestroy(()=>{t._unregisterOnChange(i)})}function D4(t,e){if(!t.hasOwnProperty("model"))return!1;let i=t.model;return i.isFirstChange()?!0:!Object.is(e,i.currentValue)}function E4(t){return Object.getPrototypeOf(t.constructor)===yy}function w4(t,e){if(!e)return null;Array.isArray(e);let i,n,r;return e.forEach(o=>{o.constructor===So?i=o:E4(o)?n=o:r=o}),r||n||i||null}function ZT(t,e){let i=t.indexOf(e);i>-1&&t.splice(i,1)}function KT(t){return typeof t=="object"&&t!==null&&Object.keys(t).length===2&&"value"in t&&"disabled"in t}var T4=class extends gy{constructor(i=null,n,r){super(d4(n),p4(r,n));d(this,"defaultValue",null);d(this,"_onChange",[]);d(this,"_pendingValue");d(this,"_pendingChange",!1);this._applyFormState(i),this._setUpdateStrategy(n),this._initObservables(),this.updateValueAndValidity({onlySelf:!0,emitEvent:!!this.asyncValidator}),Ef(n)&&(n.nonNullable||n.initialValueIsDefault)&&(KT(i)?this.defaultValue=i.value:this.defaultValue=i)}setValue(i,n={}){this.value=this._pendingValue=i,this._onChange.length&&n.emitModelToViewChange!==!1&&this._onChange.forEach(r=>r(this.value,n.emitViewToModelChange!==!1)),this.updateValueAndValidity(n)}patchValue(i,n={}){this.setValue(i,n)}reset(i=this.defaultValue,n={}){this._applyFormState(i),this.markAsPristine(n),this.markAsUntouched(n),this.setValue(this.value,n),this._pendingChange=!1}_updateValue(){}_anyControls(i){return!1}_allControlsDisabled(){return this.disabled}registerOnChange(i){this._onChange.push(i)}_unregisterOnChange(i){ZT(this._onChange,i)}registerOnDisabledChange(i){this._onDisabledChange.push(i)}_unregisterOnDisabledChange(i){ZT(this._onDisabledChange,i)}_forEachChild(i){}_syncPendingControls(){return this.updateOn==="submit"&&(this._pendingDirty&&this.markAsDirty(),this._pendingTouched&&this.markAsTouched(),this._pendingChange)?(this.setValue(this._pendingValue,{onlySelf:!0,emitModelToViewChange:!1}),!0):!1}_applyFormState(i){KT(i)?(this.value=this._pendingValue=i.value,i.disabled?this.disable({onlySelf:!0,emitEvent:!1}):this.enable({onlySelf:!0,emitEvent:!1})):this.value=this._pendingValue=i}};var x4={provide:an,useExisting:vi(()=>_r)},YT=Promise.resolve(),_r=(()=>{let e=class e extends an{constructor(r,o,s,a,u,l){super();d(this,"_changeDetectorRef");d(this,"callSetDisabledState");d(this,"control",new T4);d(this,"_registered",!1);d(this,"viewModel");d(this,"name","");d(this,"isDisabled");d(this,"model");d(this,"options");d(this,"update",new _e);this._changeDetectorRef=u,this.callSetDisabledState=l,this._parent=r,this._setValidators(o),this._setAsyncValidators(s),this.valueAccessor=w4(this,a)}ngOnChanges(r){if(this._checkForErrors(),!this._registered||"name"in r){if(this._registered&&(this._checkName(),this.formDirective)){let o=r.name.previousValue;this.formDirective.removeControl({name:o,path:this._getPath(o)})}this._setUpControl()}"isDisabled"in r&&this._updateDisabled(r),D4(r,this.viewModel)&&(this._updateValue(this.model),this.viewModel=this.model)}ngOnDestroy(){this.formDirective&&this.formDirective.removeControl(this)}get path(){return this._getPath(this.name)}get formDirective(){return this._parent?this._parent.formDirective:null}viewToModelUpdate(r){this.viewModel=r,this.update.emit(r)}_setUpControl(){this._setUpdateStrategy(),this._isStandalone()?this._setUpStandalone():this.formDirective.addControl(this),this._registered=!0}_setUpdateStrategy(){this.options&&this.options.updateOn!=null&&(this.control._updateOn=this.options.updateOn)}_isStandalone(){return!this._parent||!!(this.options&&this.options.standalone)}_setUpStandalone(){g4(this.control,this,this.callSetDisabledState),this.control.updateValueAndValidity({emitEvent:!1})}_checkForErrors(){this._isStandalone()||this._checkParentType(),this._checkName()}_checkParentType(){}_checkName(){this.options&&this.options.name&&(this.name=this.options.name),!this._isStandalone()&&this.name}_updateValue(r){YT.then(()=>{var o;this.control.setValue(r,{emitViewToModelChange:!1}),(o=this._changeDetectorRef)==null||o.markForCheck()})}_updateDisabled(r){let o=r.isDisabled.currentValue,s=o!==0&&pf(o);YT.then(()=>{var a;s&&!this.control.disabled?this.control.disable():!s&&this.control.disabled&&this.control.enable(),(a=this._changeDetectorRef)==null||a.markForCheck()})}_getPath(r){return this._parent?m4(r,this._parent):[r]}};d(e,"ngAcceptInputType_isDisabled"),d(e,"\u0275fac",function(o){return new(o||e)(Ge(hy,9),Ge(Cf,10),Ge(i4,10),Ge(_f,10),Ge(st,8),Ge(ox,8))}),d(e,"\u0275dir",T({type:e,selectors:[["","ngModel","",3,"formControlName","",3,"formControl",""]],inputs:{name:"name",isDisabled:[0,"disabled","isDisabled"],model:[0,"ngModel","model"],options:[0,"ngModelOptions","options"]},outputs:{update:"ngModelChange"},exportAs:["ngModel"],standalone:!1,features:[Z([x4]),oe,Yt]}));let t=e;return t})();var I4={provide:_f,useExisting:vi(()=>S4),multi:!0},S4=(()=>{let e=class e extends yy{writeValue(n){this.setProperty("value",parseFloat(n))}registerOnChange(n){this.onChange=r=>{n(r==""?null:parseFloat(r))}}};d(e,"\u0275fac",(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})()),d(e,"\u0275dir",T({type:e,selectors:[["input","type","range","formControlName",""],["input","type","range","formControl",""],["input","type","range","ngModel",""]],hostBindings:function(r,o){r&1&&x("change",function(a){return o.onChange(a.target.value)})("input",function(a){return o.onChange(a.target.value)})("blur",function(){return o.onTouched()})},standalone:!1,features:[Z([I4]),oe]}));let t=e;return t})();var M4=(()=>{let e=class e{constructor(){d(this,"_validator",UT);d(this,"_onChange");d(this,"_enabled")}ngOnChanges(n){if(this.inputName in n){let r=this.normalizeInput(n[this.inputName].currentValue);this._enabled=this.enabled(r),this._validator=this._enabled?this.createValidator(r):UT,this._onChange&&this._onChange()}}validate(n){return this._validator(n)}registerOnValidatorChange(n){this._onChange=n}enabled(n){return n!=null}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275dir",T({type:e,features:[Yt]}));let t=e;return t})();var A4={provide:Cf,useExisting:vi(()=>k4),multi:!0};var k4=(()=>{let e=class e extends M4{constructor(){super(...arguments);d(this,"required");d(this,"inputName","required");d(this,"normalizeInput",pf);d(this,"createValidator",r=>r4)}enabled(r){return r}};d(e,"\u0275fac",(()=>{let r;return function(s){return(r||(r=re(e)))(s||e)}})()),d(e,"\u0275dir",T({type:e,selectors:[["","required","","formControlName","",3,"type","checkbox"],["","required","","formControl","",3,"type","checkbox"],["","required","","ngModel","",3,"type","checkbox"]],hostVars:1,hostBindings:function(o,s){o&2&&Ke("required",s._enabled?"":null)},inputs:{required:"required"},standalone:!1,features:[Z([A4]),oe]}));let t=e;return t})();var O4=(()=>{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",bn({type:e})),d(e,"\u0275inj",vn({}));let t=e;return t})();var wf=(()=>{let e=class e{static withConfig(n){return{ngModule:e,providers:[{provide:ox,useValue:n.callSetDisabledState??vy}]}}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275mod",bn({type:e})),d(e,"\u0275inj",vn({imports:[O4]}));let t=e;return t})();var ux={bottom:0,height:0,left:0,right:0,top:0,width:0,x:0,y:0},Tf=new Ru;var Sa=()=>{},Wi=U(M({},ux),{toJSON:()=>ux}),Di=()=>!1,Mo=()=>!0;function N4(t,e){return Array.isArray(t)&&Array.isArray(e)&&!t.length&&!e.length}var lx=(t,e)=>t===e||N4(t,e);var xf={acceptNode(t){return"ownerSVGElement"in t?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}},Xr="\xA0",cx="\u2013";var If="\u200B";var dx="4.18.0";var Je=new k("[WA_WINDOW]",{factory:()=>{let{defaultView:t}=h(qe);if(!t)throw new Error("Window is not available");return t}}),Pn=Je,qi=new k("[WA_ANIMATION_FRAME]",{factory:()=>{let{requestAnimationFrame:t,cancelAnimationFrame:e}=h(Pn);return new te(n=>{let r=NaN,o=s=>{n.next(s),r=t(o)};return r=t(o),()=>{e(r)}}).pipe(Ri())}});var lne=new k("[WA_CACHES]",{factory:()=>h(Pn).caches});var cne=new k("[WA_CRYPTO]",{factory:()=>h(Pn).crypto});var dne=new k("[WA_CSS]",{factory:()=>h(Pn).CSS??{escape:t=>t,supports:()=>!1}});var fne=new k("[WA_HISTORY]",{factory:()=>h(Pn).history});var fx=new k("[WA_LOCAL_STORAGE]",{factory:()=>h(Pn).localStorage});var pne=new k("[WA_LOCATION]",{factory:()=>h(Pn).location});var Ao=new k("[WA_NAVIGATOR]",{factory:()=>h(Pn).navigator}),px=Ao,hne=new k("[WA_MEDIA_DEVICES]",{factory:()=>h(px).mediaDevices});var mne=new k("[WA_NETWORK_INFORMATION]",{factory:()=>h(Ao).connection||null});var gne=new k("[WA_PAGE_VISIBILITY]",{factory:()=>{let t=h(qe);return ct(t,"visibilitychange").pipe(dt(0),S(()=>t.visibilityState!=="hidden"),ke(),Li({refCount:!1,bufferSize:1}))}});var hx=new k("[WA_PERFORMANCE]",{factory:()=>h(Pn).performance});var yne=new k("[WA_SCREEN]",{factory:()=>h(Pn).screen});var vne=new k("[WA_SESSION_STORAGE]",{factory:()=>h(Pn).sessionStorage});var bne=new k("[WA_SPEECH_RECOGNITION]: [SPEECH_RECOGNITION]",{factory:()=>{let t=h(Pn);return t.speechRecognition||t.webkitSpeechRecognition||null}});var _ne=new k("[WA_SPEECH_SYNTHESIS]",{factory:()=>h(Pn).speechSynthesis});var Ma=new k("[WA_USER_AGENT]",{factory:()=>h(px).userAgent});function Jt(t,e,i){return Math.min(i,Math.max(e,t))}function al(t,e,i){return t>=e&&t=i?i:Math.round(t)}var P4=292;function F4(t,e,i){if(t===1/0)return t;e=Math.min(e,P4);let n=`${t}e`.split("e"),o=`${i(+`${n[0]}e${Number(n[1])+e}`)}e`.split("e");return+`${o[0]}e${Number(o[1])-e}`}function Dne(t,e=0){return F4(t,e,Math.round)}function gx(t,e){return t.slice(0,Math.max(e,0)).concat(t.slice(Math.max(e+1,0)))}var Tne=(t,e)=>t.replaceAll(/[^0-9A-Za-zА-Яа-я]/gi,e);function W(t){return B(()=>t)}function B(t){return t?new k("",{factory:t}):new k("")}function ul(t){return typeof t=="string"}function ko(t,e,i,n={self:!0}){let r=uf(i)?i:ge(i),o=h(t,n),s=o[`${e.toString()}Change`],l=parseInt(gT.major,10)>=19?{}:{allowSignalWrites:!0},c;return Io(()=>{var p,m;let f=r();c!==f&&(uf(o[e])?o[e].set(f):o[e]=f,(p=o.ngOnChanges)==null||p.call(o,{}),(m=s==null?void 0:s.emit)==null||m.call(s,f),c=f)},l),r}function yx(t){return t<.5?2*t*t:-1+(4-2*t)*t}function vx(t){let e=[];return t.find((i,n,r)=>(e=r,!0)),e}function by(t){return typeof t=="number"}function si(t){return t!=null}function xne(t,e,i){return t===null?e===null:e===null?!1:i(t,e)}function De(t,e,i=!1){return{provide:t,useExisting:e,multi:i}}function Zi(t,e,i){return{provide:t,useFactory:()=>M(M({},h(t,{optional:!0,skipSelf:!0})||i),h(e,{optional:!0})||e)}}function R4(t){let e=[],i=!1,n;return function(...o){return i&&e.length===o.length&&o.every((a,u)=>a===e[u])||(e=o,n=t.apply(this,o),i=!0),n}}function mx(t,e,i=!0){return function(){let r=t.call(this);return Object.defineProperty(this,e,{enumerable:i,value:r}),r}}function Ft(t,e,i){if(typeof t=="function"){let u=e;if(u.kind==="getter")return mx(t,u.name);if(u.kind==="method")return R4(t);throw new Mf}let{get:n,enumerable:r,value:o}=i,s=e;if(n)return{configurable:!0,enumerable:r,get:mx(n,s,r)};if(typeof o!="function")throw new Mf;let a=o;return{configurable:!0,enumerable:r,get(){let u=[],l=!1,c,f=(...p)=>(l&&u.length===p.length&&p.every((g,y)=>g===u[y])||(u=p,c=a.apply(this,p),l=!0),c);return Object.defineProperty(this,s,{configurable:!0,value:f}),f}}}var Mf=class extends Error{constructor(){super("")}};function ht(t){return`${t}px`}var L4=B(()=>{let t=new Map;return h(it).onDestroy(()=>t.forEach(e=>e.destroy())),t});function Dn(t){let e=h(L4),i=h(fr);e.has(t)||e.set(t,ET(t,{environmentInjector:i}))}function Aa(t){return new te(e=>{var i;return(i=t==null?void 0:t.valueChanges)==null?void 0:i.pipe(dt(t.value)).subscribe(e)})}function rt(t,e,i={}){return ct(t,e,i)}function Af(t,e=Boolean){return vu(bt(i=>e(i)?t(i):sn))}function Nne(t){return t.changes.pipe(dt(null),S(()=>vx(t)))}function bx(t){return rt(t===t.ownerDocument.documentElement?t.ownerDocument:t,"scroll")}function kf(t){return vu(Kt(Du.pipe(Se(t),Eu(()=>sn),mo(null))))}function Jr(t=h(st)){return ei(()=>t.markForCheck())}function H4(t=h(me)){return e=>new te(i=>e.subscribe({next:n=>t.run(()=>i.next(n)),error:n=>t.run(()=>i.error(n)),complete:()=>t.run(()=>i.complete())}))}function Ei(t=h(me)){return e=>new te(i=>t.runOutsideAngular(()=>e.subscribe(i)))}function ai(t=h(me)){return vu(Ei(t),H4(t))}var _y=class{constructor(e,i=Lr){this.zoneConditionFn=e,this.scheduler=i}now(){return this.scheduler.now()}schedule(...e){return this.zoneConditionFn(()=>this.scheduler.schedule(...e))}};function Fn(t=h(me),e=Lr){return new _y(t.runOutsideAngular.bind(t),e)}var _x=/^((?!chrome|android).)*safari/i,B4=/ipad|iphone|ipod/i;function Of({userAgent:t,maxTouchPoints:e}){return B4.test(t)||_x.test(t)&&e>1}var V4=new k("",{factory:()=>Of(h(Ao))}),z4=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/,j4=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/,U4=new k("",{factory:()=>z4.test(h(Ma).toLowerCase())||j4.test(h(Ma).slice(0,4).toLowerCase())}),Bne=new k("",{factory:()=>h(U4)&&!h(V4)});function Cx(t){return Of(t)||_x.test(t.userAgent)}var Vne=new k("",{factory:()=>{let t=h(Je).matchMedia("(pointer: coarse)");return Cn(ct(t,"change").pipe(S(()=>t.matches)),{initialValue:t.matches})}}),zne=new k("",{factory:()=>{var t;return!!((t=h(Je))!=null&&t.webkitConvertPointFromNodeToPage)}});var ll=[0,0,0,1];function Dx(t){let e=t.replace("#","").replace("rgba(","").replace("rgb(","").replace(")",""),i=e.split(",").map(o=>parseFloat(o));if(i.length===4)return i;if(i.length===3)return i.concat(1);let n=e.match(new RegExp(`(.{${e.length/3}})`,"g"));if(!n)return ll;let r=n.map(o=>parseInt(e.length%2?o+o:o,16));return[r[0]??ll[0],r[1]??ll[1],r[2]??ll[2],r[3]??ll[3]]}var $4=String.raw`\s*,\s*`,G4="#(?:[a-f0-9]{6}|[a-f0-9]{3})",W4=String.raw`\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*\)`,q4=String.raw`\(\s*(?:\d{1,3}\s*,\s*){2}\d{1,3}\s*,\s*\d*\.?\d+\)`,Z4=String.raw`(?:[+-]?\d*\.?\d+)(?:%|[a-z]+)?`,K4="[_a-z-][_a-z0-9-]*",Y4=["(?:",G4,"|","(?:rgb|hsl)",W4,"|","(?:rgba|hsla)",q4,"|",K4,")"],Une=[String.raw`\s*(`,...Y4,")",String.raw`(?:\s+`,"(",Z4,"))?","(?:",$4,String.raw`\s*)?`];function Oo(t){let e=W(t);return[e,i=>Zi(e,i,t)]}function Yne(t,e){try{return t.contains(e)||!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}catch{return!1}}function Q4(t){return t.matches("input")}function X4(t){return t.matches("textarea")}function wx(t){return Q4(t)||X4(t)}function ui(t){return!!t&&"nodeType"in t&&t.nodeType===Node.ELEMENT_NODE}function No(t){let e=t==null?void 0:t.ownerDocument.defaultView;return!!t&&!!e&&t instanceof e.HTMLElement}function Nf(t){return t.nodeType===Node.TEXT_NODE}function ka(t){return t.composedPath()[0]}var Ex="text/plain";function Qne(t,e=Ex){return"clipboardData"in t&&t.clipboardData!==null?t.clipboardData.getData(e)||t.clipboardData.getData(Ex):t.target.ownerDocument.defaultView.clipboardData.getData("text")}function Pf(t){return"getRootNode"in t&&t.isConnected?t.getRootNode():t.ownerDocument}function Ff(t){let{ownerDocument:e}=t;if(!(e!=null&&e.defaultView)||!t.getBoundingClientRect)return null;let{innerWidth:i,innerHeight:n}=e.defaultView,r=Pf(t),o=t.getBoundingClientRect();if(o.width===0&&o.height===0)return null;let s=Jt(Math.round(o.left)+2,0,i),a=Jt(Math.round(o.top)+2,0,n),u=Jt(Math.round(o.right)-2,0,i),l=Jt(Math.round(o.bottom)-2,0,n),c=Jt(Math.round(o.left+o.width/2),0,i),f=Jt(Math.round(o.top+o.height/2),0,n),m=[r.elementFromPoint(c,a),r.elementFromPoint(c,l),r.elementFromPoint(s,f),r.elementFromPoint(u,f)].filter(si);if(!m.length)return[];let g=m.filter(y=>!t.contains(y)&&!y.contains(t));return g.length===4?g:null}function Tx(t,e){let{offsetTop:i,offsetLeft:n,offsetParent:r}=e;for(;No(r)&&r!==t;)i+=r.offsetTop,n+=r.offsetLeft,r=r.offsetParent;return{offsetTop:i,offsetLeft:n}}function Ee(){return h(de).nativeElement}function Cy(t){return wx(t)&&!t.readOnly||!!t.isContentEditable}function Dy(t,e){var i;return Nf(t)?!!((i=t.parentElement)!=null&&i.closest(e)):ui(t)&&!!t.closest(e)}function Ey(t=0,e=0){let i={x:t,y:e,left:t,right:t,top:e,bottom:e,width:0,height:0};return U(M({},i),{toJSON:()=>i})}function xx(t){return"explicitOriginalTarget"in t?(t==null?void 0:t.explicitOriginalTarget)!==t.target:"pointerId"in t?t.pointerId===-1:"detail"in t&&"webkitForce"in t?(t==null?void 0:t.detail)===0:!1}function Rf({activeElement:t}){if(!(t!=null&&t.shadowRoot))return t;let e=t.shadowRoot.activeElement;for(;e!=null&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function rie(t){let e=Rf(t);No(e)&&e.blur()}function Ix(t){return Cn(nt(ct(t,"focusin").pipe(S(Mo)),ct(t,"focusout").pipe(S(Di))),{initialValue:!1})}function Lf(t){if(t.hasAttribute("disabled")||t.getAttribute("tabIndex")==="-1")return!1;if(No(t)&&t.isContentEditable||t.getAttribute("tabIndex")==="0")return!0;switch(t.tagName){case"A":case"LINK":return t.hasAttribute("href");case"AUDIO":case"VIDEO":return t.hasAttribute("controls");case"BUTTON":case"SELECT":case"TEXTAREA":return!0;case"INPUT":return t.getAttribute("type")!=="hidden";default:return!1}}function ys(t){return!t.hasAttribute("disabled")&&(t.getAttribute("tabIndex")==="-1"||Lf(t))}function Po({initial:t,root:e,previous:i=!1,keyboard:n=!0}){if(!e.ownerDocument)return null;let r=n?Lf:ys,o=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,xf);o.currentNode=t;do if(No(o.currentNode)&&(t=o.currentNode),No(t)&&r(t))return t;while(i?o.previousNode():o.nextNode());return null}function cl(t){return!!(t!=null&&t.ownerDocument)&&Rf(t.ownerDocument)===t&&t.ownerDocument.hasFocus()}function Ki(t){var i;let e=(t==null?void 0:t.ownerDocument)&&Rf(t.ownerDocument);return!!e&&t.contains(e)&&!!((i=t.ownerDocument)!=null&&i.hasFocus())}function Sx(t,e,i){var n;for(t+=i;t>=0&&te()),this._onDoneFns=[])}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}init(){}play(){this.hasStarted()||(this._onStart(),this.triggerMicrotask()),this._started=!0}triggerMicrotask(){queueMicrotask(()=>this._onFinish())}_onStart(){this._onStartFns.forEach(e=>e()),this._onStartFns=[]}pause(){}restart(){}finish(){this._onFinish()}destroy(){this._destroyed||(this._destroyed=!0,this.hasStarted()||this._onStart(),this.finish(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this._started=!1,this._finished=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}setPosition(e){this._position=this.totalTime?e*this.totalTime:1}getPosition(){return this.totalTime?this._position/this.totalTime:1}triggerCallback(e){let i=e=="start"?this._onStartFns:this._onDoneFns;i.forEach(n=>n()),i.length=0}},dl=class{constructor(e){d(this,"_onDoneFns",[]);d(this,"_onStartFns",[]);d(this,"_finished",!1);d(this,"_started",!1);d(this,"_destroyed",!1);d(this,"_onDestroyFns",[]);d(this,"parentPlayer",null);d(this,"totalTime",0);d(this,"players");this.players=e;let i=0,n=0,r=0,o=this.players.length;o==0?queueMicrotask(()=>this._onFinish()):this.players.forEach(s=>{s.onDone(()=>{++i==o&&this._onFinish()}),s.onDestroy(()=>{++n==o&&this._onDestroy()}),s.onStart(()=>{++r==o&&this._onStart()})}),this.totalTime=this.players.reduce((s,a)=>Math.max(s,a.totalTime),0)}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this.players.forEach(e=>e.init())}onStart(e){this._onStartFns.push(e)}_onStart(){this.hasStarted()||(this._started=!0,this._onStartFns.forEach(e=>e()),this._onStartFns=[])}onDone(e){this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}hasStarted(){return this._started}play(){this.parentPlayer||this.init(),this._onStart(),this.players.forEach(e=>e.play())}pause(){this.players.forEach(e=>e.pause())}restart(){this.players.forEach(e=>e.restart())}finish(){this._onFinish(),this.players.forEach(e=>e.finish())}destroy(){this._onDestroy()}_onDestroy(){this._destroyed||(this._destroyed=!0,this._onFinish(),this.players.forEach(e=>e.destroy()),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}reset(){this.players.forEach(e=>e.reset()),this._destroyed=!1,this._finished=!1,this._started=!1}setPosition(e){let i=e*this.totalTime;this.players.forEach(n=>{let r=n.totalTime?Math.min(1,i/n.totalTime):1;n.setPosition(r)})}getPosition(){let e=this.players.reduce((i,n)=>i===null||n.totalTime>i.totalTime?n:i,null);return e!=null?e.getPosition():0}beforeDestroy(){this.players.forEach(e=>{e.beforeDestroy&&e.beforeDestroy()})}triggerCallback(e){let i=e=="start"?this._onStartFns:this._onDoneFns;i.forEach(n=>n()),i.length=0}},Bf="!";function Ax(t){return new j(3e3,!1)}function J4(){return new j(3100,!1)}function e5(){return new j(3101,!1)}function t5(t){return new j(3001,!1)}function n5(t){return new j(3003,!1)}function i5(t){return new j(3004,!1)}function r5(t,e){return new j(3005,!1)}function o5(){return new j(3006,!1)}function s5(){return new j(3007,!1)}function a5(t,e){return new j(3008,!1)}function u5(t){return new j(3002,!1)}function l5(t,e,i,n,r){return new j(3010,!1)}function c5(){return new j(3011,!1)}function d5(){return new j(3012,!1)}function f5(){return new j(3200,!1)}function p5(){return new j(3202,!1)}function h5(){return new j(3013,!1)}function m5(t){return new j(3014,!1)}function g5(t){return new j(3015,!1)}function y5(t){return new j(3016,!1)}function v5(t,e){return new j(3404,!1)}function b5(t){return new j(3502,!1)}function _5(t){return new j(3503,!1)}function C5(){return new j(3300,!1)}function D5(t){return new j(3504,!1)}function E5(t){return new j(3301,!1)}function w5(t,e){return new j(3302,!1)}function T5(t){return new j(3303,!1)}function x5(t,e){return new j(3400,!1)}function I5(t){return new j(3401,!1)}function S5(t){return new j(3402,!1)}function M5(t,e){return new j(3505,!1)}function Ro(t){switch(t.length){case 0:return new Fo;case 1:return t[0];default:return new dl(t)}}function qx(t,e,i=new Map,n=new Map){let r=[],o=[],s=-1,a=null;if(e.forEach(u=>{let l=u.get("offset"),c=l==s,f=c&&a||new Map;u.forEach((p,m)=>{let g=m,y=p;if(m!=="offset")switch(g=t.normalizePropertyName(g,r),y){case Bf:y=i.get(m);break;case Cr:y=n.get(m);break;default:y=t.normalizeStyleValue(m,g,y,r);break}f.set(g,y)}),c||o.push(f),a=f,s=l}),r.length)throw b5(r);return o}function qy(t,e,i,n){switch(e){case"start":t.onStart(()=>n(i&&wy(i,"start",t)));break;case"done":t.onDone(()=>n(i&&wy(i,"done",t)));break;case"destroy":t.onDestroy(()=>n(i&&wy(i,"destroy",t)));break}}function wy(t,e,i){let n=i.totalTime,r=!!i.disabled,o=Zy(t.element,t.triggerName,t.fromState,t.toState,e||t.phaseName,n??t.totalTime,r),s=t._data;return s!=null&&(o._data=s),o}function Zy(t,e,i,n,r="",o=0,s){return{element:t,triggerName:e,fromState:i,toState:n,phaseName:r,totalTime:o,disabled:!!s}}function ci(t,e,i){let n=t.get(e);return n||t.set(e,n=i),n}function kx(t){let e=t.indexOf(":"),i=t.substring(1,e),n=t.slice(e+1);return[i,n]}var A5=typeof document>"u"?null:document.documentElement;function Ky(t){let e=t.parentNode||t.host||null;return e===A5?null:e}function k5(t){return t.substring(1,6)=="ebkit"}var vs=null,Ox=!1;function O5(t){vs||(vs=N5()||{},Ox=vs.style?"WebkitAppearance"in vs.style:!1);let e=!0;return vs.style&&!k5(t)&&(e=t in vs.style,!e&&Ox&&(e="Webkit"+t.charAt(0).toUpperCase()+t.slice(1)in vs.style)),e}function N5(){return typeof document<"u"?document.body:null}function Zx(t,e){for(;e;){if(e===t)return!0;e=Ky(e)}return!1}function Kx(t,e,i){if(i)return Array.from(t.querySelectorAll(e));let n=t.querySelector(e);return n?[n]:[]}var P5=(()=>{let e=class e{validateStyleProperty(n){return O5(n)}containsElement(n,r){return Zx(n,r)}getParentElement(n){return Ky(n)}query(n,r,o){return Kx(n,r,o)}computeStyle(n,r,o){return o||""}animate(n,r,o,s,a,u=[],l){return new Fo(o,s)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),Ty=class{};d(Ty,"NOOP",new P5);var ky=class{};var F5=1e3,Yx="{{",R5="}}",Qx="ng-enter",Oy="ng-leave",Vf="ng-trigger",Gf=".ng-trigger",Nx="ng-animating",Ny=".ng-animating";function eo(t){if(typeof t=="number")return t;let e=t.match(/^(-?[\.\d]+)(m?s)/);return!e||e.length<2?0:Py(parseFloat(e[1]),e[2])}function Py(t,e){switch(e){case"s":return t*F5;default:return t}}function Wf(t,e,i){return t.hasOwnProperty("duration")?t:L5(t,e,i)}function L5(t,e,i){let n=/^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i,r,o=0,s="";if(typeof t=="string"){let a=t.match(n);if(a===null)return e.push(Ax(t)),{duration:0,delay:0,easing:""};r=Py(parseFloat(a[1]),a[2]);let u=a[3];u!=null&&(o=Py(parseFloat(u),a[4]));let l=a[5];l&&(s=l)}else r=t;if(!i){let a=!1,u=e.length;r<0&&(e.push(J4()),a=!0),o<0&&(e.push(e5()),a=!0),a&&e.splice(u,0,Ax(t))}return{duration:r,delay:o,easing:s}}function H5(t){return t.length?t[0]instanceof Map?t:t.map(e=>new Map(Object.entries(e))):[]}function Dr(t,e,i){e.forEach((n,r)=>{let o=Yy(r);i&&!i.has(r)&&i.set(r,t.style[o]),t.style[o]=n})}function _s(t,e){e.forEach((i,n)=>{let r=Yy(n);t.style[r]=""})}function fl(t){return Array.isArray(t)?t.length==1?t[0]:Mx(t):t}function B5(t,e,i){let n=e.params||{},r=Xx(t);r.length&&r.forEach(o=>{n.hasOwnProperty(o)||i.push(t5(o))})}var Fy=new RegExp(`${Yx}\\s*(.+?)\\s*${R5}`,"g");function Xx(t){let e=[];if(typeof t=="string"){let i;for(;i=Fy.exec(t);)e.push(i[1]);Fy.lastIndex=0}return e}function hl(t,e,i){let n=`${t}`,r=n.replace(Fy,(o,s)=>{let a=e[s];return a==null&&(i.push(n5(s)),a=""),a.toString()});return r==n?t:r}var V5=/-+([a-z0-9])/g;function Yy(t){return t.replace(V5,(...e)=>e[1].toUpperCase())}function z5(t,e){return t===0||e===0}function j5(t,e,i){if(i.size&&e.length){let n=e[0],r=[];if(i.forEach((o,s)=>{n.has(s)||r.push(s),n.set(s,o)}),r.length)for(let o=1;os.set(a,Qy(t,a)))}}return e}function li(t,e,i){switch(e.type){case we.Trigger:return t.visitTrigger(e,i);case we.State:return t.visitState(e,i);case we.Transition:return t.visitTransition(e,i);case we.Sequence:return t.visitSequence(e,i);case we.Group:return t.visitGroup(e,i);case we.Animate:return t.visitAnimate(e,i);case we.Keyframes:return t.visitKeyframes(e,i);case we.Style:return t.visitStyle(e,i);case we.Reference:return t.visitReference(e,i);case we.AnimateChild:return t.visitAnimateChild(e,i);case we.AnimateRef:return t.visitAnimateRef(e,i);case we.Query:return t.visitQuery(e,i);case we.Stagger:return t.visitStagger(e,i);default:throw i5(e.type)}}function Qy(t,e){return window.getComputedStyle(t)[e]}var U5=new Set(["width","height","minWidth","minHeight","maxWidth","maxHeight","left","top","bottom","right","fontSize","outlineWidth","outlineOffset","paddingTop","paddingLeft","paddingBottom","paddingRight","marginTop","marginLeft","marginBottom","marginRight","borderRadius","borderWidth","borderTopWidth","borderLeftWidth","borderRightWidth","borderBottomWidth","textIndent","perspective"]),Px=class extends ky{normalizePropertyName(e,i){return Yy(e)}normalizeStyleValue(e,i,n,r){let o="",s=n.toString().trim();if(U5.has(i)&&n!==0&&n!=="0")if(typeof n=="number")o="px";else{let a=n.match(/^[+-]?[\d\.]+([a-z]*)$/);a&&a[1].length==0&&r.push(r5(e,n))}return s+o}};var qf="*";function $5(t,e){let i=[];return typeof t=="string"?t.split(/\s*,\s*/).forEach(n=>G5(n,i,e)):i.push(t),i}function G5(t,e,i){if(t[0]==":"){let u=W5(t,i);if(typeof u=="function"){e.push(u);return}t=u}let n=t.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/);if(n==null||n.length<4)return i.push(g5(t)),e;let r=n[1],o=n[2],s=n[3];e.push(Fx(r,s));let a=r==qf&&s==qf;o[0]=="<"&&!a&&e.push(Fx(s,r))}function W5(t,e){switch(t){case":enter":return"void => *";case":leave":return"* => void";case":increment":return(i,n)=>parseFloat(n)>parseFloat(i);case":decrement":return(i,n)=>parseFloat(n) *"}}var zf=new Set(["true","1"]),jf=new Set(["false","0"]);function Fx(t,e){let i=zf.has(t)||jf.has(t),n=zf.has(e)||jf.has(e);return(r,o)=>{let s=t==qf||t==r,a=e==qf||e==o;return!s&&i&&typeof r=="boolean"&&(s=r?zf.has(t):jf.has(t)),!a&&n&&typeof o=="boolean"&&(a=o?zf.has(e):jf.has(e)),s&&a}}var Jx=":self",q5=new RegExp(`s*${Jx}s*,?`,"g");function eI(t,e,i,n){return new Ry(t).build(e,i,n)}var Rx="",Ry=class{constructor(e){d(this,"_driver");this._driver=e}build(e,i,n){let r=new Ly(i);return this._resetContextStyleTimingState(r),li(this,fl(e),r)}_resetContextStyleTimingState(e){e.currentQuerySelector=Rx,e.collectedStyles=new Map,e.collectedStyles.set(Rx,new Map),e.currentTime=0}visitTrigger(e,i){let n=i.queryCount=0,r=i.depCount=0,o=[],s=[];return e.name.charAt(0)=="@"&&i.errors.push(o5()),e.definitions.forEach(a=>{if(this._resetContextStyleTimingState(i),a.type==we.State){let u=a,l=u.name;l.toString().split(/\s*,\s*/).forEach(c=>{u.name=c,o.push(this.visitState(u,i))}),u.name=l}else if(a.type==we.Transition){let u=this.visitTransition(a,i);n+=u.queryCount,r+=u.depCount,s.push(u)}else i.errors.push(s5())}),{type:we.Trigger,name:e.name,states:o,transitions:s,queryCount:n,depCount:r,options:null}}visitState(e,i){let n=this.visitStyle(e.styles,i),r=e.options&&e.options.params||null;if(n.containsDynamicStyles){let o=new Set,s=r||{};n.styles.forEach(a=>{a instanceof Map&&a.forEach(u=>{Xx(u).forEach(l=>{s.hasOwnProperty(l)||o.add(l)})})}),o.size&&i.errors.push(a5(e.name,[...o.values()]))}return{type:we.State,name:e.name,style:n,options:r?{params:r}:null}}visitTransition(e,i){i.queryCount=0,i.depCount=0;let n=li(this,fl(e.animation),i),r=$5(e.expr,i.errors);return{type:we.Transition,matchers:r,animation:n,queryCount:i.queryCount,depCount:i.depCount,options:bs(e.options)}}visitSequence(e,i){return{type:we.Sequence,steps:e.steps.map(n=>li(this,n,i)),options:bs(e.options)}}visitGroup(e,i){let n=i.currentTime,r=0,o=e.steps.map(s=>{i.currentTime=n;let a=li(this,s,i);return r=Math.max(r,i.currentTime),a});return i.currentTime=r,{type:we.Group,steps:o,options:bs(e.options)}}visitAnimate(e,i){let n=Q5(e.timings,i.errors);i.currentAnimateTimings=n;let r,o=e.styles?e.styles:R({});if(o.type==we.Keyframes)r=this.visitKeyframes(o,i);else{let s=e.styles,a=!1;if(!s){a=!0;let l={};n.easing&&(l.easing=n.easing),s=R(l)}i.currentTime+=n.duration+n.delay;let u=this.visitStyle(s,i);u.isEmptyStep=a,r=u}return i.currentAnimateTimings=null,{type:we.Animate,timings:n,style:r,options:null}}visitStyle(e,i){let n=this._makeStyleAst(e,i);return this._validateStyleAst(n,i),n}_makeStyleAst(e,i){let n=[],r=Array.isArray(e.styles)?e.styles:[e.styles];for(let a of r)typeof a=="string"?a===Cr?n.push(a):i.errors.push(u5(a)):n.push(new Map(Object.entries(a)));let o=!1,s=null;return n.forEach(a=>{if(a instanceof Map&&(a.has("easing")&&(s=a.get("easing"),a.delete("easing")),!o)){for(let u of a.values())if(u.toString().indexOf(Yx)>=0){o=!0;break}}}),{type:we.Style,styles:n,easing:s,offset:e.offset,containsDynamicStyles:o,options:null}}_validateStyleAst(e,i){let n=i.currentAnimateTimings,r=i.currentTime,o=i.currentTime;n&&o>0&&(o-=n.duration+n.delay),e.styles.forEach(s=>{typeof s!="string"&&s.forEach((a,u)=>{let l=i.collectedStyles.get(i.currentQuerySelector),c=l.get(u),f=!0;c&&(o!=r&&o>=c.startTime&&r<=c.endTime&&(i.errors.push(l5(u,c.startTime,c.endTime,o,r)),f=!1),o=c.startTime),f&&l.set(u,{startTime:o,endTime:r}),i.options&&B5(a,i.options,i.errors)})})}visitKeyframes(e,i){let n={type:we.Keyframes,styles:[],options:null};if(!i.currentAnimateTimings)return i.errors.push(c5()),n;let r=1,o=0,s=[],a=!1,u=!1,l=0,c=e.steps.map(D=>{let I=this._makeStyleAst(D,i),N=I.offset!=null?I.offset:Y5(I.styles),A=0;return N!=null&&(o++,A=I.offset=N),u=u||A<0||A>1,a=a||A0&&o{let N=p>0?I==m?1:p*I:s[I],A=N*b;i.currentTime=g+y.delay+A,y.duration=A,this._validateStyleAst(D,i),D.offset=N,n.styles.push(D)}),n}visitReference(e,i){return{type:we.Reference,animation:li(this,fl(e.animation),i),options:bs(e.options)}}visitAnimateChild(e,i){return i.depCount++,{type:we.AnimateChild,options:bs(e.options)}}visitAnimateRef(e,i){return{type:we.AnimateRef,animation:this.visitReference(e.animation,i),options:bs(e.options)}}visitQuery(e,i){let n=i.currentQuerySelector,r=e.options||{};i.queryCount++,i.currentQuery=e;let[o,s]=Z5(e.selector);i.currentQuerySelector=n.length?n+" "+o:o,ci(i.collectedStyles,i.currentQuerySelector,new Map);let a=li(this,fl(e.animation),i);return i.currentQuery=null,i.currentQuerySelector=n,{type:we.Query,selector:o,limit:r.limit||0,optional:!!r.optional,includeSelf:s,animation:a,originalSelector:e.selector,options:bs(e.options)}}visitStagger(e,i){i.currentQuery||i.errors.push(h5());let n=e.timings==="full"?{duration:0,delay:0,easing:"full"}:Wf(e.timings,i.errors,!0);return{type:we.Stagger,animation:li(this,fl(e.animation),i),timings:n,options:null}}};function Z5(t){let e=!!t.split(/\s*,\s*/).find(i=>i==Jx);return e&&(t=t.replace(q5,"")),t=t.replace(/@\*/g,Gf).replace(/@\w+/g,i=>Gf+"-"+i.slice(1)).replace(/:animating/g,Ny),[t,e]}function K5(t){return t?M({},t):null}var Ly=class{constructor(e){d(this,"errors");d(this,"queryCount",0);d(this,"depCount",0);d(this,"currentTransition",null);d(this,"currentQuery",null);d(this,"currentQuerySelector",null);d(this,"currentAnimateTimings",null);d(this,"currentTime",0);d(this,"collectedStyles",new Map);d(this,"options",null);d(this,"unsupportedCSSPropertiesFound",new Set);this.errors=e}};function Y5(t){if(typeof t=="string")return null;let e=null;if(Array.isArray(t))t.forEach(i=>{if(i instanceof Map&&i.has("offset")){let n=i;e=parseFloat(n.get("offset")),n.delete("offset")}});else if(t instanceof Map&&t.has("offset")){let i=t;e=parseFloat(i.get("offset")),i.delete("offset")}return e}function Q5(t,e){if(t.hasOwnProperty("duration"))return t;if(typeof t=="number"){let o=Wf(t,e).duration;return xy(o,0,"")}let i=t;if(i.split(/\s+/).some(o=>o.charAt(0)=="{"&&o.charAt(1)=="{")){let o=xy(0,0,"");return o.dynamic=!0,o.strValue=i,o}let r=Wf(i,e);return xy(r.duration,r.delay,r.easing)}function bs(t){return t?(t=M({},t),t.params&&(t.params=K5(t.params))):t={},t}function xy(t,e,i){return{duration:t,delay:e,easing:i}}function Xy(t,e,i,n,r,o,s=null,a=!1){return{type:1,element:t,keyframes:e,preStyleProps:i,postStyleProps:n,duration:r,delay:o,totalTime:r+o,easing:s,subTimeline:a}}var ml=class{constructor(){d(this,"_map",new Map)}get(e){return this._map.get(e)||[]}append(e,i){let n=this._map.get(e);n||this._map.set(e,n=[]),n.push(...i)}has(e){return this._map.has(e)}clear(){this._map.clear()}},X5=1,J5=":enter",e8=new RegExp(J5,"g"),t8=":leave",n8=new RegExp(t8,"g");function tI(t,e,i,n,r,o=new Map,s=new Map,a,u,l=[]){return new Hy().buildKeyframes(t,e,i,n,r,o,s,a,u,l)}var Hy=class{buildKeyframes(e,i,n,r,o,s,a,u,l,c=[]){l=l||new ml;let f=new By(e,i,l,r,o,c,[]);f.options=u;let p=u.delay?eo(u.delay):0;f.currentTimeline.delayNextStep(p),f.currentTimeline.setStyles([s],null,f.errors,u),li(this,n,f);let m=f.timelines.filter(g=>g.containsAnimation());if(m.length&&a.size){let g;for(let y=m.length-1;y>=0;y--){let b=m[y];if(b.element===i){g=b;break}}g&&!g.allowOnlyTimelineStyles()&&g.setStyles([a],null,f.errors,u)}return m.length?m.map(g=>g.buildKeyframes()):[Xy(i,[],[],[],0,p,"",!1)]}visitTrigger(e,i){}visitState(e,i){}visitTransition(e,i){}visitAnimateChild(e,i){let n=i.subInstructions.get(i.element);if(n){let r=i.createSubContext(e.options),o=i.currentTimeline.currentTime,s=this._visitSubInstructions(n,r,r.options);o!=s&&i.transformIntoNewTimeline(s)}i.previousNode=e}visitAnimateRef(e,i){let n=i.createSubContext(e.options);n.transformIntoNewTimeline(),this._applyAnimationRefDelays([e.options,e.animation.options],i,n),this.visitReference(e.animation,n),i.transformIntoNewTimeline(n.currentTimeline.currentTime),i.previousNode=e}_applyAnimationRefDelays(e,i,n){for(let r of e){let o=r==null?void 0:r.delay;if(o){let s=typeof o=="number"?o:eo(hl(o,(r==null?void 0:r.params)??{},i.errors));n.delayNextStep(s)}}}_visitSubInstructions(e,i,n){let o=i.currentTimeline.currentTime,s=n.duration!=null?eo(n.duration):null,a=n.delay!=null?eo(n.delay):null;return s!==0&&e.forEach(u=>{let l=i.appendInstructionToTimeline(u,s,a);o=Math.max(o,l.duration+l.delay)}),o}visitReference(e,i){i.updateOptions(e.options,!0),li(this,e.animation,i),i.previousNode=e}visitSequence(e,i){let n=i.subContextCount,r=i,o=e.options;if(o&&(o.params||o.delay)&&(r=i.createSubContext(o),r.transformIntoNewTimeline(),o.delay!=null)){r.previousNode.type==we.Style&&(r.currentTimeline.snapshotCurrentStyles(),r.previousNode=Zf);let s=eo(o.delay);r.delayNextStep(s)}e.steps.length&&(e.steps.forEach(s=>li(this,s,r)),r.currentTimeline.applyStylesToKeyframe(),r.subContextCount>n&&r.transformIntoNewTimeline()),i.previousNode=e}visitGroup(e,i){let n=[],r=i.currentTimeline.currentTime,o=e.options&&e.options.delay?eo(e.options.delay):0;e.steps.forEach(s=>{let a=i.createSubContext(e.options);o&&a.delayNextStep(o),li(this,s,a),r=Math.max(r,a.currentTimeline.currentTime),n.push(a.currentTimeline)}),n.forEach(s=>i.currentTimeline.mergeTimelineCollectedStyles(s)),i.transformIntoNewTimeline(r),i.previousNode=e}_visitTiming(e,i){if(e.dynamic){let n=e.strValue,r=i.params?hl(n,i.params,i.errors):n;return Wf(r,i.errors)}else return{duration:e.duration,delay:e.delay,easing:e.easing}}visitAnimate(e,i){let n=i.currentAnimateTimings=this._visitTiming(e.timings,i),r=i.currentTimeline;n.delay&&(i.incrementTime(n.delay),r.snapshotCurrentStyles());let o=e.style;o.type==we.Keyframes?this.visitKeyframes(o,i):(i.incrementTime(n.duration),this.visitStyle(o,i),r.applyStylesToKeyframe()),i.currentAnimateTimings=null,i.previousNode=e}visitStyle(e,i){let n=i.currentTimeline,r=i.currentAnimateTimings;!r&&n.hasCurrentStyleProperties()&&n.forwardFrame();let o=r&&r.easing||e.easing;e.isEmptyStep?n.applyEmptyStep(o):n.setStyles(e.styles,o,i.errors,i.options),i.previousNode=e}visitKeyframes(e,i){let n=i.currentAnimateTimings,r=i.currentTimeline.duration,o=n.duration,a=i.createSubContext().currentTimeline;a.easing=n.easing,e.styles.forEach(u=>{let l=u.offset||0;a.forwardTime(l*o),a.setStyles(u.styles,u.easing,i.errors,i.options),a.applyStylesToKeyframe()}),i.currentTimeline.mergeTimelineCollectedStyles(a),i.transformIntoNewTimeline(r+o),i.previousNode=e}visitQuery(e,i){let n=i.currentTimeline.currentTime,r=e.options||{},o=r.delay?eo(r.delay):0;o&&(i.previousNode.type===we.Style||n==0&&i.currentTimeline.hasCurrentStyleProperties())&&(i.currentTimeline.snapshotCurrentStyles(),i.previousNode=Zf);let s=n,a=i.invokeQuery(e.selector,e.originalSelector,e.limit,e.includeSelf,!!r.optional,i.errors);i.currentQueryTotal=a.length;let u=null;a.forEach((l,c)=>{i.currentQueryIndex=c;let f=i.createSubContext(e.options,l);o&&f.delayNextStep(o),l===i.element&&(u=f.currentTimeline),li(this,e.animation,f),f.currentTimeline.applyStylesToKeyframe();let p=f.currentTimeline.currentTime;s=Math.max(s,p)}),i.currentQueryIndex=0,i.currentQueryTotal=0,i.transformIntoNewTimeline(s),u&&(i.currentTimeline.mergeTimelineCollectedStyles(u),i.currentTimeline.snapshotCurrentStyles()),i.previousNode=e}visitStagger(e,i){let n=i.parentContext,r=i.currentTimeline,o=e.timings,s=Math.abs(o.duration),a=s*(i.currentQueryTotal-1),u=s*i.currentQueryIndex;switch(o.duration<0?"reverse":o.easing){case"reverse":u=a-u;break;case"full":u=n.currentStaggerTime;break}let c=i.currentTimeline;u&&c.delayNextStep(u);let f=c.currentTime;li(this,e.animation,i),i.previousNode=e,n.currentStaggerTime=r.currentTime-f+(r.startTime-n.currentTimeline.startTime)}},Zf={},By=class t{constructor(e,i,n,r,o,s,a,u){d(this,"_driver");d(this,"element");d(this,"subInstructions");d(this,"_enterClassName");d(this,"_leaveClassName");d(this,"errors");d(this,"timelines");d(this,"parentContext",null);d(this,"currentTimeline");d(this,"currentAnimateTimings",null);d(this,"previousNode",Zf);d(this,"subContextCount",0);d(this,"options",{});d(this,"currentQueryIndex",0);d(this,"currentQueryTotal",0);d(this,"currentStaggerTime",0);this._driver=e,this.element=i,this.subInstructions=n,this._enterClassName=r,this._leaveClassName=o,this.errors=s,this.timelines=a,this.currentTimeline=u||new Kf(this._driver,i,0),a.push(this.currentTimeline)}get params(){return this.options.params}updateOptions(e,i){if(!e)return;let n=e,r=this.options;n.duration!=null&&(r.duration=eo(n.duration)),n.delay!=null&&(r.delay=eo(n.delay));let o=n.params;if(o){let s=r.params;s||(s=this.options.params={}),Object.keys(o).forEach(a=>{(!i||!s.hasOwnProperty(a))&&(s[a]=hl(o[a],s,this.errors))})}}_copyOptions(){let e={};if(this.options){let i=this.options.params;if(i){let n=e.params={};Object.keys(i).forEach(r=>{n[r]=i[r]})}}return e}createSubContext(e=null,i,n){let r=i||this.element,o=new t(this._driver,r,this.subInstructions,this._enterClassName,this._leaveClassName,this.errors,this.timelines,this.currentTimeline.fork(r,n||0));return o.previousNode=this.previousNode,o.currentAnimateTimings=this.currentAnimateTimings,o.options=this._copyOptions(),o.updateOptions(e),o.currentQueryIndex=this.currentQueryIndex,o.currentQueryTotal=this.currentQueryTotal,o.parentContext=this,this.subContextCount++,o}transformIntoNewTimeline(e){return this.previousNode=Zf,this.currentTimeline=this.currentTimeline.fork(this.element,e),this.timelines.push(this.currentTimeline),this.currentTimeline}appendInstructionToTimeline(e,i,n){let r={duration:i??e.duration,delay:this.currentTimeline.currentTime+(n??0)+e.delay,easing:""},o=new Vy(this._driver,e.element,e.keyframes,e.preStyleProps,e.postStyleProps,r,e.stretchStartingKeyframe);return this.timelines.push(o),r}incrementTime(e){this.currentTimeline.forwardTime(this.currentTimeline.duration+e)}delayNextStep(e){e>0&&this.currentTimeline.delayNextStep(e)}invokeQuery(e,i,n,r,o,s){let a=[];if(r&&a.push(this.element),e.length>0){e=e.replace(e8,"."+this._enterClassName),e=e.replace(n8,"."+this._leaveClassName);let u=n!=1,l=this._driver.query(this.element,e,u);n!==0&&(l=n<0?l.slice(l.length+n,l.length):l.slice(0,n)),a.push(...l)}return!o&&a.length==0&&s.push(m5(i)),a}},Kf=class t{constructor(e,i,n,r){d(this,"_driver");d(this,"element");d(this,"startTime");d(this,"_elementTimelineStylesLookup");d(this,"duration",0);d(this,"easing",null);d(this,"_previousKeyframe",new Map);d(this,"_currentKeyframe",new Map);d(this,"_keyframes",new Map);d(this,"_styleSummary",new Map);d(this,"_localTimelineStyles",new Map);d(this,"_globalTimelineStyles");d(this,"_pendingStyles",new Map);d(this,"_backFill",new Map);d(this,"_currentEmptyStepKeyframe",null);this._driver=e,this.element=i,this.startTime=n,this._elementTimelineStylesLookup=r,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(i),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(i,this._localTimelineStyles)),this._loadKeyframe()}containsAnimation(){switch(this._keyframes.size){case 0:return!1;case 1:return this.hasCurrentStyleProperties();default:return!0}}hasCurrentStyleProperties(){return this._currentKeyframe.size>0}get currentTime(){return this.startTime+this.duration}delayNextStep(e){let i=this._keyframes.size===1&&this._pendingStyles.size;this.duration||i?(this.forwardTime(this.currentTime+e),i&&this.snapshotCurrentStyles()):this.startTime+=e}fork(e,i){return this.applyStylesToKeyframe(),new t(this._driver,e,i||this.currentTime,this._elementTimelineStylesLookup)}_loadKeyframe(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=new Map,this._keyframes.set(this.duration,this._currentKeyframe))}forwardFrame(){this.duration+=X5,this._loadKeyframe()}forwardTime(e){this.applyStylesToKeyframe(),this.duration=e,this._loadKeyframe()}_updateStyle(e,i){this._localTimelineStyles.set(e,i),this._globalTimelineStyles.set(e,i),this._styleSummary.set(e,{time:this.currentTime,value:i})}allowOnlyTimelineStyles(){return this._currentEmptyStepKeyframe!==this._currentKeyframe}applyEmptyStep(e){e&&this._previousKeyframe.set("easing",e);for(let[i,n]of this._globalTimelineStyles)this._backFill.set(i,n||Cr),this._currentKeyframe.set(i,Cr);this._currentEmptyStepKeyframe=this._currentKeyframe}setStyles(e,i,n,r){i&&this._previousKeyframe.set("easing",i);let o=r&&r.params||{},s=i8(e,this._globalTimelineStyles);for(let[a,u]of s){let l=hl(u,o,n);this._pendingStyles.set(a,l),this._localTimelineStyles.has(a)||this._backFill.set(a,this._globalTimelineStyles.get(a)??Cr),this._updateStyle(a,l)}}applyStylesToKeyframe(){this._pendingStyles.size!=0&&(this._pendingStyles.forEach((e,i)=>{this._currentKeyframe.set(i,e)}),this._pendingStyles.clear(),this._localTimelineStyles.forEach((e,i)=>{this._currentKeyframe.has(i)||this._currentKeyframe.set(i,e)}))}snapshotCurrentStyles(){for(let[e,i]of this._localTimelineStyles)this._pendingStyles.set(e,i),this._updateStyle(e,i)}getFinalKeyframe(){return this._keyframes.get(this.duration)}get properties(){let e=[];for(let i in this._currentKeyframe)e.push(i);return e}mergeTimelineCollectedStyles(e){e._styleSummary.forEach((i,n)=>{let r=this._styleSummary.get(n);(!r||i.time>r.time)&&this._updateStyle(n,i.value)})}buildKeyframes(){this.applyStylesToKeyframe();let e=new Set,i=new Set,n=this._keyframes.size===1&&this.duration===0,r=[];this._keyframes.forEach((a,u)=>{let l=new Map([...this._backFill,...a]);l.forEach((c,f)=>{c===Bf?e.add(f):c===Cr&&i.add(f)}),n||l.set("offset",u/this.duration),r.push(l)});let o=[...e.values()],s=[...i.values()];if(n){let a=r[0],u=new Map(a);a.set("offset",0),u.set("offset",1),r=[a,u]}return Xy(this.element,r,o,s,this.duration,this.startTime,this.easing,!1)}},Vy=class extends Kf{constructor(i,n,r,o,s,a,u=!1){super(i,n,a.delay);d(this,"keyframes");d(this,"preStyleProps");d(this,"postStyleProps");d(this,"_stretchStartingKeyframe");d(this,"timings");this.keyframes=r,this.preStyleProps=o,this.postStyleProps=s,this._stretchStartingKeyframe=u,this.timings={duration:a.duration,delay:a.delay,easing:a.easing}}containsAnimation(){return this.keyframes.length>1}buildKeyframes(){let i=this.keyframes,{delay:n,duration:r,easing:o}=this.timings;if(this._stretchStartingKeyframe&&n){let s=[],a=r+n,u=n/a,l=new Map(i[0]);l.set("offset",0),s.push(l);let c=new Map(i[0]);c.set("offset",Lx(u)),s.push(c);let f=i.length-1;for(let p=1;p<=f;p++){let m=new Map(i[p]),g=m.get("offset"),y=n+g*r;m.set("offset",Lx(y/a)),s.push(m)}r=a,n=0,o="",i=s}return Xy(this.element,i,this.preStyleProps,this.postStyleProps,r,n,o,!0)}};function Lx(t,e=3){let i=Math.pow(10,e-1);return Math.round(t*i)/i}function i8(t,e){let i=new Map,n;return t.forEach(r=>{if(r==="*"){n??(n=e.keys());for(let o of n)i.set(o,Cr)}else for(let[o,s]of r)i.set(o,s)}),i}function Hx(t,e,i,n,r,o,s,a,u,l,c,f,p){return{type:0,element:t,triggerName:e,isRemovalTransition:r,fromState:i,fromStyles:o,toState:n,toStyles:s,timelines:a,queriedElements:u,preStyleProps:l,postStyleProps:c,totalTime:f,errors:p}}var Iy={},Yf=class{constructor(e,i,n){d(this,"_triggerName");d(this,"ast");d(this,"_stateStyles");this._triggerName=e,this.ast=i,this._stateStyles=n}match(e,i,n,r){return r8(this.ast.matchers,e,i,n,r)}buildStyles(e,i,n){let r=this._stateStyles.get("*");return e!==void 0&&(r=this._stateStyles.get(e==null?void 0:e.toString())||r),r?r.buildStyles(i,n):new Map}build(e,i,n,r,o,s,a,u,l,c){var Pe;let f=[],p=this.ast.options&&this.ast.options.params||Iy,m=a&&a.params||Iy,g=this.buildStyles(n,m,f),y=u&&u.params||Iy,b=this.buildStyles(r,y,f),D=new Set,I=new Map,N=new Map,A=r==="void",V={params:nI(y,p),delay:(Pe=this.ast.options)==null?void 0:Pe.delay},z=c?[]:tI(e,i,this.ast.animation,o,s,g,b,V,l,f),ae=0;return z.forEach(mt=>{ae=Math.max(mt.duration+mt.delay,ae)}),f.length?Hx(i,this._triggerName,n,r,A,g,b,[],[],I,N,ae,f):(z.forEach(mt=>{let At=mt.element,Oi=ci(I,At,new Set);mt.preStyleProps.forEach(hi=>Oi.add(hi));let Ni=ci(N,At,new Set);mt.postStyleProps.forEach(hi=>Ni.add(hi)),At!==i&&D.add(At)}),Hx(i,this._triggerName,n,r,A,g,b,z,[...D.values()],I,N,ae))}};function r8(t,e,i,n,r){return t.some(o=>o(e,i,n,r))}function nI(t,e){let i=M({},e);return Object.entries(t).forEach(([n,r])=>{r!=null&&(i[n]=r)}),i}var zy=class{constructor(e,i,n){d(this,"styles");d(this,"defaultParams");d(this,"normalizer");this.styles=e,this.defaultParams=i,this.normalizer=n}buildStyles(e,i){let n=new Map,r=nI(e,this.defaultParams);return this.styles.styles.forEach(o=>{typeof o!="string"&&o.forEach((s,a)=>{s&&(s=hl(s,r,i));let u=this.normalizer.normalizePropertyName(a,i);s=this.normalizer.normalizeStyleValue(a,u,s,i),n.set(a,s)})}),n}};function o8(t,e,i){return new jy(t,e,i)}var jy=class{constructor(e,i,n){d(this,"name");d(this,"ast");d(this,"_normalizer");d(this,"transitionFactories",[]);d(this,"fallbackTransition");d(this,"states",new Map);this.name=e,this.ast=i,this._normalizer=n,i.states.forEach(r=>{let o=r.options&&r.options.params||{};this.states.set(r.name,new zy(r.style,o,n))}),Bx(this.states,"true","1"),Bx(this.states,"false","0"),i.transitions.forEach(r=>{this.transitionFactories.push(new Yf(e,r,this.states))}),this.fallbackTransition=s8(e,this.states,this._normalizer)}get containsQueries(){return this.ast.queryCount>0}matchTransition(e,i,n,r){return this.transitionFactories.find(s=>s.match(e,i,n,r))||null}matchStyles(e,i,n){return this.fallbackTransition.buildStyles(e,i,n)}};function s8(t,e,i){let n=[(s,a)=>!0],r={type:we.Sequence,steps:[],options:null},o={type:we.Transition,animation:r,matchers:n,options:null,queryCount:0,depCount:0};return new Yf(t,o,e)}function Bx(t,e,i){t.has(e)?t.has(i)||t.set(i,t.get(e)):t.has(i)&&t.set(e,t.get(i))}var a8=new ml,Uy=class{constructor(e,i,n){d(this,"bodyNode");d(this,"_driver");d(this,"_normalizer");d(this,"_animations",new Map);d(this,"_playersById",new Map);d(this,"players",[]);this.bodyNode=e,this._driver=i,this._normalizer=n}register(e,i){let n=[],r=[],o=eI(this._driver,i,n,r);if(n.length)throw _5(n);r.length&&void 0,this._animations.set(e,o)}_buildPlayer(e,i,n){let r=e.element,o=qx(this._normalizer,e.keyframes,i,n);return this._driver.animate(r,o,e.duration,e.delay,e.easing,[],!0)}create(e,i,n={}){let r=[],o=this._animations.get(e),s,a=new Map;if(o?(s=tI(this._driver,i,o,Qx,Oy,new Map,new Map,n,a8,r),s.forEach(c=>{let f=ci(a,c.element,new Map);c.postStyleProps.forEach(p=>f.set(p,null))})):(r.push(C5()),s=[]),r.length)throw D5(r);a.forEach((c,f)=>{c.forEach((p,m)=>{c.set(m,this._driver.computeStyle(f,m,Cr))})});let u=s.map(c=>{let f=a.get(c.element);return this._buildPlayer(c,new Map,f)}),l=Ro(u);return this._playersById.set(e,l),l.onDestroy(()=>this.destroy(e)),this.players.push(l),l}destroy(e){let i=this._getPlayer(e);i.destroy(),this._playersById.delete(e);let n=this.players.indexOf(i);n>=0&&this.players.splice(n,1)}_getPlayer(e){let i=this._playersById.get(e);if(!i)throw E5(e);return i}listen(e,i,n,r){let o=Zy(i,"","","");return qy(this._getPlayer(e),n,o,r),()=>{}}command(e,i,n,r){if(n=="register"){this.register(e,r[0]);return}if(n=="create"){let s=r[0]||{};this.create(e,i,s);return}let o=this._getPlayer(e);switch(n){case"play":o.play();break;case"pause":o.pause();break;case"reset":o.reset();break;case"restart":o.restart();break;case"finish":o.finish();break;case"init":o.init();break;case"setPosition":o.setPosition(parseFloat(r[0]));break;case"destroy":this.destroy(e);break}}},Vx="ng-animate-queued",u8=".ng-animate-queued",Sy="ng-animate-disabled",l8=".ng-animate-disabled",c8="ng-star-inserted",d8=".ng-star-inserted",f8=[],iI={namespaceId:"",setForRemoval:!1,setForMove:!1,hasAnimation:!1,removedBeforeQueried:!1},p8={namespaceId:"",setForMove:!1,setForRemoval:!1,hasAnimation:!1,removedBeforeQueried:!0},Yi="__ng_removed",gl=class{constructor(e,i=""){d(this,"namespaceId");d(this,"value");d(this,"options");this.namespaceId=i;let n=e&&e.hasOwnProperty("value"),r=n?e.value:e;if(this.value=m8(r),n){let o=e,{value:s}=o,a=ho(o,["value"]);this.options=a}else this.options={};this.options.params||(this.options.params={})}get params(){return this.options.params}absorbOptions(e){let i=e.params;if(i){let n=this.options.params;Object.keys(i).forEach(r=>{n[r]==null&&(n[r]=i[r])})}}},pl="void",My=new gl(pl),$y=class{constructor(e,i,n){d(this,"id");d(this,"hostElement");d(this,"_engine");d(this,"players",[]);d(this,"_triggers",new Map);d(this,"_queue",[]);d(this,"_elementListeners",new Map);d(this,"_hostClassName");this.id=e,this.hostElement=i,this._engine=n,this._hostClassName="ng-tns-"+e,wi(i,this._hostClassName)}listen(e,i,n,r){if(!this._triggers.has(i))throw w5(n,i);if(n==null||n.length==0)throw T5(i);if(!g8(n))throw x5(n,i);let o=ci(this._elementListeners,e,[]),s={name:i,phase:n,callback:r};o.push(s);let a=ci(this._engine.statesByElement,e,new Map);return a.has(i)||(wi(e,Vf),wi(e,Vf+"-"+i),a.set(i,My)),()=>{this._engine.afterFlush(()=>{let u=o.indexOf(s);u>=0&&o.splice(u,1),this._triggers.has(i)||a.delete(i)})}}register(e,i){return this._triggers.has(e)?!1:(this._triggers.set(e,i),!0)}_getTrigger(e){let i=this._triggers.get(e);if(!i)throw I5(e);return i}trigger(e,i,n,r=!0){let o=this._getTrigger(i),s=new yl(this.id,i,e),a=this._engine.statesByElement.get(e);a||(wi(e,Vf),wi(e,Vf+"-"+i),this._engine.statesByElement.set(e,a=new Map));let u=a.get(i),l=new gl(n,this.id);if(!(n&&n.hasOwnProperty("value"))&&u&&l.absorbOptions(u.options),a.set(i,l),u||(u=My),!(l.value===pl)&&u.value===l.value){if(!b8(u.params,l.params)){let y=[],b=o.matchStyles(u.value,u.params,y),D=o.matchStyles(l.value,l.params,y);y.length?this._engine.reportError(y):this._engine.afterFlush(()=>{_s(e,b),Dr(e,D)})}return}let p=ci(this._engine.playersByElement,e,[]);p.forEach(y=>{y.namespaceId==this.id&&y.triggerName==i&&y.queued&&y.destroy()});let m=o.matchTransition(u.value,l.value,e,l.params),g=!1;if(!m){if(!r)return;m=o.fallbackTransition,g=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:i,transition:m,fromState:u,toState:l,player:s,isFallbackTransition:g}),g||(wi(e,Vx),s.onStart(()=>{Oa(e,Vx)})),s.onDone(()=>{let y=this.players.indexOf(s);y>=0&&this.players.splice(y,1);let b=this._engine.playersByElement.get(e);if(b){let D=b.indexOf(s);D>=0&&b.splice(D,1)}}),this.players.push(s),p.push(s),s}deregister(e){this._triggers.delete(e),this._engine.statesByElement.forEach(i=>i.delete(e)),this._elementListeners.forEach((i,n)=>{this._elementListeners.set(n,i.filter(r=>r.name!=e))})}clearElementCache(e){this._engine.statesByElement.delete(e),this._elementListeners.delete(e);let i=this._engine.playersByElement.get(e);i&&(i.forEach(n=>n.destroy()),this._engine.playersByElement.delete(e))}_signalRemovalForInnerTriggers(e,i){let n=this._engine.driver.query(e,Gf,!0);n.forEach(r=>{if(r[Yi])return;let o=this._engine.fetchNamespacesByElement(r);o.size?o.forEach(s=>s.triggerLeaveAnimation(r,i,!1,!0)):this.clearElementCache(r)}),this._engine.afterFlushAnimationsDone(()=>n.forEach(r=>this.clearElementCache(r)))}triggerLeaveAnimation(e,i,n,r){let o=this._engine.statesByElement.get(e),s=new Map;if(o){let a=[];if(o.forEach((u,l)=>{if(s.set(l,u.value),this._triggers.has(l)){let c=this.trigger(e,l,pl,r);c&&a.push(c)}}),a.length)return this._engine.markElementAsRemoved(this.id,e,!0,i,s),n&&Ro(a).onDone(()=>this._engine.processLeaveNode(e)),!0}return!1}prepareLeaveAnimationListeners(e){let i=this._elementListeners.get(e),n=this._engine.statesByElement.get(e);if(i&&n){let r=new Set;i.forEach(o=>{let s=o.name;if(r.has(s))return;r.add(s);let u=this._triggers.get(s).fallbackTransition,l=n.get(s)||My,c=new gl(pl),f=new yl(this.id,s,e);this._engine.totalQueuedPlayers++,this._queue.push({element:e,triggerName:s,transition:u,fromState:l,toState:c,player:f,isFallbackTransition:!0})})}}removeNode(e,i){let n=this._engine;if(e.childElementCount&&this._signalRemovalForInnerTriggers(e,i),this.triggerLeaveAnimation(e,i,!0))return;let r=!1;if(n.totalAnimations){let o=n.players.length?n.playersByQueriedElement.get(e):[];if(o&&o.length)r=!0;else{let s=e;for(;s=s.parentNode;)if(n.statesByElement.get(s)){r=!0;break}}}if(this.prepareLeaveAnimationListeners(e),r)n.markElementAsRemoved(this.id,e,!1,i);else{let o=e[Yi];(!o||o===iI)&&(n.afterFlush(()=>this.clearElementCache(e)),n.destroyInnerAnimations(e),n._onRemovalComplete(e,i))}}insertNode(e,i){wi(e,this._hostClassName)}drainQueuedTransitions(e){let i=[];return this._queue.forEach(n=>{let r=n.player;if(r.destroyed)return;let o=n.element,s=this._elementListeners.get(o);s&&s.forEach(a=>{if(a.name==n.triggerName){let u=Zy(o,n.triggerName,n.fromState.value,n.toState.value);u._data=e,qy(n.player,a.phase,u,a.callback)}}),r.markedForDestroy?this._engine.afterFlush(()=>{r.destroy()}):i.push(n)}),this._queue=[],i.sort((n,r)=>{let o=n.transition.ast.depCount,s=r.transition.ast.depCount;return o==0||s==0?o-s:this._engine.driver.containsElement(n.element,r.element)?1:-1})}destroy(e){this.players.forEach(i=>i.destroy()),this._signalRemovalForInnerTriggers(this.hostElement,e)}},Gy=class{constructor(e,i,n){d(this,"bodyNode");d(this,"driver");d(this,"_normalizer");d(this,"players",[]);d(this,"newHostElements",new Map);d(this,"playersByElement",new Map);d(this,"playersByQueriedElement",new Map);d(this,"statesByElement",new Map);d(this,"disabledNodes",new Set);d(this,"totalAnimations",0);d(this,"totalQueuedPlayers",0);d(this,"_namespaceLookup",{});d(this,"_namespaceList",[]);d(this,"_flushFns",[]);d(this,"_whenQuietFns",[]);d(this,"namespacesByHostElement",new Map);d(this,"collectedEnterElements",[]);d(this,"collectedLeaveElements",[]);d(this,"onRemovalComplete",(e,i)=>{});this.bodyNode=e,this.driver=i,this._normalizer=n}_onRemovalComplete(e,i){this.onRemovalComplete(e,i)}get queuedPlayers(){let e=[];return this._namespaceList.forEach(i=>{i.players.forEach(n=>{n.queued&&e.push(n)})}),e}createNamespace(e,i){let n=new $y(e,i,this);return this.bodyNode&&this.driver.containsElement(this.bodyNode,i)?this._balanceNamespaceList(n,i):(this.newHostElements.set(i,n),this.collectEnterElement(i)),this._namespaceLookup[e]=n}_balanceNamespaceList(e,i){let n=this._namespaceList,r=this.namespacesByHostElement;if(n.length-1>=0){let s=!1,a=this.driver.getParentElement(i);for(;a;){let u=r.get(a);if(u){let l=n.indexOf(u);n.splice(l+1,0,e),s=!0;break}a=this.driver.getParentElement(a)}s||n.unshift(e)}else n.push(e);return r.set(i,e),e}register(e,i){let n=this._namespaceLookup[e];return n||(n=this.createNamespace(e,i)),n}registerTrigger(e,i,n){let r=this._namespaceLookup[e];r&&r.register(i,n)&&this.totalAnimations++}destroy(e,i){e&&(this.afterFlush(()=>{}),this.afterFlushAnimationsDone(()=>{let n=this._fetchNamespace(e);this.namespacesByHostElement.delete(n.hostElement);let r=this._namespaceList.indexOf(n);r>=0&&this._namespaceList.splice(r,1),n.destroy(i),delete this._namespaceLookup[e]}))}_fetchNamespace(e){return this._namespaceLookup[e]}fetchNamespacesByElement(e){let i=new Set,n=this.statesByElement.get(e);if(n){for(let r of n.values())if(r.namespaceId){let o=this._fetchNamespace(r.namespaceId);o&&i.add(o)}}return i}trigger(e,i,n,r){if(Uf(i)){let o=this._fetchNamespace(e);if(o)return o.trigger(i,n,r),!0}return!1}insertNode(e,i,n,r){if(!Uf(i))return;let o=i[Yi];if(o&&o.setForRemoval){o.setForRemoval=!1,o.setForMove=!0;let s=this.collectedLeaveElements.indexOf(i);s>=0&&this.collectedLeaveElements.splice(s,1)}if(e){let s=this._fetchNamespace(e);s&&s.insertNode(i,n)}r&&this.collectEnterElement(i)}collectEnterElement(e){this.collectedEnterElements.push(e)}markElementAsDisabled(e,i){i?this.disabledNodes.has(e)||(this.disabledNodes.add(e),wi(e,Sy)):this.disabledNodes.has(e)&&(this.disabledNodes.delete(e),Oa(e,Sy))}removeNode(e,i,n){if(Uf(i)){let r=e?this._fetchNamespace(e):null;r?r.removeNode(i,n):this.markElementAsRemoved(e,i,!1,n);let o=this.namespacesByHostElement.get(i);o&&o.id!==e&&o.removeNode(i,n)}else this._onRemovalComplete(i,n)}markElementAsRemoved(e,i,n,r,o){this.collectedLeaveElements.push(i),i[Yi]={namespaceId:e,setForRemoval:r,hasAnimation:n,removedBeforeQueried:!1,previousTriggersValues:o}}listen(e,i,n,r,o){return Uf(i)?this._fetchNamespace(e).listen(i,n,r,o):()=>{}}_buildInstruction(e,i,n,r,o){return e.transition.build(this.driver,e.element,e.fromState.value,e.toState.value,n,r,e.fromState.options,e.toState.options,i,o)}destroyInnerAnimations(e){let i=this.driver.query(e,Gf,!0);i.forEach(n=>this.destroyActiveAnimationsForElement(n)),this.playersByQueriedElement.size!=0&&(i=this.driver.query(e,Ny,!0),i.forEach(n=>this.finishActiveQueriedAnimationOnElement(n)))}destroyActiveAnimationsForElement(e){let i=this.playersByElement.get(e);i&&i.forEach(n=>{n.queued?n.markedForDestroy=!0:n.destroy()})}finishActiveQueriedAnimationOnElement(e){let i=this.playersByQueriedElement.get(e);i&&i.forEach(n=>n.finish())}whenRenderingDone(){return new Promise(e=>{if(this.players.length)return Ro(this.players).onDone(()=>e());e()})}processLeaveNode(e){var n;let i=e[Yi];if(i&&i.setForRemoval){if(e[Yi]=iI,i.namespaceId){this.destroyInnerAnimations(e);let r=this._fetchNamespace(i.namespaceId);r&&r.clearElementCache(e)}this._onRemovalComplete(e,i.setForRemoval)}(n=e.classList)!=null&&n.contains(Sy)&&this.markElementAsDisabled(e,!1),this.driver.query(e,l8,!0).forEach(r=>{this.markElementAsDisabled(r,!1)})}flush(e=-1){let i=[];if(this.newHostElements.size&&(this.newHostElements.forEach((n,r)=>this._balanceNamespaceList(n,r)),this.newHostElements.clear()),this.totalAnimations&&this.collectedEnterElements.length)for(let n=0;nn()),this._flushFns=[],this._whenQuietFns.length){let n=this._whenQuietFns;this._whenQuietFns=[],i.length?Ro(i).onDone(()=>{n.forEach(r=>r())}):n.forEach(r=>r())}}reportError(e){throw S5(e)}_flushAnimations(e,i){let n=new ml,r=[],o=new Map,s=[],a=new Map,u=new Map,l=new Map,c=new Set;this.disabledNodes.forEach(G=>{c.add(G);let ne=this.driver.query(G,u8,!0);for(let ue=0;ue{let ue=Qx+y++;g.set(ne,ue),G.forEach(et=>wi(et,ue))});let b=[],D=new Set,I=new Set;for(let G=0;GD.add(et)):I.add(ne))}let N=new Map,A=Ux(p,Array.from(D));A.forEach((G,ne)=>{let ue=Oy+y++;N.set(ne,ue),G.forEach(et=>wi(et,ue))}),e.push(()=>{m.forEach((G,ne)=>{let ue=g.get(ne);G.forEach(et=>Oa(et,ue))}),A.forEach((G,ne)=>{let ue=N.get(ne);G.forEach(et=>Oa(et,ue))}),b.forEach(G=>{this.processLeaveNode(G)})});let V=[],z=[];for(let G=this._namespaceList.length-1;G>=0;G--)this._namespaceList[G].drainQueuedTransitions(i).forEach(ue=>{let et=ue.player,tn=ue.element;if(V.push(et),this.collectedEnterElements.length){let gn=tn[Yi];if(gn&&gn.setForMove){if(gn.previousTriggersValues&&gn.previousTriggersValues.has(ue.triggerName)){let qo=gn.previousTriggersValues.get(ue.triggerName),mi=this.statesByElement.get(ue.element);if(mi&&mi.has(ue.triggerName)){let tc=mi.get(ue.triggerName);tc.value=qo,mi.set(ue.triggerName,tc)}}et.destroy();return}}let or=!f||!this.driver.containsElement(f,tn),Qn=N.get(tn),po=g.get(tn),kt=this._buildInstruction(ue,n,po,Qn,or);if(kt.errors&&kt.errors.length){z.push(kt);return}if(or){et.onStart(()=>_s(tn,kt.fromStyles)),et.onDestroy(()=>Dr(tn,kt.toStyles)),r.push(et);return}if(ue.isFallbackTransition){et.onStart(()=>_s(tn,kt.fromStyles)),et.onDestroy(()=>Dr(tn,kt.toStyles)),r.push(et);return}let c1=[];kt.timelines.forEach(gn=>{gn.stretchStartingKeyframe=!0,this.disabledNodes.has(gn.element)||c1.push(gn)}),kt.timelines=c1,n.append(tn,kt.timelines);let mO={instruction:kt,player:et,element:tn};s.push(mO),kt.queriedElements.forEach(gn=>ci(a,gn,[]).push(et)),kt.preStyleProps.forEach((gn,qo)=>{if(gn.size){let mi=u.get(qo);mi||u.set(qo,mi=new Set),gn.forEach((tc,em)=>mi.add(em))}}),kt.postStyleProps.forEach((gn,qo)=>{let mi=l.get(qo);mi||l.set(qo,mi=new Set),gn.forEach((tc,em)=>mi.add(em))})});if(z.length){let G=[];z.forEach(ne=>{G.push(M5(ne.triggerName,ne.errors))}),V.forEach(ne=>ne.destroy()),this.reportError(G)}let ae=new Map,Pe=new Map;s.forEach(G=>{let ne=G.element;n.has(ne)&&(Pe.set(ne,ne),this._beforeAnimationBuild(G.player.namespaceId,G.instruction,ae))}),r.forEach(G=>{let ne=G.element;this._getPreviousPlayers(ne,!1,G.namespaceId,G.triggerName,null).forEach(et=>{ci(ae,ne,[]).push(et),et.destroy()})});let mt=b.filter(G=>$x(G,u,l)),At=new Map;jx(At,this.driver,I,l,Cr).forEach(G=>{$x(G,u,l)&&mt.push(G)});let Ni=new Map;m.forEach((G,ne)=>{jx(Ni,this.driver,new Set(G),u,Bf)}),mt.forEach(G=>{let ne=At.get(G),ue=Ni.get(G);At.set(G,new Map([...(ne==null?void 0:ne.entries())??[],...(ue==null?void 0:ue.entries())??[]]))});let hi=[],Or=[],Hn={};s.forEach(G=>{let{element:ne,player:ue,instruction:et}=G;if(n.has(ne)){if(c.has(ne)){ue.onDestroy(()=>Dr(ne,et.toStyles)),ue.disabled=!0,ue.overrideTotalTime(et.totalTime),r.push(ue);return}let tn=Hn;if(Pe.size>1){let Qn=ne,po=[];for(;Qn=Qn.parentNode;){let kt=Pe.get(Qn);if(kt){tn=kt;break}po.push(Qn)}po.forEach(kt=>Pe.set(kt,tn))}let or=this._buildAnimation(ue.namespaceId,et,ae,o,Ni,At);if(ue.setRealPlayer(or),tn===Hn)hi.push(ue);else{let Qn=this.playersByElement.get(tn);Qn&&Qn.length&&(ue.parentPlayer=Ro(Qn)),r.push(ue)}}else _s(ne,et.fromStyles),ue.onDestroy(()=>Dr(ne,et.toStyles)),Or.push(ue),c.has(ne)&&r.push(ue)}),Or.forEach(G=>{let ne=o.get(G.element);if(ne&&ne.length){let ue=Ro(ne);G.setRealPlayer(ue)}}),r.forEach(G=>{G.parentPlayer?G.syncPlayerEvents(G.parentPlayer):G.destroy()});for(let G=0;G!or.destroyed);tn.length?y8(this,ne,tn):this.processLeaveNode(ne)}return b.length=0,hi.forEach(G=>{this.players.push(G),G.onDone(()=>{G.destroy();let ne=this.players.indexOf(G);this.players.splice(ne,1)}),G.play()}),hi}afterFlush(e){this._flushFns.push(e)}afterFlushAnimationsDone(e){this._whenQuietFns.push(e)}_getPreviousPlayers(e,i,n,r,o){let s=[];if(i){let a=this.playersByQueriedElement.get(e);a&&(s=a)}else{let a=this.playersByElement.get(e);if(a){let u=!o||o==pl;a.forEach(l=>{l.queued||!u&&l.triggerName!=r||s.push(l)})}}return(n||r)&&(s=s.filter(a=>!(n&&n!=a.namespaceId||r&&r!=a.triggerName))),s}_beforeAnimationBuild(e,i,n){let r=i.triggerName,o=i.element,s=i.isRemovalTransition?void 0:e,a=i.isRemovalTransition?void 0:r;for(let u of i.timelines){let l=u.element,c=l!==o,f=ci(n,l,[]);this._getPreviousPlayers(l,c,s,a,i.toState).forEach(m=>{let g=m.getRealPlayer();g.beforeDestroy&&g.beforeDestroy(),m.destroy(),f.push(m)})}_s(o,i.fromStyles)}_buildAnimation(e,i,n,r,o,s){let a=i.triggerName,u=i.element,l=[],c=new Set,f=new Set,p=i.timelines.map(g=>{let y=g.element;c.add(y);let b=y[Yi];if(b&&b.removedBeforeQueried)return new Fo(g.duration,g.delay);let D=y!==u,I=v8((n.get(y)||f8).map(ae=>ae.getRealPlayer())).filter(ae=>{let Pe=ae;return Pe.element?Pe.element===y:!1}),N=o.get(y),A=s.get(y),V=qx(this._normalizer,g.keyframes,N,A),z=this._buildPlayer(g,V,I);if(g.subTimeline&&r&&f.add(y),D){let ae=new yl(e,a,y);ae.setRealPlayer(z),l.push(ae)}return z});l.forEach(g=>{ci(this.playersByQueriedElement,g.element,[]).push(g),g.onDone(()=>h8(this.playersByQueriedElement,g.element,g))}),c.forEach(g=>wi(g,Nx));let m=Ro(p);return m.onDestroy(()=>{c.forEach(g=>Oa(g,Nx)),Dr(u,i.toStyles)}),f.forEach(g=>{ci(r,g,[]).push(m)}),m}_buildPlayer(e,i,n){return i.length>0?this.driver.animate(e.element,i,e.duration,e.delay,e.easing,n):new Fo(e.duration,e.delay)}},yl=class{constructor(e,i,n){d(this,"namespaceId");d(this,"triggerName");d(this,"element");d(this,"_player",new Fo);d(this,"_containsRealPlayer",!1);d(this,"_queuedCallbacks",new Map);d(this,"destroyed",!1);d(this,"parentPlayer",null);d(this,"markedForDestroy",!1);d(this,"disabled",!1);d(this,"queued",!0);d(this,"totalTime",0);this.namespaceId=e,this.triggerName=i,this.element=n}setRealPlayer(e){this._containsRealPlayer||(this._player=e,this._queuedCallbacks.forEach((i,n)=>{i.forEach(r=>qy(e,n,void 0,r))}),this._queuedCallbacks.clear(),this._containsRealPlayer=!0,this.overrideTotalTime(e.totalTime),this.queued=!1)}getRealPlayer(){return this._player}overrideTotalTime(e){this.totalTime=e}syncPlayerEvents(e){let i=this._player;i.triggerCallback&&e.onStart(()=>i.triggerCallback("start")),e.onDone(()=>this.finish()),e.onDestroy(()=>this.destroy())}_queueEvent(e,i){ci(this._queuedCallbacks,e,[]).push(i)}onDone(e){this.queued&&this._queueEvent("done",e),this._player.onDone(e)}onStart(e){this.queued&&this._queueEvent("start",e),this._player.onStart(e)}onDestroy(e){this.queued&&this._queueEvent("destroy",e),this._player.onDestroy(e)}init(){this._player.init()}hasStarted(){return this.queued?!1:this._player.hasStarted()}play(){!this.queued&&this._player.play()}pause(){!this.queued&&this._player.pause()}restart(){!this.queued&&this._player.restart()}finish(){this._player.finish()}destroy(){this.destroyed=!0,this._player.destroy()}reset(){!this.queued&&this._player.reset()}setPosition(e){this.queued||this._player.setPosition(e)}getPosition(){return this.queued?0:this._player.getPosition()}triggerCallback(e){let i=this._player;i.triggerCallback&&i.triggerCallback(e)}};function h8(t,e,i){let n=t.get(e);if(n){if(n.length){let r=n.indexOf(i);n.splice(r,1)}n.length==0&&t.delete(e)}return n}function m8(t){return t??null}function Uf(t){return t&&t.nodeType===1}function g8(t){return t=="start"||t=="done"}function zx(t,e){let i=t.style.display;return t.style.display=e??"none",i}function jx(t,e,i,n,r){let o=[];i.forEach(u=>o.push(zx(u)));let s=[];n.forEach((u,l)=>{let c=new Map;u.forEach(f=>{let p=e.computeStyle(l,f,r);c.set(f,p),(!p||p.length==0)&&(l[Yi]=p8,s.push(l))}),t.set(l,c)});let a=0;return i.forEach(u=>zx(u,o[a++])),s}function Ux(t,e){let i=new Map;if(t.forEach(a=>i.set(a,[])),e.length==0)return i;let n=1,r=new Set(e),o=new Map;function s(a){if(!a)return n;let u=o.get(a);if(u)return u;let l=a.parentNode;return i.has(l)?u=l:r.has(l)?u=n:u=s(l),o.set(a,u),u}return e.forEach(a=>{let u=s(a);u!==n&&i.get(u).push(a)}),i}function wi(t,e){var i;(i=t.classList)==null||i.add(e)}function Oa(t,e){var i;(i=t.classList)==null||i.remove(e)}function y8(t,e,i){Ro(i).onDone(()=>t.processLeaveNode(e))}function v8(t){let e=[];return rI(t,e),e}function rI(t,e){for(let i=0;ir.add(o)):e.set(t,n),i.delete(t),!0}var Qf=class{constructor(e,i,n){d(this,"_driver");d(this,"_normalizer");d(this,"_transitionEngine");d(this,"_timelineEngine");d(this,"_triggerCache",{});d(this,"onRemovalComplete",(e,i)=>{});this._driver=i,this._normalizer=n,this._transitionEngine=new Gy(e.body,i,n),this._timelineEngine=new Uy(e.body,i,n),this._transitionEngine.onRemovalComplete=(r,o)=>this.onRemovalComplete(r,o)}registerTrigger(e,i,n,r,o){let s=e+"-"+r,a=this._triggerCache[s];if(!a){let u=[],l=[],c=eI(this._driver,o,u,l);if(u.length)throw v5(r,u);l.length&&void 0,a=o8(r,c,this._normalizer),this._triggerCache[s]=a}this._transitionEngine.registerTrigger(i,r,a)}register(e,i){this._transitionEngine.register(e,i)}destroy(e,i){this._transitionEngine.destroy(e,i)}onInsert(e,i,n,r){this._transitionEngine.insertNode(e,i,n,r)}onRemove(e,i,n){this._transitionEngine.removeNode(e,i,n)}disableAnimations(e,i){this._transitionEngine.markElementAsDisabled(e,i)}process(e,i,n,r){if(n.charAt(0)=="@"){let[o,s]=kx(n),a=r;this._timelineEngine.command(o,i,s,a)}else this._transitionEngine.trigger(e,i,n,r)}listen(e,i,n,r,o){if(n.charAt(0)=="@"){let[s,a]=kx(n);return this._timelineEngine.listen(s,i,a,o)}return this._transitionEngine.listen(e,i,n,r,o)}flush(e=-1){this._transitionEngine.flush(e)}get players(){return[...this._transitionEngine.players,...this._timelineEngine.players]}whenRenderingDone(){return this._transitionEngine.whenRenderingDone()}afterFlushAnimationsDone(e){this._transitionEngine.afterFlushAnimationsDone(e)}};function _8(t,e){let i=null,n=null;return Array.isArray(e)&&e.length?(i=Ay(e[0]),e.length>1&&(n=Ay(e[e.length-1]))):e instanceof Map&&(i=Ay(e)),i||n?new C8(t,i,n):null}var C8=(()=>{let e=class e{constructor(n,r,o){d(this,"_element");d(this,"_startStyles");d(this,"_endStyles");d(this,"_state",0);d(this,"_initialStyles");this._element=n,this._startStyles=r,this._endStyles=o;let s=e.initialStylesByElement.get(n);s||e.initialStylesByElement.set(n,s=new Map),this._initialStyles=s}start(){this._state<1&&(this._startStyles&&Dr(this._element,this._startStyles,this._initialStyles),this._state=1)}finish(){this.start(),this._state<2&&(Dr(this._element,this._initialStyles),this._endStyles&&(Dr(this._element,this._endStyles),this._endStyles=null),this._state=1)}destroy(){this.finish(),this._state<3&&(e.initialStylesByElement.delete(this._element),this._startStyles&&(_s(this._element,this._startStyles),this._endStyles=null),this._endStyles&&(_s(this._element,this._endStyles),this._endStyles=null),Dr(this._element,this._initialStyles),this._state=3)}};d(e,"initialStylesByElement",new WeakMap);let t=e;return t})();function Ay(t){let e=null;return t.forEach((i,n)=>{D8(n)&&(e=e||new Map,e.set(n,i))}),e}function D8(t){return t==="display"||t==="position"}var Xf=class{constructor(e,i,n,r){d(this,"element");d(this,"keyframes");d(this,"options");d(this,"_specialStyles");d(this,"_onDoneFns",[]);d(this,"_onStartFns",[]);d(this,"_onDestroyFns",[]);d(this,"_duration");d(this,"_delay");d(this,"_initialized",!1);d(this,"_finished",!1);d(this,"_started",!1);d(this,"_destroyed",!1);d(this,"_finalKeyframe");d(this,"_originalOnDoneFns",[]);d(this,"_originalOnStartFns",[]);d(this,"domPlayer");d(this,"time",0);d(this,"parentPlayer",null);d(this,"currentSnapshot",new Map);this.element=e,this.keyframes=i,this.options=n,this._specialStyles=r,this._duration=n.duration,this._delay=n.delay||0,this.time=this._duration+this._delay}_onFinish(){this._finished||(this._finished=!0,this._onDoneFns.forEach(e=>e()),this._onDoneFns=[])}init(){this._buildPlayer(),this._preparePlayerBeforeStart()}_buildPlayer(){if(this._initialized)return;this._initialized=!0;let e=this.keyframes;this.domPlayer=this._triggerWebAnimation(this.element,e,this.options),this._finalKeyframe=e.length?e[e.length-1]:new Map;let i=()=>this._onFinish();this.domPlayer.addEventListener("finish",i),this.onDestroy(()=>{this.domPlayer.removeEventListener("finish",i)})}_preparePlayerBeforeStart(){this._delay?this._resetDomPlayerState():this.domPlayer.pause()}_convertKeyframesToObject(e){let i=[];return e.forEach(n=>{i.push(Object.fromEntries(n))}),i}_triggerWebAnimation(e,i,n){return e.animate(this._convertKeyframesToObject(i),n)}onStart(e){this._originalOnStartFns.push(e),this._onStartFns.push(e)}onDone(e){this._originalOnDoneFns.push(e),this._onDoneFns.push(e)}onDestroy(e){this._onDestroyFns.push(e)}play(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(e=>e()),this._onStartFns=[],this._started=!0,this._specialStyles&&this._specialStyles.start()),this.domPlayer.play()}pause(){this.init(),this.domPlayer.pause()}finish(){this.init(),this._specialStyles&&this._specialStyles.finish(),this._onFinish(),this.domPlayer.finish()}reset(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1,this._onStartFns=this._originalOnStartFns,this._onDoneFns=this._originalOnDoneFns}_resetDomPlayerState(){this.domPlayer&&this.domPlayer.cancel()}restart(){this.reset(),this.play()}hasStarted(){return this._started}destroy(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._specialStyles&&this._specialStyles.destroy(),this._onDestroyFns.forEach(e=>e()),this._onDestroyFns=[])}setPosition(e){this.domPlayer===void 0&&this.init(),this.domPlayer.currentTime=e*this.time}getPosition(){return+(this.domPlayer.currentTime??0)/this.time}get totalTime(){return this._delay+this._duration}beforeDestroy(){let e=new Map;this.hasStarted()&&this._finalKeyframe.forEach((n,r)=>{r!=="offset"&&e.set(r,this._finished?n:Qy(this.element,r))}),this.currentSnapshot=e}triggerCallback(e){let i=e==="start"?this._onStartFns:this._onDoneFns;i.forEach(n=>n()),i.length=0}},Gx=class{validateStyleProperty(e){return!0}validateAnimatableStyleProperty(e){return!0}containsElement(e,i){return Zx(e,i)}getParentElement(e){return Ky(e)}query(e,i,n){return Kx(e,i,n)}computeStyle(e,i,n){return Qy(e,i)}animate(e,i,n,r,o,s=[]){let a=r==0?"both":"forwards",u={duration:n,delay:r,fill:a};o&&(u.easing=o);let l=new Map,c=s.filter(m=>m instanceof Xf);z5(n,r)&&c.forEach(m=>{m.currentSnapshot.forEach((g,y)=>l.set(y,g))});let f=H5(i).map(m=>new Map(m));f=j5(e,f,l);let p=_8(e,f);return new Xf(e,f,u,p)}};var $f="@",oI="@.disabled",Jf=class{constructor(e,i,n,r){d(this,"namespaceId");d(this,"delegate");d(this,"engine");d(this,"_onDestroy");d(this,"\u0275type",0);this.namespaceId=e,this.delegate=i,this.engine=n,this._onDestroy=r}get data(){return this.delegate.data}destroyNode(e){var i,n;(n=(i=this.delegate).destroyNode)==null||n.call(i,e)}destroy(){var e;this.engine.destroy(this.namespaceId,this.delegate),this.engine.afterFlushAnimationsDone(()=>{queueMicrotask(()=>{this.delegate.destroy()})}),(e=this._onDestroy)==null||e.call(this)}createElement(e,i){return this.delegate.createElement(e,i)}createComment(e){return this.delegate.createComment(e)}createText(e){return this.delegate.createText(e)}appendChild(e,i){this.delegate.appendChild(e,i),this.engine.onInsert(this.namespaceId,i,e,!1)}insertBefore(e,i,n,r=!0){this.delegate.insertBefore(e,i,n),this.engine.onInsert(this.namespaceId,i,e,r)}removeChild(e,i,n){this.parentNode(i)&&this.engine.onRemove(this.namespaceId,i,this.delegate)}selectRootElement(e,i){return this.delegate.selectRootElement(e,i)}parentNode(e){return this.delegate.parentNode(e)}nextSibling(e){return this.delegate.nextSibling(e)}setAttribute(e,i,n,r){this.delegate.setAttribute(e,i,n,r)}removeAttribute(e,i,n){this.delegate.removeAttribute(e,i,n)}addClass(e,i){this.delegate.addClass(e,i)}removeClass(e,i){this.delegate.removeClass(e,i)}setStyle(e,i,n,r){this.delegate.setStyle(e,i,n,r)}removeStyle(e,i,n){this.delegate.removeStyle(e,i,n)}setProperty(e,i,n){i.charAt(0)==$f&&i==oI?this.disableAnimations(e,!!n):this.delegate.setProperty(e,i,n)}setValue(e,i){this.delegate.setValue(e,i)}listen(e,i,n){return this.delegate.listen(e,i,n)}disableAnimations(e,i){this.engine.disableAnimations(e,i)}},Wy=class extends Jf{constructor(i,n,r,o,s){super(n,r,o,s);d(this,"factory");this.factory=i,this.namespaceId=n}setProperty(i,n,r){n.charAt(0)==$f?n.charAt(1)=="."&&n==oI?(r=r===void 0?!0:!!r,this.disableAnimations(i,r)):this.engine.process(this.namespaceId,i,n.slice(1),r):this.delegate.setProperty(i,n,r)}listen(i,n,r){if(n.charAt(0)==$f){let o=E8(i),s=n.slice(1),a="";return s.charAt(0)!=$f&&([s,a]=w8(s)),this.engine.listen(this.namespaceId,o,s,a,u=>{let l=u._data||-1;this.factory.scheduleListenerCallback(l,r,u)})}return this.delegate.listen(i,n,r)}};function E8(t){switch(t){case"body":return document.body;case"document":return document;case"window":return window;default:return t}}function w8(t){let e=t.indexOf("."),i=t.substring(0,e),n=t.slice(e+1);return[i,n]}var Wx=class{constructor(e,i,n){d(this,"delegate");d(this,"engine");d(this,"_zone");d(this,"_currentId",0);d(this,"_microtaskId",1);d(this,"_animationCallbacksBuffer",[]);d(this,"_rendererCache",new Map);d(this,"_cdRecurDepth",0);this.delegate=e,this.engine=i,this._zone=n,i.onRemovalComplete=(r,o)=>{o==null||o.removeChild(null,r)}}createRenderer(e,i){var l;let n="",r=this.delegate.createRenderer(e,i);if(!e||!((l=i==null?void 0:i.data)!=null&&l.animation)){let c=this._rendererCache,f=c.get(r);if(!f){let p=()=>c.delete(r);f=new Jf(n,r,this.engine,p),c.set(r,f)}return f}let o=i.id,s=i.id+"-"+this._currentId;this._currentId++,this.engine.register(s,e);let a=c=>{Array.isArray(c)?c.forEach(a):this.engine.registerTrigger(o,s,e,c.name,c)};return i.data.animation.forEach(a),new Wy(this,s,r,this.engine)}begin(){this._cdRecurDepth++,this.delegate.begin&&this.delegate.begin()}_scheduleCountTask(){queueMicrotask(()=>{this._microtaskId++})}scheduleListenerCallback(e,i,n){if(e>=0&&ei(n));return}let r=this._animationCallbacksBuffer;r.length==0&&queueMicrotask(()=>{this._zone.run(()=>{r.forEach(o=>{let[s,a]=o;s(a)}),this._animationCallbacksBuffer=[]})}),r.push([i,n])}end(){this._cdRecurDepth--,this._cdRecurDepth==0&&this._zone.runOutsideAngular(()=>{this._scheduleCountTask(),this.engine.flush(this._microtaskId)}),this.delegate.end&&this.delegate.end()}whenRenderingDone(){return this.engine.whenRenderingDone()}};var T8=B(()=>{let t={onRemovalComplete:()=>{}},e=new on(null),i=h(Qf,{optional:!0})||t,{onRemovalComplete:n=t.onRemovalComplete}=i;return i.onRemovalComplete=(r,o)=>{e.next(r),n.call(i,r,o)},e.pipe(bt(r=>gt(0).pipe(S(()=>null),dt(r))),Ri())});function sI(t,e=null){return Pf(t).activeElement!==t&&!t.matches(":disabled")&&!(e!=null&&e.contains(t))&&ys(t)}function x8(t){return nt(rt(t,"focusin").pipe(S(({target:e})=>e)),rt(t,"focusout").pipe(ot(({target:e,relatedTarget:i})=>!!i&&sI(e)),S(({relatedTarget:e})=>e)))}var aI=B(()=>{let t=h(T8),e=h(Je),i=h(qe),n=h(me),r=rt(e,"focusout",{capture:!0}),o=rt(e,"focusin",{capture:!0}),s=rt(e,"blur"),a=rt(e,"mousedown"),u=rt(e,"mouseup");return nt(r.pipe(Kt(a),es({delay:()=>u}),Am(t),ot(([l,c])=>sI(ka(l),c)),S(([{relatedTarget:l}])=>l)),s.pipe(S(()=>i.activeElement),ot(l=>!!(l!=null&&l.matches("iframe")))),o.pipe(bt(l=>{let c=ka(l),f=Pf(c);return f===i?ce(c):x8(f).pipe(dt(c))})),a.pipe(bt(l=>{let c=ka(l);return!i.activeElement||i.activeElement===i.body?ce(c):r.pipe($t(1),S(()=>c),Kt(gt(0,Fn(n))))}))).pipe(ke(),Ri())}),wie=B(()=>{var t;return((t=h(qe).querySelector("base"))==null?void 0:t.href)??""}),I8=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series([46])0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/,S8=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br([ev])w|bumb|bw-([nu])|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do([cp])o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly([-_])|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-([mpt])|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c([- _agpst])|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac([ \-/])|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja([tv])a|jbro|jemu|jigs|kddi|keji|kgt([ /])|klon|kpt |kwc-|kyo([ck])|le(no|xi)|lg( g|\/([klu])|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t([- ov])|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30([02])|n50([025])|n7(0([01])|10)|ne(([cm])-|on|tf|wf|wg|wt)|nok([6i])|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan([adt])|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c([-01])|47|mc|nd|ri)|sgh-|shar|sie([-m])|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel([im])|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c([- ])|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/,Qi=B(()=>I8.test(h(Ma).toLowerCase())||S8.test(h(Ma).slice(0,4).toLowerCase())),Na=B(()=>Of(h(Ao))),M8=B(()=>h(Qi)&&!h(Na)),uI=B(()=>{var t;return!!((t=h(Je))!=null&&t.webkitConvertPointFromNodeToPage)}),Tie=B(()=>h(Na)?"ios":h(M8)?"android":"web"),xie=B(()=>{let t=h(Je).matchMedia("(pointer: coarse)");return Cn(ct(t,"change").pipe(S(()=>t.matches)),{initialValue:t.matches})}),A8=B(()=>!!h(Je).Cypress),k8=B(Di),Iie=B(()=>h(A8)||h(k8)),Jy=W(null);function Sie(t){return{provide:Jy,useValue:t}}var lI=B(()=>zT(h(Ui))?new Range:{}),cI=B(()=>{let t=h(Je);return rt(t,"resize").pipe(dt(null),S(()=>{var r,o;let e=Math.max(t.document.documentElement.clientWidth||0,t.innerWidth||0,((r=t.visualViewport)==null?void 0:r.width)||0),i=Math.max(t.document.documentElement.clientHeight||0,t.innerHeight||0,((o=t.visualViewport)==null?void 0:o.height)||0),n={width:e,height:i,top:0,left:0,right:e,bottom:i,x:0,y:0};return U(M({},n),{toJSON:()=>JSON.stringify(n)})}),Li({bufferSize:1,refCount:!0}))});var O8=["viewContainer"],vl=class{},dI={self:!0,optional:!0},bl=(()=>{let e=class e{constructor(){this.fallback=h(Jy,dI),this.refresh$=new tt,this.pseudoInvalid=ge(null),this.internal=ge(this.fallback),this.control=h(an,{self:!0}),this.cdr=h(st),this.transformer=h(vl,dI),this.value=Pt(()=>this.internal()??this.fallback),this.readOnly=ge(!1),this.touched=ge(!1),this.status=ge(void 0),this.disabled=Pt(()=>this.status()==="DISABLED"),this.interactive=Pt(()=>!this.disabled()&&!this.readOnly()),this.invalid=Pt(()=>this.pseudoInvalid()!==null?!!this.pseudoInvalid()&&this.interactive():this.interactive()&&this.touched()&&this.status()==="INVALID"),this.mode=Pt(()=>this.readOnly()?"readonly":this.invalid()?"invalid":"valid"),this.onTouched=Sa,this.onChange=Sa,this.control.valueAccessor=this,this.refresh$.pipe(Jn(0),dt(null),S(()=>this.control.control),ot(Boolean),ke(),bt(n=>nt(n.valueChanges,n.statusChanges,n.events||sn).pipe(dt(null))),Se()).subscribe(()=>this.update())}set readOnlySetter(n){this.readOnly.set(n)}set invalidSetter(n){this.pseudoInvalid.set(n)}registerOnChange(n){this.refresh$.next(),this.onChange=r=>{r!==this.internal()&&(n(this.toControlValue(r)),this.internal.set(r),this.update())}}registerOnTouched(n){this.onTouched=()=>{n(),this.update()}}setDisabledState(){this.update()}writeValue(n){let r=this.control instanceof _r?this.control.model:n;this.internal.set(this.fromControlValue(r)),this.update()}fromControlValue(n){return this.transformer?this.transformer.fromControlValue(n):n}toControlValue(n){return this.transformer?this.transformer.toControlValue(n):n}update(){var n,r;this.status.set((n=this.control.control)==null?void 0:n.status),this.touched.set(!!((r=this.control.control)!=null&&r.touched)),this.cdr.markForCheck()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,inputs:{readOnlySetter:[0,"readOnly","readOnlySetter"],invalidSetter:[0,"invalid","invalidSetter"]},standalone:!1});let t=e;return Ot([Ft],t.prototype,"fromControlValue",null),Ot([Ft],t.prototype,"toControlValue",null),t})();function Uie(t){return De(bl,t)}var _l=(()=>{let e=class e{constructor(){this.injector=h(gr),this.nothing=h(Cs).attach(this)}addComponentChild(n){let r=n.createInjector(this.injector),o=this.vcr.createComponent(n.component,{injector:r});return o.changeDetectorRef.detectChanges(),o}addTemplateChild(n,r){return this.vcr.createEmbeddedView(n,r)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,viewQuery:function(r,o){if(r&1&&Gt(O8,5,zt),r&2){let s;Qe(s=Xe())&&(o.vcr=s.first)}},standalone:!1});let t=e;return t})(),Cs=(()=>{let e=class e{attach(n){this.host=n}add(n){return this.safeHost.addComponentChild(n)}remove({hostView:n}){n.destroyed||n.destroy()}addTemplate(n,r){return this.safeHost.addTemplateChild(n,r)}removeTemplate(n){n.destroyed||n.destroy()}get safeHost(){if(!this.host)throw new ev;return this.host}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();function fI(t){return De(Cs,t)}var ev=class extends Error{constructor(){super("")}};function qie(t,e,i){return i&&it?e:t}var Zie=7;var Pa=12,ep=1,tv=0,tp=11,nv=0,iv=9999,N8=2099,np=`${Xr}${cx}${Xr}`,P8=1e3,F8=60,R8=60,L8=24,H8=P8*F8,B8=H8*R8,Kie=B8*L8,rv=10,V8=2*rv+np.length,ip={Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6},to={January:0,February:1,March:2,April:3,May:4,June:5,July:6,August:7,September:8,October:9,November:10,December:11},Ti=class t{constructor(e){this.year=e}static isValidYear(e){return Number.isInteger(e)&&al(e,nv,iv+1)}static isLeapYear(e){return e%400===0||e%4===0&&e%100!==0}static getAbsoluteLeapYears(e){return Math.ceil(e/400)+(Math.ceil(e/4)-Math.ceil(e/100))}static lengthBetween(e,i){return i.year-e.year}static normalizeYearPart(e){return Sf(e,nv,iv)}get formattedYear(){return String(this.year).padStart(4,"0")}get isLeapYear(){return t.isLeapYear(this.year)}get absoluteLeapYears(){return t.getAbsoluteLeapYears(this.year)}yearBefore({year:e}){return this.year=e}yearAfter({year:e}){return this.year>e}append({year:e=0}){let i=this.year+e;return new t(i)}toString(){return this.formattedYear}valueOf(){return this.year}[Symbol.toPrimitive](e){return Date.prototype[Symbol.toPrimitive].call(this,e)}toJSON(){return this.formattedYear}},di=class t extends Ti{constructor(e,i){super(e),this.month=i}static isValidMonth(e,i){return Ti.isValidYear(e)&&t.isValidMonthPart(i)}static getMonthDaysCount(e,i){switch(e){case to.April:case to.June:case to.November:case to.September:return 30;case to.February:return i?29:28;default:return 31}}static currentLocal(){let e=new Date;return new t(e.getFullYear(),e.getMonth())}static currentUtc(){let e=new Date;return new t(e.getUTCFullYear(),e.getUTCMonth())}static lengthBetween(e,i){let n=e.month+e.year*12;return i.month+i.year*12-n}static normalizeMonthPart(e){return Sf(e,tv,tp)}static isValidMonthPart(e){return Number.isInteger(e)&&al(e,tv,tp+1)}get formattedMonthPart(){return String(this.month+1).padStart(2,"0")}get daysCount(){return t.getMonthDaysCount(this.month,this.isLeapYear)}monthBefore(e){return this.yearBefore(e)||this.yearSame(e)&&this.month=e.month}monthAfter(e){return this.yearAfter(e)||this.yearSame(e)&&this.month>e.month}append({year:e=0,month:i=0}){let n=(this.year+e)*Pa+this.month+i;return new t(Math.floor(n/Pa),n%Pa)}toString(){return`${this.formattedMonthPart}.${this.formattedYear}`}valueOf(){return this.toLocalNativeDate().valueOf()}toJSON(){return`${super.toJSON()}-${this.formattedMonthPart}`}toLocalNativeDate(){return new Date(this.year,this.month)}toUtcNativeDate(){return new Date(Date.UTC(this.year,this.month))}},Ds=class t extends di{constructor(e,i,n){super(e,i),this.day=n}static fromLocalNativeDate(e){return new t(e.getFullYear(),e.getMonth(),e.getDate())}static fromUtcNativeDate(e){return new t(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}static isValidDay(e,i,n){return di.isValidMonth(e,i)&&Number.isInteger(n)&&al(n,ep,di.getMonthDaysCount(i,Ti.isLeapYear(e))+1)}static currentLocal(){let e=new Date,i=e.getFullYear(),n=e.getMonth(),r=e.getDate();return new t(i,n,r)}static currentUtc(){let e=new Date,i=e.getUTCFullYear(),n=e.getUTCMonth(),r=e.getUTCDate();return new t(i,n,r)}static normalizeOf(e,i,n){let r=Ti.normalizeYearPart(e),o=di.normalizeMonthPart(i),s=t.normalizeDayPart(n,o,r);return new t(r,o,s)}static lengthBetween(e,i){return Math.round((i.toLocalNativeDate().getTime()-e.toLocalNativeDate().getTime())/(1e3*60*60*24))}static parseRawDateString(e,i="DMY"){switch(i){case"MDY":return{day:parseInt(e.slice(3,5),10),month:parseInt(e.slice(0,2),10)-1,year:parseInt(e.slice(6,10),10)};case"YMD":return{day:parseInt(e.slice(8,10),10),month:parseInt(e.slice(5,7),10)-1,year:parseInt(e.slice(0,4),10)};case"DMY":default:return{day:parseInt(e.slice(0,2),10),month:parseInt(e.slice(3,5),10)-1,year:parseInt(e.slice(6,10),10)}}}static normalizeParse(e,i="DMY"){let{day:n,month:r,year:o}=this.parseRawDateString(e,i);return t.normalizeOf(o,r,n)}static jsonParse(e){let{day:i,month:n,year:r}=this.parseRawDateString(e,"YMD");if(!di.isValidMonth(r,n)||!Number.isInteger(i)||!al(i,ep,di.getMonthDaysCount(n,Ti.isLeapYear(r))+1))throw new ov(r,n,i);return new t(r,n,i)}static normalizeDayPart(e,i,n){let r=di.getMonthDaysCount(i,Ti.isLeapYear(n));return Sf(e,1,r)}get formattedDayPart(){return String(this.day).padStart(2,"0")}get isWeekend(){let e=this.dayOfWeek(!1);return e===ip.Saturday||e===ip.Sunday}dayOfWeek(e=!0){let i=e?this.toLocalNativeDate().getDay()-1:this.toLocalNativeDate().getDay();return i<0?6:i}dayBefore(e){return this.monthBefore(e)||this.monthSame(e)&&this.day=e.day}dayAfter(e){return this.monthAfter(e)||this.monthSame(e)&&this.day>e.day}dayLimit(e,i){return e!==null&&this.dayBefore(e)?e:i!==null&&this.dayAfter(i)?i:this}append({year:e=0,month:i=0,day:n=0}){let r=(this.year+e)*Pa+this.month+i,o=Math.floor(r/Pa),s=r%Pa,a=Math.min(this.day,di.getMonthDaysCount(s,Ti.isLeapYear(o)))+n;for(;a>di.getMonthDaysCount(s,Ti.isLeapYear(o));)a-=di.getMonthDaysCount(s,Ti.isLeapYear(o)),s===to.December?(o++,s=to.January):s++;for(;a{let e=class e{constructor(){var n;this.control=h(an,{self:!0,optional:!0}),this.active$=h(aI),this.zone=h(me),this.el=Ee(),this.tuiActiveZoneParent=null,this.subActiveZones=[],this.directParentActiveZone=h(e,{skipSelf:!0,optional:!0}),this.tuiActiveZoneChange=this.active$.pipe(S(r=>!!r&&this.contains(r)),dt(!1),ke(),Tu(1),ei(r=>{var o;!r&&typeof((o=this.control)==null?void 0:o.valueAccessor.onTouched)=="function"&&this.control.valueAccessor.onTouched()}),ai(this.zone)),(n=this.directParentActiveZone)==null||n.addSubActiveZone(this)}set tuiActiveZoneParentSetter(n){this.setZone(n)}ngOnDestroy(){var n,r;(n=this.directParentActiveZone)==null||n.removeSubActiveZone(this),(r=this.tuiActiveZoneParent)==null||r.removeSubActiveZone(this)}contains(n){return this.el.contains(n)||this.subActiveZones.some((r,o,s)=>s.indexOf(r)===o&&r.contains(n))}setZone(n){var r;(r=this.tuiActiveZoneParent)==null||r.removeSubActiveZone(this),n==null||n.addSubActiveZone(this),this.tuiActiveZoneParent=n}addSubActiveZone(n){this.subActiveZones=[...this.subActiveZones,n]}removeSubActiveZone(n){this.subActiveZones=gx(this.subActiveZones,this.subActiveZones.indexOf(n))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiActiveZone","",5,"ng-container"],["","tuiActiveZoneChange","",5,"ng-container"],["","tuiActiveZoneParent","",5,"ng-container"]],hostBindings:function(r,o){r&1&&x("mousedown.silent",function(){return 0},!1,Nn)},inputs:{tuiActiveZoneParentSetter:[0,"tuiActiveZoneParent","tuiActiveZoneParentSetter"]},outputs:{tuiActiveZoneChange:"tuiActiveZoneChange"},exportAs:["tuiActiveZone"]});let t=e;return Ot([Ft],t.prototype,"setZone",null),t})();function gI(t){return t!=null&&`${t}`!="false"}var rp=class{constructor(e,i){this.el=e,this.options=i}get element(){return(this.el.nativeElement.tagName.includes("-")?this.el.nativeElement.querySelector(this.options.query):this.el.nativeElement)||this.el.nativeElement}get isTextFieldElement(){return this.element.matches(this.options.query)}},j8=1e3,U8=".ng-animating",av=class extends rp{constructor(e,i,n,r){super(e,r),this.animationFrame$=i,this.zone=n}setFocus(){this.isTextFieldElement?Em(gt(this.options.delay||j8),this.animationFrame$.pipe(gi(100,Fn(this.zone)),S(()=>this.element.closest(U8)),Mm(Boolean),$t(1))).subscribe(()=>this.element.focus({preventScroll:this.options.preventScroll})):this.element.focus({preventScroll:!0})}},$8=["type","inputMode","autocomplete","accept","min","max","step","pattern","size","maxlength"],uv=class extends rp{constructor(e,i,n,r,o){super(e,o),this.renderer=i,this.zone=n,this.win=r}setFocus(){this.isTextFieldElement?this.zone.runOutsideAngular(()=>this.iosWebkitAutofocus()):this.element.focus({preventScroll:!0})}iosWebkitAutofocus(){var a;let e=this.makeFakeInput(),i=this.getDurationTimeBeforeFocus(),n=0,r=0,o=()=>e.focus({preventScroll:!0}),s=()=>{clearTimeout(n),n=this.win.setTimeout(()=>{clearTimeout(r),e.removeEventListener("blur",o),e.removeEventListener("focus",s),r=this.win.setTimeout(()=>{this.element.focus({preventScroll:this.options.preventScroll}),e.remove()},i)})};e.addEventListener("blur",o,{once:!0}),e.addEventListener("focus",s),this.insideDialog()?this.win.document.body.appendChild(e):(a=this.element.parentElement)==null||a.appendChild(e),e.focus({preventScroll:!0})}makeFakeInput(){let e=this.renderer.createElement("input"),i=this.element.getBoundingClientRect();return this.patchFakeInputFromFocusableElement(e),e.style.height=ht(i.height),e.style.width=ht(i.width/2),e.style.position="fixed",e.style.zIndex="-99999999",e.style.caretColor="transparent",e.style.border="none",e.style.outline="none",e.style.color="transparent",e.style.background="transparent",e.style.cursor="none",e.style.fontSize=ht(16),e.style.top=ht(i.top),e.style.left=ht(i.left),e}getDurationTimeBeforeFocus(){return parseFloat(this.win.getComputedStyle(this.element).getPropertyValue("--tui-duration"))||0}insideDialog(){return!!this.element.closest("tui-dialog")}patchFakeInputFromFocusableElement(e){$8.forEach(i=>{let n=this.element.getAttribute(i);si(n)&&e.setAttribute(i,n)})}},[yI,vI]=Oo({delay:NaN,query:"input, textarea, select, [contenteditable]",preventScroll:!1}),bI=W(),G8=[{provide:bI,deps:[de,qi,oi,me,Je,Na,yI],useFactory:(t,e,i,n,r,o,s)=>o?new uv(t,i,n,r,s):new av(t,e,n,s)}],_I=(()=>{let e=class e{constructor(){this.handler=h(bI),this.options=h(yI),this.destroyRef=h(it)}ngAfterViewInit(){this.autoFocus&&this.focus()}focus(){Number.isNaN(this.options.delay)?Promise.resolve().then(()=>this.handler.setFocus()):gt(this.options.delay).pipe(Se(this.destroyRef)).subscribe(()=>this.handler.setFocus())}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiAutoFocus",""]],inputs:{autoFocus:[2,"tuiAutoFocus","autoFocus",gI]},features:[Z(G8),Qg]});let t=e;return t})();var CI=(()=>{let e=class e{constructor(){return this.nativeElement=Ee(),new de(this.nativeElement)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiElement",""]],exportAs:["elementRef"]});let t=e;return t})();function W8({currentTarget:t,relatedTarget:e}){return!ui(e)||!ui(t)||!t.contains(e)}var Es=(()=>{let e=class e extends te{constructor(){super(n=>this.stream$.subscribe(n)),this.el=Ee(),this.zone=h(me),this.stream$=nt(rt(this.el,"mouseenter").pipe(S(Mo)),rt(this.el,"mouseleave").pipe(S(Di)),rt(this.el,"mouseout").pipe(ot(W8),S(Di))).pipe(ke(),ai(this.zone))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();var Ore=(()=>{let e=class e{constructor(){this.tuiHoveredChange=h(Es)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHoveredChange",""]],outputs:{tuiHoveredChange:"tuiHoveredChange"},features:[Z([Es])]});let t=e;return t})();var DI=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiItem",""]]});let t=e;return t})();var lv=class{constructor(e){this.internalDirectiveInstance=e}get $implicit(){return this.internalDirectiveInstance.tuiLet}get tuiLet(){return this.internalDirectiveInstance.tuiLet}},EI=(()=>{let e=class e{constructor(){h(zt).createEmbeddedView(h(It),new lv(this))}static ngTemplateContextGuard(n,r){return!0}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiLet",""]],inputs:{tuiLet:"tuiLet"}});let t=e;return t})();var wI=(()=>{let e=class e{constructor(){this.destroyRef=h(it),this.zone=h(me),this.el=Ee(),this.tuiNativeValidator="Invalid"}validate(n){return this.control=n,gt(0).pipe(Ei(this.zone),kf(this.destroyRef)).subscribe(()=>this.handleValidation()),null}handleValidation(){var n,r,o,s;(s=(o=this.el).setCustomValidity)==null||s.call(o,(n=this.control)!=null&&n.touched&&((r=this.control)!=null&&r.invalid)?this.tuiNativeValidator:"")}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiNativeValidator",""]],hostBindings:function(r,o){r&1&&x("focusout",function(){return o.handleValidation()})},inputs:{tuiNativeValidator:"tuiNativeValidator"},features:[Z([De(Cf,e,!0)])]});let t=e;return t})();var TI=(()=>{let e=class e extends te{constructor(){super(n=>this.obscured$.subscribe(n)),this.el=Ee(),this.obscured$=h(qi).pipe(gi(100,Fn()),S(()=>Ff(this.el)),dt(null),ke(),ai())}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),op=(()=>{let e=class e{constructor(){this.activeZone=h(xi,{optional:!0}),this.enabled$=new tt,this.obscured$=h(TI,{self:!0}).pipe(S(n=>!!(n!=null&&n.every(r=>{var o;return!((o=this.activeZone)!=null&&o.contains(r))})))),this.tuiObscured=this.enabled$.pipe(Af(()=>this.obscured$))}set tuiObscuredEnabled(n){this.enabled$.next(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiObscured",""]],inputs:{tuiObscuredEnabled:"tuiObscuredEnabled"},outputs:{tuiObscured:"tuiObscured"},features:[Z([TI])]});let t=e;return t})();var II=new k("");function dv(t={}){return h(II,t)}var Xi=class{constructor(e,i){this.component=e,this.i=i}createInjector(e,i){return Wn.create({parent:this.i||e,providers:[{provide:II,useValue:i}]})}},sp=class{constructor(e){this.$implicit=e}get polymorpheusOutlet(){return this.$implicit}};var fv=(()=>{let e=class e{constructor(n=h(It,{self:!0}),r=h(st)){this.template=n,this.cdr=r,this.polymorpheus=""}static ngTemplateContextGuard(n,r){return!0}check(){this.cdr.markForCheck()}};e.\u0275fac=function(r){return new(r||e)(Ge(It),Ge(st))},e.\u0275dir=T({type:e,selectors:[["ng-template","polymorpheus",""]],inputs:{polymorpheus:"polymorpheus"},exportAs:["polymorpheus"]});let t=e;return t})(),Rn=(()=>{let e=class e{constructor(){this.vcr=h(zt),this.i=h(gr),this.t=h(It),this.content=""}static ngTemplateContextGuard(n,r){return!0}ngOnChanges({content:n}){var s;let r=this.getContext();if((s=this.c)==null||s.injector.get(st).markForCheck(),!n)return;this.vcr.clear();let o=r&&new Proxy(r,{get:(a,u)=>{var l;return(l=this.getContext())==null?void 0:l[u]}});xI(this.content)?this.process(this.content,o):(r instanceof sp&&r.$implicit)!=null&&this.vcr.createEmbeddedView(this.template,o,{injector:this.i})}ngDoCheck(){cv(this.content)&&this.content.check()}get template(){return cv(this.content)?this.content.template:this.content instanceof It?this.content:this.t}getContext(){return K8(this.content)||xI(this.content)?this.context:new sp(this.context&&typeof this.content=="function"?this.content(this.context):this.content)}process(n,r){let o=n.createInjector(this.i,r);this.c=this.vcr.createComponent(n.component,{injector:o})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","polymorpheusOutlet",""]],inputs:{content:[0,"polymorpheusOutlet","content"],context:[0,"polymorpheusOutletContext","context"]},features:[Yt]});let t=e;return t})();function cv(t){return t instanceof fv}function xI(t){return t instanceof Xi}function K8(t){return cv(t)||t instanceof It}var up=class t{constructor(e){d(this,"headers");d(this,"normalizedNames",new Map);d(this,"lazyInit");d(this,"lazyUpdate",null);e?typeof e=="string"?this.lazyInit=()=>{this.headers=new Map,e.split(` +`).forEach(i=>{let n=i.indexOf(":");if(n>0){let r=i.slice(0,n),o=i.slice(n+1).trim();this.addHeaderEntry(r,o)}})}:typeof Headers<"u"&&e instanceof Headers?(this.headers=new Map,e.forEach((i,n)=>{this.addHeaderEntry(n,i)})):this.lazyInit=()=>{this.headers=new Map,Object.entries(e).forEach(([i,n])=>{this.setHeaderEntries(i,n)})}:this.headers=new Map}has(e){return this.init(),this.headers.has(e.toLowerCase())}get(e){this.init();let i=this.headers.get(e.toLowerCase());return i&&i.length>0?i[0]:null}keys(){return this.init(),Array.from(this.normalizedNames.values())}getAll(e){return this.init(),this.headers.get(e.toLowerCase())||null}append(e,i){return this.clone({name:e,value:i,op:"a"})}set(e,i){return this.clone({name:e,value:i,op:"s"})}delete(e,i){return this.clone({name:e,value:i,op:"d"})}maybeSetNormalizedName(e,i){this.normalizedNames.has(i)||this.normalizedNames.set(i,e)}init(){this.lazyInit&&(this.lazyInit instanceof t?this.copyFrom(this.lazyInit):this.lazyInit(),this.lazyInit=null,this.lazyUpdate&&(this.lazyUpdate.forEach(e=>this.applyUpdate(e)),this.lazyUpdate=null))}copyFrom(e){e.init(),Array.from(e.headers.keys()).forEach(i=>{this.headers.set(i,e.headers.get(i)),this.normalizedNames.set(i,e.normalizedNames.get(i))})}clone(e){let i=new t;return i.lazyInit=this.lazyInit&&this.lazyInit instanceof t?this.lazyInit:this,i.lazyUpdate=(this.lazyUpdate||[]).concat([e]),i}applyUpdate(e){let i=e.name.toLowerCase();switch(e.op){case"a":case"s":let n=e.value;if(typeof n=="string"&&(n=[n]),n.length===0)return;this.maybeSetNormalizedName(e.name,i);let r=(e.op==="a"?this.headers.get(i):void 0)||[];r.push(...n),this.headers.set(i,r);break;case"d":let o=e.value;if(!o)this.headers.delete(i),this.normalizedNames.delete(i);else{let s=this.headers.get(i);if(!s)return;s=s.filter(a=>o.indexOf(a)===-1),s.length===0?(this.headers.delete(i),this.normalizedNames.delete(i)):this.headers.set(i,s)}break}}addHeaderEntry(e,i){let n=e.toLowerCase();this.maybeSetNormalizedName(e,n),this.headers.has(n)?this.headers.get(n).push(i):this.headers.set(n,[i])}setHeaderEntries(e,i){let n=(Array.isArray(i)?i:[i]).map(o=>o.toString()),r=e.toLowerCase();this.headers.set(r,n),this.maybeSetNormalizedName(e,r)}forEach(e){this.init(),Array.from(this.normalizedNames.keys()).forEach(i=>e(this.normalizedNames.get(i),this.headers.get(i)))}};var FI=function(t){return t[t.Sent=0]="Sent",t[t.UploadProgress=1]="UploadProgress",t[t.ResponseHeader=2]="ResponseHeader",t[t.DownloadProgress=3]="DownloadProgress",t[t.Response=4]="Response",t[t.User=5]="User",t}(FI||{}),pv=class{constructor(e,i=200,n="OK"){d(this,"headers");d(this,"status");d(this,"statusText");d(this,"url");d(this,"ok");d(this,"type");this.headers=e.headers||new up,this.status=e.status!==void 0?e.status:i,this.statusText=e.statusText||n,this.url=e.url||null,this.ok=this.status>=200&&this.status<300}};var lp=class t extends pv{constructor(i={}){super(i);d(this,"body");d(this,"type",FI.Response);this.body=i.body!==void 0?i.body:null}clone(i={}){return new t({body:i.body!==void 0?i.body:this.body,headers:i.headers||this.headers,status:i.status!==void 0?i.status:this.status,statusText:i.statusText||this.statusText,url:i.url||this.url||void 0})}};var Q8=new k("");var X8=new k(""),SI="b",MI="h",AI="s",kI="st",OI="u",NI="rt",ap=new k(""),J8=["GET","HEAD"];function eH(t,e){var g;let m=h(ap),{isCacheActive:i}=m,n=ho(m,["isCacheActive"]),{transferCache:r,method:o}=t;if(!i||r===!1||o==="POST"&&!n.includePostRequests&&!r||o!=="POST"&&!J8.includes(o)||!n.includeRequestsWithAuthHeaders&&tH(t)||((g=n.filter)==null?void 0:g.call(n,t))===!1)return e(t);let s=h(_a),a=h(X8,{optional:!0}),u=nl(h(Ui));if(a&&!u)throw new j(2803,!1);let l=u&&a?oH(t.url,a):t.url,c=iH(t,l),f=s.get(c,null),p=n.includeHeaders;if(typeof r=="object"&&r.includeHeaders&&(p=r.includeHeaders),f){let{[SI]:y,[NI]:b,[MI]:D,[AI]:I,[kI]:N,[OI]:A}=f,V=y;switch(b){case"arraybuffer":V=new TextEncoder().encode(y).buffer;break;case"blob":V=new Blob([y]);break}let z=new up(D);return ce(new lp({body:V,headers:z,status:I,statusText:N,url:A}))}return e(t).pipe(ei(y=>{y instanceof lp&&u&&s.set(c,{[SI]:y.body,[MI]:nH(y.headers,p),[AI]:y.status,[kI]:y.statusText,[OI]:l,[NI]:t.responseType})}))}function tH(t){return t.headers.has("authorization")||t.headers.has("proxy-authorization")}function nH(t,e){if(!e)return{};let i={};for(let n of e){let r=t.getAll(n);r!==null&&(i[n]=r)}return i}function PI(t){return[...t.keys()].sort().map(e=>`${e}=${t.getAll(e)}`).join("&")}function iH(t,e){let{params:i,method:n,responseType:r}=t,o=PI(i),s=t.serializeBody();s instanceof URLSearchParams?s=PI(s):typeof s!="string"&&(s="");let a=[n,r,e,s,o].join("|"),u=rH(a);return u}function rH(t){let e=0;for(let i of t)e=Math.imul(31,e)+i.charCodeAt(0)<<0;return e+=2147483648,e.toString()}function RI(t){return[{provide:ap,useFactory:()=>(bi("NgHttpTransferCache"),M({isCacheActive:!0},t))},{provide:Q8,useValue:eH,multi:!0,deps:[_a,ap]},{provide:lf,multi:!0,useFactory:()=>{let e=h(vr),i=h(ap);return()=>{e.whenStable().then(()=>{i.isCacheActive=!1})}}}]}function oH(t,e){let i=new URL(t,"resolve://").origin,n=e[i];return n?t.replace(i,n):t}var mv=class extends hf{constructor(){super(...arguments);d(this,"supportsDOMEvents",!0)}},gv=class t extends mv{static makeCurrent(){OT(new t)}onAndCancel(e,i,n){return e.addEventListener(i,n),()=>{e.removeEventListener(i,n)}}dispatchEvent(e,i){e.dispatchEvent(i)}remove(e){e.remove()}createElement(e,i){return i=i||this.getDefaultDocument(),i.createElement(e)}createHtmlDocument(){return document.implementation.createHTMLDocument("fakeTitle")}getDefaultDocument(){return document}isElementNode(e){return e.nodeType===Node.ELEMENT_NODE}isShadowRoot(e){return e instanceof DocumentFragment}getGlobalEventTarget(e,i){return i==="window"?window:i==="document"?e:i==="body"?e.body:null}getBaseHref(e){let i=sH();return i==null?null:aH(i)}resetBaseElement(){Cl=null}getUserAgent(){return window.navigator.userAgent}getCookie(e){return dy(document.cookie,e)}},Cl=null;function sH(){return Cl=Cl||document.querySelector("base"),Cl?Cl.getAttribute("href"):null}function aH(t){return new URL(t,document.baseURI).pathname}var uH=(()=>{let e=class e{build(){return new XMLHttpRequest}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),Dl=new k(""),jI=(()=>{let e=class e{constructor(n,r){d(this,"_zone");d(this,"_plugins");d(this,"_eventNameToPlugin",new Map);this._zone=r,n.forEach(o=>{o.manager=this}),this._plugins=n.slice().reverse()}addEventListener(n,r,o){return this._findPluginFor(r).addEventListener(n,r,o)}getZone(){return this._zone}_findPluginFor(n){let r=this._eventNameToPlugin.get(n);if(r)return r;if(r=this._plugins.find(s=>s.supports(n)),!r)throw new j(5101,!1);return this._eventNameToPlugin.set(n,r),r}};d(e,"\u0275fac",function(r){return new(r||e)($e(Dl),$e(me))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),dp=class{constructor(e){d(this,"_doc");d(this,"manager");this._doc=e}},cp="ng-app-id";function LI(t){for(let e of t)e.remove()}function HI(t,e){let i=e.createElement("style");return i.textContent=t,i}function lH(t,e,i,n){var o;let r=(o=t.head)==null?void 0:o.querySelectorAll(`style[${cp}="${e}"],link[${cp}="${e}"]`);if(r)for(let s of r)s.removeAttribute(cp),s instanceof HTMLLinkElement?n.set(s.href.slice(s.href.lastIndexOf("/")+1),{usage:0,elements:[s]}):s.textContent&&i.set(s.textContent,{usage:0,elements:[s]})}function yv(t,e){let i=e.createElement("link");return i.setAttribute("rel","stylesheet"),i.setAttribute("href",t),i}var UI=(()=>{let e=class e{constructor(n,r,o,s={}){d(this,"doc");d(this,"appId");d(this,"nonce");d(this,"inline",new Map);d(this,"external",new Map);d(this,"hosts",new Set);d(this,"isServer");this.doc=n,this.appId=r,this.nonce=o,this.isServer=nl(s),lH(n,r,this.inline,this.external),this.hosts.add(n.head)}addStyles(n,r){for(let o of n)this.addUsage(o,this.inline,HI);r==null||r.forEach(o=>this.addUsage(o,this.external,yv))}removeStyles(n,r){for(let o of n)this.removeUsage(o,this.inline);r==null||r.forEach(o=>this.removeUsage(o,this.external))}addUsage(n,r,o){let s=r.get(n);s?s.usage++:r.set(n,{usage:1,elements:[...this.hosts].map(a=>this.addElement(a,o(n,this.doc)))})}removeUsage(n,r){let o=r.get(n);o&&(o.usage--,o.usage<=0&&(LI(o.elements),r.delete(n)))}ngOnDestroy(){for(let[,{elements:n}]of[...this.inline,...this.external])LI(n);this.hosts.clear()}addHost(n){this.hosts.add(n);for(let[r,{elements:o}]of this.inline)o.push(this.addElement(n,HI(r,this.doc)));for(let[r,{elements:o}]of this.external)o.push(this.addElement(n,yv(r,this.doc)))}removeHost(n){this.hosts.delete(n)}addElement(n,r){return this.nonce&&r.setAttribute("nonce",this.nonce),this.isServer&&r.setAttribute(cp,this.appId),n.appendChild(r)}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe),$e(Ud),$e(Ig,8),$e(Ui))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),hv={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/",math:"http://www.w3.org/1998/Math/MathML"},_v=/%COMP%/g,$I="%COMP%",cH=`_nghost-${$I}`,dH=`_ngcontent-${$I}`,fH=!0,pH=new k("",{providedIn:"root",factory:()=>fH});function hH(t){return dH.replace(_v,t)}function mH(t){return cH.replace(_v,t)}function GI(t,e){return e.map(i=>i.replace(_v,t))}var BI=(()=>{let e=class e{constructor(n,r,o,s,a,u,l,c=null){d(this,"eventManager");d(this,"sharedStylesHost");d(this,"appId");d(this,"removeStylesOnCompDestroy");d(this,"doc");d(this,"platformId");d(this,"ngZone");d(this,"nonce");d(this,"rendererByCompId",new Map);d(this,"defaultRenderer");d(this,"platformIsServer");this.eventManager=n,this.sharedStylesHost=r,this.appId=o,this.removeStylesOnCompDestroy=s,this.doc=a,this.platformId=u,this.ngZone=l,this.nonce=c,this.platformIsServer=nl(u),this.defaultRenderer=new El(n,a,l,this.platformIsServer)}createRenderer(n,r){if(!n||!r)return this.defaultRenderer;this.platformIsServer&&r.encapsulation===hr.ShadowDom&&(r=U(M({},r),{encapsulation:hr.Emulated}));let o=this.getOrCreateRenderer(n,r);return o instanceof fp?o.applyToHost(n):o instanceof wl&&o.applyStyles(),o}getOrCreateRenderer(n,r){let o=this.rendererByCompId,s=o.get(r.id);if(!s){let a=this.doc,u=this.ngZone,l=this.eventManager,c=this.sharedStylesHost,f=this.removeStylesOnCompDestroy,p=this.platformIsServer;switch(r.encapsulation){case hr.Emulated:s=new fp(l,c,r,this.appId,f,a,u,p);break;case hr.ShadowDom:return new vv(l,c,n,r,a,u,this.nonce,p);default:s=new wl(l,c,r,f,a,u,p);break}o.set(r.id,s)}return s}ngOnDestroy(){this.rendererByCompId.clear()}};d(e,"\u0275fac",function(r){return new(r||e)($e(jI),$e(UI),$e(Ud),$e(pH),$e(qe),$e(Ui),$e(me),$e(Ig))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),El=class{constructor(e,i,n,r){d(this,"eventManager");d(this,"doc");d(this,"ngZone");d(this,"platformIsServer");d(this,"data",Object.create(null));d(this,"throwOnSyntheticProps",!0);d(this,"destroyNode",null);this.eventManager=e,this.doc=i,this.ngZone=n,this.platformIsServer=r}destroy(){}createElement(e,i){return i?this.doc.createElementNS(hv[i]||i,e):this.doc.createElement(e)}createComment(e){return this.doc.createComment(e)}createText(e){return this.doc.createTextNode(e)}appendChild(e,i){(VI(e)?e.content:e).appendChild(i)}insertBefore(e,i,n){e&&(VI(e)?e.content:e).insertBefore(i,n)}removeChild(e,i){i.remove()}selectRootElement(e,i){let n=typeof e=="string"?this.doc.querySelector(e):e;if(!n)throw new j(-5104,!1);return i||(n.textContent=""),n}parentNode(e){return e.parentNode}nextSibling(e){return e.nextSibling}setAttribute(e,i,n,r){if(r){i=r+":"+i;let o=hv[r];o?e.setAttributeNS(o,i,n):e.setAttribute(i,n)}else e.setAttribute(i,n)}removeAttribute(e,i,n){if(n){let r=hv[n];r?e.removeAttributeNS(r,i):e.removeAttribute(`${n}:${i}`)}else e.removeAttribute(i)}addClass(e,i){e.classList.add(i)}removeClass(e,i){e.classList.remove(i)}setStyle(e,i,n,r){r&(mr.DashCase|mr.Important)?e.style.setProperty(i,n,r&mr.Important?"important":""):e.style[i]=n}removeStyle(e,i,n){n&mr.DashCase?e.style.removeProperty(i):e.style[i]=""}setProperty(e,i,n){e!=null&&(e[i]=n)}setValue(e,i){e.nodeValue=i}listen(e,i,n){if(typeof e=="string"&&(e=br().getGlobalEventTarget(this.doc,e),!e))throw new Error(`Unsupported event target ${e} for event ${i}`);return this.eventManager.addEventListener(e,i,this.decoratePreventDefault(n))}decoratePreventDefault(e){return i=>{if(i==="__ngUnwrap__")return e;(this.platformIsServer?this.ngZone.runGuarded(()=>e(i)):e(i))===!1&&i.preventDefault()}}};function VI(t){return t.tagName==="TEMPLATE"&&t.content!==void 0}var vv=class extends El{constructor(i,n,r,o,s,a,u,l){var p;super(i,s,a,l);d(this,"sharedStylesHost");d(this,"hostEl");d(this,"shadowRoot");this.sharedStylesHost=n,this.hostEl=r,this.shadowRoot=r.attachShadow({mode:"open"}),this.sharedStylesHost.addHost(this.shadowRoot);let c=GI(o.id,o.styles);for(let m of c){let g=document.createElement("style");u&&g.setAttribute("nonce",u),g.textContent=m,this.shadowRoot.appendChild(g)}let f=(p=o.getExternalStyles)==null?void 0:p.call(o);if(f)for(let m of f){let g=yv(m,s);u&&g.setAttribute("nonce",u),this.shadowRoot.appendChild(g)}}nodeOrShadowRoot(i){return i===this.hostEl?this.shadowRoot:i}appendChild(i,n){return super.appendChild(this.nodeOrShadowRoot(i),n)}insertBefore(i,n,r){return super.insertBefore(this.nodeOrShadowRoot(i),n,r)}removeChild(i,n){return super.removeChild(null,n)}parentNode(i){return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(i)))}destroy(){this.sharedStylesHost.removeHost(this.shadowRoot)}},wl=class extends El{constructor(i,n,r,o,s,a,u,l){var c;super(i,s,a,u);d(this,"sharedStylesHost");d(this,"removeStylesOnCompDestroy");d(this,"styles");d(this,"styleUrls");this.sharedStylesHost=n,this.removeStylesOnCompDestroy=o,this.styles=l?GI(l,r.styles):r.styles,this.styleUrls=(c=r.getExternalStyles)==null?void 0:c.call(r,l)}applyStyles(){this.sharedStylesHost.addStyles(this.styles,this.styleUrls)}destroy(){this.removeStylesOnCompDestroy&&this.sharedStylesHost.removeStyles(this.styles,this.styleUrls)}},fp=class extends wl{constructor(i,n,r,o,s,a,u,l){let c=o+"-"+r.id;super(i,n,r,s,a,u,l,c);d(this,"contentAttr");d(this,"hostAttr");this.contentAttr=hH(c),this.hostAttr=mH(c)}applyToHost(i){this.applyStyles(),this.setAttribute(i,this.hostAttr,"")}createElement(i,n){let r=super.createElement(i,n);return super.setAttribute(r,this.contentAttr,""),r}},gH=(()=>{let e=class e extends dp{constructor(n){super(n)}supports(n){return!0}addEventListener(n,r,o){return n.addEventListener(r,o,!1),()=>this.removeEventListener(n,r,o)}removeEventListener(n,r,o){return n.removeEventListener(r,o)}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),zI=["alt","control","meta","shift"],yH={"\b":"Backspace"," ":"Tab","\x7F":"Delete","\x1B":"Escape",Del:"Delete",Esc:"Escape",Left:"ArrowLeft",Right:"ArrowRight",Up:"ArrowUp",Down:"ArrowDown",Menu:"ContextMenu",Scroll:"ScrollLock",Win:"OS"},vH={alt:t=>t.altKey,control:t=>t.ctrlKey,meta:t=>t.metaKey,shift:t=>t.shiftKey},bH=(()=>{let e=class e extends dp{constructor(n){super(n)}supports(n){return e.parseEventName(n)!=null}addEventListener(n,r,o){let s=e.parseEventName(r),a=e.eventCallback(s.fullKey,o,this.manager.getZone());return this.manager.getZone().runOutsideAngular(()=>br().onAndCancel(n,s.domEventName,a))}static parseEventName(n){let r=n.toLowerCase().split("."),o=r.shift();if(r.length===0||!(o==="keydown"||o==="keyup"))return null;let s=e._normalizeKey(r.pop()),a="",u=r.indexOf("code");if(u>-1&&(r.splice(u,1),a="code."),zI.forEach(c=>{let f=r.indexOf(c);f>-1&&(r.splice(f,1),a+=c+".")}),a+=s,r.length!=0||s.length===0)return null;let l={};return l.domEventName=o,l.fullKey=a,l}static matchEventFullKeyCode(n,r){let o=yH[n.key]||n.key,s="";return r.indexOf("code.")>-1&&(o=n.code,s="code."),o==null||!o?!1:(o=o.toLowerCase(),o===" "?o="space":o==="."&&(o="dot"),zI.forEach(a=>{if(a!==o){let u=vH[a];u(n)&&(s+=a+".")}}),s+=o,s===r)}static eventCallback(n,r,o){return s=>{e.matchEventFullKeyCode(s,n)&&o.runGuarded(()=>r(s))}}static _normalizeKey(n){return n==="esc"?"escape":n}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})();function Foe(t,e){return vT(M({rootComponent:t},_H(e)))}function _H(t){return{appProviders:[...TH,...(t==null?void 0:t.providers)??[]],platformProviders:wH}}function CH(){gv.makeCurrent()}function DH(){return new pr}function EH(){return EE(document),document}var wH=[{provide:Ui,useValue:fy},{provide:xg,useValue:CH,multi:!0},{provide:qe,useFactory:EH,deps:[]}];var TH=[{provide:Fd,useValue:"root"},{provide:pr,useFactory:DH,deps:[]},{provide:Dl,useClass:gH,multi:!0,deps:[qe,me,Ui]},{provide:Dl,useClass:bH,multi:!0,deps:[qe]},BI,UI,jI,{provide:ca,useExisting:BI},{provide:mf,useClass:uH,deps:[]},[]];var WI=(()=>{let e=class e{constructor(n){d(this,"_doc");d(this,"_dom");this._doc=n,this._dom=br()}addTag(n,r=!1){return n?this._getOrCreateElement(n,r):null}addTags(n,r=!1){return n?n.reduce((o,s)=>(s&&o.push(this._getOrCreateElement(s,r)),o),[]):[]}getTag(n){return n&&this._doc.querySelector(`meta[${n}]`)||null}getTags(n){if(!n)return[];let r=this._doc.querySelectorAll(`meta[${n}]`);return r?[].slice.call(r):[]}updateTag(n,r){if(!n)return null;r=r||this._parseSelector(n);let o=this.getTag(r);return o?this._setMetaElementAttributes(n,o):this._getOrCreateElement(n,!0)}removeTag(n){this.removeTagElement(this.getTag(n))}removeTagElement(n){n&&this._dom.remove(n)}_getOrCreateElement(n,r=!1){if(!r){let a=this._parseSelector(n),u=this.getTags(a).filter(l=>this._containsAttributes(n,l))[0];if(u!==void 0)return u}let o=this._dom.createElement("meta");return this._setMetaElementAttributes(n,o),this._doc.getElementsByTagName("head")[0].appendChild(o),o}_setMetaElementAttributes(n,r){return Object.keys(n).forEach(o=>r.setAttribute(this._getMetaKeyMap(o),n[o])),r}_parseSelector(n){let r=n.name?"name":"property";return`${r}="${n[r]}"`}_containsAttributes(n,r){return Object.keys(n).every(o=>r.getAttribute(this._getMetaKeyMap(o))===n[o])}_getMetaKeyMap(n){return xH[n]||n}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})(),xH={httpEquiv:"http-equiv"},Roe=(()=>{let e=class e{constructor(n){d(this,"_doc");this._doc=n}getTitle(){return this._doc.title}setTitle(n){this._doc.title=n||""}};d(e,"\u0275fac",function(r){return new(r||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})();var ws=(()=>{let e=class e{};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:function(r){let o=null;return r?o=new(r||e):o=$e(IH),o},providedIn:"root"}));let t=e;return t})(),IH=(()=>{let e=class e extends ws{constructor(r){super();d(this,"_doc");this._doc=r}sanitize(r,o){if(o==null)return null;switch(r){case ri.NONE:return o;case ri.HTML:return Kr(o,"HTML")?ii(o):Ng(this._doc,String(o)).toString();case ri.STYLE:return Kr(o,"Style")?ii(o):o;case ri.SCRIPT:if(Kr(o,"Script"))return ii(o);throw new j(5200,!1);case ri.URL:return Kr(o,"URL")?ii(o):qd(String(o));case ri.RESOURCE_URL:if(Kr(o,"ResourceURL"))return ii(o);throw new j(5201,!1);default:throw new j(5202,!1)}}bypassSecurityTrustHtml(r){return FE(r)}bypassSecurityTrustStyle(r){return RE(r)}bypassSecurityTrustScript(r){return LE(r)}bypassSecurityTrustUrl(r){return HE(r)}bypassSecurityTrustResourceUrl(r){return BE(r)}};d(e,"\u0275fac",function(o){return new(o||e)($e(qe))}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac,providedIn:"root"}));let t=e;return t})(),bv=function(t){return t[t.NoHttpTransferCache=0]="NoHttpTransferCache",t[t.HttpTransferCacheOptions=1]="HttpTransferCacheOptions",t[t.I18nSupport=2]="I18nSupport",t[t.EventReplay=3]="EventReplay",t[t.IncrementalHydration=4]="IncrementalHydration",t}(bv||{});function Loe(...t){let e=[],i=new Set,n=i.has(bv.HttpTransferCacheOptions);for(let{\u0275providers:r,\u0275kind:o}of t)i.add(o),r.length&&e.push(r);return Gu([[],bT(),i.has(bv.NoHttpTransferCache)||n?[]:RI({}),e])}var ZI=(()=>{let e=class e{generate(){return`tui_${e.autoId++}${Date.now()}`}};e.autoId=0,e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();function KI(){return h(ZI).generate()}var Yoe=(()=>{let e=class e{constructor(n,r,o={}){this.options=o,this.id=h(ZI),this.component=new Xi(r),this.items$=h(n)}open(n,r={}){return new te(o=>{let s=U(M(M({},this.options),r),{content:n,$implicit:o,component:this.component,createdAt:Date.now(),id:this.id.generate(),completeWith:a=>{o.next(a),o.complete()}});return this.items$.next([...this.items$.value,s]),()=>{this.items$.next(this.items$.value.filter(a=>a!==s))}})}};e.\u0275fac=function(r){lw()},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();var SH=300;function qI(t){return"scrollX"in t?t.scrollX:t.scrollLeft}function MH(t){return"scrollY"in t?t.scrollY:t.scrollTop}var Qoe=(()=>{let e=class e{constructor(){this.performanceRef=h(hx),this.animationFrame$=h(qi),this.zone=h(me)}scroll$(n,r,o=qI(n),s=SH){let a=MH(n),u=qI(n),l=r-a,c=o-u;return(s?Cu(()=>ce(this.performanceRef.now())).pipe(bt(p=>this.animationFrame$.pipe(S(m=>m-p))),S(p=>yx(Jt(p/s,0,1))),S(p=>[a+l*p,u+c*p]),Kt(gt(s,Fn(this.zone))),Hc([r,o])):ce([r,o])).pipe(ei(([p,m])=>{var g;(g=n.scrollTo)==null||g.call(n,m,p)}))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),Xoe=B(()=>{var t;return((t=h(WI).getTag('name="theme-color"'))==null?void 0:t.content)??""});var AH=65536,Cv=class{constructor(e){this.$implicit=e}},YI=(()=>{let e=class e{constructor(){this.viewContainer=h(zt),this.templateRef=h(It)}set tuiRepeatTimesOf(n){let r=Math.floor(Jt(n,0,AH)),{length:o}=this.viewContainer;n{let e=class e extends CI{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiResizable",""]],features:[oe]});let t=e;return t})(),QI=(()=>{let e=class e{constructor(){this.resizable=h(Dv),this.x=NaN,this.y=NaN,this.width=0,this.height=0,this.tuiResizer=[0,0],this.tuiSizeChange=new _e}get cursor(){return this.tuiResizer[0]?this.tuiResizer[1]?this.tuiResizer[0]*this.tuiResizer[1]>0?"nwse-resize":"nesw-resize":"ew-resize":"ns-resize"}onPointerDown(n,r){this.x=n,this.y=r,this.width=this.resizable.nativeElement.clientWidth,this.height=this.resizable.nativeElement.clientHeight}onPointerMove({x:n,y:r,buttons:o}){o?this.onMove(n,r):this.onPointerUp()}onPointerUp(){this.x=NaN}onMove(n,r){if(Number.isNaN(this.x))return;let{style:o}=this.resizable.nativeElement,s=[this.width+this.tuiResizer[0]*(n-this.x),this.height+this.tuiResizer[1]*(r-this.y)];this.tuiResizer[0]&&(o.width=ht(s[0])),this.tuiResizer[1]&&(o.height=ht(s[1])),this.tuiSizeChange.emit(s)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiResizer",""]],hostVars:4,hostBindings:function(r,o){r&1&&x("pointerdown.silent.prevent",function(a){return o.onPointerDown(a.x,a.y)})("pointermove.silent",function(a){return o.onPointerMove(a)},!1,Nn)("pointerup.silent",function(){return o.onPointerUp()},!1,Nn),r&2&&Ye("cursor",o.cursor)("touch-action","none")},inputs:{tuiResizer:"tuiResizer"},outputs:{tuiSizeChange:"tuiSizeChange"}});let t=e;return t})();var kH={cardNumber:["Number","Card number"],cardExpiry:["Expires","Valid through"]},OH={colorSelectorModeNames:["Solid color","Gradient"],toolbarTools:{undo:"Undo",redo:"Redo",font:"Font",fontStyle:"Font style",fontSize:"Font size",bold:"Bold",italic:"Italic",underline:"Underline",strikeThrough:"Strike through",justify:"Justify",justifyLeft:"Justify left",justifyCenter:"Justify center",justifyRight:"Justify right",justifyFull:"Justify full",list:"List",indent:"Indent",outdent:"Outdent",unorderedList:"Unordered list",orderedList:"Ordered list",quote:"Quote",foreColor:"Color",backColor:"Background color",hiliteColor:"Highlight color",clear:"Clear",link:"Link",attach:"Attach file",tex:"Insert TeX",code:"Code",image:"Insert image",insertHorizontalRule:"Insert horizontal rule",superscript:"Superscript",subscript:"Subscript",insertTable:"Insert table",insertGroup:"Insert group",hiliteGroup:"Hilite group",removeGroup:"Remove group",insertAnchor:"Insert anchor",mergeCells:"Merge cells",splitCells:"Split cells",rowsColumnsManaging:"Managing rows and columns",cellColor:"Cell color",setDetails:"Details",removeDetails:"Remove details"},editorEditLink:{urlExample:"example.com",anchorExample:"anchor"},editorTableCommands:[["Insert column before","Insert column after"],["Insert row before","Insert row after"],["Delete column","Delete row"]],editorCodeOptions:["Code in the text","Code in block"],editorFontOptions:{small:"Small",large:"Large",normal:"Normal",title:"Title",subtitle:"Subtitle"}},NH={showHideText:"Show/Hide",paginationTexts:{pages:"Pages",linesPerPage:"Lines per page",of:"of"}},PH={AD:"Andorra",AE:"United Arab Emirates",AF:"Afghanistan",AG:"Antigua & Barbuda",AI:"Anguilla",AL:"Albania",AM:"Armenia",AO:"Angola",AR:"Argentina",AT:"Austria",AU:"Australia",AW:"Aruba",AZ:"Azerbaijan",BA:"Bosnia & Herzegovina",BB:"Barbados",BD:"Bangladesh",BE:"Belgium",BF:"Burkina Faso",BG:"Bulgaria",BH:"Bahrain",BI:"Burundi",BJ:"Benin",BL:"St. Barth\xE9lemy",BM:"Bermuda",BN:"Brunei",BO:"Bolivia",BQ:"Caribbean Netherlands",BR:"Brazil",BS:"Bahamas",BT:"Bhutan",BW:"Botswana",BY:"Belarus",BZ:"Belize",CA:"Canada",CD:"Congo - Kinshasa",CF:"Central African Republic",CG:"Congo - Brazzaville",CH:"Switzerland",CI:"C\xF4te d\u2019Ivoire",CL:"Chile",CM:"Cameroon",CN:"China",CO:"Colombia",CR:"Costa Rica",CU:"Cuba",CV:"Cape Verde",CW:"Cura\xE7ao",CY:"Cyprus",CZ:"Czechia",DE:"Germany",DJ:"Djibouti",DK:"Denmark",DM:"Dominica",DO:"Dominican Republic",DZ:"Algeria",EC:"Ecuador",EE:"Estonia",EG:"Egypt",ER:"Eritrea",ES:"Spain",ET:"Ethiopia",FI:"Finland",FJ:"Fiji",FK:"Falkland Islands",FM:"Federated States of Micronesia",FR:"France",GA:"Gabon",GB:"United Kingdom",GD:"Grenada",GE:"Georgia",GF:"French Guiana",GH:"Ghana",GI:"Gibraltar",GL:"Greenland",GM:"Gambia",GN:"Guinea",GP:"Guadeloupe",GQ:"Equatorial Guinea",GR:"Greece",GT:"Guatemala",GW:"Guinea-Bissau",GY:"Guyana",HK:"Hong Kong",HN:"Honduras",HR:"Croatia",HT:"Haiti",HU:"Hungary",ID:"Indonesia",IE:"Ireland",IL:"Israel",IN:"India",IQ:"Iraq",IR:"Iran",IS:"Iceland",IT:"Italy",JM:"Jamaica",JO:"Jordan",JP:"Japan",KE:"Kenya",KG:"Kyrgyzstan",KH:"Cambodia",KM:"Comoros",KN:"St. Kitts & Nevis",KP:"North Korea",KR:"South Korea",KW:"Kuwait",KY:"Cayman Islands",KZ:"Kazakhstan",LA:"Laos",LB:"Lebanon",LC:"St. Lucia",LI:"Liechtenstein",LK:"Sri Lanka",LR:"Liberia",LS:"Lesotho",LT:"Lithuania",LU:"Luxembourg",LV:"Latvia",LY:"Libya",MA:"Morocco",MC:"Monaco",MD:"Moldova",ME:"Montenegro",MF:"St. Martin",MG:"Madagascar",MK:"North Macedonia",ML:"Mali",MM:"Myanmar (Burma)",MN:"Mongolia",MO:"Macao",MQ:"Martinique",MR:"Mauritania",MS:"Montserrat",MT:"Malta",MU:"Mauritius",MV:"Maldives",MW:"Malawi",MX:"Mexico",MY:"Malaysia",MZ:"Mozambique",NA:"Namibia",NC:"New Caledonia",NE:"Niger",NG:"Nigeria",NI:"Nicaragua",NL:"Netherlands",NO:"Norway",NP:"Nepal",NZ:"New Zealand",OM:"Oman",PA:"Panama",PE:"Peru",PF:"French Polynesia",PG:"Papua New Guinea",PH:"Philippines",PK:"Pakistan",PL:"Poland",PT:"Portugal",PW:"Palau",PY:"Paraguay",QA:"Qatar",RE:"R\xE9union",RO:"Romania",RS:"Serbia",RU:"Russia",RW:"Rwanda",SA:"Saudi Arabia",SB:"Solomon Islands",SC:"Seychelles",SD:"Sudan",SE:"Sweden",SG:"Singapore",SH:"St. Helena",SI:"Slovenia",SK:"Slovakia",SL:"Sierra Leone",SM:"San Marino",SN:"Senegal",SO:"Somalia",SR:"Suriname",ST:"S\xE3o Tom\xE9 & Pr\xEDncipe",SV:"El Salvador",SX:"Sint Maarten",SY:"Syria",SZ:"Eswatini",TC:"Turks & Caicos Islands",TD:"Chad",TG:"Togo",TH:"Thailand",TJ:"Tajikistan",TL:"Timor-Leste",TM:"Turkmenistan",TN:"Tunisia",TO:"Tonga",TR:"T\xFCrkiye",TT:"Trinidad & Tobago",TW:"Taiwan",TZ:"Tanzania",UA:"Ukraine",UG:"Uganda",US:"United States",UY:"Uruguay",UZ:"Uzbekistan",VC:"St. Vincent & Grenadines",VE:"Venezuela",VG:"British Virgin Islands",VN:"Vietnam",VU:"Vanuatu",WS:"Samoa",XK:"Kosovo",YE:"Yemen",YT:"Mayotte",ZA:"South Africa",ZM:"Zambia",ZW:"Zimbabwe",AC:"Ascension Island",AS:"American Samoa",AX:"\xC5land Islands",CC:"Cocos (Keeling) Islands",CK:"Cook Islands",CX:"Christmas Island",EH:"Western Sahara",FO:"Faroe Islands",GG:"Guernsey",GU:"Guam",IM:"Isle of Man",JE:"Jersey",IO:"British Indian Ocean Territory",KI:"Kiribati",MH:"Marshall Islands",MP:"Northern Mariana Islands",NF:"Norfolk Island",NR:"Nauru",NU:"Niue",PM:"Saint Pierre and Miquelon",PR:"Puerto Rico",PS:"Palestine",SJ:"Svalbard and Jan Mayen",SS:"South Sudan",TA:"Tristan da Cunha",TK:"Tokelau",TV:"Tuvalu",VA:"Holy See",VI:"Virgin Islands",WF:"Wallis and Futuna"},FH={months:["January","February","March","April","May","June","July","August","September","October","November","December"],close:"Close",clear:"Clear",nothingFoundMessage:"Nothing found",defaultErrorMessage:"Value is invalid",spinTexts:["Previous","Next"],shortWeekDays:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],countries:PH},RH={cancel:"Cancel",done:"Done",more:"More",otherDate:"Other date...",showAll:"Show all",hide:"Hide",mobileCalendarTexts:["Choose day","Choose range","Choose days"],range:["from","to"],countTexts:["Plus","Minus"],time:{"HH:MM":"HH:MM","HH:MM AA":"HH:MM AA","HH:MM:SS":"HH:MM:SS","HH:MM:SS AA":"HH:MM:SS AA","HH:MM:SS.MSS":"HH:MM:SS.MSS","HH:MM:SS.MSS AA":"HH:MM:SS.MSS AA"},dateTexts:{DMY:"dd.mm.yyyy",MDY:"mm.dd.yyyy",YMD:"yyyy.mm.dd"},digitalInformationUnits:["B","KiB","MiB"],passwordTexts:["Show password","Hide password"],copyTexts:["Copy","Copied"],shortCalendarMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],pagination:["Previous page","Next page"],fileTexts:{loadingError:"Upload failed",preview:"Preview",remove:"Remove"},inputFileTexts:{defaultLabelSingle:"or drop\xA0it\xA0here",defaultLabelMultiple:"or drop\xA0them\xA0here",defaultLinkSingle:"Choose a file",defaultLinkMultiple:"Choose files",maxSizeRejectionReason:"File is larger than",formatRejectionReason:"Wrong file type",drop:"Drop file here",dropMultiple:"Drop files here"},multiSelectTexts:{all:"Select all",none:"Select none"},confirm:{yes:"Yes",no:"No"},previewTexts:{rotate:"Rotate"},zoomTexts:{zoomOut:"Zoom out",zoomIn:"Zoom in",reset:"Reset"},phoneSearch:"Type country or code"},XI=M(M(M(M(M({name:"english"},FH),RH),NH),kH),OH);var JI=B(()=>XI),eS=B(()=>ce(h(JI))),LH=W(),HH=W("tuiLanguage");function Fe(t){return()=>h(eS).pipe(S(e=>e[t]))}var BH=new Map([["color-black-100","#909090"],["color-black-200","#666666"],["color-black-300","#333333"],["color-blue-100","#1771e6"],["color-blue-200","#1464cc"],["color-blue-300","#0953b3"],["color-gray-100","#f5f5f6"],["color-gray-200","#e7e8ea"],["color-gray-300","#cbcfd3"],["color-gray-400","#959ba4"],["color-gray-500","#79818c"],["color-gray-600","#616871"],["color-green-100","#39b54a"],["color-green-200","#2ca53a"],["color-green-300","#168a21"],["color-light-blue-100","#ecf1f7"],["color-light-blue-200","#e4ebf3"],["color-light-blue-300","#dde4ed"],["color-red-100","#e01f19"],["color-red-200","#d3120e"],["color-red-300","#c40b08"],["color-yellow-100","#FFDD2C"],["color-yellow-200","#FCC521"],["color-yellow-300","#FAB618"],["transparent","transparent"]]),Fa="rgb(51, 51, 51)",Oe={Align:"justify",Anchor:"anchor",Attach:"attach",Bold:"bold",Clear:"clear",Code:"code",Color:"foreColor",Details:"details",Group:"group",HR:"insertHorizontalRule",Hilite:"hiliteColor",Img:"image",Italic:"italic",Link:"link",List:"list",MergeCells:"mergeCells",Quote:"quote",RowsColumnsManaging:"rowsColumnsManaging",Size:"fontSize",SplitCells:"splitCells",Strikethrough:"strikeThrough",Sub:"subscript",Sup:"superscript",Table:"insertTable",CellColor:"cellColor",Tex:"tex",Underline:"underline",Undo:"undo"},Tl=new Set([Oe.Align,Oe.Anchor,Oe.Bold,Oe.CellColor,Oe.Clear,Oe.Code,Oe.Color,Oe.Details,Oe.Hilite,Oe.HR,Oe.Img,Oe.Italic,Oe.Link,Oe.List,Oe.Quote,Oe.Size,Oe.Strikethrough,Oe.Sub,Oe.Sup,Oe.Table,Oe.Underline,Oe.Undo]),Lo="tui_editor_resize";function VH(t){return[{px:13,name:t.small},{px:15,name:t.normal},{px:17,name:t.large},{px:24,family:"var(--tui-font-heading)",name:t.subtitle,headingLevel:2,weight:"bold"},{px:30,family:"var(--tui-font-heading)",name:t.title,headingLevel:1,weight:"bold"}]}var Ev=["id","class","src","style","controls","loop","muted","preload","autoplay","width","height","controlsList"],Ln="#",kse="http://",wv="https://",tS=":",xl="://",zH={protocol:wv},nS=(()=>{let e=class e{constructor(){this.stateChange$=new tt,this.valueChange$=new tt}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1});let t=e;return t})(),iS=new k("[TUI_EDITOR_EXTENSIONS]"),Tv=new k("[LAZY_EDITOR_EXTENSIONS]"),rS={translate:"no",spellcheck:!1,exampleText:"",placeholder:"",enableDefaultStyles:!0,tools:Tl,colors:BH,blankColor:Fa,linkOptions:zH,fontOptions:VH,floatingToolbar:!1,parseOptions:{},icons:{undo:"@tui.undo",redo:"@tui.redo",quote:"@tui.quote",link:"@tui.link",anchor:"@tui.anchor",attach:"@tui.paperclip",sub:"@tui.subscript",sup:"@tui.superscript",tex:"@tui.whole-word",image:"@tui.image",hr:"@tui.minus",clear:"@tui.remove-formatting",groupAdd:"@tui.plus",groupRemove:"@tui.circle-minus",detailsAdd:"@tui.copy-plus",detailsRemove:"@tui.square-minus",popupLinkSave:"@tui.save",popupLinkRemove:"@tui.x",popupPreviewLinkEdit:"@tui.pencil",popupPreviewLinkClear:"@tui.x",paint:"@tui.paint-bucket",hash:"@tui.hash",externalLink:"@tui.external-link",textAlignPreview:"@tui.align-left",textAlignLeft:"@tui.align-left",textAlignCenter:"@tui.align-center",textAlignRight:"@tui.align-right",textAlignJustify:"@tui.align-justify",textColor:"@tui.baseline",textHilite:"@tui.paint-roller",listPreview:"@tui.list",listUnOrdered:"@tui.list",listOrdered:"@tui.list-ordered",taskList:"@tui.check-check",indent:"@tui.indent-increase",outdent:"@tui.indent-decrease",fontSize:"@tui.a-large-small",insertTable:"@tui.table",tableCellMerge:"@tui.table-cells-merge",tableCellSplit:"@tui.table-rows-split",addRowTable:"@tui.between-horizontal-start",code:"@tui.code",fontStylePreview:"@tui.type-outline",fontStyleBold:"@tui.bold",fontStyleItalic:"@tui.italic",fontStyleUnderline:"@tui.underline",fontStyleStrike:"@tui.strikethrough",colorSelectorDropdownChevron:"@tui.chevron-down",colorSelectorDropdownCheck:"@tui.check",imageExtension:{settings:"@tui.settings",alignJustify:"@tui.align-justify",alignCenter:"@tui.align-center",alignLeft:"@tui.align-left",alignRight:"@tui.align-right"}}},xe=W(rS);function Ose(t){return Zi(xe,t,rS)}var oS=B(()=>null),sS=new k("[TUI_EDITOR_VALUE_TRANSFORMER]"),aS=new k("[TUI_ATTACH_FILES_OPTIONS]",{factory:()=>({accept:"*/*",multiple:!0})}),uS=new k("[TUI_ATTACH_FILES_LOADER]"),pp=' ',Nse=new k("[TUI_EDITOR_COLOR_SELECTOR_MODE_NAMES]",{factory:()=>["Solid color","Gradient"]}),lt=new k("[TUI_EDITOR_TOOLBAR_TEXTS]",{factory:Fe("toolbarTools")}),lS=new k("[TUI_EDITOR_TABLE_COMMANDS]",{factory:Fe("editorTableCommands")}),cS=new k("[TUI_EDITOR_LINK_TEXTS]",{factory:Fe("editorEditLink")}),dS=new k("[TUI_EDITOR_CODE_OPTIONS]",{factory:Fe("editorCodeOptions")}),fS=new k("[TUI_EDITOR_FONT_OPTIONS]",{factory:Fe("editorFontOptions")}),hp=new k("[TUI_IMAGE_LOADER]",{factory:()=>t=>{let e=new FileReader;return e.readAsDataURL(t),rt(e,"load").pipe(S(()=>String(e.result)))}}),Ra=new k("[TIPTAP_EDITOR]"),pS=new k("[LAZY_TIPTAP_EDITOR]",{factory:()=>{let t=new ur(1);return import("./chunk-VQY3XFA6.js").then(({Editor:e})=>t.next(e)).catch(()=>t.complete()),t}}),Il=new k("[INITIALIZATION_TIPTAP_CONTAINER]");var Ce="{{duration}}ms ease-in-out",no={params:{duration:300}},En=300,xv=wt("tuiParentAnimation",[Me(":leave",[Wt(":scope > *",[Hf()],{optional:!0})])]),Rse=wt("tuiParentStop",[Me(":enter",[])]),Lse=wt("tuiHost",[Me(":enter",[R({overflow:"clip"}),Wt(":scope > *",[Hf()],{optional:!0})]),Me(":leave",[Wt(":scope > *",[Hf()],{optional:!0})])]),Hse=wt("tuiHeightCollapse",[Me(":enter",[R({height:0}),ye(Ce,R({height:"*"}))],no),Me(":leave",[R({height:"*"}),ye(Ce,R({height:0}))],no)]),Bse=wt("tuiHeightCollapseList",[Me("* => *",[Wt(":enter",[R({height:0}),fn(En,[ye(Ce,R({height:"*"}))])],{optional:!0}),Wt(":leave",[R({height:"*"}),fn(En,[ye(Ce,R({height:0}))])],{optional:!0})],no)]),Vse=wt("tuiWidthCollapse",[Me(":enter",[R({width:0}),ye(Ce,R({width:"*"}))],no),Me(":leave",[R({width:"*"}),ye(Ce,R({width:0}))],no)]),zse=wt("tuiWidthCollapseList",[Me("* => *",[Wt(":enter",[R({width:0}),fn(En,[ye(Ce,R({width:"*"}))])],{optional:!0}),Wt(":leave",[R({width:"*"}),fn(En,[ye(Ce,R({width:0}))])],{optional:!0})],no)]),mp=wt("tuiFadeIn",[Me(":enter",[R({opacity:0}),ye(Ce,R({opacity:1}))],no),Me(":leave",[R({opacity:1}),ye(Ce,R({opacity:0}))],no)]),jse=wt("tuiFadeInList",[Me("* => *",[Wt(":enter",[R({opacity:0}),fn(En,[ye(Ce,R({opacity:1}))])],{optional:!0}),Wt(":leave",[R({opacity:1}),fn(En,[ye(Ce,R({opacity:0}))])],{optional:!0})],no)]),Use=wt("tuiFadeInTop",[Me(":enter",[R({transform:"translateY(-{{start}}px)",opacity:0}),ye(Ce,R({transform:"translateY({{end}})",opacity:1}))],{params:{end:0,start:10,duration:300}}),Me(":leave",[R({transform:"translateY({{end}})",opacity:1}),ye(Ce,R({transform:"translateY(-{{start}}px)",opacity:0}))],{params:{end:0,start:10,duration:300}})]),$se=wt("tuiFadeInBottom",[Me(":enter",[R({transform:"translateY({{start}}px)",opacity:0}),ye(Ce,R({transform:"translateY({{end}})",opacity:1}))],{params:{end:0,start:10,duration:300}}),Me(":leave",[R({transform:"translateY({{end}})",opacity:1}),ye(Ce,R({transform:"translateY({{start}}px)",opacity:0}))],{params:{end:0,start:10,duration:300}})]),hS=wt("tuiDropdownAnimation",[Me(":enter",[R({transform:"translateY(-{{start}}px)",opacity:0}),ye(Ce,R({transform:"translateY({{end}})",opacity:1}))],{params:{end:0,start:10,duration:300}}),Me(":leave",[R({transform:"translateY({{end}})",opacity:1}),ye(Ce,R({transform:"translateY(-{{start}}px)",opacity:0}))],{params:{end:0,start:10,duration:300}})]),mS=wt("tuiScaleIn",[Me(":enter",[R({transform:"scale({{start}})"}),ye("{{duration}}ms {{easing}}",R({transform:"scale({{end}})"}))],{params:{end:1,start:0,duration:300,easing:"ease-in-out"}}),Me(":leave",[R({transform:"scale({{end}})"}),ye(Ce,R({transform:"scale({{start}})"}))],{params:{end:1,start:0,duration:300}})]),Gse=wt("tuiPop",[Me(":enter",[R({transform:"scale({{start}})"}),ye(Ce,R({transform:"scale({{middle}})"})),ye(Ce,R({transform:"scale({{end}})"}))],{params:{end:1,middle:1.1,start:0,duration:300}}),Me(":leave",[R({transform:"scale({{end}})"}),ye(Ce,R({transform:"scale({{middle}})"})),ye(Ce,R({transform:"scale({{start}})"}))],{params:{end:1,middle:1.1,start:0,duration:300}})]),Wse=wt("tuiScaleInList",[Me("* => *",[Wt(":enter",[R({transform:"scale({{start}})"}),fn(En,[ye(Ce,R({transform:"scale({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"scale({{end}})"}),fn(En,[ye(Ce,R({transform:"scale({{start}})"}))])],{optional:!0})],{params:{end:1,start:0,duration:300}})]),qse=wt("tuiSlideIn",[Me("* => left",[R({transform:"translateX(-{{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me("left => *",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX(-{{start}})"}))],{params:{end:0,start:"100%",duration:300}}),Me("* => right",[R({transform:"translateX({{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me("right => *",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX({{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),Zse=wt("tuiSlideInLeft",[Me(":enter",[R({transform:"translateX(-{{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX(-{{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),Kse=wt("tuiSlideInLeftList",[Me("* => *",[Wt(":enter",[R({transform:"translateX(-{{start}})"}),fn(En,[ye(Ce,R({transform:"translateX({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateX({{end}})"}),fn(En,[ye(Ce,R({transform:"translateX(-{{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]),Yse=wt("tuiSlideInRight",[Me(":enter",[R({transform:"translateX({{start}})"}),ye(Ce,R({transform:"translateX({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translateX({{end}})"}),ye(Ce,R({transform:"translateX({{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),Qse=wt("tuiSlideInRightList",[Me("* => *",[Wt(":enter",[R({transform:"translateX({{start}})"}),fn(En,[ye(Ce,R({transform:"translateX({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateX({{end}})"}),fn(En,[ye(Ce,R({transform:"translateX({{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]),Xse=wt("tuiSlideInTop",[Me(":enter",[R({transform:"translate3d(0,{{start}},0)",pointerEvents:"none"}),ye(Ce,R({transform:"translate3d(0,{{end}},0)"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translate3d(0,{{end}},0)"}),ye(Ce,R({transform:"translate3d(0,{{start}},0)"}))],{params:{end:0,start:"100%",duration:300}})]),Jse=wt("tuiSlideInTopList",[Me("* => *",[Wt(":enter",[R({transform:"translateY({{start}})"}),fn(En,[ye(Ce,R({transform:"translateY({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateY({{end}})"}),fn(En,[ye(Ce,R({transform:"translateY({{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]),eae=wt("tuiSlideInBottom",[Me(":enter",[R({transform:"translateY(-{{start}})"}),ye(Ce,R({transform:"translateY({{end}})"}))],{params:{end:0,start:"100%",duration:300}}),Me(":leave",[R({transform:"translateY({{end}})"}),ye(Ce,R({transform:"translateY(-{{start}})"}))],{params:{end:0,start:"100%",duration:300}})]),tae=wt("tuiSlideInBottomList",[Me("* => *",[Wt(":enter",[R({transform:"translateY(-{{start}})"}),fn(En,[ye(Ce,R({transform:"translateY({{end}})"}))])],{optional:!0}),Wt(":leave",[R({transform:"translateY({{end}})"}),fn(En,[ye(Ce,R({transform:"translateY(-{{start}})"}))])],{optional:!0})],{params:{end:0,start:"100%",duration:300}})]);var gp=class{},Ii=class extends gp{},Si=class extends gp{};function gS(t,e,i){return{provide:t,deps:[[new qr,new qn,t],i],useFactory:Sl(e)}}function Sl(t){return(e,i)=>{var n;return((n=e==null?void 0:e.find)==null?void 0:n.call(e,r=>r!==i&&r.type===t))||i}}function vp(t,e){return gS(Ii,t,e)}function bp(t,e){return gS(Si,t,e)}function Iv(t){return De(Ii,t,!0)}function Ts(t){return De(Si,t,!0)}var yp=class{};function _p(t){return De(yp,t,!0)}var Er=class extends te{};function Ho(t){return De(Er,t,!0)}var Cp=(()=>{let e=class e{constructor(){this.destroyRef=h(it),this.drivers=h(Er,{self:!0,optional:!0})||[],this.vehicles=h(yp,{self:!0,optional:!0})}ngAfterViewInit(){var r;let n=(r=this.vehicles)==null?void 0:r.find(({type:o})=>o===this.type);nt(...this.drivers.filter(({type:o})=>o===this.type)).pipe(ke(),Se(this.destroyRef)).subscribe(o=>{n==null||n.toggle(o)})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1});let t=e;return t})();var jH={appearance:""},Dp=W(jH);function La(t){return De(Dp,t)}var UH=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-appearance"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiAppearance]{transition-property:color,background,opacity,box-shadow,border;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;position:relative;-webkit-appearance:none;appearance:none;outline:.125rem solid transparent;outline-offset:-.125rem}[tuiAppearance].tui-appearance-initializing{transition:none!important}[tuiAppearance]:focus-visible:not([data-focus=false]){outline-color:var(--tui-border-focus)}[tuiAppearance][data-focus=true]{outline-color:var(--tui-border-focus)}[tuiAppearance][tuiWrapper]:not(._focused):has(:focus-visible),[tuiAppearance][tuiWrapper]._focused{outline-color:var(--tui-border-focus)}[tuiAppearance]:disabled:not([data-state]),[tuiAppearance][data-state=disabled]{pointer-events:none;opacity:var(--tui-disabled-opacity)}[tuiAppearance][tuiWrapper]:disabled:not([data-state]),[tuiAppearance][tuiWrapper][data-state=disabled]{pointer-events:none;opacity:var(--tui-disabled-opacity)} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),Ji=(()=>{let e=class e{constructor(){this.el=Ee(),this.nothing=Dn(UH),this.modes=Pt((n=this.mode())=>!n||ul(n)?n:n.join(" ")),this.appearance=ge(h(Dp).appearance),this.state=ge(null),this.focus=ge(null),this.mode=ge(null),Ag(()=>{this.el.classList.toggle("tui-appearance-initializing",!!this.el.offsetWidth&&!1)})}set tuiAppearance(n){this.appearance.set(n)}set tuiAppearanceState(n){this.state.set(n)}set tuiAppearanceFocus(n){this.focus.set(n)}set tuiAppearanceMode(n){this.mode.set(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiAppearance",""]],hostAttrs:["tuiAppearance","",1,"tui-appearance-initializing"],hostVars:4,hostBindings:function(r,o){r&2&&Ke("data-appearance",o.appearance())("data-state",o.state())("data-focus",o.focus())("data-mode",o.modes())},inputs:{tuiAppearance:"tuiAppearance",tuiAppearanceState:"tuiAppearanceState",tuiAppearanceFocus:"tuiAppearanceFocus",tuiAppearanceMode:"tuiAppearanceMode"}});let t=e;return t})();function yS(t){return ko(Ji,"appearance",t)}function Ha(t){return ko(Ji,"state",t)}function Ep(t){return ko(Ji,"focus",t)}function wp(t){return ko(Ji,"mode",t)}var Ba=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Mt([{directive:Ji,inputs:["tuiAppearance","appearance","tuiAppearanceState","tuiAppearanceState","tuiAppearanceFocus","tuiAppearanceFocus","tuiAppearanceMode","tuiAppearanceMode"]}])]});let t=e;return t})();var $H=B(()=>{var t,e;return((e=(t=h(qe).defaultView)==null?void 0:t.matchMedia)==null?void 0:e.call(t,"(prefers-reduced-motion: reduce)").matches)??!1}),Va=B(()=>h($H)?0:1),GH=W("assets/taiga-ui/icons");var WH={check:"@tui.check",close:"@tui.x",error:"@tui.circle-alert",more:"@tui.chevron-right",search:"@tui.search",ellipsis:"@tui.ellipsis"},vS=W(WH);var qH="tuiDark",ZH=W(qH),Iae=B(()=>{let t=!0,e=h(fx),i=h(ZH),n=e.getItem(i),r=h(Je).matchMedia("(prefers-color-scheme: dark)"),o=ge(!!((n&&JSON.parse(n))??r.matches));return ct(r,"change").pipe(ot(()=>!e.getItem(i)),Se()).subscribe(()=>{t=!0,o.set(r.matches)}),Io(()=>{let s=String(o());t?t=!1:e.setItem(i,s)}),Object.assign(o,{reset:()=>{e.removeItem(i),t=!0,o.set(r.matches)}})}),KH={mode:"DMY",separator:"."},Sae=W(ce(KH));var Mae=W(t=>t.isWeekend?"weekend":"weekday"),Aae=W(ip.Monday),bS=B(Fe("months")),kae=B(Fe("close")),_S=B(Fe("clear")),CS=B(Fe("nothingFoundMessage")),Oae=B(Fe("defaultErrorMessage")),Nae=B(Fe("spinTexts")),Pae=B(Fe("shortWeekDays")),za=W(""),ja=W(""),YH=W({});var QH=B(()=>{let t=h(GH);return e=>`${t}/${e.replace("@tui.","").split(".").join("/")}.svg`});function Tp(){let t=h(YH),e=h(QH);return i=>!i||i.includes("/")?i:t[i]??e(i)}var DS=W({mobile:768,desktopSmall:1024,desktopLarge:1280}),XH={precision:NaN,decimalSeparator:".",thousandSeparator:Xr,rounding:"truncate",decimalMode:"pad"},Fae=W(ce(XH));var Ua=B(()=>new de(h(qe).documentElement)),Sv=B(()=>{let t=h(qe);return nt(rt(t,"selectionchange"),rt(t,"mouseup"),rt(t,"mousedown").pipe(bt(()=>rt(t,"mousemove").pipe(Kt(rt(t,"mouseup"))))),rt(t,"keydown"),rt(t,"keyup")).pipe(Ri())}),Rae=W({decrement:"@tui.chevron-left",increment:"@tui.chevron-right"}),Lae=W("Taiga UI"),$a=B(()=>{let t=h(Je);return{type:"viewport",getClientRect(){let e={top:0,left:0,right:t.innerWidth,bottom:t.innerHeight,width:t.innerWidth,height:t.innerHeight,x:0,y:0};return U(M({},e),{toJSON:()=>JSON.stringify(e)})}}});function ES(t){return De($a,t)}var JH=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-icons"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiIcons]{--t-icon-start: none;--t-icon-end: none}[tuiIcons]:before,[tuiIcons]:after{content:"";display:var(--t-icon-start);inline-size:1em;block-size:1em;line-height:1em;font-size:1.5rem;flex-shrink:0;background:currentColor;-webkit-mask:var(--t-icon-start) no-repeat center / contain;mask:var(--t-icon-start) no-repeat center / contain}[tuiIcons]:after{display:var(--t-icon-end);-webkit-mask:var(--t-icon-end) no-repeat center / contain;mask:var(--t-icon-end) no-repeat center / contain} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),eB=(()=>{let e=class e{constructor(){this.nothing=Dn(JH),this.resolver=Tp(),this.iconStart=h(za,{self:!0,optional:!0})||"",this.iconEnd=h(ja,{self:!0,optional:!0})||""}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,hostAttrs:["tuiIcons",""],hostVars:4,hostBindings:function(r,o){r&2&&Ye("--t-icon-start",o.iconStart?"url("+o.resolver(o.iconStart)+")":null)("--t-icon-end",o.iconEnd?"url("+o.resolver(o.iconEnd)+")":null)},inputs:{iconStart:"iconStart",iconEnd:"iconEnd"}});let t=e;return t})(),Bo=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Mt([{directive:eB,inputs:["iconStart","iconStart","iconEnd","iconEnd"]}])]});let t=e;return t})();var tB={appearance:"primary",size:"l"},[wS,TS]=Oo(tB),nB=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-button"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiButton],[tuiIconButton]{--t-size: var(--tui-height-l);--t-radius: var(--tui-radius-l);--t-gap: .25rem;--t-padding: 0 1.25rem;--t-margin: -.25rem;-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;position:relative;display:inline-flex;align-items:center;flex-shrink:0;box-sizing:border-box;white-space:nowrap;overflow:hidden;vertical-align:middle;max-inline-size:100%;gap:calc(var(--t-gap, var(--t-0, 0rem)) - 2 * var(--t-margin, 0rem));block-size:var(--t-size);justify-content:center;border-radius:var(--t-radius);padding:var(--t-padding);-webkit-user-select:none;user-select:none;cursor:pointer;font:var(--tui-font-text-m);font-weight:700}[tuiButton]>img,[tuiIconButton]>img,[tuiButton]>tui-svg,[tuiIconButton]>tui-svg,[tuiButton]>tui-icon,[tuiIconButton]>tui-icon,[tuiButton]>tui-avatar,[tuiIconButton]>tui-avatar,[tuiButton]>tui-badge,[tuiIconButton]>tui-badge,[tuiButton]>[tuiBadge],[tuiIconButton]>[tuiBadge],[tuiButton]>[tuiRadio],[tuiIconButton]>[tuiRadio],[tuiButton]>[tuiSwitch],[tuiIconButton]>[tuiSwitch],[tuiButton]>[tuiCheckbox],[tuiIconButton]>[tuiCheckbox],[tuiButton][tuiIcons]:before,[tuiIconButton][tuiIcons]:before,[tuiButton][tuiIcons]:after,[tuiIconButton][tuiIcons]:after{margin:var(--t-margin)}[tuiButton]>.t-loader,[tuiIconButton]>.t-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}[tuiButton]>.t-loader .t-text,[tuiIconButton]>.t-loader .t-text{position:absolute}[tuiButton][data-size=xs],[tuiIconButton][data-size=xs]{--t-size: var(--tui-height-xs);--t-radius: var(--tui-radius-xs);--t-gap: .125rem;--t-padding: 0 .375rem;--t-margin: -.125rem;font:var(--tui-font-text-s)}[tuiButton][data-size=xs] tui-svg,[tuiIconButton][data-size=xs] tui-svg,[tuiButton][data-size=xs] tui-icon,[tuiIconButton][data-size=xs] tui-icon,[tuiButton][data-size=xs]:before,[tuiIconButton][data-size=xs]:before{font-size:1rem}[tuiButton][data-size=s],[tuiIconButton][data-size=s]{--t-size: var(--tui-height-s);--t-radius: var(--tui-radius-s);--t-gap: .125rem;--t-padding: 0 .625rem;--t-margin: -.125rem;font:var(--tui-font-text-s)}[tuiButton][data-size=s] tui-svg,[tuiIconButton][data-size=s] tui-svg,[tuiButton][data-size=s] tui-icon,[tuiIconButton][data-size=s] tui-icon,[tuiButton][data-size=s]:not([tuiIconButton][data-appearance=icon]):not([tuiIconButton][data-appearance=link]):before,[tuiIconButton][data-size=s]:not([tuiIconButton][data-appearance=icon]):not([tuiIconButton][data-appearance=link]):before{font-size:1rem}[tuiButton][data-size=m],[tuiIconButton][data-size=m]{--t-size: var(--tui-height-m);--t-radius: var(--tui-radius-m);--t-gap: .125rem;--t-padding: 0 1rem;--t-margin: -.375rem;font:var(--tui-font-text-m);font-weight:700}[tuiButton][data-size=m]:after,[tuiIconButton][data-size=m]:after{margin-inline-end:-.125rem}[tuiButton]._loading,[tuiIconButton]._loading{--tui-disabled-opacity: 1;-webkit-text-fill-color:transparent}[tuiButton]._loading>*,[tuiIconButton]._loading>*,[tuiButton]._loading:before,[tuiIconButton]._loading:before,[tuiButton]._loading:after,[tuiIconButton]._loading:after{opacity:0}[tuiButton]._loading>.t-loader,[tuiIconButton]._loading>.t-loader{opacity:1}[tuiButton][tuiIcons]:after,[tuiIconButton][tuiIcons]:after{font-size:1rem}[tuiButton][tuiButtonVertical],[tuiIconButton][tuiButtonVertical]{--t-line-height: 1rem;--t-margin: var(--t-0, 0rem) !important;flex-direction:column;flex-shrink:1;block-size:auto;padding:.75rem;gap:.375rem;min-inline-size:5rem;white-space:pre-line;font:var(--tui-font-text-ui-s)}[tuiButton][tuiButtonVertical]>*,[tuiIconButton][tuiButtonVertical]>*{max-block-size:calc(var(--t-line-height) * 2)}[tuiIconButton]{gap:0;inline-size:var(--t-size);font-size:0!important;padding:0}[tuiIconButton][data-size=l]:after{margin:0}[tuiIconButton][tuiIconButton][style*="--t-icon-start:"]:after{display:none} `],encapsulation:2,changeDetection:0});let t=e;return t})(),Le=(()=>{let e=class e{constructor(){this.options=h(wS),this.nothing=Dn(nB),this.size=this.options.size}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["a","tuiButton",""],["button","tuiButton",""],["a","tuiIconButton",""],["button","tuiIconButton",""]],hostVars:1,hostBindings:function(r,o){r&2&&Ke("data-size",o.size)},inputs:{size:"size"},features:[Z([La(wS)]),Mt([Ba,Bo])]});let t=e;return t})();var iB={appearance:"action",pseudo:!1},xS=W(iB);var rB=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-link"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiLink]{--tui-text-tertiary: var(--tui-text-secondary);padding:0;background:transparent;border:none;cursor:pointer;font:inherit;color:inherit;-webkit-text-decoration:none dashed currentColor;text-decoration:none dashed currentColor;text-underline-offset:.2em;text-decoration-thickness:.7px;text-decoration-color:color-mix(in lch,currentColor,transparent)}[tuiLink]:hover{--tui-text-secondary: var(--tui-text-primary)}[tuiLink]:before{margin-inline-end:.25rem}[tuiLink]:after{margin-inline-start:.25rem}[tuiLink][tuiIcons]:before,[tuiLink][tuiIcons]:after{content:"\\2060";padding:calc(var(--tui-icon-size, 1rem) / 2);vertical-align:super;font-size:0;line-height:0;box-sizing:border-box}[tuiLink]:focus-visible:not([data-focus=false]){outline:none;background:var(--tui-service-selection-background);background:color-mix(in lch,currentColor 12%,transparent)}[tuiLink][data-focus=true]{outline:none;background:var(--tui-service-selection-background);background:color-mix(in lch,currentColor 12%,transparent)}[tuiLink][tuiWrapper]:not(._focused):has(:focus-visible),[tuiLink][tuiWrapper]._focused{outline:none;background:var(--tui-service-selection-background);background:color-mix(in lch,currentColor 12%,transparent)} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),IS=(()=>{let e=class e{constructor(){this.nothing=Dn(rB),this.pseudo=h(xS).pseudo}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["a","tuiLink",""],["button","tuiLink",""]],hostAttrs:["tuiLink",""],hostVars:2,hostBindings:function(r,o){r&2&&Ye("text-decoration-line",o.pseudo?"underline":null)},inputs:{pseudo:"pseudo"},features:[Z([La(xS)]),Mt([Ba,Bo])]});let t=e;return t})();function Mv(t){return!!t&&(oB(t)||Mv(t.parentElement))}function oB(t){var e;return((e=t.ownerDocument.defaultView)==null?void 0:e.getComputedStyle(t).getPropertyValue("position"))==="fixed"}function SS({document:t,innerWidth:e}){return Math.max(t.documentElement.clientWidth||0,e||0)}function Av(t){let e=t.cloneRange(),{startContainer:i,startOffset:n,endContainer:r,endOffset:o}=e,{ownerDocument:s}=i;if(!s)return e;let a=s.createTreeWalker(s.body,NodeFilter.SHOW_TEXT,xf);a.currentNode=i;do{let u=a.currentNode,l=u.textContent||"",c=u===i?l.slice(0,Math.max(0,n+1)):l,f=Math.max(c.lastIndexOf(" "),c.lastIndexOf(Xr),c.lastIndexOf(If))+1;if(e.setStart(u,0),f){e.setStart(u,f);break}}while(a.previousNode());a.currentNode=r;do{let u=a.currentNode,l=u.textContent||"",c=u===r?l.slice(o+1):l,f=[c.indexOf(" "),c.indexOf(Xr),c.indexOf(If)].reduce((p,m)=>p===-1||m===-1?Math.max(p,m):Math.min(p,m),-1);if(e.setEnd(u,l.length),f!==-1){e.setEnd(u,f+l.length-c.length);break}}while(a.nextNode());return e}var sB=["Spacebar","Backspace","Delete","ArrowLeft","ArrowRight","Left","Right","End","Home"];function AS(t=""){return t.length===1||sB.includes(t)}function kv(t,e="tui-hints"){var i;return!!((i=Ff(t))!=null&&i.some(n=>!n.closest(e)))}function Al(t,e){return(i,n)=>{let r=i||M({},n||e);return Object.keys(t).forEach(o=>{r[o]=t[o]}),r}}var MS={xxs:0,xs:1,s:2,m:3,l:4,xl:5,xxl:6};function vue(t,e="s"){return MS[t]>MS[e]}var Ov=300;function Ga(t,e){return{value:"",params:{duration:aB(t),easing:e}}}function aB(t){return t&&Ov/t}function uB(t,e){t&1&&Qt(0)}function lB(t,e){if(t&1){let i=q();E(0,"div",5),x("mousedown.capture.prevent",function(){return P(i),F(0)}),Q(1,"div",6),w()}if(t&2){let i=_().ngIf,n=_(2);Te("t-bar_has-horizontal",i[1]),v("@tuiFadeIn",n.options)}}function cB(t,e){if(t&1){let i=q();E(0,"div",7),x("mousedown.capture.prevent",function(){return P(i),F(0)}),Q(1,"div",8),w()}if(t&2){let i=_().ngIf,n=_(2);Te("t-bar_has-vertical",i[0]),v("@tuiFadeIn",n.options)}}function dB(t,e){if(t&1&&(_t(0),O(1,lB,2,3,"div",3)(2,cB,2,3,"div",4),Ct()),t&2){let i=e.ngIf;C(),v("ngIf",i[0]),C(),v("ngIf",i[1])}}function fB(t,e){if(t&1&&(O(0,dB,3,2,"ng-container",2),Y(1,"async")),t&2){let i=_();v("ngIf",J(1,1,i.refresh$))}}var pB=["*"];function hB(t,e){if(t&1&&Q(0,"tui-scroll-controls",2),t&2){let i=_();Te("t-hover-mode",i.options.mode==="hover")}}var kS=(()=>{let e=class e extends te{constructor(){super(n=>this.scroll$.subscribe(n)),this.el=Ee(),this.element=h(Ua).nativeElement,this.scroll$=nt(rt(this.el.parentElement,"mousedown").pipe(ot(({target:n})=>n!==this.el),S(n=>this.getScrolled(n,.5,.5))),rt(this.el,"mousedown").pipe(Ei(),bt(n=>{let{ownerDocument:r}=this.el,o=this.el.getBoundingClientRect(),s=mB(n,o),a=gB(n,o);return rt(r,"mousemove").pipe(S(u=>this.getScrolled(u,s,a)),Kt(rt(r,"mouseup")))})))}getScrolled({clientY:n,clientX:r},o,s){let{offsetHeight:a,offsetWidth:u}=this.el,{top:l,left:c,width:f,height:p}=this.el.parentElement.getBoundingClientRect(),m=this.element.scrollHeight-p,g=this.element.scrollWidth-f,y=(n-l-a*o)/(p-a),b=(r-c-u*s)/(f-u);return[m*y,g*b]}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();function mB({clientY:t},{top:e,height:i}){return(t-e)/i}function gB({clientX:t},{left:e,width:i}){return(t-e)/i}var xp=24,yB=(()=>{let e=class e{constructor(){this.el=h(Ua).nativeElement,this.style=Ee().style,this.scrollSub=h(kS).pipe(Se()).subscribe(([n,r])=>{this.el.style.scrollBehavior="auto",this.tuiScrollbar==="horizontal"?this.el.scrollLeft=r:this.el.scrollTop=n,this.el.style.scrollBehavior=""}),this.styleSub=nt(h(qi).pipe(gi(100,Fn())),bx(this.el)).pipe(Ei(),Se()).subscribe(()=>{let n={scrollTop:this.el.scrollTop,scrollHeight:this.el.scrollHeight,clientHeight:this.el.clientHeight,scrollLeft:this.el.scrollLeft,scrollWidth:this.el.scrollWidth,clientWidth:this.el.clientWidth},r=`${this.getThumb(n)*100}%`,o=`${this.getView(n)*100}%`;this.tuiScrollbar==="vertical"?(this.style.top=r,this.style.height=o):(this.style.left=r,this.style.width=o)}),this.tuiScrollbar="vertical"}getScrolled(n){return this.tuiScrollbar==="vertical"?n.scrollTop/(n.scrollHeight-n.clientHeight):n.scrollLeft/(n.scrollWidth-n.clientWidth)}getCompensation(n){return n.clientHeight*n.clientHeight/n.scrollHeight>xp&&this.tuiScrollbar==="vertical"||n.clientWidth*n.clientWidth/n.scrollWidth>xp&&this.tuiScrollbar==="horizontal"?0:this.tuiScrollbar==="vertical"?xp/n.clientHeight:xp/n.clientWidth}getThumb(n){let r=this.getCompensation(n)||this.getView(n);return this.getScrolled(n)*(1-r)}getView(n){return this.tuiScrollbar==="vertical"?Math.ceil(n.clientHeight/n.scrollHeight*100)/100:Math.ceil(n.clientWidth/n.scrollWidth*100)/100}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiScrollbar",""]],inputs:{tuiScrollbar:"tuiScrollbar"},features:[Z([kS])]});let t=e;return t})(),vB={mode:"always"},[OS,Bue]=Oo(vB),bB=(()=>{let e=class e{constructor(){this.scrollRef=h(Ua).nativeElement,this.nativeScrollbar=h(OS).mode==="native",this.options=Ga(h(Va)),this.refresh$=h(qi).pipe(gi(300,Fn()),S(()=>this.scrollbars),dt([!1,!1]),ke((n,r)=>n[0]===r[0]&&n[1]===r[1]),ai())}get scrollbars(){let{clientHeight:n,scrollHeight:r,clientWidth:o,scrollWidth:s}=this.scrollRef;return[Math.ceil(n/r*100)<100,Math.ceil(o/s*100)<100]}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-scroll-controls"]],decls:3,vars:2,consts:[["custom",""],[4,"ngIf","ngIfElse"],[4,"ngIf"],["class","t-bar t-bar_vertical",3,"t-bar_has-horizontal","mousedown.capture.prevent",4,"ngIf"],["class","t-bar t-bar_horizontal",3,"t-bar_has-vertical","mousedown.capture.prevent",4,"ngIf"],[1,"t-bar","t-bar_vertical",3,"mousedown.capture.prevent"],["tuiScrollbar","vertical",1,"t-thumb"],[1,"t-bar","t-bar_horizontal",3,"mousedown.capture.prevent"],["tuiScrollbar","horizontal",1,"t-thumb"]],template:function(r,o){if(r&1&&O(0,uB,1,0,"ng-container",1)(1,fB,2,3,"ng-template",null,0,We),r&2){let s=be(2);v("ngIf",o.nativeScrollbar)("ngIfElse",s)}},dependencies:[Re,ut,yB],styles:["[_nghost-%COMP%]{position:sticky;top:0;left:0;z-index:1;min-inline-size:calc(100% - 1px);min-block-size:calc(100% - 1px);max-inline-size:calc(100% - 1px);max-block-size:calc(100% - 1px);float:inline-start;margin-inline-end:calc(-100% + 1px);pointer-events:none}.t-bar[_ngcontent-%COMP%]{position:absolute;right:0;bottom:0;pointer-events:auto}.t-bar_vertical[_ngcontent-%COMP%]{top:0;inline-size:.875rem}.t-bar_horizontal[_ngcontent-%COMP%]{left:0;block-size:.875rem}.t-bar_has-horizontal[_ngcontent-%COMP%]{bottom:.5rem}.t-bar_has-vertical[_ngcontent-%COMP%]{right:.5rem}.t-thumb[_ngcontent-%COMP%]{transition-property:all;transition-duration:.15s;transition-timing-function:ease-in-out;position:absolute;border-radius:6.25rem;border:.25rem solid transparent;cursor:pointer;pointer-events:auto;-webkit-user-select:none;user-select:none;background:currentColor;background-clip:content-box;box-sizing:border-box;transition-property:width,height,opacity;opacity:.2}.t-thumb[_ngcontent-%COMP%]:hover{opacity:.24}.t-thumb[_ngcontent-%COMP%]:active{opacity:.48}.t-bar_vertical[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]{right:0;inline-size:.75rem;min-block-size:1.25rem}.t-bar_vertical[_ngcontent-%COMP%]:hover .t-thumb[_ngcontent-%COMP%], .t-bar_vertical[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]:active{inline-size:.875rem}.t-bar_horizontal[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]{bottom:0;block-size:.75rem;min-inline-size:1.25rem}.t-bar_horizontal[_ngcontent-%COMP%]:hover .t-thumb[_ngcontent-%COMP%], .t-bar_horizontal[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]:active{block-size:.875rem}"],data:{animation:[hp]},changeDetection:0});let t=e;return t})(),_B="tui-scroll-into-view";var Wa=(()=>{let e=class e{constructor(){this.el=Ee(),this.options=h(OS),this.isIOS=h(Na),this.browserScrollRef=new de(this.el),this.hidden=this.options.mode==="hidden"}get delegated(){return this.scrollRef!==this.el||this.options.mode==="native"}get scrollRef(){return this.browserScrollRef.nativeElement}set scrollRef(n){this.browserScrollRef.nativeElement=n}scrollIntoView(n){var c,f;if(this.delegated)return;let{offsetHeight:r,offsetWidth:o}=n,{offsetTop:s,offsetLeft:a}=Tx(this.scrollRef,n),u=s+r/2-this.scrollRef.clientHeight/2,l=a+o/2-this.scrollRef.clientWidth/2;(f=(c=this.scrollRef).scrollTo)==null||f.call(c,l,u)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-scrollbar"]],hostVars:2,hostBindings:function(r,o){r&1&&x("tui-scrollable.stop",function(a){return o.scrollRef=a.detail})("tui-scroll-into-view.stop",function(a){return o.scrollIntoView(a.detail)}),r&2&&Te("_native-hidden",o.options.mode!=="native"&&(!o.isIOS||o.hidden))},inputs:{hidden:"hidden"},features:[Z([{provide:Ua,useFactory:()=>h(e).browserScrollRef}])],ngContentSelectors:pB,decls:3,vars:3,consts:[["class","t-bars",3,"t-hover-mode",4,"ngIf"],[1,"t-content"],[1,"t-bars"]],template:function(r,o){r&1&&(Xt(),O(0,hB,1,2,"tui-scroll-controls",0),E(1,"div",1),at(2),w()),r&2&&(v("ngIf",!o.hidden&&!o.isIOS&&o.options.mode!=="native"),C(),Te("t-content_delegated",o.delegated))},dependencies:[ut,bB],styles:["[_nghost-%COMP%]{position:relative;display:flex;isolation:isolate;overflow:auto}._native-hidden[_nghost-%COMP%]{scrollbar-width:none;-ms-overflow-style:none}._native-hidden[_nghost-%COMP%]::-webkit-scrollbar, ._native-hidden[_nghost-%COMP%]::-webkit-scrollbar-thumb{display:none}[_nghost-%COMP%] .t-hover-mode[_ngcontent-%COMP%]:not(:active){transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}[_nghost-%COMP%]:hover .t-hover-mode[_ngcontent-%COMP%]{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:1}.t-content[_ngcontent-%COMP%]{isolation:isolate;flex:1;flex-basis:auto;inline-size:100%;block-size:-webkit-max-content;block-size:max-content}.t-content_delegated[_ngcontent-%COMP%]{block-size:100%}.t-bars[_ngcontent-%COMP%]{color:var(--tui-text-primary)}"],changeDetection:0});let t=e;return t})(),Vue=(()=>{let e=class e{constructor(){this.el=Ee(),this.destroyRef=h(it)}set tuiScrollIntoView(n){n&>(0).pipe(Se(this.destroyRef)).subscribe(()=>{this.el.dispatchEvent(new CustomEvent(_B,{bubbles:!0,detail:this.el}))})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiScrollIntoView",""]],inputs:{tuiScrollIntoView:"tuiScrollIntoView"}});let t=e;return t})();var zue=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiScrollRef",""]],features:[Z([De(Ua,de)])]});let t=e;return t})();var Jue=(()=>{let e=class e extends te{constructor(){super(n=>this.stream$.subscribe(n)),this.media=h(DS),this.sorted=Object.values(this.media).sort((n,r)=>n-r),this.invert=Object.keys(this.media).reduce((n,r)=>U(M({},n),{[this.media[r]]:r}),{}),this.stream$=h(cI).pipe(S(({width:n})=>this.sorted.find(r=>r>n)),S(n=>this.invert[n||this.sorted[this.sorted.length-1]||0]),ke(),ai(),Li({bufferSize:1,refCount:!0}))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var ele=(()=>{let e=class e{constructor(){this.locale=h(tl)}format(n){return ce(new Date(n).toLocaleTimeString(this.locale,{hour:"numeric",minute:"2-digit"}))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),qa=(()=>{let e=class e extends te{constructor(){let n=h(qi),r=h(me);super(o=>n.pipe(dt(null),S(()=>this.accessor.getPosition(this.el.getBoundingClientRect(),this.el)),Ei(r),wu(()=>this.accessor.getPosition(Wi))).subscribe(o)),this.el=Ee(),this.accessor=h(Ii)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Ip=(()=>{let e=class e{constructor(){this.isWebkit=h(uI),this.win=h(Je)}correct(n){var r,o;return this.isWebkit?[n[0]+(((r=this.win.visualViewport)==null?void 0:r.offsetTop)??0),n[1]+(((o=this.win.visualViewport)==null?void 0:o.offsetLeft)??0)]:n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var ale=(()=>{let e=class e{constructor(){this.months$=h(bS)}transform({month:n}){return this.months$.pipe(S(r=>r[n]||r[0]))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275pipe=$i({name:"tuiMonth",type:e,pure:!0});let t=e;return t})();var Nv=class extends CustomEvent{constructor(e,o){var s=o,{clientX:i,clientY:n}=s,r=ho(s,["clientX","clientY"]);super(e,U(M({},r),{detail:{clientX:i,clientY:n}}))}},CB=({userAgent:t,maxTouchPoints:e})=>/ipad|iphone|ipod/i.test(t)||/^((?!chrome|android).)*safari/i.test(t)&&e>1,DB=700,NS=typeof navigator>"u"?null:navigator,EB=15,Pv=class{constructor(){this.isIOS=!!NS&&CB(NS)}addEventListener(e,i,n){let r=this.isIOS?this.listenTouchEvents(e):this.listenContextmenuEvent(e);return e.addEventListener("longtap",n),()=>{r(),e.removeEventListener("longtap",n)}}supports(e){return e==="longtap"}listenContextmenuEvent(e){return this.manager.addEventListener(e,"contextmenu.prevent.stop",({clientX:i,clientY:n})=>{this.dispatchLongtapEvent(e,i,n)})}listenTouchEvents(e){let i=null,n=null,r=()=>{clearTimeout(i),n=null,i=null},o=this.manager.addEventListener(e,"touchstart.silent.passive",({touches:l})=>{let c=l[0];if(!c)return;let{clientX:f,clientY:p}=c;n={clientX:f,clientY:p},i=setTimeout(()=>{this.dispatchLongtapEvent(e,f,p),r()},DB)}),s=this.manager.addEventListener(e,"touchmove.silent.passive",({touches:l})=>{let c=l[0];if(!c||!n)return;let{clientX:f,clientY:p}=c;Math.hypot(f-n.clientX,p-n.clientY)<=EB||r()}),a=this.manager.addEventListener(e,"touchcancel.silent.passive",r),u=this.manager.addEventListener(e,"touchend.silent.passive",r);return()=>{o(),s(),a(),u()}}dispatchLongtapEvent(e,i,n){e.dispatchEvent(new Nv("longtap",{clientX:i,clientY:n,bubbles:!1,cancelable:!1,composed:!1}))}},io=class{supports(e){return e.includes(this.modifier)}unwrap(e){return e.split(".").filter(i=>!this.modifier.includes(i)).join(".")}},wB=new k("",{factory:()=>{let t=h(qe);return e=>e==="body"?t.body:t.defaultView[e]||t.createElement("div")}}),TB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.handler=h(wB),this.modifier=">"}addEventListener(n,r,o){var s;return this.manager.addEventListener(this.handler(r.split(">")[0]),((s=r.split(">"))==null?void 0:s[1])??"",o)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),xB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier="capture.once.passive"}supports(n){return n.includes(".")&&!this.unwrap(n).includes(".")}addEventListener(n,r,o){let s=this.unwrap(r),a=r.includes(".capture");return n.addEventListener(s,o,{capture:a,once:r.includes(".once"),passive:r.includes(".passive")}),()=>n.removeEventListener(s,o,{capture:a})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),IB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".prevent"}addEventListener(n,r,o){return this.manager.addEventListener(n,this.unwrap(r),s=>{s.preventDefault(),o(s)})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),SB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier="resize"}supports(n){return n==="resize"}addEventListener(n,r,o){if(typeof ResizeObserver>"u"||!(n instanceof Element))return n.addEventListener(r,o),()=>n.removeEventListener(r,o);let s=new ResizeObserver(o);return s.observe(n),()=>s.disconnect()}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),MB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".self"}addEventListener(n,r,o){return this.manager.addEventListener(n,this.unwrap(r),s=>{s.target===s.currentTarget&&o(s)})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Fv=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".silent"}addEventListener(n,r,o){return e.ngZone=this.manager.getZone(),e.ngZone.runOutsideAngular(()=>this.manager.addEventListener(n,this.unwrap(r),o))}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),AB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".stop"}addEventListener(n,r,o){return this.manager.addEventListener(n,this.unwrap(r),s=>{s.stopPropagation(),o(s)})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),kB=[Fv,TB,xB,IB,SB,MB,AB,Pv],ple=kB.map(t=>({provide:Dl,multi:!0,useClass:t}));function PS(t){return(e,i,n)=>{let{value:r}=n;n.value=function(...o){t.apply(this,o)&&(Fv.ngZone?Fv.ngZone.run(()=>r.apply(this,o)):r.apply(this,o))}}}var OB=t=>({$implicit:t});function NB(t,e){if(t&1&&(E(0,"div",2),he(1),w()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}var PB=["tuiDropdownHost"],Rv=(()=>{let e=class e extends on{constructor(){super(!1),this.type="dropdown"}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),FB=(()=>{let e=class e extends _p{constructor(){super(...arguments),this.type="dropdown"}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,features:[oe]});let t=e;return t})(),Sp=B(()=>LB),RB=W(),kl=(()=>{let e=class e extends Cs{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),Lv={align:"left",direction:null,limitWidth:"auto",maxHeight:400,minHeight:80,offset:4,appearance:""},xs=W(Lv),Hv=t=>({provide:xs,deps:[[new qn,new Uu,Is],[new qn,new qr,xs]],useFactory:Al(t,Lv)}),Is=(()=>{let e=class e{constructor(){this.options=h(xs,{skipSelf:!0}),this.align=this.options.align,this.appearance=this.options.appearance,this.direction=this.options.direction,this.limitWidth=this.options.limitWidth,this.minHeight=this.options.minHeight,this.maxHeight=this.options.maxHeight,this.offset=this.options.offset}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdownAlign",""],["","tuiDropdownAppearance",""],["","tuiDropdownDirection",""],["","tuiDropdownLimitWidth",""],["","tuiDropdownMinHeight",""],["","tuiDropdownMaxHeight",""],["","tuiDropdownOffset",""]],inputs:{align:[0,"tuiDropdownAlign","align"],appearance:[0,"tuiDropdownAppearance","appearance"],direction:[0,"tuiDropdownDirection","direction"],limitWidth:[0,"tuiDropdownLimitWidth","limitWidth"],minHeight:[0,"tuiDropdownMinHeight","minHeight"],maxHeight:[0,"tuiDropdownMaxHeight","maxHeight"],offset:[0,"tuiDropdownOffset","offset"]},features:[Z([De(xs,e)])]});let t=e;return t})(),FS=(()=>{let e=class e extends Ii{constructor(){super(...arguments),this.options=h(xs),this.viewport=h($a),this.directionChange=new _e,this.type="dropdown",this.accessor=Sl("dropdown")(h(Si),h(Ze,{optional:!0}))}emitDirection(n){this.directionChange.emit(n)}getPosition({width:n,height:r}){var A;!n&&!r&&(this.previous=void 0);let o=((A=this.accessor)==null?void 0:A.getClientRect())??Wi,s=this.viewport.getClientRect(),{minHeight:a,align:u,direction:l,offset:c,limitWidth:f}=this.options,p={top:s.top-c,bottom:s.bottom+c,right:s.right-c,left:s.left+c},m=this.previous||l||"bottom",g={top:o.top-2*c-p.top,bottom:p.bottom-o.bottom-2*c},y=f==="fixed"?o.width:n,b=Math.max(o.right-y,c),D=o.left+ng.bottom?"top":"bottom";return g[m]>a&&l||g[m]>r?(this.emitDirection(m),[I[m],I[u]]):(this.previous=N,this.emitDirection(N),[I[N],I[u]])}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,outputs:{directionChange:"tuiDropdownDirectionChange"},features:[oe]});let t=e;return Ot([Ft],t.prototype,"emitDirection",null),t})(),Ze=(()=>{let e=class e{constructor(){this.refresh$=new tt,this.service=h(kl),this.cdr=h(st),this.sub=this.refresh$.pipe(gi(0,Fn()),Se()).subscribe(()=>{var n,r;(n=this.ref())==null||n.changeDetectorRef.detectChanges(),(r=this.ref())==null||r.changeDetectorRef.markForCheck()}),this.el=Ee(),this.type="dropdown",this.component=new Xi(h(Sp),h(gr)),this.ref=ge(null)}set tuiDropdown(n){this.content=n instanceof It?new dv(n,this.cdr):n}get position(){return Mv(this.el)?"fixed":"absolute"}ngAfterViewChecked(){this.refresh$.next()}ngOnChanges(){this.content||this.toggle(!1)}ngOnDestroy(){this.toggle(!1)}getClientRect(){return this.el.getBoundingClientRect()}toggle(n){let r=this.ref();n&&this.content&&!r?this.ref.set(this.service.add(this.component)):!n&&r&&(this.ref.set(null),this.service.remove(r))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdown","",5,"ng-container",5,"ng-template"]],inputs:{tuiDropdown:"tuiDropdown"},exportAs:["tuiDropdown"],features:[Z([Ts(e),bp(e)]),Mt([FB,{directive:FS,outputs:["tuiDropdownDirectionChange","tuiDropdownDirectionChange"]}]),Yt]});let t=e;return Ot([Ft],t.prototype,"position",null),t})(),LB=(()=>{let e=class e{constructor(){var n;this.el=Ee(),this.accessor=h(Si),this.win=h(Je),this.vvs=h(Ip),this.animation=Ga(h(Va)),this.options=h(xs),this.directive=h(Ze),this.context=h(RB,{optional:!0}),this.theme=(n=this.directive.el.closest("[tuiTheme]"))==null?void 0:n.getAttribute("tuiTheme"),this.sub=h(qa).pipe(go(()=>this.directive.el.isConnected&&!!this.directive.el.offsetParent),S(r=>this.directive.position==="fixed"?this.vvs.correct(r):r),S(([r,o])=>this.getStyles(r,o)),Se()).subscribe({next:r=>Object.assign(this.el.style,r),complete:()=>{var r;return(r=this.close)==null?void 0:r.call(this)}}),this.close=()=>this.directive.toggle(!1)}getStyles(n,r){var N;let{right:o}=this.el.getBoundingClientRect(),{maxHeight:s,minHeight:a,offset:u,limitWidth:l}=this.options,{innerHeight:c}=this.win,f=(N=this.el.offsetParent)==null?void 0:N.getBoundingClientRect(),{position:p}=this.directive,m=this.accessor.getClientRect(),g=p==="fixed"?0:-((f==null?void 0:f.left)||0),y=p==="fixed"?0:-((f==null?void 0:f.top)||0);n+=y,r+=g;let b=o<=m.left||r>=m.right,I=rm.left&&n{let e=class e{constructor(){this.directive=h(Ze),this.el=Ee(),this.obscured=h(op),this.dropdown=Pt(()=>{var n;return(n=this.directive.ref())==null?void 0:n.location.nativeElement}),this.sub=nt(this.obscured.tuiObscured.pipe(ot(Boolean)),h(xi).tuiActiveZoneChange.pipe(ot(n=>!n)),ct(this.el,"focusin").pipe(S(ka),ot(n=>!this.host.contains(n)||!this.directive.ref()))).pipe(Jr(),Se()).subscribe(()=>this.toggle(!1)),this.tuiDropdownEnabled=!0,this.tuiDropdownOpen=!1,this.tuiDropdownOpenChange=new _e,this.driver=h(Rv)}ngOnChanges(){this.update(!!this.tuiDropdownOpen)}toggle(n){this.focused&&!n&&this.host.focus({preventScroll:!0}),this.update(n)}onEsc(n){n.preventDefault(),this.toggle(!1)}onClick(n){!this.editable&&this.host.contains(n)&&this.update(!this.tuiDropdownOpen)}onArrow(n,r){!ui(n.target)||!this.host.contains(n.target)||!this.tuiDropdownEnabled||(n.preventDefault(),this.focusDropdown(r))}onKeydown({key:n,target:r,defaultPrevented:o}){o||!AS(n)||!this.editable||!this.focused||!this.directive.content||!No(r)||_y(r)&&r!==this.host||(this.update(!0),this.host.focus({preventScroll:!0}))}get host(){var o,s;let n=((o=this.dropdownHost)==null?void 0:o.nativeElement)||this.el,r=Lf(n)?n:Po({initial:n,root:this.el});return((s=this.dropdownHost)==null?void 0:s.nativeElement)||r||this.el}get editable(){return _y(this.host)}get focused(){return Ki(this.host)||Ki(this.dropdown())}update(n){if(n&&!this.tuiDropdownEnabled)return this.drive();this.tuiDropdownOpen=n,this.tuiDropdownOpenChange.emit(n),this.drive()}drive(n=!!this.tuiDropdownOpen&&this.tuiDropdownEnabled){this.obscured.tuiObscuredEnabled=n,this.driver.next(n)}focusDropdown(n){let r=this.dropdown();if(!r){this.update(!0);return}let o=this.el.ownerDocument,s=r.appendChild(o.createElement("div")),u=Po({initial:n?s:r,previous:n,root:r});s.remove(),u==null||u.focus()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdown","","tuiDropdownOpen",""],["","tuiDropdown","","tuiDropdownOpenChange",""]],contentQueries:function(r,o,s){if(r&1&&_n(s,PB,5,de),r&2){let a;Qe(a=Xe())&&(o.dropdownHost=a.first)}},hostBindings:function(r,o){r&1&&x("click",function(a){return o.onClick(a.target)})("keydown.arrowDown",function(a){return o.onArrow(a,!1)})("keydown.arrowUp",function(a){return o.onArrow(a,!0)})("keydown.silent.capture",function(a){return o.onEsc(a)},!1,Nn)("keydown.silent",function(a){return o.onKeydown(a)},!1,Nn)},inputs:{tuiDropdownEnabled:"tuiDropdownEnabled",tuiDropdownOpen:"tuiDropdownOpen"},outputs:{tuiDropdownOpenChange:"tuiDropdownOpenChange"},features:[Z([Rv,Ho(Rv)]),Mt([op,{directive:xi,inputs:["tuiActiveZoneParent","tuiActiveZoneParent"],outputs:["tuiActiveZoneChange","tuiActiveZoneChange"]}]),Yt]});let t=e;return Ot([PS(BB)],t.prototype,"onEsc",null),t})();var Zle=(()=>{let e=class e{constructor(){this.tuiDropdownOpenChange=new on(!1)}set tuiDropdownOpen(n){this.tuiDropdownOpenChange.next(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdownOpen","",3,"tuiDropdown",""],["","tuiDropdownOpenChange","",3,"tuiDropdown",""]],inputs:{tuiDropdownOpen:"tuiDropdownOpen"},outputs:{tuiDropdownOpenChange:"tuiDropdownOpenChange"}});let t=e;return t})();function RS(t){return ko(Ze,"tuiDropdown",t,{})}function LS(){let t=ko(Tt,"tuiDropdownOpen",!1,{});return h(Tt).tuiDropdownOpenChange.pipe(Se()).subscribe(e=>t.set(e)),t}var HS=(()=>{let e=class e{constructor(){Al({limitWidth:"fixed"},Lv)(h(xs,{self:!0,optional:!0}),null)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Z([Hv({})])]});let t=e;return t})(),Kle=(()=>{let e=class e extends _l{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-dropdowns"]],features:[Z([fI(kl)]),oe],decls:2,vars:0,consts:[["viewContainer",""]],template:function(r,o){r&1&&Qt(0,null,0)},encapsulation:2,changeDetection:0});let t=e;return t})(),BS=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Mt([{directive:Tt,inputs:["tuiDropdownOpen","open"],outputs:["tuiDropdownOpenChange","openChange"]}])]});let t=e;return t})();var zB=["tuiOption",""],VS=["*"],jB=t=>({$implicit:t});function UB(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}function $B(t,e){t&1&&at(0)}function GB(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}function WB(t,e){if(t&1&&(E(0,"div",1),O(1,GB,2,1,"ng-container",2),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.emptyContent||i.fallback())}}var qB=W();var ZB=W();function KB(t){return De(ZB,t)}var Za=W();function zS(t){return De(Za,t)}var Ss=(()=>{let e=class e{constructor(){var n;this.isMobile=h(Qi),this.el=Ee(),this.dataList=h(vi(()=>Ms),{optional:!0}),this.host=h(Za,{optional:!0}),this.content=h(qB,{optional:!0}),this.dropdown=(n=h(Ze,{self:!0,optional:!0}))==null?void 0:n.ref,this.disabled=!1}ngOnDestroy(){var n;(n=this.dataList)==null||n.handleFocusLossIfNecessary(this.el)}onClick(){var n;(n=this.host)!=null&&n.handleOption&&this.value!==void 0&&this.host.handleOption(this.value)}onMouseMove(){!this.isMobile&&!cl(this.el)&&this.dataList&&this.el.focus({preventScroll:!0})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["button","tuiOption",""],["a","tuiOption",""],["label","tuiOption",""]],hostAttrs:["type","button","role","option"],hostVars:3,hostBindings:function(r,o){r&1&&x("click",function(){return o.onClick()})("mousemove.silent",function(){return o.onMouseMove()}),r&2&&(Ke("disabled",o.disabled||null),Te("_with-dropdown",o.dropdown==null?null:o.dropdown()))},inputs:{disabled:"disabled",value:"value"},features:[Mt([Bo])],attrs:zB,ngContentSelectors:VS,decls:3,vars:4,consts:[["t",""],[4,"polymorpheusOutlet","polymorpheusOutletContext"]],template:function(r,o){if(r&1&&(Xt(),O(0,UB,2,1,"ng-container",1)(1,$B,1,0,"ng-template",null,0,We)),r&2){let s=be(2);v("polymorpheusOutlet",o.content||s)("polymorpheusOutletContext",Kn(2,jB,s))}},dependencies:[Rn],encapsulation:2,changeDetection:0});let t=e;return t})();function YB(){var i;let t=["s","m","l"],e=(i=h(Za,{optional:!0}))==null?void 0:i.size;return e&&t.includes(e)?e:"l"}var Ms=(()=>{let e=class e{constructor(){this.options=Tf,this.ngZone=h(me),this.destroyRef=h(it),this.el=Ee(),this.cdr=h(st),this.fallback=Cn(h(CS)),this.empty=ge(!1),this.size=YB()}onKeyDownArrow(n,r){let{elements:o}=this;Sx(o.indexOf(n),o,r)}handleFocusLossIfNecessary(n=this.el){var r;Ki(n)&&((r=this.origin)==null||r.focus({preventScroll:!0}))}ngAfterContentChecked(){gt(0).pipe(Ei(this.ngZone),kf(this.destroyRef)).subscribe(()=>{this.empty.set(!this.elements.length),this.cdr.detectChanges()})}getOptions(n=!1){return this.options.filter(({disabled:r})=>n||!r).map(({value:r})=>r).filter(si)}onFocusIn(n,r){!r.contains(n)&&!this.origin&&(this.origin=n)}get elements(){return Array.from(this.el.querySelectorAll("a,button,input"))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-data-list"]],contentQueries:function(r,o,s){if(r&1&&_n(s,Ss,5),r&2){let a;Qe(a=Xe())&&(o.options=a)}},hostAttrs:["role","listbox"],hostVars:1,hostBindings:function(r,o){r&1&&x("focusin",function(a){return o.onFocusIn(a.relatedTarget,a.currentTarget)})("mousedown.prevent",function(){return 0})("wheel.silent.passive",function(){return o.handleFocusLossIfNecessary()})("mouseleave",function(a){return o.handleFocusLossIfNecessary(a.target)})("keydown.tab",function(){return o.handleFocusLossIfNecessary()})("keydown.shift.tab",function(){return o.handleFocusLossIfNecessary()})("keydown.arrowDown.prevent",function(a){return o.onKeyDownArrow(a.target,1)})("keydown.arrowUp.prevent",function(a){return o.onKeyDownArrow(a.target,-1)}),r&2&&Ke("data-size",o.size)},inputs:{emptyContent:"emptyContent",size:"size"},features:[Z([KB(e)])],ngContentSelectors:VS,decls:2,vars:1,consts:[["class","t-empty",4,"ngIf"],[1,"t-empty"],[4,"polymorpheusOutlet"]],template:function(r,o){r&1&&(Xt(),at(0),O(1,WB,2,1,"div",0)),r&2&&(C(),v("ngIf",o.empty()))},dependencies:[ut,Rn],styles:[`tui-data-list{--tui-data-list-padding: .25rem;--tui-data-list-margin: .0625rem;display:flex;font:var(--tui-font-text-m);flex-direction:column;padding:calc(var(--tui-data-list-padding) - var(--tui-data-list-margin)) var(--tui-data-list-padding);color:var(--tui-text-tertiary)}tui-data-list:focus-within .t-trap{display:none}tui-data-list:focus-within [tuiOption]._with-dropdown:not(:focus){background-color:transparent}tui-data-list[data-size=s]{--tui-data-list-margin: var(--t-0, 0rem)}tui-data-list[data-size=s]>.t-empty,tui-data-list[data-size=s] [tuiOption]{font:var(--tui-font-text-s);min-block-size:2rem;padding:.3125rem .5rem}tui-data-list[data-size=s]>.t-empty:before,tui-data-list[data-size=s] [tuiOption]:before{font-size:1rem}tui-data-list[data-size=m]>.t-empty,tui-data-list[data-size=m] [tuiOption]{font:var(--tui-font-text-s);min-block-size:2.5rem;padding:.375rem .5rem}tui-data-list[data-size=l]{--tui-data-list-padding: .375rem;--tui-data-list-margin: .125rem}tui-data-list[data-size=l]>.t-empty,tui-data-list[data-size=l] [tuiOption]{font:var(--tui-font-text-m);min-block-size:2.75rem;padding:.375rem .625rem}tui-data-list>.t-empty{display:flex;align-items:center;box-sizing:border-box;margin:var(--tui-data-list-margin) 0}tui-data-list [tuiOption]{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:flex;align-items:center;box-sizing:border-box;margin:var(--tui-data-list-margin) 0;justify-content:space-between;text-align:start;color:var(--tui-text-primary);border-radius:var(--tui-radius-s);outline:none;cursor:pointer;background-clip:padding-box}tui-data-list [tuiOption]:disabled{opacity:var(--tui-disabled-opacity);cursor:default}tui-data-list [tuiOption]:hover,tui-data-list [tuiOption]:focus-within,tui-data-list [tuiOption]._with-dropdown{background-color:var(--tui-background-neutral-1)}tui-data-list [tuiOption]:before{margin-inline-end:.5rem}tui-data-list [tuiOption]:after{font-size:1rem;margin:0 -.75rem 0 auto;border-left:.5rem solid;border-right:.5rem solid}tui-opt-group{position:relative;display:flex;font:var(--tui-font-text-xs);color:var(--tui-text-secondary);flex-direction:column;line-height:1rem}tui-data-list[data-size=l] tui-opt-group{font:var(--tui-font-text-s);line-height:1.25rem}tui-data-list[data-size=l] tui-opt-group:before{padding-left:.625rem;padding-right:.625rem}tui-data-list[data-size=l] tui-opt-group:after{left:.625rem;right:.625rem}tui-opt-group:empty:before,tui-opt-group:empty:after{display:none}tui-opt-group:before{content:attr(data-label);padding:var(--tui-data-list-padding) .5rem var(--tui-data-list-padding);margin:var(--tui-data-list-margin) 0;white-space:normal;word-break:break-word}tui-opt-group:after{position:absolute;left:.5rem;right:.5rem;top:var(--tui-data-list-padding);block-size:1px;background:var(--tui-border-normal)}tui-opt-group:not(:empty)~tui-opt-group:before{padding-top:calc(.75rem + var(--tui-data-list-padding))}tui-opt-group:not(:empty)~tui-opt-group[data-label=""]:before,tui-opt-group:not(:empty)~tui-opt-group:not([data-label]):before{padding:var(--tui-data-list-padding) 0}tui-opt-group:not(:empty)~tui-opt-group:after{content:""}tui-opt-group[data-label=""]:before,tui-opt-group:not([data-label]):before{padding:0;margin:0} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),mce=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["ng-template","tuiDataList",""]]});let t=e;return t})();var jS=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["tui-opt-group"]],hostAttrs:["role","group"],hostVars:1,hostBindings:function(r,o){r&2&&Ke("data-label",o.label)},inputs:{label:"label"}});let t=e;return t})();var Vo=(()=>{let e=class e{constructor(){this.resolver=wp(),this.backgroundSrc=ge(null),this.iconSrc=ge(this.resolve(h(za,{self:!0,optional:!0})||h(ja,{self:!0,optional:!0})))}set icon(n){this.iconSrc.set(this.resolve(n))}set background(n){this.backgroundSrc.set(this.resolve(n))}resolve(n){return n?`url(${this.resolver(n)})`:null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-icon"]],hostVars:4,hostBindings:function(r,o){r&2&&Ye("--t-icon",o.iconSrc()||"url()")("--t-icon-bg",o.backgroundSrc())},inputs:{icon:"icon",background:"background"},decls:0,vars:0,template:function(r,o){},styles:[`tui-icon{position:relative;display:inline-block;inline-size:1em;block-size:1em;font-size:1.5rem;flex-shrink:0;border:0 solid transparent;vertical-align:middle;box-sizing:border-box;-webkit-mask:var(--t-icon-bg) no-repeat center / contain;mask:var(--t-icon-bg) no-repeat center / contain}@media (hover: hover) and (pointer: fine){tui-icon[data-appearance=icon]:hover{color:var(--tui-text-secondary)}}tui-icon:after,tui-icon[tuiIcons]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";display:block;-webkit-mask:var(--t-icon) no-repeat center / contain;mask:var(--t-icon) no-repeat center / contain;background:currentColor} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),IS=(()=>{let e=class e{constructor(){this.nothing=Dn(rB),this.pseudo=h(xS).pseudo}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["a","tuiLink",""],["button","tuiLink",""]],hostAttrs:["tuiLink",""],hostVars:2,hostBindings:function(r,o){r&2&&Ye("text-decoration-line",o.pseudo?"underline":null)},inputs:{pseudo:"pseudo"},features:[Z([La(xS)]),Mt([Ba,Bo])]});let t=e;return t})();function Mv(t){return!!t&&(oB(t)||Mv(t.parentElement))}function oB(t){var e;return((e=t.ownerDocument.defaultView)==null?void 0:e.getComputedStyle(t).getPropertyValue("position"))==="fixed"}function SS({document:t,innerWidth:e}){return Math.max(t.documentElement.clientWidth||0,e||0)}function Av(t){let e=t.cloneRange(),{startContainer:i,startOffset:n,endContainer:r,endOffset:o}=e,{ownerDocument:s}=i;if(!s)return e;let a=s.createTreeWalker(s.body,NodeFilter.SHOW_TEXT,xf);a.currentNode=i;do{let u=a.currentNode,l=u.textContent||"",c=u===i?l.slice(0,Math.max(0,n+1)):l,f=Math.max(c.lastIndexOf(" "),c.lastIndexOf(Xr),c.lastIndexOf(If))+1;if(e.setStart(u,0),f){e.setStart(u,f);break}}while(a.previousNode());a.currentNode=r;do{let u=a.currentNode,l=u.textContent||"",c=u===r?l.slice(o+1):l,f=[c.indexOf(" "),c.indexOf(Xr),c.indexOf(If)].reduce((p,m)=>p===-1||m===-1?Math.max(p,m):Math.min(p,m),-1);if(e.setEnd(u,l.length),f!==-1){e.setEnd(u,f+l.length-c.length);break}}while(a.nextNode());return e}var sB=["Spacebar","Backspace","Delete","ArrowLeft","ArrowRight","Left","Right","End","Home"];function AS(t=""){return t.length===1||sB.includes(t)}function kv(t,e="tui-hints"){var i;return!!((i=Ff(t))!=null&&i.some(n=>!n.closest(e)))}function Al(t,e){return(i,n)=>{let r=i||M({},n||e);return Object.keys(t).forEach(o=>{r[o]=t[o]}),r}}var MS={xxs:0,xs:1,s:2,m:3,l:4,xl:5,xxl:6};function vue(t,e="s"){return MS[t]>MS[e]}var Ov=300;function Ga(t,e){return{value:"",params:{duration:aB(t),easing:e}}}function aB(t){return t&&Ov/t}function uB(t,e){t&1&&Qt(0)}function lB(t,e){if(t&1){let i=q();E(0,"div",5),x("mousedown.capture.prevent",function(){return P(i),F(0)}),Q(1,"div",6),w()}if(t&2){let i=_().ngIf,n=_(2);Te("t-bar_has-horizontal",i[1]),v("@tuiFadeIn",n.options)}}function cB(t,e){if(t&1){let i=q();E(0,"div",7),x("mousedown.capture.prevent",function(){return P(i),F(0)}),Q(1,"div",8),w()}if(t&2){let i=_().ngIf,n=_(2);Te("t-bar_has-vertical",i[0]),v("@tuiFadeIn",n.options)}}function dB(t,e){if(t&1&&(_t(0),O(1,lB,2,3,"div",3)(2,cB,2,3,"div",4),Ct()),t&2){let i=e.ngIf;C(),v("ngIf",i[0]),C(),v("ngIf",i[1])}}function fB(t,e){if(t&1&&(O(0,dB,3,2,"ng-container",2),Y(1,"async")),t&2){let i=_();v("ngIf",J(1,1,i.refresh$))}}var pB=["*"];function hB(t,e){if(t&1&&Q(0,"tui-scroll-controls",2),t&2){let i=_();Te("t-hover-mode",i.options.mode==="hover")}}var kS=(()=>{let e=class e extends te{constructor(){super(n=>this.scroll$.subscribe(n)),this.el=Ee(),this.element=h(Ua).nativeElement,this.scroll$=nt(rt(this.el.parentElement,"mousedown").pipe(ot(({target:n})=>n!==this.el),S(n=>this.getScrolled(n,.5,.5))),rt(this.el,"mousedown").pipe(Ei(),bt(n=>{let{ownerDocument:r}=this.el,o=this.el.getBoundingClientRect(),s=mB(n,o),a=gB(n,o);return rt(r,"mousemove").pipe(S(u=>this.getScrolled(u,s,a)),Kt(rt(r,"mouseup")))})))}getScrolled({clientY:n,clientX:r},o,s){let{offsetHeight:a,offsetWidth:u}=this.el,{top:l,left:c,width:f,height:p}=this.el.parentElement.getBoundingClientRect(),m=this.element.scrollHeight-p,g=this.element.scrollWidth-f,y=(n-l-a*o)/(p-a),b=(r-c-u*s)/(f-u);return[m*y,g*b]}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})();function mB({clientY:t},{top:e,height:i}){return(t-e)/i}function gB({clientX:t},{left:e,width:i}){return(t-e)/i}var Ip=24,yB=(()=>{let e=class e{constructor(){this.el=h(Ua).nativeElement,this.style=Ee().style,this.scrollSub=h(kS).pipe(Se()).subscribe(([n,r])=>{this.el.style.scrollBehavior="auto",this.tuiScrollbar==="horizontal"?this.el.scrollLeft=r:this.el.scrollTop=n,this.el.style.scrollBehavior=""}),this.styleSub=nt(h(qi).pipe(gi(100,Fn())),bx(this.el)).pipe(Ei(),Se()).subscribe(()=>{let n={scrollTop:this.el.scrollTop,scrollHeight:this.el.scrollHeight,clientHeight:this.el.clientHeight,scrollLeft:this.el.scrollLeft,scrollWidth:this.el.scrollWidth,clientWidth:this.el.clientWidth},r=`${this.getThumb(n)*100}%`,o=`${this.getView(n)*100}%`;this.tuiScrollbar==="vertical"?(this.style.top=r,this.style.height=o):(this.style.left=r,this.style.width=o)}),this.tuiScrollbar="vertical"}getScrolled(n){return this.tuiScrollbar==="vertical"?n.scrollTop/(n.scrollHeight-n.clientHeight):n.scrollLeft/(n.scrollWidth-n.clientWidth)}getCompensation(n){return n.clientHeight*n.clientHeight/n.scrollHeight>Ip&&this.tuiScrollbar==="vertical"||n.clientWidth*n.clientWidth/n.scrollWidth>Ip&&this.tuiScrollbar==="horizontal"?0:this.tuiScrollbar==="vertical"?Ip/n.clientHeight:Ip/n.clientWidth}getThumb(n){let r=this.getCompensation(n)||this.getView(n);return this.getScrolled(n)*(1-r)}getView(n){return this.tuiScrollbar==="vertical"?Math.ceil(n.clientHeight/n.scrollHeight*100)/100:Math.ceil(n.clientWidth/n.scrollWidth*100)/100}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiScrollbar",""]],inputs:{tuiScrollbar:"tuiScrollbar"},features:[Z([kS])]});let t=e;return t})(),vB={mode:"always"},[OS,Bue]=Oo(vB),bB=(()=>{let e=class e{constructor(){this.scrollRef=h(Ua).nativeElement,this.nativeScrollbar=h(OS).mode==="native",this.options=Ga(h(Va)),this.refresh$=h(qi).pipe(gi(300,Fn()),S(()=>this.scrollbars),dt([!1,!1]),ke((n,r)=>n[0]===r[0]&&n[1]===r[1]),ai())}get scrollbars(){let{clientHeight:n,scrollHeight:r,clientWidth:o,scrollWidth:s}=this.scrollRef;return[Math.ceil(n/r*100)<100,Math.ceil(o/s*100)<100]}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-scroll-controls"]],decls:3,vars:2,consts:[["custom",""],[4,"ngIf","ngIfElse"],[4,"ngIf"],["class","t-bar t-bar_vertical",3,"t-bar_has-horizontal","mousedown.capture.prevent",4,"ngIf"],["class","t-bar t-bar_horizontal",3,"t-bar_has-vertical","mousedown.capture.prevent",4,"ngIf"],[1,"t-bar","t-bar_vertical",3,"mousedown.capture.prevent"],["tuiScrollbar","vertical",1,"t-thumb"],[1,"t-bar","t-bar_horizontal",3,"mousedown.capture.prevent"],["tuiScrollbar","horizontal",1,"t-thumb"]],template:function(r,o){if(r&1&&O(0,uB,1,0,"ng-container",1)(1,fB,2,3,"ng-template",null,0,We),r&2){let s=be(2);v("ngIf",o.nativeScrollbar)("ngIfElse",s)}},dependencies:[Re,ut,yB],styles:["[_nghost-%COMP%]{position:sticky;top:0;left:0;z-index:1;min-inline-size:calc(100% - 1px);min-block-size:calc(100% - 1px);max-inline-size:calc(100% - 1px);max-block-size:calc(100% - 1px);float:inline-start;margin-inline-end:calc(-100% + 1px);pointer-events:none}.t-bar[_ngcontent-%COMP%]{position:absolute;right:0;bottom:0;pointer-events:auto}.t-bar_vertical[_ngcontent-%COMP%]{top:0;inline-size:.875rem}.t-bar_horizontal[_ngcontent-%COMP%]{left:0;block-size:.875rem}.t-bar_has-horizontal[_ngcontent-%COMP%]{bottom:.5rem}.t-bar_has-vertical[_ngcontent-%COMP%]{right:.5rem}.t-thumb[_ngcontent-%COMP%]{transition-property:all;transition-duration:.15s;transition-timing-function:ease-in-out;position:absolute;border-radius:6.25rem;border:.25rem solid transparent;cursor:pointer;pointer-events:auto;-webkit-user-select:none;user-select:none;background:currentColor;background-clip:content-box;box-sizing:border-box;transition-property:width,height,opacity;opacity:.2}.t-thumb[_ngcontent-%COMP%]:hover{opacity:.24}.t-thumb[_ngcontent-%COMP%]:active{opacity:.48}.t-bar_vertical[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]{right:0;inline-size:.75rem;min-block-size:1.25rem}.t-bar_vertical[_ngcontent-%COMP%]:hover .t-thumb[_ngcontent-%COMP%], .t-bar_vertical[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]:active{inline-size:.875rem}.t-bar_horizontal[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]{bottom:0;block-size:.75rem;min-inline-size:1.25rem}.t-bar_horizontal[_ngcontent-%COMP%]:hover .t-thumb[_ngcontent-%COMP%], .t-bar_horizontal[_ngcontent-%COMP%] .t-thumb[_ngcontent-%COMP%]:active{block-size:.875rem}"],data:{animation:[mp]},changeDetection:0});let t=e;return t})(),_B="tui-scroll-into-view";var Wa=(()=>{let e=class e{constructor(){this.el=Ee(),this.options=h(OS),this.isIOS=h(Na),this.browserScrollRef=new de(this.el),this.hidden=this.options.mode==="hidden"}get delegated(){return this.scrollRef!==this.el||this.options.mode==="native"}get scrollRef(){return this.browserScrollRef.nativeElement}set scrollRef(n){this.browserScrollRef.nativeElement=n}scrollIntoView(n){var c,f;if(this.delegated)return;let{offsetHeight:r,offsetWidth:o}=n,{offsetTop:s,offsetLeft:a}=Tx(this.scrollRef,n),u=s+r/2-this.scrollRef.clientHeight/2,l=a+o/2-this.scrollRef.clientWidth/2;(f=(c=this.scrollRef).scrollTo)==null||f.call(c,l,u)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-scrollbar"]],hostVars:2,hostBindings:function(r,o){r&1&&x("tui-scrollable.stop",function(a){return o.scrollRef=a.detail})("tui-scroll-into-view.stop",function(a){return o.scrollIntoView(a.detail)}),r&2&&Te("_native-hidden",o.options.mode!=="native"&&(!o.isIOS||o.hidden))},inputs:{hidden:"hidden"},features:[Z([{provide:Ua,useFactory:()=>h(e).browserScrollRef}])],ngContentSelectors:pB,decls:3,vars:3,consts:[["class","t-bars",3,"t-hover-mode",4,"ngIf"],[1,"t-content"],[1,"t-bars"]],template:function(r,o){r&1&&(Xt(),O(0,hB,1,2,"tui-scroll-controls",0),E(1,"div",1),at(2),w()),r&2&&(v("ngIf",!o.hidden&&!o.isIOS&&o.options.mode!=="native"),C(),Te("t-content_delegated",o.delegated))},dependencies:[ut,bB],styles:["[_nghost-%COMP%]{position:relative;display:flex;isolation:isolate;overflow:auto}._native-hidden[_nghost-%COMP%]{scrollbar-width:none;-ms-overflow-style:none}._native-hidden[_nghost-%COMP%]::-webkit-scrollbar, ._native-hidden[_nghost-%COMP%]::-webkit-scrollbar-thumb{display:none}[_nghost-%COMP%] .t-hover-mode[_ngcontent-%COMP%]:not(:active){transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}[_nghost-%COMP%]:hover .t-hover-mode[_ngcontent-%COMP%]{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:1}.t-content[_ngcontent-%COMP%]{isolation:isolate;flex:1;flex-basis:auto;inline-size:100%;block-size:-webkit-max-content;block-size:max-content}.t-content_delegated[_ngcontent-%COMP%]{block-size:100%}.t-bars[_ngcontent-%COMP%]{color:var(--tui-text-primary)}"],changeDetection:0});let t=e;return t})(),Vue=(()=>{let e=class e{constructor(){this.el=Ee(),this.destroyRef=h(it)}set tuiScrollIntoView(n){n&>(0).pipe(Se(this.destroyRef)).subscribe(()=>{this.el.dispatchEvent(new CustomEvent(_B,{bubbles:!0,detail:this.el}))})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiScrollIntoView",""]],inputs:{tuiScrollIntoView:"tuiScrollIntoView"}});let t=e;return t})();var zue=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiScrollRef",""]],features:[Z([De(Ua,de)])]});let t=e;return t})();var Jue=(()=>{let e=class e extends te{constructor(){super(n=>this.stream$.subscribe(n)),this.media=h(DS),this.sorted=Object.values(this.media).sort((n,r)=>n-r),this.invert=Object.keys(this.media).reduce((n,r)=>U(M({},n),{[this.media[r]]:r}),{}),this.stream$=h(cI).pipe(S(({width:n})=>this.sorted.find(r=>r>n)),S(n=>this.invert[n||this.sorted[this.sorted.length-1]||0]),ke(),ai(),Li({bufferSize:1,refCount:!0}))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var ele=(()=>{let e=class e{constructor(){this.locale=h(tl)}format(n){return ce(new Date(n).toLocaleTimeString(this.locale,{hour:"numeric",minute:"2-digit"}))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),qa=(()=>{let e=class e extends te{constructor(){let n=h(qi),r=h(me);super(o=>n.pipe(dt(null),S(()=>this.accessor.getPosition(this.el.getBoundingClientRect(),this.el)),Ei(r),wu(()=>this.accessor.getPosition(Wi))).subscribe(o)),this.el=Ee(),this.accessor=h(Ii)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Sp=(()=>{let e=class e{constructor(){this.isWebkit=h(uI),this.win=h(Je)}correct(n){var r,o;return this.isWebkit?[n[0]+(((r=this.win.visualViewport)==null?void 0:r.offsetTop)??0),n[1]+(((o=this.win.visualViewport)==null?void 0:o.offsetLeft)??0)]:n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})();var ale=(()=>{let e=class e{constructor(){this.months$=h(bS)}transform({month:n}){return this.months$.pipe(S(r=>r[n]||r[0]))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275pipe=$i({name:"tuiMonth",type:e,pure:!0});let t=e;return t})();var Nv=class extends CustomEvent{constructor(e,o){var s=o,{clientX:i,clientY:n}=s,r=ho(s,["clientX","clientY"]);super(e,U(M({},r),{detail:{clientX:i,clientY:n}}))}},CB=({userAgent:t,maxTouchPoints:e})=>/ipad|iphone|ipod/i.test(t)||/^((?!chrome|android).)*safari/i.test(t)&&e>1,DB=700,NS=typeof navigator>"u"?null:navigator,EB=15,Pv=class{constructor(){this.isIOS=!!NS&&CB(NS)}addEventListener(e,i,n){let r=this.isIOS?this.listenTouchEvents(e):this.listenContextmenuEvent(e);return e.addEventListener("longtap",n),()=>{r(),e.removeEventListener("longtap",n)}}supports(e){return e==="longtap"}listenContextmenuEvent(e){return this.manager.addEventListener(e,"contextmenu.prevent.stop",({clientX:i,clientY:n})=>{this.dispatchLongtapEvent(e,i,n)})}listenTouchEvents(e){let i=null,n=null,r=()=>{clearTimeout(i),n=null,i=null},o=this.manager.addEventListener(e,"touchstart.silent.passive",({touches:l})=>{let c=l[0];if(!c)return;let{clientX:f,clientY:p}=c;n={clientX:f,clientY:p},i=setTimeout(()=>{this.dispatchLongtapEvent(e,f,p),r()},DB)}),s=this.manager.addEventListener(e,"touchmove.silent.passive",({touches:l})=>{let c=l[0];if(!c||!n)return;let{clientX:f,clientY:p}=c;Math.hypot(f-n.clientX,p-n.clientY)<=EB||r()}),a=this.manager.addEventListener(e,"touchcancel.silent.passive",r),u=this.manager.addEventListener(e,"touchend.silent.passive",r);return()=>{o(),s(),a(),u()}}dispatchLongtapEvent(e,i,n){e.dispatchEvent(new Nv("longtap",{clientX:i,clientY:n,bubbles:!1,cancelable:!1,composed:!1}))}},io=class{supports(e){return e.includes(this.modifier)}unwrap(e){return e.split(".").filter(i=>!this.modifier.includes(i)).join(".")}},wB=new k("",{factory:()=>{let t=h(qe);return e=>e==="body"?t.body:t.defaultView[e]||t.createElement("div")}}),TB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.handler=h(wB),this.modifier=">"}addEventListener(n,r,o){var s;return this.manager.addEventListener(this.handler(r.split(">")[0]),((s=r.split(">"))==null?void 0:s[1])??"",o)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),xB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier="capture.once.passive"}supports(n){return n.includes(".")&&!this.unwrap(n).includes(".")}addEventListener(n,r,o){let s=this.unwrap(r),a=r.includes(".capture");return n.addEventListener(s,o,{capture:a,once:r.includes(".once"),passive:r.includes(".passive")}),()=>n.removeEventListener(s,o,{capture:a})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),IB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".prevent"}addEventListener(n,r,o){return this.manager.addEventListener(n,this.unwrap(r),s=>{s.preventDefault(),o(s)})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),SB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier="resize"}supports(n){return n==="resize"}addEventListener(n,r,o){if(typeof ResizeObserver>"u"||!(n instanceof Element))return n.addEventListener(r,o),()=>n.removeEventListener(r,o);let s=new ResizeObserver(o);return s.observe(n),()=>s.disconnect()}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),MB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".self"}addEventListener(n,r,o){return this.manager.addEventListener(n,this.unwrap(r),s=>{s.target===s.currentTarget&&o(s)})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Fv=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".silent"}addEventListener(n,r,o){return e.ngZone=this.manager.getZone(),e.ngZone.runOutsideAngular(()=>this.manager.addEventListener(n,this.unwrap(r),o))}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),AB=(()=>{let e=class e extends io{constructor(){super(...arguments),this.modifier=".stop"}addEventListener(n,r,o){return this.manager.addEventListener(n,this.unwrap(r),s=>{s.stopPropagation(),o(s)})}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),kB=[Fv,TB,xB,IB,SB,MB,AB,Pv],ple=kB.map(t=>({provide:Dl,multi:!0,useClass:t}));function PS(t){return(e,i,n)=>{let{value:r}=n;n.value=function(...o){t.apply(this,o)&&(Fv.ngZone?Fv.ngZone.run(()=>r.apply(this,o)):r.apply(this,o))}}}var OB=t=>({$implicit:t});function NB(t,e){if(t&1&&(E(0,"div",2),he(1),w()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}var PB=["tuiDropdownHost"],Rv=(()=>{let e=class e extends on{constructor(){super(!1),this.type="dropdown"}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),FB=(()=>{let e=class e extends Cp{constructor(){super(...arguments),this.type="dropdown"}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,features:[oe]});let t=e;return t})(),Mp=B(()=>LB),RB=W(),kl=(()=>{let e=class e extends Cs{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),Lv={align:"left",direction:null,limitWidth:"auto",maxHeight:400,minHeight:80,offset:4,appearance:""},xs=W(Lv),Hv=t=>({provide:xs,deps:[[new qn,new Uu,Is],[new qn,new qr,xs]],useFactory:Al(t,Lv)}),Is=(()=>{let e=class e{constructor(){this.options=h(xs,{skipSelf:!0}),this.align=this.options.align,this.appearance=this.options.appearance,this.direction=this.options.direction,this.limitWidth=this.options.limitWidth,this.minHeight=this.options.minHeight,this.maxHeight=this.options.maxHeight,this.offset=this.options.offset}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdownAlign",""],["","tuiDropdownAppearance",""],["","tuiDropdownDirection",""],["","tuiDropdownLimitWidth",""],["","tuiDropdownMinHeight",""],["","tuiDropdownMaxHeight",""],["","tuiDropdownOffset",""]],inputs:{align:[0,"tuiDropdownAlign","align"],appearance:[0,"tuiDropdownAppearance","appearance"],direction:[0,"tuiDropdownDirection","direction"],limitWidth:[0,"tuiDropdownLimitWidth","limitWidth"],minHeight:[0,"tuiDropdownMinHeight","minHeight"],maxHeight:[0,"tuiDropdownMaxHeight","maxHeight"],offset:[0,"tuiDropdownOffset","offset"]},features:[Z([De(xs,e)])]});let t=e;return t})(),FS=(()=>{let e=class e extends Ii{constructor(){super(...arguments),this.options=h(xs),this.viewport=h($a),this.directionChange=new _e,this.type="dropdown",this.accessor=Sl("dropdown")(h(Si),h(Ze,{optional:!0}))}emitDirection(n){this.directionChange.emit(n)}getPosition({width:n,height:r}){var A;!n&&!r&&(this.previous=void 0);let o=((A=this.accessor)==null?void 0:A.getClientRect())??Wi,s=this.viewport.getClientRect(),{minHeight:a,align:u,direction:l,offset:c,limitWidth:f}=this.options,p={top:s.top-c,bottom:s.bottom+c,right:s.right-c,left:s.left+c},m=this.previous||l||"bottom",g={top:o.top-2*c-p.top,bottom:p.bottom-o.bottom-2*c},y=f==="fixed"?o.width:n,b=Math.max(o.right-y,c),D=o.left+ng.bottom?"top":"bottom";return g[m]>a&&l||g[m]>r?(this.emitDirection(m),[I[m],I[u]]):(this.previous=N,this.emitDirection(N),[I[N],I[u]])}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,outputs:{directionChange:"tuiDropdownDirectionChange"},features:[oe]});let t=e;return Ot([Ft],t.prototype,"emitDirection",null),t})(),Ze=(()=>{let e=class e{constructor(){this.refresh$=new tt,this.service=h(kl),this.cdr=h(st),this.sub=this.refresh$.pipe(gi(0,Fn()),Se()).subscribe(()=>{var n,r;(n=this.ref())==null||n.changeDetectorRef.detectChanges(),(r=this.ref())==null||r.changeDetectorRef.markForCheck()}),this.el=Ee(),this.type="dropdown",this.component=new Xi(h(Mp),h(gr)),this.ref=ge(null)}set tuiDropdown(n){this.content=n instanceof It?new fv(n,this.cdr):n}get position(){return Mv(this.el)?"fixed":"absolute"}ngAfterViewChecked(){this.refresh$.next()}ngOnChanges(){this.content||this.toggle(!1)}ngOnDestroy(){this.toggle(!1)}getClientRect(){return this.el.getBoundingClientRect()}toggle(n){let r=this.ref();n&&this.content&&!r?this.ref.set(this.service.add(this.component)):!n&&r&&(this.ref.set(null),this.service.remove(r))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdown","",5,"ng-container",5,"ng-template"]],inputs:{tuiDropdown:"tuiDropdown"},exportAs:["tuiDropdown"],features:[Z([Ts(e),_p(e)]),Mt([FB,{directive:FS,outputs:["tuiDropdownDirectionChange","tuiDropdownDirectionChange"]}]),Yt]});let t=e;return Ot([Ft],t.prototype,"position",null),t})(),LB=(()=>{let e=class e{constructor(){var n;this.el=Ee(),this.accessor=h(Si),this.win=h(Je),this.vvs=h(Sp),this.animation=Ga(h(Va)),this.options=h(xs),this.directive=h(Ze),this.context=h(RB,{optional:!0}),this.theme=(n=this.directive.el.closest("[tuiTheme]"))==null?void 0:n.getAttribute("tuiTheme"),this.sub=h(qa).pipe(go(()=>this.directive.el.isConnected&&!!this.directive.el.offsetParent),S(r=>this.directive.position==="fixed"?this.vvs.correct(r):r),S(([r,o])=>this.getStyles(r,o)),Se()).subscribe({next:r=>Object.assign(this.el.style,r),complete:()=>{var r;return(r=this.close)==null?void 0:r.call(this)}}),this.close=()=>this.directive.toggle(!1)}getStyles(n,r){var N;let{right:o}=this.el.getBoundingClientRect(),{maxHeight:s,minHeight:a,offset:u,limitWidth:l}=this.options,{innerHeight:c}=this.win,f=(N=this.el.offsetParent)==null?void 0:N.getBoundingClientRect(),{position:p}=this.directive,m=this.accessor.getClientRect(),g=p==="fixed"?0:-((f==null?void 0:f.left)||0),y=p==="fixed"?0:-((f==null?void 0:f.top)||0);n+=y,r+=g;let b=o<=m.left||r>=m.right,I=rm.left&&n{let e=class e{constructor(){this.directive=h(Ze),this.el=Ee(),this.obscured=h(op),this.dropdown=Pt(()=>{var n;return(n=this.directive.ref())==null?void 0:n.location.nativeElement}),this.sub=nt(this.obscured.tuiObscured.pipe(ot(Boolean)),h(xi).tuiActiveZoneChange.pipe(ot(n=>!n)),ct(this.el,"focusin").pipe(S(ka),ot(n=>!this.host.contains(n)||!this.directive.ref()))).pipe(Jr(),Se()).subscribe(()=>this.toggle(!1)),this.tuiDropdownEnabled=!0,this.tuiDropdownOpen=!1,this.tuiDropdownOpenChange=new _e,this.driver=h(Rv)}ngOnChanges(){this.update(!!this.tuiDropdownOpen)}toggle(n){this.focused&&!n&&this.host.focus({preventScroll:!0}),this.update(n)}onEsc(n){n.preventDefault(),this.toggle(!1)}onClick(n){!this.editable&&this.host.contains(n)&&this.update(!this.tuiDropdownOpen)}onArrow(n,r){!ui(n.target)||!this.host.contains(n.target)||!this.tuiDropdownEnabled||(n.preventDefault(),this.focusDropdown(r))}onKeydown({key:n,target:r,defaultPrevented:o}){o||!AS(n)||!this.editable||!this.focused||!this.directive.content||!No(r)||Cy(r)&&r!==this.host||(this.update(!0),this.host.focus({preventScroll:!0}))}get host(){var o,s;let n=((o=this.dropdownHost)==null?void 0:o.nativeElement)||this.el,r=Lf(n)?n:Po({initial:n,root:this.el});return((s=this.dropdownHost)==null?void 0:s.nativeElement)||r||this.el}get editable(){return Cy(this.host)}get focused(){return Ki(this.host)||Ki(this.dropdown())}update(n){if(n&&!this.tuiDropdownEnabled)return this.drive();this.tuiDropdownOpen=n,this.tuiDropdownOpenChange.emit(n),this.drive()}drive(n=!!this.tuiDropdownOpen&&this.tuiDropdownEnabled){this.obscured.tuiObscuredEnabled=n,this.driver.next(n)}focusDropdown(n){let r=this.dropdown();if(!r){this.update(!0);return}let o=this.el.ownerDocument,s=r.appendChild(o.createElement("div")),u=Po({initial:n?s:r,previous:n,root:r});s.remove(),u==null||u.focus()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdown","","tuiDropdownOpen",""],["","tuiDropdown","","tuiDropdownOpenChange",""]],contentQueries:function(r,o,s){if(r&1&&_n(s,PB,5,de),r&2){let a;Qe(a=Xe())&&(o.dropdownHost=a.first)}},hostBindings:function(r,o){r&1&&x("click",function(a){return o.onClick(a.target)})("keydown.arrowDown",function(a){return o.onArrow(a,!1)})("keydown.arrowUp",function(a){return o.onArrow(a,!0)})("keydown.silent.capture",function(a){return o.onEsc(a)},!1,Nn)("keydown.silent",function(a){return o.onKeydown(a)},!1,Nn)},inputs:{tuiDropdownEnabled:"tuiDropdownEnabled",tuiDropdownOpen:"tuiDropdownOpen"},outputs:{tuiDropdownOpenChange:"tuiDropdownOpenChange"},features:[Z([Rv,Ho(Rv)]),Mt([op,{directive:xi,inputs:["tuiActiveZoneParent","tuiActiveZoneParent"],outputs:["tuiActiveZoneChange","tuiActiveZoneChange"]}]),Yt]});let t=e;return Ot([PS(BB)],t.prototype,"onEsc",null),t})();var Zle=(()=>{let e=class e{constructor(){this.tuiDropdownOpenChange=new on(!1)}set tuiDropdownOpen(n){this.tuiDropdownOpenChange.next(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiDropdownOpen","",3,"tuiDropdown",""],["","tuiDropdownOpenChange","",3,"tuiDropdown",""]],inputs:{tuiDropdownOpen:"tuiDropdownOpen"},outputs:{tuiDropdownOpenChange:"tuiDropdownOpenChange"}});let t=e;return t})();function RS(t){return ko(Ze,"tuiDropdown",t,{})}function LS(){let t=ko(Tt,"tuiDropdownOpen",!1,{});return h(Tt).tuiDropdownOpenChange.pipe(Se()).subscribe(e=>t.set(e)),t}var HS=(()=>{let e=class e{constructor(){Al({limitWidth:"fixed"},Lv)(h(xs,{self:!0,optional:!0}),null)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Z([Hv({})])]});let t=e;return t})(),Kle=(()=>{let e=class e extends _l{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-dropdowns"]],features:[Z([fI(kl)]),oe],decls:2,vars:0,consts:[["viewContainer",""]],template:function(r,o){r&1&&Qt(0,null,0)},encapsulation:2,changeDetection:0});let t=e;return t})(),BS=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,features:[Mt([{directive:Tt,inputs:["tuiDropdownOpen","open"],outputs:["tuiDropdownOpenChange","openChange"]}])]});let t=e;return t})();var zB=["tuiOption",""],VS=["*"],jB=t=>({$implicit:t});function UB(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}function $B(t,e){t&1&&at(0)}function GB(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}function WB(t,e){if(t&1&&(E(0,"div",1),O(1,GB,2,1,"ng-container",2),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.emptyContent||i.fallback())}}var qB=W();var ZB=W();function KB(t){return De(ZB,t)}var Za=W();function zS(t){return De(Za,t)}var Ss=(()=>{let e=class e{constructor(){var n;this.isMobile=h(Qi),this.el=Ee(),this.dataList=h(vi(()=>Ms),{optional:!0}),this.host=h(Za,{optional:!0}),this.content=h(qB,{optional:!0}),this.dropdown=(n=h(Ze,{self:!0,optional:!0}))==null?void 0:n.ref,this.disabled=!1}ngOnDestroy(){var n;(n=this.dataList)==null||n.handleFocusLossIfNecessary(this.el)}onClick(){var n;(n=this.host)!=null&&n.handleOption&&this.value!==void 0&&this.host.handleOption(this.value)}onMouseMove(){!this.isMobile&&!cl(this.el)&&this.dataList&&this.el.focus({preventScroll:!0})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["button","tuiOption",""],["a","tuiOption",""],["label","tuiOption",""]],hostAttrs:["type","button","role","option"],hostVars:3,hostBindings:function(r,o){r&1&&x("click",function(){return o.onClick()})("mousemove.silent",function(){return o.onMouseMove()}),r&2&&(Ke("disabled",o.disabled||null),Te("_with-dropdown",o.dropdown==null?null:o.dropdown()))},inputs:{disabled:"disabled",value:"value"},features:[Mt([Bo])],attrs:zB,ngContentSelectors:VS,decls:3,vars:4,consts:[["t",""],[4,"polymorpheusOutlet","polymorpheusOutletContext"]],template:function(r,o){if(r&1&&(Xt(),O(0,UB,2,1,"ng-container",1)(1,$B,1,0,"ng-template",null,0,We)),r&2){let s=be(2);v("polymorpheusOutlet",o.content||s)("polymorpheusOutletContext",Kn(2,jB,s))}},dependencies:[Rn],encapsulation:2,changeDetection:0});let t=e;return t})();function YB(){var i;let t=["s","m","l"],e=(i=h(Za,{optional:!0}))==null?void 0:i.size;return e&&t.includes(e)?e:"l"}var Ms=(()=>{let e=class e{constructor(){this.options=Tf,this.ngZone=h(me),this.destroyRef=h(it),this.el=Ee(),this.cdr=h(st),this.fallback=Cn(h(CS)),this.empty=ge(!1),this.size=YB()}onKeyDownArrow(n,r){let{elements:o}=this;Sx(o.indexOf(n),o,r)}handleFocusLossIfNecessary(n=this.el){var r;Ki(n)&&((r=this.origin)==null||r.focus({preventScroll:!0}))}ngAfterContentChecked(){gt(0).pipe(Ei(this.ngZone),kf(this.destroyRef)).subscribe(()=>{this.empty.set(!this.elements.length),this.cdr.detectChanges()})}getOptions(n=!1){return this.options.filter(({disabled:r})=>n||!r).map(({value:r})=>r).filter(si)}onFocusIn(n,r){!r.contains(n)&&!this.origin&&(this.origin=n)}get elements(){return Array.from(this.el.querySelectorAll("a,button,input"))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-data-list"]],contentQueries:function(r,o,s){if(r&1&&_n(s,Ss,5),r&2){let a;Qe(a=Xe())&&(o.options=a)}},hostAttrs:["role","listbox"],hostVars:1,hostBindings:function(r,o){r&1&&x("focusin",function(a){return o.onFocusIn(a.relatedTarget,a.currentTarget)})("mousedown.prevent",function(){return 0})("wheel.silent.passive",function(){return o.handleFocusLossIfNecessary()})("mouseleave",function(a){return o.handleFocusLossIfNecessary(a.target)})("keydown.tab",function(){return o.handleFocusLossIfNecessary()})("keydown.shift.tab",function(){return o.handleFocusLossIfNecessary()})("keydown.arrowDown.prevent",function(a){return o.onKeyDownArrow(a.target,1)})("keydown.arrowUp.prevent",function(a){return o.onKeyDownArrow(a.target,-1)}),r&2&&Ke("data-size",o.size)},inputs:{emptyContent:"emptyContent",size:"size"},features:[Z([KB(e)])],ngContentSelectors:VS,decls:2,vars:1,consts:[["class","t-empty",4,"ngIf"],[1,"t-empty"],[4,"polymorpheusOutlet"]],template:function(r,o){r&1&&(Xt(),at(0),O(1,WB,2,1,"div",0)),r&2&&(C(),v("ngIf",o.empty()))},dependencies:[ut,Rn],styles:[`tui-data-list{--tui-data-list-padding: .25rem;--tui-data-list-margin: .0625rem;display:flex;font:var(--tui-font-text-m);flex-direction:column;padding:calc(var(--tui-data-list-padding) - var(--tui-data-list-margin)) var(--tui-data-list-padding);color:var(--tui-text-tertiary)}tui-data-list:focus-within .t-trap{display:none}tui-data-list:focus-within [tuiOption]._with-dropdown:not(:focus){background-color:transparent}tui-data-list[data-size=s]{--tui-data-list-margin: var(--t-0, 0rem)}tui-data-list[data-size=s]>.t-empty,tui-data-list[data-size=s] [tuiOption]{font:var(--tui-font-text-s);min-block-size:2rem;padding:.3125rem .5rem}tui-data-list[data-size=s]>.t-empty:before,tui-data-list[data-size=s] [tuiOption]:before{font-size:1rem}tui-data-list[data-size=m]>.t-empty,tui-data-list[data-size=m] [tuiOption]{font:var(--tui-font-text-s);min-block-size:2.5rem;padding:.375rem .5rem}tui-data-list[data-size=l]{--tui-data-list-padding: .375rem;--tui-data-list-margin: .125rem}tui-data-list[data-size=l]>.t-empty,tui-data-list[data-size=l] [tuiOption]{font:var(--tui-font-text-m);min-block-size:2.75rem;padding:.375rem .625rem}tui-data-list>.t-empty{display:flex;align-items:center;box-sizing:border-box;margin:var(--tui-data-list-margin) 0}tui-data-list [tuiOption]{-webkit-appearance:none;appearance:none;padding:0;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:flex;align-items:center;box-sizing:border-box;margin:var(--tui-data-list-margin) 0;justify-content:space-between;text-align:start;color:var(--tui-text-primary);border-radius:var(--tui-radius-s);outline:none;cursor:pointer;background-clip:padding-box}tui-data-list [tuiOption]:disabled{opacity:var(--tui-disabled-opacity);cursor:default}tui-data-list [tuiOption]:hover,tui-data-list [tuiOption]:focus-within,tui-data-list [tuiOption]._with-dropdown{background-color:var(--tui-background-neutral-1)}tui-data-list [tuiOption]:before{margin-inline-end:.5rem}tui-data-list [tuiOption]:after{font-size:1rem;margin:0 -.75rem 0 auto;border-left:.5rem solid;border-right:.5rem solid}tui-opt-group{position:relative;display:flex;font:var(--tui-font-text-xs);color:var(--tui-text-secondary);flex-direction:column;line-height:1rem}tui-data-list[data-size=l] tui-opt-group{font:var(--tui-font-text-s);line-height:1.25rem}tui-data-list[data-size=l] tui-opt-group:before{padding-left:.625rem;padding-right:.625rem}tui-data-list[data-size=l] tui-opt-group:after{left:.625rem;right:.625rem}tui-opt-group:empty:before,tui-opt-group:empty:after{display:none}tui-opt-group:before{content:attr(data-label);padding:var(--tui-data-list-padding) .5rem var(--tui-data-list-padding);margin:var(--tui-data-list-margin) 0;white-space:normal;word-break:break-word}tui-opt-group:after{position:absolute;left:.5rem;right:.5rem;top:var(--tui-data-list-padding);block-size:1px;background:var(--tui-border-normal)}tui-opt-group:not(:empty)~tui-opt-group:before{padding-top:calc(.75rem + var(--tui-data-list-padding))}tui-opt-group:not(:empty)~tui-opt-group[data-label=""]:before,tui-opt-group:not(:empty)~tui-opt-group:not([data-label]):before{padding:var(--tui-data-list-padding) 0}tui-opt-group:not(:empty)~tui-opt-group:after{content:""}tui-opt-group[data-label=""]:before,tui-opt-group:not([data-label]):before{padding:0;margin:0} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),mce=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["ng-template","tuiDataList",""]]});let t=e;return t})();var jS=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["tui-opt-group"]],hostAttrs:["role","group"],hostVars:1,hostBindings:function(r,o){r&2&&Ke("data-label",o.label)},inputs:{label:"label"}});let t=e;return t})();var Vo=(()=>{let e=class e{constructor(){this.resolver=Tp(),this.backgroundSrc=ge(null),this.iconSrc=ge(this.resolve(h(za,{self:!0,optional:!0})||h(ja,{self:!0,optional:!0})))}set icon(n){this.iconSrc.set(this.resolve(n))}set background(n){this.backgroundSrc.set(this.resolve(n))}resolve(n){return n?`url(${this.resolver(n)})`:null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-icon"]],hostVars:4,hostBindings:function(r,o){r&2&&Ye("--t-icon",o.iconSrc()||"url()")("--t-icon-bg",o.backgroundSrc())},inputs:{icon:"icon",background:"background"},decls:0,vars:0,template:function(r,o){},styles:[`tui-icon{position:relative;display:inline-block;inline-size:1em;block-size:1em;font-size:1.5rem;flex-shrink:0;border:0 solid transparent;vertical-align:middle;box-sizing:border-box;-webkit-mask:var(--t-icon-bg) no-repeat center / contain;mask:var(--t-icon-bg) no-repeat center / contain}@media (hover: hover) and (pointer: fine){tui-icon[data-appearance=icon]:hover{color:var(--tui-text-secondary)}}tui-icon:after,tui-icon[tuiIcons]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";display:block;-webkit-mask:var(--t-icon) no-repeat center / contain;mask:var(--t-icon) no-repeat center / contain;background:currentColor} `],encapsulation:2,changeDetection:0});let t=e;return t})();var QB=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-label"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiLabel]{display:flex;gap:.25rem;flex-direction:column;font:var(--tui-font-text-s);color:var(--tui-text-primary)}[tuiLabel]:not([data-orientation=vertical]){flex-direction:row;inline-size:-webkit-fit-content;inline-size:-moz-fit-content;inline-size:fit-content;font:var(--tui-font-text-m)}[tuiLabel]:has(tui-textfield),[tuiLabel]:has(tui-primitive-textfield),[tuiLabel]:has(tui-textarea){flex-direction:column!important;inline-size:auto!important;font:var(--tui-font-text-s)!important}[tuiLabel] input[type=checkbox],[tuiLabel] input[type=radio]{margin-inline-end:.5rem}[tuiLabel] input[type=checkbox][data-size=s],[tuiLabel] input[type=radio][data-size=s]{margin-inline-end:.25rem;margin-top:.125rem}[tuiLabel] small{font:var(--tui-font-text-s)}[tuiLabel] [tuiTitle]{margin-top:.125rem}[tuiLabel] [tuiSubtitle]{color:var(--tui-text-secondary)} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),$S=(()=>{let e=class e{constructor(){this.el=Ee(),this.nothing=Dn(QB),this.parent=h(vi(()=>Za),{optional:!0})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["label","tuiLabel",""]],contentQueries:function(r,o,s){if(r&1&&_n(s,Za,5),r&2){let a;Qe(a=Xe())&&(o.textfield=a.first)}},hostVars:2,hostBindings:function(r,o){r&2&&Ke("for",o.el.htmlFor||(o.parent==null?null:o.parent.id))("data-orientation",o.textfield?"vertical":"horizontal")}});let t=e;return t})();function XB(t,e){t&1&&Qt(0)}var JB=["*"];function eV(t,e){if(t&1&&Q(0,"span",1),t&2){let i=e.polymorpheusOutlet;v("innerHTML",i,Zd)}}var tV=t=>({$implicit:t});function nV(t,e){t&1&&Qt(0)}function iV(t,e){if(t&1&&(E(0,"div",1),O(1,nV,1,0,"ng-container",2),w()),t&2){let i=e.$implicit;v("@tuiParentAnimation",void 0)("tuiActiveZoneParent",i.activeZone||null),C(),v("polymorpheusOutlet",i.component)("polymorpheusOutletContext",Kn(4,tV,i))}}var rV=B(()=>Bv),qS=(()=>{let e=class e extends on{constructor(){super([])}add(n){this.next(this.value.concat(n))}remove(n){this.value.includes(n)&&this.next(this.value.filter(r=>r!==n))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),oV=(()=>{let e=class e extends _p{constructor(){super(...arguments),this.type="hint"}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,features:[oe]});let t=e;return t})(),GS=["bottom-left","bottom","bottom-right","top-left","top","top-right","left-top","left","left-bottom","right-top","right","right-bottom"],sV={direction:"bottom-left",showDelay:500,hideDelay:200,appearance:"",icon:"@tui.circle-help"},As=W(sV);var kp=(()=>{let e=class e{constructor(){this.options=h(As,{skipSelf:!0}),this.direction=this.options.direction,this.appearance=this.options.appearance,this.showDelay=this.options.showDelay,this.hideDelay=this.options.hideDelay,this.icon=this.options.icon,this.change$=new tt}ngOnChanges(){this.change$.next()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHintContent",""]],inputs:{content:[0,"tuiHintContent","content"],direction:[0,"tuiHintDirection","direction"],appearance:[0,"tuiHintAppearance","appearance"],showDelay:[0,"tuiHintShowDelay","showDelay"],hideDelay:[0,"tuiHintHideDelay","hideDelay"]},features:[Z([De(As,e)]),Yt]});let t=e;return t})(),Ka=(()=>{let e=class e extends Er{constructor(){super(n=>this.stream$.subscribe(n)),this.isMobile=h(Qi),this.el=Ee(),this.hovered$=h(Es),this.options=h(As),this.visible=!1,this.toggle$=new tt,this.stream$=nt(this.toggle$.pipe(bt(n=>this.isMobile?ce(n):ce(n).pipe(Jn(n?0:this.tuiHintHideDelay))),Kt(this.hovered$),es()),this.hovered$.pipe(bt(n=>this.isMobile?ce(n):ce(n).pipe(Jn(n?this.tuiHintShowDelay:this.tuiHintHideDelay))),Kt(this.toggle$),es())).pipe(ot(()=>this.enabled),S(n=>n&&(this.el.hasAttribute("tuiHintPointer")||!kv(this.el))),ei(n=>{this.visible=n})),this.parent=h(e,{optional:!0,skipSelf:!0}),this.tuiHintShowDelay=this.options.showDelay,this.tuiHintHideDelay=this.options.hideDelay,this.type="hint",this.enabled=!0}toggle(n=!this.visible){var r;this.toggle$.next(n),(r=this.parent)==null||r.toggle(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,inputs:{tuiHintShowDelay:"tuiHintShowDelay",tuiHintHideDelay:"tuiHintHideDelay"},exportAs:["tuiHintHover"],features:[Z([Ho(e),Es]),oe]});let t=e;return t})(),Mp=8,Ap=24,jt=0,en=1,ZS=(()=>{let e=class e extends Ii{constructor(){super(...arguments),this.offset=h(Qi)?16:8,this.viewport=h($a),this.accessor=Sl("hint")(h(Si),h(Ve)),this.points=GS.reduce((n,r)=>U(M({},n),{[r]:[0,0]}),{}),this.direction=h(As).direction,this.directionChange=new _e,this.type="hint"}emitDirection(n){this.directionChange.emit(n)}getPosition(n,r){let o=(r==null?void 0:r.clientWidth)??n.width,s=(r==null?void 0:r.clientHeight)??n.height,a=this.accessor.getClientRect()??Wi,u=a.left+a.width/2,l=a.top+a.height/2;this.points["top-left"][jt]=a.top-s-this.offset,this.points["top-left"][en]=u-o+Ap,this.points.top[jt]=this.points["top-left"][jt],this.points.top[en]=u-o/2,this.points["top-right"][jt]=this.points["top-left"][jt],this.points["top-right"][en]=u-Ap,this.points["bottom-left"][jt]=a.bottom+this.offset,this.points["bottom-left"][en]=this.points["top-left"][en],this.points.bottom[jt]=this.points["bottom-left"][jt],this.points.bottom[en]=this.points.top[en],this.points["bottom-right"][jt]=this.points["bottom-left"][jt],this.points["bottom-right"][en]=this.points["top-right"][en],this.points["left-top"][jt]=l-s+Ap,this.points["left-top"][en]=a.left-o-this.offset,this.points.left[jt]=l-s/2,this.points.left[en]=this.points["left-top"][en],this.points["left-bottom"][jt]=l-Ap,this.points["left-bottom"][en]=this.points["left-top"][en],this.points["right-top"][jt]=this.points["left-top"][jt],this.points["right-top"][en]=a.right+this.offset,this.points.right[jt]=this.points.left[jt],this.points.right[en]=this.points["right-top"][en],this.points["right-bottom"][jt]=this.points["left-bottom"][jt],this.points["right-bottom"][en]=this.points["right-top"][en];let p=(Array.isArray(this.direction)?this.direction:[this.direction]).concat(GS).find(m=>this.checkPosition(this.points[m],o,s));return this.emitDirection(p||this.fallback),this.points[p||this.fallback]}get fallback(){return this.points.top[jt]>this.viewport.getClientRect().bottom-this.points.bottom[jt]?"top":"bottom"}checkPosition([n,r],o,s){let a=this.viewport.getClientRect();return n>Mp&&r>Mp&&n+s{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,inputs:{direction:[0,"tuiHintDirection","direction"]},outputs:{directionChange:"tuiHintDirectionChange"},features:[oe]});let t=e;return Ot([Ft],t.prototype,"emitDirection",null),t})(),Ve=(()=>{let e=class e{constructor(){this.service=h(qS),this.appearance=h(As).appearance,this.content=ge(null),this.component=h(Xi),this.el=Ee(),this.activeZone=h(xi,{optional:!0}),this.type="hint"}set tuiHint(n){this.content.set(n),n||this.toggle(!1)}ngOnDestroy(){this.toggle(!1)}getClientRect(){return this.el.getBoundingClientRect()}toggle(n){n&&this.content()?this.service.add(this):this.service.remove(this)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHint","",5,"ng-container",5,"ng-template"]],inputs:{context:[0,"tuiHintContext","context"],appearance:[0,"tuiHintAppearance","appearance"],tuiHint:"tuiHint"},features:[Z([Ts(e),bp(e),{provide:Xi,deps:[rV,gr],useClass:Xi}]),Mt([oV,{directive:Ka,inputs:["tuiHintHideDelay","tuiHintHideDelay","tuiHintShowDelay","tuiHintShowDelay"]},{directive:ZS,inputs:["tuiHintDirection","tuiHintDirection"],outputs:["tuiHintDirectionChange","tuiHintDirectionChange"]}])]});let t=e;return t})(),aV=(()=>{let e=class e extends Ka{constructor(){super(...arguments),this.currentRect=Wi}getClientRect(){return this.currentRect}onMove({clientX:n,clientY:r}){this.currentRect=Dy(n,r)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiHint","","tuiHintPointer",""]],hostBindings:function(r,o){r&1&&x("mousemove.silent",function(a){return o.onMove(a)})},features:[Z([Ts(e),Ho(e)]),oe]});let t=e;return t})(),uV=(()=>{let e=class e{constructor(){this.context=cv()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostVars:1,hostBindings:function(r,o){r&2&&Ea("@tuiParentAnimation",void 0)},decls:1,vars:1,consts:[[4,"polymorpheusOutlet"]],template:function(r,o){r&1&&O(0,XB,1,0,"ng-container",0),r&2&&v("polymorpheusOutlet",o.context.$implicit.content())},dependencies:[Rn],encapsulation:2,data:{animation:[xv]},changeDetection:0});let t=e;return t})();var WS=8,lV=[qa,Es,yp("hint",ZS),vp("hint",Ve)],Bv=(()=>{let e=class e{constructor(){var n;this.el=Ee(),this.hover=h(Ka),this.vvs=h(Ip),this.viewport=h($a),this.desktop={value:"",params:{end:1,start:1}},this.options=Ga(h(Va),"cubic-bezier(0.35, 1.3, 0.25, 1)"),this.pointer=h(aV,{optional:!0}),this.accessor=h(Si),this.hint=cv().$implicit,this.isMobile=h(Qi),this.content=this.hint.component.component===uV?ge(""):this.hint.content,this.appearance=this.hint.appearance||((n=this.hint.el.closest("[tuiTheme]"))==null?void 0:n.getAttribute("tuiTheme")),h(qa).pipe(go(()=>this.hint.el.isConnected),S(r=>this.vvs.correct(r)),Se()).subscribe({next:([r,o])=>this.update(r,o),complete:()=>this.hover.toggle(!1)}),h(Es).pipe(Se()).subscribe(r=>this.hover.toggle(r))}onClick(n){(!n.closest("tui-hint")&&!this.hint.el.contains(n)||kv(this.hint.el))&&this.hover.toggle(!1)}apply(n,r,o,s){this.el.style.top=n,this.el.style.left=r,this.el.style.setProperty("--top",`${o}%`),this.el.style.setProperty("--left",`${s}%`),this.el.style.setProperty("--rotate",!s||Math.ceil(s)===100?"90deg":"0deg")}update(n,r){let{clientHeight:o,clientWidth:s}=this.el,a=this.accessor.getClientRect(),u=this.viewport.getClientRect();if(a===Wi||!o||!s)return;let l=Jt(r,WS,u.width-s-WS),[c,f]=this.vvs.correct([a.top+a.height/2-n,a.left+a.width/2-l]);this.apply(ht(Math.round(n)),ht(Math.round(l)),Math.round(Jt(c,0,o)/o*100),Math.round(Jt(f,0,s)/s*100))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-hint"]],hostVars:8,hostBindings:function(r,o){r&1&&x("click",function(a){return o.onClick(a.target)},!1,Nn),r&2&&(Ea("@tuiScaleIn",o.isMobile?o.options:o.desktop)("@tuiFadeIn",o.options),Ke("data-appearance",o.appearance)("tuiTheme",o.appearance),Te("_untouchable",o.pointer)("_mobile",o.isMobile))},features:[Z(lV)],ngContentSelectors:JB,decls:2,vars:2,consts:[[3,"innerHTML",4,"polymorpheusOutlet","polymorpheusOutletContext"],[3,"innerHTML"]],template:function(r,o){r&1&&(Xt(),at(0),O(1,eV,1,1,"span",0)),r&2&&(C(),v("polymorpheusOutlet",o.content())("polymorpheusOutletContext",o.hint.context))},dependencies:[Rn],styles:[`[_nghost-%COMP%]{position:absolute;max-inline-size:18rem;padding:.75rem 1rem;background:var(--tui-background-accent-1);border-radius:var(--tui-radius-l);color:var(--tui-text-primary-on-accent-1);box-sizing:border-box;font:var(--tui-font-text-s);white-space:pre-line;overflow-wrap:break-word;transform-origin:var(--left) var(--top)}[_nghost-%COMP%]:before{content:"";position:absolute;top:var(--top);left:var(--left);inline-size:.75rem;block-size:.5rem;background:inherit;-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,');transform:translate(-50%,-50%) rotate(var(--rotate))}._mobile[_nghost-%COMP%]{font:var(--tui-font-text-m)}._mobile[_nghost-%COMP%]:before{inline-size:1.5rem;block-size:1.125rem;-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}[data-appearance=error][_nghost-%COMP%]{background:var(--tui-status-negative)}[data-appearance=dark][_nghost-%COMP%]{background:var(--tui-background-accent-opposite-hover);color:var(--tui-background-base);filter:drop-shadow(0 0 .125rem rgba(0,0,0,.16)) drop-shadow(0 1.5rem 1rem rgba(0,0,0,.03)) drop-shadow(0 .75rem .75rem rgba(0,0,0,.04)) drop-shadow(0 .25rem .375rem rgba(0,0,0,.05))}[_nghost-%COMP%]:not([style*=top]){visibility:hidden}._untouchable[_nghost-%COMP%]{pointer-events:none}`],data:{animation:[hp,mS]},changeDetection:0});let t=e;return Ot([Ft],t.prototype,"apply",null),t})(),ze=(()=>{let e=class e extends Er{constructor(){super(n=>this.stream$.subscribe(n)),this.doc=h(qe),this.el=Ee(),this.zone=h(me),this.id$=new on(""),this.stream$=this.id$.pipe(ke(),Af(()=>ct(this.doc,"keydown",{capture:!0}),si),bt(()=>this.focused?ce(!1):nt(rt(this.doc,"keyup"),rt(this.element,"blur")).pipe(S(()=>this.focused))),Em(n=>n?gt(1e3,Fn(this.zone)):ce(null)),dt(!1),ke(),Tu(1),ai()),this.type="hint"}set tuiHintDescribe(n){this.id$.next(n||"")}get element(){return this.doc.getElementById(this.id$.value||"")||this.el}get focused(){return cl(this.element)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHintDescribe",""]],inputs:{tuiHintDescribe:"tuiHintDescribe"},features:[Z([Ho(e)]),oe]});let t=e;return Ot([Ft],t.prototype,"element",null),t})();var ade=(()=>{let e=class e{constructor(){this.hints$=h(qS),this.destroyRef=h(it),this.cdr=h(st),this.hints=[]}ngOnInit(){this.hints$.pipe(Se(this.destroyRef)).subscribe(n=>{this.hints=n,this.cdr.detectChanges()})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-hints"]],hostAttrs:["aria-live","polite"],decls:1,vars:1,consts:[["role","tooltip",3,"tuiActiveZoneParent",4,"ngFor","ngForOf"],["role","tooltip",3,"tuiActiveZoneParent"],[4,"polymorpheusOutlet","polymorpheusOutletContext"]],template:function(r,o){r&1&&O(0,iV,2,6,"div",0),r&2&&v("ngForOf",o.hints)},dependencies:[Ci,Rn,xi],styles:["[_nghost-%COMP%]{position:fixed;top:0;left:0;inline-size:100%;block-size:100%;block-size:0}"],data:{animation:[xv]}});let t=e;return t})();var cV=typeof ResizeObserver<"u"?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},dV="content-box",Vv=dV,fV=new k("[WA_RESIZE_OPTION_BOX]",{providedIn:"root",factory:()=>Vv}),QS=fV,YS=(()=>{let e=class e extends te{constructor(){let n=h(de).nativeElement,r=h(QS);super(o=>{let s=new cV(a=>o.next(a));return s.observe(n,{box:r}),()=>{s.disconnect()}})}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),XS=(()=>{let e=class e{constructor(){d(this,"waResizeObserver",h(YS));d(this,"box",Vv)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275dir",T({type:e,selectors:[["","waResizeObserver",""]],inputs:{waResizeBox:[0,"box","waResizeBox"]},outputs:{waResizeObserver:"waResizeObserver"},features:[Z([YS,{provide:QS,useFactory:()=>h(de).nativeElement.getAttribute("waResizeBox")||Vv}])]}));let t=e;return t})();var hde=new k("[WA_RESIZE_OBSERVER_SUPPORT]",{providedIn:"root",factory:()=>!!h(Je).ResizeObserver});var pV=["vcr"],hV=[[["input"]],[["select"]],[["label"]],"*",[["tui-icon"]]],mV=["input","select","label","*","tui-icon"],gV=t=>({$implicit:t});function yV(t,e){if(t&1){let i=q();E(0,"button",6),x("click",function(){P(i);let r=_();return F(r.directive==null?null:r.directive.setValue(null))})("pointerdown.silent.prevent",function(){P(i);let r=_();return F(r.input==null||r.input.nativeElement==null?null:r.input.nativeElement.focus())}),he(1),w()}if(t&2){let i=_();v("iconStart",i.icons.close),C(),Nt(" ",i.clear()," ")}}function vV(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}function bV(t,e){if(t&1&&Q(0,"input",7),t&2){let i=_();v("value",i.computedFiller())}}var zv={appearance:"textfield",size:"l",cleaner:!0},Op=W({appearance:ge(zv.appearance),size:ge(zv.size),cleaner:ge(zv.cleaner)});var _V=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["ng-template","tuiTextfieldDropdown",""]]});let t=e;return t})(),CV=(()=>{let e=class e{constructor(){this.dropdown=RS(null)}set template(n){this.dropdown.set(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,contentQueries:function(r,o,s){if(r&1&&_n(s,_V,5,It),r&2){let a;Qe(a=Xe())&&(o.template=a.first)}}});let t=e;return t})(),jv=(()=>{let e=class e{constructor(){this.filler=ge(""),this.autoId=KI(),this.el=Ee(),this.open=LS(),this.focusedIn=Ix(Ee()),this.icons=h(vS),this.clear=Cn(h(_S)),this.computedFiller=Pt(()=>{var o;let n=((o=this.directive)==null?void 0:o.nativeValue())||"",r=n+this.filler().slice(n.length);return r.length>n.length?r:""}),this.showFiller=Pt(()=>{var n,r;return this.focused()&&!!this.computedFiller()&&(!!((n=this.directive)!=null&&n.nativeValue())||!((r=this.input)!=null&&r.nativeElement.placeholder))}),this.stringify=String,this.focused=Pt(()=>this.open()||this.focusedIn()),this.options=h(Op)}set fillerSetter(n){this.filler.set(n)}get id(){var n;return((n=this.input)==null?void 0:n.nativeElement.id)||this.autoId}get size(){return this.options.size()}handleOption(n){var r;(r=this.directive)==null||r.setValue(n),this.open.set(!1)}get hasLabel(){var n,r;return!!((r=(n=this.label)==null?void 0:n.nativeElement)!=null&&r.childNodes.length)}onResize({contentRect:n}){this.el.style.setProperty("--t-side",ht(n.width))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-textfield"]],contentQueries:function(r,o,s){if(r&1&&(_n(s,JS,5),_n(s,$S,5,de),_n(s,an,5),_n(s,JS,7,de)),r&2){let a;Qe(a=Xe())&&(o.directive=a.first),Qe(a=Xe())&&(o.label=a.first),Qe(a=Xe())&&(o.control=a.first),Qe(a=Xe())&&(o.input=a.first)}},viewQuery:function(r,o){if(r&1&&Gt(pV,7,zt),r&2){let s;Qe(s=Xe())&&(o.vcr=s.first)}},hostVars:7,hostBindings:function(r,o){r&2&&(Ke("data-size",o.options.size()),Te("_with-label",o.hasLabel)("_with-template",o.content)("_disabled",o.input==null?null:o.input.nativeElement.disabled))},inputs:{stringify:"stringify",content:"content",fillerSetter:[0,"filler","fillerSetter"]},features:[Z([TS({size:"xs",appearance:"icon"}),zS(e)]),Mt([HS,Ze,BS,CV,Bo])],ngContentSelectors:mV,decls:12,vars:6,consts:[["vcr",""],[1,"t-content",3,"mousedown.prevent","waResizeObserver"],["appearance","icon","size","xs","tabindex","-1","tuiIconButton","","type","button","class","t-clear",3,"iconStart","click","pointerdown.silent.prevent",4,"ngIf"],[1,"t-template"],[4,"polymorpheusOutlet","polymorpheusOutletContext"],["aria-hidden","true","disabled","","class","t-filler",3,"value",4,"ngIf"],["appearance","icon","size","xs","tabindex","-1","tuiIconButton","","type","button",1,"t-clear",3,"click","pointerdown.silent.prevent","iconStart"],["aria-hidden","true","disabled","",1,"t-filler",3,"value"]],template:function(r,o){if(r&1){let s=q();Xt(hV),at(0),at(1,1),at(2,2),E(3,"span",1),x("mousedown.prevent",function(){return P(s),F(o.input==null||o.input.nativeElement==null?null:o.input.nativeElement.focus())})("waResizeObserver",function(u){return P(s),F(u[0]&&o.onResize(u[0]))}),at(4,3),O(5,yV,2,2,"button",2),Qt(6,null,0),at(8,4),w(),E(9,"span",3),O(10,vV,2,1,"ng-container",4),w(),O(11,bV,1,1,"input",5)}r&2&&(C(5),v("ngIf",o.options.cleaner()),C(5),v("polymorpheusOutlet",o.content)("polymorpheusOutletContext",Kn(4,gV,o.control==null?null:o.control.value)),C(),v("ngIf",o.showFiller()))},dependencies:[ut,Rn,Le,XS],styles:[`tui-textfield{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;--t-height: var(--tui-height-l);--t-padding: var(--tui-padding-l);position:relative;display:flex;align-items:center;pointer-events:none;cursor:pointer;block-size:var(--t-height);color:var(--tui-text-tertiary);padding:0 var(--t-padding);border-radius:var(--tui-radius-l);font:var(--tui-font-text-m);box-sizing:border-box}tui-textfield[style*="--t-icon-start:"]{--t-left: 2.25rem}tui-textfield[style*="--t-icon-end:"]{--t-right: 2.25rem}tui-textfield:after{margin-inline-start:.25rem}tui-textfield input,tui-textfield select{font:var(--tui-font-text-m)}tui-textfield[data-size=s]{--t-height: var(--tui-height-s);--t-padding: var(--tui-padding-s);border-radius:var(--tui-radius-m);font:var(--tui-font-text-s)}tui-textfield[data-size=s][style*="--t-icon-start:"]{--t-left: 1.25rem}tui-textfield[data-size=s][style*="--t-icon-end:"]{--t-right: 1.25rem}tui-textfield[data-size=s]:before{margin:0 .5rem 0 -.125rem;font-size:1rem}tui-textfield[data-size=s]:after{margin:0 -.175rem 0 .575rem;font-size:1rem}tui-textfield[data-size=s] input,tui-textfield[data-size=s] select{font:var(--tui-font-text-s)}tui-textfield[data-size=s] .t-content{gap:0;margin-inline-end:-.325rem}tui-textfield[data-size=m]{--t-height: var(--tui-height-m);--t-padding: var(--tui-padding-m);border-radius:var(--tui-radius-m);font:var(--tui-font-text-s)}tui-textfield[data-size=m][style*="--t-icon-start:"]{--t-left: 1.75rem}tui-textfield[data-size=m][style*="--t-icon-end:"]{--t-right: 1.75rem}tui-textfield[data-size=m]:before{margin:0 .375rem 0 -.125rem}tui-textfield[data-size=m]:after{margin:0 -.125rem 0 .5rem}tui-textfield[data-size=m] input,tui-textfield[data-size=m] select{font:var(--tui-font-text-s)}tui-textfield[data-size=m] .t-content{margin-inline-end:-.125rem}tui-textfield:hover{color:var(--tui-text-secondary)}tui-textfield:hover:has(input:read-only),tui-textfield:hover:has(select[data-mode~=readonly]){color:var(--tui-text-tertiary)}tui-textfield:before{z-index:1;margin-inline-end:.75rem}tui-textfield:has(:disabled:not(.t-filler,button,option)):before,tui-textfield:has(:disabled:not(.t-filler,button,option)):after,tui-textfield:has(:disabled:not(.t-filler,button,option)) .t-template{opacity:var(--tui-disabled-opacity)}tui-textfield._disabled:before,tui-textfield._disabled:after,tui-textfield._disabled .t-template{opacity:var(--tui-disabled-opacity)}tui-textfield:has(label:not(:empty)) .t-template,tui-textfield:has(label:not(:empty)) input:defined,tui-textfield:has(label:not(:empty)) select:defined{padding-top:calc(var(--t-height) / 3)}tui-textfield:has(label:not(:empty)) .t-template::placeholder,tui-textfield:has(label:not(:empty)) input:defined::placeholder,tui-textfield:has(label:not(:empty)) select:defined::placeholder,tui-textfield:has(label:not(:empty)) .t-template._empty,tui-textfield:has(label:not(:empty)) input:defined._empty,tui-textfield:has(label:not(:empty)) select:defined._empty{color:transparent}tui-textfield._with-label .t-template,tui-textfield._with-label input:defined,tui-textfield._with-label select:defined{padding-top:calc(var(--t-height) / 3)}tui-textfield._with-label .t-template::placeholder,tui-textfield._with-label input:defined::placeholder,tui-textfield._with-label select:defined::placeholder,tui-textfield._with-label .t-template._empty,tui-textfield._with-label input:defined._empty,tui-textfield._with-label select:defined._empty{color:transparent}tui-textfield .t-template,tui-textfield input:defined,tui-textfield select:defined{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;-webkit-appearance:none;appearance:none;box-sizing:border-box;border-radius:inherit;padding:inherit;border:none;text-indent:var(--t-left, 0);padding-inline-end:calc(var(--t-right, var(--t-0, 0rem)) + var(--t-side) + var(--t-padding))}tui-textfield .t-template{display:flex;align-items:center}tui-textfield._with-template select{color:transparent!important}tui-textfield input:defined,tui-textfield select:defined{pointer-events:auto;background:transparent}tui-textfield input:defined:read-only~.t-filler,tui-textfield select:defined:read-only~.t-filler{display:none}tui-textfield input:defined:disabled~label,tui-textfield select:defined:disabled~label,tui-textfield input:defined:disabled~.t-content,tui-textfield select:defined:disabled~.t-content{opacity:var(--tui-disabled-opacity)}tui-textfield input:defined:disabled~label>tui-icon,tui-textfield select:defined:disabled~label>tui-icon,tui-textfield input:defined:disabled~.t-content>tui-icon,tui-textfield select:defined:disabled~.t-content>tui-icon{display:none}tui-textfield input:defined:-webkit-autofill~label,tui-textfield select:defined:-webkit-autofill~label,tui-textfield input:defined:not(._empty):not(:placeholder-shown)~label,tui-textfield select:defined:not(._empty):not(:placeholder-shown)~label{font-size:.83em;transform:translateY(-.7em)}tui-textfield input:defined:-webkit-autofill:not(:disabled)[data-mode~=invalid]~label,tui-textfield select:defined:-webkit-autofill:not(:disabled)[data-mode~=invalid]~label,tui-textfield input:defined:not(._empty):not(:placeholder-shown):not(:disabled)[data-mode~=invalid]~label,tui-textfield select:defined:not(._empty):not(:placeholder-shown):not(:disabled)[data-mode~=invalid]~label,tui-textfield input:defined:-webkit-autofill:invalid:not(:disabled):not([data-mode])~label,tui-textfield select:defined:-webkit-autofill:invalid:not(:disabled):not([data-mode])~label,tui-textfield input:defined:not(._empty):not(:placeholder-shown):invalid:not(:disabled):not([data-mode])~label,tui-textfield select:defined:not(._empty):not(:placeholder-shown):invalid:not(:disabled):not([data-mode])~label{color:var(--tui-text-negative)}tui-textfield input:defined:-webkit-autofill:not(:disabled):not([data-mode~=readonly])~.t-content .t-clear,tui-textfield select:defined:-webkit-autofill:not(:disabled):not([data-mode~=readonly])~.t-content .t-clear,tui-textfield input:defined:not(._empty):not(:placeholder-shown):not(:disabled):not([data-mode~=readonly])~.t-content .t-clear,tui-textfield select:defined:not(._empty):not(:placeholder-shown):not(:disabled):not([data-mode~=readonly])~.t-content .t-clear{display:flex}tui-textfield input:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])::placeholder,tui-textfield select:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])::placeholder,tui-textfield input:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])._empty,tui-textfield select:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])._empty{color:var(--tui-text-tertiary)}tui-textfield input:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])~label,tui-textfield select:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])~label{color:var(--tui-text-primary)!important;font-size:.83em;transform:translateY(-.7em)}tui-textfield input:defined:not([data-mode~=readonly])[data-focus=true]::placeholder,tui-textfield select:defined:not([data-mode~=readonly])[data-focus=true]::placeholder,tui-textfield input:defined:not([data-mode~=readonly])[data-focus=true]._empty,tui-textfield select:defined:not([data-mode~=readonly])[data-focus=true]._empty{color:var(--tui-text-tertiary)}tui-textfield input:defined:not([data-mode~=readonly])[data-focus=true]~label,tui-textfield select:defined:not([data-mode~=readonly])[data-focus=true]~label{color:var(--tui-text-primary)!important;font-size:.83em;transform:translateY(-.7em)}tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)::placeholder,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)::placeholder,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]._focused::placeholder,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]._focused::placeholder,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)._empty,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)._empty,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]._focused._empty,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]._focused._empty{color:var(--tui-text-tertiary)}tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)~label,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)~label,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]._focused~label,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]._focused~label{color:var(--tui-text-primary)!important;font-size:.83em;transform:translateY(-.7em)}@supports (-webkit-touch-callout: none){tui-textfield input:defined._ios-fix,tui-textfield select:defined._ios-fix{position:fixed;left:1000rem}}tui-textfield label:not([data-orientation=vertical]){transition-property:all;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative;display:block;flex:1;font-size:inherit}tui-textfield label:defined,tui-textfield input:defined::placeholder,tui-textfield select:defined._empty{color:var(--tui-text-secondary)}tui-textfield select:not([data-mode~=readonly]){cursor:pointer}tui-textfield button,tui-textfield a{pointer-events:auto}tui-textfield .t-content{display:flex;align-items:center;gap:.25rem;margin-inline-start:auto;isolation:isolate}tui-textfield .t-content>tui-icon{pointer-events:auto}tui-textfield .t-clear{display:none;pointer-events:auto}tui-textfield .t-filler:defined{pointer-events:none;background:none;color:var(--tui-text-tertiary);opacity:1}tui-textfield [tuiFluidTypography]{font-weight:700} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),DV=(()=>{let e=class e{constructor(){this.focused=ge(null),this.control=h(an,{optional:!0}),this.a=yS(h(Op).appearance),this.s=Ha(null),this.m=Ep(this.mode),this.f=Dp(Pt(()=>this.focused()||this.textfield.focused())),this.el=Ee(),this.textfield=h(jv),this.readOnly=!1,this.invalid=null,this.nativeValue=Cn(nt(ct(this.el,"input"),gt(0).pipe(bt(()=>Aa(this.control)))).pipe(S(()=>this.el.value)),{initialValue:this.el.value})}set focusedSetter(n){this.focused.set(n)}set stateSetter(n){this.s.set(n)}get mode(){return this.readOnly?"readonly":this.invalid===!1?"valid":this.invalid?"invalid":null}ngOnChanges(){this.m.set(this.mode)}setValue(n){this.el.focus(),this.el.select(),n==null?this.el.ownerDocument.execCommand("delete"):this.el.ownerDocument.execCommand("insertText",!1,this.textfield.stringify(n))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,inputs:{readOnly:"readOnly",invalid:"invalid",focusedSetter:[0,"focused","focusedSetter"],stateSetter:[0,"state","stateSetter"]},standalone:!1,features:[Yt]});let t=e;return t})(),JS=(()=>{let e=class e extends DV{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["input","tuiTextfield",""]],hostVars:4,hostBindings:function(r,o){r&1&&x("input",function(){return 0})("focusin",function(){return 0})("focusout",function(){return 0}),r&2&&(ms("id",o.textfield.id)("readOnly",o.readOnly),Te("_empty",o.el.value===""))},features:[Mt([wI,Ji]),oe]});let t=e;return t})();var EV={size:"l",collapsed:!1,rounded:!0,orientation:"horizontal"},wV=W(EV);var TV=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-group"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiGroup]{position:relative;display:flex;isolation:isolate;--t-group-radius: var(--tui-radius-l);--t-group-margin: -1px;--t-group-clip: inset(-1rem 1px -1rem -1rem)}[tuiGroup]>*{z-index:1;flex:1 1 0;min-inline-size:0}[tuiGroup]>*:disabled,[tuiGroup]>*._disabled{z-index:0}[tuiGroup]>*:invalid:not([data-mode]),[tuiGroup]>*[data-mode~=invalid]{z-index:2;--t-group-clip: none}[tuiGroup]>*:has(:invalid:not([data-mode])),[tuiGroup]>*:has([data-mode~=invalid]){z-index:2;--t-group-clip: none}[tuiGroup]>*:focus-within{z-index:3;--t-group-clip: none}[tuiGroup]>*:has([data-focus=true]){z-index:3;--t-group-clip: none}[tuiGroup]>*:checked:not([data-mode]),[tuiGroup]>*[data-mode~=checked]{z-index:4;--t-group-clip: none}[tuiGroup]>*:has([tuiBlock]:checked){z-index:4;--t-group-clip: none}[tuiGroup]>*:not(:last-child){margin-inline-end:var(--t-group-margin);clip-path:var(--t-group-clip)}[tuiGroup]>*:nth-child(n){border-radius:0}[tuiGroup]>*:first-child{border-top-left-radius:var(--t-group-radius);border-bottom-left-radius:var(--t-group-radius)}[tuiGroup]>*:last-child{border-top-right-radius:var(--t-group-radius);border-bottom-right-radius:var(--t-group-radius)}[tuiGroup][data-size=s],[tuiGroup][data-size=m]{--t-group-radius: var(--tui-radius-m)}[tuiGroup][data-orientation=vertical]{display:inline-flex;flex-direction:column;--t-group-clip: inset(-1rem -1rem 1px -1rem)}[tuiGroup][data-orientation=vertical]>*{min-block-size:auto;flex:0 0 auto}[tuiGroup][data-orientation=vertical]>*:not(:last-child){margin-inline-end:0;margin-block-end:var(--t-group-margin)}[tuiGroup][data-orientation=vertical]>*:first-child{border-radius:var(--t-group-radius) var(--t-group-radius) 0 0}[tuiGroup][data-orientation=vertical]>*:last-child{border-radius:0 0 var(--t-group-radius) var(--t-group-radius)}[tuiGroup][data-orientation=vertical]>*:only-child{border-radius:var(--t-group-radius)}.tui-group{position:relative;display:flex;isolation:isolate;--t-group-radius: var(--tui-radius-m)}.tui-group>*{flex:1 1 0;min-inline-size:0}.tui-group>*:not(:last-child){margin-right:.125rem}.tui-group.tui-group>*:nth-child(n){border-radius:0}.tui-group_radius_large{--t-group-radius: var(--tui-radius-l)}.tui-group_collapsed>*{z-index:1}.tui-group_collapsed>*:not(:last-child){margin:0 -1px 0 0}.tui-group_collapsed>*._readonly,.tui-group_collapsed>*._disabled,.tui-group_collapsed>*._readonly:hover,.tui-group_collapsed>*._disabled:hover{z-index:0}.tui-group_collapsed>*._invalid{z-index:2}.tui-group_collapsed>*._invalid:hover,.tui-group_collapsed>*._invalid._hovered,.tui-group_collapsed>*._invalid._pressed{z-index:4}.tui-group_collapsed>*:hover,.tui-group_collapsed>*._hovered,.tui-group_collapsed>*._pressed{z-index:3}.tui-group_collapsed>*._hosted_dropdown_focused,.tui-group_collapsed>*._focus-visible,.tui-group_collapsed>*._focused.ng-touched,.tui-group_collapsed>*._focused.ng-untouched{z-index:5}.tui-group_collapsed>*._active,.tui-group_collapsed>*[data-appearance=whiteblock-active]{z-index:6}.tui-group_collapsed>*:has([tuiBlock]:checked){z-index:6}.tui-group_collapsed>*._focus-visible._focused,.tui-group_collapsed>*._focus-visible._active,.tui-group_collapsed>*._focus-visible[data-appearance=whiteblock-active]{z-index:7}.tui-group_orientation_vertical{display:inline-flex;flex-direction:column}.tui-group_orientation_vertical>*{min-block-size:auto;flex:0 0 auto}.tui-group_orientation_vertical>*:not(:last-child){margin-right:0;margin-bottom:.125rem}.tui-group_orientation_vertical.tui-group_collapsed>*:not(:last-child){margin:0 0 -1px}.tui-group_rounded.tui-group_orientation_horizontal>*:first-child{border-top-left-radius:var(--t-group-radius);border-bottom-left-radius:var(--t-group-radius)}.tui-group_rounded.tui-group_orientation_horizontal>*:last-child{border-top-right-radius:var(--t-group-radius);border-bottom-right-radius:var(--t-group-radius)}.tui-group_rounded.tui-group_orientation_vertical>*:first-child{border-top-left-radius:var(--t-group-radius);border-top-right-radius:var(--t-group-radius)}.tui-group_rounded.tui-group_orientation_vertical>*:last-child{border-bottom-left-radius:var(--t-group-radius);border-bottom-right-radius:var(--t-group-radius)}.tui-group__auto-width-item{min-inline-size:auto;flex:0 0 auto}.tui-group__inherit-item{border-radius:inherit!important} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),ife=(()=>{let e=class e{constructor(){this.options=h(wV),this.nothing=Dn(TV),this.orientation=this.options.orientation,this.collapsed=this.options.collapsed,this.rounded=this.options.rounded,this.size=this.options.size}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiGroup","",5,"ng-container"]],hostAttrs:["tuiGroup","","role","group"],hostVars:8,hostBindings:function(r,o){r&2&&(Ke("data-orientation",o.orientation)("data-size",o.size),Ye("--t-group-radius",o.rounded?null:0)("--t-group-margin",o.collapsed?null:.125,"rem")("--t-group-clip",o.collapsed?null:0))},inputs:{orientation:"orientation",collapsed:"collapsed",rounded:"rounded",size:"size"}});let t=e;return t})();var ufe=(()=>{let e=class e{constructor(){this.imagePreview=new _e}click(n){n instanceof HTMLImageElement&&this.imagePreview.emit(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["tui-editor-socket","imagePreview",""]],hostAttrs:[1,"_preview-image"],hostBindings:function(r,o){r&1&&x("click",function(a){return o.click(a.target)})},outputs:{imagePreview:"imagePreview"}});let t=e;return t})();function Np(t,e,i){let n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.name===i)return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ya(t){let{state:e}=t,{selection:i}=e,{$anchor:n,empty:r}=i;if(!r)return{from:i.from,to:i.to};if(n){let{pos:o}=n,s=n.start(),a=n.parent,u=a.textBetween(0,o-s,void 0,"\uFFFC"),l=a.textBetween(o-s,a.content.size,void 0,"\uFFFC"),c=u.replaceAll(/\uFFFC/g,"").split(/\b/).pop(),f=l.replaceAll(/\uFFFC/g,"").split(/\b/).shift(),p=o-((c==null?void 0:c.length)??0),m=o+((f==null?void 0:f.length)??0);return{from:p,to:m}}return{from:i.to,to:i.to+1}}function xV(t,e){let i=Object.keys(e);return!i.length||!!i.filter(n=>e[n]===t[n]).length}function Uv(t,e,i={}){return t.find(({attrs:n,type:r})=>r===e&&xV(n,i))||null}function t2(t,e,i={}){if(!t||!e)return null;let{node:n,offset:r}=t.parent.childAfter(t.parentOffset);if(!n)return null;let o=Uv(n.marks,e,i);if(!o)return null;let s=t.index(),a=t.start()+r,u=s+1,l=a+n.nodeSize;for(Uv(n.marks,e,i);s>0&&o.isInSet(t.parent.child(s-1).marks);)s-=1,a-=t.parent.child(s).nodeSize;for(;u{i instanceof d1&&e.push([i.type.name,i.attrs])}),e}function Pp(t,e){let i=e??t.selection.$head.parent.textContent,n=t.doc.cut(t.selection.from,t.selection.to);return n.content.size?zs(n.content,t.schema):i}function n2(t){var o,s,a;if(!((o=t==null?void 0:t.state)!=null&&o.selection))return{before:"",after:""};let{$from:e,$to:i}=t.state.selection,n=(s=e.nodeBefore)==null?void 0:s.textContent;n=((n==null?void 0:n.slice((((n==null?void 0:n.lastIndexOf(" "))||(n==null?void 0:n.lastIndexOf(` -`)))??0)+1))??"").trim();let r=((a=i.nodeAfter)==null?void 0:a.textContent.trim())??"";return{before:n,after:r}}function Fp(t,e){let{doc:i,schema:n}=t,r=i.cut(e,e+1);return zs(r.content,n).replaceAll(/<\/?[^>]+(>|$)/g,"")}function pfe({anchorNode:t,focusNode:e},i){return!!t&&!!e&&Cy(t,i)&&Cy(e,i)}function i2(t){Array.from(t.children).forEach(e=>{if(e.children.length&&i2(e),e.tagName==="FONT")if(e.hasAttribute("size"))switch(e.getAttribute("size")){case"2":{$v("13px",e);break}case"3":{$v("15px",e);break}case"4":{$v("17px",e);break}case"5":{e2("h2",e);break}case"6":{e2("h1",e);break}default:break}else e.hasAttribute("color")&&IV(e)})}function e2(t,e){var i,n,r,o,s,a,u,l,c;if(globalThis.document){let f=document.createElement(t);if(f.innerHTML=e.innerHTML,((i=e.parentElement)==null?void 0:i.tagName)==="P"){let p=(r=(n=e.parentElement)==null?void 0:n.parentElement)==null?void 0:r.insertBefore(f,e.parentElement);(o=e.parentElement)==null||o.removeChild(e),p!=null&&p.nextSibling&&!((a=(s=p==null?void 0:p.nextSibling)==null?void 0:s.textContent)!=null&&a.trim())&&((l=(u=p.nextSibling)==null?void 0:u.parentElement)==null||l.removeChild(p.nextSibling))}else(c=e.parentElement)==null||c.replaceChild(f,e)}}function $v(t,e){var i;if(globalThis.document){let n=document.createElement("p"),r=document.createElement("span");r.setAttribute("style",`font-size: ${t}`),r.innerHTML=e.innerHTML,n.append(r),(i=e.parentElement)==null||i.replaceChild(e.parentElement.tagName==="P"?r:n,e)}}function IV(t){var e;if(globalThis.document){let i=document.createElement("span");i.setAttribute("style",`color: ${t.getAttribute("color")}`),i.innerHTML=t.innerHTML,(e=t.parentElement)==null||e.replaceChild(i,t)}}function hfe(t){let e=new DOMParser().parseFromString(t,"text/html");return i2(e.body),e.body.innerHTML}function Qa(t){return t.reduce((e,i)=>(e[i]={parseHTML:n=>n==null?void 0:n.getAttribute(`${i}`)},e),{})}function r2(t){return t.split(";").reduce((e,i)=>{let[n,r]=i.split(":")??[];return n&&r&&(e[n.trim()]=r.trim()),e},{})}function o2(t){var i;let e=((i=t.endContainer.nodeValue)==null?void 0:i.length)??0;return t.endOffset-t.startOffset>0||t.endOffset-t.startOffset===0&&e===1||t.startOffset!==0&&e>1&&t.endOffset!==e}function mfe({stops:t,side:e}){return`linear-gradient(${e}, ${t.map(({color:i,position:n})=>`rgba(${Dx(i).join(", ")}) ${n}`).join(", ")})`}function SV(t){var e,i;return Array.isArray(t)&&t.length===1&&((e=t[0])==null?void 0:e.type)==="paragraph"&&!((i=t[0])!=null&&i.hasOwnProperty("content"))}var je=(()=>{let e=class e extends nS{constructor(){super(),this.editorRef=h(Ra),this.options=h(xe),this.selectionSnapshot=null,this.editorRef.subscribe(n=>{if(!n)return;this.editor=n;let r=()=>{let o=n.getHTML(),s=n.getJSON().content,a=SV(s)?"":o;this.valueChange$.next(a),this.stateChange$.next()};n.on("transaction",r.bind(this)),n.on("update",r.bind(this))})}get isFocused(){var n;return((n=this.editor)==null?void 0:n.isFocused)??!1}get html(){var n;return((n=this.editor)==null?void 0:n.getHTML())??""}get editable(){var n;return((n=this.editor)==null?void 0:n.isEditable)??!1}set editable(n){var r;(r=this.editor)==null||r.setEditable(n,!1)}get state(){var n;return((n=this.editor)==null?void 0:n.state)??null}getOriginTiptapEditor(){return this.editor??null}undoDisabled(){var n;return!((n=this.editor)!=null&&n.can().undo())}redoDisabled(){var n;return!((n=this.editor)!=null&&n.can().redo())}getFontColor(){var n;return((n=this.editor)==null?void 0:n.getAttributes("textStyle").fontColor)||Fa}getFontSize(){var n;return parseInt((n=this.editor)==null?void 0:n.getAttributes("textStyle").fontSize,10)}setFontSize(n){var r;(r=this.editor)==null||r.chain().setMark("textStyle",{fontSize:ht(n)}).run()}getBackgroundColor(){var n;return((n=this.editor)==null?void 0:n.getAttributes("textStyle").backgroundColor)||"transparent"}getCellColor(){var n,r;return((n=this.editor)==null?void 0:n.getAttributes("tableCell").background)||((r=this.editor)==null?void 0:r.getAttributes("tableHeader").background)||""}getGroupColor(){var n,r;if((n=this.editor)!=null&&n.isActive("group")){let o=((r=this.editor.getAttributes("group"))==null?void 0:r.style)??"",s=r2(o);return s["background-color"]??s.background??""}return""}onAlign(n){var r;(r=this.editor)==null||r.chain().focus().setTextAlign(n).run()}setImage(n){var r;(r=this.editor)==null||r.chain().focus().command(({commands:o,state:s})=>{let a=o.setEditableImage??o.setImage;if(a){let u=s.selection.anchor;return a({src:n}),o.setTextSelection(u),!0}return!1}).run()}undo(){var n;(n=this.editor)==null||n.chain().undo().run()}redo(){var n;(n=this.editor)==null||n.chain().redo().run()}setHorizontalRule(){var n;(n=this.editor)==null||n.chain().focus().setHorizontalRule().run()}removeFormat(){var n,r;(n=this.editor)==null||n.commands.unsetAllMarks(),(r=this.editor)==null||r.commands.clearNodes()}setFontColor(n){var r;(r=this.editor)==null||r.chain().focus().setFontColor(n).run()}setBackgroundColor(n){var r;(r=this.editor)==null||r.chain().focus().setBackgroundColor(n).run()}toggleUnderline(){var n;(n=this.editor)==null||n.chain().focus().toggleUnderline().run()}toggleStrike(){var n;(n=this.editor)==null||n.chain().focus().toggleStrike().run()}toggleOrderedList(){var n;(n=this.editor)==null||n.chain().focus().toggleOrderedList().run()}toggleUnorderedList(){var n;(n=this.editor)==null||n.chain().focus().toggleBulletList().run()}togglePre(){var n;(n=this.editor)==null||n.chain().focus().toggleCodeBlock().run()}toggleTaskList(){var n;(n=this.editor)==null||n.commands.toggleTaskList()}sinkListItem(){var r,o;let n=(r=this.editor)!=null&&r.isActive("taskList")?"taskItem":"listItem";(o=this.editor)==null||o.chain().focus().sinkListItem(n).run()}liftListItem(){var r,o;let n=(r=this.editor)!=null&&r.isActive("taskList")?"taskItem":"listItem";(o=this.editor)==null||o.chain().focus().liftListItem(n).run()}isActive(n){var r;return((r=this.editor)==null?void 0:r.isActive(n))??!1}isActive$(n){return this.stateChange$.pipe(dt(null),S(()=>this.isActive(n)),ke())}toggleBold(){var n;(n=this.editor)==null||n.chain().focus().toggleBold().run()}toggleCode(){var n;(n=this.editor)==null||n.chain().focus().toggleCode().run()}toggleItalic(){var n;(n=this.editor)==null||n.chain().focus().toggleItalic().run()}toggleBlockquote(){var n;(n=this.editor)==null||n.chain().focus().toggleBlockquote().run()}toggleSubscript(){var n;(n=this.editor)==null||n.chain().focus().toggleSubscript().run()}toggleSuperscript(){var n;(n=this.editor)==null||n.chain().focus().toggleSuperscript().run()}toggleCodeBlock(){var n;(n=this.editor)==null||n.chain().focus().toggleCodeBlock().run()}insertTable(n,r){var o;(o=this.editor)==null||o.chain().focus().insertTable({cols:n,rows:r}).run()}addColumnAfter(){var n;(n=this.editor)==null||n.chain().focus().addColumnAfter().run()}addColumnBefore(){var n;(n=this.editor)==null||n.chain().focus().addColumnBefore().run()}addRowAfter(){var n;(n=this.editor)==null||n.chain().focus().addRowAfter().run()}addRowBefore(){var n;(n=this.editor)==null||n.chain().focus().addRowBefore().run()}deleteColumn(){var n;(n=this.editor)==null||n.chain().focus().deleteColumn().run()}deleteRow(){var n;(n=this.editor)==null||n.chain().focus().deleteRow().run()}mergeCells(){var n;(n=this.editor)==null||n.chain().focus().mergeCells().run()}splitCell(){var n;(n=this.editor)==null||n.chain().focus().splitCell().run()}canMergeCells(){var n;return((n=this.editor)==null?void 0:n.can().mergeCells())??!1}canSplitCells(){var n;return((n=this.editor)==null?void 0:n.can().splitCell())??!1}setHeading(n){var r;(r=this.editor)==null||r.chain().focus().setHeading({level:n}).run()}setParagraph(n){var r,o;(r=this.editor)==null||r.chain().focus().setParagraph().run(),n&&((o=this.editor)==null||o.chain().setMark("textStyle",n).run())}setHardBreak(){var n;(n=this.editor)==null||n.chain().setHardBreak().run()}setTextSelection(n){var r;(r=this.editor)==null||r.commands.setTextSelection(n)}toggleLink(n){var r;(r=this.editor)==null||r.chain().focus().toggleLink({href:n}).run()}setLink(n){var r;(r=this.editor)==null||r.chain().focus().setLink({href:n}).run()}unsetLink(){var n;(n=this.editor)==null||n.chain().focus().unsetLink().run()}focus(){var n;(n=this.editor)==null||n.chain().focus().run()}setValue(n){var r,o;n===this.html||n===""&&this.html==="

          "||((r=this.editor)==null||r.commands.setContent(n,!1,this.options.parseOptions),(o=this.editor)==null||o.view.updateState(v1.create({schema:this.editor.state.schema,doc:this.editor.state.doc,selection:this.editor.state.selection,storedMarks:this.editor.state.storedMarks,plugins:this.editor.state.plugins})))}destroy(){var n;(n=this.editor)==null||n.destroy()}setCellColor(n){var r;(r=this.editor)==null||r.chain().focus().setCellBackground(n).run()}selectClosest(){var o,s,a,u;let n=(o=this.editor)==null?void 0:o.state.selection.anchor,r=t2((s=this.editor)==null?void 0:s.state.doc.resolve(n??0),(a=this.editor)==null?void 0:a.schema.marks.link);r&&((u=this.editor)==null||u.chain().setTextSelection(r).run())}enter(){var n;(n=this.editor)==null||n.commands.enter()}setDetails(){var n;(n=this.editor)==null||n.commands.setDetails()}removeDetails(){var n;(n=this.editor)==null||n.commands.removeDetails()}setGroup(){var n;(n=this.editor)==null||n.commands.setGroup()}removeGroup(){var n;(n=this.editor)==null||n.commands.removeGroup()}setGroupHilite(n){var r;(r=this.editor)==null||r.commands.setGroupHilite(n)}setAnchor(n){var r;(r=this.editor)==null||r.commands.setAnchor(n.replace("#",""))}removeAnchor(){var n;(n=this.editor)==null||n.commands.removeAnchor()}setFileLink(n){var r;(r=this.editor)==null||r.commands.setFileLink(n)}setYoutubeVideo(n){var r;(r=this.editor)==null||r.commands.setYoutubeVideo(n)}setIframe(n){var r;(r=this.editor)==null||r.commands.setIframe(n)}removeEmptyTextStyle(){var n;(n=this.editor)==null||n.commands.removeEmptyTextStyle()}toggleMark(n,r,o){var s;(s=this.editor)==null||s.commands.toggleMark(n,r,o)}getHTML(){var n;return((n=this.getOriginTiptapEditor())==null?void 0:n.getHTML())??""}takeSelectionSnapshot(){var n;this.selectionSnapshot=((n=this.editor)==null?void 0:n.state.selection.toJSON())??null}getSelectionSnapshot(){return this.selectionSnapshot}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Ol=(()=>{let e=class e{constructor(){this.el=h(de),this.renderer=h(oi),this.editor=h(je),this.editorContainer=h(Il),this.$=h(Ra).pipe(Se()).subscribe(()=>this.renderer.appendChild(this.el.nativeElement,this.editorContainer)),this.valueChange=this.editor.valueChange$,this.stateChange=this.editor.stateChange$}set value(n){this.editor.setValue(n)}set editable(n){this.editor.editable=n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiTiptapEditor",""]],inputs:{value:"value",editable:"editable"},outputs:{valueChange:"valueChange",stateChange:"stateChange"}});let t=e;return t})();var MV=W("@tui.chevron-down"),AV=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-chevron"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiChevron][tuiIcons]:after,tui-icon[tuiChevron]:after{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:inline-block;cursor:pointer}[tuiChevron][tuiIcons]:after{block-size:1rem}[tuiChevron][tuiIcons]._chevron-rotated:after,tui-icon[tuiChevron]._chevron-rotated:after{transform:rotate(180deg)} -`],encapsulation:2,changeDetection:0});let t=e;return t})(),Bfe=(()=>{let e=class e{constructor(){this.el=Ee(),this.dropdown=h(Ze,{optional:!0}),this.nothing=Dn(AV),this.toggle=Io(()=>{var n;return this.el.classList.toggle("_chevron-rotated",this.chevron()||this.chevron()===""&&!!((n=this.dropdown)!=null&&n.ref()))}),this.chevron=ge("")}set tuiChevron(n){this.chevron.set(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiChevron",""]],hostAttrs:["tuiChevron",""],inputs:{tuiChevron:"tuiChevron"},features:[Z([De(ja,MV)])]});let t=e;return t})();var kV=W();function Qfe(t){return{provide:kV,deps:[[new qn,new Uu,an],[new qn,t]],useFactory:OV}}function OV(t,e){return t?Aa(t).pipe(S(i=>e?e==null?void 0:e.fromControlValue(i):i)):ce(null)}var Xfe=W(),Jfe=W(),epe=W(),tpe=W(),npe=B(Fe("confirm")),ipe=B(Fe("cancel")),rpe=B(Fe("done")),ope=B(Fe("more")),spe=B(Fe("hide")),ape=B(Fe("showAll")),upe=B(Fe("otherDate")),lpe=B(Fe("mobileCalendarTexts")),cpe=B(Fe("range")),dpe=B(Fe("countTexts")),fpe=B(Fe("time")),ppe=B(Fe("dateTexts")),hpe=B(Fe("digitalInformationUnits")),mpe=B(Fe("copyTexts")),gpe=B(Fe("passwordTexts")),ype=B(Fe("shortCalendarMonths")),vpe=B(Fe("fileTexts")),bpe=B(Fe("pagination")),_pe=B(Fe("inputFileTexts")),Cpe=B(Fe("multiSelectTexts")),Dpe=B(Fe("countries")),Epe=B(Fe("previewTexts")),wpe=B(Fe("zoomTexts")),Tpe=B(Fe("phoneSearch")),NV={icon:()=>"@tui.calendar",min:hI,max:mI,nativePicker:!1},xpe=W(NV);var PV={stringify:String,identityMatcher:lx,disabledItemHandler:Di},Ipe=W(PV);var FV=W(),Spe={provide:Sp,useFactory:()=>h(Qi)&&h(FV,{optional:!0})||h(Sp,{skipSelf:!0})},RV={rotate:"@tui.rotate-ccw-square",prev:"@tui.arrow-left",next:"@tui.arrow-right",zoomIn:"@tui.plus",zoomOut:"@tui.minus",zoomReset:"@tui.minimize"},Mpe=W(RV);var Ape=W({});var[s2,Kpe]=Oo({icon:"",appearance:"icon"}),LV=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-tooltip"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiTooltip]{border-width:.125rem;border-radius:100%;cursor:pointer;pointer-events:auto;background-clip:content-box!important}[tuiTooltip] [tuiBlock],[tuiTooltip] [tuiCell][data-size=s],[tuiLabel][data-orientation=horizontal] [tuiTooltip]{border-width:.25rem}[tuiTitle] [tuiTooltip]{font-size:1rem;border:none}[tuiTooltip]:after{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);inline-size:1rem;block-size:1rem}@media (hover: hover) and (pointer: fine){tui-textfield:hover [tuiTooltip][data-appearance=icon]:after,tui-textarea:hover [tuiTooltip][data-appearance=icon]:after,tui-primitive-textfield:hover [tuiTooltip][data-appearance=icon]:after,tui-input-tag:hover [tuiTooltip][data-appearance=icon]:after{color:var(--tui-text-secondary)}} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),$S=(()=>{let e=class e{constructor(){this.el=Ee(),this.nothing=Dn(QB),this.parent=h(vi(()=>Za),{optional:!0})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["label","tuiLabel",""]],contentQueries:function(r,o,s){if(r&1&&_n(s,Za,5),r&2){let a;Qe(a=Xe())&&(o.textfield=a.first)}},hostVars:2,hostBindings:function(r,o){r&2&&Ke("for",o.el.htmlFor||(o.parent==null?null:o.parent.id))("data-orientation",o.textfield?"vertical":"horizontal")}});let t=e;return t})();function XB(t,e){t&1&&Qt(0)}var JB=["*"];function eV(t,e){if(t&1&&Q(0,"span",1),t&2){let i=e.polymorpheusOutlet;v("innerHTML",i,Zd)}}var tV=t=>({$implicit:t});function nV(t,e){t&1&&Qt(0)}function iV(t,e){if(t&1&&(E(0,"div",1),O(1,nV,1,0,"ng-container",2),w()),t&2){let i=e.$implicit;v("@tuiParentAnimation",void 0)("tuiActiveZoneParent",i.activeZone||null),C(),v("polymorpheusOutlet",i.component)("polymorpheusOutletContext",Kn(4,tV,i))}}var rV=B(()=>Bv),qS=(()=>{let e=class e extends on{constructor(){super([])}add(n){this.next(this.value.concat(n))}remove(n){this.value.includes(n)&&this.next(this.value.filter(r=>r!==n))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac,providedIn:"root"});let t=e;return t})(),oV=(()=>{let e=class e extends Cp{constructor(){super(...arguments),this.type="hint"}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,features:[oe]});let t=e;return t})(),GS=["bottom-left","bottom","bottom-right","top-left","top","top-right","left-top","left","left-bottom","right-top","right","right-bottom"],sV={direction:"bottom-left",showDelay:500,hideDelay:200,appearance:"",icon:"@tui.circle-help"},As=W(sV);var Op=(()=>{let e=class e{constructor(){this.options=h(As,{skipSelf:!0}),this.direction=this.options.direction,this.appearance=this.options.appearance,this.showDelay=this.options.showDelay,this.hideDelay=this.options.hideDelay,this.icon=this.options.icon,this.change$=new tt}ngOnChanges(){this.change$.next()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHintContent",""]],inputs:{content:[0,"tuiHintContent","content"],direction:[0,"tuiHintDirection","direction"],appearance:[0,"tuiHintAppearance","appearance"],showDelay:[0,"tuiHintShowDelay","showDelay"],hideDelay:[0,"tuiHintHideDelay","hideDelay"]},features:[Z([De(As,e)]),Yt]});let t=e;return t})(),Ka=(()=>{let e=class e extends Er{constructor(){super(n=>this.stream$.subscribe(n)),this.isMobile=h(Qi),this.el=Ee(),this.hovered$=h(Es),this.options=h(As),this.visible=!1,this.toggle$=new tt,this.stream$=nt(this.toggle$.pipe(bt(n=>this.isMobile?ce(n):ce(n).pipe(Jn(n?0:this.tuiHintHideDelay))),Kt(this.hovered$),es()),this.hovered$.pipe(bt(n=>this.isMobile?ce(n):ce(n).pipe(Jn(n?this.tuiHintShowDelay:this.tuiHintHideDelay))),Kt(this.toggle$),es())).pipe(ot(()=>this.enabled),S(n=>n&&(this.el.hasAttribute("tuiHintPointer")||!kv(this.el))),ei(n=>{this.visible=n})),this.parent=h(e,{optional:!0,skipSelf:!0}),this.tuiHintShowDelay=this.options.showDelay,this.tuiHintHideDelay=this.options.hideDelay,this.type="hint",this.enabled=!0}toggle(n=!this.visible){var r;this.toggle$.next(n),(r=this.parent)==null||r.toggle(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,inputs:{tuiHintShowDelay:"tuiHintShowDelay",tuiHintHideDelay:"tuiHintHideDelay"},exportAs:["tuiHintHover"],features:[Z([Ho(e),Es]),oe]});let t=e;return t})(),Ap=8,kp=24,jt=0,en=1,ZS=(()=>{let e=class e extends Ii{constructor(){super(...arguments),this.offset=h(Qi)?16:8,this.viewport=h($a),this.accessor=Sl("hint")(h(Si),h(Ve)),this.points=GS.reduce((n,r)=>U(M({},n),{[r]:[0,0]}),{}),this.direction=h(As).direction,this.directionChange=new _e,this.type="hint"}emitDirection(n){this.directionChange.emit(n)}getPosition(n,r){let o=(r==null?void 0:r.clientWidth)??n.width,s=(r==null?void 0:r.clientHeight)??n.height,a=this.accessor.getClientRect()??Wi,u=a.left+a.width/2,l=a.top+a.height/2;this.points["top-left"][jt]=a.top-s-this.offset,this.points["top-left"][en]=u-o+kp,this.points.top[jt]=this.points["top-left"][jt],this.points.top[en]=u-o/2,this.points["top-right"][jt]=this.points["top-left"][jt],this.points["top-right"][en]=u-kp,this.points["bottom-left"][jt]=a.bottom+this.offset,this.points["bottom-left"][en]=this.points["top-left"][en],this.points.bottom[jt]=this.points["bottom-left"][jt],this.points.bottom[en]=this.points.top[en],this.points["bottom-right"][jt]=this.points["bottom-left"][jt],this.points["bottom-right"][en]=this.points["top-right"][en],this.points["left-top"][jt]=l-s+kp,this.points["left-top"][en]=a.left-o-this.offset,this.points.left[jt]=l-s/2,this.points.left[en]=this.points["left-top"][en],this.points["left-bottom"][jt]=l-kp,this.points["left-bottom"][en]=this.points["left-top"][en],this.points["right-top"][jt]=this.points["left-top"][jt],this.points["right-top"][en]=a.right+this.offset,this.points.right[jt]=this.points.left[jt],this.points.right[en]=this.points["right-top"][en],this.points["right-bottom"][jt]=this.points["left-bottom"][jt],this.points["right-bottom"][en]=this.points["right-top"][en];let p=(Array.isArray(this.direction)?this.direction:[this.direction]).concat(GS).find(m=>this.checkPosition(this.points[m],o,s));return this.emitDirection(p||this.fallback),this.points[p||this.fallback]}get fallback(){return this.points.top[jt]>this.viewport.getClientRect().bottom-this.points.bottom[jt]?"top":"bottom"}checkPosition([n,r],o,s){let a=this.viewport.getClientRect();return n>Ap&&r>Ap&&n+s{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,inputs:{direction:[0,"tuiHintDirection","direction"]},outputs:{directionChange:"tuiHintDirectionChange"},features:[oe]});let t=e;return Ot([Ft],t.prototype,"emitDirection",null),t})(),Ve=(()=>{let e=class e{constructor(){this.service=h(qS),this.appearance=h(As).appearance,this.content=ge(null),this.component=h(Xi),this.el=Ee(),this.activeZone=h(xi,{optional:!0}),this.type="hint"}set tuiHint(n){this.content.set(n),n||this.toggle(!1)}ngOnDestroy(){this.toggle(!1)}getClientRect(){return this.el.getBoundingClientRect()}toggle(n){n&&this.content()?this.service.add(this):this.service.remove(this)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHint","",5,"ng-container",5,"ng-template"]],inputs:{context:[0,"tuiHintContext","context"],appearance:[0,"tuiHintAppearance","appearance"],tuiHint:"tuiHint"},features:[Z([Ts(e),_p(e),{provide:Xi,deps:[rV,gr],useClass:Xi}]),Mt([oV,{directive:Ka,inputs:["tuiHintHideDelay","tuiHintHideDelay","tuiHintShowDelay","tuiHintShowDelay"]},{directive:ZS,inputs:["tuiHintDirection","tuiHintDirection"],outputs:["tuiHintDirectionChange","tuiHintDirectionChange"]}])]});let t=e;return t})(),aV=(()=>{let e=class e extends Ka{constructor(){super(...arguments),this.currentRect=Wi}getClientRect(){return this.currentRect}onMove({clientX:n,clientY:r}){this.currentRect=Ey(n,r)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiHint","","tuiHintPointer",""]],hostBindings:function(r,o){r&1&&x("mousemove.silent",function(a){return o.onMove(a)})},features:[Z([Ts(e),Ho(e)]),oe]});let t=e;return t})(),uV=(()=>{let e=class e{constructor(){this.context=dv()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostVars:1,hostBindings:function(r,o){r&2&&Ea("@tuiParentAnimation",void 0)},decls:1,vars:1,consts:[[4,"polymorpheusOutlet"]],template:function(r,o){r&1&&O(0,XB,1,0,"ng-container",0),r&2&&v("polymorpheusOutlet",o.context.$implicit.content())},dependencies:[Rn],encapsulation:2,data:{animation:[xv]},changeDetection:0});let t=e;return t})();var WS=8,lV=[qa,Es,vp("hint",ZS),bp("hint",Ve)],Bv=(()=>{let e=class e{constructor(){var n;this.el=Ee(),this.hover=h(Ka),this.vvs=h(Sp),this.viewport=h($a),this.desktop={value:"",params:{end:1,start:1}},this.options=Ga(h(Va),"cubic-bezier(0.35, 1.3, 0.25, 1)"),this.pointer=h(aV,{optional:!0}),this.accessor=h(Si),this.hint=dv().$implicit,this.isMobile=h(Qi),this.content=this.hint.component.component===uV?ge(""):this.hint.content,this.appearance=this.hint.appearance||((n=this.hint.el.closest("[tuiTheme]"))==null?void 0:n.getAttribute("tuiTheme")),h(qa).pipe(go(()=>this.hint.el.isConnected),S(r=>this.vvs.correct(r)),Se()).subscribe({next:([r,o])=>this.update(r,o),complete:()=>this.hover.toggle(!1)}),h(Es).pipe(Se()).subscribe(r=>this.hover.toggle(r))}onClick(n){(!n.closest("tui-hint")&&!this.hint.el.contains(n)||kv(this.hint.el))&&this.hover.toggle(!1)}apply(n,r,o,s){this.el.style.top=n,this.el.style.left=r,this.el.style.setProperty("--top",`${o}%`),this.el.style.setProperty("--left",`${s}%`),this.el.style.setProperty("--rotate",!s||Math.ceil(s)===100?"90deg":"0deg")}update(n,r){let{clientHeight:o,clientWidth:s}=this.el,a=this.accessor.getClientRect(),u=this.viewport.getClientRect();if(a===Wi||!o||!s)return;let l=Jt(r,WS,u.width-s-WS),[c,f]=this.vvs.correct([a.top+a.height/2-n,a.left+a.width/2-l]);this.apply(ht(Math.round(n)),ht(Math.round(l)),Math.round(Jt(c,0,o)/o*100),Math.round(Jt(f,0,s)/s*100))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-hint"]],hostVars:8,hostBindings:function(r,o){r&1&&x("click",function(a){return o.onClick(a.target)},!1,Nn),r&2&&(Ea("@tuiScaleIn",o.isMobile?o.options:o.desktop)("@tuiFadeIn",o.options),Ke("data-appearance",o.appearance)("tuiTheme",o.appearance),Te("_untouchable",o.pointer)("_mobile",o.isMobile))},features:[Z(lV)],ngContentSelectors:JB,decls:2,vars:2,consts:[[3,"innerHTML",4,"polymorpheusOutlet","polymorpheusOutletContext"],[3,"innerHTML"]],template:function(r,o){r&1&&(Xt(),at(0),O(1,eV,1,1,"span",0)),r&2&&(C(),v("polymorpheusOutlet",o.content())("polymorpheusOutletContext",o.hint.context))},dependencies:[Rn],styles:[`[_nghost-%COMP%]{position:absolute;max-inline-size:18rem;padding:.75rem 1rem;background:var(--tui-background-accent-1);border-radius:var(--tui-radius-l);color:var(--tui-text-primary-on-accent-1);box-sizing:border-box;font:var(--tui-font-text-s);white-space:pre-line;overflow-wrap:break-word;transform-origin:var(--left) var(--top)}[_nghost-%COMP%]:before{content:"";position:absolute;top:var(--top);left:var(--left);inline-size:.75rem;block-size:.5rem;background:inherit;-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,');transform:translate(-50%,-50%) rotate(var(--rotate))}._mobile[_nghost-%COMP%]{font:var(--tui-font-text-m)}._mobile[_nghost-%COMP%]:before{inline-size:1.5rem;block-size:1.125rem;-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,')}[data-appearance=error][_nghost-%COMP%]{background:var(--tui-status-negative)}[data-appearance=dark][_nghost-%COMP%]{background:var(--tui-background-accent-opposite-hover);color:var(--tui-background-base);filter:drop-shadow(0 0 .125rem rgba(0,0,0,.16)) drop-shadow(0 1.5rem 1rem rgba(0,0,0,.03)) drop-shadow(0 .75rem .75rem rgba(0,0,0,.04)) drop-shadow(0 .25rem .375rem rgba(0,0,0,.05))}[_nghost-%COMP%]:not([style*=top]){visibility:hidden}._untouchable[_nghost-%COMP%]{pointer-events:none}`],data:{animation:[mp,mS]},changeDetection:0});let t=e;return Ot([Ft],t.prototype,"apply",null),t})(),ze=(()=>{let e=class e extends Er{constructor(){super(n=>this.stream$.subscribe(n)),this.doc=h(qe),this.el=Ee(),this.zone=h(me),this.id$=new on(""),this.stream$=this.id$.pipe(ke(),Af(()=>ct(this.doc,"keydown",{capture:!0}),si),bt(()=>this.focused?ce(!1):nt(rt(this.doc,"keyup"),rt(this.element,"blur")).pipe(S(()=>this.focused))),wm(n=>n?gt(1e3,Fn(this.zone)):ce(null)),dt(!1),ke(),Tu(1),ai()),this.type="hint"}set tuiHintDescribe(n){this.id$.next(n||"")}get element(){return this.doc.getElementById(this.id$.value||"")||this.el}get focused(){return cl(this.element)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiHintDescribe",""]],inputs:{tuiHintDescribe:"tuiHintDescribe"},features:[Z([Ho(e)]),oe]});let t=e;return Ot([Ft],t.prototype,"element",null),t})();var ade=(()=>{let e=class e{constructor(){this.hints$=h(qS),this.destroyRef=h(it),this.cdr=h(st),this.hints=[]}ngOnInit(){this.hints$.pipe(Se(this.destroyRef)).subscribe(n=>{this.hints=n,this.cdr.detectChanges()})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-hints"]],hostAttrs:["aria-live","polite"],decls:1,vars:1,consts:[["role","tooltip",3,"tuiActiveZoneParent",4,"ngFor","ngForOf"],["role","tooltip",3,"tuiActiveZoneParent"],[4,"polymorpheusOutlet","polymorpheusOutletContext"]],template:function(r,o){r&1&&O(0,iV,2,6,"div",0),r&2&&v("ngForOf",o.hints)},dependencies:[Ci,Rn,xi],styles:["[_nghost-%COMP%]{position:fixed;top:0;left:0;inline-size:100%;block-size:100%;block-size:0}"],data:{animation:[xv]}});let t=e;return t})();var cV=typeof ResizeObserver<"u"?ResizeObserver:class{observe(){}unobserve(){}disconnect(){}},dV="content-box",Vv=dV,fV=new k("[WA_RESIZE_OPTION_BOX]",{providedIn:"root",factory:()=>Vv}),QS=fV,YS=(()=>{let e=class e extends te{constructor(){let n=h(de).nativeElement,r=h(QS);super(o=>{let s=new cV(a=>o.next(a));return s.observe(n,{box:r}),()=>{s.disconnect()}})}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275prov",$({token:e,factory:e.\u0275fac}));let t=e;return t})(),XS=(()=>{let e=class e{constructor(){d(this,"waResizeObserver",h(YS));d(this,"box",Vv)}};d(e,"\u0275fac",function(r){return new(r||e)}),d(e,"\u0275dir",T({type:e,selectors:[["","waResizeObserver",""]],inputs:{waResizeBox:[0,"box","waResizeBox"]},outputs:{waResizeObserver:"waResizeObserver"},features:[Z([YS,{provide:QS,useFactory:()=>h(de).nativeElement.getAttribute("waResizeBox")||Vv}])]}));let t=e;return t})();var hde=new k("[WA_RESIZE_OBSERVER_SUPPORT]",{providedIn:"root",factory:()=>!!h(Je).ResizeObserver});var pV=["vcr"],hV=[[["input"]],[["select"]],[["label"]],"*",[["tui-icon"]]],mV=["input","select","label","*","tui-icon"],gV=t=>({$implicit:t});function yV(t,e){if(t&1){let i=q();E(0,"button",6),x("click",function(){P(i);let r=_();return F(r.directive==null?null:r.directive.setValue(null))})("pointerdown.silent.prevent",function(){P(i);let r=_();return F(r.input==null||r.input.nativeElement==null?null:r.input.nativeElement.focus())}),he(1),w()}if(t&2){let i=_();v("iconStart",i.icons.close),C(),Nt(" ",i.clear()," ")}}function vV(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.polymorpheusOutlet;C(),Nt(" ",i," ")}}function bV(t,e){if(t&1&&Q(0,"input",7),t&2){let i=_();v("value",i.computedFiller())}}var zv={appearance:"textfield",size:"l",cleaner:!0},Np=W({appearance:ge(zv.appearance),size:ge(zv.size),cleaner:ge(zv.cleaner)});var _V=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["ng-template","tuiTextfieldDropdown",""]]});let t=e;return t})(),CV=(()=>{let e=class e{constructor(){this.dropdown=RS(null)}set template(n){this.dropdown.set(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,contentQueries:function(r,o,s){if(r&1&&_n(s,_V,5,It),r&2){let a;Qe(a=Xe())&&(o.template=a.first)}}});let t=e;return t})(),jv=(()=>{let e=class e{constructor(){this.filler=ge(""),this.autoId=KI(),this.el=Ee(),this.open=LS(),this.focusedIn=Ix(Ee()),this.icons=h(vS),this.clear=Cn(h(_S)),this.computedFiller=Pt(()=>{var o;let n=((o=this.directive)==null?void 0:o.nativeValue())||"",r=n+this.filler().slice(n.length);return r.length>n.length?r:""}),this.showFiller=Pt(()=>{var n,r;return this.focused()&&!!this.computedFiller()&&(!!((n=this.directive)!=null&&n.nativeValue())||!((r=this.input)!=null&&r.nativeElement.placeholder))}),this.stringify=String,this.focused=Pt(()=>this.open()||this.focusedIn()),this.options=h(Np)}set fillerSetter(n){this.filler.set(n)}get id(){var n;return((n=this.input)==null?void 0:n.nativeElement.id)||this.autoId}get size(){return this.options.size()}handleOption(n){var r;(r=this.directive)==null||r.setValue(n),this.open.set(!1)}get hasLabel(){var n,r;return!!((r=(n=this.label)==null?void 0:n.nativeElement)!=null&&r.childNodes.length)}onResize({contentRect:n}){this.el.style.setProperty("--t-side",ht(n.width))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-textfield"]],contentQueries:function(r,o,s){if(r&1&&(_n(s,JS,5),_n(s,$S,5,de),_n(s,an,5),_n(s,JS,7,de)),r&2){let a;Qe(a=Xe())&&(o.directive=a.first),Qe(a=Xe())&&(o.label=a.first),Qe(a=Xe())&&(o.control=a.first),Qe(a=Xe())&&(o.input=a.first)}},viewQuery:function(r,o){if(r&1&&Gt(pV,7,zt),r&2){let s;Qe(s=Xe())&&(o.vcr=s.first)}},hostVars:7,hostBindings:function(r,o){r&2&&(Ke("data-size",o.options.size()),Te("_with-label",o.hasLabel)("_with-template",o.content)("_disabled",o.input==null?null:o.input.nativeElement.disabled))},inputs:{stringify:"stringify",content:"content",fillerSetter:[0,"filler","fillerSetter"]},features:[Z([TS({size:"xs",appearance:"icon"}),zS(e)]),Mt([HS,Ze,BS,CV,Bo])],ngContentSelectors:mV,decls:12,vars:6,consts:[["vcr",""],[1,"t-content",3,"mousedown.prevent","waResizeObserver"],["appearance","icon","size","xs","tabindex","-1","tuiIconButton","","type","button","class","t-clear",3,"iconStart","click","pointerdown.silent.prevent",4,"ngIf"],[1,"t-template"],[4,"polymorpheusOutlet","polymorpheusOutletContext"],["aria-hidden","true","disabled","","class","t-filler",3,"value",4,"ngIf"],["appearance","icon","size","xs","tabindex","-1","tuiIconButton","","type","button",1,"t-clear",3,"click","pointerdown.silent.prevent","iconStart"],["aria-hidden","true","disabled","",1,"t-filler",3,"value"]],template:function(r,o){if(r&1){let s=q();Xt(hV),at(0),at(1,1),at(2,2),E(3,"span",1),x("mousedown.prevent",function(){return P(s),F(o.input==null||o.input.nativeElement==null?null:o.input.nativeElement.focus())})("waResizeObserver",function(u){return P(s),F(u[0]&&o.onResize(u[0]))}),at(4,3),O(5,yV,2,2,"button",2),Qt(6,null,0),at(8,4),w(),E(9,"span",3),O(10,vV,2,1,"ng-container",4),w(),O(11,bV,1,1,"input",5)}r&2&&(C(5),v("ngIf",o.options.cleaner()),C(5),v("polymorpheusOutlet",o.content)("polymorpheusOutletContext",Kn(4,gV,o.control==null?null:o.control.value)),C(),v("ngIf",o.showFiller()))},dependencies:[ut,Rn,Le,XS],styles:[`tui-textfield{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;--t-height: var(--tui-height-l);--t-padding: var(--tui-padding-l);position:relative;display:flex;align-items:center;pointer-events:none;cursor:pointer;block-size:var(--t-height);color:var(--tui-text-tertiary);padding:0 var(--t-padding);border-radius:var(--tui-radius-l);font:var(--tui-font-text-m);box-sizing:border-box}tui-textfield[style*="--t-icon-start:"]{--t-left: 2.25rem}tui-textfield[style*="--t-icon-end:"]{--t-right: 2.25rem}tui-textfield:after{margin-inline-start:.25rem}tui-textfield input,tui-textfield select{font:var(--tui-font-text-m)}tui-textfield[data-size=s]{--t-height: var(--tui-height-s);--t-padding: var(--tui-padding-s);border-radius:var(--tui-radius-m);font:var(--tui-font-text-s)}tui-textfield[data-size=s][style*="--t-icon-start:"]{--t-left: 1.25rem}tui-textfield[data-size=s][style*="--t-icon-end:"]{--t-right: 1.25rem}tui-textfield[data-size=s]:before{margin:0 .5rem 0 -.125rem;font-size:1rem}tui-textfield[data-size=s]:after{margin:0 -.175rem 0 .575rem;font-size:1rem}tui-textfield[data-size=s] input,tui-textfield[data-size=s] select{font:var(--tui-font-text-s)}tui-textfield[data-size=s] .t-content{gap:0;margin-inline-end:-.325rem}tui-textfield[data-size=m]{--t-height: var(--tui-height-m);--t-padding: var(--tui-padding-m);border-radius:var(--tui-radius-m);font:var(--tui-font-text-s)}tui-textfield[data-size=m][style*="--t-icon-start:"]{--t-left: 1.75rem}tui-textfield[data-size=m][style*="--t-icon-end:"]{--t-right: 1.75rem}tui-textfield[data-size=m]:before{margin:0 .375rem 0 -.125rem}tui-textfield[data-size=m]:after{margin:0 -.125rem 0 .5rem}tui-textfield[data-size=m] input,tui-textfield[data-size=m] select{font:var(--tui-font-text-s)}tui-textfield[data-size=m] .t-content{margin-inline-end:-.125rem}tui-textfield:hover{color:var(--tui-text-secondary)}tui-textfield:hover:has(input:read-only),tui-textfield:hover:has(select[data-mode~=readonly]){color:var(--tui-text-tertiary)}tui-textfield:before{z-index:1;margin-inline-end:.75rem}tui-textfield:has(:disabled:not(.t-filler,button,option)):before,tui-textfield:has(:disabled:not(.t-filler,button,option)):after,tui-textfield:has(:disabled:not(.t-filler,button,option)) .t-template{opacity:var(--tui-disabled-opacity)}tui-textfield._disabled:before,tui-textfield._disabled:after,tui-textfield._disabled .t-template{opacity:var(--tui-disabled-opacity)}tui-textfield:has(label:not(:empty)) .t-template,tui-textfield:has(label:not(:empty)) input:defined,tui-textfield:has(label:not(:empty)) select:defined{padding-top:calc(var(--t-height) / 3)}tui-textfield:has(label:not(:empty)) .t-template::placeholder,tui-textfield:has(label:not(:empty)) input:defined::placeholder,tui-textfield:has(label:not(:empty)) select:defined::placeholder,tui-textfield:has(label:not(:empty)) .t-template._empty,tui-textfield:has(label:not(:empty)) input:defined._empty,tui-textfield:has(label:not(:empty)) select:defined._empty{color:transparent}tui-textfield._with-label .t-template,tui-textfield._with-label input:defined,tui-textfield._with-label select:defined{padding-top:calc(var(--t-height) / 3)}tui-textfield._with-label .t-template::placeholder,tui-textfield._with-label input:defined::placeholder,tui-textfield._with-label select:defined::placeholder,tui-textfield._with-label .t-template._empty,tui-textfield._with-label input:defined._empty,tui-textfield._with-label select:defined._empty{color:transparent}tui-textfield .t-template,tui-textfield input:defined,tui-textfield select:defined{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;-webkit-appearance:none;appearance:none;box-sizing:border-box;border-radius:inherit;padding:inherit;border:none;text-indent:var(--t-left, 0);padding-inline-end:calc(var(--t-right, var(--t-0, 0rem)) + var(--t-side) + var(--t-padding))}tui-textfield .t-template{display:flex;align-items:center}tui-textfield._with-template select{color:transparent!important}tui-textfield input:defined,tui-textfield select:defined{pointer-events:auto;background:transparent}tui-textfield input:defined:read-only~.t-filler,tui-textfield select:defined:read-only~.t-filler{display:none}tui-textfield input:defined:disabled~label,tui-textfield select:defined:disabled~label,tui-textfield input:defined:disabled~.t-content,tui-textfield select:defined:disabled~.t-content{opacity:var(--tui-disabled-opacity)}tui-textfield input:defined:disabled~label>tui-icon,tui-textfield select:defined:disabled~label>tui-icon,tui-textfield input:defined:disabled~.t-content>tui-icon,tui-textfield select:defined:disabled~.t-content>tui-icon{display:none}tui-textfield input:defined:-webkit-autofill~label,tui-textfield select:defined:-webkit-autofill~label,tui-textfield input:defined:not(._empty):not(:placeholder-shown)~label,tui-textfield select:defined:not(._empty):not(:placeholder-shown)~label{font-size:.83em;transform:translateY(-.7em)}tui-textfield input:defined:-webkit-autofill:not(:disabled)[data-mode~=invalid]~label,tui-textfield select:defined:-webkit-autofill:not(:disabled)[data-mode~=invalid]~label,tui-textfield input:defined:not(._empty):not(:placeholder-shown):not(:disabled)[data-mode~=invalid]~label,tui-textfield select:defined:not(._empty):not(:placeholder-shown):not(:disabled)[data-mode~=invalid]~label,tui-textfield input:defined:-webkit-autofill:invalid:not(:disabled):not([data-mode])~label,tui-textfield select:defined:-webkit-autofill:invalid:not(:disabled):not([data-mode])~label,tui-textfield input:defined:not(._empty):not(:placeholder-shown):invalid:not(:disabled):not([data-mode])~label,tui-textfield select:defined:not(._empty):not(:placeholder-shown):invalid:not(:disabled):not([data-mode])~label{color:var(--tui-text-negative)}tui-textfield input:defined:-webkit-autofill:not(:disabled):not([data-mode~=readonly])~.t-content .t-clear,tui-textfield select:defined:-webkit-autofill:not(:disabled):not([data-mode~=readonly])~.t-content .t-clear,tui-textfield input:defined:not(._empty):not(:placeholder-shown):not(:disabled):not([data-mode~=readonly])~.t-content .t-clear,tui-textfield select:defined:not(._empty):not(:placeholder-shown):not(:disabled):not([data-mode~=readonly])~.t-content .t-clear{display:flex}tui-textfield input:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])::placeholder,tui-textfield select:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])::placeholder,tui-textfield input:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])._empty,tui-textfield select:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])._empty{color:var(--tui-text-tertiary)}tui-textfield input:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])~label,tui-textfield select:defined:not([data-mode~=readonly]):focus-visible:not([data-focus=false])~label{color:var(--tui-text-primary)!important;font-size:.83em;transform:translateY(-.7em)}tui-textfield input:defined:not([data-mode~=readonly])[data-focus=true]::placeholder,tui-textfield select:defined:not([data-mode~=readonly])[data-focus=true]::placeholder,tui-textfield input:defined:not([data-mode~=readonly])[data-focus=true]._empty,tui-textfield select:defined:not([data-mode~=readonly])[data-focus=true]._empty{color:var(--tui-text-tertiary)}tui-textfield input:defined:not([data-mode~=readonly])[data-focus=true]~label,tui-textfield select:defined:not([data-mode~=readonly])[data-focus=true]~label{color:var(--tui-text-primary)!important;font-size:.83em;transform:translateY(-.7em)}tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)::placeholder,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)::placeholder,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]._focused::placeholder,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]._focused::placeholder,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)._empty,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)._empty,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]._focused._empty,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]._focused._empty{color:var(--tui-text-tertiary)}tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)~label,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]:not(._focused):has(:focus-visible)~label,tui-textfield input:defined:not([data-mode~=readonly])[tuiWrapper]._focused~label,tui-textfield select:defined:not([data-mode~=readonly])[tuiWrapper]._focused~label{color:var(--tui-text-primary)!important;font-size:.83em;transform:translateY(-.7em)}@supports (-webkit-touch-callout: none){tui-textfield input:defined._ios-fix,tui-textfield select:defined._ios-fix{position:fixed;left:1000rem}}tui-textfield label:not([data-orientation=vertical]){transition-property:all;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;position:relative;display:block;flex:1;font-size:inherit}tui-textfield label:defined,tui-textfield input:defined::placeholder,tui-textfield select:defined._empty{color:var(--tui-text-secondary)}tui-textfield select:not([data-mode~=readonly]){cursor:pointer}tui-textfield button,tui-textfield a{pointer-events:auto}tui-textfield .t-content{display:flex;align-items:center;gap:.25rem;margin-inline-start:auto;isolation:isolate}tui-textfield .t-content>tui-icon{pointer-events:auto}tui-textfield .t-clear{display:none;pointer-events:auto}tui-textfield .t-filler:defined{pointer-events:none;background:none;color:var(--tui-text-tertiary);opacity:1}tui-textfield [tuiFluidTypography]{font-weight:700} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),DV=(()=>{let e=class e{constructor(){this.focused=ge(null),this.control=h(an,{optional:!0}),this.a=yS(h(Np).appearance),this.s=Ha(null),this.m=wp(this.mode),this.f=Ep(Pt(()=>this.focused()||this.textfield.focused())),this.el=Ee(),this.textfield=h(jv),this.readOnly=!1,this.invalid=null,this.nativeValue=Cn(nt(ct(this.el,"input"),gt(0).pipe(bt(()=>Aa(this.control)))).pipe(S(()=>this.el.value)),{initialValue:this.el.value})}set focusedSetter(n){this.focused.set(n)}set stateSetter(n){this.s.set(n)}get mode(){return this.readOnly?"readonly":this.invalid===!1?"valid":this.invalid?"invalid":null}ngOnChanges(){this.m.set(this.mode)}setValue(n){this.el.focus(),this.el.select(),n==null?this.el.ownerDocument.execCommand("delete"):this.el.ownerDocument.execCommand("insertText",!1,this.textfield.stringify(n))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,inputs:{readOnly:"readOnly",invalid:"invalid",focusedSetter:[0,"focused","focusedSetter"],stateSetter:[0,"state","stateSetter"]},standalone:!1,features:[Yt]});let t=e;return t})(),JS=(()=>{let e=class e extends DV{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["input","tuiTextfield",""]],hostVars:4,hostBindings:function(r,o){r&1&&x("input",function(){return 0})("focusin",function(){return 0})("focusout",function(){return 0}),r&2&&(ms("id",o.textfield.id)("readOnly",o.readOnly),Te("_empty",o.el.value===""))},features:[Mt([wI,Ji]),oe]});let t=e;return t})();var EV={size:"l",collapsed:!1,rounded:!0,orientation:"horizontal"},wV=W(EV);var TV=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-group"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiGroup]{position:relative;display:flex;isolation:isolate;--t-group-radius: var(--tui-radius-l);--t-group-margin: -1px;--t-group-clip: inset(-1rem 1px -1rem -1rem)}[tuiGroup]>*{z-index:1;flex:1 1 0;min-inline-size:0}[tuiGroup]>*:disabled,[tuiGroup]>*._disabled{z-index:0}[tuiGroup]>*:invalid:not([data-mode]),[tuiGroup]>*[data-mode~=invalid]{z-index:2;--t-group-clip: none}[tuiGroup]>*:has(:invalid:not([data-mode])),[tuiGroup]>*:has([data-mode~=invalid]){z-index:2;--t-group-clip: none}[tuiGroup]>*:focus-within{z-index:3;--t-group-clip: none}[tuiGroup]>*:has([data-focus=true]){z-index:3;--t-group-clip: none}[tuiGroup]>*:checked:not([data-mode]),[tuiGroup]>*[data-mode~=checked]{z-index:4;--t-group-clip: none}[tuiGroup]>*:has([tuiBlock]:checked){z-index:4;--t-group-clip: none}[tuiGroup]>*:not(:last-child){margin-inline-end:var(--t-group-margin);clip-path:var(--t-group-clip)}[tuiGroup]>*:nth-child(n){border-radius:0}[tuiGroup]>*:first-child{border-top-left-radius:var(--t-group-radius);border-bottom-left-radius:var(--t-group-radius)}[tuiGroup]>*:last-child{border-top-right-radius:var(--t-group-radius);border-bottom-right-radius:var(--t-group-radius)}[tuiGroup][data-size=s],[tuiGroup][data-size=m]{--t-group-radius: var(--tui-radius-m)}[tuiGroup][data-orientation=vertical]{display:inline-flex;flex-direction:column;--t-group-clip: inset(-1rem -1rem 1px -1rem)}[tuiGroup][data-orientation=vertical]>*{min-block-size:auto;flex:0 0 auto}[tuiGroup][data-orientation=vertical]>*:not(:last-child){margin-inline-end:0;margin-block-end:var(--t-group-margin)}[tuiGroup][data-orientation=vertical]>*:first-child{border-radius:var(--t-group-radius) var(--t-group-radius) 0 0}[tuiGroup][data-orientation=vertical]>*:last-child{border-radius:0 0 var(--t-group-radius) var(--t-group-radius)}[tuiGroup][data-orientation=vertical]>*:only-child{border-radius:var(--t-group-radius)}.tui-group{position:relative;display:flex;isolation:isolate;--t-group-radius: var(--tui-radius-m)}.tui-group>*{flex:1 1 0;min-inline-size:0}.tui-group>*:not(:last-child){margin-right:.125rem}.tui-group.tui-group>*:nth-child(n){border-radius:0}.tui-group_radius_large{--t-group-radius: var(--tui-radius-l)}.tui-group_collapsed>*{z-index:1}.tui-group_collapsed>*:not(:last-child){margin:0 -1px 0 0}.tui-group_collapsed>*._readonly,.tui-group_collapsed>*._disabled,.tui-group_collapsed>*._readonly:hover,.tui-group_collapsed>*._disabled:hover{z-index:0}.tui-group_collapsed>*._invalid{z-index:2}.tui-group_collapsed>*._invalid:hover,.tui-group_collapsed>*._invalid._hovered,.tui-group_collapsed>*._invalid._pressed{z-index:4}.tui-group_collapsed>*:hover,.tui-group_collapsed>*._hovered,.tui-group_collapsed>*._pressed{z-index:3}.tui-group_collapsed>*._hosted_dropdown_focused,.tui-group_collapsed>*._focus-visible,.tui-group_collapsed>*._focused.ng-touched,.tui-group_collapsed>*._focused.ng-untouched{z-index:5}.tui-group_collapsed>*._active,.tui-group_collapsed>*[data-appearance=whiteblock-active]{z-index:6}.tui-group_collapsed>*:has([tuiBlock]:checked){z-index:6}.tui-group_collapsed>*._focus-visible._focused,.tui-group_collapsed>*._focus-visible._active,.tui-group_collapsed>*._focus-visible[data-appearance=whiteblock-active]{z-index:7}.tui-group_orientation_vertical{display:inline-flex;flex-direction:column}.tui-group_orientation_vertical>*{min-block-size:auto;flex:0 0 auto}.tui-group_orientation_vertical>*:not(:last-child){margin-right:0;margin-bottom:.125rem}.tui-group_orientation_vertical.tui-group_collapsed>*:not(:last-child){margin:0 0 -1px}.tui-group_rounded.tui-group_orientation_horizontal>*:first-child{border-top-left-radius:var(--t-group-radius);border-bottom-left-radius:var(--t-group-radius)}.tui-group_rounded.tui-group_orientation_horizontal>*:last-child{border-top-right-radius:var(--t-group-radius);border-bottom-right-radius:var(--t-group-radius)}.tui-group_rounded.tui-group_orientation_vertical>*:first-child{border-top-left-radius:var(--t-group-radius);border-top-right-radius:var(--t-group-radius)}.tui-group_rounded.tui-group_orientation_vertical>*:last-child{border-bottom-left-radius:var(--t-group-radius);border-bottom-right-radius:var(--t-group-radius)}.tui-group__auto-width-item{min-inline-size:auto;flex:0 0 auto}.tui-group__inherit-item{border-radius:inherit!important} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),ife=(()=>{let e=class e{constructor(){this.options=h(wV),this.nothing=Dn(TV),this.orientation=this.options.orientation,this.collapsed=this.options.collapsed,this.rounded=this.options.rounded,this.size=this.options.size}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiGroup","",5,"ng-container"]],hostAttrs:["tuiGroup","","role","group"],hostVars:8,hostBindings:function(r,o){r&2&&(Ke("data-orientation",o.orientation)("data-size",o.size),Ye("--t-group-radius",o.rounded?null:0)("--t-group-margin",o.collapsed?null:.125,"rem")("--t-group-clip",o.collapsed?null:0))},inputs:{orientation:"orientation",collapsed:"collapsed",rounded:"rounded",size:"size"}});let t=e;return t})();var ufe=(()=>{let e=class e{constructor(){this.imagePreview=new _e}click(n){n instanceof HTMLImageElement&&this.imagePreview.emit(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["tui-editor-socket","imagePreview",""]],hostAttrs:[1,"_preview-image"],hostBindings:function(r,o){r&1&&x("click",function(a){return o.click(a.target)})},outputs:{imagePreview:"imagePreview"}});let t=e;return t})();function Pp(t,e,i){let n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.name===i)return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Ya(t){let{state:e}=t,{selection:i}=e,{$anchor:n,empty:r}=i;if(!r)return{from:i.from,to:i.to};if(n){let{pos:o}=n,s=n.start(),a=n.parent,u=a.textBetween(0,o-s,void 0,"\uFFFC"),l=a.textBetween(o-s,a.content.size,void 0,"\uFFFC"),c=u.replaceAll(/\uFFFC/g,"").split(/\b/).pop(),f=l.replaceAll(/\uFFFC/g,"").split(/\b/).shift(),p=o-((c==null?void 0:c.length)??0),m=o+((f==null?void 0:f.length)??0);return{from:p,to:m}}return{from:i.to,to:i.to+1}}function xV(t,e){let i=Object.keys(e);return!i.length||!!i.filter(n=>e[n]===t[n]).length}function Uv(t,e,i={}){return t.find(({attrs:n,type:r})=>r===e&&xV(n,i))||null}function t2(t,e,i={}){if(!t||!e)return null;let{node:n,offset:r}=t.parent.childAfter(t.parentOffset);if(!n)return null;let o=Uv(n.marks,e,i);if(!o)return null;let s=t.index(),a=t.start()+r,u=s+1,l=a+n.nodeSize;for(Uv(n.marks,e,i);s>0&&o.isInSet(t.parent.child(s-1).marks);)s-=1,a-=t.parent.child(s).nodeSize;for(;u{i instanceof d1&&e.push([i.type.name,i.attrs])}),e}function Fp(t,e){let i=e??t.selection.$head.parent.textContent,n=t.doc.cut(t.selection.from,t.selection.to);return n.content.size?zs(n.content,t.schema):i}function n2(t){var o,s,a;if(!((o=t==null?void 0:t.state)!=null&&o.selection))return{before:"",after:""};let{$from:e,$to:i}=t.state.selection,n=(s=e.nodeBefore)==null?void 0:s.textContent;n=((n==null?void 0:n.slice((((n==null?void 0:n.lastIndexOf(" "))||(n==null?void 0:n.lastIndexOf(` +`)))??0)+1))??"").trim();let r=((a=i.nodeAfter)==null?void 0:a.textContent.trim())??"";return{before:n,after:r}}function Rp(t,e){let{doc:i,schema:n}=t,r=i.cut(e,e+1);return zs(r.content,n).replaceAll(/<\/?[^>]+(>|$)/g,"")}function pfe({anchorNode:t,focusNode:e},i){return!!t&&!!e&&Dy(t,i)&&Dy(e,i)}function i2(t){Array.from(t.children).forEach(e=>{if(e.children.length&&i2(e),e.tagName==="FONT")if(e.hasAttribute("size"))switch(e.getAttribute("size")){case"2":{$v("13px",e);break}case"3":{$v("15px",e);break}case"4":{$v("17px",e);break}case"5":{e2("h2",e);break}case"6":{e2("h1",e);break}default:break}else e.hasAttribute("color")&&IV(e)})}function e2(t,e){var i,n,r,o,s,a,u,l,c;if(globalThis.document){let f=document.createElement(t);if(f.innerHTML=e.innerHTML,((i=e.parentElement)==null?void 0:i.tagName)==="P"){let p=(r=(n=e.parentElement)==null?void 0:n.parentElement)==null?void 0:r.insertBefore(f,e.parentElement);(o=e.parentElement)==null||o.removeChild(e),p!=null&&p.nextSibling&&!((a=(s=p==null?void 0:p.nextSibling)==null?void 0:s.textContent)!=null&&a.trim())&&((l=(u=p.nextSibling)==null?void 0:u.parentElement)==null||l.removeChild(p.nextSibling))}else(c=e.parentElement)==null||c.replaceChild(f,e)}}function $v(t,e){var i;if(globalThis.document){let n=document.createElement("p"),r=document.createElement("span");r.setAttribute("style",`font-size: ${t}`),r.innerHTML=e.innerHTML,n.append(r),(i=e.parentElement)==null||i.replaceChild(e.parentElement.tagName==="P"?r:n,e)}}function IV(t){var e;if(globalThis.document){let i=document.createElement("span");i.setAttribute("style",`color: ${t.getAttribute("color")}`),i.innerHTML=t.innerHTML,(e=t.parentElement)==null||e.replaceChild(i,t)}}function hfe(t){let e=new DOMParser().parseFromString(t,"text/html");return i2(e.body),e.body.innerHTML}function Qa(t){return t.reduce((e,i)=>(e[i]={parseHTML:n=>n==null?void 0:n.getAttribute(`${i}`)},e),{})}function r2(t){return t.split(";").reduce((e,i)=>{let[n,r]=i.split(":")??[];return n&&r&&(e[n.trim()]=r.trim()),e},{})}function o2(t){var i;let e=((i=t.endContainer.nodeValue)==null?void 0:i.length)??0;return t.endOffset-t.startOffset>0||t.endOffset-t.startOffset===0&&e===1||t.startOffset!==0&&e>1&&t.endOffset!==e}function mfe({stops:t,side:e}){return`linear-gradient(${e}, ${t.map(({color:i,position:n})=>`rgba(${Dx(i).join(", ")}) ${n}`).join(", ")})`}function SV(t){var e,i;return Array.isArray(t)&&t.length===1&&((e=t[0])==null?void 0:e.type)==="paragraph"&&!((i=t[0])!=null&&i.hasOwnProperty("content"))}var je=(()=>{let e=class e extends nS{constructor(){super(),this.editorRef=h(Ra),this.options=h(xe),this.selectionSnapshot=null,this.editorRef.subscribe(n=>{if(!n)return;this.editor=n;let r=()=>{let o=n.getHTML(),s=n.getJSON().content,a=SV(s)?"":o;this.valueChange$.next(a),this.stateChange$.next()};n.on("transaction",r.bind(this)),n.on("update",r.bind(this))})}get isFocused(){var n;return((n=this.editor)==null?void 0:n.isFocused)??!1}get html(){var n;return((n=this.editor)==null?void 0:n.getHTML())??""}get editable(){var n;return((n=this.editor)==null?void 0:n.isEditable)??!1}set editable(n){var r;(r=this.editor)==null||r.setEditable(n,!1)}get state(){var n;return((n=this.editor)==null?void 0:n.state)??null}getOriginTiptapEditor(){return this.editor??null}undoDisabled(){var n;return!((n=this.editor)!=null&&n.can().undo())}redoDisabled(){var n;return!((n=this.editor)!=null&&n.can().redo())}getFontColor(){var n;return((n=this.editor)==null?void 0:n.getAttributes("textStyle").fontColor)||Fa}getFontSize(){var n;return parseInt((n=this.editor)==null?void 0:n.getAttributes("textStyle").fontSize,10)}setFontSize(n){var r;(r=this.editor)==null||r.chain().setMark("textStyle",{fontSize:ht(n)}).run()}getBackgroundColor(){var n;return((n=this.editor)==null?void 0:n.getAttributes("textStyle").backgroundColor)||"transparent"}getCellColor(){var n,r;return((n=this.editor)==null?void 0:n.getAttributes("tableCell").background)||((r=this.editor)==null?void 0:r.getAttributes("tableHeader").background)||""}getGroupColor(){var n,r;if((n=this.editor)!=null&&n.isActive("group")){let o=((r=this.editor.getAttributes("group"))==null?void 0:r.style)??"",s=r2(o);return s["background-color"]??s.background??""}return""}onAlign(n){var r;(r=this.editor)==null||r.chain().focus().setTextAlign(n).run()}setImage(n){var r;(r=this.editor)==null||r.chain().focus().command(({commands:o,state:s})=>{let a=o.setEditableImage??o.setImage;if(a){let u=s.selection.anchor;return a({src:n}),o.setTextSelection(u),!0}return!1}).run()}undo(){var n;(n=this.editor)==null||n.chain().undo().run()}redo(){var n;(n=this.editor)==null||n.chain().redo().run()}setHorizontalRule(){var n;(n=this.editor)==null||n.chain().focus().setHorizontalRule().run()}removeFormat(){var n,r;(n=this.editor)==null||n.commands.unsetAllMarks(),(r=this.editor)==null||r.commands.clearNodes()}setFontColor(n){var r;(r=this.editor)==null||r.chain().focus().setFontColor(n).run()}setBackgroundColor(n){var r;(r=this.editor)==null||r.chain().focus().setBackgroundColor(n).run()}toggleUnderline(){var n;(n=this.editor)==null||n.chain().focus().toggleUnderline().run()}toggleStrike(){var n;(n=this.editor)==null||n.chain().focus().toggleStrike().run()}toggleOrderedList(){var n;(n=this.editor)==null||n.chain().focus().toggleOrderedList().run()}toggleUnorderedList(){var n;(n=this.editor)==null||n.chain().focus().toggleBulletList().run()}togglePre(){var n;(n=this.editor)==null||n.chain().focus().toggleCodeBlock().run()}toggleTaskList(){var n;(n=this.editor)==null||n.commands.toggleTaskList()}sinkListItem(){var r,o;let n=(r=this.editor)!=null&&r.isActive("taskList")?"taskItem":"listItem";(o=this.editor)==null||o.chain().focus().sinkListItem(n).run()}liftListItem(){var r,o;let n=(r=this.editor)!=null&&r.isActive("taskList")?"taskItem":"listItem";(o=this.editor)==null||o.chain().focus().liftListItem(n).run()}isActive(n){var r;return((r=this.editor)==null?void 0:r.isActive(n))??!1}isActive$(n){return this.stateChange$.pipe(dt(null),S(()=>this.isActive(n)),ke())}toggleBold(){var n;(n=this.editor)==null||n.chain().focus().toggleBold().run()}toggleCode(){var n;(n=this.editor)==null||n.chain().focus().toggleCode().run()}toggleItalic(){var n;(n=this.editor)==null||n.chain().focus().toggleItalic().run()}toggleBlockquote(){var n;(n=this.editor)==null||n.chain().focus().toggleBlockquote().run()}toggleSubscript(){var n;(n=this.editor)==null||n.chain().focus().toggleSubscript().run()}toggleSuperscript(){var n;(n=this.editor)==null||n.chain().focus().toggleSuperscript().run()}toggleCodeBlock(){var n;(n=this.editor)==null||n.chain().focus().toggleCodeBlock().run()}insertTable(n,r){var o;(o=this.editor)==null||o.chain().focus().insertTable({cols:n,rows:r}).run()}addColumnAfter(){var n;(n=this.editor)==null||n.chain().focus().addColumnAfter().run()}addColumnBefore(){var n;(n=this.editor)==null||n.chain().focus().addColumnBefore().run()}addRowAfter(){var n;(n=this.editor)==null||n.chain().focus().addRowAfter().run()}addRowBefore(){var n;(n=this.editor)==null||n.chain().focus().addRowBefore().run()}deleteColumn(){var n;(n=this.editor)==null||n.chain().focus().deleteColumn().run()}deleteRow(){var n;(n=this.editor)==null||n.chain().focus().deleteRow().run()}mergeCells(){var n;(n=this.editor)==null||n.chain().focus().mergeCells().run()}splitCell(){var n;(n=this.editor)==null||n.chain().focus().splitCell().run()}canMergeCells(){var n;return((n=this.editor)==null?void 0:n.can().mergeCells())??!1}canSplitCells(){var n;return((n=this.editor)==null?void 0:n.can().splitCell())??!1}setHeading(n){var r;(r=this.editor)==null||r.chain().focus().setHeading({level:n}).run()}setParagraph(n){var r,o;(r=this.editor)==null||r.chain().focus().setParagraph().run(),n&&((o=this.editor)==null||o.chain().setMark("textStyle",n).run())}setHardBreak(){var n;(n=this.editor)==null||n.chain().setHardBreak().run()}setTextSelection(n){var r;(r=this.editor)==null||r.commands.setTextSelection(n)}toggleLink(n){var r;(r=this.editor)==null||r.chain().focus().toggleLink({href:n}).run()}setLink(n){var r;(r=this.editor)==null||r.chain().focus().setLink({href:n}).run()}unsetLink(){var n;(n=this.editor)==null||n.chain().focus().unsetLink().run()}focus(){var n;(n=this.editor)==null||n.chain().focus().run()}setValue(n){var r,o;n===this.html||n===""&&this.html==="

          "||((r=this.editor)==null||r.commands.setContent(n,!1,this.options.parseOptions),(o=this.editor)==null||o.view.updateState(v1.create({schema:this.editor.state.schema,doc:this.editor.state.doc,selection:this.editor.state.selection,storedMarks:this.editor.state.storedMarks,plugins:this.editor.state.plugins})))}destroy(){var n;(n=this.editor)==null||n.destroy()}setCellColor(n){var r;(r=this.editor)==null||r.chain().focus().setCellBackground(n).run()}selectClosest(){var o,s,a,u;let n=(o=this.editor)==null?void 0:o.state.selection.anchor,r=t2((s=this.editor)==null?void 0:s.state.doc.resolve(n??0),(a=this.editor)==null?void 0:a.schema.marks.link);r&&((u=this.editor)==null||u.chain().setTextSelection(r).run())}enter(){var n;(n=this.editor)==null||n.commands.enter()}setDetails(){var n;(n=this.editor)==null||n.commands.setDetails()}removeDetails(){var n;(n=this.editor)==null||n.commands.removeDetails()}setGroup(){var n;(n=this.editor)==null||n.commands.setGroup()}removeGroup(){var n;(n=this.editor)==null||n.commands.removeGroup()}setGroupHilite(n){var r;(r=this.editor)==null||r.commands.setGroupHilite(n)}setAnchor(n){var r;(r=this.editor)==null||r.commands.setAnchor(n.replace("#",""))}removeAnchor(){var n;(n=this.editor)==null||n.commands.removeAnchor()}setFileLink(n){var r;(r=this.editor)==null||r.commands.setFileLink(n)}setYoutubeVideo(n){var r;(r=this.editor)==null||r.commands.setYoutubeVideo(n)}setIframe(n){var r;(r=this.editor)==null||r.commands.setIframe(n)}removeEmptyTextStyle(){var n;(n=this.editor)==null||n.commands.removeEmptyTextStyle()}toggleMark(n,r,o){var s;(s=this.editor)==null||s.commands.toggleMark(n,r,o)}getHTML(){var n;return((n=this.getOriginTiptapEditor())==null?void 0:n.getHTML())??""}takeSelectionSnapshot(){var n;this.selectionSnapshot=((n=this.editor)==null?void 0:n.state.selection.toJSON())??null}getSelectionSnapshot(){return this.selectionSnapshot}};e.\u0275fac=function(r){return new(r||e)},e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Ol=(()=>{let e=class e{constructor(){this.el=h(de),this.renderer=h(oi),this.editor=h(je),this.editorContainer=h(Il),this.$=h(Ra).pipe(Se()).subscribe(()=>this.renderer.appendChild(this.el.nativeElement,this.editorContainer)),this.valueChange=this.editor.valueChange$,this.stateChange=this.editor.stateChange$}set value(n){this.editor.setValue(n)}set editable(n){this.editor.editable=n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiTiptapEditor",""]],inputs:{value:"value",editable:"editable"},outputs:{valueChange:"valueChange",stateChange:"stateChange"}});let t=e;return t})();var MV=W("@tui.chevron-down"),AV=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-chevron"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiChevron][tuiIcons]:after,tui-icon[tuiChevron]:after{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;display:inline-block;cursor:pointer}[tuiChevron][tuiIcons]:after{block-size:1rem}[tuiChevron][tuiIcons]._chevron-rotated:after,tui-icon[tuiChevron]._chevron-rotated:after{transform:rotate(180deg)} +`],encapsulation:2,changeDetection:0});let t=e;return t})(),Bfe=(()=>{let e=class e{constructor(){this.el=Ee(),this.dropdown=h(Ze,{optional:!0}),this.nothing=Dn(AV),this.toggle=Io(()=>{var n;return this.el.classList.toggle("_chevron-rotated",this.chevron()||this.chevron()===""&&!!((n=this.dropdown)!=null&&n.ref()))}),this.chevron=ge("")}set tuiChevron(n){this.chevron.set(n)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiChevron",""]],hostAttrs:["tuiChevron",""],inputs:{tuiChevron:"tuiChevron"},features:[Z([De(ja,MV)])]});let t=e;return t})();var kV=W();function Qfe(t){return{provide:kV,deps:[[new qn,new Uu,an],[new qn,t]],useFactory:OV}}function OV(t,e){return t?Aa(t).pipe(S(i=>e?e==null?void 0:e.fromControlValue(i):i)):ce(null)}var Xfe=W(),Jfe=W(),epe=W(),tpe=W(),npe=B(Fe("confirm")),ipe=B(Fe("cancel")),rpe=B(Fe("done")),ope=B(Fe("more")),spe=B(Fe("hide")),ape=B(Fe("showAll")),upe=B(Fe("otherDate")),lpe=B(Fe("mobileCalendarTexts")),cpe=B(Fe("range")),dpe=B(Fe("countTexts")),fpe=B(Fe("time")),ppe=B(Fe("dateTexts")),hpe=B(Fe("digitalInformationUnits")),mpe=B(Fe("copyTexts")),gpe=B(Fe("passwordTexts")),ype=B(Fe("shortCalendarMonths")),vpe=B(Fe("fileTexts")),bpe=B(Fe("pagination")),_pe=B(Fe("inputFileTexts")),Cpe=B(Fe("multiSelectTexts")),Dpe=B(Fe("countries")),Epe=B(Fe("previewTexts")),wpe=B(Fe("zoomTexts")),Tpe=B(Fe("phoneSearch")),NV={icon:()=>"@tui.calendar",min:hI,max:mI,nativePicker:!1},xpe=W(NV);var PV={stringify:String,identityMatcher:lx,disabledItemHandler:Di},Ipe=W(PV);var FV=W(),Spe={provide:Mp,useFactory:()=>h(Qi)&&h(FV,{optional:!0})||h(Mp,{skipSelf:!0})},RV={rotate:"@tui.rotate-ccw-square",prev:"@tui.arrow-left",next:"@tui.arrow-right",zoomIn:"@tui.plus",zoomOut:"@tui.minus",zoomReset:"@tui.minimize"},Mpe=W(RV);var Ape=W({});var[s2,Kpe]=Oo({icon:"",appearance:"icon"}),LV=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["ng-component"]],hostAttrs:[1,"tui-tooltip"],decls:0,vars:0,template:function(r,o){},styles:[`[tuiTooltip]{border-width:.125rem;border-radius:100%;cursor:pointer;pointer-events:auto;background-clip:content-box!important}[tuiTooltip] [tuiBlock],[tuiTooltip] [tuiCell][data-size=s],[tuiLabel][data-orientation=horizontal] [tuiTooltip]{border-width:.25rem}[tuiTitle] [tuiTooltip]{font-size:1rem;border:none}[tuiTooltip]:after{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);inline-size:1rem;block-size:1rem}@media (hover: hover) and (pointer: fine){tui-textfield:hover [tuiTooltip][data-appearance=icon]:after,tui-textarea:hover [tuiTooltip][data-appearance=icon]:after,tui-primitive-textfield:hover [tuiTooltip][data-appearance=icon]:after,tui-input-tag:hover [tuiTooltip][data-appearance=icon]:after{color:var(--tui-text-secondary)}} `],encapsulation:2,changeDetection:0});let t=e;return t})(),a2=(()=>{let e=class e{constructor(){this.textfield=h(jv,{optional:!0}),this.isMobile=h(Qi),this.describe=h(ze),this.driver=h(Ka),this.nothing=Dn(LV),this.state=Ha(Cn(h(Ka).pipe(S(n=>n?"hover":null),Jr()),{initialValue:null}))}ngDoCheck(){var n;(n=this.textfield)!=null&&n.id&&(this.describe.tuiHintDescribe=this.textfield.id)}onClick(n){this.isMobile?(n.preventDefault(),n.stopPropagation()):this.driver.toggle()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["tui-icon","tuiTooltip",""]],hostAttrs:["tuiTooltip",""],hostBindings:function(r,o){r&1&&x("click.prevent",function(){return 0})("mousedown",function(a){return o.onClick(a)})},features:[Z([La(s2),{provide:za,useFactory:()=>h(s2).icon||h(As).icon}]),Mt([Ba,{directive:ze,inputs:["tuiHintDescribe","tuiTooltipDescribe"]},{directive:Ve,inputs:["tuiHint","tuiTooltip","tuiHintAppearance","tuiHintAppearance","tuiHintContext","tuiHintContext"]}])]});let t=e;return t})();function u2(t){let{anchorOffset:e=0,focusOffset:i=0}=t.ownerDocument.getSelection()||{},n=Math.min(e,i),r=Math.max(e,i);return[n,r]}function BV(t,[e,i]){var n,r,o,s;let a=t.ownerDocument,u=a.createRange();u.setStart(t.firstChild||t,Math.min(e,(r=(n=t.textContent)===null||n===void 0?void 0:n.length)!==null&&r!==void 0?r:0)),u.setEnd(t.lastChild||t,Math.min(i,(s=(o=t.textContent)===null||o===void 0?void 0:o.length)!==null&&s!==void 0?s:0));let l=a.getSelection();l&&(l.removeAllRanges(),l.addRange(u))}var Wv=class{constructor(e){this.element=e,this.maxLength=1/0}get value(){return this.element.innerText.replace(/\n\n$/,` `)}set value(e){this.element.innerHTML=e.replace(/\n$/,` -`)}get selectionStart(){return u2(this.element)[0]}get selectionEnd(){return u2(this.element)[1]}setSelectionRange(e,i){BV(this.element,[e??0,i??0])}select(){this.setSelectionRange(0,this.value.length)}};function VV(t){let e=new Wv(t);return new Proxy(t,{get(i,n){if(n in e)return e[n];let r=i[n];return typeof r=="function"?r.bind(i):r},set(i,n,r,o){return Reflect.set(n in e?e:i,n,r,o)}})}var f2=t=>t.isContentEditable?VV(t):t.querySelector("input,textarea")||t,Kv={mask:/^.*$/,preprocessors:[],postprocessors:[],plugins:[],overwriteMode:"shift"},qv=class{constructor(){this.now=null,this.past=[],this.future=[]}undo(){let e=this.past.pop();e&&this.now&&(this.future.push(this.now),this.updateElement(e,"historyUndo"))}redo(){let e=this.future.pop();e&&this.now&&(this.past.push(this.now),this.updateElement(e,"historyRedo"))}updateHistory(e){if(!this.now){this.now=e;return}let i=this.now.value!==e.value,n=this.now.selection.some((r,o)=>r!==e.selection[o]);!i&&!n||(i&&(this.past.push(this.now),this.future=[]),this.now=e)}updateElement(e,i){this.now=e,this.updateElementState(e,{inputType:i,data:null})}};function zV(t,...e){return e.every(({value:i})=>i===t.value)}function jV(t,...e){return e.every(({value:i,selection:n})=>i===t.value&&n[0]===t.selection[0]&&n[1]===t.selection[1])}function UV({value:t,selection:e},i,n){let[r,o]=e,s=typeof n=="function"?n({value:t,selection:e}):n;return{value:t,selection:s==="replace"?[r,Math.max(r+i.length,o)]:[r,o]}}function Bp(t){return typeof t=="string"}function l2(t,e,i,n){let r="";for(let o=e.length;o{let r=e[n]||"";return Bp(r)?i===r:i.match(r)}):e.test(t)}function $V(t,e,i){let n=null,r=null,o=Array.from(t.value).reduce((a,u,l)=>{let c=l2(e,a,u,i),f=a+c,p=e[f.length]||"";return n===null&&l>=t.selection[0]&&(n=f.length),r===null&&l>=t.selection[1]&&(r=f.length),Bp(p)?f+p:u.match(p)?f+u:f},""),s=l2(e,o,"",i);return{value:p2(o+s,e)?o+s:o,selection:[n??o.length,r??o.length]}}function GV({value:t,selection:e},i){let[n,r]=e,o=n,s=r;return{value:Array.from(t).reduce((u,l,c)=>{let f=u+l;return n===c&&(o=u.length),r===c&&(s=u.length),f.match(i)?f:u},""),selection:[o,s]}}function Rp(t,e,i=null){if(p2(t.value,e))return t;let{value:n,selection:r}=Array.isArray(e)?$V(t,e,i):GV(t,e);return{selection:r,value:Array.isArray(e)?n.slice(0,e.length):n}}function c2(t,e){if(!Array.isArray(e))return t;let[i,n]=t.selection,r=[],o=Array.from(t.value).reduce((s,a,u)=>{let l=e[u]||"";return u===i&&r.push(s.length),u===n&&r.push(s.length),Bp(l)&&l===a?s:s+a},"");return r.length<2&&r.push(...new Array(2-r.length).fill(o.length)),{value:o,selection:[r[0],r[1]]}}var Fl=class{constructor(e,i){this.initialElementState=e,this.maskOptions=i,this.value="",this.selection=[0,0];let{value:n,selection:r}=Rp(this.initialElementState,this.getMaskExpression(this.initialElementState));this.value=n,this.selection=r}addCharacters([e,i],n){let{value:r,maskOptions:o}=this,s=this.getMaskExpression({value:r.slice(0,e)+n+r.slice(i),selection:[e+n.length,e+n.length]}),a={value:r,selection:[e,i]},u=c2(a,s),[l,c]=UV(u,n,o.overwriteMode).selection,f=u.value.slice(0,l)+n,p=f.length,m=Rp({value:f+u.value.slice(c),selection:[p,p]},s,a);if(r.slice(0,e)===Rp({value:f,selection:[p,p]},s,a).value||jV(this,m))throw new Error("Invalid mask value");this.value=m.value,this.selection=m.selection}deleteCharacters([e,i]){if(e===i||!i)return;let{value:n}=this,r=this.getMaskExpression({value:n.slice(0,e)+n.slice(i),selection:[e,e]}),o={value:n,selection:[e,i]},s=c2(o,r),[a,u]=s.selection,l=s.value.slice(0,a)+s.value.slice(u),c=Rp({value:l,selection:[a,a]},r,o);this.value=c.value,this.selection=c.selection}getMaskExpression(e){let{mask:i}=this.maskOptions;return typeof i=="function"?i(e):i}},Zv=class{constructor(e){this.element=e,this.listeners=[]}listen(e,i,n){let r=i;this.element.addEventListener(e,r,n),this.listeners.push(()=>this.element.removeEventListener(e,r,n))}destroy(){this.listeners.forEach(e=>e())}},er={CTRL:1,ALT:2,SHIFT:4,META:8},Nl={Y:89,Z:90};function Pl(t,e,i){return t.ctrlKey===!!(e&er.CTRL)&&t.altKey===!!(e&er.ALT)&&t.shiftKey===!!(e&er.SHIFT)&&t.metaKey===!!(e&er.META)&&t.keyCode===i}function WV(t){return Pl(t,er.CTRL,Nl.Y)||Pl(t,er.CTRL|er.SHIFT,Nl.Z)||Pl(t,er.META|er.SHIFT,Nl.Z)}function qV(t){return Pl(t,er.CTRL,Nl.Z)||Pl(t,er.META,Nl.Z)}function ZV({value:t,selection:e},i){let[n,r]=e;if(n!==r)return[n,r];let o=i?t.slice(n).indexOf(` +`)}get selectionStart(){return u2(this.element)[0]}get selectionEnd(){return u2(this.element)[1]}setSelectionRange(e,i){BV(this.element,[e??0,i??0])}select(){this.setSelectionRange(0,this.value.length)}};function VV(t){let e=new Wv(t);return new Proxy(t,{get(i,n){if(n in e)return e[n];let r=i[n];return typeof r=="function"?r.bind(i):r},set(i,n,r,o){return Reflect.set(n in e?e:i,n,r,o)}})}var f2=t=>t.isContentEditable?VV(t):t.querySelector("input,textarea")||t,Kv={mask:/^.*$/,preprocessors:[],postprocessors:[],plugins:[],overwriteMode:"shift"},qv=class{constructor(){this.now=null,this.past=[],this.future=[]}undo(){let e=this.past.pop();e&&this.now&&(this.future.push(this.now),this.updateElement(e,"historyUndo"))}redo(){let e=this.future.pop();e&&this.now&&(this.past.push(this.now),this.updateElement(e,"historyRedo"))}updateHistory(e){if(!this.now){this.now=e;return}let i=this.now.value!==e.value,n=this.now.selection.some((r,o)=>r!==e.selection[o]);!i&&!n||(i&&(this.past.push(this.now),this.future=[]),this.now=e)}updateElement(e,i){this.now=e,this.updateElementState(e,{inputType:i,data:null})}};function zV(t,...e){return e.every(({value:i})=>i===t.value)}function jV(t,...e){return e.every(({value:i,selection:n})=>i===t.value&&n[0]===t.selection[0]&&n[1]===t.selection[1])}function UV({value:t,selection:e},i,n){let[r,o]=e,s=typeof n=="function"?n({value:t,selection:e}):n;return{value:t,selection:s==="replace"?[r,Math.max(r+i.length,o)]:[r,o]}}function Vp(t){return typeof t=="string"}function l2(t,e,i,n){let r="";for(let o=e.length;o{let r=e[n]||"";return Vp(r)?i===r:i.match(r)}):e.test(t)}function $V(t,e,i){let n=null,r=null,o=Array.from(t.value).reduce((a,u,l)=>{let c=l2(e,a,u,i),f=a+c,p=e[f.length]||"";return n===null&&l>=t.selection[0]&&(n=f.length),r===null&&l>=t.selection[1]&&(r=f.length),Vp(p)?f+p:u.match(p)?f+u:f},""),s=l2(e,o,"",i);return{value:p2(o+s,e)?o+s:o,selection:[n??o.length,r??o.length]}}function GV({value:t,selection:e},i){let[n,r]=e,o=n,s=r;return{value:Array.from(t).reduce((u,l,c)=>{let f=u+l;return n===c&&(o=u.length),r===c&&(s=u.length),f.match(i)?f:u},""),selection:[o,s]}}function Lp(t,e,i=null){if(p2(t.value,e))return t;let{value:n,selection:r}=Array.isArray(e)?$V(t,e,i):GV(t,e);return{selection:r,value:Array.isArray(e)?n.slice(0,e.length):n}}function c2(t,e){if(!Array.isArray(e))return t;let[i,n]=t.selection,r=[],o=Array.from(t.value).reduce((s,a,u)=>{let l=e[u]||"";return u===i&&r.push(s.length),u===n&&r.push(s.length),Vp(l)&&l===a?s:s+a},"");return r.length<2&&r.push(...new Array(2-r.length).fill(o.length)),{value:o,selection:[r[0],r[1]]}}var Fl=class{constructor(e,i){this.initialElementState=e,this.maskOptions=i,this.value="",this.selection=[0,0];let{value:n,selection:r}=Lp(this.initialElementState,this.getMaskExpression(this.initialElementState));this.value=n,this.selection=r}addCharacters([e,i],n){let{value:r,maskOptions:o}=this,s=this.getMaskExpression({value:r.slice(0,e)+n+r.slice(i),selection:[e+n.length,e+n.length]}),a={value:r,selection:[e,i]},u=c2(a,s),[l,c]=UV(u,n,o.overwriteMode).selection,f=u.value.slice(0,l)+n,p=f.length,m=Lp({value:f+u.value.slice(c),selection:[p,p]},s,a);if(r.slice(0,e)===Lp({value:f,selection:[p,p]},s,a).value||jV(this,m))throw new Error("Invalid mask value");this.value=m.value,this.selection=m.selection}deleteCharacters([e,i]){if(e===i||!i)return;let{value:n}=this,r=this.getMaskExpression({value:n.slice(0,e)+n.slice(i),selection:[e,e]}),o={value:n,selection:[e,i]},s=c2(o,r),[a,u]=s.selection,l=s.value.slice(0,a)+s.value.slice(u),c=Lp({value:l,selection:[a,a]},r,o);this.value=c.value,this.selection=c.selection}getMaskExpression(e){let{mask:i}=this.maskOptions;return typeof i=="function"?i(e):i}},Zv=class{constructor(e){this.element=e,this.listeners=[]}listen(e,i,n){let r=i;this.element.addEventListener(e,r,n),this.listeners.push(()=>this.element.removeEventListener(e,r,n))}destroy(){this.listeners.forEach(e=>e())}},er={CTRL:1,ALT:2,SHIFT:4,META:8},Nl={Y:89,Z:90};function Pl(t,e,i){return t.ctrlKey===!!(e&er.CTRL)&&t.altKey===!!(e&er.ALT)&&t.shiftKey===!!(e&er.SHIFT)&&t.metaKey===!!(e&er.META)&&t.keyCode===i}function WV(t){return Pl(t,er.CTRL,Nl.Y)||Pl(t,er.CTRL|er.SHIFT,Nl.Z)||Pl(t,er.META|er.SHIFT,Nl.Z)}function qV(t){return Pl(t,er.CTRL,Nl.Z)||Pl(t,er.META,Nl.Z)}function ZV({value:t,selection:e},i){let[n,r]=e;if(n!==r)return[n,r];let o=i?t.slice(n).indexOf(` `)+1||t.length:t.slice(0,r).lastIndexOf(` -`)+1;return[i?n:o,i?o:r]}function KV({value:t,selection:e},i){let[n,r]=e;return n!==r?[n,r]:(i?[n,r+1]:[n-1,r]).map(s=>Math.min(Math.max(s,0),t.length))}var YV=/\s+$/g,QV=/^\s+/g,d2=/\s/;function XV({value:t,selection:e},i){let[n,r]=e;if(n!==r)return[n,r];if(i){let u=t.slice(n),[l]=u.match(QV)||[""],c=u.trimStart().search(d2);return[n,c!==-1?n+l.length+c:t.length]}let o=t.slice(0,r),[s]=o.match(YV)||[""],a=o.trimEnd().split("").reverse().findIndex(u=>d2.exec(u));return[a!==-1?r-s.length-a:0,r]}function Lp(t=[]){return(e,...i)=>t.reduce((n,r)=>Object.assign(Object.assign({},n),r(n,...i)),e)}function Yv(t,e){let i=Object.assign(Object.assign({},Kv),e),n=Lp(i.preprocessors),r=Lp(i.postprocessors),o=typeof t=="string"?{value:t,selection:[0,0]}:t,{elementState:s}=n({elementState:o,data:""},"validation"),a=new Fl(s,i),{value:u,selection:l}=r(a,o);return typeof t=="string"?u:{value:u,selection:l}}var Hp=class extends qv{constructor(e,i){super(),this.element=e,this.maskitoOptions=i,this.isTextArea=this.element.nodeName==="TEXTAREA",this.eventListener=new Zv(this.element),this.options=Object.assign(Object.assign({},Kv),this.maskitoOptions),this.upcomingElementState=null,this.preprocessor=Lp(this.options.preprocessors),this.postprocessor=Lp(this.options.postprocessors),this.teardowns=this.options.plugins.map(n=>n(this.element,this.options)),this.updateHistory(this.elementState),this.eventListener.listen("keydown",n=>{if(WV(n))return n.preventDefault(),this.redo();if(qV(n))return n.preventDefault(),this.undo()}),this.eventListener.listen("beforeinput",n=>{var r,o,s;let a=n.inputType.includes("Forward");switch(this.updateHistory(this.elementState),n.inputType){case"historyUndo":return n.preventDefault(),this.undo();case"historyRedo":return n.preventDefault(),this.redo();case"deleteByCut":case"deleteContentBackward":case"deleteContentForward":return this.handleDelete({event:n,isForward:a,selection:KV(this.elementState,a)});case"deleteWordForward":case"deleteWordBackward":return this.handleDelete({event:n,isForward:a,selection:XV(this.elementState,a),force:!0});case"deleteSoftLineBackward":case"deleteSoftLineForward":case"deleteHardLineBackward":case"deleteHardLineForward":return this.handleDelete({event:n,isForward:a,selection:ZV(this.elementState,a),force:!0});case"insertCompositionText":return;case"insertReplacementText":return;case"insertLineBreak":case"insertParagraph":return this.handleEnter(n);case"insertFromPaste":case"insertText":case"insertFromDrop":default:return this.handleInsert(n,(s=(r=n.data)!==null&&r!==void 0?r:(o=n.dataTransfer)===null||o===void 0?void 0:o.getData("text/plain"))!==null&&s!==void 0?s:"")}}),this.eventListener.listen("input",()=>{this.upcomingElementState&&(this.updateElementState(this.upcomingElementState),this.upcomingElementState=null)},{capture:!0}),this.eventListener.listen("input",({inputType:n})=>{n!=="insertCompositionText"&&(this.ensureValueFitsMask(),this.updateHistory(this.elementState))}),this.eventListener.listen("compositionend",()=>{this.ensureValueFitsMask(),this.updateHistory(this.elementState)})}destroy(){this.eventListener.destroy(),this.teardowns.forEach(e=>e==null?void 0:e())}updateElementState({value:e,selection:i},n){let r=this.elementState.value;this.updateValue(e),this.updateSelectionRange(i),n&&r!==e&&this.dispatchInputEvent(n)}get elementState(){let{value:e,selectionStart:i,selectionEnd:n}=this.element;return{value:e,selection:[i??0,n??0]}}get maxLength(){let{maxLength:e}=this.element;return e===-1?1/0:e}updateSelectionRange([e,i]){var n;let{element:r}=this;r.matches(":focus")&&(r.selectionStart!==e||r.selectionEnd!==i)&&((n=r.setSelectionRange)===null||n===void 0||n.call(r,e,i))}updateValue(e){this.element.value=e}ensureValueFitsMask(){this.updateElementState(Yv(this.elementState,this.options),{inputType:"insertText",data:null})}dispatchInputEvent(e={inputType:"insertText",data:null}){globalThis.InputEvent&&this.element.dispatchEvent(new InputEvent("input",Object.assign(Object.assign({},e),{bubbles:!0,cancelable:!1})))}handleDelete({event:e,selection:i,isForward:n,force:r=!1}){let o={value:this.elementState.value,selection:i},[s,a]=o.selection,{elementState:u}=this.preprocessor({elementState:o,data:""},n?"deleteForward":"deleteBackward"),l=new Fl(u,this.options),[c,f]=u.selection;l.deleteCharacters([c,f]);let p=this.postprocessor(l,o);if(!(o.value.slice(0,s)+o.value.slice(a)===p.value&&!r&&!this.element.isContentEditable)){if(zV(o,u,l,p))return e.preventDefault(),this.updateSelectionRange(n?[f,f]:[c,c]);this.upcomingElementState=p}}handleInsert(e,i){let{options:n,maxLength:r,element:o,elementState:s}=this,{elementState:a,data:u=i}=this.preprocessor({data:i,elementState:s},"insert"),l=new Fl(a,n);try{l.addCharacters(a.selection,u)}catch{return e.preventDefault()}let[c,f]=a.selection,p=s.value.slice(0,c)+i+s.value.slice(f),m=this.postprocessor(l,s);if(m.value.length>r)return e.preventDefault();(p!==m.value||o.isContentEditable)&&(this.upcomingElementState=m,n.overwriteMode==="replace"&&p.length>r&&this.dispatchInputEvent({inputType:"insertText",data:i}))}handleEnter(e){(this.isTextArea||this.element.isContentEditable)&&this.handleInsert(e,` +`)+1;return[i?n:o,i?o:r]}function KV({value:t,selection:e},i){let[n,r]=e;return n!==r?[n,r]:(i?[n,r+1]:[n-1,r]).map(s=>Math.min(Math.max(s,0),t.length))}var YV=/\s+$/g,QV=/^\s+/g,d2=/\s/;function XV({value:t,selection:e},i){let[n,r]=e;if(n!==r)return[n,r];if(i){let u=t.slice(n),[l]=u.match(QV)||[""],c=u.trimStart().search(d2);return[n,c!==-1?n+l.length+c:t.length]}let o=t.slice(0,r),[s]=o.match(YV)||[""],a=o.trimEnd().split("").reverse().findIndex(u=>d2.exec(u));return[a!==-1?r-s.length-a:0,r]}function Hp(t=[]){return(e,...i)=>t.reduce((n,r)=>Object.assign(Object.assign({},n),r(n,...i)),e)}function Yv(t,e){let i=Object.assign(Object.assign({},Kv),e),n=Hp(i.preprocessors),r=Hp(i.postprocessors),o=typeof t=="string"?{value:t,selection:[0,0]}:t,{elementState:s}=n({elementState:o,data:""},"validation"),a=new Fl(s,i),{value:u,selection:l}=r(a,o);return typeof t=="string"?u:{value:u,selection:l}}var Bp=class extends qv{constructor(e,i){super(),this.element=e,this.maskitoOptions=i,this.isTextArea=this.element.nodeName==="TEXTAREA",this.eventListener=new Zv(this.element),this.options=Object.assign(Object.assign({},Kv),this.maskitoOptions),this.upcomingElementState=null,this.preprocessor=Hp(this.options.preprocessors),this.postprocessor=Hp(this.options.postprocessors),this.teardowns=this.options.plugins.map(n=>n(this.element,this.options)),this.updateHistory(this.elementState),this.eventListener.listen("keydown",n=>{if(WV(n))return n.preventDefault(),this.redo();if(qV(n))return n.preventDefault(),this.undo()}),this.eventListener.listen("beforeinput",n=>{var r,o,s;let a=n.inputType.includes("Forward");switch(this.updateHistory(this.elementState),n.inputType){case"historyUndo":return n.preventDefault(),this.undo();case"historyRedo":return n.preventDefault(),this.redo();case"deleteByCut":case"deleteContentBackward":case"deleteContentForward":return this.handleDelete({event:n,isForward:a,selection:KV(this.elementState,a)});case"deleteWordForward":case"deleteWordBackward":return this.handleDelete({event:n,isForward:a,selection:XV(this.elementState,a),force:!0});case"deleteSoftLineBackward":case"deleteSoftLineForward":case"deleteHardLineBackward":case"deleteHardLineForward":return this.handleDelete({event:n,isForward:a,selection:ZV(this.elementState,a),force:!0});case"insertCompositionText":return;case"insertReplacementText":return;case"insertLineBreak":case"insertParagraph":return this.handleEnter(n);case"insertFromPaste":case"insertText":case"insertFromDrop":default:return this.handleInsert(n,(s=(r=n.data)!==null&&r!==void 0?r:(o=n.dataTransfer)===null||o===void 0?void 0:o.getData("text/plain"))!==null&&s!==void 0?s:"")}}),this.eventListener.listen("input",()=>{this.upcomingElementState&&(this.updateElementState(this.upcomingElementState),this.upcomingElementState=null)},{capture:!0}),this.eventListener.listen("input",({inputType:n})=>{n!=="insertCompositionText"&&(this.ensureValueFitsMask(),this.updateHistory(this.elementState))}),this.eventListener.listen("compositionend",()=>{this.ensureValueFitsMask(),this.updateHistory(this.elementState)})}destroy(){this.eventListener.destroy(),this.teardowns.forEach(e=>e==null?void 0:e())}updateElementState({value:e,selection:i},n){let r=this.elementState.value;this.updateValue(e),this.updateSelectionRange(i),n&&r!==e&&this.dispatchInputEvent(n)}get elementState(){let{value:e,selectionStart:i,selectionEnd:n}=this.element;return{value:e,selection:[i??0,n??0]}}get maxLength(){let{maxLength:e}=this.element;return e===-1?1/0:e}updateSelectionRange([e,i]){var n;let{element:r}=this;r.matches(":focus")&&(r.selectionStart!==e||r.selectionEnd!==i)&&((n=r.setSelectionRange)===null||n===void 0||n.call(r,e,i))}updateValue(e){this.element.value=e}ensureValueFitsMask(){this.updateElementState(Yv(this.elementState,this.options),{inputType:"insertText",data:null})}dispatchInputEvent(e={inputType:"insertText",data:null}){globalThis.InputEvent&&this.element.dispatchEvent(new InputEvent("input",Object.assign(Object.assign({},e),{bubbles:!0,cancelable:!1})))}handleDelete({event:e,selection:i,isForward:n,force:r=!1}){let o={value:this.elementState.value,selection:i},[s,a]=o.selection,{elementState:u}=this.preprocessor({elementState:o,data:""},n?"deleteForward":"deleteBackward"),l=new Fl(u,this.options),[c,f]=u.selection;l.deleteCharacters([c,f]);let p=this.postprocessor(l,o);if(!(o.value.slice(0,s)+o.value.slice(a)===p.value&&!r&&!this.element.isContentEditable)){if(zV(o,u,l,p))return e.preventDefault(),this.updateSelectionRange(n?[f,f]:[c,c]);this.upcomingElementState=p}}handleInsert(e,i){let{options:n,maxLength:r,element:o,elementState:s}=this,{elementState:a,data:u=i}=this.preprocessor({data:i,elementState:s},"insert"),l=new Fl(a,n);try{l.addCharacters(a.selection,u)}catch{return e.preventDefault()}let[c,f]=a.selection,p=s.value.slice(0,c)+i+s.value.slice(f),m=this.postprocessor(l,s);if(m.value.length>r)return e.preventDefault();(p!==m.value||o.isContentEditable)&&(this.upcomingElementState=m,n.overwriteMode==="replace"&&p.length>r&&this.dispatchInputEvent({inputType:"insertText",data:i}))}handleEnter(e){(this.isTextArea||this.element.isContentEditable)&&this.handleInsert(e,` `)}};var JV=[[["input"]],"*"],e9=["input","*"];function t9(t,e){t&1&&(E(0,"span",3),at(1,1),w())}function n9(t,e){if(t&1&&(_t(0),Q(1,"span",1),O(2,t9,2,0,"span",2),Ct()),t&2){let i=e.tuiLet;C(),v("textContent",i),C(),v("ngIf",!i)}}var h2=(()=>{let e=class e{constructor(){this.value$=Cu(()=>Aa(this.control))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-input-inline"]],contentQueries:function(r,o,s){if(r&1&&_n(s,an,5),r&2){let a;Qe(a=Xe())&&(o.control=a.first)}},ngContentSelectors:e9,decls:3,vars:3,consts:[[4,"tuiLet"],[1,"t-before",3,"textContent"],["automation-id","tui-input-inline__placeholder","class","t-placeholder",4,"ngIf"],["automation-id","tui-input-inline__placeholder",1,"t-placeholder"]],template:function(r,o){r&1&&(Xt(JV),O(0,n9,3,2,"ng-container",0),Y(1,"async"),at(2)),r&2&&v("tuiLet",J(1,1,o.value$))},dependencies:[Re,ut,EI],styles:[`tui-input-inline{position:relative;display:inline-block;white-space:nowrap;box-sizing:border-box}tui-input-inline>.t-before{padding-right:.02em;margin-left:1px;white-space:pre;visibility:hidden}tui-input-inline>.t-placeholder{display:inline-block;min-inline-size:1px;margin-left:-1px}tui-input-inline>input{position:absolute;top:0;left:0;background-color:transparent;padding:inherit;font:inherit;color:inherit;box-sizing:border-box;inline-size:100%;block-size:100%;border-width:0;text-align:inherit;letter-spacing:inherit;text-indent:inherit;text-transform:inherit;outline:none} -`],encapsulation:2,changeDetection:0});let t=e;return t})();var lhe=(()=>{let e=class e{constructor(){this.elementRef=h(de).nativeElement,this.ngZone=h(me),this.maskedElement=null,this.options=null,this.elementPredicate=f2;let n=h(So,{self:!0,optional:!0});if(n){let r=n.writeValue.bind(n);n.writeValue=o=>{r(this.options?Yv(String(o??""),this.options):o)}}}async ngOnChanges(){let{elementPredicate:n,options:r,maskedElement:o,elementRef:s,ngZone:a}=this;if(o==null||o.destroy(),!r)return;let u=await n(s);this.elementPredicate!==n||this.options!==r||a.runOutsideAngular(()=>{this.maskedElement=new Hp(u,r)})}ngOnDestroy(){var n;(n=this.maskedElement)==null||n.destroy()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","maskito",""]],inputs:{options:[0,"maskito","options"],elementPredicate:[0,"maskitoElement","elementPredicate"]},features:[Yt]});let t=e;return t})();function i9(t,e){t&1&&(_t(0),he(1,"Edit anchor"),Ct())}function r9(t,e){t&1&&(E(0,"span"),he(1,"Link to anchor"),w())}function o9(t,e){t&1&&(E(0,"span"),he(1,"URL"),w())}function s9(t,e){if(t&1&&O(0,r9,2,0,"span",4)(1,o9,2,0,"ng-template",null,2,We),t&2){let i=be(2),n=_(2);v("ngIf",n.prefixIsHashMode)("ngIfElse",i)}}function a9(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.ngIf,n=_(2);C(),Nt(" ",n.prefixIsHashMode?i.anchorExample:i.urlExample," ")}}function u9(t,e){if(t&1){let i=q();_t(0),E(1,"label",6)(2,"div",7),O(3,i9,2,0,"ng-container",4)(4,s9,3,2,"ng-template",null,1,We),w(),E(6,"div",8)(7,"div",9),he(8),w(),E(9,"tui-input-inline",10),x("input",function(r){P(i);let o=_();return F(o.onChange(r.target==null?null:r.target.value))})("keydown.backspace",function(){P(i);let r=_();return F(r.onBackspace())})("keydown.prevent.enter",function(){P(i);let r=_();return F(r.onSave())}),O(10,a9,2,1,"ng-container",5),Y(11,"async"),E(12,"input",11),df("ngModelChange",function(r){P(i);let o=_();return ny(o.url,r)||(o.url=r),F(r)}),x("blur",function(){P(i);let r=_();return F(r.onBlur(r.url))}),w()()()(),E(13,"button",12),x("click",function(){P(i);let r=_();return F(r.onClear())}),w(),E(14,"button",13),x("click",function(){P(i);let r=_();return F(r.onSave())}),w(),Ct()}if(t&2){let i=be(5),n=_();C(3),v("ngIf",n.anchorMode)("ngIfElse",i),C(5),ey(n.prefix),C(),Te("t-input_filled",n.hasUrl),C(),v("ngIf",J(11,9,n.texts$)),C(2),cf("ngModel",n.url),C(),v("iconStart",n.options.icons.popupLinkRemove),C(),v("iconStart",n.options.icons.popupLinkSave)}}function l9(t,e){if(t&1){let i=q();E(0,"a",14),he(1),Y(2,"tuiShortUrl"),w(),E(3,"button",15),x("click",function(){P(i);let r=_();return F(r.onEdit())}),w(),E(4,"button",16),x("click",function(){P(i);let r=_();return F(r.onRemove())}),w()}if(t&2){let i=_();v("href",i.href,Kd)("iconStart",i.prefixIsHashMode?i.options.icons.hash:i.options.icons.externalLink),C(),Nt(" ",J(2,5,i.url)," "),C(2),v("iconStart",i.options.icons.popupPreviewLinkEdit),C(),v("iconStart",i.options.icons.popupPreviewLinkClear)}}function c9(t,e){if(t&1){let i=q();E(0,"button",20),x("mousedown",function(){let r=P(i).$implicit,o=_(2);return F(o.setAnchor(r))}),he(1),w()}if(t&2){let i=e.$implicit;C(),Nt(" #",i," ")}}function d9(t,e){if(t&1&&(_t(0),Q(1,"hr",17),E(2,"tui-scrollbar")(3,"div",18),O(4,c9,2,1,"button",19),Y(5,"tuiFilterAnchors"),w()(),Ct()),t&2){let i=_();C(4),v("ngForOf",mT(5,1,i.anchorIds,i.prefix,i.url))}}var f9=(()=>{let e=class e{transform(n,r,o){return r==="#"?n.filter(s=>s!==o):n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275pipe=$i({name:"tuiFilterAnchors",type:e,pure:!0});let t=e;return t})(),Qv=60,y2=Qv-20,p9=Qv-y2-10,h9=(()=>{let e=class e{transform(n){return n.length-1?[e.slice(0,n+xl.length),e.slice(n+xl.length,e.length)]:["",e],s=o+(i.length?`?${i}`:""),a=[r,s].filter(Boolean);return o!=null&&o.includes("://")&&a.length>1?v2(s):a}function m2(t=""){let[e="",i=""]=t.split(/\?/)??[],[n,r]=e.split(/:/).slice(-2).filter(Boolean);return!(e.includes("/")&&e.lastIndexOf(":")>e.indexOf("/")||e.includes("?")&&e.lastIndexOf(":")>e.indexOf("?"))&&n&&r&&!m9(e)?[`${n}:`,r+(i.length?`?${i}`:"")]:[]}function g2(t=""){if(t.startsWith(Ln))return{prefix:Ln,path:t.slice(1)};let[e="",i=""]=t.includes(xl)?v2(t):m2(t);if(i.includes(tS)){let[n,r]=m2(i);if(n&&r)return{prefix:n,path:r}}return t.startsWith("/")&&!t.startsWith("//")?{prefix:t.slice(0,1),path:t.slice(1)}:t.startsWith("./")?{prefix:t.slice(0,2),path:t.slice(2)}:{prefix:e,path:e===""?t:i}}function m9(t){return new RegExp(String.raw`^([a-zA-Z]+:\/\/)?`+String.raw`((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|localhost|`+String.raw`((\d{1,3}\.){3}\d{1,3}))`+String.raw`(\:\d+)?(\/[-a-z\d%_.~+\:]*)*`+String.raw`(\?[)(;&a-z\d%_.~+=-]*)?`+String.raw`(\#[-a-z\d_]*)?$`,"i").test(t)}var b2=(()=>{let e=class e{constructor(){var n;this.doc=((n=h(Je))==null?void 0:n.document)??null,this.isOnlyAnchorMode=this.detectAnchorMode(),this.injectionEditor=h(je,{optional:!0}),this.options=h(xe),this.url=this.getHrefOrAnchorId(),this.edit=!this.url,this.prefix=this.makeDefaultPrefix(),this.anchorIds=this.getAllAnchorsIds(),this.texts$=h(cS),this.inputEditor=null,this.addLink=new _e,this.removeLink=new _e}set anchorMode(n){this.isOnlyAnchorMode=n,this.prefix=n?Ln:this.makeDefaultPrefix()}get anchorMode(){return this.isOnlyAnchorMode}get editor(){return this.injectionEditor??this.inputEditor}get defaultProtocol(){var n;return((n=this.options.linkOptions)==null?void 0:n.protocol)??wv}get prefixIsHashMode(){return this.prefix===Ln}get hasUrl(){return!!this.url}get href(){return`${this.prefix}${this.url}`}get showAnchorsList(){return!this.anchorMode&&this.edit&&this.anchorIds.length>0}onSelectionChange(){this.isViewMode&&(this.url=this.getHrefOrAnchorId(),this.anchorMode=this.detectAnchorMode())}onMouseDown(n){ui(n.target)&&!n.target.matches("a, button, input")&&n.preventDefault()}setAnchor(n){this.url=n,this.changePrefix(!0),this.addLink.emit(this.href)}changePrefix(n){this.prefix=n?Ln:this.defaultProtocol}onSave(){this.url?this.addLink.emit(this.href):this.removeLink.emit()}onBackspace(){this.url||(this.prefix=this.isOnlyAnchorMode?Ln:this.defaultProtocol)}onEdit(){this.edit=!0}onRemove(){this.removeLink.emit()}onChange(n){this.url=this.removePrefix(n)}onBlur(n){var o,s,a,u;let r=(o=this.editor)==null?void 0:o.getSelectionSnapshot();r&&!n&&!this.url&&((s=this.editor)==null||s.setTextSelection({from:r.anchor,to:r.head}),this.anchorMode?(a=this.editor)==null||a.removeAnchor():(u=this.editor)==null||u.toggleLink(""))}onClear(){this.url=""}get isViewMode(){return!this.edit}makeDefaultPrefix(){var o;let n=this.getAnchorElement(),r=g2((n==null?void 0:n.getAttribute("href"))??"").prefix||this.defaultProtocol;return n?this.isOnlyAnchorMode?Ln:!n.getAttribute("href")&&n.getAttribute("id")||(o=n.getAttribute("href"))!=null&&o.startsWith(Ln)?Ln:r:r}detectAnchorMode(){let n=this.getAnchorElement();return!(n!=null&&n.href)&&(!!(n!=null&&n.getAttribute("id"))||(n==null?void 0:n.getAttribute("data-type"))==="jump-anchor")}getFocusedParentElement(){var n,r,o,s;return((s=(o=(r=(n=this.doc)==null?void 0:n.getSelection)==null?void 0:r.call(n))==null?void 0:o.focusNode)==null?void 0:s.parentElement)||null}getAnchorElement(){var r;let n=this.getFocusedParentElement();return(n==null?void 0:n.closest("a"))??((r=n==null?void 0:n.querySelector("img"))==null?void 0:r.closest("a"))??null}getHrefOrAnchorId(){let n=this.getAnchorElement();return n?this.removePrefix(n.getAttribute("href")??n.getAttribute("id")??""):this.url}removePrefix(n){let r=n.startsWith(Ln)||this.prefix===Ln||n.startsWith("/")||n.startsWith("./")||n.startsWith("http")||n.startsWith("://")?n:`${this.prefix??""}${n}`,{prefix:o,path:s}=g2(r);return this.isOnlyAnchorMode||o===Ln||o===""&&this.prefix===Ln?this.prefix=Ln:o===""?this.prefix=this.defaultProtocol:this.prefix=o,s}getAllAnchorsIds(){var r,o;let n=Array.from(((o=(r=this.editor)==null?void 0:r.getOriginTiptapEditor())==null?void 0:o.view.dom.querySelectorAll('[data-type="jump-anchor"]'))??[]);return Array.from(n).map(s=>s.getAttribute("id")??"").filter(Boolean)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-edit-link"]],hostBindings:function(r,o){r&1&&x("selectionchange",function(){return o.onSelectionChange()},!1,Nn)("mousedown",function(a){return o.onMouseDown(a)})},inputs:{inputEditor:[0,"editor","inputEditor"],anchorMode:"anchorMode"},outputs:{addLink:"addLink",removeLink:"removeLink"},decls:5,vars:3,consts:[["view",""],["fullOptions",""],["urlTitle",""],[1,"t-edit-link"],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"t-label"],[1,"t-label-properties"],[1,"t-url"],[1,"t-prefix"],["tuiAutoFocus","",1,"t-input",3,"input","keydown.backspace","keydown.prevent.enter"],[3,"ngModelChange","blur","ngModel"],["appearance","icon","size","s","title","Clear","tuiIconButton","","type","button",1,"t-button",3,"click","iconStart"],["appearance","icon","size","s","title","Save","tuiIconButton","","type","button",1,"t-button",3,"click","iconStart"],["target","_blank","tuiLink","",1,"t-link",3,"href","iconStart"],["appearance","icon","size","s","title","Change link","tuiIconButton","","type","button",1,"t-button","t-edit-button",3,"click","iconStart"],["appearance","icon","automation-id","toolbar__popup-link-clear-button","size","s","title","Remove link","tuiIconButton","","type","button",1,"t-button",3,"click","iconStart"],[1,"t-hr"],[1,"t-anchor-list"],["type","button","class","t-anchor",3,"mousedown",4,"ngFor","ngForOf"],["type","button",1,"t-anchor",3,"mousedown"]],template:function(r,o){if(r&1&&(E(0,"div",3),O(1,u9,15,11,"ng-container",4)(2,l9,5,7,"ng-template",null,0,We),w(),O(4,d9,6,5,"ng-container",5)),r&2){let s=be(3);C(),v("ngIf",o.edit)("ngIfElse",s),C(3),v("ngIf",o.showAnchorsList)}},dependencies:[Re,wf,So,Df,_r,Ci,ut,_I,Le,f9,h2,IS,Wa,h9],styles:["[_nghost-%COMP%]{display:block;min-inline-size:18.75rem}.t-edit-link[_ngcontent-%COMP%]{display:flex;min-block-size:4rem;align-items:center;padding-right:.75rem}.t-label[_ngcontent-%COMP%]{font:var(--tui-font-text-s);block-size:var(--tui-height-l);box-sizing:border-box;padding:.4375rem 1rem;min-inline-size:12.5rem;max-inline-size:25rem;inline-size:100%}.t-label-properties[_ngcontent-%COMP%]{display:flex;align-items:center;max-inline-size:8.375rem;justify-content:space-between}.t-property_inactive[_ngcontent-%COMP%]{opacity:.5}.t-url[_ngcontent-%COMP%]{display:flex;font:var(--tui-font-text-m);color:var(--tui-text-secondary)}.t-input[_ngcontent-%COMP%]{flex:1}.t-input_filled[_ngcontent-%COMP%]{color:var(--tui-text-primary)}.t-button[_ngcontent-%COMP%]{inline-size:2rem;block-size:2rem;margin:0 .25rem;transition:background .2s}.t-edit-button[_ngcontent-%COMP%]{margin-left:auto}.t-link[_ngcontent-%COMP%]{margin:0 1rem;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.t-cleaner[_ngcontent-%COMP%]{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;color:var(--tui-text-secondary);cursor:pointer;margin-left:auto}.t-cleaner[_ngcontent-%COMP%]:hover{color:var(--tui-background-accent-opposite-pressed)}.t-cleaner_hidden[_ngcontent-%COMP%]{visibility:hidden}.t-anchor-list[_ngcontent-%COMP%]{display:flex;max-block-size:12.5rem;flex-direction:column}.t-anchor[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;min-block-size:2.75rem;padding:.375rem .5rem;margin:.125rem .5rem;border-radius:var(--tui-radius-m);text-align:start}.t-anchor[_ngcontent-%COMP%]:hover{background:var(--tui-background-base-alt);cursor:pointer}"],changeDetection:0});let t=e;return t})();var _2=(()=>{let e=class e{constructor(){this.editor=h(Ol,{optional:!0}),this.customSanitizer=h(oS,{optional:!0}),this.sanitizer=h(ws),this.document=h(qe),this.options=h(xe),this.html=ge(null)}set content(n){var o;let r=((o=this.customSanitizer)==null?void 0:o.sanitize(ri.HTML,n??""))??this.sanitizer.bypassSecurityTrustHtml(n??"");this.html.set(r)}click(n){var o,s;if(this.editor||!ui(n.target))return;let r=((s=(o=n.target)==null?void 0:o.closest("a"))==null?void 0:s.getAttribute("href"))??"";r.startsWith("#")&&(this.document.location.hash=r.replace("#",""),n.preventDefault())}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-editor-socket"]],hostVars:3,hostBindings:function(r,o){r&1&&x("click",function(a){return o.click(a)}),r&2&&(ms("innerHTML",o.html(),Zd),Te("tui-editor-socket",o.options.enableDefaultStyles))},inputs:{content:"content"},decls:0,vars:0,template:function(r,o){},styles:[`.tui-editor-socket{display:block;margin:0;color:var(--tui-text-primary);font:var(--tui-font-text-m)}.tui-editor-socket:after{content:"";display:table;clear:both}.tui-editor-socket[tuiTiptapEditor]{overflow:hidden}.tui-editor-socket .ProseMirror{min-block-size:100%;padding:.2rem 1rem;outline:none;white-space:pre-wrap}.tui-editor-socket .resize-cursor{cursor:ew-resize;cursor:col-resize}.tui-editor-socket .ProseMirror-gapcursor{margin-top:.83rem}.tui-editor-socket .ProseMirror .ProseMirror-gapcursor:first-child{margin-top:0}.tui-editor-socket img.ProseMirror-separator+.ProseMirror-trailingBreak,.tui-editor-socket img.ProseMirror-separator{display:none!important}.tui-editor-socket h1,.tui-editor-socket h2,.tui-editor-socket h3,.tui-editor-socket h4,.tui-editor-socket h5,.tui-editor-socket h6{word-break:break-word;line-height:normal}.tui-editor-socket h1:first-child,.tui-editor-socket h2:first-child,.tui-editor-socket p:last-child{margin-bottom:0}.tui-editor-socket p:last-child,.tui-editor-socket pre:last-child{margin-bottom:0}.tui-editor-socket p:empty:after{content:" ";white-space:pre}.tui-editor-socket p:first-child{margin-top:0;min-inline-size:.0625rem}.tui-editor-socket p{margin:1rem 0}.tui-editor-socket p>span{line-height:initial}.tui-editor-socket blockquote{margin:1.25rem 0 1.25rem 1.5rem;padding-left:1.0625rem;border-left:.0625rem solid var(--tui-border-normal)}.tui-editor-socket hr{border:none;border-top:.0625rem solid var(--tui-background-neutral-1-hover);margin:1rem 0}.tui-editor-socket mark{background:unset;color:inherit}.tui-editor-socket font[face="Courier New"]{display:inline-block;padding:.25rem .5rem;border-radius:.25rem;background-color:#ecf1f7;word-break:break-word}.tui-editor-socket a:not([data-type=jump-anchor]){color:var(--tui-text-action);text-decoration:none;outline:none}.tui-editor-socket a:not([data-type=jump-anchor]):hover{color:var(--tui-text-action-hover);text-decoration:underline}.tui-editor-socket a:not([data-type=jump-anchor]):active{color:var(--tui-background-accent-1-pressed)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]{text-decoration:underline;text-decoration-color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:before{content:"#"}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:hover{color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a:hover img[contenteditable=false]{cursor:pointer;outline:.25rem solid var(--tui-text-action)}.tui-editor-socket ul:not([data-type]),.tui-editor-socket ol:not([data-type]){list-style-type:none;margin:1rem 1rem 1rem 1.5rem;padding:0}.tui-editor-socket ul:not([data-type]) li,.tui-editor-socket ol:not([data-type]) li{margin:.75rem 0}.tui-editor-socket ul:not([data-type]) li>p,.tui-editor-socket ol:not([data-type]) li>p{display:inline;margin:0 auto;word-break:break-word}.tui-editor-socket ul:not([data-type]) li:before,.tui-editor-socket ol:not([data-type]) li:before{unicode-bidi:isolate;font-variant-numeric:tabular-nums;text-transform:none;text-indent:0;text-align:start;text-align-last:start}.tui-editor-socket ul:not([data-type]) li>p{display:block}.tui-editor-socket ul:not([data-type])>li:before{content:"";display:inline-block;inline-size:.5rem;block-size:.5rem;border-radius:100%;margin:.5rem .875rem .0625rem -1.375rem;background-color:var(--tui-background-accent-1);vertical-align:top;box-sizing:border-box;float:inline-start}.tui-editor-socket li ul:not([data-type])>li:before{background:none;border:.125rem solid var(--tui-background-accent-1)}.tui-editor-socket li ul:not([data-type])>li>ul:not([data-type])>li:before{background:var(--tui-background-accent-1);border-radius:0;inline-size:.375rem;block-size:.375rem}.tui-editor-socket ol:not([data-type]){counter-reset:item}.tui-editor-socket ol:not([data-type])>li:before{content:counters(item,".") ".";display:block;counter-increment:item;margin:0 .75rem 0 -1.5rem;color:var(--tui-border-hover);vertical-align:top;float:inline-start;white-space:nowrap}.tui-editor-socket [data-type=details-content] ol{counter-reset:details-item}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item,".") ".";counter-increment:details-item}.tui-editor-socket [data-type=details-content] ol [data-type=details-content] ol{counter-reset:details-item2}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item2,".") ".";counter-increment:details-item2}.tui-editor-socket ul[data-type] li[data-checked]{display:flex;gap:.5rem}.tui-editor-socket ul[data-type] li[data-checked]>div{inline-size:100%}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]{position:relative;inline-size:var(--t-size, 1rem);block-size:var(--t-size, 1rem);border-radius:var(--tui-radius-xs, .25rem);transition-property:color,background,opacity,box-shadow,border;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;outline:.125rem solid transparent;outline-offset:-.125rem;margin-top:.25rem;cursor:pointer}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]:before{content:"";position:absolute;top:0;left:0;inline-size:100%;block-size:100%;background:currentColor;-webkit-mask:url('data:image/svg+xml,') center / 100%;mask:url('data:image/svg+xml,') center / 100%;transform:scale(0);transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked{background:var(--tui-background-accent-1, #526ed3);color:var(--tui-text-primary-on-accent-1, #fff)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked:before{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,');transform:scale(1)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]{box-shadow:inset 0 0 0 .0625rem var(--tui-border-normal);color:var(--tui-text-primary)}.tui-editor-socket._preview-image img{cursor:pointer}.tui-editor-socket .ProseMirror video,.tui-editor-socket .ProseMirror audio{pointer-events:none}.tui-editor-socket img.ProseMirror-selectednode{outline:.25rem solid var(--tui-background-accent-1-hover)}.tui-editor-socket[tuiTiptapEditor] tui-image-editor:hover{outline:.0625rem dashed var(--tui-background-accent-1-hover)}.tui-editor-socket .t-editor-placeholder:not(tr):not(th):not(td):not(ul):not(ol):not(li):first-child:before{content:attr(data-placeholder);position:absolute;float:inline-start;color:var(--tui-border-hover);pointer-events:none}.tui-editor-socket table{border-collapse:collapse;table-layout:fixed;inline-size:100%;margin:0;overflow:hidden}.tui-editor-socket table .tableWrapper,.tui-editor-socket .tableWrapper,.tui-editor-socket .tui-table-wrapper{overflow-x:auto}.tui-editor-socket table td{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word}.tui-editor-socket table th{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word;font-weight:700;text-align:start;background-color:var(--tui-background-base-alt);min-block-size:2rem}.tui-editor-socket table td,.tui-editor-socket table th{border:.125rem solid #e9e9e7}[tuiTheme=dark] .tui-editor-socket table td,[tuiTheme=dark] .tui-editor-socket table th{border:.125rem solid #2f2f2f}.tui-editor-socket table .column-resize-handle{position:absolute;right:-.125rem;top:0;bottom:-.125rem;inline-size:.25rem;background-color:#adf;pointer-events:none}.tui-editor-socket table td>*{margin-top:0;margin-bottom:0}.tui-editor-socket table th>*{margin-top:0;margin-bottom:0}.tui-editor-socket .selectedCell{outline:.0625rem solid #83b4d7}.tui-editor-socket .selectedCell:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--tui-service-selected-text);pointer-events:none}.tui-editor-socket summary{display:flex;align-items:center;min-block-size:3.5rem;inline-size:100%;box-sizing:border-box;border-radius:var(--tui-radius-l);pointer-events:none;outline:none;word-break:break-word;padding:0 4.6875rem 0 1.25rem}.tui-editor-socket summary:focus-visible{outline:.125rem solid var(--tui-text-action)}.tui-editor-socket summary p{min-inline-size:.0625rem;margin:0}.tui-editor-socket summary::-webkit-details-marker{display:none}.tui-editor-socket details[open] summary{border-radius:var(--tui-radius-l) var(--tui-radius-l) 0 0}.tui-editor-socket .t-details-arrow{position:absolute;top:1.5rem;right:1.25rem;block-size:.575rem;inline-size:.575rem;border:.0625rem solid var(--tui-text-secondary);border-width:0 .125rem .125rem 0;transform:rotate(45deg);transition:var(--tui-duration, .3s);-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none}.tui-editor-socket .t-details-arrow:hover{border-color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete{position:absolute;top:1.4rem;right:2.7rem;block-size:1.125rem;inline-size:1.25rem;-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none;border:none}.tui-editor-socket .t-details-delete:hover:after{color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete:after{content:"\\d7";display:inline-block;font:inherit;font-size:2rem;color:var(--tui-text-secondary);block-size:100%;inline-size:100%;line-height:.8rem}.tui-editor-socket details{inline-size:100%;border:.0625rem solid var(--tui-border-normal);border-radius:var(--tui-radius-l)}.tui-editor-socket div[data-type=details-content]{padding:1.25rem;min-block-size:3rem;border:.0625rem solid var(--tui-border-normal);border-width:.0625rem 0 0}.tui-editor-socket div[data-type=details-content] h1:first-child,.tui-editor-socket div[data-type=details-content] h2:first-child,.tui-editor-socket div[data-type=details-content] pre:first-child,.tui-editor-socket div[data-type=details-content] ul:first-child,.tui-editor-socket div[data-type=details-content] ol:first-child,.tui-editor-socket div[data-type=details-content] ol li:first-child,.tui-editor-socket div[data-type=details-content] ul li:first-child{margin-top:0}.tui-editor-socket .t-details-wrapper{position:relative;display:flex}.tui-editor-socket .t-details-wrapper_rendered .t-details-arrow{pointer-events:none}.tui-editor-socket .t-details-wrapper_rendered summary{transition:transform var(--tui-duration, .3s);cursor:pointer;pointer-events:auto}.tui-editor-socket .t-details-wrapper_rendered summary:hover{background:var(--tui-background-base-alt)}.tui-editor-socket details[open]+.t-details-arrow{top:1.75rem;transform:rotate(225deg)}.tui-editor-socket pre{white-space:pre-wrap;word-break:break-word;border-radius:.25rem;margin:1rem 0;padding:.75rem 1rem;font-family:Courier,monospace;color:var(--tui-text-secondary);background:var(--tui-background-base-alt)}.tui-editor-socket .tui-group-node{display:flex;flex-direction:row}.tui-editor-socket .tui-group-node:hover>.tui-group-pointer{pointer-events:auto;opacity:1}.tui-editor-socket .tui-group-pointer{opacity:0;min-block-size:.8125rem;max-block-size:.8125rem;min-inline-size:.8125rem;max-inline-size:.8125rem;margin:.3125rem .3125rem 0 0;cursor:grab;background-image:url('data:image/svg+xml;charset=UTF-8,');background-repeat:no-repeat;background-size:contain;background-position:center}.tui-editor-socket [data-mode=onDark] .tui-group-pointer{background-image:url('data:image/svg+xml;charset=UTF-8,')}.t-hidden-editor{display:none;visibility:hidden;opacity:0;block-size:0;inline-size:100%;margin:0;padding:0} -`],encapsulation:2,changeDetection:0});let t=e;return t})();function g9(t,e){if(t&1){let i=q();E(0,"div",3)(1,"button",4),Y(2,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("left"))}),he(3," Left align "),w(),E(4,"button",4),Y(5,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("center"))}),he(6," Center align "),w(),E(7,"button",4),Y(8,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("right"))}),he(9," Right align "),w(),E(10,"button",4),Y(11,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("justify"))}),he(12," Justify align "),w()()}if(t&2){let i,n,r,o,s=_();C(),v("iconStart",s.options.icons.textAlignLeft)("tuiHint",(i=J(2,8,s.texts$))==null?null:i.justifyLeft),C(3),v("iconStart",s.options.icons.textAlignCenter)("tuiHint",(n=J(5,10,s.texts$))==null?null:n.justifyCenter),C(3),v("iconStart",s.options.icons.textAlignRight)("tuiHint",(r=J(8,12,s.texts$))==null?null:r.justifyRight),C(3),v("iconStart",s.options.icons.textAlignJustify)("tuiHint",(o=J(11,14,s.texts$))==null?null:o.justifyFull)}}var C2=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.alignState$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n,r,o,s;this.alignState$=In([((n=this.editor)==null?void 0:n.isActive$({textAlign:"left"}))??ce(!1),((r=this.editor)==null?void 0:r.isActive$({textAlign:"right"}))??ce(!1),((o=this.editor)==null?void 0:o.isActive$({textAlign:"center"}))??ce(!1),((s=this.editor)==null?void 0:s.isActive$({textAlign:"justify"}))??ce(!1)]).pipe(S(([a,u,l,c])=>({left:a,right:u,center:l,justify:c})))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-align-content"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:5,vars:6,consts:[["alignDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__align-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),O(3,g9,13,16,"ng-template",null,0,We),w()),r&2){let s,a=be(4);v("tuiDropdown",a)("tuiDropdownOpen",!1),C(),v("iconStart",o.options.icons.textAlignPreview)("tuiHint",(s=J(2,4,o.texts$))==null?null:s.justify)}},dependencies:[Re,Le,Ze,Tt,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function y9(t,e){if(t&1){let i=q();E(0,"button",5),x("click",function(){let r=P(i).index,o=_(2);return F(o.onCode(!!r))}),he(1),w()}if(t&2){let i=e.$implicit;C(),Nt(" ",i," ")}}function v9(t,e){if(t&1&&(E(0,"tui-data-list"),O(1,y9,2,1,"button",4),Y(2,"async"),w()),t&2){let i=_();C(),v("ngForOf",J(2,1,i.codeOptionsTexts$))}}var D2=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.codeOptionsTexts$=h(dS),this.hintText$=this.texts$.pipe(S(n=>n.code)),this.insideCode$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}onCode(n){var r;(r=this.editor)==null||r[n?"toggleCodeBlock":"toggleCode"]()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n,r;this.insideCode$=In({code:((n=this.editor)==null?void 0:n.isActive$("code"))??ce(!1),codeBlock:((r=this.editor)==null?void 0:r.isActive$("codeBlock"))??ce(!1)}).pipe(S(({code:o,codeBlock:s})=>o||s))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-code"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:6,consts:[["codes",""],["codesDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(r,o){if(r&1&&(E(0,"div",2,0),Q(2,"button",3),Y(3,"async"),O(4,v9,3,3,"ng-template",null,1,We),w()),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(2),v("iconStart",o.options.icons.code)("tuiHint",J(3,4,o.hintText$))}},dependencies:[Re,Ci,Le,Ms,Ss,Ze,Tt,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();var E2=(()=>{let e=class e{constructor(){this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.options=h(xe),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setDetails(){var n;(n=this.editor)==null||n.setDetails()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-details"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:2,vars:4,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","iconStart","tuiHint"]],template:function(r,o){if(r&1&&(E(0,"button",0),Y(1,"async"),x("click",function(){return o.setDetails()}),w()),r&2){let s;v("iconStart",o.options.icons.detailsAdd)("tuiHint",(s=J(1,2,o.texts$))==null?null:s.setDetails)}},dependencies:[Re,Le,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function b9(t,e){if(t&1){let i=q();E(0,"button",1),Y(1,"async"),x("click",function(){P(i);let r=_();return F(r.removeDetails())}),w()}if(t&2){let i=e.ngIf,n=_();v("disabled",!!J(1,3,n.disabled$))("iconStart",n.options.icons.detailsRemove)("tuiHint",i.removeDetails)}}var w2=(()=>{let e=class e{constructor(){this.localEditor=null,this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.options=h(xe),this.disabled$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}removeDetails(){var n;(n=this.editor)==null||n.removeDetails()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n;this.disabled$=((n=this.editor)==null?void 0:n.isActive$("details").pipe(S(r=>!r)))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-details-remove"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:2,vars:3,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"]],template:function(r,o){r&1&&(O(0,b9,2,5,"button",0),Y(1,"async")),r&2&&v("ngIf",J(1,1,o.texts$))},dependencies:[Re,ut,Le,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();var T2=()=>({});function _9(t,e){if(t&1){let i=q();E(0,"button",5),Y(1,"lowercase"),x("click",function(){let r=P(i).$implicit,o=_(2);return F(o.setFontOption(r))}),he(2),w()}if(t&2){let i=e.$implicit;Ye("font-family",i.family)("font-size",i.px,"px")("font-weight",i.weight),v("ngClass",(i==null?null:i.ngClass)||Qr(12,T2))("ngStyle",(i==null?null:i.ngStyle)||Qr(13,T2)),Ke("automation-id","tui_font__"+J(1,10,i.name||"")),C(2),Nt(" ",i.name," ")}}function C9(t,e){if(t&1&&(E(0,"tui-data-list"),O(1,_9,3,14,"button",4),Y(2,"async"),w()),t&2){let i=_();C(),v("ngForOf",J(2,1,i.fontsOptions$))}}var x2=(()=>{let e=class e{constructor(){this.fontOptionsTexts$=h(fS),this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.fontsOptions$=this.fontOptionsTexts$.pipe(S(n=>this.options.fontOptions(n))),this.fontText$=this.texts$.pipe(S(n=>n.font)),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setFontOption({headingLevel:n,px:r}){var s,a,u,l;let o=((s=this.editor)==null?void 0:s.getFontColor())??Fa;this.clearPreviousTextStyles(),n?(a=this.editor)==null||a.setHeading(n):(u=this.editor)==null||u.setParagraph({fontSize:ht(r??0)}),o!==Fa&&((l=this.editor)==null||l.setFontColor(o))}clearPreviousTextStyles(){var n,r;(n=this.editor)==null||n.removeEmptyTextStyle(),(r=this.editor)==null||r.toggleMark("textStyle")}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-font-size"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:6,consts:[["fonts",""],["fontsDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__font-size-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["tuiOption","","type","button",3,"ngClass","ngStyle","fontFamily","fontSize","fontWeight","click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click","ngClass","ngStyle"]],template:function(r,o){if(r&1&&(E(0,"div",2,0),Q(2,"button",3),Y(3,"async"),O(4,C9,3,3,"ng-template",null,1,We),w()),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(2),v("iconStart",o.options.icons.fontSize)("tuiHint",J(3,4,o.fontText$))}},dependencies:[Re,BT,FT,Ci,RT,Le,Ms,Ss,Ze,Tt,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function D9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleBold())}),he(1," Toggle bold "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleBold)("tuiHint",i.bold)}}function E9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleItalic())}),he(1," Toggle italic "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleItalic)("tuiHint",i.italic)}}function w9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleUnderline())}),he(1," Toggle underline "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleUnderline)("tuiHint",i.underline)}}function T9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleStrike())}),he(1," Toggle strike "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleStrike)("tuiHint",i.strikeThrough)}}function x9(t,e){if(t&1&&(E(0,"div",6),O(1,D9,2,2,"button",7)(2,E9,2,2,"button",7)(3,w9,2,2,"button",7)(4,T9,2,2,"button",7),w()),t&2){let i=_(3);C(),v("ngIf",i.isEnabled(i.editorTool.Bold)),C(),v("ngIf",i.isEnabled(i.editorTool.Italic)),C(),v("ngIf",i.isEnabled(i.editorTool.Underline)),C(),v("ngIf",i.isEnabled(i.editorTool.Strikethrough))}}function I9(t,e){if(t&1&&(E(0,"div",4,0),Q(2,"button",5),O(3,x9,5,4,"ng-template",null,1,We),w()),t&2){let i=be(4),n=_().ngIf,r=_();v("tuiDropdown",i)("tuiDropdownOpen",!1),C(2),v("iconStart",r.options.icons.fontStylePreview)("tuiHint",n.fontStyle)}}function S9(t,e){if(t&1&&(_t(0),O(1,I9,5,4,"div",3),Y(2,"async"),Ct()),t&2){let i=_();C(),v("ngIf",J(2,1,i.fontStyleState$))}}var I2=(()=>{let e=class e{constructor(){this.toolsSet=new Set(Tl),this.localEditor=null,this.editorTool=Oe,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.fontStyleState$=null}set inputEditor(n){this.localEditor=n,this.initStream()}set enabledTools(n){this.toolsSet=new Set(n)}get editor(){return this.injectionEditor??this.localEditor}ngOnInit(){this.initStream()}isEnabled(n){return this.toolsSet.has(n)}initStream(){var n,r,o,s;this.fontStyleState$=In([((n=this.editor)==null?void 0:n.isActive$("bold"))??ce(!1),((r=this.editor)==null?void 0:r.isActive$("italic"))??ce(!1),((o=this.editor)==null?void 0:o.isActive$("underline"))??ce(!1),((s=this.editor)==null?void 0:s.isActive$("strike"))??ce(!1)]).pipe(S(([a,u,l,c])=>({bold:a,italic:u,underline:l,strike:c})))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-font-style"]],inputs:{inputEditor:[0,"editor","inputEditor"],enabledTools:"enabledTools"},decls:2,vars:3,consts:[["format",""],["formatDropdown",""],[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__font-style-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button","class","t-option t-option_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"]],template:function(r,o){r&1&&(O(0,S9,3,3,"ng-container",2),Y(1,"async")),r&2&&v("ngIf",J(1,1,o.texts$))},dependencies:[Re,ut,Le,Ze,Tt,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();var S2=(()=>{let e=class e{constructor(){this.localEditor=null,this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.options=h(xe),this.insertGroupText$=this.texts$.pipe(S(n=>n.insertGroup)),this.removeGroupText$=this.texts$.pipe(S(n=>n.removeGroup)),this.disabled$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}addGroup(){var n;(n=this.editor)==null||n.setGroup()}removeGroup(){var n;(n=this.editor)==null||n.removeGroup()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n;this.disabled$=((n=this.editor)==null?void 0:n.isActive$("group").pipe(S(r=>!r)))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-editor-group-tool"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:5,vars:11,consts:[["appearance","icon","automation-id","toolbar__group-add-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__group-remove-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"]],template:function(r,o){r&1&&(E(0,"button",0),Y(1,"async"),x("click",function(){return o.addGroup()}),w(),E(2,"button",1),Y(3,"async"),Y(4,"async"),x("click",function(){return o.removeGroup()}),w()),r&2&&(v("iconStart",o.options.icons.groupAdd)("tuiHint",J(1,5,o.insertGroupText$)),C(2),v("disabled",!!J(3,7,o.disabled$))("iconStart",o.options.icons.groupRemove)("tuiHint",J(4,9,o.removeGroupText$)))},dependencies:[Re,Le,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();var v0e=W({AD:"+376###-###",AE:"+971-##-###-####",AF:"+93##-###-####",AG:"+1(268) ###-####",AI:"+1(264) ###-####",AL:"+355(###) ###-###",AM:"+374##-###-###",AO:"+244(###) ###-###",AR:"+54(###) ####-####",AT:"+43(###) ###-####",AU:"+61#-####-####",AW:"+297###-####",AZ:"+994##-###-##-##",BA:"+387 ###-####-##",BB:"+1(246) ###-####",BD:"+880##-###-###",BE:"+32(###) ###-###",BF:"+226##-##-####",BG:"+359(###) ###-###",BH:"+973####-####",BI:"+257##-##-####",BJ:"+229##-##-####",BL:"+590 ## ## ## ## ##",BM:"+1(441) ###-####",BN:"+673###-####",BO:"+591#-###-####",BQ:"+599-###-####",BR:"+55(##) ####-####",BS:"+1(242) ###-####",BT:"+975#-###-###",BW:"+267##-###-###",BY:"+375(##) ###-##-##",BZ:"+501###-####",CA:"+1(###) ###-####",CD:"+243(###) ###-###",CF:"+236-##-##-####",CG:"+242##-###-####",CH:"+41##-###-####",CI:"+225##-##-###-###",CL:"+56#-####-####",CM:"+237#####-####",CN:"+86(###) ####-####",CO:"+57(###) ###-####",CR:"+506####-####",CU:"+53#-###-####",CV:"+238(###) ##-##",CW:"+5999-###-####",CY:"+357##-###-###",CZ:"+420(###) ###-###",DE:"+49(###) ###-###-##",DJ:"+253##-##-##-##",DK:"+45##-##-##-##",DM:"+1(767) ###-####",DO:"+1(###) ###-####",DZ:"+213##-###-####",EC:"+593##-###-####",EE:"+372####-####",EG:"+20(###) ###-####",ER:"+291#-###-###",ES:"+34(###) ###-###",ET:"+251##-###-####",FI:"+358(###) ###-##-##",FJ:"+679##-#####",FK:"+500#####",FM:"+691###-####",FR:"+33 ## ## ## ## ##",GA:"+241##-##-##-##",GB:"+44##-####-####",GD:"+1(473) ###-####",GE:"+995(###) ###-###",GF:"+594 ## ## ## ## ##",GH:"+233(###) ###-###",GI:"+350###-#####",GL:"+299##-##-##",GM:"+220(###) ##-##",GN:"+224##-###-###",GP:"+590 ## ## ## ## ##",GQ:"+240##-###-####",GR:"+30(###) ###-####",GT:"+502#-###-####",GW:"+245#-######",GY:"+592###-####",HK:"+852####-####",HN:"+504####-####",HR:"+385##-###-####",HT:"+509##-##-####",HU:"+36(###) ###-###",ID:"+62(###) ###-##-###",IE:"+353(###) ###-###",IL:"+972##-###-####",IN:"+91(####) ###-###",IQ:"+964(###) ###-####",IR:"+98(###) ###-####",IS:"+354###-####",IT:"+39(###) ####-###",JM:"+1(876) ###-####",JO:"+962#-####-####",JP:"+81-##-####-####",KE:"+254###-######",KG:"+996(###) ###-###",KH:"+855##-###-###",KM:"+269##-#####",KN:"+1(869) ###-####",KP:"+850####-#############",KR:"+82##-###-####",KW:"+965####-####",KY:"+1(345) ###-####",KZ:"+7(###) ###-##-##",LA:"+856##-##-###-###",LB:"+961##-###-###",LC:"+1(758) ###-####",LI:"+423(###) ###-####",LK:"+94##-###-####",LR:"+231##-###-###",LS:"+266#-###-####",LT:"+370(###) ##-###",LU:"+352(###) ###-###",LV:"+371##-###-###",LY:"+218##-###-####",MA:"+212##-####-###",MC:"+377###-###-###",MD:"+373####-####",ME:"+382##-###-###",MF:"+590 ## ## ## ## ##",MG:"+261##-##-#####",MK:"+389##-###-###",ML:"+223##-##-####",MM:"+95##-###-###",MN:"+976##-##-####",MO:"+853####-####",MQ:"+596 ## ## ## ## ##",MR:"+222##-##-####",MS:"+1(664) ###-####",MT:"+356####-####",MU:"+230####-####",MV:"+960###-####",MW:"+265#-####-####",MX:"+52(###) ###-####",MY:"+60(###) ###-###",MZ:"+258##-###-###",NA:"+264##-###-####",NC:"+687 ### ###",NE:"+227##-##-####",NG:"+234(###) ###-####",NI:"+505####-####",NL:"+31##-###-####",NO:"+47(###) ##-###",NP:"+977##-###-###",NZ:"+64(###) ###-####",OM:"+968##-###-###",PA:"+507###-####",PE:"+51(###) ###-###",PF:"+689 ## ## ## ##",PG:"+675(###) ##-###",PH:"+63(###) ###-####",PK:"+92(###) ###-####",PL:"+48(###) ###-###",PT:"+351##-###-####",PW:"+680###-####",PY:"+595(###) ###-###",QA:"+974####-####",RE:"+262 ## ## ## ## ##",RO:"+40##-###-####",RS:"+381##-###-####",RU:"+7### ###-##-##",RW:"+250(###) ###-###",SA:"+966#-####-####",SB:"+677###-####",SC:"+248#-###-###",SD:"+249##-###-####",SE:"+46##-###-####",SG:"+65####-####",SH:"+290####",SI:"+386##-###-###",SK:"+421(###) ###-###",SL:"+232##-######",SM:"+378####-######",SN:"+221##-###-####",SO:"+252##-###-###",SR:"+597###-####",ST:"+239##-#####",SV:"+503##-##-####",SX:"+1(721) ###-####",SY:"+963##-####-###",SZ:"+268##-##-####",TC:"+1(649) ###-####",TD:"+235##-##-##-##",TG:"+228##-###-###",TH:"+66##-###-####",TJ:"+992##-###-####",TL:"+670###-#####",TM:"+993#-###-####",TN:"+216##-###-###",TO:"+676#####",TR:"+90(###) ###-####",TT:"+1(868) ###-####",TW:"+886#-####-####",TZ:"+255##-###-####",UA:"+380(##) ###-##-##",UG:"+256(###) ###-###",US:"+1(###) ###-####",UY:"+598#-###-##-##",UZ:"+998##-###-####",VC:"+1(784) ###-####",VE:"+58(###) ###-####",VG:"+1(284)###-####",VN:"+84(###) ####-###",VU:"+678##-#####",WS:"+685##-####",XK:"+383##-###-###",YE:"+967###-###-###",YT:"+262 ## ## ## ## ##",ZA:"+27##-###-####",ZM:"+260##-###-####",ZW:"+263#-######",VA:"+39 #### ###-####",WF:"+681 ## ##-##",VI:"+1(340) ###-####",JE:"+44(####) ######",AC:"+247###-####",TV:"+686###-####",TK:"+690###-####",TA:"+290###-####",SS:"+211### ###-###",SJ:"+47 ## ##-##-##",PS:"+970 #### ###-###",PR:"+1(###) ###-####",PM:"+508 ### ##-##-##",NU:"+683 ###-####",NR:"+674 ###-####",NF:"+672##-####",MP:"+1(670) ###-####",MH:"+692 ###-####",KI:"+686 ####-####",IO:"+246 ### ####",IM:"+44(####) ######",GU:"+1(###) ###-###",GG:"+44(###) ###-####",FO:"+298 ######",EH:"+212 #### #####",CX:"+61 # ####-####",CK:"+682 ## ###",CC:"+61 # ####-####",AX:"+358 ## ###-####",AS:"+1(###) ###-####"}),Xv=W();function M2(t){return De(Xv,t)}var A2=B(()=>{var t;return yn(((t=h(qe).fonts)==null?void 0:t.ready)||sn).pipe(Li({bufferSize:1,refCount:!1}))}),b0e=W({}),_0e=B(()=>Cx(h(Ao))),C0e=B(()=>!!h(Je).chrome),D0e=B(()=>{var t;return((t=h(Je))==null?void 0:t.mozCancelFullScreen)!==void 0}),E0e=B(()=>h(Je).location.host.endsWith("stackblitz.io")),w0e=W();var T0e=W(),k2=W("textfield"),O2=W();function N2(t){return De(O2,t)}var x0e=B(()=>h(Je).matchMedia("(any-pointer: coarse)").matches),I0e=W();var M9="tui_interactive_",Jv=(()=>{let e=class e{constructor(){this.autoIdString=`${M9}${e.autoId++}${Date.now()}`,this.focusVisible=!1,this.pseudoHover=null,this.pseudoActive=null,this.pseudoFocus=null,this.focusable=!0,this.nativeId="",this.focusedChange=new _e,this.focusVisibleChange=new _e}get computedDisabled(){return this.disabled}get computedFocused(){return!this.computedDisabled&&(this.pseudoFocus??this.focused)}get computedFocusVisible(){return!this.computedDisabled&&(this.pseudoFocus??this.focusVisible)}get computedFocusable(){return!this.computedDisabled&&(this.focusable||this.focused)}get id(){return this.nativeId||this.autoIdString}updateFocused(n){this.focusedChange.emit(n)}updateFocusVisible(n){this.focusVisible!==n&&(this.focusVisible=n,this.focusVisibleChange.emit(n))}};e.autoId=0,e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,hostVars:7,hostBindings:function(r,o){r&2&&(Ke("data-focused",o.pseudoFocus),Te("_disabled",o.computedDisabled)("_focused",o.computedFocused)("_focus-visible",o.computedFocusVisible))},inputs:{pseudoHover:"pseudoHover",pseudoActive:"pseudoActive",pseudoFocus:"pseudoFocus",focusable:"focusable",nativeId:"nativeId"},outputs:{focusedChange:"focusedChange",focusVisibleChange:"focusVisibleChange"},standalone:!1});let t=e;return t})(),Vp=(()=>{let e=class e extends Jv{constructor(){super(),this.ngControl=h(an,{optional:!0}),this.refresh$=new tt,this.onTouched=Sa,this.onChange=Sa,this.fallbackValue=this.getFallbackValue(),this.destroyRef=h(it),this.cdr=h(st),this.valueTransformer=h(vl,{optional:!0}),this.readOnly=!1,this.pseudoInvalid=null,this.update$=new tt,this.ngControl&&(this.ngControl.valueAccessor=this)}get computedInvalid(){return this.interactive&&(this.pseudoInvalid!==null?this.pseudoInvalid:this.touched&&this.invalid)}get value(){return this.previousInternalValue??this.fallbackValue}set value(n){this.updateValue(n),this.update$.next()}get safeCurrentValue(){return this.rawValue??this.fallbackValue}get invalid(){return this.safeNgControlData(({invalid:n})=>n,!1)}get valid(){return this.safeNgControlData(({valid:n})=>n,!1)}get touched(){return this.safeNgControlData(({touched:n})=>n,!1)}get disabled(){return this.safeNgControlData(({disabled:n})=>n,!1)}get interactive(){return!this.readOnly&&!this.computedDisabled}get control(){return this.safeNgControlData(({control:n})=>n,null)}get computedName(){var n;return((n=this.controlName)==null?void 0:n.toString())??null}get controlName(){var n,r;return((r=(n=this.ngControl)==null?void 0:n.name)==null?void 0:r.toString())??null}ngOnInit(){this.refresh$.pipe(Jn(0),dt(null),S(()=>{var n;return(n=this.ngControl)==null?void 0:n.control}),ot(si),ke(),bt(n=>nt(n.valueChanges,n.statusChanges,n.events||sn)),Se(this.destroyRef)).subscribe(()=>{this.refreshLocalValue(this.safeCurrentValue)})}checkControlUpdate(){this.cdr.markForCheck()}registerOnChange(n){this.onChange=r=>{n(this.toControlValue(r))},this.refresh$.next()}registerOnTouched(n){this.onTouched=n}setDisabledState(){this.checkControlUpdate()}writeValue(n){let r=this.ngControl instanceof _r&&this.previousInternalValue===void 0?this.ngControl.model:n;this.refreshLocalValue(this.fromControlValue(r))}updateFocused(n){n||this.controlMarkAsTouched(),super.updateFocused(n)}updateValue(n){this.disabled||this.valueIdenticalComparator(this.value,n)||(this.previousInternalValue=n,this.controlSetValue(n))}valueIdenticalComparator(n,r){return n===r}get rawValue(){let{ngControl:n}=this;if(n===null)return;let r=n instanceof _r&&this.previousInternalValue===void 0?n.viewModel:n.value;return this.fromControlValue(r)}safeNgControlData(n,r){return(this.ngControl&&n(this.ngControl))??r}controlMarkAsTouched(){this.onTouched(),this.checkControlUpdate()}controlSetValue(n){this.onChange(n),this.checkControlUpdate()}refreshLocalValue(n){this.previousInternalValue=n,this.checkControlUpdate()}fromControlValue(n){return this.valueTransformer?this.valueTransformer.fromControlValue(n):n}toControlValue(n){return this.valueTransformer?this.valueTransformer.toControlValue(n):n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,hostVars:4,hostBindings:function(r,o){r&2&&Te("_readonly",o.readOnly)("_invalid",o.computedInvalid)},inputs:{readOnly:"readOnly",pseudoInvalid:"pseudoInvalid"},standalone:!1,features:[oe]});let t=e;return t})();function V0e(t){return[De(Vp,t),De(bl,t)]}var P2=(()=>{let e=class e{constructor(){this.host=h(Vp,{optional:!0})}get readOnly(){return this.host.readOnly}get disabled(){return this.host.computedDisabled}get invalid(){return this.host.computedInvalid}get focusable(){return this.host.computedFocusable}get inputMode(){return"text"}get value(){var n;return((n=this.host.value)==null?void 0:n.toString())||""}process(n){}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1});let t=e;return t})(),tr=(()=>{let e=class e{constructor(){this.change$=new tt}ngOnChanges(){this.change$.next()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1,features:[Yt]});let t=e;return t})(),z0e=(()=>{let e=class e extends Vp{clear(){this.value=[]}getFallbackValue(){return[]}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,standalone:!1,features:[oe]});let t=e;return t})();var j0e=(()=>{let e=class e extends Vp{getFallbackValue(){return null}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,standalone:!1,features:[oe]});let t=e;return t})();var eb=class{constructor(e,i,n,r,o,s,a,u,l,c,f,p,m){this.change$=e,this.options=i,this.legacyAppearance=n,this.appearanceDirective=r,this.cleanerDirective=o,this.customContentDirective=s,this.iconDirective=a,this.iconLeftDirective=u,this.labelOutsideDirective=l,this.sizeDirective=c,this.prefixDirective=f,this.postfixDirective=p,this.fillerDirective=m}get appearance(){return this.appearanceDirective.appearance||this.legacyAppearance}get cleaner(){return this.cleanerDirective.cleaner}get customContent(){return this.customContentDirective.customContent||""}get icon(){return this.iconDirective.icon}get iconStart(){return this.iconLeftDirective.iconStart}get labelOutside(){return this.labelOutsideDirective.labelOutside}get size(){return this.sizeDirective.size}get prefix(){return this.prefixDirective.prefix}get postfix(){return this.postfixDirective.postfix}get filler(){return this.fillerDirective.filler}},F2={iconCleaner:"@tui.x",hintOnDisabled:!1},tb=W(F2);var R2=B(()=>new A9),A9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.appearance=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldAppearance",""]],inputs:{appearance:[0,"tuiTextfieldAppearance","appearance"]},standalone:!1,features:[Z([De(R2,e)]),oe]});let t=e;return t})(),L2=B(()=>new k9),k9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.cleaner=!1}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldCleaner",""]],inputs:{cleaner:[0,"tuiTextfieldCleaner","cleaner"]},standalone:!1,features:[Z([De(L2,e)]),oe]});let t=e;return t})(),H2=B(()=>new O9),O9=(()=>{let e=class e extends tr{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldCustomContent",""]],inputs:{customContent:[0,"tuiTextfieldCustomContent","customContent"]},standalone:!1,features:[Z([De(H2,e)]),oe]});let t=e;return t})(),B2=B(()=>new N9),N9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.filler=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldFiller",""]],inputs:{filler:[0,"tuiTextfieldFiller","filler"]},standalone:!1,features:[Z([De(B2,e)]),oe]});let t=e;return t})(),V2=B(()=>new P9),P9=(()=>{let e=class e extends tr{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldIcon",""]],inputs:{icon:[0,"tuiTextfieldIcon","icon"]},standalone:!1,features:[Z([De(V2,e)]),oe]});let t=e;return t})(),z2=B(()=>new F9),F9=(()=>{let e=class e extends tr{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldIconLeft",""]],inputs:{iconStart:[0,"tuiTextfieldIconLeft","iconStart"]},standalone:!1,features:[Z([De(z2,e)]),oe]});let t=e;return t})(),j2=B(()=>new R9),R9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.labelOutside=!1}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldLabelOutside",""]],inputs:{labelOutside:[0,"tuiTextfieldLabelOutside","labelOutside"]},standalone:!1,features:[Z([De(j2,e)]),oe]});let t=e;return t})(),U2=B(()=>new L9),L9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.postfix=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldPostfix",""]],inputs:{postfix:[0,"tuiTextfieldPostfix","postfix"]},standalone:!1,features:[Z([De(U2,e)]),oe]});let t=e;return t})(),$2=B(()=>new H9),H9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.prefix=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldPrefix",""]],inputs:{prefix:[0,"tuiTextfieldPrefix","prefix"]},standalone:!1,features:[Z([De($2,e)]),oe]});let t=e;return t})(),G2=B(()=>new B9),B9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.size="l"}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldSize",""]],inputs:{size:[0,"tuiTextfieldSize","size"]},standalone:!1,features:[Z([De(G2,e)]),oe]});let t=e;return t})(),ege=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({});let t=e;return t})(),nb=W(),W2=[{provide:nb,deps:[st,tb,k2,R2,L2,H2,V2,z2,j2,G2,$2,U2,B2],useFactory:(t,e,i,...n)=>{let r=nt(...n.map(({change$:o})=>o||Du)).pipe(Jr(t),Se());return r.subscribe(),new eb(r,e,i,...n)}}];var q2=(()=>{let e=class e{constructor(){this.disabled=!1,this.readOnly=!1,this.hover=null,this.active=null,this.focus=!1,this.invalid=!1,this.appearance=""}get computedInvalid(){return!this.disabled&&!this.readOnly&&this.invalid}get computedFocused(){return this.focus&&!this.disabled}get interactiveState(){return this.disabled?"disabled":this.readOnly?"readonly":this.active?"active":this.hover?"hover":null}get noHover(){return this.readOnly||this.hover===!1}get noActive(){return this.readOnly||this.active===!1}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiWrapper",""]],hostAttrs:["tuiAppearance",""],hostVars:10,hostBindings:function(r,o){r&2&&(Ke("data-appearance",o.appearance)("data-state",o.interactiveState),Te("_invalid",o.computedInvalid)("_focused",o.computedFocused)("_no-hover",o.noHover)("_no-active",o.noActive))},inputs:{disabled:"disabled",readOnly:"readOnly",hover:"hover",active:"active",focus:"focus",invalid:"invalid",appearance:"appearance"},standalone:!1});let t=e;return t})(),Z2=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({});let t=e;return t})();var oge={DMY:"dd/mm/yyyy",MDY:"mm/dd/yyyy",YMD:"yyyy/mm/dd"};var ib=1.5,z9=2.5;function K2(t,e=!1,i=!1,n=!1,r="m"){let o=r==="s"?0:.25,s=0;return t&&(s+=ib+o),e&&(s+=ib+o),i&&(s+=ib+o),n&&(s+=z9+o),s}var sge=`?v=${dx}`;var age=Hv({limitWidth:"fixed",align:"right"});var Y2=(()=>{let e=class e extends kp{constructor(){super(...arguments),this.describeId=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-tooltip"]],inputs:{content:"content",direction:"direction",appearance:"appearance",showDelay:"showDelay",hideDelay:"hideDelay",describeId:"describeId",context:"context"},standalone:!1,features:[oe],decls:1,vars:7,consts:[["automation-id","tui-tooltip__icon",3,"tuiHintAppearance","tuiHintContext","tuiHintDirection","tuiHintHideDelay","tuiHintShowDelay","tuiTooltip","tuiTooltipDescribe"]],template:function(r,o){r&1&&Q(0,"tui-icon",0),r&2&&v("tuiHintAppearance",o.appearance||"")("tuiHintContext",o.context)("tuiHintDirection",o.direction)("tuiHintHideDelay",o.hideDelay)("tuiHintShowDelay",o.showDelay)("tuiTooltip",o.content)("tuiTooltipDescribe",o.describeId)},dependencies:[Vo,a2],encapsulation:2,changeDetection:0});let t=e;return t})(),Q2=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({imports:[Vo]});let t=e;return t})();var U9=["pre"],$9=["focusableElement"],G9=[[["input"]],[["select"]],[["tuiContent"]],"*"],W9=["input","select","tuiContent","*"],q9=()=>({standalone:!0}),rb=t=>({$implicit:t});function Z9(t,e){t&1&&Qt(0)}function K9(t,e){t&1&&Qt(0)}function Y9(t,e){if(t&1&&Q(0,"tui-icon",19),t&2){let i=e.polymorpheusOutlet;v("icon",i.toString())}}function Q9(t,e){if(t&1&&(E(0,"div",17),O(1,Y9,1,1,"tui-icon",18),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.iconLeftContent)("polymorpheusOutletContext",Kn(2,rb,i.size))}}function X9(t,e){if(t&1&&(E(0,"label",20),at(1,3),w()),t&2){let i=_();Te("t-placeholder_raised",i.placeholderRaised),v("for",i.computedId)}}function J9(t,e){if(t&1&&Q(0,"tui-icon",23),t&2){let i=e.polymorpheusOutlet;v("icon",i)}}function ez(t,e){if(t&1&&(E(0,"div",21),O(1,J9,1,1,"tui-icon",22),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.controller.customContent)}}function tz(t,e){if(t&1&&Q(0,"tui-icon",26),t&2){let i=e.polymorpheusOutlet;Ye("border","0.25rem solid transparent"),v("icon",i.toString())}}function nz(t,e){if(t&1){let i=q();E(0,"span",24),x("click.stop",function(){P(i);let r=_();return F(r.clear())}),O(1,tz,1,3,"tui-icon",25),w()}if(t&2){let i=_();C(),v("polymorpheusOutlet",i.iconCleaner||i.controller.options.iconCleaner)("polymorpheusOutletContext",Kn(2,rb,i.size))}}function iz(t,e){if(t&1&&Q(0,"tui-tooltip",27),t&2){let i=_();v("content",i.hintOptions==null?null:i.hintOptions.content)("describeId",i.computedId)}}function rz(t,e){if(t&1&&Q(0,"tui-icon",19),t&2){let i=e.polymorpheusOutlet;v("icon",i.toString())}}function oz(t,e){if(t&1&&(E(0,"div",28),O(1,rz,1,1,"tui-icon",18),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.iconContent)("polymorpheusOutletContext",Kn(2,rb,i.size))}}var sz=(()=>{let e=class e{constructor(){this.textfield=h(Xv),this.fontsReady$=h(A2),this.prefix$=new on(""),this.pre$=nt(this.fontsReady$,this.prefix$).pipe(Jn(0),ot(()=>{var n;return!!((n=this.pre)!=null&&n.nativeElement.isConnected)}),S(()=>{var n;return((n=this.pre)==null?void 0:n.nativeElement.offsetWidth)||0}),ke())}ngDoCheck(){this.prefix$.next(this.prefix)}get isContextTable(){return this.textfield.appearance==="table"}get filler(){let{focused:n,placeholder:r,exampleText:o,value:s,textfield:a}=this;return r&&o?"":n?o||a.filler.slice(s.length):""}get value(){return this.textfield.value}get prefix(){return this.decorationsVisible?this.textfield.prefix:""}get postfix(){return this.decorationsVisible?this.computedPostfix:""}get placeholder(){var n;return((n=this.textfield.nativeFocusableElement)==null?void 0:n.placeholder)||""}get exampleText(){return!this.value&&this.focused?this.placeholder:""}get decorationsVisible(){return!!this.value||this.focused&&!this.placeholder}get focused(){return this.textfield.computedFocused&&!this.textfield.readOnly}get computedPostfix(){return this.textfield.postfix&&(this.filler||this.value)?` ${this.textfield.postfix}`:this.textfield.postfix}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-value-decoration"]],viewQuery:function(r,o){if(r&1&&Gt(U9,7,de),r&2){let s;Qe(s=Xe())&&(o.pre=s.first)}},hostVars:4,hostBindings:function(r,o){r&1&&x("animationstart",function(){return o.ngDoCheck()}),r&2&&Te("_table",o.isContextTable)("_filler",o.filler)},standalone:!1,decls:5,vars:4,consts:[["pre",""],[1,"t-prefix",3,"textContent"],[1,"t-ghost",3,"textContent"],[1,"t-filler",3,"textContent"],[1,"t-postfix",3,"textContent"]],template:function(r,o){r&1&&Q(0,"span",1,0)(2,"span",2)(3,"span",3)(4,"span",4),r&2&&(v("textContent",o.prefix),C(2),v("textContent",o.value),C(),v("textContent",o.filler),C(),v("textContent",o.postfix))},styles:['[_nghost-%COMP%]{position:absolute;display:block;inline-size:100%;line-height:var(--tui-height);margin-top:calc(var(--tui-height) / -2);box-sizing:content-box;color:var(--tui-text-tertiary);animation:tuiPresent 1s;white-space:nowrap}._table[_nghost-%COMP%]{position:static;margin-top:0}._filler[_nghost-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}tui-primitive-textfield[data-size="m"]:not(._label-outside) [_nghost-%COMP%]{line-height:calc(var(--tui-height) - .25rem)}.t-ghost[_ngcontent-%COMP%]{visibility:hidden;white-space:pre;text-overflow:clip}.t-prefix[_ngcontent-%COMP%], .t-postfix[_ngcontent-%COMP%]{white-space:pre;color:var(--tui-text-primary)}.t-filler[_ngcontent-%COMP%]{max-inline-size:100%;white-space:nowrap}']});let t=e;return t})(),az={s:1.25,m:1.75,l:2.25},uz=(()=>{let e=class e extends Jv{constructor(){super(...arguments),this.legacyOptions=h(tb),this.el=Ee(),this.options=h(Op),this.controller=h(nb),this.hintOptions=h(kp,{optional:!0}),this.autofilled=!1,this.editable=!0,this.iconCleaner=this.legacyOptions.iconCleaner,this.readOnly=!1,this.invalid=!1,this.disabled=!1,this.value="",this.valueChange=new _e}get prefix(){return this.controller.prefix}get postfix(){return this.controller.postfix}get filler(){return this.controller.filler}get nativeFocusableElement(){if(this.computedDisabled||!this.focusableElement)return null;let{nativeElement:n}=this.focusableElement;return n.previousElementSibling||n}get focused(){return Ki(this.el)}get appearance(){return this.options.appearance()==="table"?"table":this.controller.appearance}onModelChange(n){this.updateValue(n)}get size(){return this.controller.size}get computedInvalid(){return!this.readOnly&&!this.disabled&&this.invalid}get inputHidden(){var n;return!!((n=this.content)!=null&&n.length)}get borderStart(){return this.iconLeftContent?this.iconPaddingLeft:0}get borderEnd(){return K2(!!this.iconContent,this.hasCleaner,this.hasTooltip,this.hasCustomContent,this.size)}get hasValue(){return!!this.value}get hasCleaner(){return this.controller.cleaner&&this.hasValue&&!this.computedDisabled&&!this.readOnly}get hasTooltip(){var n;return!!((n=this.hintOptions)!=null&&n.content)&&!this.computedDisabled}get hasCustomContent(){return!!this.controller.customContent}get placeholderVisible(){var o;let r=(((o=this.nativeFocusableElement)==null?void 0:o.placeholder)||this.prefix||this.postfix||this.filler)&&!this.readOnly&&this.computedFocused;return!this.hasValue&&!r}get hasPlaceholder(){return this.placeholderRaisable||this.placeholderVisible}get placeholderRaised(){return this.placeholderRaisable&&(this.computedFocused&&!this.readOnly||this.hasValue||this.autofilled)}get iconContent(){return this.controller.icon}get iconLeftContent(){return this.controller.iconStart}get showHint(){var n;return!!((n=this.hintOptions)!=null&&n.content)&&(this.legacyOptions.hintOnDisabled||!this.computedDisabled)}get name(){var n;return((n=this.nativeFocusableElement)==null?void 0:n.autocomplete)==="cc-exp"?"ccexpiryyear":null}get computedId(){var n;return((n=this.nativeFocusableElement)==null?void 0:n.id)||""}getIndent$(n){return ct(n,"scroll").pipe(S(()=>-1*Math.max(n.scrollLeft,0)))}onFocused(n){this.updateFocused(n)}clear(){this.nativeFocusableElement&&(this.nativeFocusableElement.value=""),this.updateValue("")}onMouseDown(n){let{nativeFocusableElement:r}=this;!r||n.target===r||(n.preventDefault(),r.focus())}transitionStartHandler({propertyName:n,target:r}){n.includes("box-shadow")&&(r==null?void 0:r.matches("input"))&&this.onAutofilled(!this.autofilled)}onAutofilled(n){this.updateAutofilled(n)}detectRetargetFromLabel(n){xx(n)&&n.stopImmediatePropagation()}get iconPaddingLeft(){return az[this.size]}get placeholderRaisable(){return this.size!=="s"&&!this.controller.labelOutside}updateAutofilled(n){this.autofilled!==n&&(this.autofilled=n)}updateValue(n){this.value=n,this.valueChange.emit(n)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-primitive-textfield"]],contentQueries:function(r,o,s){if(r&1&&_n(s,Rn,5),r&2){let a;Qe(a=Xe())&&(o.content=a)}},viewQuery:function(r,o){if(r&1&&Gt($9,5),r&2){let s;Qe(s=Xe())&&(o.focusableElement=s.first)}},hostVars:15,hostBindings:function(r,o){r&1&&x("focusin",function(){return o.onFocused(!0)})("focusout",function(){return o.onFocused(!1)})("transitionstart.capture",function(a){return o.transitionStartHandler(a)}),r&2&&(Ke("data-size",o.size),Ye("--border-start",o.borderStart,"rem")("--border-end",o.borderEnd,"rem"),Te("_readonly",o.readOnly)("_hidden",o.inputHidden)("_invalid",o.computedInvalid)("_autofilled",o.autofilled)("_label-outside",o.options.appearance()==="table"||o.controller.labelOutside))},inputs:{editable:"editable",iconCleaner:"iconCleaner",readOnly:"readOnly",invalid:"invalid",disabled:"disabled",value:"value"},outputs:{valueChange:"valueChange"},standalone:!1,features:[Z([M2(e),W2]),oe],ngContentSelectors:W9,decls:25,vars:40,consts:[["focusableElement",""],["decor",""],[4,"ngIf"],["automation-id","tui-primitive-textfield__wrapper","tuiWrapper","",3,"click.prevent.silent","mousedown","active","appearance","disabled","focus","hover","invalid","readOnly"],["automation-id","tui-primitive-textfield__native-input",1,"t-input",3,"ngModelChange","disabled","id","ngModel","ngModelOptions","readOnly","tabIndex"],["automation-id","tui-primitive-textfield__value",1,"t-input","t-input_template"],[1,"t-content"],["class","t-icon t-icon_left t-textfield-icon",4,"ngIf"],[1,"t-wrapper"],["automation-id","tui-primitive-textfield__placeholder","class","t-placeholder",3,"t-placeholder_raised","for",4,"ngIf"],[1,"t-wrapper-value-decoration"],["aria-hidden","true","automation-id","tui-primitive-textfield__value-decoration",1,"t-value-decoration"],[1,"t-icons"],["automation-id","tui-primitive-textfield__custom-content","class","t-custom-content",4,"ngIf"],["appearance","icon","automation-id","tui-primitive-textfield__cleaner","tuiWrapper","","class","t-cleaner",3,"click.stop",4,"ngIf"],["automation-id","tui-primitive-textfield__tooltip","class","t-tooltip",3,"content","describeId",4,"ngIf"],["class","t-icon t-textfield-icon",4,"ngIf"],[1,"t-icon","t-icon_left","t-textfield-icon"],["tuiAppearance","icon",3,"icon",4,"polymorpheusOutlet","polymorpheusOutletContext"],["tuiAppearance","icon",3,"icon"],["automation-id","tui-primitive-textfield__placeholder",1,"t-placeholder",3,"for"],["automation-id","tui-primitive-textfield__custom-content",1,"t-custom-content"],["class","t-custom-icon",3,"icon",4,"polymorpheusOutlet"],[1,"t-custom-icon",3,"icon"],["appearance","icon","automation-id","tui-primitive-textfield__cleaner","tuiWrapper","",1,"t-cleaner",3,"click.stop"],[3,"icon","border",4,"polymorpheusOutlet","polymorpheusOutletContext"],[3,"icon"],["automation-id","tui-primitive-textfield__tooltip",1,"t-tooltip",3,"content","describeId"],[1,"t-icon","t-textfield-icon"]],template:function(r,o){if(r&1){let s=q();Xt(G9),O(0,Z9,1,0,"ng-container",2),Y(1,"async"),O(2,K9,1,0,"ng-container",2),Y(3,"async"),E(4,"div",3),Y(5,"async"),x("click.prevent.silent",function(u){return P(s),F(o.detectRetargetFromLabel(u))})("mousedown",function(u){return P(s),F(o.onMouseDown(u))}),at(6),at(7,1),E(8,"input",4,0),x("ngModelChange",function(u){return P(s),F(o.onModelChange(u))}),w(),E(10,"div",5),at(11,2),w(),E(12,"div",6),O(13,Q9,2,4,"div",7),E(14,"div",8),O(15,X9,2,3,"label",9),E(16,"div",10),Q(17,"tui-value-decoration",11,1),Y(19,"async"),w()(),E(20,"div",12),O(21,ez,2,1,"div",13)(22,nz,2,4,"span",14)(23,iz,1,2,"tui-tooltip",15)(24,oz,2,4,"div",16),w()()()}if(r&2){let s=be(9),a=be(18);v("ngIf",J(1,31,o.content==null?null:o.content.changes)),C(2),v("ngIf",J(3,33,o.hintOptions==null?null:o.hintOptions.change$)),C(2),Ye("--text-indent",J(5,35,a.pre$),"px"),v("active",o.pseudoActive)("appearance",o.appearance)("disabled",o.disabled)("focus",o.computedFocused)("hover",o.pseudoHover)("invalid",o.computedInvalid)("readOnly",o.readOnly),C(4),v("disabled",o.computedDisabled)("id",o.id)("ngModel",o.value)("ngModelOptions",Qr(39,q9))("readOnly",o.readOnly||!o.editable)("tabIndex",o.computedFocusable?0:-1),Ke("aria-invalid",o.computedInvalid)("name",o.name),C(2),Te("t-input_template_hidden",!o.inputHidden),C(3),v("ngIf",o.iconLeftContent),C(2),v("ngIf",o.hasPlaceholder),C(2),Ye("text-indent",J(19,37,o.getIndent$(s)),"px"),Te("t-has-value",o.value),C(4),v("ngIf",o.hasCustomContent),C(),v("ngIf",o.hasCleaner),C(),v("ngIf",o.showHint),C(),v("ngIf",o.iconContent)}},dependencies:[ut,So,Df,_r,Rn,q2,Y2,Vo,Ji,sz,Re],styles:['[_nghost-%COMP%]{position:relative;display:block;text-align:start;border-radius:var(--tui-radius-m);block-size:var(--tui-height);min-block-size:var(--tui-height);max-block-size:var(--tui-height)}[data-size=s][_nghost-%COMP%]{--tui-height: var(--tui-height-s);font:var(--tui-font-text-s)}[data-size=m][_nghost-%COMP%]{--tui-height: var(--tui-height-m);font:var(--tui-font-text-s)}[data-size=l][_nghost-%COMP%]{--tui-height: var(--tui-height-l);font:var(--tui-font-text-m);line-height:1.25rem}[_nghost-%COMP%] *:disabled[_nghost-%COMP%], *:disabled [_nghost-%COMP%]{pointer-events:none}.t-input[_ngcontent-%COMP%]{padding:0;margin:0;border-width:0;border-radius:inherit;background:none;font-size:inherit;line-height:inherit;font-weight:inherit;color:inherit;caret-color:currentColor;outline:none;-webkit-appearance:none;appearance:none;word-break:keep-all;-webkit-text-fill-color:currentColor;position:absolute;top:0;left:0;inline-size:100%;block-size:100%;border-style:solid;border-color:transparent;border-inline-start-width:var(--border-start, 0);border-inline-end-width:var(--border-end, 0);text-indent:var(--text-indent);color:var(--tui-text-primary);text-align:inherit;box-sizing:border-box;white-space:nowrap;overflow:hidden;text-transform:inherit;resize:none}.t-input[_ngcontent-%COMP%]:-webkit-autofill, .t-input[_ngcontent-%COMP%]:-webkit-autofill:hover, .t-input[_ngcontent-%COMP%]:-webkit-autofill:focus{-webkit-text-fill-color:var(--tui-text-primary)!important;border-color:var(--tui-service-autofill-background);box-shadow:0 0 0 100rem var(--tui-service-autofill-background) inset!important}.t-input[inputMode=none][_ngcontent-%COMP%]{caret-color:transparent}.t-input[_ngcontent-%COMP%]:-webkit-autofill, .t-input[_ngcontent-%COMP%]:-webkit-autofill:first-line{font-size:inherit;line-height:inherit}.t-input[_ngcontent-%COMP%]::-webkit-caps-lock-indicator, .t-input[_ngcontent-%COMP%]::-webkit-contacts-auto-fill-button, .t-input[_ngcontent-%COMP%]::-webkit-credit-card-auto-fill-button, .t-input[_ngcontent-%COMP%]::-webkit-credentials-auto-fill-button, .t-input[_ngcontent-%COMP%]::-webkit-strong-password-auto-fill-button{content:none!important;position:absolute;left:-62.4375rem;top:-62.4375rem;z-index:-999;display:none!important;background:transparent!important;pointer-events:none!important}.t-input[_ngcontent-%COMP%]::placeholder{color:var(--tui-text-tertiary);opacity:0}._focused[_nghost-%COMP%]:not(._readonly) .t-input[_ngcontent-%COMP%]::placeholder, tui-primitive-textfield._focused:not(._readonly)[_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-primitive-textfield._focused:not(._readonly) [_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-textarea._focused:not(._readonly)[_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-textarea._focused:not(._readonly) [_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-text-area._focused:not(._readonly)[_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-text-area._focused:not(._readonly) [_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder{opacity:1}[data-size=s][_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="s"][_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="s"] [_nghost-%COMP%]:not(tui-primitive-textfield), .t-input tui-textarea[data-size="s"][_nghost-%COMP%]:not(tui-textarea), tui-textarea[data-size="s"] [_nghost-%COMP%]:not(tui-textarea), .t-input tui-text-area[data-size="s"][_nghost-%COMP%]:not(tui-text-area), tui-text-area[data-size="s"] [_nghost-%COMP%]:not(tui-text-area){padding:0 var(--tui-padding-s)}[data-size=m][_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="m"][_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="m"] [_nghost-%COMP%]:not(tui-primitive-textfield), .t-input tui-textarea[data-size="m"][_nghost-%COMP%]:not(tui-textarea), tui-textarea[data-size="m"] [_nghost-%COMP%]:not(tui-textarea), .t-input tui-text-area[data-size="m"][_nghost-%COMP%]:not(tui-text-area), tui-text-area[data-size="m"] [_nghost-%COMP%]:not(tui-text-area){padding:0 var(--tui-padding-m)}[data-size=l][_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="l"][_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="l"] [_nghost-%COMP%]:not(tui-primitive-textfield), .t-input tui-textarea[data-size="l"][_nghost-%COMP%]:not(tui-textarea), tui-textarea[data-size="l"] [_nghost-%COMP%]:not(tui-textarea), .t-input tui-text-area[data-size="l"][_nghost-%COMP%]:not(tui-text-area), tui-text-area[data-size="l"] [_nghost-%COMP%]:not(tui-text-area){padding:0 var(--tui-padding-l)}._disabled[_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield._disabled[_nghost-%COMP%], tui-primitive-textfield._disabled [_nghost-%COMP%], .t-input tui-textarea._disabled[_nghost-%COMP%], tui-textarea._disabled [_nghost-%COMP%], .t-input tui-text-area._disabled[_nghost-%COMP%], tui-text-area._disabled [_nghost-%COMP%]{pointer-events:none}[data-size=l][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="l"]:not(._label-outside)[_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="l"]:not(._label-outside) [_nghost-%COMP%]:not(tui-primitive-textfield){padding-top:1.25rem}[data-size=m][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="m"]:not(._label-outside)[_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="m"]:not(._label-outside) [_nghost-%COMP%]:not(tui-primitive-textfield){padding-top:1rem}[data-size=l][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%]{padding-top:1.25rem}[data-size=l][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%]:-webkit-autofill + .t-content[_ngcontent-%COMP%] .t-placeholder[_ngcontent-%COMP%]{font-size:.8156rem;transform:translateY(-.625rem)}[data-size=m][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%]:-webkit-autofill + .t-content[_ngcontent-%COMP%] .t-placeholder[_ngcontent-%COMP%]{font-size:.69rem;transform:translateY(-.5rem)}._hidden[_nghost-%COMP%] input.t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield._hidden[_nghost-%COMP%], tui-primitive-textfield._hidden [_nghost-%COMP%]{opacity:0;text-indent:-10em}.t-content[_ngcontent-%COMP%]{display:flex;block-size:100%;inline-size:100%;box-sizing:border-box;align-items:center;overflow:hidden}[data-size=s][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{padding:0 var(--tui-padding-s)}[data-size=m][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{padding:0 var(--tui-padding-m)}[data-size=l][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{padding:0 var(--tui-padding-l)}.t-wrapper[_ngcontent-%COMP%]{flex:1;min-inline-size:0;padding-inline-end:.25rem}.t-placeholder[_ngcontent-%COMP%]{transition-property:transform,font-size,color,letter-spacing;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;inline-size:100%;-webkit-user-select:none;user-select:none;font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none;will-change:transform;transform:translateY(0)}@supports (-webkit-hyphens: none){.t-placeholder[_ngcontent-%COMP%]{will-change:unset;transition-property:transform,color,letter-spacing}}.t-placeholder_raised[_ngcontent-%COMP%]{transform:translateY(-.625rem)}[data-size=m][_nghost-%COMP%] .t-placeholder_raised[_ngcontent-%COMP%]{font:var(--tui-font-text-xs);line-height:1.25rem;transform:translateY(-.5rem);letter-spacing:.025rem}._invalid[_nghost-%COMP%]:not(._focused) .t-placeholder_raised[_ngcontent-%COMP%], ._invalid[_nghost-%COMP%]:not(._focused):hover .t-placeholder_raised[_ngcontent-%COMP%]{color:var(--tui-text-negative)}._focused[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], [data-size=m]._focused._label-outside[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], [data-size=l]._focused._label-outside[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%]{color:var(--tui-text-tertiary)}[data-size=l][_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%]{font:var(--tui-font-text-m);line-height:1.25rem}[data-size=l][_nghost-%COMP%] .t-placeholder_raised[_ngcontent-%COMP%]{font-size:.8156rem}[data-size=m]._focused[_nghost-%COMP%]:not(._label-outside) .t-placeholder[_ngcontent-%COMP%], [data-size=l]._focused[_nghost-%COMP%]:not(._label-outside) .t-placeholder[_ngcontent-%COMP%]{color:var(--tui-text-primary)}.t-cleaner[_ngcontent-%COMP%]{position:relative;display:flex;inline-size:1.5rem;block-size:1.5rem;align-items:center;justify-content:center;box-sizing:border-box;cursor:pointer;pointer-events:none;pointer-events:auto;border-width:.25rem}._readonly[_nghost-%COMP%] .t-cleaner[_ngcontent-%COMP%], ._disabled[_nghost-%COMP%] .t-cleaner[_ngcontent-%COMP%]{pointer-events:none}.t-icon[_ngcontent-%COMP%]{position:relative;display:flex;inline-size:1.5rem;block-size:1.5rem;align-items:center;justify-content:center;box-sizing:border-box;cursor:pointer;pointer-events:none}[data-size=s][_nghost-%COMP%] .t-icon_left[_ngcontent-%COMP%]{margin:0 .125rem 0 -.375rem}[data-size=m][_nghost-%COMP%] .t-icon_left[_ngcontent-%COMP%]{margin-inline-start:-.125rem;margin-inline-end:.375rem}[data-size=l][_nghost-%COMP%] .t-icon_left[_ngcontent-%COMP%]{margin-inline-end:.75rem}.t-icons[_ngcontent-%COMP%]{display:flex;align-items:center}[data-size=m][_nghost-%COMP%] .t-icons[_ngcontent-%COMP%]{margin-inline-end:-.125rem}[data-size=s][_nghost-%COMP%] .t-icons[_ngcontent-%COMP%]{margin-inline-end:-.375rem}[_nghost-%COMP%]:not([data-size=s]) .t-icons[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(:first-child){margin-inline-start:.25rem}[_nghost-%COMP%] input{transition:box-shadow .01s}._autofilled[data-size=s][_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], ._autofilled._label-outside[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], ._autofilled[_nghost-%COMP%] .t-value-decoration[_ngcontent-%COMP%]:not(.t-has-value){visibility:hidden}[data-size=s][_nghost-%COMP%] tui-icon[_ngcontent-%COMP%]{border-width:.25rem}.t-custom-content[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;min-inline-size:2rem;block-size:2rem;pointer-events:none}.t-custom-icon[_ngcontent-%COMP%]{inline-size:2rem;block-size:100%}.t-input[_ngcontent-%COMP%]:not(:first-child){display:none}[data-size][_nghost-%COMP%] .t-input_template[_ngcontent-%COMP%]{display:flex;inline-size:calc(100% - 1rem);max-inline-size:calc(100% - 1rem);align-items:center;pointer-events:none;padding-inline-end:0}.t-input_template_hidden[_ngcontent-%COMP%]{display:none}.t-text-template[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-wrapper-value-decoration[_ngcontent-%COMP%]{position:relative;pointer-events:none}._readonly[_nghost-%COMP%] .t-textfield-icon[_ngcontent-%COMP%] [tuiAppearance][data-appearance=icon]{pointer-events:none}@media (hover: hover) and (pointer: fine){[_nghost-%COMP%]:not(._readonly):not(._disabled):hover .t-textfield-icon[_ngcontent-%COMP%] [tuiAppearance][data-appearance=icon]:after{color:var(--tui-text-secondary)}}'],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"getIndent$",null),t})(),Bge=(()=>{let e=class e extends P2{constructor(){super(...arguments),this.host=h(uz)}get readOnly(){return this.host.readOnly||!this.host.editable}onValueChange(n){this.host.onModelChange(n)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["tui-primitive-textfield"]],standalone:!1,features:[Z([N2(e)]),oe]});let t=e;return t})();var Vge=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({imports:[wa,wf,Z2,Q2,Vo]});let t=e;return t})();function lz(t,e){if(t&1){let i=q();E(0,"button",1),x("click",function(){let r=P(i).$implicit,o=_();return F(o.selectedColor.emit(r.value))}),w()}if(t&2){let i=e.$implicit;Ye("background",i.value),v("id",i.key)("tuiHint",i.key)("tuiHintDescribe",i.key)}}var Xge=W(["Solid color","Gradient"]);var cz={SolidColor:0,Gradient:1},dz={selectorMode:!0,mode:cz.SolidColor,color:[0,0,0,1],colors:new Map,gradient:{icons:{"to top right":"@tui.move-up-right","to right":"@tui.move-right","to bottom right":"@tui.move-down-right","to bottom":"@tui.move-down","to bottom left":"@tui.move-down-left","to left":"@tui.move-left","to top left":"@tui.move-up-left","to top":"@tui.move-up"},steps:[[0,[0,0,0,1]],[1,[255,255,255,1]]],stop:0,direction:"to bottom",emptyStop:[0,0,0,0],buttons:["to top right","to right","to bottom right","to bottom","to bottom left","to left","to top left","to top"]}},Jge=W(dz);var Xa=(()=>{let e=class e{constructor(){this.colors=new Map,this.selectedColor=new _e,this.originalOrder=(n,r)=>0}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-palette"]],inputs:{colors:"colors"},outputs:{selectedColor:"selectedColor"},standalone:!1,decls:2,vars:4,consts:[["type","button","class","t-button",3,"id","background","tuiHint","tuiHintDescribe","click",4,"ngFor","ngForOf"],["type","button",1,"t-button",3,"click","id","tuiHint","tuiHintDescribe"]],template:function(r,o){r&1&&(O(0,lz,1,5,"button",0),Y(1,"keyvalue")),r&2&&v("ngForOf",hT(1,1,o.colors,o.originalOrder))},dependencies:[Ci,Ve,ze,VT],styles:["[_nghost-%COMP%]{display:flex;flex-wrap:wrap;padding:.875rem}.t-button[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;padding:0;background:none;font-size:inherit;line-height:inherit;inline-size:1.5625rem;block-size:1.5625rem;box-sizing:border-box;margin:.375rem;border-radius:var(--tui-radius-m);border:1px solid rgba(0,0,0,.08)}"],changeDetection:0});let t=e;return t})();var Ja=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({imports:[wa,Bv]});let t=e;return t})();function fz(t,e){if(t&1&&(Q(0,"div",4),Y(1,"async")),t&2){let i=_();Ye("background",J(1,2,i.backgroundColor$))}}function pz(t,e){if(t&1){let i=q();E(0,"tui-palette",5),x("selectedColor",function(r){P(i);let o=_();return F(o.editor==null?null:o.editor.setBackgroundColor(r))}),w()}if(t&2){let i=_();v("colors",i.colors)}}var J2=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.backgroundColor$=null,this.backColorText$=this.texts$.pipe(S(n=>n.backColor)),this.colors=this.options.colors}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}isBlankColor(n){return n===this.options.blankColor}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}initStream(){var n;this.backgroundColor$=((n=this.editor)==null?void 0:n.stateChange$.pipe(S(()=>{var r;return((r=this.editor)==null?void 0:r.getBackgroundColor())??this.options.blankColor??!1}),ke()))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-highlight-color"]],inputs:{colors:"colors",inputEditor:[0,"editor","inputEditor"]},decls:7,vars:9,consts:[["hiliteDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__hilite-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"iconStart","tuiHint"],["class","t-plate",3,"background",4,"ngIf"],[1,"t-plate"],[1,"t-color-picker",3,"selectedColor","colors"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),O(3,fz,2,4,"div",3),Y(4,"async"),O(5,pz,1,1,"ng-template",null,0,We),w()),r&2){let s=be(6);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(),v("iconStart",o.icons.textHilite)("tuiHint",J(2,5,o.backColorText$)),C(2),v("ngIf",!o.isBlankColor(J(4,7,o.backgroundColor$)||""))}},dependencies:[Re,ut,Le,Ze,Tt,Ve,ze,Ja,Xa],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function hz(t,e){if(t&1){let i=q();E(0,"div",5)(1,"button",6),x("click",function(){P(i);let r=_(3);return F(r.editor==null?null:r.editor.toggleUnorderedList())}),he(2," Unordered list "),w(),E(3,"button",7),x("click",function(){P(i);let r=_(3);return F(r.editor==null?null:r.editor.toggleOrderedList())}),he(4," Ordered list "),w(),E(5,"button",8),x("click",function(){P(i);let r=_(3);return F(r.editor==null?null:r.editor.toggleTaskList())}),he(6," Toggle task list "),w(),E(7,"button",9),x("click",function(){P(i);let r=_(3);return F(r.sinkListItem())}),he(8," Sink list item "),w(),E(9,"button",10),x("click",function(){P(i);let r=_(3);return F(r.liftListItem())}),he(10," Lift list item "),w()()}if(t&2){let i=_(2).ngIf,n=_();C(),v("iconStart",n.options.icons.listUnOrdered)("tuiHint",i.unorderedList),C(2),v("iconStart",n.options.icons.listOrdered)("tuiHint",i.orderedList),C(2),v("iconStart",n.options.icons.taskList),C(2),v("iconStart",n.options.icons.indent)("tuiHint",i.indent),C(2),v("iconStart",n.options.icons.outdent)("tuiHint",i.outdent)}}function mz(t,e){if(t&1&&(E(0,"div",3),Q(1,"button",4),O(2,hz,11,9,"ng-template",null,0,We),w()),t&2){let i=be(3),n=_().ngIf,r=_();v("tuiDropdown",i)("tuiDropdownOpen",!1),C(),v("iconStart",r.options.icons.listPreview)("tuiHint",n.list)}}function gz(t,e){if(t&1&&(_t(0),O(1,mz,4,4,"div",2),Y(2,"async"),Ct()),t&2){let i=_();C(),v("ngIf",J(2,1,i.listState$))}}var eM=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.listState$=null}set inputEditor(n){this.localEditor=n,this.initStream()}get editor(){return this.injectionEditor??this.localEditor}sinkListItem(){var n;(n=this.editor)==null||n.sinkListItem()}liftListItem(){var n;(n=this.editor)==null||n.liftListItem()}initStream(){var n,r,o;this.listState$=In([((n=this.editor)==null?void 0:n.isActive$("orderedList"))??ce(!1),((r=this.editor)==null?void 0:r.isActive$("bulletList"))??ce(!1),((o=this.editor)==null?void 0:o.isActive$("taskList"))??ce(!1)]).pipe(S(([s,a,u])=>({ordered:s,unordered:a,tasked:u})))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-list-configs"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:2,vars:3,consts:[["listDropdown",""],[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__ordering-list-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-dropdown","t-dropdown-list"],["appearance","icon","automation-id","toolbar__un-ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__task-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart"],["appearance","icon","automation-id","toolbar_indent-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar_outdent-button","size","s","tuiIconButton","","type","button",1,"t-option",3,"click","iconStart","tuiHint"]],template:function(r,o){r&1&&(O(0,gz,3,3,"ng-container",1),Y(1,"async")),r&2&&v("ngIf",J(1,1,o.texts$))},dependencies:[Re,ut,Le,Ze,Tt,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function yz(t,e){if(t&1&&(Q(0,"div",3),Y(1,"async")),t&2){let i=_();Ye("background",J(1,2,i.color$))}}function vz(t,e){if(t&1){let i=q();E(0,"tui-palette",4),x("selectedColor",function(r){P(i);let o=_();return F(o.setCellColor(r))}),w()}if(t&2){let i=_();v("colors",i.colors)}}var tM=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.colorText$=null,this.isActive$=null,this.color$=null,this.colors=this.options.colors}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}isBlankColor(n){return n===this.options.blankColor}setCellColor(n){var r,o;(r=this.editor)!=null&&r.isActive("group")?this.editor.setGroupHilite(n):(o=this.editor)!=null&&o.isActive("table")&&this.editor.setCellColor(n)}initStream(){var n,r,o;this.colorText$=this.texts$.pipe(S(s=>{var a,u;return((a=this.editor)==null?void 0:a.isActive("group"))&&s.hiliteGroup||((u=this.editor)==null?void 0:u.isActive("table"))&&s.cellColor||""})),this.isActive$=In([((n=this.editor)==null?void 0:n.isActive$("table"))??ce(!1),((r=this.editor)==null?void 0:r.isActive$("group"))??ce(!1)]).pipe(S(([s,a])=>s||a)),this.color$=((o=this.editor)==null?void 0:o.stateChange$.pipe(S(()=>{var s,a;return((s=this.editor)==null?void 0:s.getCellColor())??((a=this.editor)==null?void 0:a.getGroupColor())??this.options.blankColor}),ke()))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-cell-color"]],inputs:{colors:"colors",inputEditor:[0,"editor","inputEditor"]},decls:7,vars:13,consts:[["cellColorDropdown",""],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiDropdown","tuiDropdownMaxHeight","tuiDropdownOpen","tuiHint"],["class","t-plate t-plate_paint",3,"background",4,"ngIf"],[1,"t-plate","t-plate_paint"],[1,"t-color-picker",3,"selectedColor","colors"]],template:function(r,o){if(r&1&&(Q(0,"button",1),Y(1,"async"),Y(2,"async"),O(3,yz,2,4,"div",2),Y(4,"async"),O(5,vz,1,1,"ng-template",null,0,We)),r&2){let s=be(6);v("disabled",!J(1,7,o.isActive$))("iconStart",o.icons.paint)("tuiDropdown",s)("tuiDropdownMaxHeight",999)("tuiDropdownOpen",!1)("tuiHint",J(2,9,o.colorText$)),C(3),v("ngIf",!o.isBlankColor(J(4,11,o.color$)||""))}},dependencies:[Re,ut,Le,Is,Ze,Tt,Ve,ze,Ja,Xa],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function bz(t,e){if(t&1){let i=q();E(0,"div",4),x("click",function(){P(i);let r=_(2);return F(r.select())})("mouseenter",function(r){let o=P(i).$implicit,s=_().$implicit,a=_();return F(a.updateCurrentSize(o+1,s+1,r))}),w()}if(t&2){let i=e.$implicit,n=_().$implicit,r=_();Te("t-cell_hovered",r.tableSelectHovered(i,n))}}function _z(t,e){if(t&1&&(E(0,"div",2),O(1,bz,1,2,"div",3),w()),t&2){let i=_();C(),v("tuiRepeatTimesOf",i.rowsNumber)}}function Cz(t,e){if(t&1){let i=q();E(0,"tui-table-size-selector",4),x("selectSize",function(r){P(i);let o=_();return F(o.addTable(r))}),w()}}var Dz=15,Ez=15,wz=70,Tz=(()=>{let e=class e{constructor(){this.win=h(Pn),this.tableSize={rows:1,cols:1},this.selectSize=new _e}get columnsNumber(){return Math.min(Math.max(3,this.tableSize.cols+1),Dz)}get rowsNumber(){return Math.min(Math.max(3,this.tableSize.rows+1),Ez)}tableSelectHovered(n,r){return nwz&&(this.tableSize={rows:n,cols:r})}select(){this.selectSize.emit(this.tableSize)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-size-selector"]],outputs:{selectSize:"selectSize"},decls:3,vars:3,consts:[["class","t-column",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-description"],[1,"t-column"],["class","t-cell",3,"t-cell_hovered","click","mouseenter",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-cell",3,"click","mouseenter"]],template:function(r,o){r&1&&(O(0,_z,2,1,"div",0),E(1,"div",1),he(2),w()),r&2&&(v("tuiRepeatTimesOf",o.columnsNumber),C(2),ty("",o.tableSize.cols,"\xD7",o.tableSize.rows,""))},dependencies:[YI],styles:["[_nghost-%COMP%]{display:block;padding:.75rem}.t-cell[_ngcontent-%COMP%]{display:inline-block;background-color:var(--tui-background-base);inline-size:1.25rem;block-size:1.25rem;border-radius:.25rem;margin:.125rem;border:.0625rem solid var(--tui-border-normal);cursor:pointer}.t-cell_hovered[_ngcontent-%COMP%]{background-color:var(--tui-background-base-alt)}.t-column[_ngcontent-%COMP%]{white-space:nowrap}.t-description[_ngcontent-%COMP%]{text-align:center}"],changeDetection:0});let t=e;return t})(),nM=(()=>{let e=class e{constructor(){this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.insertTableText$=this.texts$.pipe(S(n=>n.insertTable)),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}addTable({rows:n,cols:r}){var s,a,u,l,c,f,p;(s=this.editor)==null||s.enter();let o=(u=(a=this.editor)==null?void 0:a.state)==null?void 0:u.selection.anchor;(l=this.editor)==null||l.enter(),(c=this.editor)==null||c.enter(),(f=this.editor)==null||f.setTextSelection(o??0),(p=this.editor)==null||p.insertTable(n,r)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-create"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:6,consts:[["table",""],["tableDropdown",""],["tuiDropdownAlign","left","tuiDropdownDirection","bottom",3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__insert-table-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[3,"selectSize"]],template:function(r,o){if(r&1&&(E(0,"div",2,0),Q(2,"button",3),Y(3,"async"),w(),O(4,Cz,1,0,"ng-template",null,1,We)),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(2),v("iconStart",o.options.icons.insertTable)("tuiHint",J(3,4,o.insertTableText$))}},dependencies:[Re,Le,Is,Ze,Tt,Ve,ze,Tz],encapsulation:2,changeDetection:0});let t=e;return t})();var iM=(()=>{let e=class e{constructor(){this.localEditor=null,this.destroyRef=h(it),this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.canMergeCells=ge(!1),this.canSplitCells=ge(!1)}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}mergeCells(){var n;(n=this.editor)==null||n.mergeCells()}splitCell(){var n;(n=this.editor)==null||n.splitCell()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n,r;(n=this.editor)==null||n.stateChange$.pipe(S(()=>{var o;return((o=this.editor)==null?void 0:o.canMergeCells())??!1}),ke(),Se(this.destroyRef)).subscribe(o=>this.canMergeCells.set(o)),(r=this.editor)==null||r.stateChange$.pipe(S(()=>{var o;return((o=this.editor)==null?void 0:o.canSplitCells())??!1}),ke(),Se(this.destroyRef)).subscribe(o=>this.canSplitCells.set(o))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-merge-cells"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:3,vars:7,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"]],template:function(r,o){if(r&1&&(E(0,"button",0),Y(1,"async"),Y(2,"async"),x("click",function(){return o.canMergeCells()?o.mergeCells():o.splitCell()}),w()),r&2){let s;v("disabled",!o.canMergeCells()&&!o.canSplitCells())("iconStart",o.canMergeCells()?o.options.icons.tableCellMerge:o.options.icons.tableCellSplit)("tuiHint",o.canMergeCells()?(s=J(1,3,o.texts$))==null?null:s.mergeCells:(s=J(2,5,o.texts$))==null?null:s.splitCells)}},dependencies:[Re,Le,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function xz(t,e){if(t&1){let i=q();E(0,"button",5),x("click",function(){let r=P(i).index,o=_().index,s=_(2);return F(s.onTableOption(o*2+r))}),he(1),w()}if(t&2){let i=e.$implicit;C(),Nt(" ",i," ")}}function Iz(t,e){if(t&1&&(E(0,"tui-opt-group"),O(1,xz,2,1,"button",4),w()),t&2){let i=e.$implicit;C(),v("ngForOf",i)}}function Sz(t,e){if(t&1&&(E(0,"tui-data-list"),O(1,Iz,2,1,"tui-opt-group",3),Y(2,"async"),w()),t&2){let i=_();C(),v("ngForOf",J(2,1,i.tableCommandTexts$))}}var eu={InsertColumnBefore:0,InsertColumnAfter:1,InsertRowBefore:2,InsertRowAfter:3,DeleteColumn:4,DeleteRow:5},rM=(()=>{let e=class e{constructor(){this.localEditor=null,this.commandsRegistry=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.tableCommandTexts$=h(lS),this.isActive$=null,this.rowsColumnsManagingText$=this.texts$.pipe(S(n=>n.rowsColumnsManaging))}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}onTableOption(n){var r,o;(o=(r=this.commandsRegistry)==null?void 0:r[n])==null||o.call(r)}initStream(){var n;this.commandsRegistry={[eu.InsertColumnAfter]:()=>{var r;return(r=this.editor)==null?void 0:r.addColumnAfter()},[eu.InsertColumnBefore]:()=>{var r;return(r=this.editor)==null?void 0:r.addColumnBefore()},[eu.InsertRowAfter]:()=>{var r;return(r=this.editor)==null?void 0:r.addRowAfter()},[eu.InsertRowBefore]:()=>{var r;return(r=this.editor)==null?void 0:r.addRowBefore()},[eu.DeleteColumn]:()=>{var r;return(r=this.editor)==null?void 0:r.deleteColumn()},[eu.DeleteRow]:()=>{var r;return(r=this.editor)==null?void 0:r.deleteRow()}},this.isActive$=((n=this.editor)==null?void 0:n.isActive$("table"))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-row-column-manager"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:9,consts:[["tableOptionsDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint"],[4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),Y(3,"async"),w(),O(4,Sz,3,3,"ng-template",null,0,We)),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(),v("disabled",!J(2,5,o.isActive$))("iconStart",o.options.icons.addRowTable)("tuiHint",J(3,7,o.rowsColumnsManagingText$))}},dependencies:[Re,Ci,Le,Ms,Ss,jS,Ze,Tt,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function Mz(t,e){if(t&1){let i=q();E(0,"tui-palette",3),x("selectedColor",function(r){P(i);let o=_();return F(o.editor==null?null:o.editor.setFontColor(r))}),w()}if(t&2){let i=_();v("colors",i.colors)}}var oM=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.foreColorText$=this.texts$.pipe(S(n=>n.foreColor)),this.fontColor$=null,this.colors=this.options.colors}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n;this.fontColor$=((n=this.editor)==null?void 0:n.stateChange$.pipe(S(()=>{var r;return((r=this.editor)==null?void 0:r.getFontColor())??this.options.blankColor}),S(r=>r===this.options.blankColor?"":r),ke()))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-text-color"]],inputs:{colors:"colors",inputEditor:[0,"editor","inputEditor"]},decls:6,vars:10,consts:[["colorDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__color-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-color-picker",3,"selectedColor","colors"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),Y(3,"async"),O(4,Mz,1,1,"ng-template",null,0,We),w()),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(),Ye("color",J(2,6,o.fontColor$)),v("iconStart",o.options.icons.textColor)("tuiHint",J(3,8,o.foreColorText$))}},dependencies:[Re,Le,Ze,Tt,Ve,ze,Ja,Xa],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();var Az=["dropdown"],kz=["*"];function Oz(t,e){if(t&1){let i=q();_t(0),Q(1,"button",4),E(2,"div",5),x("focus",function(){P(i);let r=_();return F(r.onTopFocus())}),w(),E(3,"div",5),x("focus",function(){P(i);let r=_();return F(r.onBottomFocus())}),w(),Ct()}if(t&2){let i=_();C(2),v("tabIndex",i.focusable?0:-1),C(),v("tabIndex",i.focusable?0:-1)}}function Nz(t,e){t&1&&Qt(0)}function Pz(t,e){if(t&1){let i=q();E(0,"div",8)(1,"button",9),x("click",function(){P(i);let r=_(2);return F(r.undo())}),w(),E(2,"button",10),x("click",function(){P(i);let r=_(2);return F(r.redo())}),w()()}if(t&2){let i=_().ngIf,n=_();C(),v("disabled",n.undoDisabled)("iconStart",n.icons.undo)("tuiHint",i.undo),C(),v("disabled",n.redoDisabled)("iconStart",n.icons.redo)("tuiHint",i.redo)}}function Fz(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-font-size",11),w()),t&2){let i=_(2);C(),v("editor",i.editor)}}function Rz(t,e){if(t&1&&Q(0,"tui-font-style",17),t&2){let i=_(3);v("editor",i.editor)("enabledTools",i.toolsSet)}}function Lz(t,e){if(t&1&&Q(0,"tui-align-content",11),t&2){let i=_(3);v("editor",i.editor)}}function Hz(t,e){if(t&1&&Q(0,"tui-list-configs",11),t&2){let i=_(3);v("editor",i.editor)}}function Bz(t,e){if(t&1){let i=q();E(0,"button",18),x("click",function(){P(i);let r=_(3);return F(r.toggleQuote())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("disabled",n.unorderedList||n.orderedList)("iconStart",n.icons.quote)("tuiHint",i.quote)}}function Vz(t,e){if(t&1){let i=q();E(0,"button",19),x("click",function(){P(i);let r=_(3);return F(r.onLink())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("disabled",n.a||n.jumpAnchor)("iconStart",n.icons.link)("tuiHint",i.link)}}function zz(t,e){if(t&1){let i=q();E(0,"button",20),x("click",function(){P(i);let r=_(3);return F(r.onLink("#"))}),w()}if(t&2){let i=_(2).ngIf,n=_();v("disabled",n.a||n.jumpAnchor)("iconStart",n.icons.anchor)("tuiHint",i.insertAnchor)}}function jz(t,e){if(t&1){let i=q();_t(0),E(1,"button",21),x("click",function(){P(i);let r=be(3);return F(r.click())}),w(),E(2,"input",22,0),x("change",function(){P(i);let r=be(3),o=_(3);return F(o.onAttach(r))}),w(),Ct()}if(t&2){let i=_(2).ngIf,n=_();C(),v("iconStart",n.icons.attach)("tuiHint",i.attach),C(),v("accept",n.attachOptions.accept)("multiple",n.attachOptions.multiple)("tabIndex",-1)}}function Uz(t,e){if(t&1&&(E(0,"div",8),O(1,Rz,1,2,"tui-font-style",12)(2,Lz,1,1,"tui-align-content",13)(3,Hz,1,1,"tui-list-configs",13)(4,Bz,1,3,"button",14)(5,Vz,1,3,"button",15)(6,zz,1,3,"button",16)(7,jz,4,5,"ng-container",2),w()),t&2){let i=_(2);C(),v("ngIf",i.formatEnabled),C(),v("ngIf",i.enabled(i.editorTool.Align)),C(),v("ngIf",i.enabled(i.editorTool.List)),C(),v("ngIf",i.enabled(i.editorTool.Quote)),C(),v("ngIf",i.enabled(i.editorTool.Link)),C(),v("ngIf",i.enabled(i.editorTool.Anchor)),C(),v("ngIf",i.enabled(i.editorTool.Attach))}}function $z(t,e){if(t&1){let i=q();E(0,"button",21),x("click",function(){P(i);let r=_(3);return F(r.toggleSubscript())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.sub)("tuiHint",i.subscript)}}function Gz(t,e){if(t&1){let i=q();E(0,"button",21),x("click",function(){P(i);let r=_(3);return F(r.toggleSuperscript())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.sup)("tuiHint",i.superscript)}}function Wz(t,e){if(t&1&&(E(0,"div",8),O(1,$z,1,2,"button",23)(2,Gz,1,2,"button",23),w()),t&2){let i=_(2);C(),v("ngIf",i.enabled(i.editorTool.Sub)),C(),v("ngIf",i.enabled(i.editorTool.Sup))}}function qz(t,e){if(t&1&&Q(0,"tui-text-color",25),t&2){let i=_(3);v("colors",i.colors)("editor",i.editor)}}function Zz(t,e){if(t&1&&Q(0,"tui-highlight-color",25),t&2){let i=_(3);v("colors",i.colors)("editor",i.editor)}}function Kz(t,e){if(t&1&&(E(0,"div",8),O(1,qz,1,2,"tui-text-color",24)(2,Zz,1,2,"tui-highlight-color",24),w()),t&2){let i=_(2);C(),v("ngIf",i.enabled(i.editorTool.Color)),C(),v("ngIf",i.enabled(i.editorTool.Hilite))}}function Yz(t,e){if(t&1&&Q(0,"tui-code",11),t&2){let i=_(3);v("editor",i.editor)}}function Qz(t,e){if(t&1){let i=q();E(0,"button",28),x("click",function(){P(i);let r=_(3);return F(r.onTeX())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.tex)("tuiHint",i.tex)}}function Xz(t,e){if(t&1){let i=q();E(0,"div",29)(1,"button",30),x("click",function(){P(i);let r=be(3);return F(r.click())}),w(),E(2,"input",31,1),x("change",function(){P(i);let r=be(3),o=_(3);return F(o.onImage(r))}),w()()}if(t&2){let i=_(2).ngIf,n=_();C(),v("iconStart",n.icons.image)("tuiHint",i.image),C(),v("tabIndex",-1)}}function Jz(t,e){if(t&1){let i=q();E(0,"button",21),x("click",function(){P(i);let r=_(3);return F(r.insertHorizontalRule())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.hr)("tuiHint",i.insertHorizontalRule)}}function ej(t,e){if(t&1&&(E(0,"div",8),O(1,Yz,1,1,"tui-code",13)(2,Qz,1,2,"button",26)(3,Xz,4,3,"div",27)(4,Jz,1,2,"button",23),w()),t&2){let i=_(2);C(),v("ngIf",i.enabled(i.editorTool.Code)),C(),v("ngIf",i.enabled(i.editorTool.Tex)),C(),v("ngIf",i.enabled(i.editorTool.Img)),C(),v("ngIf",i.enabled(i.editorTool.HR))}}function tj(t,e){if(t&1){let i=q();E(0,"div",8)(1,"button",21),x("click",function(){P(i);let r=_(2);return F(r.removeFormat())}),w()()}if(t&2){let i=_().ngIf,n=_();C(),v("iconStart",n.icons.clear)("tuiHint",i.clear)}}function nj(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-details",32)(2,"tui-details-remove",32),w()),t&2){let i=_(2);C(),v("editor",i.editor),C(),v("editor",i.editor)}}function ij(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-editor-group-tool",32),w()),t&2){let i=_(2);C(),v("editor",i.editor)}}function rj(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-table-create",32)(2,"tui-table-row-column-manager",32)(3,"tui-table-merge-cells",32),w()),t&2){let i=_(2);C(),v("editor",i.editor),C(),v("editor",i.editor),C(),v("editor",i.editor)}}function oj(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-table-cell-color",25),w()),t&2){let i=_(2);C(),v("colors",i.colors)("editor",i.editor)}}function sj(t,e){if(t&1&&(E(0,"fieldset",6),O(1,Pz,3,6,"div",7)(2,Fz,2,1,"div",7)(3,Uz,8,7,"div",7)(4,Wz,3,2,"div",7)(5,Kz,3,2,"div",7)(6,ej,5,4,"div",7)(7,tj,2,2,"div",7)(8,nj,3,2,"div",7)(9,ij,2,1,"div",7)(10,rj,4,3,"div",7)(11,oj,2,2,"div",7),E(12,"div",8),at(13),w()()),t&2){let i=_();v("disabled",i.disabled),C(),v("ngIf",i.enabled(i.editorTool.Undo)),C(),v("ngIf",i.enabled(i.editorTool.Size)),C(),v("ngIf",i.firstBigBlockEnabled),C(),v("ngIf",i.enabled(i.editorTool.Sub)||i.enabled(i.editorTool.Sup)),C(),v("ngIf",i.enabled(i.editorTool.Color)||i.enabled(i.editorTool.Hilite)),C(),v("ngIf",i.secondBigBlockEnabled),C(),v("ngIf",i.enabled(i.editorTool.Clear)),C(),v("ngIf",i.enabled(i.editorTool.Details)),C(),v("ngIf",i.enabled(i.editorTool.Group)),C(),v("ngIf",i.enabled(i.editorTool.Table)),C(),v("ngIf",i.enabled(i.editorTool.CellColor))}}var sM=(()=>{let e=class e{constructor(){this.el=h(de).nativeElement}findFirstFocusableTool(n=!1){let r=n?this.toolsContainers.slice().reverse():this.toolsContainers;for(let o of r){let s=ys(o)?o:Po({initial:o,root:o,keyboard:!1});if(s)return s}return null}onHorizontalNavigation(n){let{toolsContainers:r}=this,o=r.findIndex(Ki),s=Jt(o+(n?-1:1),0,r.length-1),a=r[s],u=n?this.findPreviousTool(a):this.findNextTool(a);u&&u.focus()}get toolsContainers(){return Array.from(this.el.querySelectorAll("[tuiItem]"))}findPreviousTool(n){return!n||ys(n)?n??null:Po({initial:n,root:n,keyboard:!1})||Po({initial:n,root:this.el,previous:!0,keyboard:!1})}findNextTool(n){return!n||ys(n)?n??null:Po({initial:n,root:this.el,keyboard:!1})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiToolbarNavigationManager",""]],hostBindings:function(r,o){r&1&&x("keydown.arrowRight.prevent",function(){return o.onHorizontalNavigation(!1)})("keydown.arrowLeft.prevent",function(){return o.onHorizontalNavigation(!0)})}});let t=e;return t})(),ob=(()=>{let e=class e{constructor(){var n;this.dropdowns=Tf,this.filesLoader=h(uS,{optional:!0}),this.destroyRef=h(it),this.imageLoader=h(pp),this.options=h(xe),this.editorTool=Oe,this.injectionEditor=h(je,{optional:!0}),this.attachOptions=h(aS),this.texts$=h(lt),this.toolsSet=new Set(Tl),this.inputEditor=null,this.colors=this.options.colors,this.disabled=!1,this.linkAdded=new _e,this.texClicked=new _e,this.fileAttached=new _e,this.el=((n=h(de,{optional:!0}))==null?void 0:n.nativeElement)??null}set tools(n){this.toolsSet=new Set(n)}get editor(){return this.injectionEditor??this.inputEditor}get icons(){return this.options.icons}get focused(){return Ki(this.el)||!!this.dropdowns.find(({nativeElement:n})=>Ki(n))}get focusable(){return!this.focused&&!this.disabled}get unorderedList(){var n;return((n=this.editor)==null?void 0:n.isActive("bulletList"))??!1}get orderedList(){var n;return((n=this.editor)==null?void 0:n.isActive("orderedList"))??!1}get blockquote(){var n;return((n=this.editor)==null?void 0:n.isActive("blockquote"))??!1}get a(){var n;return((n=this.editor)==null?void 0:n.isActive("link"))??!1}get jumpAnchor(){var n;return((n=this.editor)==null?void 0:n.isActive("jumpAnchor"))??!1}get undoDisabled(){var n;return((n=this.editor)==null?void 0:n.undoDisabled())??!1}get redoDisabled(){var n;return((n=this.editor)==null?void 0:n.redoDisabled())??!1}get subscript(){var n;return((n=this.editor)==null?void 0:n.isActive("subscript"))??!1}get superscript(){var n;return((n=this.editor)==null?void 0:n.isActive("superscript"))??!1}get formatEnabled(){return this.enabled(Oe.Bold)||this.enabled(Oe.Italic)||this.enabled(Oe.Underline)||this.enabled(Oe.Strikethrough)}get firstBigBlockEnabled(){return this.formatEnabled||this.enabled(Oe.Align)||this.enabled(Oe.List)||this.enabled(Oe.Quote)||this.enabled(Oe.Link)||this.enabled(Oe.Anchor)||this.enabled(Oe.Attach)}get secondBigBlockEnabled(){return this.enabled(Oe.Code)||this.enabled(Oe.Tex)||this.enabled(Oe.Img)||this.enabled(Oe.HR)}onMouseDown(n,r){var o;r.closest("button")||(n.preventDefault(),(o=this.editor)==null||o.focus())}onBottomFocus(){this.focusLast()}onTopFocus(){this.focusFirst()}onImage(n){var o;let r=(o=n.files)==null?void 0:o[0];n.value="",r&&this.imageLoader(r).pipe($t(1),Se(this.destroyRef)).subscribe(s=>this.addImage(s))}onAttach(n){var o;let r=Array.from(n.files||[]);n.value="",r&&((o=this.filesLoader)==null||o.call(this,r).pipe($t(1),Se(this.destroyRef)).subscribe(s=>this.fileAttached.emit(s)))}onTeX(){this.texClicked.emit()}onLink(n){var r,o,s,a,u,l,c;if((r=this.editor)==null||r.takeSelectionSnapshot(),n==="#"){let f=(o=this.editor)==null?void 0:o.getSelectionSnapshot(),p=(s=this.editor)==null?void 0:s.getOriginTiptapEditor(),{from:m=f==null?void 0:f.anchor}=p?Ya(p):{};(a=this.editor)==null||a.setAnchor(""),(l=(u=this.editor)==null?void 0:u.getOriginTiptapEditor())==null||l.commands.focus((m??0)+1)}else(c=this.editor)==null||c.toggleLink(n??"")}enabled(n){return this.toolsSet.has(n)}undo(){var n;(n=this.editor)==null||n.undo()}redo(){var n;(n=this.editor)==null||n.redo()}insertHorizontalRule(){var n;(n=this.editor)==null||n.setHorizontalRule()}removeFormat(){var n;(n=this.editor)==null||n.removeFormat()}toggleOrderedList(){var n;(n=this.editor)==null||n.toggleOrderedList()}toggleQuote(){var n;(n=this.editor)==null||n.toggleBlockquote()}toggleSubscript(){var n;(n=this.editor)==null||n.toggleSubscript()}toggleSuperscript(){var n;(n=this.editor)==null||n.toggleSuperscript()}addImage(n){var r;(r=this.editor)==null||r.setImage(n)}focusFirst(){var r;let n=(r=this.navigationManager)==null?void 0:r.findFirstFocusableTool();n&&n.focus()}focusLast(){var r;let n=(r=this.navigationManager)==null?void 0:r.findFirstFocusableTool(!0);n&&n.focus()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-toolbar"]],viewQuery:function(r,o){if(r&1&&(Gt(sM,5),Gt(Az,5,de)),r&2){let s;Qe(s=Xe())&&(o.navigationManager=s.first),Qe(s=Xe())&&(o.dropdowns=s)}},hostAttrs:["role","toolbar"],hostVars:2,hostBindings:function(r,o){r&1&&x("mousedown",function(a){return o.onMouseDown(a,a.target)}),r&2&&Te("_disabled",o.disabled)},inputs:{inputEditor:[0,"editor","inputEditor"],colors:"colors",disabled:"disabled",tools:"tools"},outputs:{linkAdded:"linkAdded",texClicked:"texClicked",fileAttached:"fileAttached"},ngContentSelectors:kz,decls:5,vars:7,consts:[["fileUpload",""],["image",""],[4,"ngIf"],["tuiToolbarNavigationManager","","class","t-tools-wrapper",3,"disabled",4,"ngIf"],["type","button",1,"t-prevent-parent-label-behavior"],[3,"focus","tabIndex"],["tuiToolbarNavigationManager","",1,"t-tools-wrapper",3,"disabled"],["class","t-block",4,"ngIf"],[1,"t-block"],["appearance","icon","automation-id","toolbar__undo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__redo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","disabled","iconStart","tuiHint"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor"],["tuiItem","","class","t-tool t-wrapper",3,"editor","enabledTools",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"editor",4,"ngIf"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button","class","t-tool",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor","enabledTools"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","iconStart","tuiHint"],["type","file",1,"t-file-upload",3,"change","accept","multiple","tabIndex"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"colors","editor",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"colors","editor"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-wrapper",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool",3,"click","iconStart","tuiHint"],["tuiItem","",1,"t-wrapper"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"click","iconStart","tuiHint"],["accept","image/*","type","file",1,"t-image",3,"change","tabIndex"],["tuiItem","",1,"t-tool","t-tool_margin",3,"editor"]],template:function(r,o){r&1&&(Xt(),O(0,Oz,4,2,"ng-container",2)(1,Nz,1,0,"ng-container",2),Y(2,"async"),O(3,sj,14,12,"fieldset",3),Y(4,"async")),r&2&&(v("ngIf",!o.disabled),C(),v("ngIf",J(2,3,o.editor==null?null:o.editor.stateChange$)),C(2),v("ngIf",J(4,5,o.texts$)))},dependencies:[Re,ut,C2,Le,D2,E2,w2,S2,x2,I2,J2,Ve,ze,DI,eM,tM,nM,iM,rM,oM,sM],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate}._disabled[_nghost-%COMP%]{pointer-events:none}tui-editor[_nghost-%COMP%][_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)), tui-editor [_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){border:none;outline:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper[_ngcontent-%COMP%]{scrollbar-width:none;-ms-overflow-style:none;display:flex;overflow:auto;flex-wrap:wrap;padding:0;margin:0;border:0}.t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar, .t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{display:none}.t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){padding:.25rem .75rem;border:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper._disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:var(--tui-disabled-opacity)}.t-block[_ngcontent-%COMP%]{display:flex;padding:.25rem 0}.t-block[_ngcontent-%COMP%]:empty{display:none}.t-block[_ngcontent-%COMP%]:not(:last-child):after{content:"";display:block;margin:0 .25rem;inline-size:.0625rem;background:var(--tui-background-neutral-1-pressed)}.t-tool[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}button.t-tool[_ngcontent-%COMP%]:hover, .t-tool[_ngcontent-%COMP%] button:hover{background:var(--tui-background-neutral-1-hover)}.t-tool_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-font[_ngcontent-%COMP%]{padding:.3em 0;outline:none;inline-size:100%;pointer-events:none}.t-image[_ngcontent-%COMP%]{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;font-size:0;opacity:0;cursor:pointer}.t-image[_ngcontent-%COMP%]::-webkit-file-upload-button{display:none}.t-file-upload[_ngcontent-%COMP%]{display:none}.t-color-picker[_ngcontent-%COMP%] tui-hosted-dropdown, .t-color-picker[_ngcontent-%COMP%] tui-color-picker, .t-color-picker[_ngcontent-%COMP%] tui-color-edit{display:none}.t-prevent-parent-label-behavior[_ngcontent-%COMP%]{display:none}'],changeDetection:0});let t=e;return t})();var aj=["tuiDropdown"],uj=["*",[["tools"]],[["tools"]],[["mention"]]],lj=["*","tools","tools","mention"];function cj(t,e){if(t&1){let i=q();E(0,"tui-toolbar",13),x("fileAttached",function(r){P(i);let o=_(2);return F(o.fileAttached.emit(r))}),at(1,1),w()}if(t&2){let i=_(2);v("disabled",!i.interactive())("tools",i.tools)}}function dj(t,e){if(t&1){let i=q();E(0,"div",14),x("mousedown",function(r){P(i);let o=_(2);return F(o.focus(r))}),he(1),w()}if(t&2){let i=_(2);C(),Nt(" ",i.placeholder||i.exampleText," ")}}function fj(t,e){if(t&1){let i=q();E(0,"tui-scrollbar",15),x("mousedown",function(r){P(i);let o=_(2);return F(o.focus(r))}),Qt(1,16),w()}if(t&2){_();let i=be(9);C(),v("ngTemplateOutlet",i)}}function pj(t,e){if(t&1){let i=q();E(0,"tui-scrollbar",17),x("keydown",function(r){P(i);let o=_(2);return F(o.focus(r))})("mousedown",function(r){P(i);let o=_(2);return F(o.focus(r))}),Qt(1,16),Q(2,"tui-editor-portal-host"),w()}if(t&2){_();let i=be(9);C(),v("ngTemplateOutlet",i)}}function hj(t,e){if(t&1){let i=q();E(0,"tui-toolbar",13),x("fileAttached",function(r){P(i);let o=_(4);return F(o.fileAttached.emit(r))}),at(1,2),w()}if(t&2){let i=_(4);v("disabled",!i.interactive())("tools",i.tools)}}function mj(t,e){if(t&1){let i=q();E(0,"tui-edit-link",22,3),x("addLink",function(r){P(i);let o=be(1),s=_(4);return o.anchorMode?s.addAnchor(r):s.addLink(r),F(s.closeDropdown())})("removeLink",function(){P(i);let r=be(1),o=_(4);return r.anchorMode?o.removeAnchor():o.removeLink(),F(o.closeDropdown())}),w()}}function gj(t,e){t&1&&(_t(0),at(1,3),Ct())}function yj(t,e){if(t&1&&(E(0,"div"),O(1,hj,2,2,"tui-toolbar",8)(2,mj,2,0,"tui-edit-link",20)(3,gj,2,0,"ng-container",21),w()),t&2){let i=_(3);Te("t-floating",i.floatingToolbar),C(),v("ngIf",i.floatingToolbar),C(),v("ngIf",i.isLinkSelected),C(),v("ngIf",i.isMentionMode)}}function vj(t,e){if(t&1){let i=q();E(0,"div",18,1)(2,"div",19),x("valueChange",function(r){P(i);let o=_(2);return F(o.onModelChange(r))}),w()(),O(3,yj,4,5,"ng-template",null,2,We)}if(t&2){let i=be(4),n=_(2);v("tuiDropdown",i)("tuiToolbarDropdown",n.dropdownSelectionHandler)("tuiToolbarDropdownPosition",n.floatingToolbar?"selection":"tag"),C(2),v("editable",n.interactive())}}function bj(t,e){if(t&1){let i=q();E(0,"div",6)(1,"div",7),O(2,cj,2,2,"tui-toolbar",8),E(3,"div",9),x("mousedown",function(r){P(i);let o=_();return F(o.focus(r))}),at(4),w(),O(5,dj,2,1,"div",10),w(),O(6,fj,2,1,"tui-scrollbar",11)(7,pj,3,1,"tui-scrollbar",12)(8,vj,5,4,"ng-template",null,0,We),w()}if(t&2){let i=_();C(2),v("ngIf",!i.floatingToolbar),C(3),v("ngIf",i.hasPlaceholder),C(),v("ngIf",i.floatingToolbar),C(),v("ngIf",!i.floatingToolbar)}}var _j=(()=>{let e=class e extends Er{constructor(){var n;super(r=>this.stream$.subscribe(r)),this.previousTagPosition=null,this.range=h(lI),this.doc=((n=h(Je))==null?void 0:n.document)??null,this.selection$=h(Sv),this.el=h(de),this.vcr=h(zt),this.handler$=new on(Mo),this.stream$=In([this.handler$,this.selection$.pipe(S(()=>this.getRange()),ke((r,o)=>r.startOffset===o.startOffset&&r.endOffset===o.endOffset))]).pipe(S(([r,o])=>{var a,u;let s=this.el.nativeElement.contains(o.commonAncestorContainer)||((a=o.commonAncestorContainer.parentElement)==null?void 0:a.closest("tui-dropdown"));return this.range=s&&Nf(o.commonAncestorContainer)||((u=o.commonAncestorContainer)==null?void 0:u.nodeName)==="P"?o:this.range,s&&r(this.range)})),this.position="selection",this.type="dropdown"}set tuiToolbarDropdown(n){ul(n)||this.handler$.next(n)}getClientRect(){var n,r,o;switch(this.position){case"tag":{let{commonAncestorContainer:s}=this.range,a=ui(s)?s:s.parentNode;return(n=a==null?void 0:a.parentElement)!=null&&n.closest("tui-dropdown")?this.previousTagPosition??Wi:(this.previousTagPosition=a&&ui(a)?((o=(r=this.doc)==null?void 0:r.querySelector(".ProseMirror-selectednode"))==null?void 0:o.getBoundingClientRect())||a.getBoundingClientRect():Wi,this.previousTagPosition)}case"word":return Av(this.range).getBoundingClientRect();default:{let s=this.range.getBoundingClientRect();return s.x===0&&s.y===0&&s.width===0&&s.height===0?(this.el.nativeElement.querySelector("p")??this.el.nativeElement).getBoundingClientRect():s}}}ngOnDestroy(){this.ghost&&this.vcr.element.nativeElement.removeChild(this.ghost)}getRange(){var r,o;let n=(r=this.doc)==null?void 0:r.getSelection();return(o=(n==null?void 0:n.rangeCount)&&n.getRangeAt(0)||this.range)==null?void 0:o.cloneRange()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiToolbarDropdown",""]],inputs:{position:[0,"tuiToolbarDropdownPosition","position"],tuiToolbarDropdown:"tuiToolbarDropdown"},features:[Z([Ho(e),Ts(e)]),oe]});let t=e;return t})(),aM=(()=>{let e=class e extends Cs{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Cj=[{provide:Tv,deps:[iS],useFactory:t=>{let e=new ur(1);return Promise.all(t).then(i=>e.next(i)).catch(()=>e.next([])),e}},{provide:Il,deps:[oi],useFactory:t=>t.createElement("div")},{provide:Ra,deps:[Il,Tv,pS,Je,xe],useFactory:(t,e,i,n,r)=>In([i,e]).pipe($t(1),S(([o,s])=>{try{return globalThis.document||(globalThis.document=n.document),new o(U(M({},r),{element:t,extensions:s}))}catch{return null}}),Li({bufferSize:1,refCount:!0}))},je,aM],Dj=(()=>{let e=class e extends Si{constructor(){super(...arguments),this.el=h(de).nativeElement,this.type="viewport"}getClientRect(){return this.el.getBoundingClientRect()}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiEditorPortal",""]],features:[Z([{provide:kl,useExisting:aM},ES(e)]),oe]});let t=e;return t})(),Ej=(()=>{let e=class e extends _l{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-editor-portal-host"]],features:[Z([{provide:Cs,useExisting:kl},{provide:_l,useExisting:e}]),oe],decls:2,vars:0,consts:[["viewContainer",""]],template:function(r,o){r&1&&Qt(0,null,0)},styles:["[_nghost-%COMP%]{position:absolute;top:0;left:0;display:block;block-size:100%;inline-size:100%;pointer-events:none}"],changeDetection:0});let t=e;return t})(),Ibe=(()=>{let e=class e extends bl{constructor(){var n;super(...arguments),this.contentProcessor=h(sS,{optional:!0}),this.doc=((n=h(Je))==null?void 0:n.document)??null,this.zone=h(me),this.destroy$=h(it),this.options=h(xe),this.editorLoaded=ge(!1),this.editorLoaded$=h(Ra),this.cd=h(st),this.$=this.editorLoaded$.pipe(Jn(0),Se()).subscribe(()=>{var r;this.hasMentionPlugin=!!((r=this.editorService.getOriginTiptapEditor())!=null&&r.extensionManager.extensions.find(o=>o.name==="mention")),this.listenResizeEvents(),this.editorService.setValue(this.firstInitialValue),this.editorLoaded.set(!0),this.cd.detectChanges(),this.patchContentEditableElement()}),this.firstInitialValue="",this.exampleText=this.options.exampleText,this.placeholder=this.options.placeholder,this.floatingToolbar=this.options.floatingToolbar,this.tools=this.options.tools,this.fileAttached=new _e,this.focusIn=new _e,this.focusOut=new _e,this.hasMentionPlugin=!1,this.hovered=Cn(nt(ct(Ee(),"mouseenter").pipe(S(Mo)),ct(Ee(),"mouseleave").pipe(S(Di))).pipe(Jr(this.cdr))),this.focused=Dp(!1),this.m=Ep(this.mode),this.s=Ha(Pt(()=>this.disabled()?"disabled":this.hovered()?"hover":null)),this.editorService=h(je),this.openDropdownWhen=r=>this.currentFocusedNodeIsTextAnchor(r)||this.currentFocusedNodeIsImageAnchor||this.isMentionMode}set readOnlyMode(n){this.readOnly.set(n)}get editor(){return this.editorService.getOriginTiptapEditor()?this.editorService:null}get nativeFocusableElement(){var n,r;return((r=(n=this.el)==null?void 0:n.nativeElement)==null?void 0:r.querySelector("[contenteditable].ProseMirror"))||null}get selectionState(){return n2(this.editor)}get mentionSuggestions(){let n=this.selectionState.before;return n!=null&&n.startsWith("@")&&n.length>1&&(n==null?void 0:n.replace("@",""))||""}get isMentionMode(){var n;return this.hasMentionPlugin&&((n=this.selectionState.before)==null?void 0:n.startsWith("@"))}writeValue(n){var o,s,a,u;let r=((o=this.contentProcessor)==null?void 0:o.fromControlValue(n))??n;super.writeValue(r),this.firstInitialValue!==r&&(this.firstInitialValue=r??""),this.focused()||(u=(a=(s=this.doc)==null?void 0:s.getSelection)==null?void 0:a.call(s))==null||u.removeAllRanges(),this.editorLoaded()&&this.editorService.setValue(r??"")}ngOnDestroy(){var n;(n=this.editor)==null||n.destroy()}get dropdownSelectionHandler(){return!this.focused()||this.readOnly()?Di:this.floatingToolbar?()=>this.value().trim()!=="":this.openDropdownWhen}get hasPlaceholder(){return!!(this.placeholder||this.exampleText)&&!this.value()&&!this.readOnly()}get isLinkSelected(){var o,s,a,u,l,c;let n=(s=(o=this.doc)==null?void 0:o.getSelection())==null?void 0:s.focusNode,r=n==null?void 0:n.parentNode;return(r==null?void 0:r.nodeName.toLowerCase())==="a"||((a=r==null?void 0:r.parentNode)==null?void 0:a.nodeName.toLowerCase())==="a"||(n==null?void 0:n.nodeName.toLowerCase())==="a"||!!((u=n==null?void 0:n.parentElement)!=null&&u.closest("a"))||!!((l=n==null?void 0:n.parentElement)!=null&&l.closest("tui-edit-link"))||!!((c=n==null?void 0:n.parentElement)!=null&&c.closest("tui-dropdown"))}onModelChange(n){var o;let r=((o=this.contentProcessor)==null?void 0:o.toControlValue(n))??n;r!==this.control.value&&this.onChange(r??"")}onActiveZone(n){this.focused.set(n),n?this.focusIn.emit():this.focusOut.emit()}addAnchor(n){var r;(r=this.editor)==null||r.setAnchor(n)}removeAnchor(){var n;(n=this.editor)==null||n.removeAnchor()}closeDropdown(){var n;(n=this.tuiDropdown)==null||n.toggle(!1)}addLink(n){var r,o;(r=this.editor)==null||r.selectClosest(),(o=this.editor)==null||o.setLink(n)}removeLink(){var n;(n=this.editor)==null||n.unsetLink()}focus(n){var o,s,a,u;(o=this.nativeFocusableElement)!=null&&o.contains(n.target)||(a=(s=this.toolbar)==null?void 0:s.el)!=null&&a.contains(n.target)||(n.preventDefault(),(u=this.nativeFocusableElement)==null||u.focus())}get focusNode(){var n,r,o;return((o=(r=(n=this.doc)==null?void 0:n.getSelection)==null?void 0:r.call(n))==null?void 0:o.focusNode)??null}get currentFocusedNodeIsImageAnchor(){var r,o,s;let n=(o=(r=this.focusNode)==null?void 0:r.childNodes[0])==null?void 0:o.nodeName;return((s=this.focusNode)==null?void 0:s.nodeName)==="A"&&n&&["IMG","TUI-IMAGE-EDITOR"].includes(n)||!1}currentFocusedNodeIsTextAnchor(n){var r,o,s,a;return((r=this.focusNode)==null?void 0:r.nodeName)==="A"||!!((s=(o=this.focusNode)==null?void 0:o.parentElement)!=null&&s.closest("tui-edit-link"))||!!((a=n.startContainer.parentElement)!=null&&a.closest("a"))&&o2(n)}patchContentEditableElement(){var n,r;(n=this.nativeFocusableElement)==null||n.setAttribute("translate",this.options.translate),(r=this.nativeFocusableElement)==null||r.setAttribute("spellcheck",String(this.options.spellcheck))}listenResizeEvents(){var n;(n=this.el)!=null&&n.nativeElement&&ct(this.el.nativeElement,Lo).pipe(gi(0),Ei(this.zone),Se(this.destroy$)).subscribe(()=>this.editorService.valueChange$.next(this.editorService.getHTML()))}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-editor"]],viewQuery:function(r,o){if(r&1&&(Gt(Ol,5,de),Gt(aj,5),Gt(ob,5)),r&2){let s;Qe(s=Xe())&&(o.el=s.first),Qe(s=Xe())&&(o.tuiDropdown=s.first),Qe(s=Xe())&&(o.toolbar=s.first)}},hostAttrs:["ngSkipHydration","true"],hostBindings:function(r,o){r&1&&x("tuiActiveZoneChange",function(a){return o.onActiveZone(a)})("click",function(a){return o.focus(a)})},inputs:{exampleText:"exampleText",placeholder:"placeholder",floatingToolbar:"floatingToolbar",tools:"tools",readOnlyMode:[0,"readOnly","readOnlyMode"]},outputs:{fileAttached:"fileAttached",focusIn:"focusIn",focusOut:"focusOut"},features:[Z([Cj,{provide:Cp,useValue:{appearance:"textfield"}},vI({delay:Ov,query:"[contenteditable].ProseMirror, input:not(.t-image, .t-file-upload), textarea, select"})]),Mt([{directive:Ji,inputs:["tuiAppearance","appearance"]},{directive:xi,outputs:["tuiActiveZoneChange","tuiActiveZoneChange"]}]),oe],ngContentSelectors:lj,decls:2,vars:2,consts:[["editor",""],["tuiDropdown","tuiDropdown"],["dropdown",""],["link",""],["class","t-wrapper",4,"ngIf"],[1,"t-hidden-editor",3,"content"],[1,"t-wrapper"],[1,"t-toolbar-wrapper"],[3,"disabled","tools","fileAttached",4,"ngIf"],[1,"t-editor-label",3,"mousedown"],["class","t-editor-example-text",3,"mousedown",4,"ngIf"],["class","t-scrollbar",3,"mousedown",4,"ngIf"],["tuiEditorPortal","","class","t-scrollbar",3,"keydown","mousedown",4,"ngIf"],[3,"fileAttached","disabled","tools"],[1,"t-editor-example-text",3,"mousedown"],[1,"t-scrollbar",3,"mousedown"],[3,"ngTemplateOutlet"],["tuiEditorPortal","",1,"t-scrollbar",3,"keydown","mousedown"],["tuiDropdownLimitWidth","auto",3,"tuiDropdown","tuiToolbarDropdown","tuiToolbarDropdownPosition"],["tuiTiptapEditor","",1,"tui-editor-socket",3,"valueChange","editable"],[3,"addLink","removeLink",4,"ngIf"],[4,"ngIf"],[3,"addLink","removeLink"]],template:function(r,o){r&1&&(Xt(uj),O(0,bj,10,4,"div",4),Q(1,"tui-editor-socket",5)),r&2&&(v("ngIf",o.editorLoaded()),C(),v("content",o.value()))},dependencies:[ut,LT,Is,Ze,b2,_j,Dj,Ej,_2,Wa,Ol,ob],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate;font:var(--tui-font-text-m);border-radius:var(--tui-radius-m);max-block-size:inherit;min-block-size:10rem;box-sizing:border-box;overflow:auto}[_nghost-%COMP%]:after{content:"";display:table;clear:both}.t-wrapper[_ngcontent-%COMP%]{display:flex;block-size:100%;max-block-size:inherit;min-block-size:inherit;cursor:text;overflow:clip;flex-direction:column;border-radius:inherit}.t-editor-label[_ngcontent-%COMP%]{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none;will-change:transform;transform:translateY(-.25rem);inline-size:95%;font-size:.9375rem}.t-editor-label_raised[_ngcontent-%COMP%]{transform:translateY(-.4375rem)}.t-editor-label[_ngcontent-%COMP%]:not(:empty){margin:1rem 1rem -.625rem;min-block-size:1.625rem}.t-editor-label[_ngcontent-%COMP%]:empty{margin-bottom:1rem}.t-editor-example-text[_ngcontent-%COMP%]{position:absolute;left:1rem;margin-top:.1875rem;color:var(--tui-text-secondary);letter-spacing:normal;text-transform:none}.t-scrollbar[_ngcontent-%COMP%]{display:flex;padding-bottom:.75rem;box-sizing:border-box;flex:1}.t-floating[_ngcontent-%COMP%], .t-floating[_ngcontent-%COMP%] .t-tools-wrapper{max-inline-size:var(--tui-floating-toolbar-max-width, 31.25rem);flex-wrap:nowrap}'],changeDetection:0});let t=e;return t})();var sb=class{constructor(e,i,n){let r=i.get(vr),s=i.get(Vr).resolveComponentFactory(e);this.componentRef=s.create(i,[]),this.updateProps(n),r.attachView(this.componentRef.hostView)}get el(){return this.componentRef.injector.get(de)}get dom(){return this.el.nativeElement}updateProps(e){Object.entries(e).forEach(([i,n])=>{this.instance[i]=n})}detectChanges(){this.componentRef.changeDetectorRef.detectChanges()}destroy(){this.componentRef.destroy()}get instance(){return this.componentRef.instance}},zp=class{},tu=class extends I1{constructor(e,i,n){super(e,i,n),this.contentDOMElement=null}get dom(){return this.renderer.dom}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}mount(){let e=this.options.injector,i=e.get(qe),n={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode(),view:this.view,innerDecorations:this.innerDecorations,HTMLAttributes:this.HTMLAttributes};this.editor.on("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.renderer=new sb(this.component,e,n),this.extension.config.draggable&&(this.renderer.el.nativeElement.ondragstart=o=>{this.onDragStart(o)});let r=this.node.isInline?"span":"div";this.contentDOMElement=this.node.isLeaf?null:i.createElement(r),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit",this.renderer.detectChanges()),this.appendContendDom()}update(e,i){return this.options.update?this.options.update(e,i):e.type!==this.node.type?!1:(e===this.node&&this.decorations===i||(this.node=e,this.decorations=i,this.renderer.updateProps({node:e,decorations:i}),this.appendContendDom()),!0)}handleSelectionUpdate(){let{from:e,to:i}=this.editor.state.selection;e<=this.getPos()&&i>=this.getPos()+this.node.nodeSize?this.selectNode():this.deselectNode()}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.contentDOMElement=null}appendContendDom(){let e=this.dom.querySelector("[data-node-view-content]");this.contentDOMElement&&e&&!e.contains(this.contentDOMElement)&&e.appendChild(this.contentDOMElement)}};var wj=["container"],Tj=["*"],xj=t=>[t,0],Ij=()=>[1,0],Sj=()=>[0,1];function Mj(t,e){if(t&1){let i=q();E(0,"div",5),x("tuiSizeChange",function(r){P(i);let o=_();return F(o.sizeChange.emit(r))}),w()}t&2&&v("tuiResizer",Qr(1,Sj))}var jp=(()=>{let e=class e extends zp{constructor(){super(...arguments),this.currentHeight=0,this.currentWidth=0}get node(){return this.localNode}set node(n){this.localNode=n,this.changeDetector.markForCheck()}get attrs(){var n;return((n=this.node)==null?void 0:n.attrs)||{src:""}}get width(){return(this.currentWidth||this.attrs.width)??null}get height(){return(this.currentHeight||this.attrs.height)??null}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,standalone:!1,features:[oe]});let t=e;return t})(),Up=(()=>{let e=class e{constructor(){this.autoHeight=!1,this.width=null,this.height=null,this.sizeChange=new _e}get hostWidth(){return vy(this.width)?ht(this.width):this.width}get hostHeight(){return this.autoHeight?null:vy(this.height)?ht(this.height):this.height}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-editor-resizable"]],viewQuery:function(r,o){if(r&1&&Gt(wj,7),r&2){let s;Qe(s=Xe())&&(o.container=s.first)}},hostVars:4,hostBindings:function(r,o){r&2&&Ye("width",o.hostWidth)("height",o.hostHeight)},inputs:{autoHeight:"autoHeight",width:"width",height:"height"},outputs:{sizeChange:"sizeChange"},ngContentSelectors:Tj,decls:6,vars:8,consts:[["container",""],["tuiResizable","",1,"t-resizable"],[1,"t-handle","t-handle-left-side",3,"tuiSizeChange","tuiResizer"],["class","t-handle t-handle-bottom-side",3,"tuiResizer","tuiSizeChange",4,"ngIf"],[1,"t-handle","t-handle-right-side",3,"tuiSizeChange","tuiResizer"],[1,"t-handle","t-handle-bottom-side",3,"tuiSizeChange","tuiResizer"]],template:function(r,o){if(r&1){let s=q();Xt(),E(0,"div",1,0),at(2),E(3,"div",2),x("tuiSizeChange",function(u){return P(s),F(o.sizeChange.emit(u))}),w(),O(4,Mj,1,2,"div",3),E(5,"div",4),x("tuiSizeChange",function(u){return P(s),F(o.sizeChange.emit(u))}),w()()}r&2&&(Te("t-resizable-auto-height",o.autoHeight),C(3),v("tuiResizer",Kn(5,xj,-1)),C(),v("ngIf",!o.autoHeight),C(),v("tuiResizer",Qr(7,Ij)))},dependencies:[ut,Dv,QI],styles:['[_nghost-%COMP%]{position:relative;display:inline-block;box-sizing:border-box}[_nghost-%COMP%] .t-resizable[_ngcontent-%COMP%]{box-sizing:border-box}[_nghost-%COMP%] .t-resizable-auto-height[_ngcontent-%COMP%]{block-size:auto!important}[_nghost-%COMP%] iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}[_nghost-%COMP%]:hover .t-handle[_ngcontent-%COMP%]:after{opacity:1}.t-handle[_ngcontent-%COMP%]{position:absolute;top:0;display:flex;inline-size:.75rem;cursor:col-resize;justify-content:center;align-items:center;block-size:100%}.t-handle[_ngcontent-%COMP%]:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:"";inline-size:50%;block-size:33%;box-sizing:border-box;border-radius:var(--tui-radius-m);background:var(--tui-background-accent-opposite-hover);border:.0625rem solid var(--tui-background-neutral-1-hover);opacity:0}.t-handle-left-side[_ngcontent-%COMP%]{left:0}.t-handle-bottom-side[_ngcontent-%COMP%]{top:unset;bottom:.3125rem;block-size:.95rem;inline-size:100%}.t-handle-right-side[_ngcontent-%COMP%]{right:0}'],changeDetection:0});let t=e;return t})();var uM=ft.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,renderHTML:({backgroundColor:t})=>t?{style:`background-color: ${t}`}:{},parseHTML:({style:t})=>t.backgroundColor.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).run()}}});var lM=X.create({name:"details",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{opened:{default:!0,keepOnSplit:!1,parseHTML:t=>t.getAttribute("data-opened")==="true",renderHTML:t=>({"data-opened":t.opened})}}},content:"summary detailsContent",group:"block",draggable:!0,allowGapCursor:!0,isolating:!0,parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:t}){return["div",{class:"t-details-wrapper t-details-wrapper_rendered"},["details",ee(this.options.HTMLAttributes,t),0],["button",{class:"t-details-arrow"}]]},addNodeView(){return({node:t,getPos:e})=>{if(globalThis.document){let i=document.createElement("div"),n=document.createElement("details"),r=document.createElement("button"),o=document.createElement("button");i.className="t-details-wrapper",r.className="t-details-arrow",r.type="button",o.className="t-details-delete",o.type="button",n.open=t.attrs.opened;let s=a=>{var l;let u=(e==null?void 0:e())??0;n.open=!n.open,t.attrs.opened=n.open,(l=a.target)==null||l.dispatchEvent(new CustomEvent(Lo,{bubbles:!0})),this.editor.chain().focus().setTextSelection(u).run()};return r.addEventListener("click",s),o.addEventListener("click",a=>{r.removeEventListener("click",s);let u=(e==null?void 0:e())??0;this.editor.chain().focus().setTextSelection(e==null?void 0:e()).run();let l=this.editor.state.selection.$anchor.nodeAfter,c=u+((l==null?void 0:l.nodeSize)??0);this.editor.isActive("summary")?this.editor.commands.deleteNode(this.type):this.editor.commands.deleteRange({from:u,to:c}),a.preventDefault()},{capture:!0,once:!0}),i.append(n,r,o),{dom:i,contentDOM:n}}}},addCommands(){return{setDetails:()=>({commands:t,editor:e,state:i})=>{var o,s;let n="",r=this.editor.state.selection.$anchor.pos;return globalThis.document&&(n=(((s=(o=document.defaultView)==null?void 0:o.window.getSelection())==null?void 0:s.toString().trim().length)??0)>0?Pp(i):"",setTimeout(()=>e.chain().focus().setTextSelection(r).run())),t.insertContent(`

          ${n}

          `)},removeDetails:()=>({editor:t,state:e,dispatch:i})=>(Np(e,i,this.name),t.commands.focus("end"))}}}),cM=X.create({name:"detailsContent",content:"block+",group:"block",allowGapCursor:!0,parseHTML(){return[{tag:'div[data-type="details-content"]'}]},renderHTML({HTMLAttributes:t}){return["div",ee(this.options.HTMLAttributes,t,{"data-type":"details-content"}),0]}}),dM=X.create({name:"summary",addOptions(){return{HTMLAttributes:{}}},content:"paragraph",group:"block",parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:t}){return["summary",ee(this.options.HTMLAttributes,t),0]}});var fM=ft.create({name:"fileLink",addCommands(){return{setFileLink:t=>({state:e,chain:i})=>{let{selection:n}=e,r=Math.abs(n.to-n.from),o=' ';return(r>0?i().toggleMark("link",{href:t.link},{extendEmptyMarkRange:!0}).setTextSelection(n.to).insertContent(o):i().insertContent(`${t.name}${o}`)).setTextSelection(n.to).run()}}}});var pM=ft.create({name:"fontColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontColor:{default:null,renderHTML:({fontColor:t})=>t?{style:`color: ${t}`}:{},parseHTML:({style:t})=>t.color.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands(){return{setFontColor:t=>({chain:e})=>e().setMark("textStyle",{fontColor:t}).run(),unsetFontColor:()=>({chain:t})=>t().setMark("textStyle",{fontColor:null}).run()}}});var hM=ft.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:({style:t})=>t.fontSize,renderHTML:({fontSize:t})=>t?{style:`font-size: ${t}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});function Aj(t){return t.isActive("bulletList")||t.isActive("orderedList")||t.isActive("taskList")}var mM=ft.create({name:"indent",addKeyboardShortcuts(){return{Tab:()=>Aj(this.editor)?!1:this.editor.commands.insertContent(" ")}}});var gM=Zt.create({name:"jumpAnchor",priority:1e3,keepOnSplit:!1,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},parseHTML(){return[{tag:'a[data-type="jump-anchor"]'}]},renderHTML({HTMLAttributes:t}){return["a",ee({"data-type":"jump-anchor"},t),0]},addCommands(){return{setAnchor:t=>({chain:e,state:i,editor:n})=>{let{from:r,to:o}=Ya(n),a=Fp(i,o)===" ",u=e().setTextSelection({from:r,to:o}).extendMarkRange("jumpAnchor").setMark("jumpAnchor",{id:t});return(a?u.setTextSelection(o-1):u.setTextSelection(o).insertContent(fp).setTextSelection(o-1)).run()},removeAnchor:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).run()}}});var kj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Oj="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",iu=(t,e)=>{for(let i in e)t[i]=e[i];return t},pb="numeric",hb="ascii",mb="alpha",Hl="asciinumeric",Ll="alphanumeric",gb="domain",EM="emoji",Nj="scheme",Pj="slashscheme",ab="whitespace";function Fj(t,e){return t in e||(e[t]=[]),e[t]}function ks(t,e,i){e[pb]&&(e[Hl]=!0,e[Ll]=!0),e[hb]&&(e[Hl]=!0,e[mb]=!0),e[Hl]&&(e[Ll]=!0),e[mb]&&(e[Ll]=!0),e[Ll]&&(e[gb]=!0),e[EM]&&(e[gb]=!0);for(let n in e){let r=Fj(n,i);r.indexOf(t)<0&&r.push(t)}}function Rj(t,e){let i={};for(let n in e)e[n].indexOf(t)>=0&&(i[n]=!0);return i}function Yn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Yn.groups={};Yn.prototype={accepts(){return!!this.t},go(t){let e=this,i=e.j[t];if(i)return i;for(let n=0;nt.ta(e,i,n,r),Lt=(t,e,i,n,r)=>t.tr(e,i,n,r),yM=(t,e,i,n,r)=>t.ts(e,i,n,r),L=(t,e,i,n,r)=>t.tt(e,i,n,r),so="WORD",yb="UWORD",wM="ASCIINUMERICAL",TM="ALPHANUMERICAL",$l="LOCALHOST",vb="TLD",bb="UTLD",qp="SCHEME",nu="SLASH_SCHEME",Cb="NUM",_b="WS",Db="NL",Bl="OPENBRACE",Vl="CLOSEBRACE",Zp="OPENBRACKET",Kp="CLOSEBRACKET",Yp="OPENPAREN",Qp="CLOSEPAREN",Xp="OPENANGLEBRACKET",Jp="CLOSEANGLEBRACKET",eh="FULLWIDTHLEFTPAREN",th="FULLWIDTHRIGHTPAREN",nh="LEFTCORNERBRACKET",ih="RIGHTCORNERBRACKET",rh="LEFTWHITECORNERBRACKET",oh="RIGHTWHITECORNERBRACKET",sh="FULLWIDTHLESSTHAN",ah="FULLWIDTHGREATERTHAN",uh="AMPERSAND",Eb="APOSTROPHE",lh="ASTERISK",jo="AT",ch="BACKSLASH",dh="BACKTICK",fh="CARET",Uo="COLON",wb="COMMA",ph="DOLLAR",wr="DOT",hh="EQUALS",Tb="EXCLAMATION",Ai="HYPHEN",zl="PERCENT",mh="PIPE",gh="PLUS",yh="POUND",jl="QUERY",xb="QUOTE",xM="FULLWIDTHMIDDLEDOT",Ib="SEMI",Tr="SLASH",Ul="TILDE",vh="UNDERSCORE",IM="EMOJI",bh="SYM",SM=Object.freeze({__proto__:null,WORD:so,UWORD:yb,ASCIINUMERICAL:wM,ALPHANUMERICAL:TM,LOCALHOST:$l,TLD:vb,UTLD:bb,SCHEME:qp,SLASH_SCHEME:nu,NUM:Cb,WS:_b,NL:Db,OPENBRACE:Bl,CLOSEBRACE:Vl,OPENBRACKET:Zp,CLOSEBRACKET:Kp,OPENPAREN:Yp,CLOSEPAREN:Qp,OPENANGLEBRACKET:Xp,CLOSEANGLEBRACKET:Jp,FULLWIDTHLEFTPAREN:eh,FULLWIDTHRIGHTPAREN:th,LEFTCORNERBRACKET:nh,RIGHTCORNERBRACKET:ih,LEFTWHITECORNERBRACKET:rh,RIGHTWHITECORNERBRACKET:oh,FULLWIDTHLESSTHAN:sh,FULLWIDTHGREATERTHAN:ah,AMPERSAND:uh,APOSTROPHE:Eb,ASTERISK:lh,AT:jo,BACKSLASH:ch,BACKTICK:dh,CARET:fh,COLON:Uo,COMMA:wb,DOLLAR:ph,DOT:wr,EQUALS:hh,EXCLAMATION:Tb,HYPHEN:Ai,PERCENT:zl,PIPE:mh,PLUS:gh,POUND:yh,QUERY:jl,QUOTE:xb,FULLWIDTHMIDDLEDOT:xM,SEMI:Ib,SLASH:Tr,TILDE:Ul,UNDERSCORE:vh,EMOJI:IM,SYM:bh}),ro=/[a-z]/,Rl=new RegExp("\\p{L}","u"),ub=new RegExp("\\p{Emoji}","u");var oo=/\d/,lb=/\s/;var vM="\r",cb=` -`,Lj="\uFE0F",Hj="\u200D",db="\uFFFC",$p=null,Gp=null;function Bj(t=[]){let e={};Yn.groups=e;let i=new Yn;$p==null&&($p=bM(kj)),Gp==null&&(Gp=bM(Oj)),L(i,"'",Eb),L(i,"{",Bl),L(i,"}",Vl),L(i,"[",Zp),L(i,"]",Kp),L(i,"(",Yp),L(i,")",Qp),L(i,"<",Xp),L(i,">",Jp),L(i,"\uFF08",eh),L(i,"\uFF09",th),L(i,"\u300C",nh),L(i,"\u300D",ih),L(i,"\u300E",rh),L(i,"\u300F",oh),L(i,"\uFF1C",sh),L(i,"\uFF1E",ah),L(i,"&",uh),L(i,"*",lh),L(i,"@",jo),L(i,"`",dh),L(i,"^",fh),L(i,":",Uo),L(i,",",wb),L(i,"$",ph),L(i,".",wr),L(i,"=",hh),L(i,"!",Tb),L(i,"-",Ai),L(i,"%",zl),L(i,"|",mh),L(i,"+",gh),L(i,"#",yh),L(i,"?",jl),L(i,'"',xb),L(i,"/",Tr),L(i,";",Ib),L(i,"~",Ul),L(i,"_",vh),L(i,"\\",ch),L(i,"\u30FB",xM);let n=Lt(i,oo,Cb,{[pb]:!0});Lt(n,oo,n);let r=Lt(n,ro,wM,{[Hl]:!0}),o=Lt(n,Rl,TM,{[Ll]:!0}),s=Lt(i,ro,so,{[hb]:!0});Lt(s,oo,r),Lt(s,ro,s),Lt(r,oo,r),Lt(r,ro,r);let a=Lt(i,Rl,yb,{[mb]:!0});Lt(a,ro),Lt(a,oo,o),Lt(a,Rl,a),Lt(o,oo,o),Lt(o,ro),Lt(o,Rl,o);let u=L(i,cb,Db,{[ab]:!0}),l=L(i,vM,_b,{[ab]:!0}),c=Lt(i,lb,_b,{[ab]:!0});L(i,db,c),L(l,cb,u),L(l,db,c),Lt(l,lb,c),L(c,vM),L(c,cb),Lt(c,lb,c),L(c,db,c);let f=Lt(i,ub,IM,{[EM]:!0});L(f,"#"),Lt(f,ub,f),L(f,Lj,f);let p=L(f,Hj);L(p,"#"),Lt(p,ub,f);let m=[[ro,s],[oo,r]],g=[[ro,null],[Rl,a],[oo,o]];for(let y=0;y<$p.length;y++)zo(i,$p[y],vb,so,m);for(let y=0;yy[0]>b[0]?1:-1);for(let y=0;y=0?I[gb]=!0:ro.test(b)?oo.test(b)?I[Hl]=!0:I[hb]=!0:I[pb]=!0,yM(i,b,b,I)}return yM(i,"localhost",$l,{ascii:!0}),i.jd=new Yn(bh),{start:i,tokens:iu({groups:e},SM)}}function MM(t,e){let i=Vj(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=i.length,r=[],o=0,s=0;for(;s=0&&(f+=i[s].length,p++),l+=i[s].length,o+=i[s].length,s++;o-=f,s-=p,l-=f,r.push({t:c.t,v:e.slice(o-l,o),s:o-l,e:o})}return r}function Vj(t){let e=[],i=t.length,n=0;for(;n56319||n+1===i||(o=t.charCodeAt(n+1))<56320||o>57343?t[n]:t.slice(n,n+2);e.push(s),n+=s.length}return e}function zo(t,e,i,n,r){let o,s=e.length;for(let a=0;a=0;)o++;if(o>0){e.push(i.join(""));for(let s=parseInt(t.substring(n,n+o),10);s>0;s--)i.pop();n+=o}else i.push(t[n]),n++}return e}var Gl={defaultProtocol:"http",events:null,format:_M,formatHref:_M,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Sb(t,e=null){let i=iu({},Gl);t&&(i=iu(i,t instanceof Sb?t.o:t));let n=i.ignoreTags,r=[];for(let o=0;oi?n.substring(0,i)+"\u2026":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Gl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,i=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",i,this),r=t.get("tagName",i,e),o=this.toFormattedString(t),s={},a=t.get("className",i,e),u=t.get("target",i,e),l=t.get("rel",i,e),c=t.getObj("attributes",i,e),f=t.getObj("events",i,e);return s.href=n,a&&(s.class=a),u&&(s.target=u),l&&(s.rel=l),c&&iu(s,c),{tagName:r,attributes:s,content:o,eventListeners:f}}};function _h(t,e){class i extends AM{constructor(r,o){super(r,o),this.t=t}}for(let n in e)i.prototype[n]=e[n];return i.t=t,i}var CM=_h("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),DM=_h("text"),zj=_h("nl"),Wp=_h("url",{isLink:!0,toHref(t=Gl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==$l&&t[1].t===Uo}});var Mi=t=>new Yn(t);function jj({groups:t}){let e=t.domain.concat([uh,lh,jo,ch,dh,fh,ph,hh,Ai,Cb,zl,mh,gh,yh,Tr,bh,Ul,vh]),i=[Uo,wb,wr,Tb,zl,jl,xb,Ib,Xp,Jp,Bl,Vl,Kp,Zp,Yp,Qp,eh,th,nh,ih,rh,oh,sh,ah],n=[uh,Eb,lh,ch,dh,fh,ph,hh,Ai,Bl,Vl,zl,mh,gh,yh,jl,Tr,bh,Ul,vh],r=Mi(),o=L(r,Ul);Ne(o,n,o),Ne(o,t.domain,o);let s=Mi(),a=Mi(),u=Mi();Ne(r,t.domain,s),Ne(r,t.scheme,a),Ne(r,t.slashscheme,u),Ne(s,n,o),Ne(s,t.domain,s);let l=L(s,jo);L(o,jo,l),L(a,jo,l),L(u,jo,l);let c=L(o,wr);Ne(c,n,o),Ne(c,t.domain,o);let f=Mi();Ne(l,t.domain,f),Ne(f,t.domain,f);let p=L(f,wr);Ne(p,t.domain,f);let m=Mi(CM);Ne(p,t.tld,m),Ne(p,t.utld,m),L(l,$l,m);let g=L(f,Ai);L(g,Ai,g),Ne(g,t.domain,f),Ne(m,t.domain,f),L(m,wr,p),L(m,Ai,g);let y=L(m,Uo);Ne(y,t.numeric,CM);let b=L(s,Ai),D=L(s,wr);L(b,Ai,b),Ne(b,t.domain,s),Ne(D,n,o),Ne(D,t.domain,s);let I=Mi(Wp);Ne(D,t.tld,I),Ne(D,t.utld,I),Ne(I,t.domain,s),Ne(I,n,o),L(I,wr,D),L(I,Ai,b),L(I,jo,l);let N=L(I,Uo),A=Mi(Wp);Ne(N,t.numeric,A);let V=Mi(Wp),z=Mi();Ne(V,e,V),Ne(V,i,z),Ne(z,e,V),Ne(z,i,z),L(I,Tr,V),L(A,Tr,V);let ae=L(a,Uo),Pe=L(u,Uo),mt=L(Pe,Tr),At=L(mt,Tr);Ne(a,t.domain,s),L(a,wr,D),L(a,Ai,b),Ne(u,t.domain,s),L(u,wr,D),L(u,Ai,b),Ne(ae,t.domain,V),L(ae,Tr,V),L(ae,jl,V),Ne(At,t.domain,V),Ne(At,e,V),L(At,Tr,V);let Oi=[[Bl,Vl],[Zp,Kp],[Yp,Qp],[Xp,Jp],[eh,th],[nh,ih],[rh,oh],[sh,ah]];for(let Ni=0;Ni=0&&p++,r++,c++;if(p<0)r-=c,r0&&(o.push(fb(DM,e,s)),s=[]),r-=p,c-=p;let m=f.t,g=i.slice(r-c,r);o.push(fb(m,e,g))}}return s.length>0&&o.push(fb(DM,e,s)),o}function fb(t,e,i){let n=i[0].s,r=i[i.length-1].e,o=e.slice(n,r);return new t(o,i)}var $j=typeof console<"u"&&console&&console.warn||(()=>{}),Gj="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",xt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kM(){return Yn.groups={},xt.scanner=null,xt.parser=null,xt.tokenQueue=[],xt.pluginQueue=[],xt.customSchemes=[],xt.initialized=!1,xt}function Mb(t,e=!1){if(xt.initialized&&$j(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Gj}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +`],encapsulation:2,changeDetection:0});let t=e;return t})();var lhe=(()=>{let e=class e{constructor(){this.elementRef=h(de).nativeElement,this.ngZone=h(me),this.maskedElement=null,this.options=null,this.elementPredicate=f2;let n=h(So,{self:!0,optional:!0});if(n){let r=n.writeValue.bind(n);n.writeValue=o=>{r(this.options?Yv(String(o??""),this.options):o)}}}async ngOnChanges(){let{elementPredicate:n,options:r,maskedElement:o,elementRef:s,ngZone:a}=this;if(o==null||o.destroy(),!r)return;let u=await n(s);this.elementPredicate!==n||this.options!==r||a.runOutsideAngular(()=>{this.maskedElement=new Bp(u,r)})}ngOnDestroy(){var n;(n=this.maskedElement)==null||n.destroy()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","maskito",""]],inputs:{options:[0,"maskito","options"],elementPredicate:[0,"maskitoElement","elementPredicate"]},features:[Yt]});let t=e;return t})();function i9(t,e){t&1&&(_t(0),he(1,"Edit anchor"),Ct())}function r9(t,e){t&1&&(E(0,"span"),he(1,"Link to anchor"),w())}function o9(t,e){t&1&&(E(0,"span"),he(1,"URL"),w())}function s9(t,e){if(t&1&&O(0,r9,2,0,"span",4)(1,o9,2,0,"ng-template",null,2,We),t&2){let i=be(2),n=_(2);v("ngIf",n.prefixIsHashMode)("ngIfElse",i)}}function a9(t,e){if(t&1&&(_t(0),he(1),Ct()),t&2){let i=e.ngIf,n=_(2);C(),Nt(" ",n.prefixIsHashMode?i.anchorExample:i.urlExample," ")}}function u9(t,e){if(t&1){let i=q();_t(0),E(1,"label",6)(2,"div",7),O(3,i9,2,0,"ng-container",4)(4,s9,3,2,"ng-template",null,1,We),w(),E(6,"div",8)(7,"div",9),he(8),w(),E(9,"tui-input-inline",10),x("input",function(r){P(i);let o=_();return F(o.onChange(r.target==null?null:r.target.value))})("keydown.backspace",function(){P(i);let r=_();return F(r.onBackspace())})("keydown.prevent.enter",function(){P(i);let r=_();return F(r.onSave())}),O(10,a9,2,1,"ng-container",5),Y(11,"async"),E(12,"input",11),df("ngModelChange",function(r){P(i);let o=_();return iy(o.url,r)||(o.url=r),F(r)}),x("blur",function(){P(i);let r=_();return F(r.onBlur(r.url))}),w()()()(),E(13,"button",12),x("click",function(){P(i);let r=_();return F(r.onClear())}),w(),E(14,"button",13),x("click",function(){P(i);let r=_();return F(r.onSave())}),w(),Ct()}if(t&2){let i=be(5),n=_();C(3),v("ngIf",n.anchorMode)("ngIfElse",i),C(5),ty(n.prefix),C(),Te("t-input_filled",n.hasUrl),C(),v("ngIf",J(11,9,n.texts$)),C(2),cf("ngModel",n.url),C(),v("iconStart",n.options.icons.popupLinkRemove),C(),v("iconStart",n.options.icons.popupLinkSave)}}function l9(t,e){if(t&1){let i=q();E(0,"a",14),he(1),Y(2,"tuiShortUrl"),w(),E(3,"button",15),x("click",function(){P(i);let r=_();return F(r.onEdit())}),w(),E(4,"button",16),x("click",function(){P(i);let r=_();return F(r.onRemove())}),w()}if(t&2){let i=_();v("href",i.href,Kd)("iconStart",i.prefixIsHashMode?i.options.icons.hash:i.options.icons.externalLink),C(),Nt(" ",J(2,5,i.url)," "),C(2),v("iconStart",i.options.icons.popupPreviewLinkEdit),C(),v("iconStart",i.options.icons.popupPreviewLinkClear)}}function c9(t,e){if(t&1){let i=q();E(0,"button",20),x("mousedown",function(){let r=P(i).$implicit,o=_(2);return F(o.setAnchor(r))}),he(1),w()}if(t&2){let i=e.$implicit;C(),Nt(" #",i," ")}}function d9(t,e){if(t&1&&(_t(0),Q(1,"hr",17),E(2,"tui-scrollbar")(3,"div",18),O(4,c9,2,1,"button",19),Y(5,"tuiFilterAnchors"),w()(),Ct()),t&2){let i=_();C(4),v("ngForOf",mT(5,1,i.anchorIds,i.prefix,i.url))}}var f9=(()=>{let e=class e{transform(n,r,o){return r==="#"?n.filter(s=>s!==o):n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275pipe=$i({name:"tuiFilterAnchors",type:e,pure:!0});let t=e;return t})(),Qv=60,y2=Qv-20,p9=Qv-y2-10,h9=(()=>{let e=class e{transform(n){return n.length-1?[e.slice(0,n+xl.length),e.slice(n+xl.length,e.length)]:["",e],s=o+(i.length?`?${i}`:""),a=[r,s].filter(Boolean);return o!=null&&o.includes("://")&&a.length>1?v2(s):a}function m2(t=""){let[e="",i=""]=t.split(/\?/)??[],[n,r]=e.split(/:/).slice(-2).filter(Boolean);return!(e.includes("/")&&e.lastIndexOf(":")>e.indexOf("/")||e.includes("?")&&e.lastIndexOf(":")>e.indexOf("?"))&&n&&r&&!m9(e)?[`${n}:`,r+(i.length?`?${i}`:"")]:[]}function g2(t=""){if(t.startsWith(Ln))return{prefix:Ln,path:t.slice(1)};let[e="",i=""]=t.includes(xl)?v2(t):m2(t);if(i.includes(tS)){let[n,r]=m2(i);if(n&&r)return{prefix:n,path:r}}return t.startsWith("/")&&!t.startsWith("//")?{prefix:t.slice(0,1),path:t.slice(1)}:t.startsWith("./")?{prefix:t.slice(0,2),path:t.slice(2)}:{prefix:e,path:e===""?t:i}}function m9(t){return new RegExp(String.raw`^([a-zA-Z]+:\/\/)?`+String.raw`((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|localhost|`+String.raw`((\d{1,3}\.){3}\d{1,3}))`+String.raw`(\:\d+)?(\/[-a-z\d%_.~+\:]*)*`+String.raw`(\?[)(;&a-z\d%_.~+=-]*)?`+String.raw`(\#[-a-z\d_]*)?$`,"i").test(t)}var b2=(()=>{let e=class e{constructor(){var n;this.doc=((n=h(Je))==null?void 0:n.document)??null,this.isOnlyAnchorMode=this.detectAnchorMode(),this.injectionEditor=h(je,{optional:!0}),this.options=h(xe),this.url=this.getHrefOrAnchorId(),this.edit=!this.url,this.prefix=this.makeDefaultPrefix(),this.anchorIds=this.getAllAnchorsIds(),this.texts$=h(cS),this.inputEditor=null,this.addLink=new _e,this.removeLink=new _e}set anchorMode(n){this.isOnlyAnchorMode=n,this.prefix=n?Ln:this.makeDefaultPrefix()}get anchorMode(){return this.isOnlyAnchorMode}get editor(){return this.injectionEditor??this.inputEditor}get defaultProtocol(){var n;return((n=this.options.linkOptions)==null?void 0:n.protocol)??wv}get prefixIsHashMode(){return this.prefix===Ln}get hasUrl(){return!!this.url}get href(){return`${this.prefix}${this.url}`}get showAnchorsList(){return!this.anchorMode&&this.edit&&this.anchorIds.length>0}onSelectionChange(){this.isViewMode&&(this.url=this.getHrefOrAnchorId(),this.anchorMode=this.detectAnchorMode())}onMouseDown(n){ui(n.target)&&!n.target.matches("a, button, input")&&n.preventDefault()}setAnchor(n){this.url=n,this.changePrefix(!0),this.addLink.emit(this.href)}changePrefix(n){this.prefix=n?Ln:this.defaultProtocol}onSave(){this.url?this.addLink.emit(this.href):this.removeLink.emit()}onBackspace(){this.url||(this.prefix=this.isOnlyAnchorMode?Ln:this.defaultProtocol)}onEdit(){this.edit=!0}onRemove(){this.removeLink.emit()}onChange(n){this.url=this.removePrefix(n)}onBlur(n){var o,s,a,u;let r=(o=this.editor)==null?void 0:o.getSelectionSnapshot();r&&!n&&!this.url&&((s=this.editor)==null||s.setTextSelection({from:r.anchor,to:r.head}),this.anchorMode?(a=this.editor)==null||a.removeAnchor():(u=this.editor)==null||u.toggleLink(""))}onClear(){this.url=""}get isViewMode(){return!this.edit}makeDefaultPrefix(){var o;let n=this.getAnchorElement(),r=g2((n==null?void 0:n.getAttribute("href"))??"").prefix||this.defaultProtocol;return n?this.isOnlyAnchorMode?Ln:!n.getAttribute("href")&&n.getAttribute("id")||(o=n.getAttribute("href"))!=null&&o.startsWith(Ln)?Ln:r:r}detectAnchorMode(){let n=this.getAnchorElement();return!(n!=null&&n.href)&&(!!(n!=null&&n.getAttribute("id"))||(n==null?void 0:n.getAttribute("data-type"))==="jump-anchor")}getFocusedParentElement(){var n,r,o,s;return((s=(o=(r=(n=this.doc)==null?void 0:n.getSelection)==null?void 0:r.call(n))==null?void 0:o.focusNode)==null?void 0:s.parentElement)||null}getAnchorElement(){var r;let n=this.getFocusedParentElement();return(n==null?void 0:n.closest("a"))??((r=n==null?void 0:n.querySelector("img"))==null?void 0:r.closest("a"))??null}getHrefOrAnchorId(){let n=this.getAnchorElement();return n?this.removePrefix(n.getAttribute("href")??n.getAttribute("id")??""):this.url}removePrefix(n){let r=n.startsWith(Ln)||this.prefix===Ln||n.startsWith("/")||n.startsWith("./")||n.startsWith("http")||n.startsWith("://")?n:`${this.prefix??""}${n}`,{prefix:o,path:s}=g2(r);return this.isOnlyAnchorMode||o===Ln||o===""&&this.prefix===Ln?this.prefix=Ln:o===""?this.prefix=this.defaultProtocol:this.prefix=o,s}getAllAnchorsIds(){var r,o;let n=Array.from(((o=(r=this.editor)==null?void 0:r.getOriginTiptapEditor())==null?void 0:o.view.dom.querySelectorAll('[data-type="jump-anchor"]'))??[]);return Array.from(n).map(s=>s.getAttribute("id")??"").filter(Boolean)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-edit-link"]],hostBindings:function(r,o){r&1&&x("selectionchange",function(){return o.onSelectionChange()},!1,Nn)("mousedown",function(a){return o.onMouseDown(a)})},inputs:{inputEditor:[0,"editor","inputEditor"],anchorMode:"anchorMode"},outputs:{addLink:"addLink",removeLink:"removeLink"},decls:5,vars:3,consts:[["view",""],["fullOptions",""],["urlTitle",""],[1,"t-edit-link"],[4,"ngIf","ngIfElse"],[4,"ngIf"],[1,"t-label"],[1,"t-label-properties"],[1,"t-url"],[1,"t-prefix"],["tuiAutoFocus","",1,"t-input",3,"input","keydown.backspace","keydown.prevent.enter"],[3,"ngModelChange","blur","ngModel"],["appearance","icon","size","s","title","Clear","tuiIconButton","","type","button",1,"t-button",3,"click","iconStart"],["appearance","icon","size","s","title","Save","tuiIconButton","","type","button",1,"t-button",3,"click","iconStart"],["target","_blank","tuiLink","",1,"t-link",3,"href","iconStart"],["appearance","icon","size","s","title","Change link","tuiIconButton","","type","button",1,"t-button","t-edit-button",3,"click","iconStart"],["appearance","icon","automation-id","toolbar__popup-link-clear-button","size","s","title","Remove link","tuiIconButton","","type","button",1,"t-button",3,"click","iconStart"],[1,"t-hr"],[1,"t-anchor-list"],["type","button","class","t-anchor",3,"mousedown",4,"ngFor","ngForOf"],["type","button",1,"t-anchor",3,"mousedown"]],template:function(r,o){if(r&1&&(E(0,"div",3),O(1,u9,15,11,"ng-container",4)(2,l9,5,7,"ng-template",null,0,We),w(),O(4,d9,6,5,"ng-container",5)),r&2){let s=be(3);C(),v("ngIf",o.edit)("ngIfElse",s),C(3),v("ngIf",o.showAnchorsList)}},dependencies:[Re,wf,So,Df,_r,Ci,ut,_I,Le,f9,h2,IS,Wa,h9],styles:["[_nghost-%COMP%]{display:block;min-inline-size:18.75rem}.t-edit-link[_ngcontent-%COMP%]{display:flex;min-block-size:4rem;align-items:center;padding-right:.75rem}.t-label[_ngcontent-%COMP%]{font:var(--tui-font-text-s);block-size:var(--tui-height-l);box-sizing:border-box;padding:.4375rem 1rem;min-inline-size:12.5rem;max-inline-size:25rem;inline-size:100%}.t-label-properties[_ngcontent-%COMP%]{display:flex;align-items:center;max-inline-size:8.375rem;justify-content:space-between}.t-property_inactive[_ngcontent-%COMP%]{opacity:.5}.t-url[_ngcontent-%COMP%]{display:flex;font:var(--tui-font-text-m);color:var(--tui-text-secondary)}.t-input[_ngcontent-%COMP%]{flex:1}.t-input_filled[_ngcontent-%COMP%]{color:var(--tui-text-primary)}.t-button[_ngcontent-%COMP%]{inline-size:2rem;block-size:2rem;margin:0 .25rem;transition:background .2s}.t-edit-button[_ngcontent-%COMP%]{margin-left:auto}.t-link[_ngcontent-%COMP%]{margin:0 1rem;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.t-cleaner[_ngcontent-%COMP%]{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;color:var(--tui-text-secondary);cursor:pointer;margin-left:auto}.t-cleaner[_ngcontent-%COMP%]:hover{color:var(--tui-background-accent-opposite-pressed)}.t-cleaner_hidden[_ngcontent-%COMP%]{visibility:hidden}.t-anchor-list[_ngcontent-%COMP%]{display:flex;max-block-size:12.5rem;flex-direction:column}.t-anchor[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;min-block-size:2.75rem;padding:.375rem .5rem;margin:.125rem .5rem;border-radius:var(--tui-radius-m);text-align:start}.t-anchor[_ngcontent-%COMP%]:hover{background:var(--tui-background-base-alt);cursor:pointer}"],changeDetection:0});let t=e;return t})();var _2=(()=>{let e=class e{constructor(){this.editor=h(Ol,{optional:!0}),this.customSanitizer=h(oS,{optional:!0}),this.sanitizer=h(ws),this.document=h(qe),this.options=h(xe),this.html=ge(null)}set content(n){var o;let r=((o=this.customSanitizer)==null?void 0:o.sanitize(ri.HTML,n??""))??this.sanitizer.bypassSecurityTrustHtml(n??"");this.html.set(r)}click(n){var o,s;if(this.editor||!ui(n.target))return;let r=((s=(o=n.target)==null?void 0:o.closest("a"))==null?void 0:s.getAttribute("href"))??"";r.startsWith("#")&&(this.document.location.hash=r.replace("#",""),n.preventDefault())}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-editor-socket"]],hostVars:3,hostBindings:function(r,o){r&1&&x("click",function(a){return o.click(a)}),r&2&&(ms("innerHTML",o.html(),Zd),Te("tui-editor-socket",o.options.enableDefaultStyles))},inputs:{content:"content"},decls:0,vars:0,template:function(r,o){},styles:[`.tui-editor-socket{display:block;margin:0;color:var(--tui-text-primary);font:var(--tui-font-text-m)}.tui-editor-socket:after{content:"";display:table;clear:both}.tui-editor-socket[tuiTiptapEditor]{overflow:hidden}.tui-editor-socket .ProseMirror{min-block-size:100%;padding:.2rem 1rem;outline:none;white-space:pre-wrap}.tui-editor-socket .resize-cursor{cursor:ew-resize;cursor:col-resize}.tui-editor-socket .ProseMirror-gapcursor{margin-top:.83rem}.tui-editor-socket .ProseMirror .ProseMirror-gapcursor:first-child{margin-top:0}.tui-editor-socket img.ProseMirror-separator+.ProseMirror-trailingBreak,.tui-editor-socket img.ProseMirror-separator{display:none!important}.tui-editor-socket h1,.tui-editor-socket h2,.tui-editor-socket h3,.tui-editor-socket h4,.tui-editor-socket h5,.tui-editor-socket h6{word-break:break-word;line-height:normal}.tui-editor-socket h1:first-child,.tui-editor-socket h2:first-child,.tui-editor-socket p:last-child{margin-bottom:0}.tui-editor-socket p:last-child,.tui-editor-socket pre:last-child{margin-bottom:0}.tui-editor-socket p:empty:after{content:" ";white-space:pre}.tui-editor-socket p:first-child{margin-top:0;min-inline-size:.0625rem}.tui-editor-socket p{margin:1rem 0}.tui-editor-socket p>span{line-height:initial}.tui-editor-socket blockquote{margin:1.25rem 0 1.25rem 1.5rem;padding-left:1.0625rem;border-left:.0625rem solid var(--tui-border-normal)}.tui-editor-socket hr{border:none;border-top:.0625rem solid var(--tui-background-neutral-1-hover);margin:1rem 0}.tui-editor-socket mark{background:unset;color:inherit}.tui-editor-socket font[face="Courier New"]{display:inline-block;padding:.25rem .5rem;border-radius:.25rem;background-color:#ecf1f7;word-break:break-word}.tui-editor-socket a:not([data-type=jump-anchor]){color:var(--tui-text-action);text-decoration:none;outline:none}.tui-editor-socket a:not([data-type=jump-anchor]):hover{color:var(--tui-text-action-hover);text-decoration:underline}.tui-editor-socket a:not([data-type=jump-anchor]):active{color:var(--tui-background-accent-1-pressed)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]{text-decoration:underline;text-decoration-color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:before{content:"#"}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:hover{color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a:hover img[contenteditable=false]{cursor:pointer;outline:.25rem solid var(--tui-text-action)}.tui-editor-socket ul:not([data-type]),.tui-editor-socket ol:not([data-type]){list-style-type:none;margin:1rem 1rem 1rem 1.5rem;padding:0}.tui-editor-socket ul:not([data-type]) li,.tui-editor-socket ol:not([data-type]) li{margin:.75rem 0}.tui-editor-socket ul:not([data-type]) li>p,.tui-editor-socket ol:not([data-type]) li>p{display:inline;margin:0 auto;word-break:break-word}.tui-editor-socket ul:not([data-type]) li:before,.tui-editor-socket ol:not([data-type]) li:before{unicode-bidi:isolate;font-variant-numeric:tabular-nums;text-transform:none;text-indent:0;text-align:start;text-align-last:start}.tui-editor-socket ul:not([data-type]) li>p{display:block}.tui-editor-socket ul:not([data-type])>li:before{content:"";display:inline-block;inline-size:.5rem;block-size:.5rem;border-radius:100%;margin:.5rem .875rem .0625rem -1.375rem;background-color:var(--tui-background-accent-1);vertical-align:top;box-sizing:border-box;float:inline-start}.tui-editor-socket li ul:not([data-type])>li:before{background:none;border:.125rem solid var(--tui-background-accent-1)}.tui-editor-socket li ul:not([data-type])>li>ul:not([data-type])>li:before{background:var(--tui-background-accent-1);border-radius:0;inline-size:.375rem;block-size:.375rem}.tui-editor-socket ol:not([data-type]){counter-reset:item}.tui-editor-socket ol:not([data-type])>li:before{content:counters(item,".") ".";display:block;counter-increment:item;margin:0 .75rem 0 -1.5rem;color:var(--tui-border-hover);vertical-align:top;float:inline-start;white-space:nowrap}.tui-editor-socket [data-type=details-content] ol{counter-reset:details-item}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item,".") ".";counter-increment:details-item}.tui-editor-socket [data-type=details-content] ol [data-type=details-content] ol{counter-reset:details-item2}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item2,".") ".";counter-increment:details-item2}.tui-editor-socket ul[data-type] li[data-checked]{display:flex;gap:.5rem}.tui-editor-socket ul[data-type] li[data-checked]>div{inline-size:100%}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]{position:relative;inline-size:var(--t-size, 1rem);block-size:var(--t-size, 1rem);border-radius:var(--tui-radius-xs, .25rem);transition-property:color,background,opacity,box-shadow,border;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;outline:.125rem solid transparent;outline-offset:-.125rem;margin-top:.25rem;cursor:pointer}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]:before{content:"";position:absolute;top:0;left:0;inline-size:100%;block-size:100%;background:currentColor;-webkit-mask:url('data:image/svg+xml,') center / 100%;mask:url('data:image/svg+xml,') center / 100%;transform:scale(0);transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked{background:var(--tui-background-accent-1, #526ed3);color:var(--tui-text-primary-on-accent-1, #fff)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked:before{-webkit-mask-image:url('data:image/svg+xml,');mask-image:url('data:image/svg+xml,');transform:scale(1)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]{box-shadow:inset 0 0 0 .0625rem var(--tui-border-normal);color:var(--tui-text-primary)}.tui-editor-socket._preview-image img{cursor:pointer}.tui-editor-socket .ProseMirror video,.tui-editor-socket .ProseMirror audio{pointer-events:none}.tui-editor-socket img.ProseMirror-selectednode{outline:.25rem solid var(--tui-background-accent-1-hover)}.tui-editor-socket[tuiTiptapEditor] tui-image-editor:hover{outline:.0625rem dashed var(--tui-background-accent-1-hover)}.tui-editor-socket .t-editor-placeholder:not(tr):not(th):not(td):not(ul):not(ol):not(li):first-child:before{content:attr(data-placeholder);position:absolute;float:inline-start;color:var(--tui-border-hover);pointer-events:none}.tui-editor-socket table{border-collapse:collapse;table-layout:fixed;inline-size:100%;margin:0;overflow:hidden}.tui-editor-socket table .tableWrapper,.tui-editor-socket .tableWrapper,.tui-editor-socket .tui-table-wrapper{overflow-x:auto}.tui-editor-socket table td{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word}.tui-editor-socket table th{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word;font-weight:700;text-align:start;background-color:var(--tui-background-base-alt);min-block-size:2rem}.tui-editor-socket table td,.tui-editor-socket table th{border:.125rem solid #e9e9e7}[tuiTheme=dark] .tui-editor-socket table td,[tuiTheme=dark] .tui-editor-socket table th{border:.125rem solid #2f2f2f}.tui-editor-socket table .column-resize-handle{position:absolute;right:-.125rem;top:0;bottom:-.125rem;inline-size:.25rem;background-color:#adf;pointer-events:none}.tui-editor-socket table td>*{margin-top:0;margin-bottom:0}.tui-editor-socket table th>*{margin-top:0;margin-bottom:0}.tui-editor-socket .selectedCell{outline:.0625rem solid #83b4d7}.tui-editor-socket .selectedCell:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--tui-service-selected-text);pointer-events:none}.tui-editor-socket summary{display:flex;align-items:center;min-block-size:3.5rem;inline-size:100%;box-sizing:border-box;border-radius:var(--tui-radius-l);pointer-events:none;outline:none;word-break:break-word;padding:0 4.6875rem 0 1.25rem}.tui-editor-socket summary:focus-visible{outline:.125rem solid var(--tui-text-action)}.tui-editor-socket summary p{min-inline-size:.0625rem;margin:0}.tui-editor-socket summary::-webkit-details-marker{display:none}.tui-editor-socket details[open] summary{border-radius:var(--tui-radius-l) var(--tui-radius-l) 0 0}.tui-editor-socket .t-details-arrow{position:absolute;top:1.5rem;right:1.25rem;block-size:.575rem;inline-size:.575rem;border:.0625rem solid var(--tui-text-secondary);border-width:0 .125rem .125rem 0;transform:rotate(45deg);transition:var(--tui-duration, .3s);-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none}.tui-editor-socket .t-details-arrow:hover{border-color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete{position:absolute;top:1.4rem;right:2.7rem;block-size:1.125rem;inline-size:1.25rem;-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none;border:none}.tui-editor-socket .t-details-delete:hover:after{color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete:after{content:"\\d7";display:inline-block;font:inherit;font-size:2rem;color:var(--tui-text-secondary);block-size:100%;inline-size:100%;line-height:.8rem}.tui-editor-socket details{inline-size:100%;border:.0625rem solid var(--tui-border-normal);border-radius:var(--tui-radius-l)}.tui-editor-socket div[data-type=details-content]{padding:1.25rem;min-block-size:3rem;border:.0625rem solid var(--tui-border-normal);border-width:.0625rem 0 0}.tui-editor-socket div[data-type=details-content] h1:first-child,.tui-editor-socket div[data-type=details-content] h2:first-child,.tui-editor-socket div[data-type=details-content] pre:first-child,.tui-editor-socket div[data-type=details-content] ul:first-child,.tui-editor-socket div[data-type=details-content] ol:first-child,.tui-editor-socket div[data-type=details-content] ol li:first-child,.tui-editor-socket div[data-type=details-content] ul li:first-child{margin-top:0}.tui-editor-socket .t-details-wrapper{position:relative;display:flex}.tui-editor-socket .t-details-wrapper_rendered .t-details-arrow{pointer-events:none}.tui-editor-socket .t-details-wrapper_rendered summary{transition:transform var(--tui-duration, .3s);cursor:pointer;pointer-events:auto}.tui-editor-socket .t-details-wrapper_rendered summary:hover{background:var(--tui-background-base-alt)}.tui-editor-socket details[open]+.t-details-arrow{top:1.75rem;transform:rotate(225deg)}.tui-editor-socket pre{white-space:pre-wrap;word-break:break-word;border-radius:.25rem;margin:1rem 0;padding:.75rem 1rem;font-family:Courier,monospace;color:var(--tui-text-secondary);background:var(--tui-background-base-alt)}.tui-editor-socket .tui-group-node{display:flex;flex-direction:row}.tui-editor-socket .tui-group-node:hover>.tui-group-pointer{pointer-events:auto;opacity:1}.tui-editor-socket .tui-group-pointer{opacity:0;min-block-size:.8125rem;max-block-size:.8125rem;min-inline-size:.8125rem;max-inline-size:.8125rem;margin:.3125rem .3125rem 0 0;cursor:grab;background-image:url('data:image/svg+xml;charset=UTF-8,');background-repeat:no-repeat;background-size:contain;background-position:center}.tui-editor-socket [data-mode=onDark] .tui-group-pointer{background-image:url('data:image/svg+xml;charset=UTF-8,')}.t-hidden-editor{display:none;visibility:hidden;opacity:0;block-size:0;inline-size:100%;margin:0;padding:0} +`],encapsulation:2,changeDetection:0});let t=e;return t})();function g9(t,e){if(t&1){let i=q();E(0,"div",3)(1,"button",4),Y(2,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("left"))}),he(3," Left align "),w(),E(4,"button",4),Y(5,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("center"))}),he(6," Center align "),w(),E(7,"button",4),Y(8,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("right"))}),he(9," Right align "),w(),E(10,"button",4),Y(11,"async"),x("click",function(){P(i);let r=_();return F(r.editor==null?null:r.editor.onAlign("justify"))}),he(12," Justify align "),w()()}if(t&2){let i,n,r,o,s=_();C(),v("iconStart",s.options.icons.textAlignLeft)("tuiHint",(i=J(2,8,s.texts$))==null?null:i.justifyLeft),C(3),v("iconStart",s.options.icons.textAlignCenter)("tuiHint",(n=J(5,10,s.texts$))==null?null:n.justifyCenter),C(3),v("iconStart",s.options.icons.textAlignRight)("tuiHint",(r=J(8,12,s.texts$))==null?null:r.justifyRight),C(3),v("iconStart",s.options.icons.textAlignJustify)("tuiHint",(o=J(11,14,s.texts$))==null?null:o.justifyFull)}}var C2=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.alignState$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n,r,o,s;this.alignState$=In([((n=this.editor)==null?void 0:n.isActive$({textAlign:"left"}))??ce(!1),((r=this.editor)==null?void 0:r.isActive$({textAlign:"right"}))??ce(!1),((o=this.editor)==null?void 0:o.isActive$({textAlign:"center"}))??ce(!1),((s=this.editor)==null?void 0:s.isActive$({textAlign:"justify"}))??ce(!1)]).pipe(S(([a,u,l,c])=>({left:a,right:u,center:l,justify:c})))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-align-content"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:5,vars:6,consts:[["alignDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__align-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),O(3,g9,13,16,"ng-template",null,0,We),w()),r&2){let s,a=be(4);v("tuiDropdown",a)("tuiDropdownOpen",!1),C(),v("iconStart",o.options.icons.textAlignPreview)("tuiHint",(s=J(2,4,o.texts$))==null?null:s.justify)}},dependencies:[Re,Le,Ze,Tt,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function y9(t,e){if(t&1){let i=q();E(0,"button",5),x("click",function(){let r=P(i).index,o=_(2);return F(o.onCode(!!r))}),he(1),w()}if(t&2){let i=e.$implicit;C(),Nt(" ",i," ")}}function v9(t,e){if(t&1&&(E(0,"tui-data-list"),O(1,y9,2,1,"button",4),Y(2,"async"),w()),t&2){let i=_();C(),v("ngForOf",J(2,1,i.codeOptionsTexts$))}}var D2=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.codeOptionsTexts$=h(dS),this.hintText$=this.texts$.pipe(S(n=>n.code)),this.insideCode$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}onCode(n){var r;(r=this.editor)==null||r[n?"toggleCodeBlock":"toggleCode"]()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n,r;this.insideCode$=In({code:((n=this.editor)==null?void 0:n.isActive$("code"))??ce(!1),codeBlock:((r=this.editor)==null?void 0:r.isActive$("codeBlock"))??ce(!1)}).pipe(S(({code:o,codeBlock:s})=>o||s))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-code"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:6,consts:[["codes",""],["codesDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(r,o){if(r&1&&(E(0,"div",2,0),Q(2,"button",3),Y(3,"async"),O(4,v9,3,3,"ng-template",null,1,We),w()),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(2),v("iconStart",o.options.icons.code)("tuiHint",J(3,4,o.hintText$))}},dependencies:[Re,Ci,Le,Ms,Ss,Ze,Tt,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();var E2=(()=>{let e=class e{constructor(){this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.options=h(xe),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setDetails(){var n;(n=this.editor)==null||n.setDetails()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-details"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:2,vars:4,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","iconStart","tuiHint"]],template:function(r,o){if(r&1&&(E(0,"button",0),Y(1,"async"),x("click",function(){return o.setDetails()}),w()),r&2){let s;v("iconStart",o.options.icons.detailsAdd)("tuiHint",(s=J(1,2,o.texts$))==null?null:s.setDetails)}},dependencies:[Re,Le,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function b9(t,e){if(t&1){let i=q();E(0,"button",1),Y(1,"async"),x("click",function(){P(i);let r=_();return F(r.removeDetails())}),w()}if(t&2){let i=e.ngIf,n=_();v("disabled",!!J(1,3,n.disabled$))("iconStart",n.options.icons.detailsRemove)("tuiHint",i.removeDetails)}}var w2=(()=>{let e=class e{constructor(){this.localEditor=null,this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.options=h(xe),this.disabled$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}removeDetails(){var n;(n=this.editor)==null||n.removeDetails()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n;this.disabled$=((n=this.editor)==null?void 0:n.isActive$("details").pipe(S(r=>!r)))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-details-remove"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:2,vars:3,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"]],template:function(r,o){r&1&&(O(0,b9,2,5,"button",0),Y(1,"async")),r&2&&v("ngIf",J(1,1,o.texts$))},dependencies:[Re,ut,Le,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();var T2=()=>({});function _9(t,e){if(t&1){let i=q();E(0,"button",5),Y(1,"lowercase"),x("click",function(){let r=P(i).$implicit,o=_(2);return F(o.setFontOption(r))}),he(2),w()}if(t&2){let i=e.$implicit;Ye("font-family",i.family)("font-size",i.px,"px")("font-weight",i.weight),v("ngClass",(i==null?null:i.ngClass)||Qr(12,T2))("ngStyle",(i==null?null:i.ngStyle)||Qr(13,T2)),Ke("automation-id","tui_font__"+J(1,10,i.name||"")),C(2),Nt(" ",i.name," ")}}function C9(t,e){if(t&1&&(E(0,"tui-data-list"),O(1,_9,3,14,"button",4),Y(2,"async"),w()),t&2){let i=_();C(),v("ngForOf",J(2,1,i.fontsOptions$))}}var x2=(()=>{let e=class e{constructor(){this.fontOptionsTexts$=h(fS),this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.fontsOptions$=this.fontOptionsTexts$.pipe(S(n=>this.options.fontOptions(n))),this.fontText$=this.texts$.pipe(S(n=>n.font)),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setFontOption({headingLevel:n,px:r}){var s,a,u,l;let o=((s=this.editor)==null?void 0:s.getFontColor())??Fa;this.clearPreviousTextStyles(),n?(a=this.editor)==null||a.setHeading(n):(u=this.editor)==null||u.setParagraph({fontSize:ht(r??0)}),o!==Fa&&((l=this.editor)==null||l.setFontColor(o))}clearPreviousTextStyles(){var n,r;(n=this.editor)==null||n.removeEmptyTextStyle(),(r=this.editor)==null||r.toggleMark("textStyle")}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-font-size"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:6,consts:[["fonts",""],["fontsDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__font-size-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["tuiOption","","type","button",3,"ngClass","ngStyle","fontFamily","fontSize","fontWeight","click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click","ngClass","ngStyle"]],template:function(r,o){if(r&1&&(E(0,"div",2,0),Q(2,"button",3),Y(3,"async"),O(4,C9,3,3,"ng-template",null,1,We),w()),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(2),v("iconStart",o.options.icons.fontSize)("tuiHint",J(3,4,o.fontText$))}},dependencies:[Re,BT,FT,Ci,RT,Le,Ms,Ss,Ze,Tt,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function D9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleBold())}),he(1," Toggle bold "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleBold)("tuiHint",i.bold)}}function E9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleItalic())}),he(1," Toggle italic "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleItalic)("tuiHint",i.italic)}}function w9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleUnderline())}),he(1," Toggle underline "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleUnderline)("tuiHint",i.underline)}}function T9(t,e){if(t&1){let i=q();E(0,"button",8),x("click",function(){P(i);let r=_(4);return F(r.editor==null?null:r.editor.toggleStrike())}),he(1," Toggle strike "),w()}if(t&2){let i=_(3).ngIf,n=_();v("iconStart",n.options.icons.fontStyleStrike)("tuiHint",i.strikeThrough)}}function x9(t,e){if(t&1&&(E(0,"div",6),O(1,D9,2,2,"button",7)(2,E9,2,2,"button",7)(3,w9,2,2,"button",7)(4,T9,2,2,"button",7),w()),t&2){let i=_(3);C(),v("ngIf",i.isEnabled(i.editorTool.Bold)),C(),v("ngIf",i.isEnabled(i.editorTool.Italic)),C(),v("ngIf",i.isEnabled(i.editorTool.Underline)),C(),v("ngIf",i.isEnabled(i.editorTool.Strikethrough))}}function I9(t,e){if(t&1&&(E(0,"div",4,0),Q(2,"button",5),O(3,x9,5,4,"ng-template",null,1,We),w()),t&2){let i=be(4),n=_().ngIf,r=_();v("tuiDropdown",i)("tuiDropdownOpen",!1),C(2),v("iconStart",r.options.icons.fontStylePreview)("tuiHint",n.fontStyle)}}function S9(t,e){if(t&1&&(_t(0),O(1,I9,5,4,"div",3),Y(2,"async"),Ct()),t&2){let i=_();C(),v("ngIf",J(2,1,i.fontStyleState$))}}var I2=(()=>{let e=class e{constructor(){this.toolsSet=new Set(Tl),this.localEditor=null,this.editorTool=Oe,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.fontStyleState$=null}set inputEditor(n){this.localEditor=n,this.initStream()}set enabledTools(n){this.toolsSet=new Set(n)}get editor(){return this.injectionEditor??this.localEditor}ngOnInit(){this.initStream()}isEnabled(n){return this.toolsSet.has(n)}initStream(){var n,r,o,s;this.fontStyleState$=In([((n=this.editor)==null?void 0:n.isActive$("bold"))??ce(!1),((r=this.editor)==null?void 0:r.isActive$("italic"))??ce(!1),((o=this.editor)==null?void 0:o.isActive$("underline"))??ce(!1),((s=this.editor)==null?void 0:s.isActive$("strike"))??ce(!1)]).pipe(S(([a,u,l,c])=>({bold:a,italic:u,underline:l,strike:c})))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-font-style"]],inputs:{inputEditor:[0,"editor","inputEditor"],enabledTools:"enabledTools"},decls:2,vars:3,consts:[["format",""],["formatDropdown",""],[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__font-style-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button","class","t-option t-option_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"]],template:function(r,o){r&1&&(O(0,S9,3,3,"ng-container",2),Y(1,"async")),r&2&&v("ngIf",J(1,1,o.texts$))},dependencies:[Re,ut,Le,Ze,Tt,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();var S2=(()=>{let e=class e{constructor(){this.localEditor=null,this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.options=h(xe),this.insertGroupText$=this.texts$.pipe(S(n=>n.insertGroup)),this.removeGroupText$=this.texts$.pipe(S(n=>n.removeGroup)),this.disabled$=null}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}addGroup(){var n;(n=this.editor)==null||n.setGroup()}removeGroup(){var n;(n=this.editor)==null||n.removeGroup()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n;this.disabled$=((n=this.editor)==null?void 0:n.isActive$("group").pipe(S(r=>!r)))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-editor-group-tool"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:5,vars:11,consts:[["appearance","icon","automation-id","toolbar__group-add-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__group-remove-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"]],template:function(r,o){r&1&&(E(0,"button",0),Y(1,"async"),x("click",function(){return o.addGroup()}),w(),E(2,"button",1),Y(3,"async"),Y(4,"async"),x("click",function(){return o.removeGroup()}),w()),r&2&&(v("iconStart",o.options.icons.groupAdd)("tuiHint",J(1,5,o.insertGroupText$)),C(2),v("disabled",!!J(3,7,o.disabled$))("iconStart",o.options.icons.groupRemove)("tuiHint",J(4,9,o.removeGroupText$)))},dependencies:[Re,Le,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();var v0e=W({AD:"+376###-###",AE:"+971-##-###-####",AF:"+93##-###-####",AG:"+1(268) ###-####",AI:"+1(264) ###-####",AL:"+355(###) ###-###",AM:"+374##-###-###",AO:"+244(###) ###-###",AR:"+54(###) ####-####",AT:"+43(###) ###-####",AU:"+61#-####-####",AW:"+297###-####",AZ:"+994##-###-##-##",BA:"+387 ###-####-##",BB:"+1(246) ###-####",BD:"+880##-###-###",BE:"+32(###) ###-###",BF:"+226##-##-####",BG:"+359(###) ###-###",BH:"+973####-####",BI:"+257##-##-####",BJ:"+229##-##-####",BL:"+590 ## ## ## ## ##",BM:"+1(441) ###-####",BN:"+673###-####",BO:"+591#-###-####",BQ:"+599-###-####",BR:"+55(##) ####-####",BS:"+1(242) ###-####",BT:"+975#-###-###",BW:"+267##-###-###",BY:"+375(##) ###-##-##",BZ:"+501###-####",CA:"+1(###) ###-####",CD:"+243(###) ###-###",CF:"+236-##-##-####",CG:"+242##-###-####",CH:"+41##-###-####",CI:"+225##-##-###-###",CL:"+56#-####-####",CM:"+237#####-####",CN:"+86(###) ####-####",CO:"+57(###) ###-####",CR:"+506####-####",CU:"+53#-###-####",CV:"+238(###) ##-##",CW:"+5999-###-####",CY:"+357##-###-###",CZ:"+420(###) ###-###",DE:"+49(###) ###-###-##",DJ:"+253##-##-##-##",DK:"+45##-##-##-##",DM:"+1(767) ###-####",DO:"+1(###) ###-####",DZ:"+213##-###-####",EC:"+593##-###-####",EE:"+372####-####",EG:"+20(###) ###-####",ER:"+291#-###-###",ES:"+34(###) ###-###",ET:"+251##-###-####",FI:"+358(###) ###-##-##",FJ:"+679##-#####",FK:"+500#####",FM:"+691###-####",FR:"+33 ## ## ## ## ##",GA:"+241##-##-##-##",GB:"+44##-####-####",GD:"+1(473) ###-####",GE:"+995(###) ###-###",GF:"+594 ## ## ## ## ##",GH:"+233(###) ###-###",GI:"+350###-#####",GL:"+299##-##-##",GM:"+220(###) ##-##",GN:"+224##-###-###",GP:"+590 ## ## ## ## ##",GQ:"+240##-###-####",GR:"+30(###) ###-####",GT:"+502#-###-####",GW:"+245#-######",GY:"+592###-####",HK:"+852####-####",HN:"+504####-####",HR:"+385##-###-####",HT:"+509##-##-####",HU:"+36(###) ###-###",ID:"+62(###) ###-##-###",IE:"+353(###) ###-###",IL:"+972##-###-####",IN:"+91(####) ###-###",IQ:"+964(###) ###-####",IR:"+98(###) ###-####",IS:"+354###-####",IT:"+39(###) ####-###",JM:"+1(876) ###-####",JO:"+962#-####-####",JP:"+81-##-####-####",KE:"+254###-######",KG:"+996(###) ###-###",KH:"+855##-###-###",KM:"+269##-#####",KN:"+1(869) ###-####",KP:"+850####-#############",KR:"+82##-###-####",KW:"+965####-####",KY:"+1(345) ###-####",KZ:"+7(###) ###-##-##",LA:"+856##-##-###-###",LB:"+961##-###-###",LC:"+1(758) ###-####",LI:"+423(###) ###-####",LK:"+94##-###-####",LR:"+231##-###-###",LS:"+266#-###-####",LT:"+370(###) ##-###",LU:"+352(###) ###-###",LV:"+371##-###-###",LY:"+218##-###-####",MA:"+212##-####-###",MC:"+377###-###-###",MD:"+373####-####",ME:"+382##-###-###",MF:"+590 ## ## ## ## ##",MG:"+261##-##-#####",MK:"+389##-###-###",ML:"+223##-##-####",MM:"+95##-###-###",MN:"+976##-##-####",MO:"+853####-####",MQ:"+596 ## ## ## ## ##",MR:"+222##-##-####",MS:"+1(664) ###-####",MT:"+356####-####",MU:"+230####-####",MV:"+960###-####",MW:"+265#-####-####",MX:"+52(###) ###-####",MY:"+60(###) ###-###",MZ:"+258##-###-###",NA:"+264##-###-####",NC:"+687 ### ###",NE:"+227##-##-####",NG:"+234(###) ###-####",NI:"+505####-####",NL:"+31##-###-####",NO:"+47(###) ##-###",NP:"+977##-###-###",NZ:"+64(###) ###-####",OM:"+968##-###-###",PA:"+507###-####",PE:"+51(###) ###-###",PF:"+689 ## ## ## ##",PG:"+675(###) ##-###",PH:"+63(###) ###-####",PK:"+92(###) ###-####",PL:"+48(###) ###-###",PT:"+351##-###-####",PW:"+680###-####",PY:"+595(###) ###-###",QA:"+974####-####",RE:"+262 ## ## ## ## ##",RO:"+40##-###-####",RS:"+381##-###-####",RU:"+7### ###-##-##",RW:"+250(###) ###-###",SA:"+966#-####-####",SB:"+677###-####",SC:"+248#-###-###",SD:"+249##-###-####",SE:"+46##-###-####",SG:"+65####-####",SH:"+290####",SI:"+386##-###-###",SK:"+421(###) ###-###",SL:"+232##-######",SM:"+378####-######",SN:"+221##-###-####",SO:"+252##-###-###",SR:"+597###-####",ST:"+239##-#####",SV:"+503##-##-####",SX:"+1(721) ###-####",SY:"+963##-####-###",SZ:"+268##-##-####",TC:"+1(649) ###-####",TD:"+235##-##-##-##",TG:"+228##-###-###",TH:"+66##-###-####",TJ:"+992##-###-####",TL:"+670###-#####",TM:"+993#-###-####",TN:"+216##-###-###",TO:"+676#####",TR:"+90(###) ###-####",TT:"+1(868) ###-####",TW:"+886#-####-####",TZ:"+255##-###-####",UA:"+380(##) ###-##-##",UG:"+256(###) ###-###",US:"+1(###) ###-####",UY:"+598#-###-##-##",UZ:"+998##-###-####",VC:"+1(784) ###-####",VE:"+58(###) ###-####",VG:"+1(284)###-####",VN:"+84(###) ####-###",VU:"+678##-#####",WS:"+685##-####",XK:"+383##-###-###",YE:"+967###-###-###",YT:"+262 ## ## ## ## ##",ZA:"+27##-###-####",ZM:"+260##-###-####",ZW:"+263#-######",VA:"+39 #### ###-####",WF:"+681 ## ##-##",VI:"+1(340) ###-####",JE:"+44(####) ######",AC:"+247###-####",TV:"+686###-####",TK:"+690###-####",TA:"+290###-####",SS:"+211### ###-###",SJ:"+47 ## ##-##-##",PS:"+970 #### ###-###",PR:"+1(###) ###-####",PM:"+508 ### ##-##-##",NU:"+683 ###-####",NR:"+674 ###-####",NF:"+672##-####",MP:"+1(670) ###-####",MH:"+692 ###-####",KI:"+686 ####-####",IO:"+246 ### ####",IM:"+44(####) ######",GU:"+1(###) ###-###",GG:"+44(###) ###-####",FO:"+298 ######",EH:"+212 #### #####",CX:"+61 # ####-####",CK:"+682 ## ###",CC:"+61 # ####-####",AX:"+358 ## ###-####",AS:"+1(###) ###-####"}),Xv=W();function M2(t){return De(Xv,t)}var A2=B(()=>{var t;return yn(((t=h(qe).fonts)==null?void 0:t.ready)||sn).pipe(Li({bufferSize:1,refCount:!1}))}),b0e=W({}),_0e=B(()=>Cx(h(Ao))),C0e=B(()=>!!h(Je).chrome),D0e=B(()=>{var t;return((t=h(Je))==null?void 0:t.mozCancelFullScreen)!==void 0}),E0e=B(()=>h(Je).location.host.endsWith("stackblitz.io")),w0e=W();var T0e=W(),k2=W("textfield"),O2=W();function N2(t){return De(O2,t)}var x0e=B(()=>h(Je).matchMedia("(any-pointer: coarse)").matches),I0e=W();var M9="tui_interactive_",Jv=(()=>{let e=class e{constructor(){this.autoIdString=`${M9}${e.autoId++}${Date.now()}`,this.focusVisible=!1,this.pseudoHover=null,this.pseudoActive=null,this.pseudoFocus=null,this.focusable=!0,this.nativeId="",this.focusedChange=new _e,this.focusVisibleChange=new _e}get computedDisabled(){return this.disabled}get computedFocused(){return!this.computedDisabled&&(this.pseudoFocus??this.focused)}get computedFocusVisible(){return!this.computedDisabled&&(this.pseudoFocus??this.focusVisible)}get computedFocusable(){return!this.computedDisabled&&(this.focusable||this.focused)}get id(){return this.nativeId||this.autoIdString}updateFocused(n){this.focusedChange.emit(n)}updateFocusVisible(n){this.focusVisible!==n&&(this.focusVisible=n,this.focusVisibleChange.emit(n))}};e.autoId=0,e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,hostVars:7,hostBindings:function(r,o){r&2&&(Ke("data-focused",o.pseudoFocus),Te("_disabled",o.computedDisabled)("_focused",o.computedFocused)("_focus-visible",o.computedFocusVisible))},inputs:{pseudoHover:"pseudoHover",pseudoActive:"pseudoActive",pseudoFocus:"pseudoFocus",focusable:"focusable",nativeId:"nativeId"},outputs:{focusedChange:"focusedChange",focusVisibleChange:"focusVisibleChange"},standalone:!1});let t=e;return t})(),zp=(()=>{let e=class e extends Jv{constructor(){super(),this.ngControl=h(an,{optional:!0}),this.refresh$=new tt,this.onTouched=Sa,this.onChange=Sa,this.fallbackValue=this.getFallbackValue(),this.destroyRef=h(it),this.cdr=h(st),this.valueTransformer=h(vl,{optional:!0}),this.readOnly=!1,this.pseudoInvalid=null,this.update$=new tt,this.ngControl&&(this.ngControl.valueAccessor=this)}get computedInvalid(){return this.interactive&&(this.pseudoInvalid!==null?this.pseudoInvalid:this.touched&&this.invalid)}get value(){return this.previousInternalValue??this.fallbackValue}set value(n){this.updateValue(n),this.update$.next()}get safeCurrentValue(){return this.rawValue??this.fallbackValue}get invalid(){return this.safeNgControlData(({invalid:n})=>n,!1)}get valid(){return this.safeNgControlData(({valid:n})=>n,!1)}get touched(){return this.safeNgControlData(({touched:n})=>n,!1)}get disabled(){return this.safeNgControlData(({disabled:n})=>n,!1)}get interactive(){return!this.readOnly&&!this.computedDisabled}get control(){return this.safeNgControlData(({control:n})=>n,null)}get computedName(){var n;return((n=this.controlName)==null?void 0:n.toString())??null}get controlName(){var n,r;return((r=(n=this.ngControl)==null?void 0:n.name)==null?void 0:r.toString())??null}ngOnInit(){this.refresh$.pipe(Jn(0),dt(null),S(()=>{var n;return(n=this.ngControl)==null?void 0:n.control}),ot(si),ke(),bt(n=>nt(n.valueChanges,n.statusChanges,n.events||sn)),Se(this.destroyRef)).subscribe(()=>{this.refreshLocalValue(this.safeCurrentValue)})}checkControlUpdate(){this.cdr.markForCheck()}registerOnChange(n){this.onChange=r=>{n(this.toControlValue(r))},this.refresh$.next()}registerOnTouched(n){this.onTouched=n}setDisabledState(){this.checkControlUpdate()}writeValue(n){let r=this.ngControl instanceof _r&&this.previousInternalValue===void 0?this.ngControl.model:n;this.refreshLocalValue(this.fromControlValue(r))}updateFocused(n){n||this.controlMarkAsTouched(),super.updateFocused(n)}updateValue(n){this.disabled||this.valueIdenticalComparator(this.value,n)||(this.previousInternalValue=n,this.controlSetValue(n))}valueIdenticalComparator(n,r){return n===r}get rawValue(){let{ngControl:n}=this;if(n===null)return;let r=n instanceof _r&&this.previousInternalValue===void 0?n.viewModel:n.value;return this.fromControlValue(r)}safeNgControlData(n,r){return(this.ngControl&&n(this.ngControl))??r}controlMarkAsTouched(){this.onTouched(),this.checkControlUpdate()}controlSetValue(n){this.onChange(n),this.checkControlUpdate()}refreshLocalValue(n){this.previousInternalValue=n,this.checkControlUpdate()}fromControlValue(n){return this.valueTransformer?this.valueTransformer.fromControlValue(n):n}toControlValue(n){return this.valueTransformer?this.valueTransformer.toControlValue(n):n}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,hostVars:4,hostBindings:function(r,o){r&2&&Te("_readonly",o.readOnly)("_invalid",o.computedInvalid)},inputs:{readOnly:"readOnly",pseudoInvalid:"pseudoInvalid"},standalone:!1,features:[oe]});let t=e;return t})();function V0e(t){return[De(zp,t),De(bl,t)]}var P2=(()=>{let e=class e{constructor(){this.host=h(zp,{optional:!0})}get readOnly(){return this.host.readOnly}get disabled(){return this.host.computedDisabled}get invalid(){return this.host.computedInvalid}get focusable(){return this.host.computedFocusable}get inputMode(){return"text"}get value(){var n;return((n=this.host.value)==null?void 0:n.toString())||""}process(n){}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1});let t=e;return t})(),tr=(()=>{let e=class e{constructor(){this.change$=new tt}ngOnChanges(){this.change$.next()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,standalone:!1,features:[Yt]});let t=e;return t})(),z0e=(()=>{let e=class e extends zp{clear(){this.value=[]}getFallbackValue(){return[]}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,standalone:!1,features:[oe]});let t=e;return t})();var j0e=(()=>{let e=class e extends zp{getFallbackValue(){return null}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,standalone:!1,features:[oe]});let t=e;return t})();var eb=class{constructor(e,i,n,r,o,s,a,u,l,c,f,p,m){this.change$=e,this.options=i,this.legacyAppearance=n,this.appearanceDirective=r,this.cleanerDirective=o,this.customContentDirective=s,this.iconDirective=a,this.iconLeftDirective=u,this.labelOutsideDirective=l,this.sizeDirective=c,this.prefixDirective=f,this.postfixDirective=p,this.fillerDirective=m}get appearance(){return this.appearanceDirective.appearance||this.legacyAppearance}get cleaner(){return this.cleanerDirective.cleaner}get customContent(){return this.customContentDirective.customContent||""}get icon(){return this.iconDirective.icon}get iconStart(){return this.iconLeftDirective.iconStart}get labelOutside(){return this.labelOutsideDirective.labelOutside}get size(){return this.sizeDirective.size}get prefix(){return this.prefixDirective.prefix}get postfix(){return this.postfixDirective.postfix}get filler(){return this.fillerDirective.filler}},F2={iconCleaner:"@tui.x",hintOnDisabled:!1},tb=W(F2);var R2=B(()=>new A9),A9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.appearance=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldAppearance",""]],inputs:{appearance:[0,"tuiTextfieldAppearance","appearance"]},standalone:!1,features:[Z([De(R2,e)]),oe]});let t=e;return t})(),L2=B(()=>new k9),k9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.cleaner=!1}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldCleaner",""]],inputs:{cleaner:[0,"tuiTextfieldCleaner","cleaner"]},standalone:!1,features:[Z([De(L2,e)]),oe]});let t=e;return t})(),H2=B(()=>new O9),O9=(()=>{let e=class e extends tr{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldCustomContent",""]],inputs:{customContent:[0,"tuiTextfieldCustomContent","customContent"]},standalone:!1,features:[Z([De(H2,e)]),oe]});let t=e;return t})(),B2=B(()=>new N9),N9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.filler=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldFiller",""]],inputs:{filler:[0,"tuiTextfieldFiller","filler"]},standalone:!1,features:[Z([De(B2,e)]),oe]});let t=e;return t})(),V2=B(()=>new P9),P9=(()=>{let e=class e extends tr{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldIcon",""]],inputs:{icon:[0,"tuiTextfieldIcon","icon"]},standalone:!1,features:[Z([De(V2,e)]),oe]});let t=e;return t})(),z2=B(()=>new F9),F9=(()=>{let e=class e extends tr{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldIconLeft",""]],inputs:{iconStart:[0,"tuiTextfieldIconLeft","iconStart"]},standalone:!1,features:[Z([De(z2,e)]),oe]});let t=e;return t})(),j2=B(()=>new R9),R9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.labelOutside=!1}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldLabelOutside",""]],inputs:{labelOutside:[0,"tuiTextfieldLabelOutside","labelOutside"]},standalone:!1,features:[Z([De(j2,e)]),oe]});let t=e;return t})(),U2=B(()=>new L9),L9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.postfix=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldPostfix",""]],inputs:{postfix:[0,"tuiTextfieldPostfix","postfix"]},standalone:!1,features:[Z([De(U2,e)]),oe]});let t=e;return t})(),$2=B(()=>new H9),H9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.prefix=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldPrefix",""]],inputs:{prefix:[0,"tuiTextfieldPrefix","prefix"]},standalone:!1,features:[Z([De($2,e)]),oe]});let t=e;return t})(),G2=B(()=>new B9),B9=(()=>{let e=class e extends tr{constructor(){super(...arguments),this.size="l"}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiTextfieldSize",""]],inputs:{size:[0,"tuiTextfieldSize","size"]},standalone:!1,features:[Z([De(G2,e)]),oe]});let t=e;return t})(),ege=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({});let t=e;return t})(),nb=W(),W2=[{provide:nb,deps:[st,tb,k2,R2,L2,H2,V2,z2,j2,G2,$2,U2,B2],useFactory:(t,e,i,...n)=>{let r=nt(...n.map(({change$:o})=>o||Du)).pipe(Jr(t),Se());return r.subscribe(),new eb(r,e,i,...n)}}];var q2=(()=>{let e=class e{constructor(){this.disabled=!1,this.readOnly=!1,this.hover=null,this.active=null,this.focus=!1,this.invalid=!1,this.appearance=""}get computedInvalid(){return!this.disabled&&!this.readOnly&&this.invalid}get computedFocused(){return this.focus&&!this.disabled}get interactiveState(){return this.disabled?"disabled":this.readOnly?"readonly":this.active?"active":this.hover?"hover":null}get noHover(){return this.readOnly||this.hover===!1}get noActive(){return this.readOnly||this.active===!1}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiWrapper",""]],hostAttrs:["tuiAppearance",""],hostVars:10,hostBindings:function(r,o){r&2&&(Ke("data-appearance",o.appearance)("data-state",o.interactiveState),Te("_invalid",o.computedInvalid)("_focused",o.computedFocused)("_no-hover",o.noHover)("_no-active",o.noActive))},inputs:{disabled:"disabled",readOnly:"readOnly",hover:"hover",active:"active",focus:"focus",invalid:"invalid",appearance:"appearance"},standalone:!1});let t=e;return t})(),Z2=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({});let t=e;return t})();var oge={DMY:"dd/mm/yyyy",MDY:"mm/dd/yyyy",YMD:"yyyy/mm/dd"};var ib=1.5,z9=2.5;function K2(t,e=!1,i=!1,n=!1,r="m"){let o=r==="s"?0:.25,s=0;return t&&(s+=ib+o),e&&(s+=ib+o),i&&(s+=ib+o),n&&(s+=z9+o),s}var sge=`?v=${dx}`;var age=Hv({limitWidth:"fixed",align:"right"});var Y2=(()=>{let e=class e extends Op{constructor(){super(...arguments),this.describeId=""}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-tooltip"]],inputs:{content:"content",direction:"direction",appearance:"appearance",showDelay:"showDelay",hideDelay:"hideDelay",describeId:"describeId",context:"context"},standalone:!1,features:[oe],decls:1,vars:7,consts:[["automation-id","tui-tooltip__icon",3,"tuiHintAppearance","tuiHintContext","tuiHintDirection","tuiHintHideDelay","tuiHintShowDelay","tuiTooltip","tuiTooltipDescribe"]],template:function(r,o){r&1&&Q(0,"tui-icon",0),r&2&&v("tuiHintAppearance",o.appearance||"")("tuiHintContext",o.context)("tuiHintDirection",o.direction)("tuiHintHideDelay",o.hideDelay)("tuiHintShowDelay",o.showDelay)("tuiTooltip",o.content)("tuiTooltipDescribe",o.describeId)},dependencies:[Vo,a2],encapsulation:2,changeDetection:0});let t=e;return t})(),Q2=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({imports:[Vo]});let t=e;return t})();var U9=["pre"],$9=["focusableElement"],G9=[[["input"]],[["select"]],[["tuiContent"]],"*"],W9=["input","select","tuiContent","*"],q9=()=>({standalone:!0}),rb=t=>({$implicit:t});function Z9(t,e){t&1&&Qt(0)}function K9(t,e){t&1&&Qt(0)}function Y9(t,e){if(t&1&&Q(0,"tui-icon",19),t&2){let i=e.polymorpheusOutlet;v("icon",i.toString())}}function Q9(t,e){if(t&1&&(E(0,"div",17),O(1,Y9,1,1,"tui-icon",18),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.iconLeftContent)("polymorpheusOutletContext",Kn(2,rb,i.size))}}function X9(t,e){if(t&1&&(E(0,"label",20),at(1,3),w()),t&2){let i=_();Te("t-placeholder_raised",i.placeholderRaised),v("for",i.computedId)}}function J9(t,e){if(t&1&&Q(0,"tui-icon",23),t&2){let i=e.polymorpheusOutlet;v("icon",i)}}function ez(t,e){if(t&1&&(E(0,"div",21),O(1,J9,1,1,"tui-icon",22),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.controller.customContent)}}function tz(t,e){if(t&1&&Q(0,"tui-icon",26),t&2){let i=e.polymorpheusOutlet;Ye("border","0.25rem solid transparent"),v("icon",i.toString())}}function nz(t,e){if(t&1){let i=q();E(0,"span",24),x("click.stop",function(){P(i);let r=_();return F(r.clear())}),O(1,tz,1,3,"tui-icon",25),w()}if(t&2){let i=_();C(),v("polymorpheusOutlet",i.iconCleaner||i.controller.options.iconCleaner)("polymorpheusOutletContext",Kn(2,rb,i.size))}}function iz(t,e){if(t&1&&Q(0,"tui-tooltip",27),t&2){let i=_();v("content",i.hintOptions==null?null:i.hintOptions.content)("describeId",i.computedId)}}function rz(t,e){if(t&1&&Q(0,"tui-icon",19),t&2){let i=e.polymorpheusOutlet;v("icon",i.toString())}}function oz(t,e){if(t&1&&(E(0,"div",28),O(1,rz,1,1,"tui-icon",18),w()),t&2){let i=_();C(),v("polymorpheusOutlet",i.iconContent)("polymorpheusOutletContext",Kn(2,rb,i.size))}}var sz=(()=>{let e=class e{constructor(){this.textfield=h(Xv),this.fontsReady$=h(A2),this.prefix$=new on(""),this.pre$=nt(this.fontsReady$,this.prefix$).pipe(Jn(0),ot(()=>{var n;return!!((n=this.pre)!=null&&n.nativeElement.isConnected)}),S(()=>{var n;return((n=this.pre)==null?void 0:n.nativeElement.offsetWidth)||0}),ke())}ngDoCheck(){this.prefix$.next(this.prefix)}get isContextTable(){return this.textfield.appearance==="table"}get filler(){let{focused:n,placeholder:r,exampleText:o,value:s,textfield:a}=this;return r&&o?"":n?o||a.filler.slice(s.length):""}get value(){return this.textfield.value}get prefix(){return this.decorationsVisible?this.textfield.prefix:""}get postfix(){return this.decorationsVisible?this.computedPostfix:""}get placeholder(){var n;return((n=this.textfield.nativeFocusableElement)==null?void 0:n.placeholder)||""}get exampleText(){return!this.value&&this.focused?this.placeholder:""}get decorationsVisible(){return!!this.value||this.focused&&!this.placeholder}get focused(){return this.textfield.computedFocused&&!this.textfield.readOnly}get computedPostfix(){return this.textfield.postfix&&(this.filler||this.value)?` ${this.textfield.postfix}`:this.textfield.postfix}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-value-decoration"]],viewQuery:function(r,o){if(r&1&&Gt(U9,7,de),r&2){let s;Qe(s=Xe())&&(o.pre=s.first)}},hostVars:4,hostBindings:function(r,o){r&1&&x("animationstart",function(){return o.ngDoCheck()}),r&2&&Te("_table",o.isContextTable)("_filler",o.filler)},standalone:!1,decls:5,vars:4,consts:[["pre",""],[1,"t-prefix",3,"textContent"],[1,"t-ghost",3,"textContent"],[1,"t-filler",3,"textContent"],[1,"t-postfix",3,"textContent"]],template:function(r,o){r&1&&Q(0,"span",1,0)(2,"span",2)(3,"span",3)(4,"span",4),r&2&&(v("textContent",o.prefix),C(2),v("textContent",o.value),C(),v("textContent",o.filler),C(),v("textContent",o.postfix))},styles:['[_nghost-%COMP%]{position:absolute;display:block;inline-size:100%;line-height:var(--tui-height);margin-top:calc(var(--tui-height) / -2);box-sizing:content-box;color:var(--tui-text-tertiary);animation:tuiPresent 1s;white-space:nowrap}._table[_nghost-%COMP%]{position:static;margin-top:0}._filler[_nghost-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}tui-primitive-textfield[data-size="m"]:not(._label-outside) [_nghost-%COMP%]{line-height:calc(var(--tui-height) - .25rem)}.t-ghost[_ngcontent-%COMP%]{visibility:hidden;white-space:pre;text-overflow:clip}.t-prefix[_ngcontent-%COMP%], .t-postfix[_ngcontent-%COMP%]{white-space:pre;color:var(--tui-text-primary)}.t-filler[_ngcontent-%COMP%]{max-inline-size:100%;white-space:nowrap}']});let t=e;return t})(),az={s:1.25,m:1.75,l:2.25},uz=(()=>{let e=class e extends Jv{constructor(){super(...arguments),this.legacyOptions=h(tb),this.el=Ee(),this.options=h(Np),this.controller=h(nb),this.hintOptions=h(Op,{optional:!0}),this.autofilled=!1,this.editable=!0,this.iconCleaner=this.legacyOptions.iconCleaner,this.readOnly=!1,this.invalid=!1,this.disabled=!1,this.value="",this.valueChange=new _e}get prefix(){return this.controller.prefix}get postfix(){return this.controller.postfix}get filler(){return this.controller.filler}get nativeFocusableElement(){if(this.computedDisabled||!this.focusableElement)return null;let{nativeElement:n}=this.focusableElement;return n.previousElementSibling||n}get focused(){return Ki(this.el)}get appearance(){return this.options.appearance()==="table"?"table":this.controller.appearance}onModelChange(n){this.updateValue(n)}get size(){return this.controller.size}get computedInvalid(){return!this.readOnly&&!this.disabled&&this.invalid}get inputHidden(){var n;return!!((n=this.content)!=null&&n.length)}get borderStart(){return this.iconLeftContent?this.iconPaddingLeft:0}get borderEnd(){return K2(!!this.iconContent,this.hasCleaner,this.hasTooltip,this.hasCustomContent,this.size)}get hasValue(){return!!this.value}get hasCleaner(){return this.controller.cleaner&&this.hasValue&&!this.computedDisabled&&!this.readOnly}get hasTooltip(){var n;return!!((n=this.hintOptions)!=null&&n.content)&&!this.computedDisabled}get hasCustomContent(){return!!this.controller.customContent}get placeholderVisible(){var o;let r=(((o=this.nativeFocusableElement)==null?void 0:o.placeholder)||this.prefix||this.postfix||this.filler)&&!this.readOnly&&this.computedFocused;return!this.hasValue&&!r}get hasPlaceholder(){return this.placeholderRaisable||this.placeholderVisible}get placeholderRaised(){return this.placeholderRaisable&&(this.computedFocused&&!this.readOnly||this.hasValue||this.autofilled)}get iconContent(){return this.controller.icon}get iconLeftContent(){return this.controller.iconStart}get showHint(){var n;return!!((n=this.hintOptions)!=null&&n.content)&&(this.legacyOptions.hintOnDisabled||!this.computedDisabled)}get name(){var n;return((n=this.nativeFocusableElement)==null?void 0:n.autocomplete)==="cc-exp"?"ccexpiryyear":null}get computedId(){var n;return((n=this.nativeFocusableElement)==null?void 0:n.id)||""}getIndent$(n){return ct(n,"scroll").pipe(S(()=>-1*Math.max(n.scrollLeft,0)))}onFocused(n){this.updateFocused(n)}clear(){this.nativeFocusableElement&&(this.nativeFocusableElement.value=""),this.updateValue("")}onMouseDown(n){let{nativeFocusableElement:r}=this;!r||n.target===r||(n.preventDefault(),r.focus())}transitionStartHandler({propertyName:n,target:r}){n.includes("box-shadow")&&(r==null?void 0:r.matches("input"))&&this.onAutofilled(!this.autofilled)}onAutofilled(n){this.updateAutofilled(n)}detectRetargetFromLabel(n){xx(n)&&n.stopImmediatePropagation()}get iconPaddingLeft(){return az[this.size]}get placeholderRaisable(){return this.size!=="s"&&!this.controller.labelOutside}updateAutofilled(n){this.autofilled!==n&&(this.autofilled=n)}updateValue(n){this.value=n,this.valueChange.emit(n)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-primitive-textfield"]],contentQueries:function(r,o,s){if(r&1&&_n(s,Rn,5),r&2){let a;Qe(a=Xe())&&(o.content=a)}},viewQuery:function(r,o){if(r&1&&Gt($9,5),r&2){let s;Qe(s=Xe())&&(o.focusableElement=s.first)}},hostVars:15,hostBindings:function(r,o){r&1&&x("focusin",function(){return o.onFocused(!0)})("focusout",function(){return o.onFocused(!1)})("transitionstart.capture",function(a){return o.transitionStartHandler(a)}),r&2&&(Ke("data-size",o.size),Ye("--border-start",o.borderStart,"rem")("--border-end",o.borderEnd,"rem"),Te("_readonly",o.readOnly)("_hidden",o.inputHidden)("_invalid",o.computedInvalid)("_autofilled",o.autofilled)("_label-outside",o.options.appearance()==="table"||o.controller.labelOutside))},inputs:{editable:"editable",iconCleaner:"iconCleaner",readOnly:"readOnly",invalid:"invalid",disabled:"disabled",value:"value"},outputs:{valueChange:"valueChange"},standalone:!1,features:[Z([M2(e),W2]),oe],ngContentSelectors:W9,decls:25,vars:40,consts:[["focusableElement",""],["decor",""],[4,"ngIf"],["automation-id","tui-primitive-textfield__wrapper","tuiWrapper","",3,"click.prevent.silent","mousedown","active","appearance","disabled","focus","hover","invalid","readOnly"],["automation-id","tui-primitive-textfield__native-input",1,"t-input",3,"ngModelChange","disabled","id","ngModel","ngModelOptions","readOnly","tabIndex"],["automation-id","tui-primitive-textfield__value",1,"t-input","t-input_template"],[1,"t-content"],["class","t-icon t-icon_left t-textfield-icon",4,"ngIf"],[1,"t-wrapper"],["automation-id","tui-primitive-textfield__placeholder","class","t-placeholder",3,"t-placeholder_raised","for",4,"ngIf"],[1,"t-wrapper-value-decoration"],["aria-hidden","true","automation-id","tui-primitive-textfield__value-decoration",1,"t-value-decoration"],[1,"t-icons"],["automation-id","tui-primitive-textfield__custom-content","class","t-custom-content",4,"ngIf"],["appearance","icon","automation-id","tui-primitive-textfield__cleaner","tuiWrapper","","class","t-cleaner",3,"click.stop",4,"ngIf"],["automation-id","tui-primitive-textfield__tooltip","class","t-tooltip",3,"content","describeId",4,"ngIf"],["class","t-icon t-textfield-icon",4,"ngIf"],[1,"t-icon","t-icon_left","t-textfield-icon"],["tuiAppearance","icon",3,"icon",4,"polymorpheusOutlet","polymorpheusOutletContext"],["tuiAppearance","icon",3,"icon"],["automation-id","tui-primitive-textfield__placeholder",1,"t-placeholder",3,"for"],["automation-id","tui-primitive-textfield__custom-content",1,"t-custom-content"],["class","t-custom-icon",3,"icon",4,"polymorpheusOutlet"],[1,"t-custom-icon",3,"icon"],["appearance","icon","automation-id","tui-primitive-textfield__cleaner","tuiWrapper","",1,"t-cleaner",3,"click.stop"],[3,"icon","border",4,"polymorpheusOutlet","polymorpheusOutletContext"],[3,"icon"],["automation-id","tui-primitive-textfield__tooltip",1,"t-tooltip",3,"content","describeId"],[1,"t-icon","t-textfield-icon"]],template:function(r,o){if(r&1){let s=q();Xt(G9),O(0,Z9,1,0,"ng-container",2),Y(1,"async"),O(2,K9,1,0,"ng-container",2),Y(3,"async"),E(4,"div",3),Y(5,"async"),x("click.prevent.silent",function(u){return P(s),F(o.detectRetargetFromLabel(u))})("mousedown",function(u){return P(s),F(o.onMouseDown(u))}),at(6),at(7,1),E(8,"input",4,0),x("ngModelChange",function(u){return P(s),F(o.onModelChange(u))}),w(),E(10,"div",5),at(11,2),w(),E(12,"div",6),O(13,Q9,2,4,"div",7),E(14,"div",8),O(15,X9,2,3,"label",9),E(16,"div",10),Q(17,"tui-value-decoration",11,1),Y(19,"async"),w()(),E(20,"div",12),O(21,ez,2,1,"div",13)(22,nz,2,4,"span",14)(23,iz,1,2,"tui-tooltip",15)(24,oz,2,4,"div",16),w()()()}if(r&2){let s=be(9),a=be(18);v("ngIf",J(1,31,o.content==null?null:o.content.changes)),C(2),v("ngIf",J(3,33,o.hintOptions==null?null:o.hintOptions.change$)),C(2),Ye("--text-indent",J(5,35,a.pre$),"px"),v("active",o.pseudoActive)("appearance",o.appearance)("disabled",o.disabled)("focus",o.computedFocused)("hover",o.pseudoHover)("invalid",o.computedInvalid)("readOnly",o.readOnly),C(4),v("disabled",o.computedDisabled)("id",o.id)("ngModel",o.value)("ngModelOptions",Qr(39,q9))("readOnly",o.readOnly||!o.editable)("tabIndex",o.computedFocusable?0:-1),Ke("aria-invalid",o.computedInvalid)("name",o.name),C(2),Te("t-input_template_hidden",!o.inputHidden),C(3),v("ngIf",o.iconLeftContent),C(2),v("ngIf",o.hasPlaceholder),C(2),Ye("text-indent",J(19,37,o.getIndent$(s)),"px"),Te("t-has-value",o.value),C(4),v("ngIf",o.hasCustomContent),C(),v("ngIf",o.hasCleaner),C(),v("ngIf",o.showHint),C(),v("ngIf",o.iconContent)}},dependencies:[ut,So,Df,_r,Rn,q2,Y2,Vo,Ji,sz,Re],styles:['[_nghost-%COMP%]{position:relative;display:block;text-align:start;border-radius:var(--tui-radius-m);block-size:var(--tui-height);min-block-size:var(--tui-height);max-block-size:var(--tui-height)}[data-size=s][_nghost-%COMP%]{--tui-height: var(--tui-height-s);font:var(--tui-font-text-s)}[data-size=m][_nghost-%COMP%]{--tui-height: var(--tui-height-m);font:var(--tui-font-text-s)}[data-size=l][_nghost-%COMP%]{--tui-height: var(--tui-height-l);font:var(--tui-font-text-m);line-height:1.25rem}[_nghost-%COMP%] *:disabled[_nghost-%COMP%], *:disabled [_nghost-%COMP%]{pointer-events:none}.t-input[_ngcontent-%COMP%]{padding:0;margin:0;border-width:0;border-radius:inherit;background:none;font-size:inherit;line-height:inherit;font-weight:inherit;color:inherit;caret-color:currentColor;outline:none;-webkit-appearance:none;appearance:none;word-break:keep-all;-webkit-text-fill-color:currentColor;position:absolute;top:0;left:0;inline-size:100%;block-size:100%;border-style:solid;border-color:transparent;border-inline-start-width:var(--border-start, 0);border-inline-end-width:var(--border-end, 0);text-indent:var(--text-indent);color:var(--tui-text-primary);text-align:inherit;box-sizing:border-box;white-space:nowrap;overflow:hidden;text-transform:inherit;resize:none}.t-input[_ngcontent-%COMP%]:-webkit-autofill, .t-input[_ngcontent-%COMP%]:-webkit-autofill:hover, .t-input[_ngcontent-%COMP%]:-webkit-autofill:focus{-webkit-text-fill-color:var(--tui-text-primary)!important;border-color:var(--tui-service-autofill-background);box-shadow:0 0 0 100rem var(--tui-service-autofill-background) inset!important}.t-input[inputMode=none][_ngcontent-%COMP%]{caret-color:transparent}.t-input[_ngcontent-%COMP%]:-webkit-autofill, .t-input[_ngcontent-%COMP%]:-webkit-autofill:first-line{font-size:inherit;line-height:inherit}.t-input[_ngcontent-%COMP%]::-webkit-caps-lock-indicator, .t-input[_ngcontent-%COMP%]::-webkit-contacts-auto-fill-button, .t-input[_ngcontent-%COMP%]::-webkit-credit-card-auto-fill-button, .t-input[_ngcontent-%COMP%]::-webkit-credentials-auto-fill-button, .t-input[_ngcontent-%COMP%]::-webkit-strong-password-auto-fill-button{content:none!important;position:absolute;left:-62.4375rem;top:-62.4375rem;z-index:-999;display:none!important;background:transparent!important;pointer-events:none!important}.t-input[_ngcontent-%COMP%]::placeholder{color:var(--tui-text-tertiary);opacity:0}._focused[_nghost-%COMP%]:not(._readonly) .t-input[_ngcontent-%COMP%]::placeholder, tui-primitive-textfield._focused:not(._readonly)[_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-primitive-textfield._focused:not(._readonly) [_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-textarea._focused:not(._readonly)[_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-textarea._focused:not(._readonly) [_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-text-area._focused:not(._readonly)[_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder, tui-text-area._focused:not(._readonly) [_nghost-%COMP%] .t-input[_ngcontent-%COMP%]::placeholder{opacity:1}[data-size=s][_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="s"][_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="s"] [_nghost-%COMP%]:not(tui-primitive-textfield), .t-input tui-textarea[data-size="s"][_nghost-%COMP%]:not(tui-textarea), tui-textarea[data-size="s"] [_nghost-%COMP%]:not(tui-textarea), .t-input tui-text-area[data-size="s"][_nghost-%COMP%]:not(tui-text-area), tui-text-area[data-size="s"] [_nghost-%COMP%]:not(tui-text-area){padding:0 var(--tui-padding-s)}[data-size=m][_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="m"][_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="m"] [_nghost-%COMP%]:not(tui-primitive-textfield), .t-input tui-textarea[data-size="m"][_nghost-%COMP%]:not(tui-textarea), tui-textarea[data-size="m"] [_nghost-%COMP%]:not(tui-textarea), .t-input tui-text-area[data-size="m"][_nghost-%COMP%]:not(tui-text-area), tui-text-area[data-size="m"] [_nghost-%COMP%]:not(tui-text-area){padding:0 var(--tui-padding-m)}[data-size=l][_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="l"][_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="l"] [_nghost-%COMP%]:not(tui-primitive-textfield), .t-input tui-textarea[data-size="l"][_nghost-%COMP%]:not(tui-textarea), tui-textarea[data-size="l"] [_nghost-%COMP%]:not(tui-textarea), .t-input tui-text-area[data-size="l"][_nghost-%COMP%]:not(tui-text-area), tui-text-area[data-size="l"] [_nghost-%COMP%]:not(tui-text-area){padding:0 var(--tui-padding-l)}._disabled[_nghost-%COMP%] .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield._disabled[_nghost-%COMP%], tui-primitive-textfield._disabled [_nghost-%COMP%], .t-input tui-textarea._disabled[_nghost-%COMP%], tui-textarea._disabled [_nghost-%COMP%], .t-input tui-text-area._disabled[_nghost-%COMP%], tui-text-area._disabled [_nghost-%COMP%]{pointer-events:none}[data-size=l][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="l"]:not(._label-outside)[_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="l"]:not(._label-outside) [_nghost-%COMP%]:not(tui-primitive-textfield){padding-top:1.25rem}[data-size=m][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield[data-size="m"]:not(._label-outside)[_nghost-%COMP%]:not(tui-primitive-textfield), tui-primitive-textfield[data-size="m"]:not(._label-outside) [_nghost-%COMP%]:not(tui-primitive-textfield){padding-top:1rem}[data-size=l][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%]{padding-top:1.25rem}[data-size=l][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%]:-webkit-autofill + .t-content[_ngcontent-%COMP%] .t-placeholder[_ngcontent-%COMP%]{font-size:.8156rem;transform:translateY(-.625rem)}[data-size=m][_nghost-%COMP%]:not(._label-outside) .t-input[_ngcontent-%COMP%]:-webkit-autofill + .t-content[_ngcontent-%COMP%] .t-placeholder[_ngcontent-%COMP%]{font-size:.69rem;transform:translateY(-.5rem)}._hidden[_nghost-%COMP%] input.t-input[_ngcontent-%COMP%], .t-input tui-primitive-textfield._hidden[_nghost-%COMP%], tui-primitive-textfield._hidden [_nghost-%COMP%]{opacity:0;text-indent:-10em}.t-content[_ngcontent-%COMP%]{display:flex;block-size:100%;inline-size:100%;box-sizing:border-box;align-items:center;overflow:hidden}[data-size=s][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{padding:0 var(--tui-padding-s)}[data-size=m][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{padding:0 var(--tui-padding-m)}[data-size=l][_nghost-%COMP%] .t-content[_ngcontent-%COMP%]{padding:0 var(--tui-padding-l)}.t-wrapper[_ngcontent-%COMP%]{flex:1;min-inline-size:0;padding-inline-end:.25rem}.t-placeholder[_ngcontent-%COMP%]{transition-property:transform,font-size,color,letter-spacing;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block;inline-size:100%;-webkit-user-select:none;user-select:none;font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none;will-change:transform;transform:translateY(0)}@supports (-webkit-hyphens: none){.t-placeholder[_ngcontent-%COMP%]{will-change:unset;transition-property:transform,color,letter-spacing}}.t-placeholder_raised[_ngcontent-%COMP%]{transform:translateY(-.625rem)}[data-size=m][_nghost-%COMP%] .t-placeholder_raised[_ngcontent-%COMP%]{font:var(--tui-font-text-xs);line-height:1.25rem;transform:translateY(-.5rem);letter-spacing:.025rem}._invalid[_nghost-%COMP%]:not(._focused) .t-placeholder_raised[_ngcontent-%COMP%], ._invalid[_nghost-%COMP%]:not(._focused):hover .t-placeholder_raised[_ngcontent-%COMP%]{color:var(--tui-text-negative)}._focused[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], [data-size=m]._focused._label-outside[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], [data-size=l]._focused._label-outside[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%]{color:var(--tui-text-tertiary)}[data-size=l][_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%]{font:var(--tui-font-text-m);line-height:1.25rem}[data-size=l][_nghost-%COMP%] .t-placeholder_raised[_ngcontent-%COMP%]{font-size:.8156rem}[data-size=m]._focused[_nghost-%COMP%]:not(._label-outside) .t-placeholder[_ngcontent-%COMP%], [data-size=l]._focused[_nghost-%COMP%]:not(._label-outside) .t-placeholder[_ngcontent-%COMP%]{color:var(--tui-text-primary)}.t-cleaner[_ngcontent-%COMP%]{position:relative;display:flex;inline-size:1.5rem;block-size:1.5rem;align-items:center;justify-content:center;box-sizing:border-box;cursor:pointer;pointer-events:none;pointer-events:auto;border-width:.25rem}._readonly[_nghost-%COMP%] .t-cleaner[_ngcontent-%COMP%], ._disabled[_nghost-%COMP%] .t-cleaner[_ngcontent-%COMP%]{pointer-events:none}.t-icon[_ngcontent-%COMP%]{position:relative;display:flex;inline-size:1.5rem;block-size:1.5rem;align-items:center;justify-content:center;box-sizing:border-box;cursor:pointer;pointer-events:none}[data-size=s][_nghost-%COMP%] .t-icon_left[_ngcontent-%COMP%]{margin:0 .125rem 0 -.375rem}[data-size=m][_nghost-%COMP%] .t-icon_left[_ngcontent-%COMP%]{margin-inline-start:-.125rem;margin-inline-end:.375rem}[data-size=l][_nghost-%COMP%] .t-icon_left[_ngcontent-%COMP%]{margin-inline-end:.75rem}.t-icons[_ngcontent-%COMP%]{display:flex;align-items:center}[data-size=m][_nghost-%COMP%] .t-icons[_ngcontent-%COMP%]{margin-inline-end:-.125rem}[data-size=s][_nghost-%COMP%] .t-icons[_ngcontent-%COMP%]{margin-inline-end:-.375rem}[_nghost-%COMP%]:not([data-size=s]) .t-icons[_ngcontent-%COMP%] > [_ngcontent-%COMP%]:not(:first-child){margin-inline-start:.25rem}[_nghost-%COMP%] input{transition:box-shadow .01s}._autofilled[data-size=s][_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], ._autofilled._label-outside[_nghost-%COMP%] .t-placeholder[_ngcontent-%COMP%], ._autofilled[_nghost-%COMP%] .t-value-decoration[_ngcontent-%COMP%]:not(.t-has-value){visibility:hidden}[data-size=s][_nghost-%COMP%] tui-icon[_ngcontent-%COMP%]{border-width:.25rem}.t-custom-content[_ngcontent-%COMP%]{position:relative;display:flex;align-items:center;justify-content:center;min-inline-size:2rem;block-size:2rem;pointer-events:none}.t-custom-icon[_ngcontent-%COMP%]{inline-size:2rem;block-size:100%}.t-input[_ngcontent-%COMP%]:not(:first-child){display:none}[data-size][_nghost-%COMP%] .t-input_template[_ngcontent-%COMP%]{display:flex;inline-size:calc(100% - 1rem);max-inline-size:calc(100% - 1rem);align-items:center;pointer-events:none;padding-inline-end:0}.t-input_template_hidden[_ngcontent-%COMP%]{display:none}.t-text-template[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.t-wrapper-value-decoration[_ngcontent-%COMP%]{position:relative;pointer-events:none}._readonly[_nghost-%COMP%] .t-textfield-icon[_ngcontent-%COMP%] [tuiAppearance][data-appearance=icon]{pointer-events:none}@media (hover: hover) and (pointer: fine){[_nghost-%COMP%]:not(._readonly):not(._disabled):hover .t-textfield-icon[_ngcontent-%COMP%] [tuiAppearance][data-appearance=icon]:after{color:var(--tui-text-secondary)}}'],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"getIndent$",null),t})(),Bge=(()=>{let e=class e extends P2{constructor(){super(...arguments),this.host=h(uz)}get readOnly(){return this.host.readOnly||!this.host.editable}onValueChange(n){this.host.onModelChange(n)}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["tui-primitive-textfield"]],standalone:!1,features:[Z([N2(e)]),oe]});let t=e;return t})();var Vge=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({imports:[wa,wf,Z2,Q2,Vo]});let t=e;return t})();function lz(t,e){if(t&1){let i=q();E(0,"button",1),x("click",function(){let r=P(i).$implicit,o=_();return F(o.selectedColor.emit(r.value))}),w()}if(t&2){let i=e.$implicit;Ye("background",i.value),v("id",i.key)("tuiHint",i.key)("tuiHintDescribe",i.key)}}var Xge=W(["Solid color","Gradient"]);var cz={SolidColor:0,Gradient:1},dz={selectorMode:!0,mode:cz.SolidColor,color:[0,0,0,1],colors:new Map,gradient:{icons:{"to top right":"@tui.move-up-right","to right":"@tui.move-right","to bottom right":"@tui.move-down-right","to bottom":"@tui.move-down","to bottom left":"@tui.move-down-left","to left":"@tui.move-left","to top left":"@tui.move-up-left","to top":"@tui.move-up"},steps:[[0,[0,0,0,1]],[1,[255,255,255,1]]],stop:0,direction:"to bottom",emptyStop:[0,0,0,0],buttons:["to top right","to right","to bottom right","to bottom","to bottom left","to left","to top left","to top"]}},Jge=W(dz);var Xa=(()=>{let e=class e{constructor(){this.colors=new Map,this.selectedColor=new _e,this.originalOrder=(n,r)=>0}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-palette"]],inputs:{colors:"colors"},outputs:{selectedColor:"selectedColor"},standalone:!1,decls:2,vars:4,consts:[["type","button","class","t-button",3,"id","background","tuiHint","tuiHintDescribe","click",4,"ngFor","ngForOf"],["type","button",1,"t-button",3,"click","id","tuiHint","tuiHintDescribe"]],template:function(r,o){r&1&&(O(0,lz,1,5,"button",0),Y(1,"keyvalue")),r&2&&v("ngForOf",hT(1,1,o.colors,o.originalOrder))},dependencies:[Ci,Ve,ze,VT],styles:["[_nghost-%COMP%]{display:flex;flex-wrap:wrap;padding:.875rem}.t-button[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;padding:0;background:none;font-size:inherit;line-height:inherit;inline-size:1.5625rem;block-size:1.5625rem;box-sizing:border-box;margin:.375rem;border-radius:var(--tui-radius-m);border:1px solid rgba(0,0,0,.08)}"],changeDetection:0});let t=e;return t})();var Ja=(()=>{let e=class e{};e.\u0275fac=function(r){return new(r||e)},e.\u0275mod=bn({type:e}),e.\u0275inj=vn({imports:[wa,Bv]});let t=e;return t})();function fz(t,e){if(t&1&&(Q(0,"div",4),Y(1,"async")),t&2){let i=_();Ye("background",J(1,2,i.backgroundColor$))}}function pz(t,e){if(t&1){let i=q();E(0,"tui-palette",5),x("selectedColor",function(r){P(i);let o=_();return F(o.editor==null?null:o.editor.setBackgroundColor(r))}),w()}if(t&2){let i=_();v("colors",i.colors)}}var J2=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.backgroundColor$=null,this.backColorText$=this.texts$.pipe(S(n=>n.backColor)),this.colors=this.options.colors}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}isBlankColor(n){return n===this.options.blankColor}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}initStream(){var n;this.backgroundColor$=((n=this.editor)==null?void 0:n.stateChange$.pipe(S(()=>{var r;return((r=this.editor)==null?void 0:r.getBackgroundColor())??this.options.blankColor??!1}),ke()))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-highlight-color"]],inputs:{colors:"colors",inputEditor:[0,"editor","inputEditor"]},decls:7,vars:9,consts:[["hiliteDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__hilite-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"iconStart","tuiHint"],["class","t-plate",3,"background",4,"ngIf"],[1,"t-plate"],[1,"t-color-picker",3,"selectedColor","colors"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),O(3,fz,2,4,"div",3),Y(4,"async"),O(5,pz,1,1,"ng-template",null,0,We),w()),r&2){let s=be(6);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(),v("iconStart",o.icons.textHilite)("tuiHint",J(2,5,o.backColorText$)),C(2),v("ngIf",!o.isBlankColor(J(4,7,o.backgroundColor$)||""))}},dependencies:[Re,ut,Le,Ze,Tt,Ve,ze,Ja,Xa],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function hz(t,e){if(t&1){let i=q();E(0,"div",5)(1,"button",6),x("click",function(){P(i);let r=_(3);return F(r.editor==null?null:r.editor.toggleUnorderedList())}),he(2," Unordered list "),w(),E(3,"button",7),x("click",function(){P(i);let r=_(3);return F(r.editor==null?null:r.editor.toggleOrderedList())}),he(4," Ordered list "),w(),E(5,"button",8),x("click",function(){P(i);let r=_(3);return F(r.editor==null?null:r.editor.toggleTaskList())}),he(6," Toggle task list "),w(),E(7,"button",9),x("click",function(){P(i);let r=_(3);return F(r.sinkListItem())}),he(8," Sink list item "),w(),E(9,"button",10),x("click",function(){P(i);let r=_(3);return F(r.liftListItem())}),he(10," Lift list item "),w()()}if(t&2){let i=_(2).ngIf,n=_();C(),v("iconStart",n.options.icons.listUnOrdered)("tuiHint",i.unorderedList),C(2),v("iconStart",n.options.icons.listOrdered)("tuiHint",i.orderedList),C(2),v("iconStart",n.options.icons.taskList),C(2),v("iconStart",n.options.icons.indent)("tuiHint",i.indent),C(2),v("iconStart",n.options.icons.outdent)("tuiHint",i.outdent)}}function mz(t,e){if(t&1&&(E(0,"div",3),Q(1,"button",4),O(2,hz,11,9,"ng-template",null,0,We),w()),t&2){let i=be(3),n=_().ngIf,r=_();v("tuiDropdown",i)("tuiDropdownOpen",!1),C(),v("iconStart",r.options.icons.listPreview)("tuiHint",n.list)}}function gz(t,e){if(t&1&&(_t(0),O(1,mz,4,4,"div",2),Y(2,"async"),Ct()),t&2){let i=_();C(),v("ngIf",J(2,1,i.listState$))}}var eM=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.listState$=null}set inputEditor(n){this.localEditor=n,this.initStream()}get editor(){return this.injectionEditor??this.localEditor}sinkListItem(){var n;(n=this.editor)==null||n.sinkListItem()}liftListItem(){var n;(n=this.editor)==null||n.liftListItem()}initStream(){var n,r,o;this.listState$=In([((n=this.editor)==null?void 0:n.isActive$("orderedList"))??ce(!1),((r=this.editor)==null?void 0:r.isActive$("bulletList"))??ce(!1),((o=this.editor)==null?void 0:o.isActive$("taskList"))??ce(!1)]).pipe(S(([s,a,u])=>({ordered:s,unordered:a,tasked:u})))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-list-configs"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:2,vars:3,consts:[["listDropdown",""],[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__ordering-list-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-dropdown","t-dropdown-list"],["appearance","icon","automation-id","toolbar__un-ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__task-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart"],["appearance","icon","automation-id","toolbar_indent-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"click","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar_outdent-button","size","s","tuiIconButton","","type","button",1,"t-option",3,"click","iconStart","tuiHint"]],template:function(r,o){r&1&&(O(0,gz,3,3,"ng-container",1),Y(1,"async")),r&2&&v("ngIf",J(1,1,o.texts$))},dependencies:[Re,ut,Le,Ze,Tt,Ve,ze],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function yz(t,e){if(t&1&&(Q(0,"div",3),Y(1,"async")),t&2){let i=_();Ye("background",J(1,2,i.color$))}}function vz(t,e){if(t&1){let i=q();E(0,"tui-palette",4),x("selectedColor",function(r){P(i);let o=_();return F(o.setCellColor(r))}),w()}if(t&2){let i=_();v("colors",i.colors)}}var tM=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.colorText$=null,this.isActive$=null,this.color$=null,this.colors=this.options.colors}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}isBlankColor(n){return n===this.options.blankColor}setCellColor(n){var r,o;(r=this.editor)!=null&&r.isActive("group")?this.editor.setGroupHilite(n):(o=this.editor)!=null&&o.isActive("table")&&this.editor.setCellColor(n)}initStream(){var n,r,o;this.colorText$=this.texts$.pipe(S(s=>{var a,u;return((a=this.editor)==null?void 0:a.isActive("group"))&&s.hiliteGroup||((u=this.editor)==null?void 0:u.isActive("table"))&&s.cellColor||""})),this.isActive$=In([((n=this.editor)==null?void 0:n.isActive$("table"))??ce(!1),((r=this.editor)==null?void 0:r.isActive$("group"))??ce(!1)]).pipe(S(([s,a])=>s||a)),this.color$=((o=this.editor)==null?void 0:o.stateChange$.pipe(S(()=>{var s,a;return((s=this.editor)==null?void 0:s.getCellColor())??((a=this.editor)==null?void 0:a.getGroupColor())??this.options.blankColor}),ke()))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-cell-color"]],inputs:{colors:"colors",inputEditor:[0,"editor","inputEditor"]},decls:7,vars:13,consts:[["cellColorDropdown",""],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiDropdown","tuiDropdownMaxHeight","tuiDropdownOpen","tuiHint"],["class","t-plate t-plate_paint",3,"background",4,"ngIf"],[1,"t-plate","t-plate_paint"],[1,"t-color-picker",3,"selectedColor","colors"]],template:function(r,o){if(r&1&&(Q(0,"button",1),Y(1,"async"),Y(2,"async"),O(3,yz,2,4,"div",2),Y(4,"async"),O(5,vz,1,1,"ng-template",null,0,We)),r&2){let s=be(6);v("disabled",!J(1,7,o.isActive$))("iconStart",o.icons.paint)("tuiDropdown",s)("tuiDropdownMaxHeight",999)("tuiDropdownOpen",!1)("tuiHint",J(2,9,o.colorText$)),C(3),v("ngIf",!o.isBlankColor(J(4,11,o.color$)||""))}},dependencies:[Re,ut,Le,Is,Ze,Tt,Ve,ze,Ja,Xa],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();function bz(t,e){if(t&1){let i=q();E(0,"div",4),x("click",function(){P(i);let r=_(2);return F(r.select())})("mouseenter",function(r){let o=P(i).$implicit,s=_().$implicit,a=_();return F(a.updateCurrentSize(o+1,s+1,r))}),w()}if(t&2){let i=e.$implicit,n=_().$implicit,r=_();Te("t-cell_hovered",r.tableSelectHovered(i,n))}}function _z(t,e){if(t&1&&(E(0,"div",2),O(1,bz,1,2,"div",3),w()),t&2){let i=_();C(),v("tuiRepeatTimesOf",i.rowsNumber)}}function Cz(t,e){if(t&1){let i=q();E(0,"tui-table-size-selector",4),x("selectSize",function(r){P(i);let o=_();return F(o.addTable(r))}),w()}}var Dz=15,Ez=15,wz=70,Tz=(()=>{let e=class e{constructor(){this.win=h(Pn),this.tableSize={rows:1,cols:1},this.selectSize=new _e}get columnsNumber(){return Math.min(Math.max(3,this.tableSize.cols+1),Dz)}get rowsNumber(){return Math.min(Math.max(3,this.tableSize.rows+1),Ez)}tableSelectHovered(n,r){return nwz&&(this.tableSize={rows:n,cols:r})}select(){this.selectSize.emit(this.tableSize)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-size-selector"]],outputs:{selectSize:"selectSize"},decls:3,vars:3,consts:[["class","t-column",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-description"],[1,"t-column"],["class","t-cell",3,"t-cell_hovered","click","mouseenter",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-cell",3,"click","mouseenter"]],template:function(r,o){r&1&&(O(0,_z,2,1,"div",0),E(1,"div",1),he(2),w()),r&2&&(v("tuiRepeatTimesOf",o.columnsNumber),C(2),ny("",o.tableSize.cols,"\xD7",o.tableSize.rows,""))},dependencies:[YI],styles:["[_nghost-%COMP%]{display:block;padding:.75rem}.t-cell[_ngcontent-%COMP%]{display:inline-block;background-color:var(--tui-background-base);inline-size:1.25rem;block-size:1.25rem;border-radius:.25rem;margin:.125rem;border:.0625rem solid var(--tui-border-normal);cursor:pointer}.t-cell_hovered[_ngcontent-%COMP%]{background-color:var(--tui-background-base-alt)}.t-column[_ngcontent-%COMP%]{white-space:nowrap}.t-description[_ngcontent-%COMP%]{text-align:center}"],changeDetection:0});let t=e;return t})(),nM=(()=>{let e=class e{constructor(){this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.insertTableText$=this.texts$.pipe(S(n=>n.insertTable)),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}addTable({rows:n,cols:r}){var s,a,u,l,c,f,p;(s=this.editor)==null||s.enter();let o=(u=(a=this.editor)==null?void 0:a.state)==null?void 0:u.selection.anchor;(l=this.editor)==null||l.enter(),(c=this.editor)==null||c.enter(),(f=this.editor)==null||f.setTextSelection(o??0),(p=this.editor)==null||p.insertTable(n,r)}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-create"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:6,consts:[["table",""],["tableDropdown",""],["tuiDropdownAlign","left","tuiDropdownDirection","bottom",3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__insert-table-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[3,"selectSize"]],template:function(r,o){if(r&1&&(E(0,"div",2,0),Q(2,"button",3),Y(3,"async"),w(),O(4,Cz,1,0,"ng-template",null,1,We)),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(2),v("iconStart",o.options.icons.insertTable)("tuiHint",J(3,4,o.insertTableText$))}},dependencies:[Re,Le,Is,Ze,Tt,Ve,ze,Tz],encapsulation:2,changeDetection:0});let t=e;return t})();var iM=(()=>{let e=class e{constructor(){this.localEditor=null,this.destroyRef=h(it),this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.canMergeCells=ge(!1),this.canSplitCells=ge(!1)}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}mergeCells(){var n;(n=this.editor)==null||n.mergeCells()}splitCell(){var n;(n=this.editor)==null||n.splitCell()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n,r;(n=this.editor)==null||n.stateChange$.pipe(S(()=>{var o;return((o=this.editor)==null?void 0:o.canMergeCells())??!1}),ke(),Se(this.destroyRef)).subscribe(o=>this.canMergeCells.set(o)),(r=this.editor)==null||r.stateChange$.pipe(S(()=>{var o;return((o=this.editor)==null?void 0:o.canSplitCells())??!1}),ke(),Se(this.destroyRef)).subscribe(o=>this.canSplitCells.set(o))}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-merge-cells"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:3,vars:7,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"]],template:function(r,o){if(r&1&&(E(0,"button",0),Y(1,"async"),Y(2,"async"),x("click",function(){return o.canMergeCells()?o.mergeCells():o.splitCell()}),w()),r&2){let s;v("disabled",!o.canMergeCells()&&!o.canSplitCells())("iconStart",o.canMergeCells()?o.options.icons.tableCellMerge:o.options.icons.tableCellSplit)("tuiHint",o.canMergeCells()?(s=J(1,3,o.texts$))==null?null:s.mergeCells:(s=J(2,5,o.texts$))==null?null:s.splitCells)}},dependencies:[Re,Le,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function xz(t,e){if(t&1){let i=q();E(0,"button",5),x("click",function(){let r=P(i).index,o=_().index,s=_(2);return F(s.onTableOption(o*2+r))}),he(1),w()}if(t&2){let i=e.$implicit;C(),Nt(" ",i," ")}}function Iz(t,e){if(t&1&&(E(0,"tui-opt-group"),O(1,xz,2,1,"button",4),w()),t&2){let i=e.$implicit;C(),v("ngForOf",i)}}function Sz(t,e){if(t&1&&(E(0,"tui-data-list"),O(1,Iz,2,1,"tui-opt-group",3),Y(2,"async"),w()),t&2){let i=_();C(),v("ngForOf",J(2,1,i.tableCommandTexts$))}}var eu={InsertColumnBefore:0,InsertColumnAfter:1,InsertRowBefore:2,InsertRowAfter:3,DeleteColumn:4,DeleteRow:5},rM=(()=>{let e=class e{constructor(){this.localEditor=null,this.commandsRegistry=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.tableCommandTexts$=h(lS),this.isActive$=null,this.rowsColumnsManagingText$=this.texts$.pipe(S(n=>n.rowsColumnsManaging))}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}onTableOption(n){var r,o;(o=(r=this.commandsRegistry)==null?void 0:r[n])==null||o.call(r)}initStream(){var n;this.commandsRegistry={[eu.InsertColumnAfter]:()=>{var r;return(r=this.editor)==null?void 0:r.addColumnAfter()},[eu.InsertColumnBefore]:()=>{var r;return(r=this.editor)==null?void 0:r.addColumnBefore()},[eu.InsertRowAfter]:()=>{var r;return(r=this.editor)==null?void 0:r.addRowAfter()},[eu.InsertRowBefore]:()=>{var r;return(r=this.editor)==null?void 0:r.addRowBefore()},[eu.DeleteColumn]:()=>{var r;return(r=this.editor)==null?void 0:r.deleteColumn()},[eu.DeleteRow]:()=>{var r;return(r=this.editor)==null?void 0:r.deleteRow()}},this.isActive$=((n=this.editor)==null?void 0:n.isActive$("table"))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-table-row-column-manager"]],inputs:{inputEditor:[0,"editor","inputEditor"]},decls:6,vars:9,consts:[["tableOptionsDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint"],[4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),Y(3,"async"),w(),O(4,Sz,3,3,"ng-template",null,0,We)),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(),v("disabled",!J(2,5,o.isActive$))("iconStart",o.options.icons.addRowTable)("tuiHint",J(3,7,o.rowsColumnsManagingText$))}},dependencies:[Re,Ci,Le,Ms,Ss,jS,Ze,Tt,Ve,ze],encapsulation:2,changeDetection:0});let t=e;return t})();function Mz(t,e){if(t&1){let i=q();E(0,"tui-palette",3),x("selectedColor",function(r){P(i);let o=_();return F(o.editor==null?null:o.editor.setFontColor(r))}),w()}if(t&2){let i=_();v("colors",i.colors)}}var oM=(()=>{let e=class e{constructor(){this.localEditor=null,this.options=h(xe),this.injectionEditor=h(je,{optional:!0}),this.texts$=h(lt),this.foreColorText$=this.texts$.pipe(S(n=>n.foreColor)),this.fontColor$=null,this.colors=this.options.colors}set inputEditor(n){this.localEditor=n,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){var n;this.fontColor$=((n=this.editor)==null?void 0:n.stateChange$.pipe(S(()=>{var r;return((r=this.editor)==null?void 0:r.getFontColor())??this.options.blankColor}),S(r=>r===this.options.blankColor?"":r),ke()))??null}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-text-color"]],inputs:{colors:"colors",inputEditor:[0,"editor","inputEditor"]},decls:6,vars:10,consts:[["colorDropdown",""],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__color-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],[1,"t-color-picker",3,"selectedColor","colors"]],template:function(r,o){if(r&1&&(E(0,"div",1),Q(1,"button",2),Y(2,"async"),Y(3,"async"),O(4,Mz,1,1,"ng-template",null,0,We),w()),r&2){let s=be(5);v("tuiDropdown",s)("tuiDropdownOpen",!1),C(),Ye("color",J(2,6,o.fontColor$)),v("iconStart",o.options.icons.textColor)("tuiHint",J(3,8,o.foreColorText$))}},dependencies:[Re,Le,Ze,Tt,Ve,ze,Ja,Xa],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0});let t=e;return t})();var Az=["dropdown"],kz=["*"];function Oz(t,e){if(t&1){let i=q();_t(0),Q(1,"button",4),E(2,"div",5),x("focus",function(){P(i);let r=_();return F(r.onTopFocus())}),w(),E(3,"div",5),x("focus",function(){P(i);let r=_();return F(r.onBottomFocus())}),w(),Ct()}if(t&2){let i=_();C(2),v("tabIndex",i.focusable?0:-1),C(),v("tabIndex",i.focusable?0:-1)}}function Nz(t,e){t&1&&Qt(0)}function Pz(t,e){if(t&1){let i=q();E(0,"div",8)(1,"button",9),x("click",function(){P(i);let r=_(2);return F(r.undo())}),w(),E(2,"button",10),x("click",function(){P(i);let r=_(2);return F(r.redo())}),w()()}if(t&2){let i=_().ngIf,n=_();C(),v("disabled",n.undoDisabled)("iconStart",n.icons.undo)("tuiHint",i.undo),C(),v("disabled",n.redoDisabled)("iconStart",n.icons.redo)("tuiHint",i.redo)}}function Fz(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-font-size",11),w()),t&2){let i=_(2);C(),v("editor",i.editor)}}function Rz(t,e){if(t&1&&Q(0,"tui-font-style",17),t&2){let i=_(3);v("editor",i.editor)("enabledTools",i.toolsSet)}}function Lz(t,e){if(t&1&&Q(0,"tui-align-content",11),t&2){let i=_(3);v("editor",i.editor)}}function Hz(t,e){if(t&1&&Q(0,"tui-list-configs",11),t&2){let i=_(3);v("editor",i.editor)}}function Bz(t,e){if(t&1){let i=q();E(0,"button",18),x("click",function(){P(i);let r=_(3);return F(r.toggleQuote())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("disabled",n.unorderedList||n.orderedList)("iconStart",n.icons.quote)("tuiHint",i.quote)}}function Vz(t,e){if(t&1){let i=q();E(0,"button",19),x("click",function(){P(i);let r=_(3);return F(r.onLink())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("disabled",n.a||n.jumpAnchor)("iconStart",n.icons.link)("tuiHint",i.link)}}function zz(t,e){if(t&1){let i=q();E(0,"button",20),x("click",function(){P(i);let r=_(3);return F(r.onLink("#"))}),w()}if(t&2){let i=_(2).ngIf,n=_();v("disabled",n.a||n.jumpAnchor)("iconStart",n.icons.anchor)("tuiHint",i.insertAnchor)}}function jz(t,e){if(t&1){let i=q();_t(0),E(1,"button",21),x("click",function(){P(i);let r=be(3);return F(r.click())}),w(),E(2,"input",22,0),x("change",function(){P(i);let r=be(3),o=_(3);return F(o.onAttach(r))}),w(),Ct()}if(t&2){let i=_(2).ngIf,n=_();C(),v("iconStart",n.icons.attach)("tuiHint",i.attach),C(),v("accept",n.attachOptions.accept)("multiple",n.attachOptions.multiple)("tabIndex",-1)}}function Uz(t,e){if(t&1&&(E(0,"div",8),O(1,Rz,1,2,"tui-font-style",12)(2,Lz,1,1,"tui-align-content",13)(3,Hz,1,1,"tui-list-configs",13)(4,Bz,1,3,"button",14)(5,Vz,1,3,"button",15)(6,zz,1,3,"button",16)(7,jz,4,5,"ng-container",2),w()),t&2){let i=_(2);C(),v("ngIf",i.formatEnabled),C(),v("ngIf",i.enabled(i.editorTool.Align)),C(),v("ngIf",i.enabled(i.editorTool.List)),C(),v("ngIf",i.enabled(i.editorTool.Quote)),C(),v("ngIf",i.enabled(i.editorTool.Link)),C(),v("ngIf",i.enabled(i.editorTool.Anchor)),C(),v("ngIf",i.enabled(i.editorTool.Attach))}}function $z(t,e){if(t&1){let i=q();E(0,"button",21),x("click",function(){P(i);let r=_(3);return F(r.toggleSubscript())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.sub)("tuiHint",i.subscript)}}function Gz(t,e){if(t&1){let i=q();E(0,"button",21),x("click",function(){P(i);let r=_(3);return F(r.toggleSuperscript())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.sup)("tuiHint",i.superscript)}}function Wz(t,e){if(t&1&&(E(0,"div",8),O(1,$z,1,2,"button",23)(2,Gz,1,2,"button",23),w()),t&2){let i=_(2);C(),v("ngIf",i.enabled(i.editorTool.Sub)),C(),v("ngIf",i.enabled(i.editorTool.Sup))}}function qz(t,e){if(t&1&&Q(0,"tui-text-color",25),t&2){let i=_(3);v("colors",i.colors)("editor",i.editor)}}function Zz(t,e){if(t&1&&Q(0,"tui-highlight-color",25),t&2){let i=_(3);v("colors",i.colors)("editor",i.editor)}}function Kz(t,e){if(t&1&&(E(0,"div",8),O(1,qz,1,2,"tui-text-color",24)(2,Zz,1,2,"tui-highlight-color",24),w()),t&2){let i=_(2);C(),v("ngIf",i.enabled(i.editorTool.Color)),C(),v("ngIf",i.enabled(i.editorTool.Hilite))}}function Yz(t,e){if(t&1&&Q(0,"tui-code",11),t&2){let i=_(3);v("editor",i.editor)}}function Qz(t,e){if(t&1){let i=q();E(0,"button",28),x("click",function(){P(i);let r=_(3);return F(r.onTeX())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.tex)("tuiHint",i.tex)}}function Xz(t,e){if(t&1){let i=q();E(0,"div",29)(1,"button",30),x("click",function(){P(i);let r=be(3);return F(r.click())}),w(),E(2,"input",31,1),x("change",function(){P(i);let r=be(3),o=_(3);return F(o.onImage(r))}),w()()}if(t&2){let i=_(2).ngIf,n=_();C(),v("iconStart",n.icons.image)("tuiHint",i.image),C(),v("tabIndex",-1)}}function Jz(t,e){if(t&1){let i=q();E(0,"button",21),x("click",function(){P(i);let r=_(3);return F(r.insertHorizontalRule())}),w()}if(t&2){let i=_(2).ngIf,n=_();v("iconStart",n.icons.hr)("tuiHint",i.insertHorizontalRule)}}function ej(t,e){if(t&1&&(E(0,"div",8),O(1,Yz,1,1,"tui-code",13)(2,Qz,1,2,"button",26)(3,Xz,4,3,"div",27)(4,Jz,1,2,"button",23),w()),t&2){let i=_(2);C(),v("ngIf",i.enabled(i.editorTool.Code)),C(),v("ngIf",i.enabled(i.editorTool.Tex)),C(),v("ngIf",i.enabled(i.editorTool.Img)),C(),v("ngIf",i.enabled(i.editorTool.HR))}}function tj(t,e){if(t&1){let i=q();E(0,"div",8)(1,"button",21),x("click",function(){P(i);let r=_(2);return F(r.removeFormat())}),w()()}if(t&2){let i=_().ngIf,n=_();C(),v("iconStart",n.icons.clear)("tuiHint",i.clear)}}function nj(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-details",32)(2,"tui-details-remove",32),w()),t&2){let i=_(2);C(),v("editor",i.editor),C(),v("editor",i.editor)}}function ij(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-editor-group-tool",32),w()),t&2){let i=_(2);C(),v("editor",i.editor)}}function rj(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-table-create",32)(2,"tui-table-row-column-manager",32)(3,"tui-table-merge-cells",32),w()),t&2){let i=_(2);C(),v("editor",i.editor),C(),v("editor",i.editor),C(),v("editor",i.editor)}}function oj(t,e){if(t&1&&(E(0,"div",8),Q(1,"tui-table-cell-color",25),w()),t&2){let i=_(2);C(),v("colors",i.colors)("editor",i.editor)}}function sj(t,e){if(t&1&&(E(0,"fieldset",6),O(1,Pz,3,6,"div",7)(2,Fz,2,1,"div",7)(3,Uz,8,7,"div",7)(4,Wz,3,2,"div",7)(5,Kz,3,2,"div",7)(6,ej,5,4,"div",7)(7,tj,2,2,"div",7)(8,nj,3,2,"div",7)(9,ij,2,1,"div",7)(10,rj,4,3,"div",7)(11,oj,2,2,"div",7),E(12,"div",8),at(13),w()()),t&2){let i=_();v("disabled",i.disabled),C(),v("ngIf",i.enabled(i.editorTool.Undo)),C(),v("ngIf",i.enabled(i.editorTool.Size)),C(),v("ngIf",i.firstBigBlockEnabled),C(),v("ngIf",i.enabled(i.editorTool.Sub)||i.enabled(i.editorTool.Sup)),C(),v("ngIf",i.enabled(i.editorTool.Color)||i.enabled(i.editorTool.Hilite)),C(),v("ngIf",i.secondBigBlockEnabled),C(),v("ngIf",i.enabled(i.editorTool.Clear)),C(),v("ngIf",i.enabled(i.editorTool.Details)),C(),v("ngIf",i.enabled(i.editorTool.Group)),C(),v("ngIf",i.enabled(i.editorTool.Table)),C(),v("ngIf",i.enabled(i.editorTool.CellColor))}}var sM=(()=>{let e=class e{constructor(){this.el=h(de).nativeElement}findFirstFocusableTool(n=!1){let r=n?this.toolsContainers.slice().reverse():this.toolsContainers;for(let o of r){let s=ys(o)?o:Po({initial:o,root:o,keyboard:!1});if(s)return s}return null}onHorizontalNavigation(n){let{toolsContainers:r}=this,o=r.findIndex(Ki),s=Jt(o+(n?-1:1),0,r.length-1),a=r[s],u=n?this.findPreviousTool(a):this.findNextTool(a);u&&u.focus()}get toolsContainers(){return Array.from(this.el.querySelectorAll("[tuiItem]"))}findPreviousTool(n){return!n||ys(n)?n??null:Po({initial:n,root:n,keyboard:!1})||Po({initial:n,root:this.el,previous:!0,keyboard:!1})}findNextTool(n){return!n||ys(n)?n??null:Po({initial:n,root:this.el,keyboard:!1})}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiToolbarNavigationManager",""]],hostBindings:function(r,o){r&1&&x("keydown.arrowRight.prevent",function(){return o.onHorizontalNavigation(!1)})("keydown.arrowLeft.prevent",function(){return o.onHorizontalNavigation(!0)})}});let t=e;return t})(),ob=(()=>{let e=class e{constructor(){var n;this.dropdowns=Tf,this.filesLoader=h(uS,{optional:!0}),this.destroyRef=h(it),this.imageLoader=h(hp),this.options=h(xe),this.editorTool=Oe,this.injectionEditor=h(je,{optional:!0}),this.attachOptions=h(aS),this.texts$=h(lt),this.toolsSet=new Set(Tl),this.inputEditor=null,this.colors=this.options.colors,this.disabled=!1,this.linkAdded=new _e,this.texClicked=new _e,this.fileAttached=new _e,this.el=((n=h(de,{optional:!0}))==null?void 0:n.nativeElement)??null}set tools(n){this.toolsSet=new Set(n)}get editor(){return this.injectionEditor??this.inputEditor}get icons(){return this.options.icons}get focused(){return Ki(this.el)||!!this.dropdowns.find(({nativeElement:n})=>Ki(n))}get focusable(){return!this.focused&&!this.disabled}get unorderedList(){var n;return((n=this.editor)==null?void 0:n.isActive("bulletList"))??!1}get orderedList(){var n;return((n=this.editor)==null?void 0:n.isActive("orderedList"))??!1}get blockquote(){var n;return((n=this.editor)==null?void 0:n.isActive("blockquote"))??!1}get a(){var n;return((n=this.editor)==null?void 0:n.isActive("link"))??!1}get jumpAnchor(){var n;return((n=this.editor)==null?void 0:n.isActive("jumpAnchor"))??!1}get undoDisabled(){var n;return((n=this.editor)==null?void 0:n.undoDisabled())??!1}get redoDisabled(){var n;return((n=this.editor)==null?void 0:n.redoDisabled())??!1}get subscript(){var n;return((n=this.editor)==null?void 0:n.isActive("subscript"))??!1}get superscript(){var n;return((n=this.editor)==null?void 0:n.isActive("superscript"))??!1}get formatEnabled(){return this.enabled(Oe.Bold)||this.enabled(Oe.Italic)||this.enabled(Oe.Underline)||this.enabled(Oe.Strikethrough)}get firstBigBlockEnabled(){return this.formatEnabled||this.enabled(Oe.Align)||this.enabled(Oe.List)||this.enabled(Oe.Quote)||this.enabled(Oe.Link)||this.enabled(Oe.Anchor)||this.enabled(Oe.Attach)}get secondBigBlockEnabled(){return this.enabled(Oe.Code)||this.enabled(Oe.Tex)||this.enabled(Oe.Img)||this.enabled(Oe.HR)}onMouseDown(n,r){var o;r.closest("button")||(n.preventDefault(),(o=this.editor)==null||o.focus())}onBottomFocus(){this.focusLast()}onTopFocus(){this.focusFirst()}onImage(n){var o;let r=(o=n.files)==null?void 0:o[0];n.value="",r&&this.imageLoader(r).pipe($t(1),Se(this.destroyRef)).subscribe(s=>this.addImage(s))}onAttach(n){var o;let r=Array.from(n.files||[]);n.value="",r&&((o=this.filesLoader)==null||o.call(this,r).pipe($t(1),Se(this.destroyRef)).subscribe(s=>this.fileAttached.emit(s)))}onTeX(){this.texClicked.emit()}onLink(n){var r,o,s,a,u,l,c;if((r=this.editor)==null||r.takeSelectionSnapshot(),n==="#"){let f=(o=this.editor)==null?void 0:o.getSelectionSnapshot(),p=(s=this.editor)==null?void 0:s.getOriginTiptapEditor(),{from:m=f==null?void 0:f.anchor}=p?Ya(p):{};(a=this.editor)==null||a.setAnchor(""),(l=(u=this.editor)==null?void 0:u.getOriginTiptapEditor())==null||l.commands.focus((m??0)+1)}else(c=this.editor)==null||c.toggleLink(n??"")}enabled(n){return this.toolsSet.has(n)}undo(){var n;(n=this.editor)==null||n.undo()}redo(){var n;(n=this.editor)==null||n.redo()}insertHorizontalRule(){var n;(n=this.editor)==null||n.setHorizontalRule()}removeFormat(){var n;(n=this.editor)==null||n.removeFormat()}toggleOrderedList(){var n;(n=this.editor)==null||n.toggleOrderedList()}toggleQuote(){var n;(n=this.editor)==null||n.toggleBlockquote()}toggleSubscript(){var n;(n=this.editor)==null||n.toggleSubscript()}toggleSuperscript(){var n;(n=this.editor)==null||n.toggleSuperscript()}addImage(n){var r;(r=this.editor)==null||r.setImage(n)}focusFirst(){var r;let n=(r=this.navigationManager)==null?void 0:r.findFirstFocusableTool();n&&n.focus()}focusLast(){var r;let n=(r=this.navigationManager)==null?void 0:r.findFirstFocusableTool(!0);n&&n.focus()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-toolbar"]],viewQuery:function(r,o){if(r&1&&(Gt(sM,5),Gt(Az,5,de)),r&2){let s;Qe(s=Xe())&&(o.navigationManager=s.first),Qe(s=Xe())&&(o.dropdowns=s)}},hostAttrs:["role","toolbar"],hostVars:2,hostBindings:function(r,o){r&1&&x("mousedown",function(a){return o.onMouseDown(a,a.target)}),r&2&&Te("_disabled",o.disabled)},inputs:{inputEditor:[0,"editor","inputEditor"],colors:"colors",disabled:"disabled",tools:"tools"},outputs:{linkAdded:"linkAdded",texClicked:"texClicked",fileAttached:"fileAttached"},ngContentSelectors:kz,decls:5,vars:7,consts:[["fileUpload",""],["image",""],[4,"ngIf"],["tuiToolbarNavigationManager","","class","t-tools-wrapper",3,"disabled",4,"ngIf"],["type","button",1,"t-prevent-parent-label-behavior"],[3,"focus","tabIndex"],["tuiToolbarNavigationManager","",1,"t-tools-wrapper",3,"disabled"],["class","t-block",4,"ngIf"],[1,"t-block"],["appearance","icon","automation-id","toolbar__undo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__redo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","disabled","iconStart","tuiHint"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor"],["tuiItem","","class","t-tool t-wrapper",3,"editor","enabledTools",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"editor",4,"ngIf"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button","class","t-tool",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor","enabledTools"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"click","disabled","iconStart","tuiHint"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"click","iconStart","tuiHint"],["type","file",1,"t-file-upload",3,"change","accept","multiple","tabIndex"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"colors","editor",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"colors","editor"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-wrapper",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool",3,"click","iconStart","tuiHint"],["tuiItem","",1,"t-wrapper"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"click","iconStart","tuiHint"],["accept","image/*","type","file",1,"t-image",3,"change","tabIndex"],["tuiItem","",1,"t-tool","t-tool_margin",3,"editor"]],template:function(r,o){r&1&&(Xt(),O(0,Oz,4,2,"ng-container",2)(1,Nz,1,0,"ng-container",2),Y(2,"async"),O(3,sj,14,12,"fieldset",3),Y(4,"async")),r&2&&(v("ngIf",!o.disabled),C(),v("ngIf",J(2,3,o.editor==null?null:o.editor.stateChange$)),C(2),v("ngIf",J(4,5,o.texts$)))},dependencies:[Re,ut,C2,Le,D2,E2,w2,S2,x2,I2,J2,Ve,ze,DI,eM,tM,nM,iM,rM,oM,sM],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate}._disabled[_nghost-%COMP%]{pointer-events:none}tui-editor[_nghost-%COMP%][_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)), tui-editor [_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){border:none;outline:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper[_ngcontent-%COMP%]{scrollbar-width:none;-ms-overflow-style:none;display:flex;overflow:auto;flex-wrap:wrap;padding:0;margin:0;border:0}.t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar, .t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{display:none}.t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){padding:.25rem .75rem;border:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper._disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:var(--tui-disabled-opacity)}.t-block[_ngcontent-%COMP%]{display:flex;padding:.25rem 0}.t-block[_ngcontent-%COMP%]:empty{display:none}.t-block[_ngcontent-%COMP%]:not(:last-child):after{content:"";display:block;margin:0 .25rem;inline-size:.0625rem;background:var(--tui-background-neutral-1-pressed)}.t-tool[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}button.t-tool[_ngcontent-%COMP%]:hover, .t-tool[_ngcontent-%COMP%] button:hover{background:var(--tui-background-neutral-1-hover)}.t-tool_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-font[_ngcontent-%COMP%]{padding:.3em 0;outline:none;inline-size:100%;pointer-events:none}.t-image[_ngcontent-%COMP%]{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;font-size:0;opacity:0;cursor:pointer}.t-image[_ngcontent-%COMP%]::-webkit-file-upload-button{display:none}.t-file-upload[_ngcontent-%COMP%]{display:none}.t-color-picker[_ngcontent-%COMP%] tui-hosted-dropdown, .t-color-picker[_ngcontent-%COMP%] tui-color-picker, .t-color-picker[_ngcontent-%COMP%] tui-color-edit{display:none}.t-prevent-parent-label-behavior[_ngcontent-%COMP%]{display:none}'],changeDetection:0});let t=e;return t})();var aj=["tuiDropdown"],uj=["*",[["tools"]],[["tools"]],[["mention"]]],lj=["*","tools","tools","mention"];function cj(t,e){if(t&1){let i=q();E(0,"tui-toolbar",13),x("fileAttached",function(r){P(i);let o=_(2);return F(o.fileAttached.emit(r))}),at(1,1),w()}if(t&2){let i=_(2);v("disabled",!i.interactive())("tools",i.tools)}}function dj(t,e){if(t&1){let i=q();E(0,"div",14),x("mousedown",function(r){P(i);let o=_(2);return F(o.focus(r))}),he(1),w()}if(t&2){let i=_(2);C(),Nt(" ",i.placeholder||i.exampleText," ")}}function fj(t,e){if(t&1){let i=q();E(0,"tui-scrollbar",15),x("mousedown",function(r){P(i);let o=_(2);return F(o.focus(r))}),Qt(1,16),w()}if(t&2){_();let i=be(9);C(),v("ngTemplateOutlet",i)}}function pj(t,e){if(t&1){let i=q();E(0,"tui-scrollbar",17),x("keydown",function(r){P(i);let o=_(2);return F(o.focus(r))})("mousedown",function(r){P(i);let o=_(2);return F(o.focus(r))}),Qt(1,16),Q(2,"tui-editor-portal-host"),w()}if(t&2){_();let i=be(9);C(),v("ngTemplateOutlet",i)}}function hj(t,e){if(t&1){let i=q();E(0,"tui-toolbar",13),x("fileAttached",function(r){P(i);let o=_(4);return F(o.fileAttached.emit(r))}),at(1,2),w()}if(t&2){let i=_(4);v("disabled",!i.interactive())("tools",i.tools)}}function mj(t,e){if(t&1){let i=q();E(0,"tui-edit-link",22,3),x("addLink",function(r){P(i);let o=be(1),s=_(4);return o.anchorMode?s.addAnchor(r):s.addLink(r),F(s.closeDropdown())})("removeLink",function(){P(i);let r=be(1),o=_(4);return r.anchorMode?o.removeAnchor():o.removeLink(),F(o.closeDropdown())}),w()}}function gj(t,e){t&1&&(_t(0),at(1,3),Ct())}function yj(t,e){if(t&1&&(E(0,"div"),O(1,hj,2,2,"tui-toolbar",8)(2,mj,2,0,"tui-edit-link",20)(3,gj,2,0,"ng-container",21),w()),t&2){let i=_(3);Te("t-floating",i.floatingToolbar),C(),v("ngIf",i.floatingToolbar),C(),v("ngIf",i.isLinkSelected),C(),v("ngIf",i.isMentionMode)}}function vj(t,e){if(t&1){let i=q();E(0,"div",18,1)(2,"div",19),x("valueChange",function(r){P(i);let o=_(2);return F(o.onModelChange(r))}),w()(),O(3,yj,4,5,"ng-template",null,2,We)}if(t&2){let i=be(4),n=_(2);v("tuiDropdown",i)("tuiToolbarDropdown",n.dropdownSelectionHandler)("tuiToolbarDropdownPosition",n.floatingToolbar?"selection":"tag"),C(2),v("editable",n.interactive())}}function bj(t,e){if(t&1){let i=q();E(0,"div",6)(1,"div",7),O(2,cj,2,2,"tui-toolbar",8),E(3,"div",9),x("mousedown",function(r){P(i);let o=_();return F(o.focus(r))}),at(4),w(),O(5,dj,2,1,"div",10),w(),O(6,fj,2,1,"tui-scrollbar",11)(7,pj,3,1,"tui-scrollbar",12)(8,vj,5,4,"ng-template",null,0,We),w()}if(t&2){let i=_();C(2),v("ngIf",!i.floatingToolbar),C(3),v("ngIf",i.hasPlaceholder),C(),v("ngIf",i.floatingToolbar),C(),v("ngIf",!i.floatingToolbar)}}var _j=(()=>{let e=class e extends Er{constructor(){var n;super(r=>this.stream$.subscribe(r)),this.previousTagPosition=null,this.range=h(lI),this.doc=((n=h(Je))==null?void 0:n.document)??null,this.selection$=h(Sv),this.el=h(de),this.vcr=h(zt),this.handler$=new on(Mo),this.stream$=In([this.handler$,this.selection$.pipe(S(()=>this.getRange()),ke((r,o)=>r.startOffset===o.startOffset&&r.endOffset===o.endOffset))]).pipe(S(([r,o])=>{var a,u;let s=this.el.nativeElement.contains(o.commonAncestorContainer)||((a=o.commonAncestorContainer.parentElement)==null?void 0:a.closest("tui-dropdown"));return this.range=s&&Nf(o.commonAncestorContainer)||((u=o.commonAncestorContainer)==null?void 0:u.nodeName)==="P"?o:this.range,s&&r(this.range)})),this.position="selection",this.type="dropdown"}set tuiToolbarDropdown(n){ul(n)||this.handler$.next(n)}getClientRect(){var n,r,o;switch(this.position){case"tag":{let{commonAncestorContainer:s}=this.range,a=ui(s)?s:s.parentNode;return(n=a==null?void 0:a.parentElement)!=null&&n.closest("tui-dropdown")?this.previousTagPosition??Wi:(this.previousTagPosition=a&&ui(a)?((o=(r=this.doc)==null?void 0:r.querySelector(".ProseMirror-selectednode"))==null?void 0:o.getBoundingClientRect())||a.getBoundingClientRect():Wi,this.previousTagPosition)}case"word":return Av(this.range).getBoundingClientRect();default:{let s=this.range.getBoundingClientRect();return s.x===0&&s.y===0&&s.width===0&&s.height===0?(this.el.nativeElement.querySelector("p")??this.el.nativeElement).getBoundingClientRect():s}}}ngOnDestroy(){this.ghost&&this.vcr.element.nativeElement.removeChild(this.ghost)}getRange(){var r,o;let n=(r=this.doc)==null?void 0:r.getSelection();return(o=(n==null?void 0:n.rangeCount)&&n.getRangeAt(0)||this.range)==null?void 0:o.cloneRange()}};e.\u0275fac=function(r){return new(r||e)},e.\u0275dir=T({type:e,selectors:[["","tuiToolbarDropdown",""]],inputs:{position:[0,"tuiToolbarDropdownPosition","position"],tuiToolbarDropdown:"tuiToolbarDropdown"},features:[Z([Ho(e),Ts(e)]),oe]});let t=e;return t})(),aM=(()=>{let e=class e extends Cs{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275prov=$({token:e,factory:e.\u0275fac});let t=e;return t})(),Cj=[{provide:Tv,deps:[iS],useFactory:t=>{let e=new ur(1);return Promise.all(t).then(i=>e.next(i)).catch(()=>e.next([])),e}},{provide:Il,deps:[oi],useFactory:t=>t.createElement("div")},{provide:Ra,deps:[Il,Tv,pS,Je,xe],useFactory:(t,e,i,n,r)=>In([i,e]).pipe($t(1),S(([o,s])=>{try{return globalThis.document||(globalThis.document=n.document),new o(U(M({},r),{element:t,extensions:s}))}catch{return null}}),Li({bufferSize:1,refCount:!0}))},je,aM],Dj=(()=>{let e=class e extends Si{constructor(){super(...arguments),this.el=h(de).nativeElement,this.type="viewport"}getClientRect(){return this.el.getBoundingClientRect()}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiEditorPortal",""]],features:[Z([{provide:kl,useExisting:aM},ES(e)]),oe]});let t=e;return t})(),Ej=(()=>{let e=class e extends _l{};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-editor-portal-host"]],features:[Z([{provide:Cs,useExisting:kl},{provide:_l,useExisting:e}]),oe],decls:2,vars:0,consts:[["viewContainer",""]],template:function(r,o){r&1&&Qt(0,null,0)},styles:["[_nghost-%COMP%]{position:absolute;top:0;left:0;display:block;block-size:100%;inline-size:100%;pointer-events:none}"],changeDetection:0});let t=e;return t})(),Ibe=(()=>{let e=class e extends bl{constructor(){var n;super(...arguments),this.contentProcessor=h(sS,{optional:!0}),this.doc=((n=h(Je))==null?void 0:n.document)??null,this.zone=h(me),this.destroy$=h(it),this.options=h(xe),this.editorLoaded=ge(!1),this.editorLoaded$=h(Ra),this.cd=h(st),this.$=this.editorLoaded$.pipe(Jn(0),Se()).subscribe(()=>{var r;this.hasMentionPlugin=!!((r=this.editorService.getOriginTiptapEditor())!=null&&r.extensionManager.extensions.find(o=>o.name==="mention")),this.listenResizeEvents(),this.editorService.setValue(this.firstInitialValue),this.editorLoaded.set(!0),this.cd.detectChanges(),this.patchContentEditableElement()}),this.firstInitialValue="",this.exampleText=this.options.exampleText,this.placeholder=this.options.placeholder,this.floatingToolbar=this.options.floatingToolbar,this.tools=this.options.tools,this.fileAttached=new _e,this.focusIn=new _e,this.focusOut=new _e,this.hasMentionPlugin=!1,this.hovered=Cn(nt(ct(Ee(),"mouseenter").pipe(S(Mo)),ct(Ee(),"mouseleave").pipe(S(Di))).pipe(Jr(this.cdr))),this.focused=Ep(!1),this.m=wp(this.mode),this.s=Ha(Pt(()=>this.disabled()?"disabled":this.hovered()?"hover":null)),this.editorService=h(je),this.openDropdownWhen=r=>this.currentFocusedNodeIsTextAnchor(r)||this.currentFocusedNodeIsImageAnchor||this.isMentionMode}set readOnlyMode(n){this.readOnly.set(n)}get editor(){return this.editorService.getOriginTiptapEditor()?this.editorService:null}get nativeFocusableElement(){var n,r;return((r=(n=this.el)==null?void 0:n.nativeElement)==null?void 0:r.querySelector("[contenteditable].ProseMirror"))||null}get selectionState(){return n2(this.editor)}get mentionSuggestions(){let n=this.selectionState.before;return n!=null&&n.startsWith("@")&&n.length>1&&(n==null?void 0:n.replace("@",""))||""}get isMentionMode(){var n;return this.hasMentionPlugin&&((n=this.selectionState.before)==null?void 0:n.startsWith("@"))}writeValue(n){var o,s,a,u;let r=((o=this.contentProcessor)==null?void 0:o.fromControlValue(n))??n;super.writeValue(r),this.firstInitialValue!==r&&(this.firstInitialValue=r??""),this.focused()||(u=(a=(s=this.doc)==null?void 0:s.getSelection)==null?void 0:a.call(s))==null||u.removeAllRanges(),this.editorLoaded()&&this.editorService.setValue(r??"")}ngOnDestroy(){var n;(n=this.editor)==null||n.destroy()}get dropdownSelectionHandler(){return!this.focused()||this.readOnly()?Di:this.floatingToolbar?()=>this.value().trim()!=="":this.openDropdownWhen}get hasPlaceholder(){return!!(this.placeholder||this.exampleText)&&!this.value()&&!this.readOnly()}get isLinkSelected(){var o,s,a,u,l,c;let n=(s=(o=this.doc)==null?void 0:o.getSelection())==null?void 0:s.focusNode,r=n==null?void 0:n.parentNode;return(r==null?void 0:r.nodeName.toLowerCase())==="a"||((a=r==null?void 0:r.parentNode)==null?void 0:a.nodeName.toLowerCase())==="a"||(n==null?void 0:n.nodeName.toLowerCase())==="a"||!!((u=n==null?void 0:n.parentElement)!=null&&u.closest("a"))||!!((l=n==null?void 0:n.parentElement)!=null&&l.closest("tui-edit-link"))||!!((c=n==null?void 0:n.parentElement)!=null&&c.closest("tui-dropdown"))}onModelChange(n){var o;let r=((o=this.contentProcessor)==null?void 0:o.toControlValue(n))??n;r!==this.control.value&&this.onChange(r??"")}onActiveZone(n){this.focused.set(n),n?this.focusIn.emit():this.focusOut.emit()}addAnchor(n){var r;(r=this.editor)==null||r.setAnchor(n)}removeAnchor(){var n;(n=this.editor)==null||n.removeAnchor()}closeDropdown(){var n;(n=this.tuiDropdown)==null||n.toggle(!1)}addLink(n){var r,o;(r=this.editor)==null||r.selectClosest(),(o=this.editor)==null||o.setLink(n)}removeLink(){var n;(n=this.editor)==null||n.unsetLink()}focus(n){var o,s,a,u;(o=this.nativeFocusableElement)!=null&&o.contains(n.target)||(a=(s=this.toolbar)==null?void 0:s.el)!=null&&a.contains(n.target)||(n.preventDefault(),(u=this.nativeFocusableElement)==null||u.focus())}get focusNode(){var n,r,o;return((o=(r=(n=this.doc)==null?void 0:n.getSelection)==null?void 0:r.call(n))==null?void 0:o.focusNode)??null}get currentFocusedNodeIsImageAnchor(){var r,o,s;let n=(o=(r=this.focusNode)==null?void 0:r.childNodes[0])==null?void 0:o.nodeName;return((s=this.focusNode)==null?void 0:s.nodeName)==="A"&&n&&["IMG","TUI-IMAGE-EDITOR"].includes(n)||!1}currentFocusedNodeIsTextAnchor(n){var r,o,s,a;return((r=this.focusNode)==null?void 0:r.nodeName)==="A"||!!((s=(o=this.focusNode)==null?void 0:o.parentElement)!=null&&s.closest("tui-edit-link"))||!!((a=n.startContainer.parentElement)!=null&&a.closest("a"))&&o2(n)}patchContentEditableElement(){var n,r;(n=this.nativeFocusableElement)==null||n.setAttribute("translate",this.options.translate),(r=this.nativeFocusableElement)==null||r.setAttribute("spellcheck",String(this.options.spellcheck))}listenResizeEvents(){var n;(n=this.el)!=null&&n.nativeElement&&ct(this.el.nativeElement,Lo).pipe(gi(0),Ei(this.zone),Se(this.destroy$)).subscribe(()=>this.editorService.valueChange$.next(this.editorService.getHTML()))}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-editor"]],viewQuery:function(r,o){if(r&1&&(Gt(Ol,5,de),Gt(aj,5),Gt(ob,5)),r&2){let s;Qe(s=Xe())&&(o.el=s.first),Qe(s=Xe())&&(o.tuiDropdown=s.first),Qe(s=Xe())&&(o.toolbar=s.first)}},hostAttrs:["ngSkipHydration","true"],hostBindings:function(r,o){r&1&&x("tuiActiveZoneChange",function(a){return o.onActiveZone(a)})("click",function(a){return o.focus(a)})},inputs:{exampleText:"exampleText",placeholder:"placeholder",floatingToolbar:"floatingToolbar",tools:"tools",readOnlyMode:[0,"readOnly","readOnlyMode"]},outputs:{fileAttached:"fileAttached",focusIn:"focusIn",focusOut:"focusOut"},features:[Z([Cj,{provide:Dp,useValue:{appearance:"textfield"}},vI({delay:Ov,query:"[contenteditable].ProseMirror, input:not(.t-image, .t-file-upload), textarea, select"})]),Mt([{directive:Ji,inputs:["tuiAppearance","appearance"]},{directive:xi,outputs:["tuiActiveZoneChange","tuiActiveZoneChange"]}]),oe],ngContentSelectors:lj,decls:2,vars:2,consts:[["editor",""],["tuiDropdown","tuiDropdown"],["dropdown",""],["link",""],["class","t-wrapper",4,"ngIf"],[1,"t-hidden-editor",3,"content"],[1,"t-wrapper"],[1,"t-toolbar-wrapper"],[3,"disabled","tools","fileAttached",4,"ngIf"],[1,"t-editor-label",3,"mousedown"],["class","t-editor-example-text",3,"mousedown",4,"ngIf"],["class","t-scrollbar",3,"mousedown",4,"ngIf"],["tuiEditorPortal","","class","t-scrollbar",3,"keydown","mousedown",4,"ngIf"],[3,"fileAttached","disabled","tools"],[1,"t-editor-example-text",3,"mousedown"],[1,"t-scrollbar",3,"mousedown"],[3,"ngTemplateOutlet"],["tuiEditorPortal","",1,"t-scrollbar",3,"keydown","mousedown"],["tuiDropdownLimitWidth","auto",3,"tuiDropdown","tuiToolbarDropdown","tuiToolbarDropdownPosition"],["tuiTiptapEditor","",1,"tui-editor-socket",3,"valueChange","editable"],[3,"addLink","removeLink",4,"ngIf"],[4,"ngIf"],[3,"addLink","removeLink"]],template:function(r,o){r&1&&(Xt(uj),O(0,bj,10,4,"div",4),Q(1,"tui-editor-socket",5)),r&2&&(v("ngIf",o.editorLoaded()),C(),v("content",o.value()))},dependencies:[ut,LT,Is,Ze,b2,_j,Dj,Ej,_2,Wa,Ol,ob],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate;font:var(--tui-font-text-m);border-radius:var(--tui-radius-m);max-block-size:inherit;min-block-size:10rem;box-sizing:border-box;overflow:auto}[_nghost-%COMP%]:after{content:"";display:table;clear:both}.t-wrapper[_ngcontent-%COMP%]{display:flex;block-size:100%;max-block-size:inherit;min-block-size:inherit;cursor:text;overflow:clip;flex-direction:column;border-radius:inherit}.t-editor-label[_ngcontent-%COMP%]{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none;will-change:transform;transform:translateY(-.25rem);inline-size:95%;font-size:.9375rem}.t-editor-label_raised[_ngcontent-%COMP%]{transform:translateY(-.4375rem)}.t-editor-label[_ngcontent-%COMP%]:not(:empty){margin:1rem 1rem -.625rem;min-block-size:1.625rem}.t-editor-label[_ngcontent-%COMP%]:empty{margin-bottom:1rem}.t-editor-example-text[_ngcontent-%COMP%]{position:absolute;left:1rem;margin-top:.1875rem;color:var(--tui-text-secondary);letter-spacing:normal;text-transform:none}.t-scrollbar[_ngcontent-%COMP%]{display:flex;padding-bottom:.75rem;box-sizing:border-box;flex:1}.t-floating[_ngcontent-%COMP%], .t-floating[_ngcontent-%COMP%] .t-tools-wrapper{max-inline-size:var(--tui-floating-toolbar-max-width, 31.25rem);flex-wrap:nowrap}'],changeDetection:0});let t=e;return t})();var sb=class{constructor(e,i,n){let r=i.get(vr),s=i.get(Vr).resolveComponentFactory(e);this.componentRef=s.create(i,[]),this.updateProps(n),r.attachView(this.componentRef.hostView)}get el(){return this.componentRef.injector.get(de)}get dom(){return this.el.nativeElement}updateProps(e){Object.entries(e).forEach(([i,n])=>{this.instance[i]=n})}detectChanges(){this.componentRef.changeDetectorRef.detectChanges()}destroy(){this.componentRef.destroy()}get instance(){return this.componentRef.instance}},jp=class{},tu=class extends I1{constructor(e,i,n){super(e,i,n),this.contentDOMElement=null}get dom(){return this.renderer.dom}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}mount(){let e=this.options.injector,i=e.get(qe),n={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode(),view:this.view,innerDecorations:this.innerDecorations,HTMLAttributes:this.HTMLAttributes};this.editor.on("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.renderer=new sb(this.component,e,n),this.extension.config.draggable&&(this.renderer.el.nativeElement.ondragstart=o=>{this.onDragStart(o)});let r=this.node.isInline?"span":"div";this.contentDOMElement=this.node.isLeaf?null:i.createElement(r),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit",this.renderer.detectChanges()),this.appendContendDom()}update(e,i){return this.options.update?this.options.update(e,i):e.type!==this.node.type?!1:(e===this.node&&this.decorations===i||(this.node=e,this.decorations=i,this.renderer.updateProps({node:e,decorations:i}),this.appendContendDom()),!0)}handleSelectionUpdate(){let{from:e,to:i}=this.editor.state.selection;e<=this.getPos()&&i>=this.getPos()+this.node.nodeSize?this.selectNode():this.deselectNode()}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.contentDOMElement=null}appendContendDom(){let e=this.dom.querySelector("[data-node-view-content]");this.contentDOMElement&&e&&!e.contains(this.contentDOMElement)&&e.appendChild(this.contentDOMElement)}};var wj=["container"],Tj=["*"],xj=t=>[t,0],Ij=()=>[1,0],Sj=()=>[0,1];function Mj(t,e){if(t&1){let i=q();E(0,"div",5),x("tuiSizeChange",function(r){P(i);let o=_();return F(o.sizeChange.emit(r))}),w()}t&2&&v("tuiResizer",Qr(1,Sj))}var Up=(()=>{let e=class e extends jp{constructor(){super(...arguments),this.currentHeight=0,this.currentWidth=0}get node(){return this.localNode}set node(n){this.localNode=n,this.changeDetector.markForCheck()}get attrs(){var n;return((n=this.node)==null?void 0:n.attrs)||{src:""}}get width(){return(this.currentWidth||this.attrs.width)??null}get height(){return(this.currentHeight||this.attrs.height)??null}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,standalone:!1,features:[oe]});let t=e;return t})(),$p=(()=>{let e=class e{constructor(){this.autoHeight=!1,this.width=null,this.height=null,this.sizeChange=new _e}get hostWidth(){return by(this.width)?ht(this.width):this.width}get hostHeight(){return this.autoHeight?null:by(this.height)?ht(this.height):this.height}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-editor-resizable"]],viewQuery:function(r,o){if(r&1&&Gt(wj,7),r&2){let s;Qe(s=Xe())&&(o.container=s.first)}},hostVars:4,hostBindings:function(r,o){r&2&&Ye("width",o.hostWidth)("height",o.hostHeight)},inputs:{autoHeight:"autoHeight",width:"width",height:"height"},outputs:{sizeChange:"sizeChange"},ngContentSelectors:Tj,decls:6,vars:8,consts:[["container",""],["tuiResizable","",1,"t-resizable"],[1,"t-handle","t-handle-left-side",3,"tuiSizeChange","tuiResizer"],["class","t-handle t-handle-bottom-side",3,"tuiResizer","tuiSizeChange",4,"ngIf"],[1,"t-handle","t-handle-right-side",3,"tuiSizeChange","tuiResizer"],[1,"t-handle","t-handle-bottom-side",3,"tuiSizeChange","tuiResizer"]],template:function(r,o){if(r&1){let s=q();Xt(),E(0,"div",1,0),at(2),E(3,"div",2),x("tuiSizeChange",function(u){return P(s),F(o.sizeChange.emit(u))}),w(),O(4,Mj,1,2,"div",3),E(5,"div",4),x("tuiSizeChange",function(u){return P(s),F(o.sizeChange.emit(u))}),w()()}r&2&&(Te("t-resizable-auto-height",o.autoHeight),C(3),v("tuiResizer",Kn(5,xj,-1)),C(),v("ngIf",!o.autoHeight),C(),v("tuiResizer",Qr(7,Ij)))},dependencies:[ut,Dv,QI],styles:['[_nghost-%COMP%]{position:relative;display:inline-block;box-sizing:border-box}[_nghost-%COMP%] .t-resizable[_ngcontent-%COMP%]{box-sizing:border-box}[_nghost-%COMP%] .t-resizable-auto-height[_ngcontent-%COMP%]{block-size:auto!important}[_nghost-%COMP%] iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}[_nghost-%COMP%]:hover .t-handle[_ngcontent-%COMP%]:after{opacity:1}.t-handle[_ngcontent-%COMP%]{position:absolute;top:0;display:flex;inline-size:.75rem;cursor:col-resize;justify-content:center;align-items:center;block-size:100%}.t-handle[_ngcontent-%COMP%]:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:"";inline-size:50%;block-size:33%;box-sizing:border-box;border-radius:var(--tui-radius-m);background:var(--tui-background-accent-opposite-hover);border:.0625rem solid var(--tui-background-neutral-1-hover);opacity:0}.t-handle-left-side[_ngcontent-%COMP%]{left:0}.t-handle-bottom-side[_ngcontent-%COMP%]{top:unset;bottom:.3125rem;block-size:.95rem;inline-size:100%}.t-handle-right-side[_ngcontent-%COMP%]{right:0}'],changeDetection:0});let t=e;return t})();var uM=ft.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,renderHTML:({backgroundColor:t})=>t?{style:`background-color: ${t}`}:{},parseHTML:({style:t})=>t.backgroundColor.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands(){return{setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).run()}}});var lM=X.create({name:"details",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{opened:{default:!0,keepOnSplit:!1,parseHTML:t=>t.getAttribute("data-opened")==="true",renderHTML:t=>({"data-opened":t.opened})}}},content:"summary detailsContent",group:"block",draggable:!0,allowGapCursor:!0,isolating:!0,parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:t}){return["div",{class:"t-details-wrapper t-details-wrapper_rendered"},["details",ee(this.options.HTMLAttributes,t),0],["button",{class:"t-details-arrow"}]]},addNodeView(){return({node:t,getPos:e})=>{if(globalThis.document){let i=document.createElement("div"),n=document.createElement("details"),r=document.createElement("button"),o=document.createElement("button");i.className="t-details-wrapper",r.className="t-details-arrow",r.type="button",o.className="t-details-delete",o.type="button",n.open=t.attrs.opened;let s=a=>{var l;let u=(e==null?void 0:e())??0;n.open=!n.open,t.attrs.opened=n.open,(l=a.target)==null||l.dispatchEvent(new CustomEvent(Lo,{bubbles:!0})),this.editor.chain().focus().setTextSelection(u).run()};return r.addEventListener("click",s),o.addEventListener("click",a=>{r.removeEventListener("click",s);let u=(e==null?void 0:e())??0;this.editor.chain().focus().setTextSelection(e==null?void 0:e()).run();let l=this.editor.state.selection.$anchor.nodeAfter,c=u+((l==null?void 0:l.nodeSize)??0);this.editor.isActive("summary")?this.editor.commands.deleteNode(this.type):this.editor.commands.deleteRange({from:u,to:c}),a.preventDefault()},{capture:!0,once:!0}),i.append(n,r,o),{dom:i,contentDOM:n}}}},addCommands(){return{setDetails:()=>({commands:t,editor:e,state:i})=>{var o,s;let n="",r=this.editor.state.selection.$anchor.pos;return globalThis.document&&(n=(((s=(o=document.defaultView)==null?void 0:o.window.getSelection())==null?void 0:s.toString().trim().length)??0)>0?Fp(i):"",setTimeout(()=>e.chain().focus().setTextSelection(r).run())),t.insertContent(`

          ${n}

          `)},removeDetails:()=>({editor:t,state:e,dispatch:i})=>(Pp(e,i,this.name),t.commands.focus("end"))}}}),cM=X.create({name:"detailsContent",content:"block+",group:"block",allowGapCursor:!0,parseHTML(){return[{tag:'div[data-type="details-content"]'}]},renderHTML({HTMLAttributes:t}){return["div",ee(this.options.HTMLAttributes,t,{"data-type":"details-content"}),0]}}),dM=X.create({name:"summary",addOptions(){return{HTMLAttributes:{}}},content:"paragraph",group:"block",parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:t}){return["summary",ee(this.options.HTMLAttributes,t),0]}});var fM=ft.create({name:"fileLink",addCommands(){return{setFileLink:t=>({state:e,chain:i})=>{let{selection:n}=e,r=Math.abs(n.to-n.from),o=' ';return(r>0?i().toggleMark("link",{href:t.link},{extendEmptyMarkRange:!0}).setTextSelection(n.to).insertContent(o):i().insertContent(`${t.name}${o}`)).setTextSelection(n.to).run()}}}});var pM=ft.create({name:"fontColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontColor:{default:null,renderHTML:({fontColor:t})=>t?{style:`color: ${t}`}:{},parseHTML:({style:t})=>t.color.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands(){return{setFontColor:t=>({chain:e})=>e().setMark("textStyle",{fontColor:t}).run(),unsetFontColor:()=>({chain:t})=>t().setMark("textStyle",{fontColor:null}).run()}}});var hM=ft.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:({style:t})=>t.fontSize,renderHTML:({fontSize:t})=>t?{style:`font-size: ${t}`}:{}}}}]},addCommands(){return{setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});function Aj(t){return t.isActive("bulletList")||t.isActive("orderedList")||t.isActive("taskList")}var mM=ft.create({name:"indent",addKeyboardShortcuts(){return{Tab:()=>Aj(this.editor)?!1:this.editor.commands.insertContent(" ")}}});var gM=Zt.create({name:"jumpAnchor",priority:1e3,keepOnSplit:!1,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},parseHTML(){return[{tag:'a[data-type="jump-anchor"]'}]},renderHTML({HTMLAttributes:t}){return["a",ee({"data-type":"jump-anchor"},t),0]},addCommands(){return{setAnchor:t=>({chain:e,state:i,editor:n})=>{let{from:r,to:o}=Ya(n),a=Rp(i,o)===" ",u=e().setTextSelection({from:r,to:o}).extendMarkRange("jumpAnchor").setMark("jumpAnchor",{id:t});return(a?u.setTextSelection(o-1):u.setTextSelection(o).insertContent(pp).setTextSelection(o-1)).run()},removeAnchor:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).run()}}});var kj="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Oj="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",iu=(t,e)=>{for(let i in e)t[i]=e[i];return t},pb="numeric",hb="ascii",mb="alpha",Hl="asciinumeric",Ll="alphanumeric",gb="domain",EM="emoji",Nj="scheme",Pj="slashscheme",ab="whitespace";function Fj(t,e){return t in e||(e[t]=[]),e[t]}function ks(t,e,i){e[pb]&&(e[Hl]=!0,e[Ll]=!0),e[hb]&&(e[Hl]=!0,e[mb]=!0),e[Hl]&&(e[Ll]=!0),e[mb]&&(e[Ll]=!0),e[Ll]&&(e[gb]=!0),e[EM]&&(e[gb]=!0);for(let n in e){let r=Fj(n,i);r.indexOf(t)<0&&r.push(t)}}function Rj(t,e){let i={};for(let n in e)e[n].indexOf(t)>=0&&(i[n]=!0);return i}function Yn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Yn.groups={};Yn.prototype={accepts(){return!!this.t},go(t){let e=this,i=e.j[t];if(i)return i;for(let n=0;nt.ta(e,i,n,r),Lt=(t,e,i,n,r)=>t.tr(e,i,n,r),yM=(t,e,i,n,r)=>t.ts(e,i,n,r),L=(t,e,i,n,r)=>t.tt(e,i,n,r),so="WORD",yb="UWORD",wM="ASCIINUMERICAL",TM="ALPHANUMERICAL",$l="LOCALHOST",vb="TLD",bb="UTLD",Zp="SCHEME",nu="SLASH_SCHEME",Cb="NUM",_b="WS",Db="NL",Bl="OPENBRACE",Vl="CLOSEBRACE",Kp="OPENBRACKET",Yp="CLOSEBRACKET",Qp="OPENPAREN",Xp="CLOSEPAREN",Jp="OPENANGLEBRACKET",eh="CLOSEANGLEBRACKET",th="FULLWIDTHLEFTPAREN",nh="FULLWIDTHRIGHTPAREN",ih="LEFTCORNERBRACKET",rh="RIGHTCORNERBRACKET",oh="LEFTWHITECORNERBRACKET",sh="RIGHTWHITECORNERBRACKET",ah="FULLWIDTHLESSTHAN",uh="FULLWIDTHGREATERTHAN",lh="AMPERSAND",Eb="APOSTROPHE",ch="ASTERISK",jo="AT",dh="BACKSLASH",fh="BACKTICK",ph="CARET",Uo="COLON",wb="COMMA",hh="DOLLAR",wr="DOT",mh="EQUALS",Tb="EXCLAMATION",Ai="HYPHEN",zl="PERCENT",gh="PIPE",yh="PLUS",vh="POUND",jl="QUERY",xb="QUOTE",xM="FULLWIDTHMIDDLEDOT",Ib="SEMI",Tr="SLASH",Ul="TILDE",bh="UNDERSCORE",IM="EMOJI",_h="SYM",SM=Object.freeze({__proto__:null,WORD:so,UWORD:yb,ASCIINUMERICAL:wM,ALPHANUMERICAL:TM,LOCALHOST:$l,TLD:vb,UTLD:bb,SCHEME:Zp,SLASH_SCHEME:nu,NUM:Cb,WS:_b,NL:Db,OPENBRACE:Bl,CLOSEBRACE:Vl,OPENBRACKET:Kp,CLOSEBRACKET:Yp,OPENPAREN:Qp,CLOSEPAREN:Xp,OPENANGLEBRACKET:Jp,CLOSEANGLEBRACKET:eh,FULLWIDTHLEFTPAREN:th,FULLWIDTHRIGHTPAREN:nh,LEFTCORNERBRACKET:ih,RIGHTCORNERBRACKET:rh,LEFTWHITECORNERBRACKET:oh,RIGHTWHITECORNERBRACKET:sh,FULLWIDTHLESSTHAN:ah,FULLWIDTHGREATERTHAN:uh,AMPERSAND:lh,APOSTROPHE:Eb,ASTERISK:ch,AT:jo,BACKSLASH:dh,BACKTICK:fh,CARET:ph,COLON:Uo,COMMA:wb,DOLLAR:hh,DOT:wr,EQUALS:mh,EXCLAMATION:Tb,HYPHEN:Ai,PERCENT:zl,PIPE:gh,PLUS:yh,POUND:vh,QUERY:jl,QUOTE:xb,FULLWIDTHMIDDLEDOT:xM,SEMI:Ib,SLASH:Tr,TILDE:Ul,UNDERSCORE:bh,EMOJI:IM,SYM:_h}),ro=/[a-z]/,Rl=new RegExp("\\p{L}","u"),ub=new RegExp("\\p{Emoji}","u");var oo=/\d/,lb=/\s/;var vM="\r",cb=` +`,Lj="\uFE0F",Hj="\u200D",db="\uFFFC",Gp=null,Wp=null;function Bj(t=[]){let e={};Yn.groups=e;let i=new Yn;Gp==null&&(Gp=bM(kj)),Wp==null&&(Wp=bM(Oj)),L(i,"'",Eb),L(i,"{",Bl),L(i,"}",Vl),L(i,"[",Kp),L(i,"]",Yp),L(i,"(",Qp),L(i,")",Xp),L(i,"<",Jp),L(i,">",eh),L(i,"\uFF08",th),L(i,"\uFF09",nh),L(i,"\u300C",ih),L(i,"\u300D",rh),L(i,"\u300E",oh),L(i,"\u300F",sh),L(i,"\uFF1C",ah),L(i,"\uFF1E",uh),L(i,"&",lh),L(i,"*",ch),L(i,"@",jo),L(i,"`",fh),L(i,"^",ph),L(i,":",Uo),L(i,",",wb),L(i,"$",hh),L(i,".",wr),L(i,"=",mh),L(i,"!",Tb),L(i,"-",Ai),L(i,"%",zl),L(i,"|",gh),L(i,"+",yh),L(i,"#",vh),L(i,"?",jl),L(i,'"',xb),L(i,"/",Tr),L(i,";",Ib),L(i,"~",Ul),L(i,"_",bh),L(i,"\\",dh),L(i,"\u30FB",xM);let n=Lt(i,oo,Cb,{[pb]:!0});Lt(n,oo,n);let r=Lt(n,ro,wM,{[Hl]:!0}),o=Lt(n,Rl,TM,{[Ll]:!0}),s=Lt(i,ro,so,{[hb]:!0});Lt(s,oo,r),Lt(s,ro,s),Lt(r,oo,r),Lt(r,ro,r);let a=Lt(i,Rl,yb,{[mb]:!0});Lt(a,ro),Lt(a,oo,o),Lt(a,Rl,a),Lt(o,oo,o),Lt(o,ro),Lt(o,Rl,o);let u=L(i,cb,Db,{[ab]:!0}),l=L(i,vM,_b,{[ab]:!0}),c=Lt(i,lb,_b,{[ab]:!0});L(i,db,c),L(l,cb,u),L(l,db,c),Lt(l,lb,c),L(c,vM),L(c,cb),Lt(c,lb,c),L(c,db,c);let f=Lt(i,ub,IM,{[EM]:!0});L(f,"#"),Lt(f,ub,f),L(f,Lj,f);let p=L(f,Hj);L(p,"#"),Lt(p,ub,f);let m=[[ro,s],[oo,r]],g=[[ro,null],[Rl,a],[oo,o]];for(let y=0;yy[0]>b[0]?1:-1);for(let y=0;y=0?I[gb]=!0:ro.test(b)?oo.test(b)?I[Hl]=!0:I[hb]=!0:I[pb]=!0,yM(i,b,b,I)}return yM(i,"localhost",$l,{ascii:!0}),i.jd=new Yn(_h),{start:i,tokens:iu({groups:e},SM)}}function MM(t,e){let i=Vj(e.replace(/[A-Z]/g,a=>a.toLowerCase())),n=i.length,r=[],o=0,s=0;for(;s=0&&(f+=i[s].length,p++),l+=i[s].length,o+=i[s].length,s++;o-=f,s-=p,l-=f,r.push({t:c.t,v:e.slice(o-l,o),s:o-l,e:o})}return r}function Vj(t){let e=[],i=t.length,n=0;for(;n56319||n+1===i||(o=t.charCodeAt(n+1))<56320||o>57343?t[n]:t.slice(n,n+2);e.push(s),n+=s.length}return e}function zo(t,e,i,n,r){let o,s=e.length;for(let a=0;a=0;)o++;if(o>0){e.push(i.join(""));for(let s=parseInt(t.substring(n,n+o),10);s>0;s--)i.pop();n+=o}else i.push(t[n]),n++}return e}var Gl={defaultProtocol:"http",events:null,format:_M,formatHref:_M,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Sb(t,e=null){let i=iu({},Gl);t&&(i=iu(i,t instanceof Sb?t.o:t));let n=i.ignoreTags,r=[];for(let o=0;oi?n.substring(0,i)+"\u2026":n},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Gl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,i=this.toHref(t.get("defaultProtocol")),n=t.get("formatHref",i,this),r=t.get("tagName",i,e),o=this.toFormattedString(t),s={},a=t.get("className",i,e),u=t.get("target",i,e),l=t.get("rel",i,e),c=t.getObj("attributes",i,e),f=t.getObj("events",i,e);return s.href=n,a&&(s.class=a),u&&(s.target=u),l&&(s.rel=l),c&&iu(s,c),{tagName:r,attributes:s,content:o,eventListeners:f}}};function Ch(t,e){class i extends AM{constructor(r,o){super(r,o),this.t=t}}for(let n in e)i.prototype[n]=e[n];return i.t=t,i}var CM=Ch("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),DM=Ch("text"),zj=Ch("nl"),qp=Ch("url",{isLink:!0,toHref(t=Gl.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==$l&&t[1].t===Uo}});var Mi=t=>new Yn(t);function jj({groups:t}){let e=t.domain.concat([lh,ch,jo,dh,fh,ph,hh,mh,Ai,Cb,zl,gh,yh,vh,Tr,_h,Ul,bh]),i=[Uo,wb,wr,Tb,zl,jl,xb,Ib,Jp,eh,Bl,Vl,Yp,Kp,Qp,Xp,th,nh,ih,rh,oh,sh,ah,uh],n=[lh,Eb,ch,dh,fh,ph,hh,mh,Ai,Bl,Vl,zl,gh,yh,vh,jl,Tr,_h,Ul,bh],r=Mi(),o=L(r,Ul);Ne(o,n,o),Ne(o,t.domain,o);let s=Mi(),a=Mi(),u=Mi();Ne(r,t.domain,s),Ne(r,t.scheme,a),Ne(r,t.slashscheme,u),Ne(s,n,o),Ne(s,t.domain,s);let l=L(s,jo);L(o,jo,l),L(a,jo,l),L(u,jo,l);let c=L(o,wr);Ne(c,n,o),Ne(c,t.domain,o);let f=Mi();Ne(l,t.domain,f),Ne(f,t.domain,f);let p=L(f,wr);Ne(p,t.domain,f);let m=Mi(CM);Ne(p,t.tld,m),Ne(p,t.utld,m),L(l,$l,m);let g=L(f,Ai);L(g,Ai,g),Ne(g,t.domain,f),Ne(m,t.domain,f),L(m,wr,p),L(m,Ai,g);let y=L(m,Uo);Ne(y,t.numeric,CM);let b=L(s,Ai),D=L(s,wr);L(b,Ai,b),Ne(b,t.domain,s),Ne(D,n,o),Ne(D,t.domain,s);let I=Mi(qp);Ne(D,t.tld,I),Ne(D,t.utld,I),Ne(I,t.domain,s),Ne(I,n,o),L(I,wr,D),L(I,Ai,b),L(I,jo,l);let N=L(I,Uo),A=Mi(qp);Ne(N,t.numeric,A);let V=Mi(qp),z=Mi();Ne(V,e,V),Ne(V,i,z),Ne(z,e,V),Ne(z,i,z),L(I,Tr,V),L(A,Tr,V);let ae=L(a,Uo),Pe=L(u,Uo),mt=L(Pe,Tr),At=L(mt,Tr);Ne(a,t.domain,s),L(a,wr,D),L(a,Ai,b),Ne(u,t.domain,s),L(u,wr,D),L(u,Ai,b),Ne(ae,t.domain,V),L(ae,Tr,V),L(ae,jl,V),Ne(At,t.domain,V),Ne(At,e,V),L(At,Tr,V);let Oi=[[Bl,Vl],[Kp,Yp],[Qp,Xp],[Jp,eh],[th,nh],[ih,rh],[oh,sh],[ah,uh]];for(let Ni=0;Ni=0&&p++,r++,c++;if(p<0)r-=c,r0&&(o.push(fb(DM,e,s)),s=[]),r-=p,c-=p;let m=f.t,g=i.slice(r-c,r);o.push(fb(m,e,g))}}return s.length>0&&o.push(fb(DM,e,s)),o}function fb(t,e,i){let n=i[0].s,r=i[i.length-1].e,o=e.slice(n,r);return new t(o,i)}var $j=typeof console<"u"&&console&&console.warn||(()=>{}),Gj="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",xt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function kM(){return Yn.groups={},xt.scanner=null,xt.parser=null,xt.tokenQueue=[],xt.pluginQueue=[],xt.customSchemes=[],xt.initialized=!1,xt}function Mb(t,e=!1){if(xt.initialized&&$j(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Gj}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" -3. "-" cannot repeat`);xt.customSchemes.push([t,e])}function Wj(){xt.scanner=Bj(xt.customSchemes);for(let t=0;t{let r=e.some(l=>l.docChanged)&&!i.doc.eq(n.doc),o=e.some(l=>l.getMeta("preventAutolink"));if(!r||o)return;let{tr:s}=n,a=b1(i.doc,[...e]);if(E1(a).forEach(({newRange:l})=>{let c=_1(n.doc,l,m=>m.isTextblock),f,p;if(c.length>1?(f=c[0],p=n.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):c.length&&n.doc.textBetween(l.from,l.to," "," ").endsWith(" ")&&(f=c[0],p=n.doc.textBetween(f.pos,l.to,void 0," ")),f&&p){let m=p.split(" ").filter(D=>D!=="");if(m.length<=0)return!1;let g=m[m.length-1],y=f.pos+p.lastIndexOf(g);if(!g)return!1;let b=Ch(g).map(D=>D.toObject(t.defaultProtocol));if(!qj(b))return!1;b.filter(D=>D.isLink).map(D=>U(M({},D),{from:y+D.start+1,to:y+D.end+1})).filter(D=>n.schema.marks.code?!n.doc.rangeHasMark(D.from,D.to,n.schema.marks.code):!0).filter(D=>t.validate(D.value)).filter(D=>t.shouldAutoLink(D.value)).forEach(D=>{w1(D.from,D.to,n.doc).some(I=>I.mark.type===t.type)||s.addMark(D.from,D.to,t.type.create({href:D.href}))})}}),!!s.steps.length)return s}})}function Kj(t){return new Rt({key:new qt("handleClickLink"),props:{handleClick:(e,i,n)=>{var r,o;if(n.button!==0||!e.editable)return!1;let s=n.target,a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(p=>p.nodeName==="A"))return!1;let u=D1(e.state,t.type.name),l=n.target,c=(r=l==null?void 0:l.href)!==null&&r!==void 0?r:u.href,f=(o=l==null?void 0:l.target)!==null&&o!==void 0?o:u.target;return l&&c?(window.open(c,f),!0):!1}}})}function Yj(t){return new Rt({key:new qt("handlePasteLink"),props:{handlePaste:(e,i,n)=>{let{state:r}=e,{selection:o}=r,{empty:s}=o;if(s)return!1;let a="";n.content.forEach(l=>{a+=l.textContent});let u=Wl(a,{defaultProtocol:t.defaultProtocol}).find(l=>l.isLink&&l.value===a);return!a||!u?!1:(t.editor.commands.setMark(t.type,{href:u.href}),!0)}}})}var Qj=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function ql(t,e){let i=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{let r=typeof n=="string"?n:n.scheme;r&&i.push(r)}),!t||t.replace(Qj,"").match(new RegExp(`^(?:(?:${i.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var OM=Zt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Mb(t);return}Mb(t.scheme,t.optionalSlashes)})},onDestroy(){kM()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!ql(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:i=>!!ql(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!ql(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ee(this.options.HTMLAttributes,t),0]:["a",ee(this.options.HTMLAttributes,U(M({},t),{href:""})),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Vn({find:t=>{let e=[];if(t){let{protocols:i,defaultProtocol:n}=this.options,r=Wl(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!ql(s,i),protocols:i,defaultProtocol:n}));r.length&&r.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:i}=this.options;return this.options.autolink&&t.push(Zj({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:r=>!!ql(r,e),protocols:e,defaultProtocol:i}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Kj({type:this.type})),this.options.linkOnPaste&&t.push(Yj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});var NM=OM.extend({addAttributes(){var t;return M(M({},(t=this.parent)==null?void 0:t.call(this)),Qa(["download"]))},addCommands(){var t;return U(M({},(t=this.parent)==null?void 0:t.call(this)),{toggleLink:e=>({chain:i,state:n,editor:r})=>{{let{from:o,to:s}=Ya(r),u=Fp(n,s)===" ",l=i().setTextSelection({from:o,to:s}).toggleMark(this.name,e,{extendEmptyMarkRange:!0});return(u?l.setTextSelection(s-1):l.setTextSelection(s).insertContent(fp).setTextSelection(s-1)).run()}}})},addKeyboardShortcuts(){return{"Mod-k":({editor:t})=>{let e=this.editor.isActive("link"),i=t.chain().focus();return(e?i.unsetLink():i.toggleLink({href:""})).run()}}},addPasteRules(){return[Vn({find:t=>Wl(t).filter(e=>{var i,n;return((n=(i=this.options).validate)==null?void 0:n.call(i,e.value))??!0}).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]}}).configure({openOnClick:!1});var PM=ft.create({name:"customEnter",addKeyboardShortcuts(){return{Enter:({editor:t})=>{var e,i,n,r;return t.isActive("summary")?(t.commands.selectNodeForward(),t==null||t.commands.focus(((t==null?void 0:t.state.selection.anchor)??0)+1),globalThis.document&&((r=(n=(i=(e=t.view.nodeDOM(t.state.selection.anchor))==null?void 0:e.parentElement)==null?void 0:i.closest("details"))==null?void 0:n.querySelector('[data-type="details-content"]'))==null||r.prepend(document.createElement("p"))),!1):this.editor.chain().createParagraphNear().run()}}}});var FM=X.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{let{selection:i}=e,{$from:n,$to:r}=i,o=t();return n.parentOffset===0?o.insertContentAt({from:Math.max(n.pos-1,0),to:r.pos},{type:this.name}):ac(i)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var u;if(a){let{$to:l}=s.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?s.setSelection(Dt.create(s.doc,l.pos+1)):l.nodeAfter.isBlock?s.setSelection(Nr.create(s.doc,l.pos)):s.setSelection(Dt.create(s.doc,l.pos));else{let f=(u=l.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();f&&(s.insert(c,f),s.setSelection(Dt.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[uc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var RM=FM.extend({addCommands(){return{setHorizontalRule:()=>({chain:t,state:e,editor:i})=>{let{selection:n}=e,{$from:r,$to:o}=n,s=t();return i.isActive("summary")?!1:(r.parentOffset===0?(s.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},"

          "),s.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name})):ac(n)?s.insertContentAt(o.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:a,dispatch:u})=>{var l;if(u){let{$to:c}=a.selection,f=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?a.setSelection(Dt.create(a.doc,c.pos+1)):c.nodeAfter.isBlock?a.setSelection(Nr.create(a.doc,c.pos)):a.setSelection(Dt.create(a.doc,c.pos));else{let p=(l=c.parent.type.contentMatch.defaultType)==null?void 0:l.create();p&&(a.insert(f,p),a.setSelection(Dt.create(a.doc,f+1)))}a.scrollIntoView()}return!0}).run())}}}});var Xj=/^\s*>\s$/,LM=X.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ar({find:Xj,type:this.type})]}});var Jj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,e7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,t7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,n7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,HM=Zt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",ee(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[sr({find:Jj,type:this.type}),sr({find:t7,type:this.type})]},addPasteRules(){return[Vn({find:e7,type:this.type}),Vn({find:n7,type:this.type})]}});var i7="listItem",BM="textStyle",VM=/^\s*([-+*])\s$/,zM=X.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i7,this.editor.getAttributes(BM)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ar({find:VM,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ar({find:VM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(BM),editor:this.editor})),[t]}});var r7=new RegExp("(?({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[sr({find:r7,type:this.type})]},addPasteRules(){return[Vn({find:o7,type:this.type})]}});var s7=/^```([a-z]+)?[\s\n]$/,a7=/^~~~([a-z]+)?[\s\n]$/,UM=X.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:i}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(i)).map(s=>s.replace(i,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ee(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,i=e.pos===1;return!t||e.parent.type.name!==this.name?!1:i||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:i}=e,{$from:n,empty:r}=i;if(!r||n.parent.type!==this.type)return!1;let o=n.parentOffset===n.parent.nodeSize-2,s=n.parent.textContent.endsWith(` +3. "-" cannot repeat`);xt.customSchemes.push([t,e])}function Wj(){xt.scanner=Bj(xt.customSchemes);for(let t=0;t{let r=e.some(l=>l.docChanged)&&!i.doc.eq(n.doc),o=e.some(l=>l.getMeta("preventAutolink"));if(!r||o)return;let{tr:s}=n,a=b1(i.doc,[...e]);if(E1(a).forEach(({newRange:l})=>{let c=_1(n.doc,l,m=>m.isTextblock),f,p;if(c.length>1?(f=c[0],p=n.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):c.length&&n.doc.textBetween(l.from,l.to," "," ").endsWith(" ")&&(f=c[0],p=n.doc.textBetween(f.pos,l.to,void 0," ")),f&&p){let m=p.split(" ").filter(D=>D!=="");if(m.length<=0)return!1;let g=m[m.length-1],y=f.pos+p.lastIndexOf(g);if(!g)return!1;let b=Dh(g).map(D=>D.toObject(t.defaultProtocol));if(!qj(b))return!1;b.filter(D=>D.isLink).map(D=>U(M({},D),{from:y+D.start+1,to:y+D.end+1})).filter(D=>n.schema.marks.code?!n.doc.rangeHasMark(D.from,D.to,n.schema.marks.code):!0).filter(D=>t.validate(D.value)).filter(D=>t.shouldAutoLink(D.value)).forEach(D=>{w1(D.from,D.to,n.doc).some(I=>I.mark.type===t.type)||s.addMark(D.from,D.to,t.type.create({href:D.href}))})}}),!!s.steps.length)return s}})}function Kj(t){return new Rt({key:new qt("handleClickLink"),props:{handleClick:(e,i,n)=>{var r,o;if(n.button!==0||!e.editable)return!1;let s=n.target,a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(p=>p.nodeName==="A"))return!1;let u=D1(e.state,t.type.name),l=n.target,c=(r=l==null?void 0:l.href)!==null&&r!==void 0?r:u.href,f=(o=l==null?void 0:l.target)!==null&&o!==void 0?o:u.target;return l&&c?(window.open(c,f),!0):!1}}})}function Yj(t){return new Rt({key:new qt("handlePasteLink"),props:{handlePaste:(e,i,n)=>{let{state:r}=e,{selection:o}=r,{empty:s}=o;if(s)return!1;let a="";n.content.forEach(l=>{a+=l.textContent});let u=Wl(a,{defaultProtocol:t.defaultProtocol}).find(l=>l.isLink&&l.value===a);return!a||!u?!1:(t.editor.commands.setMark(t.type,{href:u.href}),!0)}}})}var Qj=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function ql(t,e){let i=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(n=>{let r=typeof n=="string"?n:n.scheme;r&&i.push(r)}),!t||t.replace(Qj,"").match(new RegExp(`^(?:(?:${i.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var OM=Zt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){Mb(t);return}Mb(t.scheme,t.optionalSlashes)})},onDestroy(){kM()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!ql(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>!!t}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:i=>!!ql(i,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!ql(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ee(this.options.HTMLAttributes,t),0]:["a",ee(this.options.HTMLAttributes,U(M({},t),{href:""})),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Vn({find:t=>{let e=[];if(t){let{protocols:i,defaultProtocol:n}=this.options,r=Wl(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:s=>!!ql(s,i),protocols:i,defaultProtocol:n}));r.length&&r.forEach(o=>e.push({text:o.value,data:{href:o.href},index:o.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:i}=this.options;return this.options.autolink&&t.push(Zj({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:n=>this.options.isAllowedUri(n,{defaultValidate:r=>!!ql(r,e),protocols:e,defaultProtocol:i}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Kj({type:this.type})),this.options.linkOnPaste&&t.push(Yj({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}});var NM=OM.extend({addAttributes(){var t;return M(M({},(t=this.parent)==null?void 0:t.call(this)),Qa(["download"]))},addCommands(){var t;return U(M({},(t=this.parent)==null?void 0:t.call(this)),{toggleLink:e=>({chain:i,state:n,editor:r})=>{{let{from:o,to:s}=Ya(r),u=Rp(n,s)===" ",l=i().setTextSelection({from:o,to:s}).toggleMark(this.name,e,{extendEmptyMarkRange:!0});return(u?l.setTextSelection(s-1):l.setTextSelection(s).insertContent(pp).setTextSelection(s-1)).run()}}})},addKeyboardShortcuts(){return{"Mod-k":({editor:t})=>{let e=this.editor.isActive("link"),i=t.chain().focus();return(e?i.unsetLink():i.toggleLink({href:""})).run()}}},addPasteRules(){return[Vn({find:t=>Wl(t).filter(e=>{var i,n;return((n=(i=this.options).validate)==null?void 0:n.call(i,e.value))??!0}).filter(e=>e.isLink).map(e=>({text:e.value,index:e.start,data:e})),type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]}}).configure({openOnClick:!1});var PM=ft.create({name:"customEnter",addKeyboardShortcuts(){return{Enter:({editor:t})=>{var e,i,n,r;return t.isActive("summary")?(t.commands.selectNodeForward(),t==null||t.commands.focus(((t==null?void 0:t.state.selection.anchor)??0)+1),globalThis.document&&((r=(n=(i=(e=t.view.nodeDOM(t.state.selection.anchor))==null?void 0:e.parentElement)==null?void 0:i.closest("details"))==null?void 0:n.querySelector('[data-type="details-content"]'))==null||r.prepend(document.createElement("p"))),!1):this.editor.chain().createParagraphNear().run()}}}});var FM=X.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{let{selection:i}=e,{$from:n,$to:r}=i,o=t();return n.parentOffset===0?o.insertContentAt({from:Math.max(n.pos-1,0),to:r.pos},{type:this.name}):ac(i)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var u;if(a){let{$to:l}=s.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?s.setSelection(Dt.create(s.doc,l.pos+1)):l.nodeAfter.isBlock?s.setSelection(Nr.create(s.doc,l.pos)):s.setSelection(Dt.create(s.doc,l.pos));else{let f=(u=l.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();f&&(s.insert(c,f),s.setSelection(Dt.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[uc({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var RM=FM.extend({addCommands(){return{setHorizontalRule:()=>({chain:t,state:e,editor:i})=>{let{selection:n}=e,{$from:r,$to:o}=n,s=t();return i.isActive("summary")?!1:(r.parentOffset===0?(s.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},"

          "),s.insertContentAt({from:Math.max(r.pos-1,0),to:o.pos},{type:this.name})):ac(n)?s.insertContentAt(o.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:a,dispatch:u})=>{var l;if(u){let{$to:c}=a.selection,f=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?a.setSelection(Dt.create(a.doc,c.pos+1)):c.nodeAfter.isBlock?a.setSelection(Nr.create(a.doc,c.pos)):a.setSelection(Dt.create(a.doc,c.pos));else{let p=(l=c.parent.type.contentMatch.defaultType)==null?void 0:l.create();p&&(a.insert(f,p),a.setSelection(Dt.create(a.doc,f+1)))}a.scrollIntoView()}return!0}).run())}}}});var Xj=/^\s*>\s$/,LM=X.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ar({find:Xj,type:this.type})]}});var Jj=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,e7=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,t7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,n7=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,HM=Zt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",ee(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[sr({find:Jj,type:this.type}),sr({find:t7,type:this.type})]},addPasteRules(){return[Vn({find:e7,type:this.type}),Vn({find:n7,type:this.type})]}});var i7="listItem",BM="textStyle",VM=/^\s*([-+*])\s$/,zM=X.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i7,this.editor.getAttributes(BM)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=ar({find:VM,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ar({find:VM,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(BM),editor:this.editor})),[t]}});var r7=new RegExp("(?({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[sr({find:r7,type:this.type})]},addPasteRules(){return[Vn({find:o7,type:this.type})]}});var s7=/^```([a-z]+)?[\s\n]$/,a7=/^~~~([a-z]+)?[\s\n]$/,UM=X.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:i}=this.options,o=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(s=>s.startsWith(i)).map(s=>s.replace(i,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ee(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,i=e.pos===1;return!t||e.parent.type.name!==this.name?!1:i||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:i}=e,{$from:n,empty:r}=i;if(!r||n.parent.type!==this.type)return!1;let o=n.parentOffset===n.parent.nodeSize-2,s=n.parent.textContent.endsWith(` `);return!o||!s?!1:t.chain().command(({tr:a})=>(a.delete(n.pos-2,n.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:i,doc:n}=e,{$from:r,empty:o}=i;if(!o||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;let a=r.after();return a===void 0?!1:n.nodeAt(a)?t.commands.command(({tr:l})=>(l.setSelection(nn.near(n.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[pu({find:s7,type:this.type,getAttributes:t=>({language:t[1]})}),pu({find:a7,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Rt({key:new qt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let i=e.clipboardData.getData("text/plain"),n=e.clipboardData.getData("vscode-editor-data"),r=n?JSON.parse(n):void 0,o=r==null?void 0:r.mode;if(!i||!o)return!1;let{tr:s,schema:a}=t.state,u=a.text(i.replace(/\r\n?/g,` -`));return s.replaceSelectionWith(this.type.create({language:o},u)),s.selection.$from.parent.type!==this.type&&s.setSelection(Dt.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});var $M=X.create({name:"doc",topNode:!0,content:"block+"});function GM(t={}){return new Rt({view(e){return new Ab(e,t)}})}var Ab=class{constructor(e,i){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=i.width)!==null&&n!==void 0?n:1,this.color=i.color===!1?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let o=s=>{this[r](s)};return e.dom.addEventListener(r,o),{name:r,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){this.cursorPos!=null&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,n;if(i){let a=e.nodeBefore,u=e.nodeAfter;if(a||u){let l=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(l){let c=l.getBoundingClientRect(),f=a?c.bottom:c.top;a&&u&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),n={left:c.left,right:c.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!n){let a=this.editorView.coordsAtPos(this.cursorPos);n={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let o,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")o=-pageXOffset,s=-pageYOffset;else{let a=r.getBoundingClientRect();o=a.left-r.scrollLeft,s=a.top-r.scrollTop}this.element.style.left=n.left-o+"px",this.element.style.top=n.top-s+"px",this.element.style.width=n.right-n.left+"px",this.element.style.height=n.bottom-n.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),r=n&&n.type.spec.disableDropCursor,o=typeof r=="function"?r(this.editorView,i,e):r;if(i&&!o){let s=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=m1(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}};var WM=ft.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[GM(this.options)]}});var Tn=class t extends nn{constructor(e){super(e,e)}map(e,i){let n=e.resolve(i.map(this.head));return t.valid(n)?new t(n):nn.near(n)}content(){return Bn.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(i.pos))}getBookmark(){return new kb(this.anchor)}static valid(e){let i=e.parent;if(i.isTextblock||!u7(e)||!l7(e))return!1;let n=i.type.spec.allowGapCursor;if(n!=null)return n;let r=i.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,i,n=!1){e:for(;;){if(!n&&t.valid(e))return e;let r=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(i>0?e.indexAfter(s)0){o=a.child(i>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=i;let u=e.doc.resolve(r);if(t.valid(u))return u}for(;;){let s=i>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Nr.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*i),n=!1;continue e}break}o=s,r+=i;let a=e.doc.resolve(r);if(t.valid(a))return a}return null}}};Tn.prototype.visible=!1;Tn.findFrom=Tn.findGapCursorFrom;nn.jsonID("gapcursor",Tn);var kb=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return Tn.valid(i)?new Tn(i):nn.near(i)}};function u7(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),n=t.node(e);if(i==0){if(n.type.spec.isolating)return!0;continue}for(let r=n.child(i-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function l7(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),n=t.node(e);if(i==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let r=n.child(i);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function qM(){return new Rt({props:{decorations:p7,createSelectionBetween(t,e,i){return e.pos==i.pos&&Tn.valid(i)?new Tn(i):null},handleClick:d7,handleKeyDown:c7,handleDOMEvents:{beforeinput:f7}}})}var c7=rc({ArrowLeft:Dh("horiz",-1),ArrowRight:Dh("horiz",1),ArrowUp:Dh("vert",-1),ArrowDown:Dh("vert",1)});function Dh(t,e){let i=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,r,o){let s=n.selection,a=e>0?s.$to:s.$from,u=s.empty;if(s instanceof Dt){if(!o.endOfTextblock(i)||a.depth==0)return!1;u=!1,a=n.doc.resolve(e>0?a.after():a.before())}let l=Tn.findGapCursorFrom(a,e,u);return l?(r&&r(n.tr.setSelection(new Tn(l))),!0):!1}}function d7(t,e,i){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!Tn.valid(n))return!1;let r=t.posAtCoords({left:i.clientX,top:i.clientY});return r&&r.inside>-1&&Nr.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Tn(n))),!0)}function f7(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Tn))return!1;let{$from:i}=t.state.selection,n=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let r=Bt.empty;for(let s=n.length-1;s>=0;s--)r=Bt.from(n[s].createAndFill(null,r));let o=t.state.tr.replace(i.pos,i.pos,new Bn(r,0,0));return o.setSelection(Dt.near(o.doc.resolve(i.pos+1))),t.dispatch(o),!1}function p7(t){if(!(t.selection instanceof Tn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Fr.create(t.doc,[Pr.widget(t.selection.head,e,{key:"gapcursor"})])}var ZM=ft.create({name:"gapCursor",addProseMirrorPlugins(){return[qM()]},extendNodeSchema(t){var e;let i={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=sc(oc(t,"allowGapCursor",i)))!==null&&e!==void 0?e:null}}});var KM=X.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ee(this.options.HTMLAttributes,t)]},renderText(){return` -`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:i,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:r,storedMarks:o}=i;if(r.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:a}=n.extensionManager,u=o||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:c})=>{if(c&&u&&s){let f=u.filter(p=>a.includes(p.type.name));l.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var YM=X.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ee(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>U(M({},t),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>pu({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Eh=200,pn=function(){};pn.prototype.append=function(e){return e.length?(e=pn.from(e),!this.length&&e||e.length=i?pn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,i))};pn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pn.prototype.forEach=function(e,i,n){i===void 0&&(i=0),n===void 0&&(n=this.length),i<=n?this.forEachInner(e,i,n,0):this.forEachInvertedInner(e,i,n,0)};pn.prototype.map=function(e,i,n){i===void 0&&(i=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(o,s){return r.push(e(o,s))},i,n),r};pn.from=function(e){return e instanceof pn?e:e&&e.length?new QM(e):pn.empty};var QM=function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,o){return r==0&&o==this.length?this:new e(this.values.slice(r,o))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,o,s,a){for(var u=o;u=s;u--)if(r(this.values[u],a+u)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=Eh)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=Eh)return new e(r.flatten().concat(this.values))},i.length.get=function(){return this.values.length},i.depth.get=function(){return 0},Object.defineProperties(e.prototype,i),e}(pn);pn.empty=new QM([]);var h7=function(t){function e(i,n){t.call(this),this.left=i,this.right=n,this.length=i.length+n.length,this.depth=Math.max(i.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return na&&this.right.forEachInner(n,Math.max(r-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,o,s){var a=this.left.length;if(r>a&&this.right.forEachInvertedInner(n,r-a,Math.max(o,a)-a,s+a)===!1||o=o?this.right.slice(n-o,r-o):this.left.slice(n,o).append(this.right.slice(0,r-o))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(pn),Ob=pn;var m7=500,Ns=class t{constructor(e,i){this.items=e,this.eventCount=i}popEvent(e,i){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let r,o;i&&(r=this.remapping(n,this.items.length),o=r.maps.length);let s=e.tr,a,u,l=[],c=[];return this.items.forEach((f,p)=>{if(!f.step){r||(r=this.remapping(n,p+1),o=r.maps.length),o--,c.push(f);return}if(r){c.push(new xr(f.map));let m=f.step.map(r.slice(o)),g;m&&s.maybeStep(m).doc&&(g=s.mapping.maps[s.mapping.maps.length-1],l.push(new xr(g,void 0,void 0,l.length+c.length))),o--,g&&r.appendMap(g,o)}else s.maybeStep(f.step);if(f.selection)return a=r?f.selection.map(r.slice(o)):f.selection,u=new t(this.items.slice(0,n).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:s,selection:a}}addTransform(e,i,n,r){let o=[],s=this.eventCount,a=this.items,u=!r&&a.length?a.get(a.length-1):null;for(let c=0;cy7&&(a=g7(a,l),s-=l),new t(a.append(o),s)}remapping(e,i){let n=new h1;return this.items.forEach((r,o)=>{let s=r.mirrorOffset!=null&&o-r.mirrorOffset>=e?n.maps.length-r.mirrorOffset:void 0;n.appendMap(r.map,s)},e,i),n}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(i=>new xr(i))),this.eventCount)}rebased(e,i){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-i),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},r);let u=i;this.items.forEach(p=>{let m=o.getMirror(--u);if(m==null)return;s=Math.min(s,m);let g=o.maps[m];if(p.step){let y=e.steps[m].invert(e.docs[m]),b=p.selection&&p.selection.map(o.slice(u+1,m));b&&a++,n.push(new xr(g,y,b))}else n.push(new xr(g))},r);let l=[];for(let p=i;pm7&&(f=f.compress(this.items.length-n.length)),f}emptyItemCount(){let e=0;return this.items.forEach(i=>{i.step||e++}),e}compress(e=this.items.length){let i=this.remapping(0,e),n=i.maps.length,r=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)r.push(s),s.selection&&o++;else if(s.step){let u=s.step.map(i.slice(n)),l=u&&u.getMap();if(n--,l&&i.appendMap(l,n),u){let c=s.selection&&s.selection.map(i.slice(n));c&&o++;let f=new xr(l.invert(),u,c),p,m=r.length-1;(p=r.length&&r[m].merge(f))?r[m]=p:r.push(f)}}else s.map&&n--},this.items.length,0),new t(Ob.from(r.reverse()),o)}};Ns.empty=new Ns(Ob.empty,0);function g7(t,e){let i;return t.forEach((n,r)=>{if(n.selection&&e--==0)return i=r,!1}),t.slice(i)}var xr=class t{constructor(e,i,n,r){this.map=e,this.step=i,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let i=e.step.merge(this.step);if(i)return new t(i.getMap().invert(),i,this.selection)}}},Ir=class{constructor(e,i,n,r,o){this.done=e,this.undone=i,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}},y7=20;function v7(t,e,i,n){let r=i.getMeta(Os),o;if(r)return r.historyState;i.getMeta(C7)&&(t=new Ir(t.done,t.undone,null,0,-1));let s=i.getMeta("appendedTransaction");if(i.steps.length==0)return t;if(s&&s.getMeta(Os))return s.getMeta(Os).redo?new Ir(t.done.addTransform(i,void 0,n,wh(e)),t.undone,XM(i.mapping.maps),t.prevTime,t.prevComposition):new Ir(t.done,t.undone.addTransform(i,void 0,n,wh(e)),null,t.prevTime,t.prevComposition);if(i.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=i.getMeta("composition"),u=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(i.time||0)-n.newGroupDelay||!b7(i,t.prevRanges)),l=s?Nb(t.prevRanges,i.mapping):XM(i.mapping.maps);return new Ir(t.done.addTransform(i,u?e.selection.getBookmark():void 0,n,wh(e)),Ns.empty,l,i.time,a??t.prevComposition)}else return(o=i.getMeta("rebased"))?new Ir(t.done.rebased(i,o),t.undone.rebased(i,o),Nb(t.prevRanges,i.mapping),t.prevTime,t.prevComposition):new Ir(t.done.addMaps(i.mapping.maps),t.undone.addMaps(i.mapping.maps),Nb(t.prevRanges,i.mapping),t.prevTime,t.prevComposition)}function b7(t,e){if(!e)return!1;if(!t.docChanged)return!0;let i=!1;return t.mapping.maps[0].forEach((n,r)=>{for(let o=0;o=e[o]&&(i=!0)}),i}function XM(t){let e=[];for(let i=t.length-1;i>=0&&e.length==0;i--)t[i].forEach((n,r,o,s)=>e.push(o,s));return e}function Nb(t,e){if(!t)return null;let i=[];for(let n=0;n{let r=Os.getState(i);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(n){let o=_7(r,i,t);o&&n(e?o.scrollIntoView():o)}return!0}}var Fb=Th(!1,!0),Rb=Th(!0,!0),y1e=Th(!1,!1),v1e=Th(!0,!1);var tA=ft.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Fb(t,e),redo:()=>({state:t,dispatch:e})=>Rb(t,e)}},addProseMirrorPlugins(){return[eA(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var D7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,E7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,w7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,T7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,nA=Zt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ee(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[sr({find:D7,type:this.type}),sr({find:w7,type:this.type})]},addPasteRules(){return[Vn({find:E7,type:this.type}),Vn({find:T7,type:this.type})]}});var iA=X.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ee(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)}}});var x7="listItem",rA="textStyle",oA=/^(\d+)\.\s$/,sA=X.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let n=t,{start:e}=n,i=ho(n,["start"]);return e===1?["ol",ee(this.options.HTMLAttributes,i),0]:["ol",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(x7,this.editor.getAttributes(rA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ar({find:oA,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ar({find:oA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>M({start:+e[1]},this.editor.getAttributes(rA)),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1],editor:this.editor})),[t]}});var aA=X.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var uA=ft.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Rt({key:new qt("placeholder"),props:{decorations:({doc:t,selection:e})=>{let i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,r=[];if(!i)return null;let o=this.editor.isEmpty;return t.descendants((s,a)=>{let u=n>=a&&n<=a+s.nodeSize,l=!s.isLeaf&&T1(s);if((u||!this.options.showOnlyCurrent)&&l){let c=[this.options.emptyNodeClass];o&&c.push(this.options.emptyEditorClass);let f=Pr.node(a,a+s.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:u}):this.options.placeholder});r.push(f)}return this.options.includeChildren}),Fr.create(t,r)}}})]}});var I7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,S7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lA=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[sr({find:I7,type:this.type})]},addPasteRules(){return[Vn({find:S7,type:this.type})]}});var M7=/^\s*(\[([( |x])?\])\s$/,cA=X.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ee(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?U(M({},t),{Tab:()=>this.editor.commands.sinkListItem(this.name)}):t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:i,editor:n})=>{let r=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),u=document.createElement("div");return o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",l=>l.preventDefault()),a.addEventListener("change",l=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:c}=l.target;n.isEditable&&typeof i=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{let p=i();if(typeof p!="number")return!1;let m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,U(M({},m==null?void 0:m.attrs),{checked:c})),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,c)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([l,c])=>{r.setAttribute(l,c)}),r.dataset.checked=t.attrs.checked,t.attrs.checked&&a.setAttribute("checked","checked"),o.append(a,s),r.append(o,u),Object.entries(e).forEach(([l,c])=>{r.setAttribute(l,c)}),{dom:r,contentDOM:u,update:l=>l.type!==this.type?!1:(r.dataset.checked=l.attrs.checked,l.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[ar({find:M7,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}});var dA=X.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",ee(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});var fA=X.create({name:"text",group:"inline"});var pA=ft.create({name:"starterKit",addExtensions(){let t=[],e=this.options;return(e==null?void 0:e.blockquote)!==!1&&t.push(LM.configure(e==null?void 0:e.blockquote)),(e==null?void 0:e.bold)!==!1&&t.push(HM.configure(e==null?void 0:e.bold)),(e==null?void 0:e.bulletList)!==!1&&t.push(zM.configure(e==null?void 0:e.bulletList)),(e==null?void 0:e.code)!==!1&&t.push(jM.configure(e==null?void 0:e.code)),(e==null?void 0:e.codeBlock)!==!1&&t.push(UM.configure(e==null?void 0:e.codeBlock)),(e==null?void 0:e.document)!==!1&&t.push($M.configure(e==null?void 0:e.document)),(e==null?void 0:e.dropcursor)!==!1&&t.push(WM.configure(e==null?void 0:e.dropcursor)),(e==null?void 0:e.gapcursor)!==!1&&t.push(ZM.configure(M({allowGapCursor:!0},(e==null?void 0:e.gapcursor)??{}))),(e==null?void 0:e.hardBreak)!==!1&&t.push(KM.configure(e==null?void 0:e.hardBreak)),(e==null?void 0:e.heading)!==!1&&t.push(YM.configure(M({levels:[1,2,3,4,5,6]},e==null?void 0:e.heading)).extend({addKeyboardShortcuts(){return this.options.levels.reduce((i,n)=>U(M({},i||{}),{[`Mod-Alt-${n}`]:()=>this==null?void 0:this.editor.commands.toggleHeading({level:n})}),{})}})),(e==null?void 0:e.history)!==!1&&t.push(tA.configure(M({depth:100,newGroupDelay:500},e==null?void 0:e.history))),(e==null?void 0:e.horizontalRule)!==!1&&t.push(RM.configure(e==null?void 0:e.horizontalRule)),(e==null?void 0:e.italic)!==!1&&t.push(nA.configure(e==null?void 0:e.italic)),(e==null?void 0:e.listItem)!==!1&&t.push(iA.configure(e==null?void 0:e.listItem)),(e==null?void 0:e.taskList)!==!1&&t.push(dA.configure(e==null?void 0:e.taskList)),(e==null?void 0:e.taskItem)!==!1&&t.push(cA.configure(M({nested:!0},e==null?void 0:e.taskItem))),(e==null?void 0:e.orderedList)!==!1&&t.push(sA.configure(e==null?void 0:e.orderedList)),(e==null?void 0:e.paragraph)!==!1&&t.push(aA.configure(e==null?void 0:e.paragraph)),(e==null?void 0:e.strike)!==!1&&t.push(lA.configure(e==null?void 0:e.strike)),(e==null?void 0:e.text)!==!1&&t.push(fA.configure(e==null?void 0:e.text)),(e==null?void 0:e.placeholder)!==!1&&t.push(uA.configure(M({emptyNodeClass:"t-editor-placeholder",includeChildren:!0,showOnlyCurrent:!0,showOnlyWhenEditable:!0,placeholder:""},(e==null?void 0:e.placeholder)??{}))),(e==null?void 0:e.enter)!==!1&&t.push(PM),t}});var Hb,Bb;if(typeof WeakMap<"u"){let t=new WeakMap;Hb=e=>t.get(e),Bb=(e,i)=>(t.set(e,i),i)}else{let t=[],i=0;Hb=n=>{for(let r=0;r(i==10&&(i=0),t[i++]=n,t[i++]=r)}var Ht=class{constructor(t,e,i,n){this.width=t,this.height=e,this.map=i,this.problems=n}findCell(t){for(let e=0;e=i){(o||(o=[])).push({type:"overlong_rowspan",pos:c,n:D-N});break}let A=r+N*e;for(let V=0;Vn&&(o+=l.attrs.colspan)}}for(let s=0;s1&&(i=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function O7(t,e,i){t.problems||(t.problems=[]);let n={};for(let r=0;r0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function P7(t){for(let e=t.depth;e>0;e--){let i=t.node(e).type.spec.tableRole;if(i==="cell"||i==="header_cell")return t.node(e)}return null}function nr(t){let e=t.selection.$head;for(let i=e.depth;i>0;i--)if(e.node(i).type.spec.tableRole=="row")return!0;return!1}function kh(t){let e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let i=ru(e.$head)||F7(e.$head);if(i)return i;throw new RangeError(`No cell found around position ${e.head}`)}function F7(t){for(let e=t.nodeAfter,i=t.pos;e;e=e.firstChild,i++){let n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(i)}for(let e=t.nodeBefore,i=t.pos;e;e=e.lastChild,i--){let n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(i-e.nodeSize)}}function Vb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function R7(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ub(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function EA(t,e,i){let n=t.node(-1),r=Ht.get(n),o=t.start(-1),s=r.nextCell(t.pos-o,e,i);return s==null?null:t.node(0).resolve(o+s)}function Ps(t,e,i=1){let n=U(M({},t),{colspan:t.colspan-i});return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,i),n.colwidth.some(r=>r>0)||(n.colwidth=null)),n}function wA(t,e,i=1){let n=U(M({},t),{colspan:t.colspan+i});if(n.colwidth){n.colwidth=n.colwidth.slice();for(let r=0;rc!=i.pos-o);u.unshift(i.pos-o);let l=u.map(c=>{let f=n.nodeAt(c);if(!f)throw RangeError(`No cell with offset ${c} found`);let p=o+c+1;return new y1(a.resolve(p),a.resolve(p+f.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=i}map(e,i){let n=e.resolve(i.map(this.$anchorCell.pos)),r=e.resolve(i.map(this.$headCell.pos));if(Vb(n)&&Vb(r)&&Ub(n,r)){let o=this.$anchorCell.node(-1)!=n.node(-1);return o&&this.isRowSelection()?ao.rowSelection(n,r):o&&this.isColSelection()?ao.colSelection(n,r):new ao(n,r)}return Dt.between(n,r)}content(){let e=this.$anchorCell.node(-1),i=Ht.get(e),n=this.$anchorCell.start(-1),r=i.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[];for(let u=r.top;u0||b>0){let D=g.attrs;if(y>0&&(D=Ps(D,0,y)),b>0&&(D=Ps(D,D.colspan-b,b)),m.leftr.bottom){let D=U(M({},g.attrs),{rowspan:Math.min(m.bottom,r.bottom)-Math.max(m.top,r.top)});m.top0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=i+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(e,i=e){let n=e.node(-1),r=Ht.get(n),o=e.start(-1),s=r.findCell(e.pos-o),a=r.findCell(i.pos-o),u=e.node(0);return s.top<=a.top?(s.top>0&&(e=u.resolve(o+r.map[s.left])),a.bottom0&&(i=u.resolve(o+r.map[a.left])),s.bottom0)return!1;let s=r+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==i.width}eq(e){return e instanceof ao&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,i=e){let n=e.node(-1),r=Ht.get(n),o=e.start(-1),s=r.findCell(e.pos-o),a=r.findCell(i.pos-o),u=e.node(0);return s.left<=a.left?(s.left>0&&(e=u.resolve(o+r.map[s.top*r.width])),a.right0&&(i=u.resolve(o+r.map[a.top*r.width])),s.right{e.push(Pr.node(n,n+i.nodeSize,{class:"selectedCell"}))}),Fr.create(t.doc,e)}function V7({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(r+1)=0&&!(e.before(o+1)>e.start(o));o--,n--);return i==n&&/row|table/.test(t.node(r).type.spec.tableRole)}function z7({$from:t,$to:e}){let i,n;for(let r=t.depth;r>0;r--){let o=t.node(r);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){i=o;break}}for(let r=e.depth;r>0;r--){let o=e.node(r);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}return i!==n&&e.parentOffset===0}function j7(t,e,i){let n=(e||t).selection,r=(e||t).doc,o,s;if(n instanceof Nr&&(s=n.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=vt.create(r,n.from);else if(s=="row"){let a=r.resolve(n.from+1);o=vt.rowSelection(a,a)}else if(!i){let a=Ht.get(n.node),u=n.from+1,l=u+a.map[a.width*a.height-1];o=vt.create(r,u+1,l)}}else n instanceof Dt&&V7(n)?o=Dt.create(r,n.from):n instanceof Dt&&z7(n)&&(o=Dt.create(r,n.$from.start(),n.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var U7=new qt("fix-tables");function xA(t,e,i,n){let r=t.childCount,o=e.childCount;e:for(let s=0,a=0;s{r.type.spec.tableRole=="table"&&(i=$7(t,r,o,i))};return e?e.doc!=t.doc&&xA(e.doc,t.doc,0,n):t.doc.descendants(n),i}function $7(t,e,i,n){let r=Ht.get(e);if(!r.problems)return n;n||(n=t.tr);let o=[];for(let u=0;u0){let m="cell";c.firstChild&&(m=c.firstChild.type.spec.tableRole);let g=[];for(let b=0;b0?-1:0;L7(e,n,r+o)&&(o=r==0||r==e.width?null:0);for(let s=0;s0&&r0&&e.map[a-1]==u||r0?-1:0;W7(e,n,r+u)&&(u=r==0||r==e.height?null:0);for(let l=0,c=e.width*r;l0&&r0&&f==e.map[c-e.width]){let p=i.nodeAt(f).attrs;t.setNodeMarkup(t.mapping.slice(a).map(f+n),null,U(M({},p),{rowspan:p.rowspan-1})),l+=p.colspan-1}else if(r0&&i[o]==i[o-1]||n.right0&&i[r]==i[r-t]||n.bottomi[n.type.spec.tableRole])(t,e)}function K7(t){return(e,i)=>{var n;let r=e.selection,o,s;if(r instanceof vt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{if(o=P7(r.$from),!o)return!1;s=(n=ru(r.$from))==null?void 0:n.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(i){let a=o.attrs,u=[],l=a.colwidth;a.rowspan>1&&(a=U(M({},a),{rowspan:1})),a.colspan>1&&(a=U(M({},a),{colspan:1}));let c=Sr(e),f=e.tr;for(let m=0;m{s.attrs[t]!==e&&o.setNodeMarkup(a,null,U(M({},s.attrs),{[t]:e}))}):o.setNodeMarkup(r.pos,null,U(M({},r.nodeAfter.attrs),{[t]:e})),n(o)}return!0}}function Y7(t){return function(e,i){if(!nr(e))return!1;if(i){let n=xn(e.schema),r=Sr(e),o=e.tr,s=r.map.cellsInRect(t=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:t=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),a=s.map(u=>r.table.nodeAt(u));for(let u=0;u{let g=m+o.tableStart,y=s.doc.nodeAt(g);y&&s.setNodeMarkup(g,p,y.attrs)}),n(s)}return!0}}var MCe=ou("row",{useDeprecatedLogic:!0}),ACe=ou("column",{useDeprecatedLogic:!0}),RA=ou("cell",{useDeprecatedLogic:!0});function Q7(t,e){if(e<0){let i=t.nodeBefore;if(i)return t.pos-i.nodeSize;for(let n=t.index(-1)-1,r=t.before();n>=0;n--){let o=t.node(-1).child(n),s=o.lastChild;if(s)return r-1-s.nodeSize;r-=o.nodeSize}}else{if(t.index()0;n--)if(i.node(n).type.spec.tableRole=="table")return e&&e(t.tr.delete(i.before(n),i.after(n)).scrollIntoView()),!0;return!1}function xh(t,e){let i=t.selection;if(!(i instanceof vt))return!1;if(e){let n=t.tr,r=xn(t.schema).cell.createAndFill().content;i.forEachCell((o,s)=>{o.content.eq(r)||n.replace(n.mapping.map(s+1),n.mapping.map(s+o.nodeSize-1),new Bn(r,0,0))}),n.docChanged&&e(n)}return!0}function X7(t){if(!t.size)return null;let{content:e,openStart:i,openEnd:n}=t;for(;e.childCount==1&&(i>0&&n>0||e.child(0).type.spec.tableRole=="table");)i--,n--,e=e.child(0).content;let r=e.child(0),o=r.type.spec.tableRole,s=r.type.schema,a=[];if(o=="row")for(let u=0;u=0;s--){let{rowspan:a,colspan:u}=o.child(s).attrs;for(let l=r;l=e.length&&e.push(Bt.empty),i[r]n&&(p=p.type.createChecked(Ps(p.attrs,p.attrs.colspan,c+p.attrs.colspan-n),p.content)),l.push(p),c+=p.attrs.colspan;for(let m=1;mr&&(f=f.type.create(U(M({},f.attrs),{rowspan:Math.max(1,r-f.attrs.rowspan)}),f.content)),u.push(f)}o.push(Bt.from(u))}i=o,e=r}return{width:t,height:e,rows:i}}function tU(t,e,i,n,r,o,s){let a=t.doc.type.schema,u=xn(a),l,c;if(r>e.width)for(let f=0,p=0;fe.height){let f=[];for(let g=0,y=(e.height-1)*e.width;g=e.width?!1:i.nodeAt(e.map[y+g]).type==u.header_cell;f.push(b?c||(c=u.header_cell.createAndFill()):l||(l=u.cell.createAndFill()))}let p=u.row.create(null,Bt.from(f)),m=[];for(let g=e.height;g{if(!r)return!1;let o=i.selection;if(o instanceof vt)return Mh(i,n,nn.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;let s=HA(r,t,e);if(s==null)return!1;if(t=="horiz")return Mh(i,n,nn.near(i.doc.resolve(o.head+e),e));{let a=i.doc.resolve(s),u=EA(a,t,e),l;return u?l=nn.near(u,1):e<0?l=nn.near(i.doc.resolve(a.before(-1)),-1):l=nn.near(i.doc.resolve(a.after(-1)),1),Mh(i,n,l)}}}function Sh(t,e){return(i,n,r)=>{if(!r)return!1;let o=i.selection,s;if(o instanceof vt)s=o;else{let u=HA(r,t,e);if(u==null)return!1;s=new vt(i.doc.resolve(u))}let a=EA(s.$headCell,t,e);return a?Mh(i,n,new vt(s.$anchorCell,a)):!1}}function iU(t,e){let i=t.state.doc,n=ru(i.resolve(e));return n?(t.dispatch(t.state.tr.setSelection(new vt(n))),!0):!1}function rU(t,e,i){if(!nr(t.state))return!1;let n=X7(i),r=t.state.selection;if(r instanceof vt){n||(n={width:1,height:1,rows:[Bt.from(zb(xn(t.state.schema).cell,i))]});let o=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),a=Ht.get(o).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return n=eU(n,a.right-a.left,a.bottom-a.top),vA(t.state,t.dispatch,s,a,n),!0}else if(n){let o=kh(t.state),s=o.start(-1);return vA(t.state,t.dispatch,s,Ht.get(o.node(-1)).findCell(o.pos-s),n),!0}else return!1}function oU(t,e){var i;if(e.ctrlKey||e.metaKey)return;let n=bA(t,e.target),r;if(e.shiftKey&&t.state.selection instanceof vt)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(r=ru(t.state.selection.$anchor))!=null&&((i=Lb(t,e))==null?void 0:i.pos)!=r.pos)o(r,e),e.preventDefault();else if(!n)return;function o(u,l){let c=Lb(t,l),f=$o.getState(t.state)==null;if(!c||!Ub(u,c))if(f)c=u;else return;let p=new vt(u,c);if(f||!t.state.selection.eq(p)){let m=t.state.tr.setSelection(p);f&&m.setMeta($o,u.pos),t.dispatch(m)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),$o.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta($o,-1))}function a(u){let l=u,c=$o.getState(t.state),f;if(c!=null)f=t.state.doc.resolve(c);else if(bA(t,l.target)!=n&&(f=Lb(t,e),!f))return s();f&&o(f,l)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function HA(t,e,i){if(!(t.state.selection instanceof Dt))return null;let{$head:n}=t.state.selection;for(let r=n.depth-1;r>=0;r--){let o=n.node(r);if((i<0?n.index(r):n.indexAfter(r))!=(i<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let a=n.before(r),u=e=="vert"?i>0?"down":"up":i>0?"right":"left";return t.endOfTextblock(u)?a:null}}return null}function bA(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Lb(t,e){let i=t.posAtCoords({left:e.clientX,top:e.clientY});return i&&i?ru(t.state.doc.resolve(i.pos)):null}var sU=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),jb(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,jb(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function jb(t,e,i,n,r,o){var s;let a=0,u=!0,l=e.firstChild,c=t.firstChild;if(c){for(let f=0,p=0;fnew n(p,i,m)),new aU(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=fi.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{uU(s,a,t,r)},mouseleave:s=>{lU(s)},mousedown:(s,a)=>{cU(s,a,e,i)}},decorations:s=>{let a=fi.getState(s);if(a&&a.activeHandle>-1)return mU(s,a.activeHandle)},nodeViews:{}}});return o}var aU=class Ah{constructor(e,i){this.activeHandle=e,this.dragging=i}apply(e){let i=this,n=e.getMeta(fi);if(n&&n.setHandle!=null)return new Ah(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new Ah(i.activeHandle,n.setDragging);if(i.activeHandle>-1&&e.docChanged){let r=e.mapping.map(i.activeHandle,-1);return Vb(e.doc.resolve(r))||(r=-1),new Ah(r,i.dragging)}return i}};function uU(t,e,i,n){let r=fi.getState(t.state);if(r&&!r.dragging){let o=fU(e.target),s=-1;if(o){let{left:a,right:u}=o.getBoundingClientRect();e.clientX-a<=i?s=_A(t,e,"left",i):u-e.clientX<=i&&(s=_A(t,e,"right",i))}if(s!=r.activeHandle){if(!n&&s!==-1){let a=t.state.doc.resolve(s),u=a.node(-1),l=Ht.get(u),c=a.start(-1);if(l.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==l.width-1)return}VA(t,s)}}}function lU(t){let e=fi.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&VA(t,-1)}function cU(t,e,i,n){var r;let o=(r=t.dom.ownerDocument.defaultView)!=null?r:window,s=fi.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let a=t.state.doc.nodeAt(s.activeHandle),u=dU(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(fi,{setDragging:{startX:e.clientX,startWidth:u}}));function l(f){o.removeEventListener("mouseup",l),o.removeEventListener("mousemove",c);let p=fi.getState(t.state);p!=null&&p.dragging&&(pU(t,p.activeHandle,CA(p.dragging,f,i)),t.dispatch(t.state.tr.setMeta(fi,{setDragging:null})))}function c(f){if(!f.which)return l(f);let p=fi.getState(t.state);if(p&&p.dragging){let m=CA(p.dragging,f,i);DA(t,p.activeHandle,m,n)}}return DA(t,s.activeHandle,u,n),o.addEventListener("mouseup",l),o.addEventListener("mousemove",c),e.preventDefault(),!0}function dU(t,e,{colspan:i,colwidth:n}){let r=n&&n[n.length-1];if(r)return r;let o=t.domAtPos(e),a=o.node.childNodes[o.offset].offsetWidth,u=i;if(n)for(let l=0;l{let n=t.nodes[i];n.spec.tableRole&&(e[n.spec.tableRole]=n)}),t.cached.tableNodeTypes=e,e}function yU(t,e,i,n,r){let o=gU(t),s=[],a=[];for(let l=0;l{let{selection:e}=t.state;if(!vU(e))return!1;let i=0,n=C1(e.ranges[0].$from,o=>o.type.name==="table");return n==null||n.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(i+=1)}),i===e.ranges.length?(t.commands.deleteTable(),!0):!1},$A=X.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Kb,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:i,tableWidth:n,tableMinWidth:r}=Yb(t,this.options.cellMinWidth);return["table",ee(this.options.HTMLAttributes,e,{style:n?`width: ${n}`:`min-width: ${r}`}),i,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:i=!0}={})=>({tr:n,dispatch:r,editor:o})=>{let s=yU(o.schema,t,e,i);if(r){let a=n.selection.from+1;n.replaceSelectionWith(s).scrollIntoView().setSelection(Dt.near(n.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>SA(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>MA(t,e),deleteColumn:()=>({state:t,dispatch:e})=>AA(t,e),addRowBefore:()=>({state:t,dispatch:e})=>OA(t,e),addRowAfter:()=>({state:t,dispatch:e})=>NA(t,e),deleteRow:()=>({state:t,dispatch:e})=>PA(t,e),deleteTable:()=>({state:t,dispatch:e})=>LA(t,e),mergeCells:()=>({state:t,dispatch:e})=>Gb(t,e),splitCell:()=>({state:t,dispatch:e})=>Wb(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ou("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ou("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>RA(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Gb(t,e)?!0:Wb(t,e),setCellAttribute:(t,e)=>({state:i,dispatch:n})=>FA(t,e)(i,n),goToNextCell:()=>({state:t,dispatch:e})=>qb(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>qb(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&$b(t),!0),setCellSelection:t=>({tr:e,dispatch:i})=>{if(i){let n=vt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Oh,"Mod-Backspace":Oh,Delete:Oh,"Mod-Delete":Oh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[BA({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zA({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:sc(oc(t,"tableRole",e))}}});var GA=$A.extend({renderHTML({node:t,HTMLAttributes:e}){let{colgroup:i,tableWidth:n,tableMinWidth:r}=Yb(t,this.options.cellMinWidth);return["div",{class:"tui-table-wrapper"},["table",ee(this.options.HTMLAttributes,e,{style:n?`width: ${n}`:`min-width: ${r}`}),i,["tbody",0]]]}}).configure({resizable:!0,lastColumnResizable:!1,allowTableNodeSelection:!0}).extend();var WA=X.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ee(this.options.HTMLAttributes,t),0]}});var qA=WA.extend({renderHTML({HTMLAttributes:t}){let e=ee(this.options.HTMLAttributes,t);return e.colwidth&&(e.style=`width: ${e.colwidth}px; ${e.style}`),["td",e,0]}});var ZA=ft.create({addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{background:{default:null,renderHTML:({background:t})=>t?{style:`background: ${t}`}:null,parseHTML:({style:t})=>t.background,keepOnSplit:!1}}}]},addCommands(){return{setCellBackground:t=>({chain:e})=>e().updateAttributes("tableCell",{background:t}).updateAttributes("tableHeader",{background:t}).run(),unsetCellBackground:()=>({chain:t})=>t().updateAttributes("tableCell",{background:null}).updateAttributes("tableHeader",{background:null}).run()}}});var pDe=[pA.configure({heading:{levels:[1,2,3,4,5,6]}}),import("./chunk-HMDNYA55.js").then(({TextAlign:t})=>t.configure({types:["heading","paragraph"]})),import("./chunk-V7S2FUMF.js").then(({TextStyle:t})=>t),import("./chunk-CJRETWGW.js").then(({Underline:t})=>t),import("./chunk-TUVFAG53.js").then(({Subscript:t})=>t),import("./chunk-CAABDULK.js").then(({Superscript:t})=>t),pM,NM,gM,fM,uM,GA.configure({resizable:!0}),qA,import("./chunk-BNWGF3TD.js").then(({TableRow:t})=>t),import("./chunk-4ARHNIMP.js").then(({TableHeader:t})=>t),mM,ZA,cM,lM,dM,hM];var bU={groupNodeClass:"tui-group-node",groupPointerNodeClass:"tui-group-pointer",nested:!0,draggable:!0,createOnEnter:!1},yDe=(t={})=>{let{draggable:e,nested:i,groupNodeClass:n,groupPointerNodeClass:r,createOnEnter:o}=M(M({},bU),t);return X.create({name:"group",draggable:e,group:"block",content:i?"block+":"block",addAttributes(){return{style:{default:null,parseHTML:s=>s.getAttribute("style"),renderHTML:s=>s.style?{style:s.style}:{}}}},parseHTML(){return[{tag:'div[data-type="group"]'}]},renderHTML({HTMLAttributes:s}){return["div",ee(s,{"data-type":"group"}),0]},addNodeView(){return({HTMLAttributes:s,node:a})=>{if(globalThis.document){let u=document.createElement("div"),l=document.createElement("div");if(u.classList.add(n),l.setAttribute("data-type","group"),s.style&&(a.attrs.style=s.style,l.setAttribute("style",s.style)),e){let c=document.createElement("div");c.classList.add(r),c.innerHTML="",c.contentEditable="false",u.append(c,l)}else u.append(l);return{dom:u,contentDOM:l}}return null}},addCommands(){return{setGroup:()=>({commands:s,state:a})=>{this.editor.chain().focus().run();let u=Pp(a,""),c=`
          ${u.trim().startsWith("

          ")?u:`

          ${u}

          `}
          `;return s.insertContent(c)},setGroupHilite:s=>({editor:a})=>{let u=a.state.selection.$anchor;for(let l=u.depth;l>0;l--){u=a.state.selection.$anchor;let c=u.node(l);if(c.type.name===this.name){setTimeout(()=>a.commands.updateAttributes(c.type,{style:`background: ${s}`}));break}}return!0},removeGroup:()=>({state:s,dispatch:a})=>Np(s,a,this.name)}},addKeyboardShortcuts(){return o?{Enter:this.editor.commands.setGroup}:{}}})};var _U=new k("[TUI_IFRAME_EDITOR_OPTIONS]",{factory:()=>({minWidth:100,maxWidth:1/0,minHeight:100,maxHeight:1/0})}),CU=(()=>{let e=class e extends jp{constructor(){super(...arguments),this.sanitizer=h(ws),this.el=h(de),this.options=h(_U),this.changeDetector=h(st)}updateSize([n,r]){this.currentWidth=Math.max(this.options.minWidth,Math.min(this.options.maxWidth,n)),this.currentHeight=Math.max(this.options.minHeight,Math.min(this.options.maxHeight,r)),this.attrs.width=this.currentWidth,this.attrs.height=this.currentHeight,this.el.nativeElement.dispatchEvent(new CustomEvent(Lo,{bubbles:!0}))}get src(){return this.sanitizer.bypassSecurityTrustResourceUrl(this.attrs.src??"")}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-iframe-editor"]],features:[oe],decls:2,vars:13,consts:[[3,"sizeChange","height","width"],["alt","",3,"height","src","width"]],template:function(r,o){r&1&&(E(0,"tui-editor-resizable",0),x("sizeChange",function(a){return o.updateSize(a)}),Q(1,"iframe",1),w()),r&2&&(v("height",o.height)("width",o.width),C(),Ye("max-height",o.options.maxHeight)("max-width",o.options.maxWidth)("min-height",o.options.minHeight)("min-width",o.options.minWidth),v("height",o.height)("src",o.src,GE)("width",o.width))},dependencies:[Up],styles:["iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}"],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"src",null),t})(),ADe=({injector:t})=>X.create({name:"iframe",group:"block",atom:!0,draggable:!1,parseHTML(){return[{tag:"iframe"}]},addAttributes(){return{src:{default:null,keepOnSplit:!1,parseHTML:e=>e.getAttribute("src")},frameborder:{default:0,keepOnSplit:!1,parseHTML:e=>e.getAttribute("frameborder")},width:{default:"100%",keepOnSplit:!1,parseHTML:e=>e.getAttribute("width")},height:{default:null,keepOnSplit:!1,parseHTML:e=>e.getAttribute("height")},allowfullscreen:{keepOnSplit:!1,default:this.options.allowFullscreen,parseHTML:e=>e.getAttribute("allowfullscreen")}}},renderHTML({HTMLAttributes:e}){return["iframe",ee(e,{"data-type":"iframe-editor"})]},addNodeView(){return e=>new tu(CU,e,M({injector:t},e))},addCommands(){return{setIframe:e=>({commands:i,state:n})=>{let r=n.selection.anchor;return i.enter(),i.setTextSelection(r),i.insertContent({type:this.name,attrs:e}),i.setTextSelection(n.selection.anchor),!0}}}});var DU=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,KA=X.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[uc({find:DU,type:this.type,getAttributes:t=>{let[,,e,i,n]=t;return{src:i,alt:e,title:n}}})]}});var EU=["resizable"],wU=["dropdown"];function TU(t,e){if(t&1){let i=q();E(0,"tui-image-align",7),x("updateAlignStyles",function(r){P(i);let o=_();return o.align(r),F(o.open=!1)}),w()}if(t&2){let i=_();Jg(i.style)}}var xU=new k("[TUI_IMAGE_EDITOR_OPTIONS]",{factory:()=>({minWidth:null,maxWidth:1/0})}),IU=(()=>{let e=class e extends Ii{constructor(){super(...arguments),this.el=h(de),this.type="dropdown"}getPosition({width:n,height:r}){let{right:o,top:s}=this.el.nativeElement.getBoundingClientRect();return[s+r+5,o-n/2]}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiImageOptionsPosition",""]],features:[Z([Iv(e)]),oe]});let t=e;return t})(),SU=(()=>{let e=class e{constructor(){this.options=h(xe),this.style=null,this.updateAlignStyles=new _e}isAlignCenter(n){var r;return((r=n==null?void 0:n.replace(/\s/g,""))==null?void 0:r.includes("justify-content:center"))??!1}isAlignJustify(n){return n==null||n===""}isAlignLeft(n){var r;return((r=n==null?void 0:n.replace(/\s/g,""))==null?void 0:r.includes("float:left"))??!1}isAlignRight(n){var r;return((r=n==null?void 0:n.replace(/\s/g,""))==null?void 0:r.includes("float:right"))??!1}alignLeft(){this.updateAlignStyles.emit("float: left")}alignCenter(){this.updateAlignStyles.emit("display: flex; justify-content: center; margin-left: auto; margin-right: auto;")}alignJustify(){this.updateAlignStyles.emit(null)}alignRight(){this.updateAlignStyles.emit("float: right")}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-image-align"]],inputs:{style:"style"},outputs:{updateAlignStyles:"updateAlignStyles"},decls:9,vars:8,consts:[[1,"t-align-list"],["size","s","title","","tuiIconButton","","type","button",3,"click.capture","appearance","iconStart"],["size","s","tuiIconButton","","type","button",3,"click.capture","appearance","iconStart"]],template:function(r,o){r&1&&(E(0,"div",0)(1,"button",1),x("click.capture",function(){return o.alignJustify()}),he(2," Justify align "),w(),E(3,"button",2),x("click.capture",function(){return o.alignLeft()}),he(4," Left align "),w(),E(5,"button",2),x("click.capture",function(){return o.alignCenter()}),he(6," Center align "),w(),E(7,"button",2),x("click.capture",function(){return o.alignRight()}),he(8," Right align "),w()()),r&2&&(C(),v("appearance",o.isAlignJustify(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignJustify),C(2),v("appearance",o.isAlignLeft(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignLeft),C(2),v("appearance",o.isAlignCenter(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignCenter),C(2),v("appearance",o.isAlignRight(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignRight))},dependencies:[Le],styles:[".t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"isAlignCenter",null),Ot([Ft],t.prototype,"isAlignJustify",null),Ot([Ft],t.prototype,"isAlignLeft",null),Ot([Ft],t.prototype,"isAlignRight",null),t})(),MU=(()=>{let e=class e extends jp{constructor(){super(...arguments),this.sanitizer=h(ws),this.el=h(de),this.win=h(Je),this.destroyRef=h(it),this.style=null,this.contenteditable=!1,this.focused=!1,this.open=!1,this.options=h(xe),this.imageOptions=h(xU),this.changeDetector=h(st)}get height(){return null}get minWidth(){return this.imageOptions.minWidth??0}get maxWidth(){return this.imageOptions.maxWidth??0}ngOnInit(){this.style=this.attrs.style}ngAfterViewInit(){this.minWidth>0&&this.updateMinWidth()}updateSize([n]){this.currentWidth=Math.max(this.minWidth,Math.min(this.maxWidth,n)),this.attrs.width=this.currentWidth,this.notifyUpdate()}get dragHandle(){return this.attrs.draggable??null}get alt(){return this.attrs.alt??""}get title(){return this.attrs.title??""}getBypassedSrc(n){return this.sanitizer.bypassSecurityTrustResourceUrl(n)}currentTargetIsFocused(n){var r;this.focused=this.el.nativeElement.contains(n),this.focused?this.selectFakeText():(this.open=!1,(r=this.dropdown)==null||r.toggle(!1))}openDropdown(n){var r;this.open=!0,(r=this.dropdown)==null||r.toggle(!0),n.stopImmediatePropagation()}align(n){this.style=n,this.attrs.style=n,this.notifyUpdate()}selectFakeText(){var n,r,o;if(this.win.document){let s=this.win.document.createRange();(n=this.el.nativeElement.querySelector("p"))==null||n.focus(),s.selectNode(this.el.nativeElement),(r=this.win.getSelection())==null||r.removeAllRanges(),(o=this.win.getSelection())==null||o.addRange(s)}}updateMinWidth(){gt(100).pipe(Se(this.destroyRef)).subscribe(()=>{var r,o,s,a;let n=((s=(o=(r=this.resizable)==null?void 0:r.container)==null?void 0:o.nativeElement.querySelector("img"))==null?void 0:s.naturalWidth)??((a=this.resizable)==null?void 0:a.width)??this.attrs.width??0;this.minWidth>parseInt(n,10)&&this.updateSize([this.minWidth])})}notifyUpdate(){this.el.nativeElement.dispatchEvent(new CustomEvent(Lo,{bubbles:!0}))}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-image-editor"]],viewQuery:function(r,o){if(r&1&&(Gt(EU,7),Gt(wU,7)),r&2){let s;Qe(s=Xe())&&(o.resizable=s.first),Qe(s=Xe())&&(o.dropdown=s.first)}},hostVars:4,hostBindings:function(r,o){r&1&&x("click.silent",function(a){return o.currentTargetIsFocused(a.target)},!1,Nn),r&2&&(Ke("data-drag-handle",o.dragHandle)("contenteditable",o.contenteditable),Jg(o.style))},features:[oe],decls:9,vars:17,consts:[["dropdown","tuiDropdown"],["resizable",""],["imgOptions",""],["tuiImageOptionsPosition","",1,"t-hosted",3,"tuiDropdown","tuiDropdownOpen"],["appearance","","size","s","tuiIconButton","","type","button",1,"t-image-options",3,"click.capture.prevent","iconStart"],[3,"sizeChange","autoHeight","width"],["contenteditable","false","decoding","async","loading","lazy",3,"alt","src","title"],[3,"updateAlignStyles"]],template:function(r,o){if(r&1){let s=q();E(0,"div",3,0)(2,"button",4),x("click.capture.prevent",function(u){return P(s),F(o.openDropdown(u))}),he(3," Image settings "),w(),E(4,"tui-editor-resizable",5,1),x("sizeChange",function(u){return P(s),F(o.updateSize(u))}),Q(6,"img",6),w()(),O(7,TU,1,2,"ng-template",null,2,We)}if(r&2){let s=be(8);v("tuiDropdown",s)("tuiDropdownOpen",o.open),C(2),Te("_open",o.open),v("iconStart",o.options.icons.imageExtension.settings),C(2),v("autoHeight",!0)("width",o.width),C(2),Ye("max-width",o.maxWidth,"px")("min-width",o.minWidth,"px"),Te("ProseMirror-selectednode",o.focused),v("alt",o.alt)("src",o.getBypassedSrc(o.attrs.src),Kd)("title",o.title),Ke("width",o.width)}},dependencies:[Le,Ze,Tt,Up,SU,IU],styles:["[_nghost-%COMP%]{display:inline-block}[data-drag-handle][_nghost-%COMP%]{cursor:move}[_nghost-%COMP%]:hover .t-image-options[_ngcontent-%COMP%]{opacity:1}img[_ngcontent-%COMP%]{pointer-events:none}.t-hosted[_ngcontent-%COMP%]{position:relative}.t-image-options[_ngcontent-%COMP%]{position:absolute;top:.625rem;right:.625rem;z-index:1;background:var(--tui-background-base)}.t-image-options[_ngcontent-%COMP%]:not(._open){transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}.t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"getBypassedSrc",null),t})();function YA(t){return(e,i)=>{let n=i instanceof DragEvent?i.dataTransfer:i.clipboardData,r=Array.from((n==null?void 0:n.files)??[]).filter(s=>/image/i.test(s.type));r.length&&i.preventDefault();let o=t.get(pp);r.forEach(s=>{o(s).pipe($t(1),go(()=>!e.isDestroyed)).subscribe(a=>{var c;let u=(c=e.state.schema.nodes.image)==null?void 0:c.create({src:a}),l=u?e.state.tr.replaceSelectionWith(u):null;setTimeout==null||setTimeout(()=>{!e.isDestroyed&&l&&e.dispatch(l)})})})}}function AU({injector:t,draggable:e}){let i=si(e)?e:!0;return KA.extend({name:"image",group:"inline",inline:!0,priority:0,selectable:!0,draggable:i,parseHTML(){return[{tag:"img"}]},addAttributes(){return{src:{default:"",keepOnSplit:!1},width:{default:null,keepOnSplit:!1},alt:{default:"",keepOnSplit:!1},style:{default:"",keepOnSplit:!1},title:{default:"",keepOnSplit:!1},draggable:{default:i?"":null,keepOnSplit:!1}}},renderHTML({HTMLAttributes:n}){return["img",ee(n)]},addNodeView(){return n=>new tu(MU,n,M({injector:t},n))},addCommands(){return{setEditableImage:n=>({commands:r})=>r.insertContent({type:this.name,attrs:n})}},addProseMirrorPlugins(){return[new Rt({props:{handleDOMEvents:{paste:YA(t),drop:YA(t)}}})]}})}var nEe=AU;var o_={};nc(o_,{arrayReplaceAt:()=>r_,assign:()=>uu,escapeHtml:()=>co,escapeRE:()=>p$,fromCodePoint:()=>Yl,has:()=>n$,isMdAsciiPunct:()=>Hs,isPunctChar:()=>Ls,isSpace:()=>He,isString:()=>$h,isValidEntityCode:()=>Gh,isWhiteSpace:()=>Rs,lib:()=>h$,normalizeReference:()=>Bs,unescapeAll:()=>lo,unescapeMd:()=>a$});var Lh={};nc(Lh,{decode:()=>Zl,encode:()=>Fh,format:()=>su,parse:()=>Kl});var QA={};function kU(t){let e=QA[t];if(e)return e;e=QA[t]=[];for(let i=0;i<128;i++){let n=String.fromCharCode(i);e.push(n)}for(let i=0;i=55296&&c<=57343?r+="\uFFFD\uFFFD\uFFFD":r+=String.fromCharCode(c),o+=6;continue}}if((a&248)===240&&o+91114111?r+="\uFFFD\uFFFD\uFFFD\uFFFD":(f-=65536,r+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),o+=9;continue}}r+="\uFFFD"}return r})}Nh.defaultChars=";/?:@&=+$,#";Nh.componentChars="";var Zl=Nh;var XA={};function OU(t){let e=XA[t];if(e)return e;e=XA[t]=[];for(let i=0;i<128;i++){let n=String.fromCharCode(i);/^[0-9a-z]$/i.test(n)?e.push(n):e.push("%"+("0"+i.toString(16).toUpperCase()).slice(-2))}for(let i=0;i"u"&&(i=!0);let n=OU(e),r="";for(let o=0,s=t.length;o=55296&&a<=57343){if(a>=55296&&a<=56319&&o+1=56320&&u<=57343){r+=encodeURIComponent(t[o]+t[o+1]),o++;continue}}r+="%EF%BF%BD";continue}r+=encodeURIComponent(t[o])}return r}Ph.defaultChars=";/?:@&=+$,-_.!~*'()#";Ph.componentChars="-_.!~*'()";var Fh=Ph;function su(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function Rh(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var NU=/^([a-z0-9.+-]+:)/i,PU=/:[0-9]*$/,FU=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,RU=["<",">",'"',"`"," ","\r",` -`," "],LU=["{","}","|","\\","^","`"].concat(RU),HU=["'"].concat(LU),JA=["%","/","?",";","#"].concat(HU),ek=["/","?","#"],BU=255,tk=/^[+a-z0-9A-Z_-]{0,63}$/,VU=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,nk={javascript:!0,"javascript:":!0},ik={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function zU(t,e){if(t&&t instanceof Rh)return t;let i=new Rh;return i.parse(t,e),i}Rh.prototype.parse=function(t,e){let i,n,r,o=t;if(o=o.trim(),!e&&t.split("#").length===1){let l=FU.exec(o);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let s=NU.exec(o);if(s&&(s=s[0],i=s.toLowerCase(),this.protocol=s,o=o.substr(s.length)),(e||s||o.match(/^\/\/[^@\/]+@[^@\/]+/))&&(r=o.substr(0,2)==="//",r&&!(s&&nk[s])&&(o=o.substr(2),this.slashes=!0)),!nk[s]&&(r||s&&!ik[s])){let l=-1;for(let g=0;g127?I+="x":I+=D[N];if(!I.match(tk)){let N=g.slice(0,y),A=g.slice(y+1),V=D.match(VU);V&&(N.push(V[1]),A.unshift(V[2])),A.length&&(o=A.join(".")+o),this.hostname=N.join(".");break}}}}this.hostname.length>BU&&(this.hostname=""),m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let a=o.indexOf("#");a!==-1&&(this.hash=o.substr(a),o=o.slice(0,a));let u=o.indexOf("?");return u!==-1&&(this.search=o.substr(u),o=o.slice(0,u)),o&&(this.pathname=o),ik[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Rh.prototype.parseHost=function(t){let e=PU.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var Kl=zU;var Qb={};nc(Qb,{Any:()=>Hh,Cc:()=>Bh,Cf:()=>rk,P:()=>au,S:()=>Vh,Z:()=>zh});var Hh=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;var Bh=/[\0-\x1F\x7F-\x9F]/;var rk=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;var au=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/;var Vh=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;var zh=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var ok=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(t=>t.charCodeAt(0)));var sk=new Uint16Array("\u0200aglq \x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(t=>t.charCodeAt(0)));var Xb,jU=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Jb=(Xb=String.fromCodePoint)!==null&&Xb!==void 0?Xb:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function e_(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=jU.get(t))!==null&&e!==void 0?e:t}var mn=function(t){return t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z",t}(mn||{}),UU=32,Fs=function(t){return t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE",t}(Fs||{});function t_(t){return t>=mn.ZERO&&t<=mn.NINE}function $U(t){return t>=mn.UPPER_A&&t<=mn.UPPER_F||t>=mn.LOWER_A&&t<=mn.LOWER_F}function GU(t){return t>=mn.UPPER_A&&t<=mn.UPPER_Z||t>=mn.LOWER_A&&t<=mn.LOWER_Z||t_(t)}function WU(t){return t===mn.EQUALS||GU(t)}var hn=function(t){return t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity",t}(hn||{}),uo=function(t){return t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute",t}(uo||{}),jh=class{constructor(e,i,n){this.decodeTree=e,this.emitCodePoint=i,this.errors=n,this.state=hn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=uo.Strict}startEntity(e){this.decodeMode=e,this.state=hn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,i){switch(this.state){case hn.EntityStart:return e.charCodeAt(i)===mn.NUM?(this.state=hn.NumericStart,this.consumed+=1,this.stateNumericStart(e,i+1)):(this.state=hn.NamedEntity,this.stateNamedEntity(e,i));case hn.NumericStart:return this.stateNumericStart(e,i);case hn.NumericDecimal:return this.stateNumericDecimal(e,i);case hn.NumericHex:return this.stateNumericHex(e,i);case hn.NamedEntity:return this.stateNamedEntity(e,i)}}stateNumericStart(e,i){return i>=e.length?-1:(e.charCodeAt(i)|UU)===mn.LOWER_X?(this.state=hn.NumericHex,this.consumed+=1,this.stateNumericHex(e,i+1)):(this.state=hn.NumericDecimal,this.stateNumericDecimal(e,i))}addToNumericResult(e,i,n,r){if(i!==n){let o=n-i;this.result=this.result*Math.pow(r,o)+parseInt(e.substr(i,o),r),this.consumed+=o}}stateNumericHex(e,i){let n=i;for(;i>14;for(;i>14,o!==0){if(s===mn.SEMI)return this.emitNamedEntityData(this.treeIndex,o,this.consumed+this.excess);this.decodeMode!==uo.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:i,decodeTree:n}=this,r=(n[i]&Fs.VALUE_LENGTH)>>14;return this.emitNamedEntityData(i,r,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,i,n){let{decodeTree:r}=this;return this.emitCodePoint(i===1?r[e]&~Fs.VALUE_LENGTH:r[e+1],n),i===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case hn.NamedEntity:return this.result!==0&&(this.decodeMode!==uo.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case hn.NumericDecimal:return this.emitNumericEntity(0,2);case hn.NumericHex:return this.emitNumericEntity(0,3);case hn.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case hn.EntityStart:return 0}}};function ak(t){let e="",i=new jh(t,n=>e+=Jb(n));return function(r,o){let s=0,a=0;for(;(a=r.indexOf("&",a))>=0;){e+=r.slice(s,a),i.startEntity(o);let l=i.write(r,a+1);if(l<0){s=a+i.end();break}s=a+l,a=l===0?s+1:s}let u=e+r.slice(s);return e="",u}}function qU(t,e,i,n){let r=(e&Fs.BRANCH_LENGTH)>>7,o=e&Fs.JUMP_TABLE;if(r===0)return o!==0&&n===o?i:-1;if(o){let u=n-o;return u<0||u>=r?-1:t[i+u]-1}let s=i,a=s+r-1;for(;s<=a;){let u=s+a>>>1,l=t[u];if(ln)a=u-1;else return t[u+r]}return-1}var ZU=ak(ok),OEe=ak(sk);function Go(t,e=uo.Legacy){return ZU(t,e)}function Uh(t){for(let e=1;et.codePointAt(e):(t,e)=>(t.charCodeAt(e)&64512)===55296?(t.charCodeAt(e)-55296)*1024+t.charCodeAt(e+1)-56320+65536:t.charCodeAt(e);function n_(t,e){return function(n){let r,o=0,s="";for(;r=t.exec(n);)o!==r.index&&(s+=n.substring(o,r.index)),s+=e.get(r[0].charCodeAt(0)),o=r.index+1;return s+n.substring(o)}}var uk=n_(/[&<>'"]/g,YU),lk=n_(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),ck=n_(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]));function e$(t){return Object.prototype.toString.call(t)}function $h(t){return e$(t)==="[object String]"}var t$=Object.prototype.hasOwnProperty;function n$(t,e){return t$.call(t,e)}function uu(t){return Array.prototype.slice.call(arguments,1).forEach(function(i){if(i){if(typeof i!="object")throw new TypeError(i+"must be object");Object.keys(i).forEach(function(n){t[n]=i[n]})}}),t}function r_(t,e,i){return[].concat(t.slice(0,e),i,t.slice(e+1))}function Gh(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function Yl(t){if(t>65535){t-=65536;let e=55296+(t>>10),i=56320+(t&1023);return String.fromCharCode(e,i)}return String.fromCharCode(t)}var pk=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,i$=/&([a-z#][a-z0-9]{1,31});/gi,r$=new RegExp(pk.source+"|"+i$.source,"gi"),o$=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function s$(t,e){if(e.charCodeAt(0)===35&&o$.test(e)){let n=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Gh(n)?Yl(n):t}let i=Go(t);return i!==t?i:t}function a$(t){return t.indexOf("\\")<0?t:t.replace(pk,"$1")}function lo(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(r$,function(e,i,n){return i||s$(e,n)})}var u$=/[&<>"]/,l$=/[&<>"]/g,c$={"&":"&","<":"<",">":">",'"':"""};function d$(t){return c$[t]}function co(t){return u$.test(t)?t.replace(l$,d$):t}var f$=/[.?*+^$[\]\\(){}|-]/g;function p$(t){return t.replace(f$,"\\$&")}function He(t){switch(t){case 9:case 32:return!0}return!1}function Rs(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Ls(t){return au.test(t)||Vh.test(t)}function Hs(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Bs(t){return t=t.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(t=t.replace(/ẞ/g,"\xDF")),t.toLowerCase().toUpperCase()}var h$={mdurl:Lh,ucmicro:Qb};var l_={};nc(l_,{parseLinkDestination:()=>a_,parseLinkLabel:()=>s_,parseLinkTitle:()=>u_});function s_(t,e,i){let n,r,o,s,a=t.posMax,u=t.pos;for(t.pos=e+1,n=1;t.pos32))return o;if(n===41){if(s===0)break;s--}r++}return e===r||s!==0||(o.str=lo(t.slice(e,r)),o.pos=r,o.ok=!0),o}function u_(t,e,i,n){let r,o=e,s={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)s.str=n.str,s.marker=n.marker;else{if(o>=i)return s;let a=t.charCodeAt(o);if(a!==34&&a!==39&&a!==40)return s;e++,o++,a===40&&(a=41),s.marker=a}for(;o"+co(o.content)+""};Mr.code_block=function(t,e,i,n,r){let o=t[e];return""+co(t[e].content)+` +`));return s.replaceSelectionWith(this.type.create({language:o},u)),s.selection.$from.parent.type!==this.type&&s.setSelection(Dt.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});var $M=X.create({name:"doc",topNode:!0,content:"block+"});function GM(t={}){return new Rt({view(e){return new Ab(e,t)}})}var Ab=class{constructor(e,i){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(n=i.width)!==null&&n!==void 0?n:1,this.color=i.color===!1?void 0:i.color||"black",this.class=i.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let o=s=>{this[r](s)};return e.dom.addEventListener(r,o),{name:r,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:i})=>this.editorView.dom.removeEventListener(e,i))}update(e,i){this.cursorPos!=null&&i.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),i=!e.parent.inlineContent,n;if(i){let a=e.nodeBefore,u=e.nodeAfter;if(a||u){let l=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(l){let c=l.getBoundingClientRect(),f=a?c.bottom:c.top;a&&u&&(f=(f+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),n={left:c.left,right:c.right,top:f-this.width/2,bottom:f+this.width/2}}}}if(!n){let a=this.editorView.coordsAtPos(this.cursorPos);n={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",i),this.element.classList.toggle("prosemirror-dropcursor-inline",!i);let o,s;if(!r||r==document.body&&getComputedStyle(r).position=="static")o=-pageXOffset,s=-pageYOffset;else{let a=r.getBoundingClientRect();o=a.left-r.scrollLeft,s=a.top-r.scrollTop}this.element.style.left=n.left-o+"px",this.element.style.top=n.top-s+"px",this.element.style.width=n.right-n.left+"px",this.element.style.height=n.bottom-n.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let i=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=i&&i.inside>=0&&this.editorView.state.doc.nodeAt(i.inside),r=n&&n.type.spec.disableDropCursor,o=typeof r=="function"?r(this.editorView,i,e):r;if(i&&!o){let s=i.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=m1(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}};var WM=ft.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[GM(this.options)]}});var Tn=class t extends nn{constructor(e){super(e,e)}map(e,i){let n=e.resolve(i.map(this.head));return t.valid(n)?new t(n):nn.near(n)}content(){return Bn.empty}eq(e){return e instanceof t&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,i){if(typeof i.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new t(e.resolve(i.pos))}getBookmark(){return new kb(this.anchor)}static valid(e){let i=e.parent;if(i.isTextblock||!u7(e)||!l7(e))return!1;let n=i.type.spec.allowGapCursor;if(n!=null)return n;let r=i.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,i,n=!1){e:for(;;){if(!n&&t.valid(e))return e;let r=e.pos,o=null;for(let s=e.depth;;s--){let a=e.node(s);if(i>0?e.indexAfter(s)0){o=a.child(i>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=i;let u=e.doc.resolve(r);if(t.valid(u))return u}for(;;){let s=i>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!Nr.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*i),n=!1;continue e}break}o=s,r+=i;let a=e.doc.resolve(r);if(t.valid(a))return a}return null}}};Tn.prototype.visible=!1;Tn.findFrom=Tn.findGapCursorFrom;nn.jsonID("gapcursor",Tn);var kb=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let i=e.resolve(this.pos);return Tn.valid(i)?new Tn(i):nn.near(i)}};function u7(t){for(let e=t.depth;e>=0;e--){let i=t.index(e),n=t.node(e);if(i==0){if(n.type.spec.isolating)return!0;continue}for(let r=n.child(i-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function l7(t){for(let e=t.depth;e>=0;e--){let i=t.indexAfter(e),n=t.node(e);if(i==n.childCount){if(n.type.spec.isolating)return!0;continue}for(let r=n.child(i);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function qM(){return new Rt({props:{decorations:p7,createSelectionBetween(t,e,i){return e.pos==i.pos&&Tn.valid(i)?new Tn(i):null},handleClick:d7,handleKeyDown:c7,handleDOMEvents:{beforeinput:f7}}})}var c7=rc({ArrowLeft:Eh("horiz",-1),ArrowRight:Eh("horiz",1),ArrowUp:Eh("vert",-1),ArrowDown:Eh("vert",1)});function Eh(t,e){let i=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(n,r,o){let s=n.selection,a=e>0?s.$to:s.$from,u=s.empty;if(s instanceof Dt){if(!o.endOfTextblock(i)||a.depth==0)return!1;u=!1,a=n.doc.resolve(e>0?a.after():a.before())}let l=Tn.findGapCursorFrom(a,e,u);return l?(r&&r(n.tr.setSelection(new Tn(l))),!0):!1}}function d7(t,e,i){if(!t||!t.editable)return!1;let n=t.state.doc.resolve(e);if(!Tn.valid(n))return!1;let r=t.posAtCoords({left:i.clientX,top:i.clientY});return r&&r.inside>-1&&Nr.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Tn(n))),!0)}function f7(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Tn))return!1;let{$from:i}=t.state.selection,n=i.parent.contentMatchAt(i.index()).findWrapping(t.state.schema.nodes.text);if(!n)return!1;let r=Bt.empty;for(let s=n.length-1;s>=0;s--)r=Bt.from(n[s].createAndFill(null,r));let o=t.state.tr.replace(i.pos,i.pos,new Bn(r,0,0));return o.setSelection(Dt.near(o.doc.resolve(i.pos+1))),t.dispatch(o),!1}function p7(t){if(!(t.selection instanceof Tn))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Fr.create(t.doc,[Pr.widget(t.selection.head,e,{key:"gapcursor"})])}var ZM=ft.create({name:"gapCursor",addProseMirrorPlugins(){return[qM()]},extendNodeSchema(t){var e;let i={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=sc(oc(t,"allowGapCursor",i)))!==null&&e!==void 0?e:null}}});var KM=X.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ee(this.options.HTMLAttributes,t)]},renderText(){return` +`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:i,editor:n})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:r,storedMarks:o}=i;if(r.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:a}=n.extensionManager,u=o||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:c})=>{if(c&&u&&s){let f=u.filter(p=>a.includes(p.type.name));l.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var YM=X.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ee(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>U(M({},t),{[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>pu({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var wh=200,pn=function(){};pn.prototype.append=function(e){return e.length?(e=pn.from(e),!this.length&&e||e.length=i?pn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,i))};pn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};pn.prototype.forEach=function(e,i,n){i===void 0&&(i=0),n===void 0&&(n=this.length),i<=n?this.forEachInner(e,i,n,0):this.forEachInvertedInner(e,i,n,0)};pn.prototype.map=function(e,i,n){i===void 0&&(i=0),n===void 0&&(n=this.length);var r=[];return this.forEach(function(o,s){return r.push(e(o,s))},i,n),r};pn.from=function(e){return e instanceof pn?e:e&&e.length?new QM(e):pn.empty};var QM=function(t){function e(n){t.call(this),this.values=n}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var i={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,o){return r==0&&o==this.length?this:new e(this.values.slice(r,o))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,o,s,a){for(var u=o;u=s;u--)if(r(this.values[u],a+u)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=wh)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=wh)return new e(r.flatten().concat(this.values))},i.length.get=function(){return this.values.length},i.depth.get=function(){return 0},Object.defineProperties(e.prototype,i),e}(pn);pn.empty=new QM([]);var h7=function(t){function e(i,n){t.call(this),this.left=i,this.right=n,this.length=i.length+n.length,this.depth=Math.max(i.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(n){return na&&this.right.forEachInner(n,Math.max(r-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(n,r,o,s){var a=this.left.length;if(r>a&&this.right.forEachInvertedInner(n,r-a,Math.max(o,a)-a,s+a)===!1||o=o?this.right.slice(n-o,r-o):this.left.slice(n,o).append(this.right.slice(0,r-o))},e.prototype.leafAppend=function(n){var r=this.right.leafAppend(n);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(n){var r=this.left.leafPrepend(n);if(r)return new e(r,this.right)},e.prototype.appendInner=function(n){return this.left.depth>=Math.max(this.right.depth,n.depth)+1?new e(this.left,new e(this.right,n)):new e(this,n)},e}(pn),Ob=pn;var m7=500,Ns=class t{constructor(e,i){this.items=e,this.eventCount=i}popEvent(e,i){if(this.eventCount==0)return null;let n=this.items.length;for(;;n--)if(this.items.get(n-1).selection){--n;break}let r,o;i&&(r=this.remapping(n,this.items.length),o=r.maps.length);let s=e.tr,a,u,l=[],c=[];return this.items.forEach((f,p)=>{if(!f.step){r||(r=this.remapping(n,p+1),o=r.maps.length),o--,c.push(f);return}if(r){c.push(new xr(f.map));let m=f.step.map(r.slice(o)),g;m&&s.maybeStep(m).doc&&(g=s.mapping.maps[s.mapping.maps.length-1],l.push(new xr(g,void 0,void 0,l.length+c.length))),o--,g&&r.appendMap(g,o)}else s.maybeStep(f.step);if(f.selection)return a=r?f.selection.map(r.slice(o)):f.selection,u=new t(this.items.slice(0,n).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:s,selection:a}}addTransform(e,i,n,r){let o=[],s=this.eventCount,a=this.items,u=!r&&a.length?a.get(a.length-1):null;for(let c=0;cy7&&(a=g7(a,l),s-=l),new t(a.append(o),s)}remapping(e,i){let n=new h1;return this.items.forEach((r,o)=>{let s=r.mirrorOffset!=null&&o-r.mirrorOffset>=e?n.maps.length-r.mirrorOffset:void 0;n.appendMap(r.map,s)},e,i),n}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(i=>new xr(i))),this.eventCount)}rebased(e,i){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-i),o=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},r);let u=i;this.items.forEach(p=>{let m=o.getMirror(--u);if(m==null)return;s=Math.min(s,m);let g=o.maps[m];if(p.step){let y=e.steps[m].invert(e.docs[m]),b=p.selection&&p.selection.map(o.slice(u+1,m));b&&a++,n.push(new xr(g,y,b))}else n.push(new xr(g))},r);let l=[];for(let p=i;pm7&&(f=f.compress(this.items.length-n.length)),f}emptyItemCount(){let e=0;return this.items.forEach(i=>{i.step||e++}),e}compress(e=this.items.length){let i=this.remapping(0,e),n=i.maps.length,r=[],o=0;return this.items.forEach((s,a)=>{if(a>=e)r.push(s),s.selection&&o++;else if(s.step){let u=s.step.map(i.slice(n)),l=u&&u.getMap();if(n--,l&&i.appendMap(l,n),u){let c=s.selection&&s.selection.map(i.slice(n));c&&o++;let f=new xr(l.invert(),u,c),p,m=r.length-1;(p=r.length&&r[m].merge(f))?r[m]=p:r.push(f)}}else s.map&&n--},this.items.length,0),new t(Ob.from(r.reverse()),o)}};Ns.empty=new Ns(Ob.empty,0);function g7(t,e){let i;return t.forEach((n,r)=>{if(n.selection&&e--==0)return i=r,!1}),t.slice(i)}var xr=class t{constructor(e,i,n,r){this.map=e,this.step=i,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let i=e.step.merge(this.step);if(i)return new t(i.getMap().invert(),i,this.selection)}}},Ir=class{constructor(e,i,n,r,o){this.done=e,this.undone=i,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}},y7=20;function v7(t,e,i,n){let r=i.getMeta(Os),o;if(r)return r.historyState;i.getMeta(C7)&&(t=new Ir(t.done,t.undone,null,0,-1));let s=i.getMeta("appendedTransaction");if(i.steps.length==0)return t;if(s&&s.getMeta(Os))return s.getMeta(Os).redo?new Ir(t.done.addTransform(i,void 0,n,Th(e)),t.undone,XM(i.mapping.maps),t.prevTime,t.prevComposition):new Ir(t.done,t.undone.addTransform(i,void 0,n,Th(e)),null,t.prevTime,t.prevComposition);if(i.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=i.getMeta("composition"),u=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(i.time||0)-n.newGroupDelay||!b7(i,t.prevRanges)),l=s?Nb(t.prevRanges,i.mapping):XM(i.mapping.maps);return new Ir(t.done.addTransform(i,u?e.selection.getBookmark():void 0,n,Th(e)),Ns.empty,l,i.time,a??t.prevComposition)}else return(o=i.getMeta("rebased"))?new Ir(t.done.rebased(i,o),t.undone.rebased(i,o),Nb(t.prevRanges,i.mapping),t.prevTime,t.prevComposition):new Ir(t.done.addMaps(i.mapping.maps),t.undone.addMaps(i.mapping.maps),Nb(t.prevRanges,i.mapping),t.prevTime,t.prevComposition)}function b7(t,e){if(!e)return!1;if(!t.docChanged)return!0;let i=!1;return t.mapping.maps[0].forEach((n,r)=>{for(let o=0;o=e[o]&&(i=!0)}),i}function XM(t){let e=[];for(let i=t.length-1;i>=0&&e.length==0;i--)t[i].forEach((n,r,o,s)=>e.push(o,s));return e}function Nb(t,e){if(!t)return null;let i=[];for(let n=0;n{let r=Os.getState(i);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(n){let o=_7(r,i,t);o&&n(e?o.scrollIntoView():o)}return!0}}var Fb=xh(!1,!0),Rb=xh(!0,!0),y1e=xh(!1,!1),v1e=xh(!0,!1);var tA=ft.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>Fb(t,e),redo:()=>({state:t,dispatch:e})=>Rb(t,e)}},addProseMirrorPlugins(){return[eA(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var D7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,E7=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,w7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,T7=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,nA=Zt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",ee(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[sr({find:D7,type:this.type}),sr({find:w7,type:this.type})]},addPasteRules(){return[Vn({find:E7,type:this.type}),Vn({find:T7,type:this.type})]}});var iA=X.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ee(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)}}});var x7="listItem",rA="textStyle",oA=/^(\d+)\.\s$/,sA=X.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let n=t,{start:e}=n,i=ho(n,["start"]);return e===1?["ol",ee(this.options.HTMLAttributes,i),0]:["ol",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(x7,this.editor.getAttributes(rA)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ar({find:oA,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ar({find:oA,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>M({start:+e[1]},this.editor.getAttributes(rA)),joinPredicate:(e,i)=>i.childCount+i.attrs.start===+e[1],editor:this.editor})),[t]}});var aA=X.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var uA=ft.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Rt({key:new qt("placeholder"),props:{decorations:({doc:t,selection:e})=>{let i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=e,r=[];if(!i)return null;let o=this.editor.isEmpty;return t.descendants((s,a)=>{let u=n>=a&&n<=a+s.nodeSize,l=!s.isLeaf&&T1(s);if((u||!this.options.showOnlyCurrent)&&l){let c=[this.options.emptyNodeClass];o&&c.push(this.options.emptyEditorClass);let f=Pr.node(a,a+s.nodeSize,{class:c.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:u}):this.options.placeholder});r.push(f)}return this.options.includeChildren}),Fr.create(t,r)}}})]}});var I7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,S7=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,lA=Zt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",ee(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[sr({find:I7,type:this.type})]},addPasteRules(){return[Vn({find:S7,type:this.type})]}});var M7=/^\s*(\[([( |x])?\])\s$/,cA=X.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ee(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?U(M({},t),{Tab:()=>this.editor.commands.sinkListItem(this.name)}):t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:i,editor:n})=>{let r=document.createElement("li"),o=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),u=document.createElement("div");return o.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",l=>l.preventDefault()),a.addEventListener("change",l=>{if(!n.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}let{checked:c}=l.target;n.isEditable&&typeof i=="function"&&n.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{let p=i();if(typeof p!="number")return!1;let m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,U(M({},m==null?void 0:m.attrs),{checked:c})),!0}).run(),!n.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,c)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([l,c])=>{r.setAttribute(l,c)}),r.dataset.checked=t.attrs.checked,t.attrs.checked&&a.setAttribute("checked","checked"),o.append(a,s),r.append(o,u),Object.entries(e).forEach(([l,c])=>{r.setAttribute(l,c)}),{dom:r,contentDOM:u,update:l=>l.type!==this.type?!1:(r.dataset.checked=l.attrs.checked,l.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[ar({find:M7,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}});var dA=X.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",ee(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});var fA=X.create({name:"text",group:"inline"});var pA=ft.create({name:"starterKit",addExtensions(){let t=[],e=this.options;return(e==null?void 0:e.blockquote)!==!1&&t.push(LM.configure(e==null?void 0:e.blockquote)),(e==null?void 0:e.bold)!==!1&&t.push(HM.configure(e==null?void 0:e.bold)),(e==null?void 0:e.bulletList)!==!1&&t.push(zM.configure(e==null?void 0:e.bulletList)),(e==null?void 0:e.code)!==!1&&t.push(jM.configure(e==null?void 0:e.code)),(e==null?void 0:e.codeBlock)!==!1&&t.push(UM.configure(e==null?void 0:e.codeBlock)),(e==null?void 0:e.document)!==!1&&t.push($M.configure(e==null?void 0:e.document)),(e==null?void 0:e.dropcursor)!==!1&&t.push(WM.configure(e==null?void 0:e.dropcursor)),(e==null?void 0:e.gapcursor)!==!1&&t.push(ZM.configure(M({allowGapCursor:!0},(e==null?void 0:e.gapcursor)??{}))),(e==null?void 0:e.hardBreak)!==!1&&t.push(KM.configure(e==null?void 0:e.hardBreak)),(e==null?void 0:e.heading)!==!1&&t.push(YM.configure(M({levels:[1,2,3,4,5,6]},e==null?void 0:e.heading)).extend({addKeyboardShortcuts(){return this.options.levels.reduce((i,n)=>U(M({},i||{}),{[`Mod-Alt-${n}`]:()=>this==null?void 0:this.editor.commands.toggleHeading({level:n})}),{})}})),(e==null?void 0:e.history)!==!1&&t.push(tA.configure(M({depth:100,newGroupDelay:500},e==null?void 0:e.history))),(e==null?void 0:e.horizontalRule)!==!1&&t.push(RM.configure(e==null?void 0:e.horizontalRule)),(e==null?void 0:e.italic)!==!1&&t.push(nA.configure(e==null?void 0:e.italic)),(e==null?void 0:e.listItem)!==!1&&t.push(iA.configure(e==null?void 0:e.listItem)),(e==null?void 0:e.taskList)!==!1&&t.push(dA.configure(e==null?void 0:e.taskList)),(e==null?void 0:e.taskItem)!==!1&&t.push(cA.configure(M({nested:!0},e==null?void 0:e.taskItem))),(e==null?void 0:e.orderedList)!==!1&&t.push(sA.configure(e==null?void 0:e.orderedList)),(e==null?void 0:e.paragraph)!==!1&&t.push(aA.configure(e==null?void 0:e.paragraph)),(e==null?void 0:e.strike)!==!1&&t.push(lA.configure(e==null?void 0:e.strike)),(e==null?void 0:e.text)!==!1&&t.push(fA.configure(e==null?void 0:e.text)),(e==null?void 0:e.placeholder)!==!1&&t.push(uA.configure(M({emptyNodeClass:"t-editor-placeholder",includeChildren:!0,showOnlyCurrent:!0,showOnlyWhenEditable:!0,placeholder:""},(e==null?void 0:e.placeholder)??{}))),(e==null?void 0:e.enter)!==!1&&t.push(PM),t}});var Hb,Bb;if(typeof WeakMap<"u"){let t=new WeakMap;Hb=e=>t.get(e),Bb=(e,i)=>(t.set(e,i),i)}else{let t=[],i=0;Hb=n=>{for(let r=0;r(i==10&&(i=0),t[i++]=n,t[i++]=r)}var Ht=class{constructor(t,e,i,n){this.width=t,this.height=e,this.map=i,this.problems=n}findCell(t){for(let e=0;e=i){(o||(o=[])).push({type:"overlong_rowspan",pos:c,n:D-N});break}let A=r+N*e;for(let V=0;Vn&&(o+=l.attrs.colspan)}}for(let s=0;s1&&(i=!0)}e==-1?e=o:e!=o&&(e=Math.max(e,o))}return e}function O7(t,e,i){t.problems||(t.problems=[]);let n={};for(let r=0;r0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function P7(t){for(let e=t.depth;e>0;e--){let i=t.node(e).type.spec.tableRole;if(i==="cell"||i==="header_cell")return t.node(e)}return null}function nr(t){let e=t.selection.$head;for(let i=e.depth;i>0;i--)if(e.node(i).type.spec.tableRole=="row")return!0;return!1}function Oh(t){let e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;let i=ru(e.$head)||F7(e.$head);if(i)return i;throw new RangeError(`No cell found around position ${e.head}`)}function F7(t){for(let e=t.nodeAfter,i=t.pos;e;e=e.firstChild,i++){let n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(i)}for(let e=t.nodeBefore,i=t.pos;e;e=e.lastChild,i--){let n=e.type.spec.tableRole;if(n=="cell"||n=="header_cell")return t.doc.resolve(i-e.nodeSize)}}function Vb(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function R7(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Ub(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function EA(t,e,i){let n=t.node(-1),r=Ht.get(n),o=t.start(-1),s=r.nextCell(t.pos-o,e,i);return s==null?null:t.node(0).resolve(o+s)}function Ps(t,e,i=1){let n=U(M({},t),{colspan:t.colspan-i});return n.colwidth&&(n.colwidth=n.colwidth.slice(),n.colwidth.splice(e,i),n.colwidth.some(r=>r>0)||(n.colwidth=null)),n}function wA(t,e,i=1){let n=U(M({},t),{colspan:t.colspan+i});if(n.colwidth){n.colwidth=n.colwidth.slice();for(let r=0;rc!=i.pos-o);u.unshift(i.pos-o);let l=u.map(c=>{let f=n.nodeAt(c);if(!f)throw RangeError(`No cell with offset ${c} found`);let p=o+c+1;return new y1(a.resolve(p),a.resolve(p+f.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=i}map(e,i){let n=e.resolve(i.map(this.$anchorCell.pos)),r=e.resolve(i.map(this.$headCell.pos));if(Vb(n)&&Vb(r)&&Ub(n,r)){let o=this.$anchorCell.node(-1)!=n.node(-1);return o&&this.isRowSelection()?ao.rowSelection(n,r):o&&this.isColSelection()?ao.colSelection(n,r):new ao(n,r)}return Dt.between(n,r)}content(){let e=this.$anchorCell.node(-1),i=Ht.get(e),n=this.$anchorCell.start(-1),r=i.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},s=[];for(let u=r.top;u0||b>0){let D=g.attrs;if(y>0&&(D=Ps(D,0,y)),b>0&&(D=Ps(D,D.colspan-b,b)),m.leftr.bottom){let D=U(M({},g.attrs),{rowspan:Math.min(m.bottom,r.bottom)-Math.max(m.top,r.top)});m.top0)return!1;let n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=i+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(e,i=e){let n=e.node(-1),r=Ht.get(n),o=e.start(-1),s=r.findCell(e.pos-o),a=r.findCell(i.pos-o),u=e.node(0);return s.top<=a.top?(s.top>0&&(e=u.resolve(o+r.map[s.left])),a.bottom0&&(i=u.resolve(o+r.map[a.left])),s.bottom0)return!1;let s=r+this.$anchorCell.nodeAfter.attrs.colspan,a=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,a)==i.width}eq(e){return e instanceof ao&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,i=e){let n=e.node(-1),r=Ht.get(n),o=e.start(-1),s=r.findCell(e.pos-o),a=r.findCell(i.pos-o),u=e.node(0);return s.left<=a.left?(s.left>0&&(e=u.resolve(o+r.map[s.top*r.width])),a.right0&&(i=u.resolve(o+r.map[a.top*r.width])),s.right{e.push(Pr.node(n,n+i.nodeSize,{class:"selectedCell"}))}),Fr.create(t.doc,e)}function V7({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(r+1)=0&&!(e.before(o+1)>e.start(o));o--,n--);return i==n&&/row|table/.test(t.node(r).type.spec.tableRole)}function z7({$from:t,$to:e}){let i,n;for(let r=t.depth;r>0;r--){let o=t.node(r);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){i=o;break}}for(let r=e.depth;r>0;r--){let o=e.node(r);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}return i!==n&&e.parentOffset===0}function j7(t,e,i){let n=(e||t).selection,r=(e||t).doc,o,s;if(n instanceof Nr&&(s=n.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")o=vt.create(r,n.from);else if(s=="row"){let a=r.resolve(n.from+1);o=vt.rowSelection(a,a)}else if(!i){let a=Ht.get(n.node),u=n.from+1,l=u+a.map[a.width*a.height-1];o=vt.create(r,u+1,l)}}else n instanceof Dt&&V7(n)?o=Dt.create(r,n.from):n instanceof Dt&&z7(n)&&(o=Dt.create(r,n.$from.start(),n.$from.end()));return o&&(e||(e=t.tr)).setSelection(o),e}var U7=new qt("fix-tables");function xA(t,e,i,n){let r=t.childCount,o=e.childCount;e:for(let s=0,a=0;s{r.type.spec.tableRole=="table"&&(i=$7(t,r,o,i))};return e?e.doc!=t.doc&&xA(e.doc,t.doc,0,n):t.doc.descendants(n),i}function $7(t,e,i,n){let r=Ht.get(e);if(!r.problems)return n;n||(n=t.tr);let o=[];for(let u=0;u0){let m="cell";c.firstChild&&(m=c.firstChild.type.spec.tableRole);let g=[];for(let b=0;b0?-1:0;L7(e,n,r+o)&&(o=r==0||r==e.width?null:0);for(let s=0;s0&&r0&&e.map[a-1]==u||r0?-1:0;W7(e,n,r+u)&&(u=r==0||r==e.height?null:0);for(let l=0,c=e.width*r;l0&&r0&&f==e.map[c-e.width]){let p=i.nodeAt(f).attrs;t.setNodeMarkup(t.mapping.slice(a).map(f+n),null,U(M({},p),{rowspan:p.rowspan-1})),l+=p.colspan-1}else if(r0&&i[o]==i[o-1]||n.right0&&i[r]==i[r-t]||n.bottomi[n.type.spec.tableRole])(t,e)}function K7(t){return(e,i)=>{var n;let r=e.selection,o,s;if(r instanceof vt){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{if(o=P7(r.$from),!o)return!1;s=(n=ru(r.$from))==null?void 0:n.pos}if(o==null||s==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(i){let a=o.attrs,u=[],l=a.colwidth;a.rowspan>1&&(a=U(M({},a),{rowspan:1})),a.colspan>1&&(a=U(M({},a),{colspan:1}));let c=Sr(e),f=e.tr;for(let m=0;m{s.attrs[t]!==e&&o.setNodeMarkup(a,null,U(M({},s.attrs),{[t]:e}))}):o.setNodeMarkup(r.pos,null,U(M({},r.nodeAfter.attrs),{[t]:e})),n(o)}return!0}}function Y7(t){return function(e,i){if(!nr(e))return!1;if(i){let n=xn(e.schema),r=Sr(e),o=e.tr,s=r.map.cellsInRect(t=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:t=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),a=s.map(u=>r.table.nodeAt(u));for(let u=0;u{let g=m+o.tableStart,y=s.doc.nodeAt(g);y&&s.setNodeMarkup(g,p,y.attrs)}),n(s)}return!0}}var MCe=ou("row",{useDeprecatedLogic:!0}),ACe=ou("column",{useDeprecatedLogic:!0}),RA=ou("cell",{useDeprecatedLogic:!0});function Q7(t,e){if(e<0){let i=t.nodeBefore;if(i)return t.pos-i.nodeSize;for(let n=t.index(-1)-1,r=t.before();n>=0;n--){let o=t.node(-1).child(n),s=o.lastChild;if(s)return r-1-s.nodeSize;r-=o.nodeSize}}else{if(t.index()0;n--)if(i.node(n).type.spec.tableRole=="table")return e&&e(t.tr.delete(i.before(n),i.after(n)).scrollIntoView()),!0;return!1}function Ih(t,e){let i=t.selection;if(!(i instanceof vt))return!1;if(e){let n=t.tr,r=xn(t.schema).cell.createAndFill().content;i.forEachCell((o,s)=>{o.content.eq(r)||n.replace(n.mapping.map(s+1),n.mapping.map(s+o.nodeSize-1),new Bn(r,0,0))}),n.docChanged&&e(n)}return!0}function X7(t){if(!t.size)return null;let{content:e,openStart:i,openEnd:n}=t;for(;e.childCount==1&&(i>0&&n>0||e.child(0).type.spec.tableRole=="table");)i--,n--,e=e.child(0).content;let r=e.child(0),o=r.type.spec.tableRole,s=r.type.schema,a=[];if(o=="row")for(let u=0;u=0;s--){let{rowspan:a,colspan:u}=o.child(s).attrs;for(let l=r;l=e.length&&e.push(Bt.empty),i[r]n&&(p=p.type.createChecked(Ps(p.attrs,p.attrs.colspan,c+p.attrs.colspan-n),p.content)),l.push(p),c+=p.attrs.colspan;for(let m=1;mr&&(f=f.type.create(U(M({},f.attrs),{rowspan:Math.max(1,r-f.attrs.rowspan)}),f.content)),u.push(f)}o.push(Bt.from(u))}i=o,e=r}return{width:t,height:e,rows:i}}function tU(t,e,i,n,r,o,s){let a=t.doc.type.schema,u=xn(a),l,c;if(r>e.width)for(let f=0,p=0;fe.height){let f=[];for(let g=0,y=(e.height-1)*e.width;g=e.width?!1:i.nodeAt(e.map[y+g]).type==u.header_cell;f.push(b?c||(c=u.header_cell.createAndFill()):l||(l=u.cell.createAndFill()))}let p=u.row.create(null,Bt.from(f)),m=[];for(let g=e.height;g{if(!r)return!1;let o=i.selection;if(o instanceof vt)return Ah(i,n,nn.near(o.$headCell,e));if(t!="horiz"&&!o.empty)return!1;let s=HA(r,t,e);if(s==null)return!1;if(t=="horiz")return Ah(i,n,nn.near(i.doc.resolve(o.head+e),e));{let a=i.doc.resolve(s),u=EA(a,t,e),l;return u?l=nn.near(u,1):e<0?l=nn.near(i.doc.resolve(a.before(-1)),-1):l=nn.near(i.doc.resolve(a.after(-1)),1),Ah(i,n,l)}}}function Mh(t,e){return(i,n,r)=>{if(!r)return!1;let o=i.selection,s;if(o instanceof vt)s=o;else{let u=HA(r,t,e);if(u==null)return!1;s=new vt(i.doc.resolve(u))}let a=EA(s.$headCell,t,e);return a?Ah(i,n,new vt(s.$anchorCell,a)):!1}}function iU(t,e){let i=t.state.doc,n=ru(i.resolve(e));return n?(t.dispatch(t.state.tr.setSelection(new vt(n))),!0):!1}function rU(t,e,i){if(!nr(t.state))return!1;let n=X7(i),r=t.state.selection;if(r instanceof vt){n||(n={width:1,height:1,rows:[Bt.from(zb(xn(t.state.schema).cell,i))]});let o=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),a=Ht.get(o).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return n=eU(n,a.right-a.left,a.bottom-a.top),vA(t.state,t.dispatch,s,a,n),!0}else if(n){let o=Oh(t.state),s=o.start(-1);return vA(t.state,t.dispatch,s,Ht.get(o.node(-1)).findCell(o.pos-s),n),!0}else return!1}function oU(t,e){var i;if(e.ctrlKey||e.metaKey)return;let n=bA(t,e.target),r;if(e.shiftKey&&t.state.selection instanceof vt)o(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&n&&(r=ru(t.state.selection.$anchor))!=null&&((i=Lb(t,e))==null?void 0:i.pos)!=r.pos)o(r,e),e.preventDefault();else if(!n)return;function o(u,l){let c=Lb(t,l),f=$o.getState(t.state)==null;if(!c||!Ub(u,c))if(f)c=u;else return;let p=new vt(u,c);if(f||!t.state.selection.eq(p)){let m=t.state.tr.setSelection(p);f&&m.setMeta($o,u.pos),t.dispatch(m)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),$o.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta($o,-1))}function a(u){let l=u,c=$o.getState(t.state),f;if(c!=null)f=t.state.doc.resolve(c);else if(bA(t,l.target)!=n&&(f=Lb(t,e),!f))return s();f&&o(f,l)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function HA(t,e,i){if(!(t.state.selection instanceof Dt))return null;let{$head:n}=t.state.selection;for(let r=n.depth-1;r>=0;r--){let o=n.node(r);if((i<0?n.index(r):n.indexAfter(r))!=(i<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){let a=n.before(r),u=e=="vert"?i>0?"down":"up":i>0?"right":"left";return t.endOfTextblock(u)?a:null}}return null}function bA(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Lb(t,e){let i=t.posAtCoords({left:e.clientX,top:e.clientY});return i&&i?ru(t.state.doc.resolve(i.pos)):null}var sU=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),jb(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,jb(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function jb(t,e,i,n,r,o){var s;let a=0,u=!0,l=e.firstChild,c=t.firstChild;if(c){for(let f=0,p=0;fnew n(p,i,m)),new aU(-1,!1)},apply(s,a){return a.apply(s)}},props:{attributes:s=>{let a=fi.getState(s);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,a)=>{uU(s,a,t,r)},mouseleave:s=>{lU(s)},mousedown:(s,a)=>{cU(s,a,e,i)}},decorations:s=>{let a=fi.getState(s);if(a&&a.activeHandle>-1)return mU(s,a.activeHandle)},nodeViews:{}}});return o}var aU=class kh{constructor(e,i){this.activeHandle=e,this.dragging=i}apply(e){let i=this,n=e.getMeta(fi);if(n&&n.setHandle!=null)return new kh(n.setHandle,!1);if(n&&n.setDragging!==void 0)return new kh(i.activeHandle,n.setDragging);if(i.activeHandle>-1&&e.docChanged){let r=e.mapping.map(i.activeHandle,-1);return Vb(e.doc.resolve(r))||(r=-1),new kh(r,i.dragging)}return i}};function uU(t,e,i,n){let r=fi.getState(t.state);if(r&&!r.dragging){let o=fU(e.target),s=-1;if(o){let{left:a,right:u}=o.getBoundingClientRect();e.clientX-a<=i?s=_A(t,e,"left",i):u-e.clientX<=i&&(s=_A(t,e,"right",i))}if(s!=r.activeHandle){if(!n&&s!==-1){let a=t.state.doc.resolve(s),u=a.node(-1),l=Ht.get(u),c=a.start(-1);if(l.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==l.width-1)return}VA(t,s)}}}function lU(t){let e=fi.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&VA(t,-1)}function cU(t,e,i,n){var r;let o=(r=t.dom.ownerDocument.defaultView)!=null?r:window,s=fi.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let a=t.state.doc.nodeAt(s.activeHandle),u=dU(t,s.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(fi,{setDragging:{startX:e.clientX,startWidth:u}}));function l(f){o.removeEventListener("mouseup",l),o.removeEventListener("mousemove",c);let p=fi.getState(t.state);p!=null&&p.dragging&&(pU(t,p.activeHandle,CA(p.dragging,f,i)),t.dispatch(t.state.tr.setMeta(fi,{setDragging:null})))}function c(f){if(!f.which)return l(f);let p=fi.getState(t.state);if(p&&p.dragging){let m=CA(p.dragging,f,i);DA(t,p.activeHandle,m,n)}}return DA(t,s.activeHandle,u,n),o.addEventListener("mouseup",l),o.addEventListener("mousemove",c),e.preventDefault(),!0}function dU(t,e,{colspan:i,colwidth:n}){let r=n&&n[n.length-1];if(r)return r;let o=t.domAtPos(e),a=o.node.childNodes[o.offset].offsetWidth,u=i;if(n)for(let l=0;l{let n=t.nodes[i];n.spec.tableRole&&(e[n.spec.tableRole]=n)}),t.cached.tableNodeTypes=e,e}function yU(t,e,i,n,r){let o=gU(t),s=[],a=[];for(let l=0;l{let{selection:e}=t.state;if(!vU(e))return!1;let i=0,n=C1(e.ranges[0].$from,o=>o.type.name==="table");return n==null||n.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(i+=1)}),i===e.ranges.length?(t.commands.deleteTable(),!0):!1},$A=X.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Kb,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:i,tableWidth:n,tableMinWidth:r}=Yb(t,this.options.cellMinWidth);return["table",ee(this.options.HTMLAttributes,e,{style:n?`width: ${n}`:`min-width: ${r}`}),i,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:i=!0}={})=>({tr:n,dispatch:r,editor:o})=>{let s=yU(o.schema,t,e,i);if(r){let a=n.selection.from+1;n.replaceSelectionWith(s).scrollIntoView().setSelection(Dt.near(n.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>SA(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>MA(t,e),deleteColumn:()=>({state:t,dispatch:e})=>AA(t,e),addRowBefore:()=>({state:t,dispatch:e})=>OA(t,e),addRowAfter:()=>({state:t,dispatch:e})=>NA(t,e),deleteRow:()=>({state:t,dispatch:e})=>PA(t,e),deleteTable:()=>({state:t,dispatch:e})=>LA(t,e),mergeCells:()=>({state:t,dispatch:e})=>Gb(t,e),splitCell:()=>({state:t,dispatch:e})=>Wb(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ou("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ou("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>RA(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>Gb(t,e)?!0:Wb(t,e),setCellAttribute:(t,e)=>({state:i,dispatch:n})=>FA(t,e)(i,n),goToNextCell:()=>({state:t,dispatch:e})=>qb(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>qb(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&$b(t),!0),setCellSelection:t=>({tr:e,dispatch:i})=>{if(i){let n=vt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(n)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Nh,"Mod-Backspace":Nh,Delete:Nh,"Mod-Delete":Nh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[BA({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zA({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:sc(oc(t,"tableRole",e))}}});var GA=$A.extend({renderHTML({node:t,HTMLAttributes:e}){let{colgroup:i,tableWidth:n,tableMinWidth:r}=Yb(t,this.options.cellMinWidth);return["div",{class:"tui-table-wrapper"},["table",ee(this.options.HTMLAttributes,e,{style:n?`width: ${n}`:`min-width: ${r}`}),i,["tbody",0]]]}}).configure({resizable:!0,lastColumnResizable:!1,allowTableNodeSelection:!0}).extend();var WA=X.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{let e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ee(this.options.HTMLAttributes,t),0]}});var qA=WA.extend({renderHTML({HTMLAttributes:t}){let e=ee(this.options.HTMLAttributes,t);return e.colwidth&&(e.style=`width: ${e.colwidth}px; ${e.style}`),["td",e,0]}});var ZA=ft.create({addGlobalAttributes(){return[{types:["tableCell","tableHeader"],attributes:{background:{default:null,renderHTML:({background:t})=>t?{style:`background: ${t}`}:null,parseHTML:({style:t})=>t.background,keepOnSplit:!1}}}]},addCommands(){return{setCellBackground:t=>({chain:e})=>e().updateAttributes("tableCell",{background:t}).updateAttributes("tableHeader",{background:t}).run(),unsetCellBackground:()=>({chain:t})=>t().updateAttributes("tableCell",{background:null}).updateAttributes("tableHeader",{background:null}).run()}}});var pDe=[pA.configure({heading:{levels:[1,2,3,4,5,6]}}),import("./chunk-2XGFYKVF.js").then(({TextAlign:t})=>t.configure({types:["heading","paragraph"]})),import("./chunk-JDI2UT5H.js").then(({TextStyle:t})=>t),import("./chunk-7CIXT6MF.js").then(({Underline:t})=>t),import("./chunk-Y6SZONBD.js").then(({Subscript:t})=>t),import("./chunk-XNKC27B3.js").then(({Superscript:t})=>t),pM,NM,gM,fM,uM,GA.configure({resizable:!0}),qA,import("./chunk-AYGGSTQW.js").then(({TableRow:t})=>t),import("./chunk-AM4XYVK2.js").then(({TableHeader:t})=>t),mM,ZA,cM,lM,dM,hM];var bU={groupNodeClass:"tui-group-node",groupPointerNodeClass:"tui-group-pointer",nested:!0,draggable:!0,createOnEnter:!1},yDe=(t={})=>{let{draggable:e,nested:i,groupNodeClass:n,groupPointerNodeClass:r,createOnEnter:o}=M(M({},bU),t);return X.create({name:"group",draggable:e,group:"block",content:i?"block+":"block",addAttributes(){return{style:{default:null,parseHTML:s=>s.getAttribute("style"),renderHTML:s=>s.style?{style:s.style}:{}}}},parseHTML(){return[{tag:'div[data-type="group"]'}]},renderHTML({HTMLAttributes:s}){return["div",ee(s,{"data-type":"group"}),0]},addNodeView(){return({HTMLAttributes:s,node:a})=>{if(globalThis.document){let u=document.createElement("div"),l=document.createElement("div");if(u.classList.add(n),l.setAttribute("data-type","group"),s.style&&(a.attrs.style=s.style,l.setAttribute("style",s.style)),e){let c=document.createElement("div");c.classList.add(r),c.innerHTML="",c.contentEditable="false",u.append(c,l)}else u.append(l);return{dom:u,contentDOM:l}}return null}},addCommands(){return{setGroup:()=>({commands:s,state:a})=>{this.editor.chain().focus().run();let u=Fp(a,""),c=`
          ${u.trim().startsWith("

          ")?u:`

          ${u}

          `}
          `;return s.insertContent(c)},setGroupHilite:s=>({editor:a})=>{let u=a.state.selection.$anchor;for(let l=u.depth;l>0;l--){u=a.state.selection.$anchor;let c=u.node(l);if(c.type.name===this.name){setTimeout(()=>a.commands.updateAttributes(c.type,{style:`background: ${s}`}));break}}return!0},removeGroup:()=>({state:s,dispatch:a})=>Pp(s,a,this.name)}},addKeyboardShortcuts(){return o?{Enter:this.editor.commands.setGroup}:{}}})};var _U=new k("[TUI_IFRAME_EDITOR_OPTIONS]",{factory:()=>({minWidth:100,maxWidth:1/0,minHeight:100,maxHeight:1/0})}),CU=(()=>{let e=class e extends Up{constructor(){super(...arguments),this.sanitizer=h(ws),this.el=h(de),this.options=h(_U),this.changeDetector=h(st)}updateSize([n,r]){this.currentWidth=Math.max(this.options.minWidth,Math.min(this.options.maxWidth,n)),this.currentHeight=Math.max(this.options.minHeight,Math.min(this.options.maxHeight,r)),this.attrs.width=this.currentWidth,this.attrs.height=this.currentHeight,this.el.nativeElement.dispatchEvent(new CustomEvent(Lo,{bubbles:!0}))}get src(){return this.sanitizer.bypassSecurityTrustResourceUrl(this.attrs.src??"")}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-iframe-editor"]],features:[oe],decls:2,vars:13,consts:[[3,"sizeChange","height","width"],["alt","",3,"height","src","width"]],template:function(r,o){r&1&&(E(0,"tui-editor-resizable",0),x("sizeChange",function(a){return o.updateSize(a)}),Q(1,"iframe",1),w()),r&2&&(v("height",o.height)("width",o.width),C(),Ye("max-height",o.options.maxHeight)("max-width",o.options.maxWidth)("min-height",o.options.minHeight)("min-width",o.options.minWidth),v("height",o.height)("src",o.src,GE)("width",o.width))},dependencies:[$p],styles:["iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}"],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"src",null),t})(),ADe=({injector:t})=>X.create({name:"iframe",group:"block",atom:!0,draggable:!1,parseHTML(){return[{tag:"iframe"}]},addAttributes(){return{src:{default:null,keepOnSplit:!1,parseHTML:e=>e.getAttribute("src")},frameborder:{default:0,keepOnSplit:!1,parseHTML:e=>e.getAttribute("frameborder")},width:{default:"100%",keepOnSplit:!1,parseHTML:e=>e.getAttribute("width")},height:{default:null,keepOnSplit:!1,parseHTML:e=>e.getAttribute("height")},allowfullscreen:{keepOnSplit:!1,default:this.options.allowFullscreen,parseHTML:e=>e.getAttribute("allowfullscreen")}}},renderHTML({HTMLAttributes:e}){return["iframe",ee(e,{"data-type":"iframe-editor"})]},addNodeView(){return e=>new tu(CU,e,M({injector:t},e))},addCommands(){return{setIframe:e=>({commands:i,state:n})=>{let r=n.selection.anchor;return i.enter(),i.setTextSelection(r),i.insertContent({type:this.name,attrs:e}),i.setTextSelection(n.selection.anchor),!0}}}});var DU=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,KA=X.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ee(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[uc({find:DU,type:this.type,getAttributes:t=>{let[,,e,i,n]=t;return{src:i,alt:e,title:n}}})]}});var EU=["resizable"],wU=["dropdown"];function TU(t,e){if(t&1){let i=q();E(0,"tui-image-align",7),x("updateAlignStyles",function(r){P(i);let o=_();return o.align(r),F(o.open=!1)}),w()}if(t&2){let i=_();ey(i.style)}}var xU=new k("[TUI_IMAGE_EDITOR_OPTIONS]",{factory:()=>({minWidth:null,maxWidth:1/0})}),IU=(()=>{let e=class e extends Ii{constructor(){super(...arguments),this.el=h(de),this.type="dropdown"}getPosition({width:n,height:r}){let{right:o,top:s}=this.el.nativeElement.getBoundingClientRect();return[s+r+5,o-n/2]}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275dir=T({type:e,selectors:[["","tuiImageOptionsPosition",""]],features:[Z([Iv(e)]),oe]});let t=e;return t})(),SU=(()=>{let e=class e{constructor(){this.options=h(xe),this.style=null,this.updateAlignStyles=new _e}isAlignCenter(n){var r;return((r=n==null?void 0:n.replace(/\s/g,""))==null?void 0:r.includes("justify-content:center"))??!1}isAlignJustify(n){return n==null||n===""}isAlignLeft(n){var r;return((r=n==null?void 0:n.replace(/\s/g,""))==null?void 0:r.includes("float:left"))??!1}isAlignRight(n){var r;return((r=n==null?void 0:n.replace(/\s/g,""))==null?void 0:r.includes("float:right"))??!1}alignLeft(){this.updateAlignStyles.emit("float: left")}alignCenter(){this.updateAlignStyles.emit("display: flex; justify-content: center; margin-left: auto; margin-right: auto;")}alignJustify(){this.updateAlignStyles.emit(null)}alignRight(){this.updateAlignStyles.emit("float: right")}};e.\u0275fac=function(r){return new(r||e)},e.\u0275cmp=H({type:e,selectors:[["tui-image-align"]],inputs:{style:"style"},outputs:{updateAlignStyles:"updateAlignStyles"},decls:9,vars:8,consts:[[1,"t-align-list"],["size","s","title","","tuiIconButton","","type","button",3,"click.capture","appearance","iconStart"],["size","s","tuiIconButton","","type","button",3,"click.capture","appearance","iconStart"]],template:function(r,o){r&1&&(E(0,"div",0)(1,"button",1),x("click.capture",function(){return o.alignJustify()}),he(2," Justify align "),w(),E(3,"button",2),x("click.capture",function(){return o.alignLeft()}),he(4," Left align "),w(),E(5,"button",2),x("click.capture",function(){return o.alignCenter()}),he(6," Center align "),w(),E(7,"button",2),x("click.capture",function(){return o.alignRight()}),he(8," Right align "),w()()),r&2&&(C(),v("appearance",o.isAlignJustify(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignJustify),C(2),v("appearance",o.isAlignLeft(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignLeft),C(2),v("appearance",o.isAlignCenter(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignCenter),C(2),v("appearance",o.isAlignRight(o.style)?"outline":"flat")("iconStart",o.options.icons.imageExtension.alignRight))},dependencies:[Le],styles:[".t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"isAlignCenter",null),Ot([Ft],t.prototype,"isAlignJustify",null),Ot([Ft],t.prototype,"isAlignLeft",null),Ot([Ft],t.prototype,"isAlignRight",null),t})(),MU=(()=>{let e=class e extends Up{constructor(){super(...arguments),this.sanitizer=h(ws),this.el=h(de),this.win=h(Je),this.destroyRef=h(it),this.style=null,this.contenteditable=!1,this.focused=!1,this.open=!1,this.options=h(xe),this.imageOptions=h(xU),this.changeDetector=h(st)}get height(){return null}get minWidth(){return this.imageOptions.minWidth??0}get maxWidth(){return this.imageOptions.maxWidth??0}ngOnInit(){this.style=this.attrs.style}ngAfterViewInit(){this.minWidth>0&&this.updateMinWidth()}updateSize([n]){this.currentWidth=Math.max(this.minWidth,Math.min(this.maxWidth,n)),this.attrs.width=this.currentWidth,this.notifyUpdate()}get dragHandle(){return this.attrs.draggable??null}get alt(){return this.attrs.alt??""}get title(){return this.attrs.title??""}getBypassedSrc(n){return this.sanitizer.bypassSecurityTrustResourceUrl(n)}currentTargetIsFocused(n){var r;this.focused=this.el.nativeElement.contains(n),this.focused?this.selectFakeText():(this.open=!1,(r=this.dropdown)==null||r.toggle(!1))}openDropdown(n){var r;this.open=!0,(r=this.dropdown)==null||r.toggle(!0),n.stopImmediatePropagation()}align(n){this.style=n,this.attrs.style=n,this.notifyUpdate()}selectFakeText(){var n,r,o;if(this.win.document){let s=this.win.document.createRange();(n=this.el.nativeElement.querySelector("p"))==null||n.focus(),s.selectNode(this.el.nativeElement),(r=this.win.getSelection())==null||r.removeAllRanges(),(o=this.win.getSelection())==null||o.addRange(s)}}updateMinWidth(){gt(100).pipe(Se(this.destroyRef)).subscribe(()=>{var r,o,s,a;let n=((s=(o=(r=this.resizable)==null?void 0:r.container)==null?void 0:o.nativeElement.querySelector("img"))==null?void 0:s.naturalWidth)??((a=this.resizable)==null?void 0:a.width)??this.attrs.width??0;this.minWidth>parseInt(n,10)&&this.updateSize([this.minWidth])})}notifyUpdate(){this.el.nativeElement.dispatchEvent(new CustomEvent(Lo,{bubbles:!0}))}};e.\u0275fac=(()=>{let n;return function(o){return(n||(n=re(e)))(o||e)}})(),e.\u0275cmp=H({type:e,selectors:[["tui-image-editor"]],viewQuery:function(r,o){if(r&1&&(Gt(EU,7),Gt(wU,7)),r&2){let s;Qe(s=Xe())&&(o.resizable=s.first),Qe(s=Xe())&&(o.dropdown=s.first)}},hostVars:4,hostBindings:function(r,o){r&1&&x("click.silent",function(a){return o.currentTargetIsFocused(a.target)},!1,Nn),r&2&&(Ke("data-drag-handle",o.dragHandle)("contenteditable",o.contenteditable),ey(o.style))},features:[oe],decls:9,vars:17,consts:[["dropdown","tuiDropdown"],["resizable",""],["imgOptions",""],["tuiImageOptionsPosition","",1,"t-hosted",3,"tuiDropdown","tuiDropdownOpen"],["appearance","","size","s","tuiIconButton","","type","button",1,"t-image-options",3,"click.capture.prevent","iconStart"],[3,"sizeChange","autoHeight","width"],["contenteditable","false","decoding","async","loading","lazy",3,"alt","src","title"],[3,"updateAlignStyles"]],template:function(r,o){if(r&1){let s=q();E(0,"div",3,0)(2,"button",4),x("click.capture.prevent",function(u){return P(s),F(o.openDropdown(u))}),he(3," Image settings "),w(),E(4,"tui-editor-resizable",5,1),x("sizeChange",function(u){return P(s),F(o.updateSize(u))}),Q(6,"img",6),w()(),O(7,TU,1,2,"ng-template",null,2,We)}if(r&2){let s=be(8);v("tuiDropdown",s)("tuiDropdownOpen",o.open),C(2),Te("_open",o.open),v("iconStart",o.options.icons.imageExtension.settings),C(2),v("autoHeight",!0)("width",o.width),C(2),Ye("max-width",o.maxWidth,"px")("min-width",o.minWidth,"px"),Te("ProseMirror-selectednode",o.focused),v("alt",o.alt)("src",o.getBypassedSrc(o.attrs.src),Kd)("title",o.title),Ke("width",o.width)}},dependencies:[Le,Ze,Tt,$p,SU,IU],styles:["[_nghost-%COMP%]{display:inline-block}[data-drag-handle][_nghost-%COMP%]{cursor:move}[_nghost-%COMP%]:hover .t-image-options[_ngcontent-%COMP%]{opacity:1}img[_ngcontent-%COMP%]{pointer-events:none}.t-hosted[_ngcontent-%COMP%]{position:relative}.t-image-options[_ngcontent-%COMP%]{position:absolute;top:.625rem;right:.625rem;z-index:1;background:var(--tui-background-base)}.t-image-options[_ngcontent-%COMP%]:not(._open){transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}.t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0});let t=e;return Ot([Ft],t.prototype,"getBypassedSrc",null),t})();function YA(t){return(e,i)=>{let n=i instanceof DragEvent?i.dataTransfer:i.clipboardData,r=Array.from((n==null?void 0:n.files)??[]).filter(s=>/image/i.test(s.type));r.length&&i.preventDefault();let o=t.get(hp);r.forEach(s=>{o(s).pipe($t(1),go(()=>!e.isDestroyed)).subscribe(a=>{var c;let u=(c=e.state.schema.nodes.image)==null?void 0:c.create({src:a}),l=u?e.state.tr.replaceSelectionWith(u):null;setTimeout==null||setTimeout(()=>{!e.isDestroyed&&l&&e.dispatch(l)})})})}}function AU({injector:t,draggable:e}){let i=si(e)?e:!0;return KA.extend({name:"image",group:"inline",inline:!0,priority:0,selectable:!0,draggable:i,parseHTML(){return[{tag:"img"}]},addAttributes(){return{src:{default:"",keepOnSplit:!1},width:{default:null,keepOnSplit:!1},alt:{default:"",keepOnSplit:!1},style:{default:"",keepOnSplit:!1},title:{default:"",keepOnSplit:!1},draggable:{default:i?"":null,keepOnSplit:!1}}},renderHTML({HTMLAttributes:n}){return["img",ee(n)]},addNodeView(){return n=>new tu(MU,n,M({injector:t},n))},addCommands(){return{setEditableImage:n=>({commands:r})=>r.insertContent({type:this.name,attrs:n})}},addProseMirrorPlugins(){return[new Rt({props:{handleDOMEvents:{paste:YA(t),drop:YA(t)}}})]}})}var nEe=AU;var o_={};nc(o_,{arrayReplaceAt:()=>r_,assign:()=>uu,escapeHtml:()=>co,escapeRE:()=>p$,fromCodePoint:()=>Yl,has:()=>n$,isMdAsciiPunct:()=>Hs,isPunctChar:()=>Ls,isSpace:()=>He,isString:()=>Gh,isValidEntityCode:()=>Wh,isWhiteSpace:()=>Rs,lib:()=>h$,normalizeReference:()=>Bs,unescapeAll:()=>lo,unescapeMd:()=>a$});var Hh={};nc(Hh,{decode:()=>Zl,encode:()=>Rh,format:()=>su,parse:()=>Kl});var QA={};function kU(t){let e=QA[t];if(e)return e;e=QA[t]=[];for(let i=0;i<128;i++){let n=String.fromCharCode(i);e.push(n)}for(let i=0;i=55296&&c<=57343?r+="\uFFFD\uFFFD\uFFFD":r+=String.fromCharCode(c),o+=6;continue}}if((a&248)===240&&o+91114111?r+="\uFFFD\uFFFD\uFFFD\uFFFD":(f-=65536,r+=String.fromCharCode(55296+(f>>10),56320+(f&1023))),o+=9;continue}}r+="\uFFFD"}return r})}Ph.defaultChars=";/?:@&=+$,#";Ph.componentChars="";var Zl=Ph;var XA={};function OU(t){let e=XA[t];if(e)return e;e=XA[t]=[];for(let i=0;i<128;i++){let n=String.fromCharCode(i);/^[0-9a-z]$/i.test(n)?e.push(n):e.push("%"+("0"+i.toString(16).toUpperCase()).slice(-2))}for(let i=0;i"u"&&(i=!0);let n=OU(e),r="";for(let o=0,s=t.length;o=55296&&a<=57343){if(a>=55296&&a<=56319&&o+1=56320&&u<=57343){r+=encodeURIComponent(t[o]+t[o+1]),o++;continue}}r+="%EF%BF%BD";continue}r+=encodeURIComponent(t[o])}return r}Fh.defaultChars=";/?:@&=+$,-_.!~*'()#";Fh.componentChars="-_.!~*'()";var Rh=Fh;function su(t){let e="";return e+=t.protocol||"",e+=t.slashes?"//":"",e+=t.auth?t.auth+"@":"",t.hostname&&t.hostname.indexOf(":")!==-1?e+="["+t.hostname+"]":e+=t.hostname||"",e+=t.port?":"+t.port:"",e+=t.pathname||"",e+=t.search||"",e+=t.hash||"",e}function Lh(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var NU=/^([a-z0-9.+-]+:)/i,PU=/:[0-9]*$/,FU=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,RU=["<",">",'"',"`"," ","\r",` +`," "],LU=["{","}","|","\\","^","`"].concat(RU),HU=["'"].concat(LU),JA=["%","/","?",";","#"].concat(HU),ek=["/","?","#"],BU=255,tk=/^[+a-z0-9A-Z_-]{0,63}$/,VU=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,nk={javascript:!0,"javascript:":!0},ik={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function zU(t,e){if(t&&t instanceof Lh)return t;let i=new Lh;return i.parse(t,e),i}Lh.prototype.parse=function(t,e){let i,n,r,o=t;if(o=o.trim(),!e&&t.split("#").length===1){let l=FU.exec(o);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let s=NU.exec(o);if(s&&(s=s[0],i=s.toLowerCase(),this.protocol=s,o=o.substr(s.length)),(e||s||o.match(/^\/\/[^@\/]+@[^@\/]+/))&&(r=o.substr(0,2)==="//",r&&!(s&&nk[s])&&(o=o.substr(2),this.slashes=!0)),!nk[s]&&(r||s&&!ik[s])){let l=-1;for(let g=0;g127?I+="x":I+=D[N];if(!I.match(tk)){let N=g.slice(0,y),A=g.slice(y+1),V=D.match(VU);V&&(N.push(V[1]),A.unshift(V[2])),A.length&&(o=A.join(".")+o),this.hostname=N.join(".");break}}}}this.hostname.length>BU&&(this.hostname=""),m&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let a=o.indexOf("#");a!==-1&&(this.hash=o.substr(a),o=o.slice(0,a));let u=o.indexOf("?");return u!==-1&&(this.search=o.substr(u),o=o.slice(0,u)),o&&(this.pathname=o),ik[i]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Lh.prototype.parseHost=function(t){let e=PU.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var Kl=zU;var Qb={};nc(Qb,{Any:()=>Bh,Cc:()=>Vh,Cf:()=>rk,P:()=>au,S:()=>zh,Z:()=>jh});var Bh=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;var Vh=/[\0-\x1F\x7F-\x9F]/;var rk=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/;var au=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\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+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\u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DD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/;var jh=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var ok=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(t=>t.charCodeAt(0)));var sk=new Uint16Array("\u0200aglq \x1B\u026D\0\0p;\u4026os;\u4027t;\u403Et;\u403Cuot;\u4022".split("").map(t=>t.charCodeAt(0)));var Xb,jU=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),Jb=(Xb=String.fromCodePoint)!==null&&Xb!==void 0?Xb:function(t){let e="";return t>65535&&(t-=65536,e+=String.fromCharCode(t>>>10&1023|55296),t=56320|t&1023),e+=String.fromCharCode(t),e};function e_(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=jU.get(t))!==null&&e!==void 0?e:t}var mn=function(t){return t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z",t}(mn||{}),UU=32,Fs=function(t){return t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE",t}(Fs||{});function t_(t){return t>=mn.ZERO&&t<=mn.NINE}function $U(t){return t>=mn.UPPER_A&&t<=mn.UPPER_F||t>=mn.LOWER_A&&t<=mn.LOWER_F}function GU(t){return t>=mn.UPPER_A&&t<=mn.UPPER_Z||t>=mn.LOWER_A&&t<=mn.LOWER_Z||t_(t)}function WU(t){return t===mn.EQUALS||GU(t)}var hn=function(t){return t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity",t}(hn||{}),uo=function(t){return t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute",t}(uo||{}),Uh=class{constructor(e,i,n){this.decodeTree=e,this.emitCodePoint=i,this.errors=n,this.state=hn.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=uo.Strict}startEntity(e){this.decodeMode=e,this.state=hn.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,i){switch(this.state){case hn.EntityStart:return e.charCodeAt(i)===mn.NUM?(this.state=hn.NumericStart,this.consumed+=1,this.stateNumericStart(e,i+1)):(this.state=hn.NamedEntity,this.stateNamedEntity(e,i));case hn.NumericStart:return this.stateNumericStart(e,i);case hn.NumericDecimal:return this.stateNumericDecimal(e,i);case hn.NumericHex:return this.stateNumericHex(e,i);case hn.NamedEntity:return this.stateNamedEntity(e,i)}}stateNumericStart(e,i){return i>=e.length?-1:(e.charCodeAt(i)|UU)===mn.LOWER_X?(this.state=hn.NumericHex,this.consumed+=1,this.stateNumericHex(e,i+1)):(this.state=hn.NumericDecimal,this.stateNumericDecimal(e,i))}addToNumericResult(e,i,n,r){if(i!==n){let o=n-i;this.result=this.result*Math.pow(r,o)+parseInt(e.substr(i,o),r),this.consumed+=o}}stateNumericHex(e,i){let n=i;for(;i>14;for(;i>14,o!==0){if(s===mn.SEMI)return this.emitNamedEntityData(this.treeIndex,o,this.consumed+this.excess);this.decodeMode!==uo.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:i,decodeTree:n}=this,r=(n[i]&Fs.VALUE_LENGTH)>>14;return this.emitNamedEntityData(i,r,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,i,n){let{decodeTree:r}=this;return this.emitCodePoint(i===1?r[e]&~Fs.VALUE_LENGTH:r[e+1],n),i===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case hn.NamedEntity:return this.result!==0&&(this.decodeMode!==uo.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case hn.NumericDecimal:return this.emitNumericEntity(0,2);case hn.NumericHex:return this.emitNumericEntity(0,3);case hn.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case hn.EntityStart:return 0}}};function ak(t){let e="",i=new Uh(t,n=>e+=Jb(n));return function(r,o){let s=0,a=0;for(;(a=r.indexOf("&",a))>=0;){e+=r.slice(s,a),i.startEntity(o);let l=i.write(r,a+1);if(l<0){s=a+i.end();break}s=a+l,a=l===0?s+1:s}let u=e+r.slice(s);return e="",u}}function qU(t,e,i,n){let r=(e&Fs.BRANCH_LENGTH)>>7,o=e&Fs.JUMP_TABLE;if(r===0)return o!==0&&n===o?i:-1;if(o){let u=n-o;return u<0||u>=r?-1:t[i+u]-1}let s=i,a=s+r-1;for(;s<=a;){let u=s+a>>>1,l=t[u];if(ln)a=u-1;else return t[u+r]}return-1}var ZU=ak(ok),OEe=ak(sk);function Go(t,e=uo.Legacy){return ZU(t,e)}function $h(t){for(let e=1;et.codePointAt(e):(t,e)=>(t.charCodeAt(e)&64512)===55296?(t.charCodeAt(e)-55296)*1024+t.charCodeAt(e+1)-56320+65536:t.charCodeAt(e);function n_(t,e){return function(n){let r,o=0,s="";for(;r=t.exec(n);)o!==r.index&&(s+=n.substring(o,r.index)),s+=e.get(r[0].charCodeAt(0)),o=r.index+1;return s+n.substring(o)}}var uk=n_(/[&<>'"]/g,YU),lk=n_(/["&\u00A0]/g,new Map([[34,"""],[38,"&"],[160," "]])),ck=n_(/[&<>\u00A0]/g,new Map([[38,"&"],[60,"<"],[62,">"],[160," "]]));function e$(t){return Object.prototype.toString.call(t)}function Gh(t){return e$(t)==="[object String]"}var t$=Object.prototype.hasOwnProperty;function n$(t,e){return t$.call(t,e)}function uu(t){return Array.prototype.slice.call(arguments,1).forEach(function(i){if(i){if(typeof i!="object")throw new TypeError(i+"must be object");Object.keys(i).forEach(function(n){t[n]=i[n]})}}),t}function r_(t,e,i){return[].concat(t.slice(0,e),i,t.slice(e+1))}function Wh(t){return!(t>=55296&&t<=57343||t>=64976&&t<=65007||(t&65535)===65535||(t&65535)===65534||t>=0&&t<=8||t===11||t>=14&&t<=31||t>=127&&t<=159||t>1114111)}function Yl(t){if(t>65535){t-=65536;let e=55296+(t>>10),i=56320+(t&1023);return String.fromCharCode(e,i)}return String.fromCharCode(t)}var pk=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,i$=/&([a-z#][a-z0-9]{1,31});/gi,r$=new RegExp(pk.source+"|"+i$.source,"gi"),o$=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function s$(t,e){if(e.charCodeAt(0)===35&&o$.test(e)){let n=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Wh(n)?Yl(n):t}let i=Go(t);return i!==t?i:t}function a$(t){return t.indexOf("\\")<0?t:t.replace(pk,"$1")}function lo(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(r$,function(e,i,n){return i||s$(e,n)})}var u$=/[&<>"]/,l$=/[&<>"]/g,c$={"&":"&","<":"<",">":">",'"':"""};function d$(t){return c$[t]}function co(t){return u$.test(t)?t.replace(l$,d$):t}var f$=/[.?*+^$[\]\\(){}|-]/g;function p$(t){return t.replace(f$,"\\$&")}function He(t){switch(t){case 9:case 32:return!0}return!1}function Rs(t){if(t>=8192&&t<=8202)return!0;switch(t){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Ls(t){return au.test(t)||zh.test(t)}function Hs(t){switch(t){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Bs(t){return t=t.trim().replace(/\s+/g," "),"\u1E9E".toLowerCase()==="\u1E7E"&&(t=t.replace(/ẞ/g,"\xDF")),t.toLowerCase().toUpperCase()}var h$={mdurl:Hh,ucmicro:Qb};var l_={};nc(l_,{parseLinkDestination:()=>a_,parseLinkLabel:()=>s_,parseLinkTitle:()=>u_});function s_(t,e,i){let n,r,o,s,a=t.posMax,u=t.pos;for(t.pos=e+1,n=1;t.pos32))return o;if(n===41){if(s===0)break;s--}r++}return e===r||s!==0||(o.str=lo(t.slice(e,r)),o.pos=r,o.ok=!0),o}function u_(t,e,i,n){let r,o=e,s={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(n)s.str=n.str,s.marker=n.marker;else{if(o>=i)return s;let a=t.charCodeAt(o);if(a!==34&&a!==39&&a!==40)return s;e++,o++,a===40&&(a=41),s.marker=a}for(;o"+co(o.content)+""};Mr.code_block=function(t,e,i,n,r){let o=t[e];return""+co(t[e].content)+` `};Mr.fence=function(t,e,i,n,r){let o=t[e],s=o.info?lo(o.info).trim():"",a="",u="";if(s){let c=s.split(/(\s+)/g);a=c[0],u=c.slice(2).join("")}let l;if(i.highlight?l=i.highlight(o.content,a,u)||co(o.content):l=co(o.content),l.indexOf("${l} `}return`
          ${l}
          @@ -47,8 +47,8 @@ ${i.map((n,r)=>`${r+1}) ${n.toString()}`).join(` `),o+=(r.nesting===-1?" `:">",o};lu.prototype.renderInline=function(t,e,i){let n="",r=this.rules;for(let o=0,s=t.length;o=0&&(n=this.attrs[i][1]),n};cu.prototype.attrJoin=function(e,i){let n=this.attrIndex(e);n<0?this.attrPush([e,i]):this.attrs[n][1]=this.attrs[n][1]+" "+i};var fo=cu;function mk(t,e,i){this.src=t,this.env=i,this.tokens=[],this.inlineMode=!1,this.md=e}mk.prototype.Token=fo;var gk=mk;var m$=/\r\n?|\n/g,g$=/\0/g;function c_(t){let e;e=t.src.replace(m$,` -`),e=e.replace(g$,"\uFFFD"),t.src=e}function d_(t){let e;t.inlineMode?(e=new t.Token("inline","",0),e.content=t.src,e.map=[0,1],e.children=[],t.tokens.push(e)):t.md.block.parse(t.src,t.md,t.env,t.tokens)}function f_(t){let e=t.tokens;for(let i=0,n=e.length;i\s]/i.test(t)}function v$(t){return/^<\/a\s*>/i.test(t)}function p_(t){let e=t.tokens;if(t.md.options.linkify)for(let i=0,n=e.length;i=0;s--){let a=r[s];if(a.type==="link_close"){for(s--;r[s].level!==a.level&&r[s].type!=="link_open";)s--;continue}if(a.type==="html_inline"&&(y$(a.content)&&o>0&&o--,v$(a.content)&&o++),!(o>0)&&a.type==="text"&&t.md.linkify.test(a.content)){let u=a.content,l=t.md.linkify.match(u),c=[],f=a.level,p=0;l.length>0&&l[0].index===0&&s>0&&r[s-1].type==="text_special"&&(l=l.slice(1));for(let m=0;mp){let V=new t.Token("text","",0);V.content=u.slice(p,D),V.level=f,c.push(V)}let I=new t.Token("link_open","a",1);I.attrs=[["href",y]],I.level=f++,I.markup="linkify",I.info="auto",c.push(I);let N=new t.Token("text","",0);N.content=b,N.level=f,c.push(N);let A=new t.Token("link_close","a",-1);A.level=--f,A.markup="linkify",A.info="auto",c.push(A),p=l[m].lastIndex}if(p=0;i--){let n=t[i];n.type==="text"&&!e&&(n.content=n.content.replace(_$,D$)),n.type==="link_open"&&n.info==="auto"&&e--,n.type==="link_close"&&n.info==="auto"&&e++}}function w$(t){let e=0;for(let i=t.length-1;i>=0;i--){let n=t[i];n.type==="text"&&!e&&yk.test(n.content)&&(n.content=n.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),n.type==="link_open"&&n.info==="auto"&&e--,n.type==="link_close"&&n.info==="auto"&&e++}}function h_(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(b$.test(t.tokens[e].content)&&E$(t.tokens[e].children),yk.test(t.tokens[e].content)&&w$(t.tokens[e].children))}var T$=/['"]/,vk=/['"]/g,bk="\u2019";function Wh(t,e,i){return t.slice(0,e)+i+t.slice(e+1)}function x$(t,e){let i,n=[];for(let r=0;r=0&&!(n[i].level<=s);i--);if(n.length=i+1,o.type!=="text")continue;let a=o.content,u=0,l=a.length;e:for(;u=0)g=a.charCodeAt(c.index-1);else for(i=r-1;i>=0&&!(t[i].type==="softbreak"||t[i].type==="hardbreak");i--)if(t[i].content){g=t[i].content.charCodeAt(t[i].content.length-1);break}let y=32;if(u=48&&g<=57&&(p=f=!1),f&&p&&(f=b,p=D),!f&&!p){m&&(o.content=Wh(o.content,c.index,bk));continue}if(p)for(i=n.length-1;i>=0;i--){let A=n[i];if(n[i].level=0;e--)t.tokens[e].type!=="inline"||!T$.test(t.tokens[e].content)||x$(t.tokens[e].children,t)}function g_(t){let e,i,n=t.tokens,r=n.length;for(let o=0;o0&&this.level++,this.tokens.push(n),n};Ar.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Ar.prototype.skipEmptyLines=function(e){for(let i=this.lineMax;ei;)if(!He(this.src.charCodeAt(--e)))return e+1;return e};Ar.prototype.skipChars=function(e,i){for(let n=this.src.length;en;)if(i!==this.src.charCodeAt(--e))return e+1;return e};Ar.prototype.getLines=function(e,i,n,r){if(e>=i)return"";let o=new Array(i-e);for(let s=0,a=e;an?o[s]=new Array(u-n+1).join(" ")+this.src.slice(c,f):o[s]=this.src.slice(c,f)}return o.join("")};Ar.prototype.Token=fo;var Ck=Ar;var I$=65536;function b_(t,e){let i=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];return t.src.slice(i,n)}function Dk(t){let e=[],i=t.length,n=0,r=t.charCodeAt(n),o=!1,s=0,a="";for(;ni)return!1;let r=e+1;if(t.sCount[r]=4)return!1;let o=t.bMarks[r]+t.tShift[r];if(o>=t.eMarks[r])return!1;let s=t.src.charCodeAt(o++);if(s!==124&&s!==45&&s!==58||o>=t.eMarks[r])return!1;let a=t.src.charCodeAt(o++);if(a!==124&&a!==45&&a!==58&&!He(a)||s===45&&He(a))return!1;for(;o=4)return!1;l=Dk(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();let f=l.length;if(f===0||f!==c.length)return!1;if(n)return!0;let p=t.parentType;t.parentType="table";let m=t.md.block.ruler.getRules("blockquote"),g=t.push("table_open","table",1),y=[e,0];g.map=y;let b=t.push("thead_open","thead",1);b.map=[e,e+1];let D=t.push("tr_open","tr",1);D.map=[e,e+1];for(let A=0;A=4||(l=Dk(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),N+=f-l.length,N>I$))break;if(r===e+2){let z=t.push("tbody_open","tbody",1);z.map=I=[e+2,0]}let V=t.push("tr_open","tr",1);V.map=[r,r+1];for(let z=0;z=4){n++,r=n;continue}break}t.line=r;let o=t.push("code_block","code",0);return o.content=t.getLines(e,r,4+t.blkIndent,!1)+` -`,o.map=[e,t.line],!0}function D_(t,e,i,n){let r=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||r+3>o)return!1;let s=t.src.charCodeAt(r);if(s!==126&&s!==96)return!1;let a=r;r=t.skipChars(r,s);let u=r-a;if(u<3)return!1;let l=t.src.slice(a,r),c=t.src.slice(r,o);if(s===96&&c.indexOf(String.fromCharCode(s))>=0)return!1;if(n)return!0;let f=e,p=!1;for(;f++,!(f>=i||(r=a=t.bMarks[f]+t.tShift[f],o=t.eMarks[f],r=4)&&(r=t.skipChars(r,s),!(r-a=4||t.src.charCodeAt(r)!==62)return!1;if(n)return!0;let a=[],u=[],l=[],c=[],f=t.md.block.ruler.getRules("blockquote"),p=t.parentType;t.parentType="blockquote";let m=!1,g;for(g=e;g=o)break;if(t.src.charCodeAt(r++)===62&&!N){let V=t.sCount[g]+1,z,ae;t.src.charCodeAt(r)===32?(r++,V++,ae=!1,z=!0):t.src.charCodeAt(r)===9?(z=!0,(t.bsCount[g]+V)%4===3?(r++,V++,ae=!1):ae=!0):z=!1;let Pe=V;for(a.push(t.bMarks[g]),t.bMarks[g]=r;r=o,u.push(t.bsCount[g]),t.bsCount[g]=t.sCount[g]+1+(z?1:0),l.push(t.sCount[g]),t.sCount[g]=Pe-V,c.push(t.tShift[g]),t.tShift[g]=r-t.bMarks[g];continue}if(m)break;let A=!1;for(let V=0,z=f.length;V";let D=[e,0];b.map=D,t.md.block.tokenize(t,e,g);let I=t.push("blockquote_close","blockquote",-1);I.markup=">",t.lineMax=s,t.parentType=p,D[1]=t.line;for(let N=0;N=4)return!1;let o=t.bMarks[e]+t.tShift[e],s=t.src.charCodeAt(o++);if(s!==42&&s!==45&&s!==95)return!1;let a=1;for(;o=n)return-1;let o=t.src.charCodeAt(r++);if(o<48||o>57)return-1;for(;;){if(r>=n)return-1;if(o=t.src.charCodeAt(r++),o>=48&&o<=57){if(r-i>=10)return-1;continue}if(o===41||o===46)break;return-1}return r=4||t.listIndent>=0&&t.sCount[u]-t.listIndent>=4&&t.sCount[u]=t.blkIndent&&(c=!0);let f,p,m;if((m=wk(t,u))>=0){if(f=!0,s=t.bMarks[u]+t.tShift[u],p=Number(t.src.slice(s,m-1)),c&&p!==1)return!1}else if((m=Ek(t,u))>=0)f=!1;else return!1;if(c&&t.skipSpaces(m)>=t.eMarks[u])return!1;if(n)return!0;let g=t.src.charCodeAt(m-1),y=t.tokens.length;f?(a=t.push("ordered_list_open","ol",1),p!==1&&(a.attrs=[["start",p]])):a=t.push("bullet_list_open","ul",1);let b=[u,0];a.map=b,a.markup=String.fromCharCode(g);let D=!1,I=t.md.block.ruler.getRules("list"),N=t.parentType;for(t.parentType="list";u=r?ae=1:ae=V-A,ae>4&&(ae=1);let Pe=A+ae;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(g);let mt=[u,0];a.map=mt,f&&(a.info=t.src.slice(s,m-1));let At=t.tight,Oi=t.tShift[u],Ni=t.sCount[u],hi=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=Pe,t.tight=!0,t.tShift[u]=z-t.bMarks[u],t.sCount[u]=V,z>=r&&t.isEmpty(u+1)?t.line=Math.min(t.line+2,i):t.md.block.tokenize(t,u,i,!0),(!t.tight||D)&&(l=!1),D=t.line-u>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=hi,t.tShift[u]=Oi,t.sCount[u]=Ni,t.tight=At,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(g),u=t.line,mt[1]=u,u>=i||t.sCount[u]=4)break;let Or=!1;for(let Hn=0,G=I.length;Hn=4||t.src.charCodeAt(r)!==91)return!1;function a(I){let N=t.lineMax;if(I>=N||t.isEmpty(I))return null;let A=!1;if(t.sCount[I]-t.blkIndent>3&&(A=!0),t.sCount[I]<0&&(A=!0),!A){let ae=t.md.block.ruler.getRules("reference"),Pe=t.parentType;t.parentType="reference";let mt=!1;for(let At=0,Oi=ae.length;At"u"&&(t.env.references={}),typeof t.env.references[D]>"u"&&(t.env.references[D]={title:b,href:f}),t.line=s),!0):!1}var Tk=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"];var M$="[a-zA-Z_:][a-zA-Z0-9:._-]*",A$="[^\"'=<>`\\x00-\\x20]+",k$="'[^']*'",O$='"[^"]*"',N$="(?:"+A$+"|"+k$+"|"+O$+")",P$="(?:\\s+"+M$+"(?:\\s*=\\s*"+N$+")?)",xk="<[A-Za-z][A-Za-z0-9\\-]*"+P$+"*\\s*\\/?>",Ik="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",F$="",R$="<[?][\\s\\S]*?[?]>",L$="]*>",H$="",Sk=new RegExp("^(?:"+xk+"|"+Ik+"|"+F$+"|"+R$+"|"+L$+"|"+H$+")"),Mk=new RegExp("^(?:"+xk+"|"+Ik+")");var du=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(Mk.source+"\\s*$"),/^$/,!1]];function I_(t,e,i,n){let r=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(r)!==60)return!1;let s=t.src.slice(r,o),a=0;for(;a=4)return!1;let s=t.src.charCodeAt(r);if(s!==35||r>=o)return!1;let a=1;for(s=t.src.charCodeAt(++r);s===35&&r6||rr&&He(t.src.charCodeAt(u-1))&&(o=u),t.line=e+1;let l=t.push("heading_open","h"+String(a),1);l.markup="########".slice(0,a),l.map=[e,t.line];let c=t.push("inline","",0);c.content=t.src.slice(r,o).trim(),c.map=[e,t.line],c.children=[];let f=t.push("heading_close","h"+String(a),-1);return f.markup="########".slice(0,a),!0}function M_(t,e,i){let n=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;let r=t.parentType;t.parentType="paragraph";let o=0,s,a=e+1;for(;a3)continue;if(t.sCount[a]>=t.blkIndent){let m=t.bMarks[a]+t.tShift[a],g=t.eMarks[a];if(m=g))){o=s===61?1:2;break}}if(t.sCount[a]<0)continue;let p=!1;for(let m=0,g=n.length;m3||t.sCount[o]<0)continue;let l=!1;for(let c=0,f=n.length;c=i||t.sCount[s]=o){t.line=i;break}let u=t.line,l=!1;for(let c=0;c=t.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),s=t.line,s0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(r),n};Ql.prototype.scanDelims=function(t,e){let i=this.posMax,n=this.src.charCodeAt(t),r=t>0?this.src.charCodeAt(t-1):32,o=t;for(;o0)return!1;let i=t.pos,n=t.posMax;if(i+3>n||t.src.charCodeAt(i)!==58||t.src.charCodeAt(i+1)!==47||t.src.charCodeAt(i+2)!==47)return!1;let r=t.pending.match(V$);if(!r)return!1;let o=r[1],s=t.md.linkify.matchAtStart(t.src.slice(i-o.length));if(!s)return!1;let a=s.url;if(a.length<=o.length)return!1;a=a.replace(/\*+$/,"");let u=t.md.normalizeLink(a);if(!t.md.validateLink(u))return!1;if(!e){t.pending=t.pending.slice(0,-o.length);let l=t.push("link_open","a",1);l.attrs=[["href",u]],l.markup="linkify",l.info="auto";let c=t.push("text","",0);c.content=t.md.normalizeLinkText(a);let f=t.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return t.pos+=a.length-o.length,!0}function N_(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==10)return!1;let n=t.pending.length-1,r=t.posMax;if(!e)if(n>=0&&t.pending.charCodeAt(n)===32)if(n>=1&&t.pending.charCodeAt(n-1)===32){let o=n-1;for(;o>=1&&t.pending.charCodeAt(o-1)===32;)o--;t.pending=t.pending.slice(0,o),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(i++;i?@[]^_`{|}~-".split("").forEach(function(t){P_[t.charCodeAt(0)]=1});function F_(t,e){let i=t.pos,n=t.posMax;if(t.src.charCodeAt(i)!==92||(i++,i>=n))return!1;let r=t.src.charCodeAt(i);if(r===10){for(e||t.push("hardbreak","br",0),i++;i=55296&&r<=56319&&i+1=56320&&a<=57343&&(o+=t.src[i+1],i++)}let s="\\"+o;if(!e){let a=t.push("text_special","",0);r<256&&P_[r]!==0?a.content=o:a.content=s,a.markup=s,a.info="escape"}return t.pos=i+1,!0}function R_(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==96)return!1;let r=i;i++;let o=t.posMax;for(;i=0;n--){let r=e[n];if(r.marker!==95&&r.marker!==42||r.end===-1)continue;let o=e[r.end],s=n>0&&e[n-1].end===r.end+1&&e[n-1].marker===r.marker&&e[n-1].token===r.token-1&&e[r.end+1].token===o.token+1,a=String.fromCharCode(r.marker),u=t.tokens[r.token];u.type=s?"strong_open":"em_open",u.tag=s?"strong":"em",u.nesting=1,u.markup=s?a+a:a,u.content="";let l=t.tokens[o.token];l.type=s?"strong_close":"em_close",l.tag=s?"strong":"em",l.nesting=-1,l.markup=s?a+a:a,l.content="",s&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--)}}function $$(t){let e=t.tokens_meta,i=t.tokens_meta.length;Nk(t,t.delimiters);for(let n=0;n=f)return!1;if(u=g,r=t.md.helpers.parseLinkDestination(t.src,g,t.posMax),r.ok){for(s=t.md.normalizeLink(r.str),t.md.validateLink(s)?g=r.pos:s="",u=g;g=f||t.src.charCodeAt(g)!==41)&&(l=!0),g++}if(l){if(typeof t.env.references>"u")return!1;if(g=0?n=t.src.slice(u,g++):g=m+1):g=m+1,n||(n=t.src.slice(p,m)),o=t.env.references[Bs(n)],!o)return t.pos=c,!1;s=o.href,a=o.title}if(!e){t.pos=p,t.posMax=m;let y=t.push("link_open","a",1),b=[["href",s]];y.attrs=b,a&&b.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=g,t.posMax=f,!0}function V_(t,e){let i,n,r,o,s,a,u,l,c="",f=t.pos,p=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;let m=t.pos+2,g=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(g<0)return!1;if(o=g+1,o=p)return!1;for(l=o,a=t.md.helpers.parseLinkDestination(t.src,o,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?o=a.pos:c=""),l=o;o=p||t.src.charCodeAt(o)!==41)return t.pos=f,!1;o++}else{if(typeof t.env.references>"u")return!1;if(o=0?r=t.src.slice(l,o++):o=g+1):o=g+1,r||(r=t.src.slice(m,g)),s=t.env.references[Bs(r)],!s)return t.pos=f,!1;c=s.href,u=s.title}if(!e){n=t.src.slice(m,g);let y=[];t.md.inline.parse(n,t.md,t.env,y);let b=t.push("image","img",0),D=[["src",c],["alt",""]];b.attrs=D,b.children=y,b.content=n,u&&D.push(["title",u])}return t.pos=o,t.posMax=p,!0}var G$=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,W$=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function z_(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==60)return!1;let n=t.pos,r=t.posMax;for(;;){if(++i>=r)return!1;let s=t.src.charCodeAt(i);if(s===60)return!1;if(s===62)break}let o=t.src.slice(n+1,i);if(W$.test(o)){let s=t.md.normalizeLink(o);if(!t.md.validateLink(s))return!1;if(!e){let a=t.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=t.push("text","",0);u.content=t.md.normalizeLinkText(o);let l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=o.length+2,!0}if(G$.test(o)){let s=t.md.normalizeLink("mailto:"+o);if(!t.md.validateLink(s))return!1;if(!e){let a=t.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=t.push("text","",0);u.content=t.md.normalizeLinkText(o);let l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=o.length+2,!0}return!1}function q$(t){return/^\s]/i.test(t)}function Z$(t){return/^<\/a\s*>/i.test(t)}function K$(t){let e=t|32;return e>=97&&e<=122}function j_(t,e){if(!t.md.options.html)return!1;let i=t.posMax,n=t.pos;if(t.src.charCodeAt(n)!==60||n+2>=i)return!1;let r=t.src.charCodeAt(n+1);if(r!==33&&r!==63&&r!==47&&!K$(r))return!1;let o=t.src.slice(n).match(Sk);if(!o)return!1;if(!e){let s=t.push("html_inline","",0);s.content=o[0],q$(s.content)&&t.linkLevel++,Z$(s.content)&&t.linkLevel--}return t.pos+=o[0].length,!0}var Y$=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Q$=/^&([a-z][a-z0-9]{1,31});/i;function U_(t,e){let i=t.pos,n=t.posMax;if(t.src.charCodeAt(i)!==38||i+1>=n)return!1;if(t.src.charCodeAt(i+1)===35){let o=t.src.slice(i).match(Y$);if(o){if(!e){let s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),a=t.push("text_special","",0);a.content=Gh(s)?Yl(s):Yl(65533),a.markup=o[0],a.info="entity"}return t.pos+=o[0].length,!0}}else{let o=t.src.slice(i).match(Q$);if(o){let s=Go(o[0]);if(s!==o[0]){if(!e){let a=t.push("text_special","",0);a.content=s,a.markup=o[0],a.info="entity"}return t.pos+=o[0].length,!0}}}return!1}function Pk(t){let e={},i=t.length;if(!i)return;let n=0,r=-2,o=[];for(let s=0;su;l-=o[l]+1){let f=t[l];if(f.marker===a.marker&&f.open&&f.end<0){let p=!1;if((f.close||a.open)&&(f.length+a.length)%3===0&&(f.length%3!==0||a.length%3!==0)&&(p=!0),!p){let m=l>0&&!t[l-1].open?o[l-1]+1:0;o[s]=s-l+m,o[l]=m,a.open=!1,f.end=s,f.close=!1,c=-1,r=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function $_(t){let e=t.tokens_meta,i=t.tokens_meta.length;Pk(t.delimiters);for(let n=0;n0&&n++,r[e].type==="text"&&e+1=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;s||t.pos++,o[e]=t.pos};Xl.prototype.tokenize=function(t){let e=this.ruler.getRules(""),i=e.length,n=t.posMax,r=t.md.options.maxNesting;for(;t.pos=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(t.pos>=n)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};Xl.prototype.parse=function(t,e,i,n){let r=new this.State(t,e,i,n);this.tokenize(r);let o=this.ruler2.getRules(""),s=o.length;for(let a=0;a|$))",e.tpl_email_fuzzy="(^|"+i+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Z_(t){return Array.prototype.slice.call(arguments,1).forEach(function(i){i&&Object.keys(i).forEach(function(n){t[n]=i[n]})}),t}function Yh(t){return Object.prototype.toString.call(t)}function X$(t){return Yh(t)==="[object String]"}function J$(t){return Yh(t)==="[object Object]"}function eG(t){return Yh(t)==="[object RegExp]"}function Lk(t){return Yh(t)==="[object Function]"}function tG(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var Bk={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function nG(t){return Object.keys(t||{}).reduce(function(e,i){return e||Bk.hasOwnProperty(i)},!1)}var iG={"http:":{validate:function(t,e,i){let n=t.slice(e);return i.re.http||(i.re.http=new RegExp("^\\/\\/"+i.re.src_auth+i.re.src_host_port_strict+i.re.src_path,"i")),i.re.http.test(n)?n.match(i.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,i){let n=t.slice(e);return i.re.no_http||(i.re.no_http=new RegExp("^"+i.re.src_auth+"(?:localhost|(?:(?:"+i.re.src_domain+")\\.)+"+i.re.src_domain_root+")"+i.re.src_port+i.re.src_host_terminator+i.re.src_path,"i")),i.re.no_http.test(n)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:n.match(i.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,i){let n=t.slice(e);return i.re.mailto||(i.re.mailto=new RegExp("^"+i.re.src_email_name+"@"+i.re.src_host_strict,"i")),i.re.mailto.test(n)?n.match(i.re.mailto)[0].length:0}}},rG="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",oG="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");function sG(t){t.__index__=-1,t.__text_cache__=""}function aG(t){return function(e,i){let n=e.slice(i);return t.test(n)?n.match(t)[0].length:0}}function Hk(){return function(t,e){e.normalize(t)}}function Kh(t){let e=t.re=Rk(t.__opts__),i=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||i.push(rG),i.push(e.src_xn),e.src_tlds=i.join("|");function n(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(n(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(n(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(n(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(n(e.tpl_host_fuzzy_test),"i");let r=[];t.__compiled__={};function o(a,u){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+u)}Object.keys(t.__schemas__).forEach(function(a){let u=t.__schemas__[a];if(u===null)return;let l={validate:null,link:null};if(t.__compiled__[a]=l,J$(u)){eG(u.validate)?l.validate=aG(u.validate):Lk(u.validate)?l.validate=u.validate:o(a,u),Lk(u.normalize)?l.normalize=u.normalize:u.normalize?o(a,u):l.normalize=Hk();return}if(X$(u)){r.push(a);return}o(a,u)}),r.forEach(function(a){t.__compiled__[t.__schemas__[a]]&&(t.__compiled__[a].validate=t.__compiled__[t.__schemas__[a]].validate,t.__compiled__[a].normalize=t.__compiled__[t.__schemas__[a]].normalize)}),t.__compiled__[""]={validate:null,normalize:Hk()};let s=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(tG).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+s+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),sG(t)}function uG(t,e){let i=t.__index__,n=t.__last_index__,r=t.__text_cache__.slice(i,n);this.schema=t.__schema__.toLowerCase(),this.index=i+e,this.lastIndex=n+e,this.raw=r,this.text=r,this.url=r}function K_(t,e){let i=new uG(t,e);return t.__compiled__[i.schema].normalize(i,t),i}function pi(t,e){if(!(this instanceof pi))return new pi(t,e);e||nG(t)&&(e=t,t={}),this.__opts__=Z_({},Bk,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Z_({},iG,t),this.__compiled__={},this.__tlds__=oG,this.__tlds_replaced__=!1,this.re={},Kh(this)}pi.prototype.add=function(e,i){return this.__schemas__[e]=i,Kh(this),this};pi.prototype.set=function(e){return this.__opts__=Z_(this.__opts__,e),this};pi.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let i,n,r,o,s,a,u,l,c;if(this.re.schema_test.test(e)){for(u=this.re.schema_search,u.lastIndex=0;(i=u.exec(e))!==null;)if(o=this.testSchemaAt(e,i[2],u.lastIndex),o){this.__schema__=i[2],this.__index__=i.index+i[1].length,this.__last_index__=i.index+i[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l=0&&(r=e.match(this.re.email_fuzzy))!==null&&(s=r.index+r[1].length,a=r.index+r[0].length,(this.__index__<0||sthis.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=a))),this.__index__>=0};pi.prototype.pretest=function(e){return this.re.pretest.test(e)};pi.prototype.testSchemaAt=function(e,i,n){return this.__compiled__[i.toLowerCase()]?this.__compiled__[i.toLowerCase()].validate(e,n,this):0};pi.prototype.match=function(e){let i=[],n=0;this.__index__>=0&&this.__text_cache__===e&&(i.push(K_(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)i.push(K_(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return i.length?i:null};pi.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;let i=this.re.schema_at_start.exec(e);if(!i)return null;let n=this.testSchemaAt(e,i[2],i[0].length);return n?(this.__schema__=i[2],this.__index__=i.index+i[1].length,this.__last_index__=i.index+i[0].length+n,K_(this,0)):null};pi.prototype.tlds=function(e,i){return e=Array.isArray(e)?e:[e],i?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(n,r,o){return n!==o[r-1]}).reverse(),Kh(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Kh(this),this)};pi.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};pi.prototype.onCompile=function(){};var Vk=pi;var jk="-",lG=/^xn--/,cG=/[^\0-\x7F]/,dG=/[\x2E\u3002\uFF0E\uFF61]/g,fG={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Y_=35,kr=Math.floor,Q_=String.fromCharCode;function Wo(t){throw new RangeError(fG[t])}function pG(t,e){let i=[],n=t.length;for(;n--;)i[n]=e(t[n]);return i}function Uk(t,e){let i=t.split("@"),n="";i.length>1&&(n=i[0]+"@",t=i[1]),t=t.replace(dG,".");let r=t.split("."),o=pG(r,e).join(".");return n+o}function $k(t){let e=[],i=0,n=t.length;for(;i=55296&&r<=56319&&iString.fromCodePoint(...t),mG=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:36},zk=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Gk=function(t,e,i){let n=0;for(t=i?kr(t/700):t>>1,t+=kr(t/e);t>Y_*26>>1;n+=36)t=kr(t/Y_);return kr(n+(Y_+1)*t/(t+38))},Wk=function(t){let e=[],i=t.length,n=0,r=128,o=72,s=t.lastIndexOf(jk);s<0&&(s=0);for(let a=0;a=128&&Wo("not-basic"),e.push(t.charCodeAt(a));for(let a=s>0?s+1:0;a=i&&Wo("invalid-input");let p=mG(t.charCodeAt(a++));p>=36&&Wo("invalid-input"),p>kr((2147483647-n)/c)&&Wo("overflow"),n+=p*c;let m=f<=o?1:f>=o+26?26:f-o;if(pkr(2147483647/g)&&Wo("overflow"),c*=g}let l=e.length+1;o=Gk(n-u,l,u==0),kr(n/l)>2147483647-r&&Wo("overflow"),r+=kr(n/l),n%=l,e.splice(n++,0,r)}return String.fromCodePoint(...e)},qk=function(t){let e=[];t=$k(t);let i=t.length,n=128,r=0,o=72;for(let u of t)u<128&&e.push(Q_(u));let s=e.length,a=s;for(s&&e.push(jk);a=n&&ckr((2147483647-r)/l)&&Wo("overflow"),r+=(u-n)*l,n=u;for(let c of t)if(c2147483647&&Wo("overflow"),c===n){let f=r;for(let p=36;;p+=36){let m=p<=o?1:p>=o+26?26:p-o;if(f=0))try{e.hostname=X_.toASCII(e.hostname)}catch{}return Fh(su(e))}function wG(t){let e=Kl(t,!0);if(e.hostname&&(!e.protocol||Qk.indexOf(e.protocol)>=0))try{e.hostname=X_.toUnicode(e.hostname)}catch{}return Zl(su(e),Zl.defaultChars+"%")}function ki(t,e){if(!(this instanceof ki))return new ki(t,e);e||$h(t)||(e=t||{},t="default"),this.inline=new Fk,this.block=new Ak,this.core=new _k,this.renderer=new hk,this.linkify=new Vk,this.validateLink=DG,this.normalizeLink=EG,this.normalizeLinkText=wG,this.utils=o_,this.helpers=uu({},l_),this.options={},this.configure(t),e&&this.set(e)}ki.prototype.set=function(t){return uu(this.options,t),this};ki.prototype.configure=function(t){let e=this;if($h(t)){let i=t;if(t=bG[i],!t)throw new Error('Wrong `markdown-it` preset "'+i+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(i){t.components[i].rules&&e[i].ruler.enableOnly(t.components[i].rules),t.components[i].rules2&&e[i].ruler2.enableOnly(t.components[i].rules2)}),this};ki.prototype.enable=function(t,e){let i=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(r){i=i.concat(this[r].ruler.enable(t,!0))},this),i=i.concat(this.inline.ruler2.enable(t,!0));let n=t.filter(function(r){return i.indexOf(r)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this};ki.prototype.disable=function(t,e){let i=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(r){i=i.concat(this[r].ruler.disable(t,!0))},this),i=i.concat(this.inline.ruler2.disable(t,!0));let n=t.filter(function(r){return i.indexOf(r)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this};ki.prototype.use=function(t){let e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};ki.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");let i=new this.core.State(t,this,e);return this.core.process(i),i.tokens};ki.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};ki.prototype.parseInline=function(t,e){let i=new this.core.State(t,this,e);return i.inlineMode=!0,this.core.process(i),i.tokens};ki.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};var fu=ki;var TG=new f1({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function xG(t,e){if(t.isText&&e.isText&&ic.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}var t1=class{constructor(e,i){this.schema=e,this.tokenHandlers=i,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:ic.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let i=this.top(),n=i.content,r=n[n.length-1],o=this.schema.text(e,i.marks),s;r&&(s=xG(r,o))?n[n.length-1]=s:n.push(o)}openMark(e){let i=this.top();i.marks=e.addToSet(i.marks)}closeMark(e){let i=this.top();i.marks=e.removeFromSet(i.marks)}parseTokens(e){for(let i=0;i\s]/i.test(t)}function v$(t){return/^<\/a\s*>/i.test(t)}function p_(t){let e=t.tokens;if(t.md.options.linkify)for(let i=0,n=e.length;i=0;s--){let a=r[s];if(a.type==="link_close"){for(s--;r[s].level!==a.level&&r[s].type!=="link_open";)s--;continue}if(a.type==="html_inline"&&(y$(a.content)&&o>0&&o--,v$(a.content)&&o++),!(o>0)&&a.type==="text"&&t.md.linkify.test(a.content)){let u=a.content,l=t.md.linkify.match(u),c=[],f=a.level,p=0;l.length>0&&l[0].index===0&&s>0&&r[s-1].type==="text_special"&&(l=l.slice(1));for(let m=0;mp){let V=new t.Token("text","",0);V.content=u.slice(p,D),V.level=f,c.push(V)}let I=new t.Token("link_open","a",1);I.attrs=[["href",y]],I.level=f++,I.markup="linkify",I.info="auto",c.push(I);let N=new t.Token("text","",0);N.content=b,N.level=f,c.push(N);let A=new t.Token("link_close","a",-1);A.level=--f,A.markup="linkify",A.info="auto",c.push(A),p=l[m].lastIndex}if(p=0;i--){let n=t[i];n.type==="text"&&!e&&(n.content=n.content.replace(_$,D$)),n.type==="link_open"&&n.info==="auto"&&e--,n.type==="link_close"&&n.info==="auto"&&e++}}function w$(t){let e=0;for(let i=t.length-1;i>=0;i--){let n=t[i];n.type==="text"&&!e&&yk.test(n.content)&&(n.content=n.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1\u2014").replace(/(^|\s)--(?=\s|$)/mg,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1\u2013")),n.type==="link_open"&&n.info==="auto"&&e--,n.type==="link_close"&&n.info==="auto"&&e++}}function h_(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(b$.test(t.tokens[e].content)&&E$(t.tokens[e].children),yk.test(t.tokens[e].content)&&w$(t.tokens[e].children))}var T$=/['"]/,vk=/['"]/g,bk="\u2019";function qh(t,e,i){return t.slice(0,e)+i+t.slice(e+1)}function x$(t,e){let i,n=[];for(let r=0;r=0&&!(n[i].level<=s);i--);if(n.length=i+1,o.type!=="text")continue;let a=o.content,u=0,l=a.length;e:for(;u=0)g=a.charCodeAt(c.index-1);else for(i=r-1;i>=0&&!(t[i].type==="softbreak"||t[i].type==="hardbreak");i--)if(t[i].content){g=t[i].content.charCodeAt(t[i].content.length-1);break}let y=32;if(u=48&&g<=57&&(p=f=!1),f&&p&&(f=b,p=D),!f&&!p){m&&(o.content=qh(o.content,c.index,bk));continue}if(p)for(i=n.length-1;i>=0;i--){let A=n[i];if(n[i].level=0;e--)t.tokens[e].type!=="inline"||!T$.test(t.tokens[e].content)||x$(t.tokens[e].children,t)}function g_(t){let e,i,n=t.tokens,r=n.length;for(let o=0;o0&&this.level++,this.tokens.push(n),n};Ar.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Ar.prototype.skipEmptyLines=function(e){for(let i=this.lineMax;ei;)if(!He(this.src.charCodeAt(--e)))return e+1;return e};Ar.prototype.skipChars=function(e,i){for(let n=this.src.length;en;)if(i!==this.src.charCodeAt(--e))return e+1;return e};Ar.prototype.getLines=function(e,i,n,r){if(e>=i)return"";let o=new Array(i-e);for(let s=0,a=e;an?o[s]=new Array(u-n+1).join(" ")+this.src.slice(c,f):o[s]=this.src.slice(c,f)}return o.join("")};Ar.prototype.Token=fo;var Ck=Ar;var I$=65536;function b_(t,e){let i=t.bMarks[e]+t.tShift[e],n=t.eMarks[e];return t.src.slice(i,n)}function Dk(t){let e=[],i=t.length,n=0,r=t.charCodeAt(n),o=!1,s=0,a="";for(;ni)return!1;let r=e+1;if(t.sCount[r]=4)return!1;let o=t.bMarks[r]+t.tShift[r];if(o>=t.eMarks[r])return!1;let s=t.src.charCodeAt(o++);if(s!==124&&s!==45&&s!==58||o>=t.eMarks[r])return!1;let a=t.src.charCodeAt(o++);if(a!==124&&a!==45&&a!==58&&!He(a)||s===45&&He(a))return!1;for(;o=4)return!1;l=Dk(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();let f=l.length;if(f===0||f!==c.length)return!1;if(n)return!0;let p=t.parentType;t.parentType="table";let m=t.md.block.ruler.getRules("blockquote"),g=t.push("table_open","table",1),y=[e,0];g.map=y;let b=t.push("thead_open","thead",1);b.map=[e,e+1];let D=t.push("tr_open","tr",1);D.map=[e,e+1];for(let A=0;A=4||(l=Dk(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),N+=f-l.length,N>I$))break;if(r===e+2){let z=t.push("tbody_open","tbody",1);z.map=I=[e+2,0]}let V=t.push("tr_open","tr",1);V.map=[r,r+1];for(let z=0;z=4){n++,r=n;continue}break}t.line=r;let o=t.push("code_block","code",0);return o.content=t.getLines(e,r,4+t.blkIndent,!1)+` +`,o.map=[e,t.line],!0}function D_(t,e,i,n){let r=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||r+3>o)return!1;let s=t.src.charCodeAt(r);if(s!==126&&s!==96)return!1;let a=r;r=t.skipChars(r,s);let u=r-a;if(u<3)return!1;let l=t.src.slice(a,r),c=t.src.slice(r,o);if(s===96&&c.indexOf(String.fromCharCode(s))>=0)return!1;if(n)return!0;let f=e,p=!1;for(;f++,!(f>=i||(r=a=t.bMarks[f]+t.tShift[f],o=t.eMarks[f],r=4)&&(r=t.skipChars(r,s),!(r-a=4||t.src.charCodeAt(r)!==62)return!1;if(n)return!0;let a=[],u=[],l=[],c=[],f=t.md.block.ruler.getRules("blockquote"),p=t.parentType;t.parentType="blockquote";let m=!1,g;for(g=e;g=o)break;if(t.src.charCodeAt(r++)===62&&!N){let V=t.sCount[g]+1,z,ae;t.src.charCodeAt(r)===32?(r++,V++,ae=!1,z=!0):t.src.charCodeAt(r)===9?(z=!0,(t.bsCount[g]+V)%4===3?(r++,V++,ae=!1):ae=!0):z=!1;let Pe=V;for(a.push(t.bMarks[g]),t.bMarks[g]=r;r=o,u.push(t.bsCount[g]),t.bsCount[g]=t.sCount[g]+1+(z?1:0),l.push(t.sCount[g]),t.sCount[g]=Pe-V,c.push(t.tShift[g]),t.tShift[g]=r-t.bMarks[g];continue}if(m)break;let A=!1;for(let V=0,z=f.length;V";let D=[e,0];b.map=D,t.md.block.tokenize(t,e,g);let I=t.push("blockquote_close","blockquote",-1);I.markup=">",t.lineMax=s,t.parentType=p,D[1]=t.line;for(let N=0;N=4)return!1;let o=t.bMarks[e]+t.tShift[e],s=t.src.charCodeAt(o++);if(s!==42&&s!==45&&s!==95)return!1;let a=1;for(;o=n)return-1;let o=t.src.charCodeAt(r++);if(o<48||o>57)return-1;for(;;){if(r>=n)return-1;if(o=t.src.charCodeAt(r++),o>=48&&o<=57){if(r-i>=10)return-1;continue}if(o===41||o===46)break;return-1}return r=4||t.listIndent>=0&&t.sCount[u]-t.listIndent>=4&&t.sCount[u]=t.blkIndent&&(c=!0);let f,p,m;if((m=wk(t,u))>=0){if(f=!0,s=t.bMarks[u]+t.tShift[u],p=Number(t.src.slice(s,m-1)),c&&p!==1)return!1}else if((m=Ek(t,u))>=0)f=!1;else return!1;if(c&&t.skipSpaces(m)>=t.eMarks[u])return!1;if(n)return!0;let g=t.src.charCodeAt(m-1),y=t.tokens.length;f?(a=t.push("ordered_list_open","ol",1),p!==1&&(a.attrs=[["start",p]])):a=t.push("bullet_list_open","ul",1);let b=[u,0];a.map=b,a.markup=String.fromCharCode(g);let D=!1,I=t.md.block.ruler.getRules("list"),N=t.parentType;for(t.parentType="list";u=r?ae=1:ae=V-A,ae>4&&(ae=1);let Pe=A+ae;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(g);let mt=[u,0];a.map=mt,f&&(a.info=t.src.slice(s,m-1));let At=t.tight,Oi=t.tShift[u],Ni=t.sCount[u],hi=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=Pe,t.tight=!0,t.tShift[u]=z-t.bMarks[u],t.sCount[u]=V,z>=r&&t.isEmpty(u+1)?t.line=Math.min(t.line+2,i):t.md.block.tokenize(t,u,i,!0),(!t.tight||D)&&(l=!1),D=t.line-u>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=hi,t.tShift[u]=Oi,t.sCount[u]=Ni,t.tight=At,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(g),u=t.line,mt[1]=u,u>=i||t.sCount[u]=4)break;let Or=!1;for(let Hn=0,G=I.length;Hn=4||t.src.charCodeAt(r)!==91)return!1;function a(I){let N=t.lineMax;if(I>=N||t.isEmpty(I))return null;let A=!1;if(t.sCount[I]-t.blkIndent>3&&(A=!0),t.sCount[I]<0&&(A=!0),!A){let ae=t.md.block.ruler.getRules("reference"),Pe=t.parentType;t.parentType="reference";let mt=!1;for(let At=0,Oi=ae.length;At"u"&&(t.env.references={}),typeof t.env.references[D]>"u"&&(t.env.references[D]={title:b,href:f}),t.line=s),!0):!1}var Tk=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"];var M$="[a-zA-Z_:][a-zA-Z0-9:._-]*",A$="[^\"'=<>`\\x00-\\x20]+",k$="'[^']*'",O$='"[^"]*"',N$="(?:"+A$+"|"+k$+"|"+O$+")",P$="(?:\\s+"+M$+"(?:\\s*=\\s*"+N$+")?)",xk="<[A-Za-z][A-Za-z0-9\\-]*"+P$+"*\\s*\\/?>",Ik="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",F$="",R$="<[?][\\s\\S]*?[?]>",L$="]*>",H$="",Sk=new RegExp("^(?:"+xk+"|"+Ik+"|"+F$+"|"+R$+"|"+L$+"|"+H$+")"),Mk=new RegExp("^(?:"+xk+"|"+Ik+")");var du=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^/,!0],[/^<\?/,/\?>/,!0],[/^/,!0],[/^/,!0],[new RegExp("^|$))","i"),/^$/,!0],[new RegExp(Mk.source+"\\s*$"),/^$/,!1]];function I_(t,e,i,n){let r=t.bMarks[e]+t.tShift[e],o=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(r)!==60)return!1;let s=t.src.slice(r,o),a=0;for(;a=4)return!1;let s=t.src.charCodeAt(r);if(s!==35||r>=o)return!1;let a=1;for(s=t.src.charCodeAt(++r);s===35&&r6||rr&&He(t.src.charCodeAt(u-1))&&(o=u),t.line=e+1;let l=t.push("heading_open","h"+String(a),1);l.markup="########".slice(0,a),l.map=[e,t.line];let c=t.push("inline","",0);c.content=t.src.slice(r,o).trim(),c.map=[e,t.line],c.children=[];let f=t.push("heading_close","h"+String(a),-1);return f.markup="########".slice(0,a),!0}function M_(t,e,i){let n=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;let r=t.parentType;t.parentType="paragraph";let o=0,s,a=e+1;for(;a3)continue;if(t.sCount[a]>=t.blkIndent){let m=t.bMarks[a]+t.tShift[a],g=t.eMarks[a];if(m=g))){o=s===61?1:2;break}}if(t.sCount[a]<0)continue;let p=!1;for(let m=0,g=n.length;m3||t.sCount[o]<0)continue;let l=!1;for(let c=0,f=n.length;c=i||t.sCount[s]=o){t.line=i;break}let u=t.line,l=!1;for(let c=0;c=t.line)throw new Error("block rule didn't increment state.line");break}if(!l)throw new Error("none of the block rules matched");t.tight=!a,t.isEmpty(t.line-1)&&(a=!0),s=t.line,s0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],r={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(n),this.tokens_meta.push(r),n};Ql.prototype.scanDelims=function(t,e){let i=this.posMax,n=this.src.charCodeAt(t),r=t>0?this.src.charCodeAt(t-1):32,o=t;for(;o0)return!1;let i=t.pos,n=t.posMax;if(i+3>n||t.src.charCodeAt(i)!==58||t.src.charCodeAt(i+1)!==47||t.src.charCodeAt(i+2)!==47)return!1;let r=t.pending.match(V$);if(!r)return!1;let o=r[1],s=t.md.linkify.matchAtStart(t.src.slice(i-o.length));if(!s)return!1;let a=s.url;if(a.length<=o.length)return!1;a=a.replace(/\*+$/,"");let u=t.md.normalizeLink(a);if(!t.md.validateLink(u))return!1;if(!e){t.pending=t.pending.slice(0,-o.length);let l=t.push("link_open","a",1);l.attrs=[["href",u]],l.markup="linkify",l.info="auto";let c=t.push("text","",0);c.content=t.md.normalizeLinkText(a);let f=t.push("link_close","a",-1);f.markup="linkify",f.info="auto"}return t.pos+=a.length-o.length,!0}function N_(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==10)return!1;let n=t.pending.length-1,r=t.posMax;if(!e)if(n>=0&&t.pending.charCodeAt(n)===32)if(n>=1&&t.pending.charCodeAt(n-1)===32){let o=n-1;for(;o>=1&&t.pending.charCodeAt(o-1)===32;)o--;t.pending=t.pending.slice(0,o),t.push("hardbreak","br",0)}else t.pending=t.pending.slice(0,-1),t.push("softbreak","br",0);else t.push("softbreak","br",0);for(i++;i?@[]^_`{|}~-".split("").forEach(function(t){P_[t.charCodeAt(0)]=1});function F_(t,e){let i=t.pos,n=t.posMax;if(t.src.charCodeAt(i)!==92||(i++,i>=n))return!1;let r=t.src.charCodeAt(i);if(r===10){for(e||t.push("hardbreak","br",0),i++;i=55296&&r<=56319&&i+1=56320&&a<=57343&&(o+=t.src[i+1],i++)}let s="\\"+o;if(!e){let a=t.push("text_special","",0);r<256&&P_[r]!==0?a.content=o:a.content=s,a.markup=s,a.info="escape"}return t.pos=i+1,!0}function R_(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==96)return!1;let r=i;i++;let o=t.posMax;for(;i=0;n--){let r=e[n];if(r.marker!==95&&r.marker!==42||r.end===-1)continue;let o=e[r.end],s=n>0&&e[n-1].end===r.end+1&&e[n-1].marker===r.marker&&e[n-1].token===r.token-1&&e[r.end+1].token===o.token+1,a=String.fromCharCode(r.marker),u=t.tokens[r.token];u.type=s?"strong_open":"em_open",u.tag=s?"strong":"em",u.nesting=1,u.markup=s?a+a:a,u.content="";let l=t.tokens[o.token];l.type=s?"strong_close":"em_close",l.tag=s?"strong":"em",l.nesting=-1,l.markup=s?a+a:a,l.content="",s&&(t.tokens[e[n-1].token].content="",t.tokens[e[r.end+1].token].content="",n--)}}function $$(t){let e=t.tokens_meta,i=t.tokens_meta.length;Nk(t,t.delimiters);for(let n=0;n=f)return!1;if(u=g,r=t.md.helpers.parseLinkDestination(t.src,g,t.posMax),r.ok){for(s=t.md.normalizeLink(r.str),t.md.validateLink(s)?g=r.pos:s="",u=g;g=f||t.src.charCodeAt(g)!==41)&&(l=!0),g++}if(l){if(typeof t.env.references>"u")return!1;if(g=0?n=t.src.slice(u,g++):g=m+1):g=m+1,n||(n=t.src.slice(p,m)),o=t.env.references[Bs(n)],!o)return t.pos=c,!1;s=o.href,a=o.title}if(!e){t.pos=p,t.posMax=m;let y=t.push("link_open","a",1),b=[["href",s]];y.attrs=b,a&&b.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=g,t.posMax=f,!0}function V_(t,e){let i,n,r,o,s,a,u,l,c="",f=t.pos,p=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;let m=t.pos+2,g=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(g<0)return!1;if(o=g+1,o=p)return!1;for(l=o,a=t.md.helpers.parseLinkDestination(t.src,o,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?o=a.pos:c=""),l=o;o=p||t.src.charCodeAt(o)!==41)return t.pos=f,!1;o++}else{if(typeof t.env.references>"u")return!1;if(o=0?r=t.src.slice(l,o++):o=g+1):o=g+1,r||(r=t.src.slice(m,g)),s=t.env.references[Bs(r)],!s)return t.pos=f,!1;c=s.href,u=s.title}if(!e){n=t.src.slice(m,g);let y=[];t.md.inline.parse(n,t.md,t.env,y);let b=t.push("image","img",0),D=[["src",c],["alt",""]];b.attrs=D,b.children=y,b.content=n,u&&D.push(["title",u])}return t.pos=o,t.posMax=p,!0}var G$=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,W$=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function z_(t,e){let i=t.pos;if(t.src.charCodeAt(i)!==60)return!1;let n=t.pos,r=t.posMax;for(;;){if(++i>=r)return!1;let s=t.src.charCodeAt(i);if(s===60)return!1;if(s===62)break}let o=t.src.slice(n+1,i);if(W$.test(o)){let s=t.md.normalizeLink(o);if(!t.md.validateLink(s))return!1;if(!e){let a=t.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=t.push("text","",0);u.content=t.md.normalizeLinkText(o);let l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=o.length+2,!0}if(G$.test(o)){let s=t.md.normalizeLink("mailto:"+o);if(!t.md.validateLink(s))return!1;if(!e){let a=t.push("link_open","a",1);a.attrs=[["href",s]],a.markup="autolink",a.info="auto";let u=t.push("text","",0);u.content=t.md.normalizeLinkText(o);let l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=o.length+2,!0}return!1}function q$(t){return/^\s]/i.test(t)}function Z$(t){return/^<\/a\s*>/i.test(t)}function K$(t){let e=t|32;return e>=97&&e<=122}function j_(t,e){if(!t.md.options.html)return!1;let i=t.posMax,n=t.pos;if(t.src.charCodeAt(n)!==60||n+2>=i)return!1;let r=t.src.charCodeAt(n+1);if(r!==33&&r!==63&&r!==47&&!K$(r))return!1;let o=t.src.slice(n).match(Sk);if(!o)return!1;if(!e){let s=t.push("html_inline","",0);s.content=o[0],q$(s.content)&&t.linkLevel++,Z$(s.content)&&t.linkLevel--}return t.pos+=o[0].length,!0}var Y$=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Q$=/^&([a-z][a-z0-9]{1,31});/i;function U_(t,e){let i=t.pos,n=t.posMax;if(t.src.charCodeAt(i)!==38||i+1>=n)return!1;if(t.src.charCodeAt(i+1)===35){let o=t.src.slice(i).match(Y$);if(o){if(!e){let s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),a=t.push("text_special","",0);a.content=Wh(s)?Yl(s):Yl(65533),a.markup=o[0],a.info="entity"}return t.pos+=o[0].length,!0}}else{let o=t.src.slice(i).match(Q$);if(o){let s=Go(o[0]);if(s!==o[0]){if(!e){let a=t.push("text_special","",0);a.content=s,a.markup=o[0],a.info="entity"}return t.pos+=o[0].length,!0}}}return!1}function Pk(t){let e={},i=t.length;if(!i)return;let n=0,r=-2,o=[];for(let s=0;su;l-=o[l]+1){let f=t[l];if(f.marker===a.marker&&f.open&&f.end<0){let p=!1;if((f.close||a.open)&&(f.length+a.length)%3===0&&(f.length%3!==0||a.length%3!==0)&&(p=!0),!p){let m=l>0&&!t[l-1].open?o[l-1]+1:0;o[s]=s-l+m,o[l]=m,a.open=!1,f.end=s,f.close=!1,c=-1,r=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function $_(t){let e=t.tokens_meta,i=t.tokens_meta.length;Pk(t.delimiters);for(let n=0;n0&&n++,r[e].type==="text"&&e+1=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;s||t.pos++,o[e]=t.pos};Xl.prototype.tokenize=function(t){let e=this.ruler.getRules(""),i=e.length,n=t.posMax,r=t.md.options.maxNesting;for(;t.pos=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(s){if(t.pos>=n)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};Xl.prototype.parse=function(t,e,i,n){let r=new this.State(t,e,i,n);this.tokenize(r);let o=this.ruler2.getRules(""),s=o.length;for(let a=0;a|$))",e.tpl_email_fuzzy="(^|"+i+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`|\uFF5C]|"+e.src_ZPCc+"))((?![$+<=>^`|\uFF5C])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function Z_(t){return Array.prototype.slice.call(arguments,1).forEach(function(i){i&&Object.keys(i).forEach(function(n){t[n]=i[n]})}),t}function Qh(t){return Object.prototype.toString.call(t)}function X$(t){return Qh(t)==="[object String]"}function J$(t){return Qh(t)==="[object Object]"}function eG(t){return Qh(t)==="[object RegExp]"}function Lk(t){return Qh(t)==="[object Function]"}function tG(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}var Bk={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function nG(t){return Object.keys(t||{}).reduce(function(e,i){return e||Bk.hasOwnProperty(i)},!1)}var iG={"http:":{validate:function(t,e,i){let n=t.slice(e);return i.re.http||(i.re.http=new RegExp("^\\/\\/"+i.re.src_auth+i.re.src_host_port_strict+i.re.src_path,"i")),i.re.http.test(n)?n.match(i.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,i){let n=t.slice(e);return i.re.no_http||(i.re.no_http=new RegExp("^"+i.re.src_auth+"(?:localhost|(?:(?:"+i.re.src_domain+")\\.)+"+i.re.src_domain_root+")"+i.re.src_port+i.re.src_host_terminator+i.re.src_path,"i")),i.re.no_http.test(n)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:n.match(i.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,i){let n=t.slice(e);return i.re.mailto||(i.re.mailto=new RegExp("^"+i.re.src_email_name+"@"+i.re.src_host_strict,"i")),i.re.mailto.test(n)?n.match(i.re.mailto)[0].length:0}}},rG="a[cdefgilmnoqrstuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrstuvwxyz]|n[acefgilopruz]|om|p[aefghklmnrstwy]|qa|r[eosuw]|s[abcdeghijklmnortuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]",oG="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444".split("|");function sG(t){t.__index__=-1,t.__text_cache__=""}function aG(t){return function(e,i){let n=e.slice(i);return t.test(n)?n.match(t)[0].length:0}}function Hk(){return function(t,e){e.normalize(t)}}function Yh(t){let e=t.re=Rk(t.__opts__),i=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||i.push(rG),i.push(e.src_xn),e.src_tlds=i.join("|");function n(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(n(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(n(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(n(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(n(e.tpl_host_fuzzy_test),"i");let r=[];t.__compiled__={};function o(a,u){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+u)}Object.keys(t.__schemas__).forEach(function(a){let u=t.__schemas__[a];if(u===null)return;let l={validate:null,link:null};if(t.__compiled__[a]=l,J$(u)){eG(u.validate)?l.validate=aG(u.validate):Lk(u.validate)?l.validate=u.validate:o(a,u),Lk(u.normalize)?l.normalize=u.normalize:u.normalize?o(a,u):l.normalize=Hk();return}if(X$(u)){r.push(a);return}o(a,u)}),r.forEach(function(a){t.__compiled__[t.__schemas__[a]]&&(t.__compiled__[a].validate=t.__compiled__[t.__schemas__[a]].validate,t.__compiled__[a].normalize=t.__compiled__[t.__schemas__[a]].normalize)}),t.__compiled__[""]={validate:null,normalize:Hk()};let s=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(tG).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+s+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><\uFF5C]|"+e.src_ZPCc+"))("+s+")","ig"),t.re.schema_at_start=RegExp("^"+t.re.schema_search.source,"i"),t.re.pretest=RegExp("("+t.re.schema_test.source+")|("+t.re.host_fuzzy_test.source+")|@","i"),sG(t)}function uG(t,e){let i=t.__index__,n=t.__last_index__,r=t.__text_cache__.slice(i,n);this.schema=t.__schema__.toLowerCase(),this.index=i+e,this.lastIndex=n+e,this.raw=r,this.text=r,this.url=r}function K_(t,e){let i=new uG(t,e);return t.__compiled__[i.schema].normalize(i,t),i}function pi(t,e){if(!(this instanceof pi))return new pi(t,e);e||nG(t)&&(e=t,t={}),this.__opts__=Z_({},Bk,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=Z_({},iG,t),this.__compiled__={},this.__tlds__=oG,this.__tlds_replaced__=!1,this.re={},Yh(this)}pi.prototype.add=function(e,i){return this.__schemas__[e]=i,Yh(this),this};pi.prototype.set=function(e){return this.__opts__=Z_(this.__opts__,e),this};pi.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let i,n,r,o,s,a,u,l,c;if(this.re.schema_test.test(e)){for(u=this.re.schema_search,u.lastIndex=0;(i=u.exec(e))!==null;)if(o=this.testSchemaAt(e,i[2],u.lastIndex),o){this.__schema__=i[2],this.__index__=i.index+i[1].length,this.__last_index__=i.index+i[0].length+o;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l=0&&(r=e.match(this.re.email_fuzzy))!==null&&(s=r.index+r[1].length,a=r.index+r[0].length,(this.__index__<0||sthis.__last_index__)&&(this.__schema__="mailto:",this.__index__=s,this.__last_index__=a))),this.__index__>=0};pi.prototype.pretest=function(e){return this.re.pretest.test(e)};pi.prototype.testSchemaAt=function(e,i,n){return this.__compiled__[i.toLowerCase()]?this.__compiled__[i.toLowerCase()].validate(e,n,this):0};pi.prototype.match=function(e){let i=[],n=0;this.__index__>=0&&this.__text_cache__===e&&(i.push(K_(this,n)),n=this.__last_index__);let r=n?e.slice(n):e;for(;this.test(r);)i.push(K_(this,n)),r=r.slice(this.__last_index__),n+=this.__last_index__;return i.length?i:null};pi.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;let i=this.re.schema_at_start.exec(e);if(!i)return null;let n=this.testSchemaAt(e,i[2],i[0].length);return n?(this.__schema__=i[2],this.__index__=i.index+i[1].length,this.__last_index__=i.index+i[0].length+n,K_(this,0)):null};pi.prototype.tlds=function(e,i){return e=Array.isArray(e)?e:[e],i?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(n,r,o){return n!==o[r-1]}).reverse(),Yh(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Yh(this),this)};pi.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};pi.prototype.onCompile=function(){};var Vk=pi;var jk="-",lG=/^xn--/,cG=/[^\0-\x7F]/,dG=/[\x2E\u3002\uFF0E\uFF61]/g,fG={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Y_=35,kr=Math.floor,Q_=String.fromCharCode;function Wo(t){throw new RangeError(fG[t])}function pG(t,e){let i=[],n=t.length;for(;n--;)i[n]=e(t[n]);return i}function Uk(t,e){let i=t.split("@"),n="";i.length>1&&(n=i[0]+"@",t=i[1]),t=t.replace(dG,".");let r=t.split("."),o=pG(r,e).join(".");return n+o}function $k(t){let e=[],i=0,n=t.length;for(;i=55296&&r<=56319&&iString.fromCodePoint(...t),mG=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:36},zk=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},Gk=function(t,e,i){let n=0;for(t=i?kr(t/700):t>>1,t+=kr(t/e);t>Y_*26>>1;n+=36)t=kr(t/Y_);return kr(n+(Y_+1)*t/(t+38))},Wk=function(t){let e=[],i=t.length,n=0,r=128,o=72,s=t.lastIndexOf(jk);s<0&&(s=0);for(let a=0;a=128&&Wo("not-basic"),e.push(t.charCodeAt(a));for(let a=s>0?s+1:0;a=i&&Wo("invalid-input");let p=mG(t.charCodeAt(a++));p>=36&&Wo("invalid-input"),p>kr((2147483647-n)/c)&&Wo("overflow"),n+=p*c;let m=f<=o?1:f>=o+26?26:f-o;if(pkr(2147483647/g)&&Wo("overflow"),c*=g}let l=e.length+1;o=Gk(n-u,l,u==0),kr(n/l)>2147483647-r&&Wo("overflow"),r+=kr(n/l),n%=l,e.splice(n++,0,r)}return String.fromCodePoint(...e)},qk=function(t){let e=[];t=$k(t);let i=t.length,n=128,r=0,o=72;for(let u of t)u<128&&e.push(Q_(u));let s=e.length,a=s;for(s&&e.push(jk);a=n&&ckr((2147483647-r)/l)&&Wo("overflow"),r+=(u-n)*l,n=u;for(let c of t)if(c2147483647&&Wo("overflow"),c===n){let f=r;for(let p=36;;p+=36){let m=p<=o?1:p>=o+26?26:p-o;if(f=0))try{e.hostname=X_.toASCII(e.hostname)}catch{}return Rh(su(e))}function wG(t){let e=Kl(t,!0);if(e.hostname&&(!e.protocol||Qk.indexOf(e.protocol)>=0))try{e.hostname=X_.toUnicode(e.hostname)}catch{}return Zl(su(e),Zl.defaultChars+"%")}function ki(t,e){if(!(this instanceof ki))return new ki(t,e);e||Gh(t)||(e=t||{},t="default"),this.inline=new Fk,this.block=new Ak,this.core=new _k,this.renderer=new hk,this.linkify=new Vk,this.validateLink=DG,this.normalizeLink=EG,this.normalizeLinkText=wG,this.utils=o_,this.helpers=uu({},l_),this.options={},this.configure(t),e&&this.set(e)}ki.prototype.set=function(t){return uu(this.options,t),this};ki.prototype.configure=function(t){let e=this;if(Gh(t)){let i=t;if(t=bG[i],!t)throw new Error('Wrong `markdown-it` preset "'+i+'", check name')}if(!t)throw new Error("Wrong `markdown-it` preset, can't be empty");return t.options&&e.set(t.options),t.components&&Object.keys(t.components).forEach(function(i){t.components[i].rules&&e[i].ruler.enableOnly(t.components[i].rules),t.components[i].rules2&&e[i].ruler2.enableOnly(t.components[i].rules2)}),this};ki.prototype.enable=function(t,e){let i=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(r){i=i.concat(this[r].ruler.enable(t,!0))},this),i=i.concat(this.inline.ruler2.enable(t,!0));let n=t.filter(function(r){return i.indexOf(r)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+n);return this};ki.prototype.disable=function(t,e){let i=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(r){i=i.concat(this[r].ruler.disable(t,!0))},this),i=i.concat(this.inline.ruler2.disable(t,!0));let n=t.filter(function(r){return i.indexOf(r)<0});if(n.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+n);return this};ki.prototype.use=function(t){let e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};ki.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");let i=new this.core.State(t,this,e);return this.core.process(i),i.tokens};ki.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};ki.prototype.parseInline=function(t,e){let i=new this.core.State(t,this,e);return i.inlineMode=!0,this.core.process(i),i.tokens};ki.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};var fu=ki;var TG=new f1({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM(){return["p",0]}},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM(){return["blockquote",0]}},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM(){return["div",["hr"]]}},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM(t){return["h"+t.attrs.level,0]}},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM(t){return["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]}},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs(t){return{order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")}}}],toDOM(t){return["ol",{start:t.attrs.order==1?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]}},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM(t){return["ul",{"data-tight":t.attrs.tight?"true":null},0]}},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM(){return["li",0]}},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs(t){return{src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")}}}],toDOM(t){return["img",t.attrs]}},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM(){return["br"]}}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>t.type.name=="em"}],toDOM(){return["em"]}},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name=="strong"},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM(){return["strong"]}},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs(t){return{href:t.getAttribute("href"),title:t.getAttribute("title")}}}],toDOM(t){return["a",t.attrs]}},code:{parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function xG(t,e){if(t.isText&&e.isText&&ic.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}var t1=class{constructor(e,i){this.schema=e,this.tokenHandlers=i,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:ic.none}]}top(){return this.stack[this.stack.length-1]}push(e){this.stack.length&&this.top().content.push(e)}addText(e){if(!e)return;let i=this.top(),n=i.content,r=n[n.length-1],o=this.schema.text(e,i.marks),s;r&&(s=xG(r,o))?n[n.length-1]=s:n.push(o)}openMark(e){let i=this.top();i.marks=e.addToSet(i.marks)}closeMark(e){let i=this.top();i.marks=e.removeFromSet(i.marks)}parseTokens(e){for(let i=0;i{s.openNode(o,Jl(r,a,u,l)),s.addText(Xk(a.content)),s.closeNode()}:(i[n+"_open"]=(s,a,u,l)=>s.openNode(o,Jl(r,a,u,l)),i[n+"_close"]=s=>s.closeNode())}else if(r.node){let o=t.nodeType(r.node);i[n]=(s,a,u,l)=>s.addNode(o,Jl(r,a,u,l))}else if(r.mark){let o=t.marks[r.mark];J_(r,n)?i[n]=(s,a,u,l)=>{s.openMark(o.create(Jl(r,a,u,l))),s.addText(Xk(a.content)),s.closeMark(o)}:(i[n+"_open"]=(s,a,u,l)=>s.openMark(o.create(Jl(r,a,u,l))),i[n+"_close"]=s=>s.closeMark(o))}else if(r.ignore)J_(r,n)?i[n]=e1:(i[n+"_open"]=e1,i[n+"_close"]=e1);else throw new RangeError("Unrecognized parsing spec "+JSON.stringify(r))}return i.text=(n,r)=>n.addText(r.content),i.inline=(n,r)=>n.parseTokens(r.children),i.softbreak=i.softbreak||(n=>n.addText(" ")),i}var n1=class{constructor(e,i,n){this.schema=e,this.tokenizer=i,this.tokens=n,this.tokenHandlers=IG(e,n)}parse(e,i={}){let n=new t1(this.schema,this.tokenHandlers),r;n.parseTokens(this.tokenizer.parse(e,i));do r=n.closeNode();while(n.stack.length);return r||this.schema.topNodeType.createAndFill()}};function Jk(t,e){for(;++e({tight:Jk(e,i)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,i)=>({order:+t.attrGet("start")||1,tight:Jk(e,i)})},heading:{block:"heading",getAttrs:t=>({level:+t.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:t=>({params:t.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:t=>({src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:t=>({href:t.attrGet("href"),title:t.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}}),SG={open:"",close:"",mixable:!0},i1=class{constructor(e,i,n={}){this.nodes=e,this.marks=i,this.options=n}serialize(e,i={}){i=Object.assign({},this.options,i);let n=new ec(this.nodes,this.marks,i);return n.renderContent(e),n.out}},rr=new i1({blockquote(t,e){t.wrapBlock("> ",null,e,()=>t.renderContent(e))},code_block(t,e){let i=e.textContent.match(/`{3,}/gm),n=i?i.sort().slice(-1)[0]+"`":"```";t.write(n+(e.attrs.params||"")+` `),t.text(e.textContent,!1),t.write(` `),t.write(n),t.closeBlock(e)},heading(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e,!1),t.closeBlock(e)},horizontal_rule(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list(t,e){t.renderList(e," ",()=>(e.attrs.bullet||"*")+" ")},ordered_list(t,e){let i=e.attrs.order||1,n=String(i+e.childCount-1).length,r=t.repeat(" ",n+2);t.renderList(e,r,o=>{let s=String(i+o);return t.repeat(" ",n-s.length)+s+". "})},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+e.attrs.src.replace(/[\(\)]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,i,n){for(let r=n+1;r`${r+1}) ${n.toString()}`).join(` `);for(let r=0;rthis.render(i,e,r))}renderInline(e,i=!0){this.atBlockStart=i;let n=[],r="",o=(s,a,u)=>{let l=s?s.marks:[];s&&s.type.name===this.options.hardBreakNodeName&&(l=l.filter(y=>{if(u+1==e.childCount)return!1;let b=e.child(u+1);return y.isInSet(b.marks)&&(!b.isText||/\S/.test(b.text))}));let c=r;if(r="",s&&s.isText&&l.some(y=>{let b=this.getMark(y.type.name);return b&&b.expelEnclosingWhitespace&&!y.isInSet(n)})){let[y,b,D]=/^(\s*)(.*)$/m.exec(s.text);b&&(c+=b,s=D?s.withText(D):null,s||(l=n))}if(s&&s.isText&&l.some(y=>{let b=this.getMark(y.type.name);return b&&b.expelEnclosingWhitespace&&(u==e.childCount-1||!y.isInSet(e.child(u+1).marks))})){let[y,b,D]=/^(.*?)(\s*)$/m.exec(s.text);D&&(r=D,s=b?s.withText(b):null,s||(l=n))}let f=l.length?l[l.length-1]:null,p=f&&this.getMark(f.type.name).escape===!1,m=l.length-(p?1:0);e:for(let y=0;yD?l=l.slice(0,D).concat(b).concat(l.slice(D,y)).concat(l.slice(y+1,m)):D>y&&(l=l.slice(0,y).concat(l.slice(y+1,D)).concat(b).concat(l.slice(D,m)));continue e}}}let g=0;for(;g0&&(this.atBlockStart=!1)};e.forEach(o),o(null,0,e.childCount),this.atBlockStart=!1}renderList(e,i,n){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let r=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,o=this.inTightList;this.inTightList=r,e.forEach((s,a,u)=>{u&&r&&this.flushClose(1),this.wrapBlock(i,n(u),e,()=>this.render(s,e,u))}),this.inTightList=o}esc(e,i=!1){return e=e.replace(/[`*\\~\[\]_]/g,(n,r)=>n=="_"&&r>0&&r+1])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(e=e.replace(this.options.escapeExtraCharacters,"\\$&")),e}quote(e){let i=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return i[0]+e+i[1]}repeat(e,i){let n="";for(let r=0;r${t}`,"text/html").body}function AG(t){var n,r,o;let e=t.parentElement,i=e==null?void 0:e.cloneNode();for(;e!=null&&e.firstChild&&e.firstChild!==t;)i==null||i.appendChild(e.firstChild);(((n=i==null?void 0:i.childNodes)==null?void 0:n.length)??0)>0&&i&&((r=e==null?void 0:e.parentElement)==null||r.insertBefore(i,e)),(o=e==null?void 0:e.parentElement)==null||o.insertBefore(t,e),(e==null?void 0:e.childNodes.length)===0&&e.remove()}function kG(t){let e=t.parentNode;for(;t!=null&&t.firstChild;)e==null||e.insertBefore(t.firstChild,t);e==null||e.removeChild(t)}function OG(t){return(t==null?void 0:t.replace(/",">"))??""}var NG=ft.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new Rt({key:new qt("markdownClipboard"),props:{clipboardTextParser:(t,e,i)=>{if(i||!this.options.transformPastedText)return null;let n=this.editor.storage.markdown.parser.parse(t,{inline:!0});return p1.fromSchema(this.editor.schema).parseSlice(l1(n),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),PG=Zt.create({name:"bold"}).extend({addStorage(){return{markdown:{serialize:rr.marks.strong,parse:{}}}}}),FG=Zt.create({name:"code"}).extend({addStorage(){return{markdown:{serialize:rr.marks.code,parse:{}}}}});function tO(t){let e=t.type.schema,i=e.text(" ",[t]),n=zs(Bt.from(i),e),r=/^(<.*?>) (<\/.*?>)$/.exec(n);return r?[r[1]??"",r[2]??""]:null}var oO=Zt.create({name:"markdownHTMLMark",addStorage(){return{markdown:{serialize:{open(t,e){var i,n;return(i=this.editor)!=null&&i.storage.markdown.options.html?((n=tO(e))==null?void 0:n[0])??"":(console.warn(`Tiptap Markdown: "${e.type.name}" mark is only available in html mode`),"")},close(t,e){var i,n;return(i=this.editor)!=null&&i.storage.markdown.options.html?((n=tO(e))==null?void 0:n[1])??"":""}},parse:{}}}}}),RG=Zt.create({name:"italic"}).extend({addStorage(){return{markdown:{serialize:rr.marks.em,parse:{}}}}}),LG=Zt.create({name:"link"}).extend({addStorage(){return{markdown:{serialize:rr.marks.link,parse:{}}}}}),HG=Zt.create({name:"strike"}).extend({addStorage(){return{markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}}}}),BG=X.create({name:"blockquote"}).extend({addStorage(){return{markdown:{serialize:rr.nodes.blockquote,parse:{}}}}}),sO=X.create({name:"bulletList"}).extend({addStorage(){return{markdown:{serialize(t,e){return t.renderList(e," ",()=>{var i;return`${((i=this==null?void 0:this.editor)==null?void 0:i.storage.markdown.options.bulletListMarker)||"-"} `})},parse:{}}}}}),VG=X.create({name:"codeBlock"}).extend({addStorage(){return{markdown:{serialize(t,e){t.write(`\`\`\`${e.attrs.language||""} `),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:((e=this.options)==null?void 0:e.languageClassPrefix)??"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replaceAll(` -`,"")}}}}}}),Xh=X.create({name:"markdownHTMLNode",addStorage(){return{markdown:{serialize(t,e,i){this.editor.storage.markdown.options.html?t.write(zG(e,i)):(console.warn(`Tiptap Markdown: "${e.type.name}" node is only available in html mode`),t.write(`[${e.type.name}]`)),e.isBlock&&t.closeBlock(e)},parse:{}}}}});function zG(t,e){let i=t.type.schema,n=zs(Bt.from(t),i);return t.isBlock&&(e instanceof Bt||e.type.name===i.topNodeType.name)?jG(n):n}function jG(t){let i=l1(t).firstElementChild;return i&&(i.innerHTML=i.innerHTML.trim()?` +`,"")}}}}}}),Jh=X.create({name:"markdownHTMLNode",addStorage(){return{markdown:{serialize(t,e,i){this.editor.storage.markdown.options.html?t.write(zG(e,i)):(console.warn(`Tiptap Markdown: "${e.type.name}" node is only available in html mode`),t.write(`[${e.type.name}]`)),e.isBlock&&t.closeBlock(e)},parse:{}}}}});function zG(t,e){let i=t.type.schema,n=zs(Bt.from(t),i);return t.isBlock&&(e instanceof Bt||e.type.name===i.topNodeType.name)?jG(n):n}function jG(t){let i=l1(t).firstElementChild;return i&&(i.innerHTML=i.innerHTML.trim()?` ${i.innerHTML} `:` -`),(i==null?void 0:i.outerHTML)??""}var aO=X.create({name:"hardBreak"}).extend({addStorage(){return{markdown:{serialize(t,e,i,n){for(let r=n+1;r0&&e.child(i-n-1).type.name===t.type.name;n++);return n}var ZG=X.create({name:"orderedList"}).extend({addStorage(){return{markdown:{serialize(t,e,i,n){let r=e.attrs.start||1,o=String(r+e.childCount-1).length,s=t.repeat(" ",o+2),u=qG(e,i,n)%2?") ":". ";t.renderList(e,s,l=>{let c=String(r+l);return t.repeat(" ",o-c.length)+c+u})},parse:{}}}}}),KG=X.create({name:"paragraph"}).extend({addStorage(){return{markdown:{serialize:rr.nodes.paragraph,parse:{}}}}});function r1(t){var e;return((e=t==null?void 0:t.content)==null?void 0:e.content)??[]}var YG=X.create({name:"table"}).extend({addStorage(){return{markdown:{serialize(t,e,i){if(!QG(e)){Xh.storage.markdown.serialize.call(this,t,e,i);return}t.inTable=!0,e.forEach((n,r,o)=>{if(t.write("| "),n.forEach((s,a,u)=>{u&&t.write(" | ");let l=s.firstChild;l!=null&&l.textContent.trim()&&t.renderInline(l)}),t.write(" |"),t.ensureNewLine(),!o){let s=Array.from({length:n.childCount}).map(()=>"---").join(" | ");t.write(`| ${s} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function nO(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function QG(t){let e=r1(t),i=e[0],n=e.slice(1);return r1(i).some(r=>r.type.name!=="tableHeader"||nO(r)||r.childCount>1)?!1:!n.some(r=>r1(r).some(o=>o.type.name==="tableHeader"||nO(o)||o.childCount>1))}var XG=X.create({name:"taskItem"}).extend({addStorage(){return{markdown:{serialize(t,e){let i=e.attrs.checked?"[x]":"[ ]";t.write(`${i} `),t.renderContent(e)},parse:{updateDOM(t){Array.from(t.querySelectorAll(".task-list-item")).forEach(e=>{let i=e.querySelector("input");e.setAttribute("data-type","taskItem"),i&&(e.setAttribute("data-checked",i.checked.toString()),i.remove())})}}}}}}),o1=!0,uO=!1,lO=!1;function JG(t,e){e&&(o1=!e.enabled,uO=!!e.label,lO=!!e.labelAfter),t.core.ruler.after("inline","github-task-lists",i=>{let n=i.tokens;for(let r=2;r=0;o--)if(((r=t[o])==null?void 0:r.level)===i)return o;return-1}function tW(t,e){return(t[e]&&aW(t[e])&&t[e-1]&&uW(t[e-1])&&t[e-2]&&lW(t[e-2])&&cW(t[e]))??!1}function nW(t,e){var i,n,r,o,s,a,u;if((i=t.children)==null||i.unshift(iW(t,e)),(n=t.children)!=null&&n[1]&&(t.children[1].content=t.children[1].content.slice(3)),t.content&&(t.content=t.content.slice(3)),uO)if(lO){(r=t.children)==null||r.pop();let l=`task-item-${Math.ceil(Math.random()*(1e4*1e3)-1e3)}`;(o=t.children)!=null&&o[0]&&(t.children[0].content=`${t.children[0].content.slice(0,-1)} id="${l}">`),(s=t.children)==null||s.push(sW(t.content,l,e))}else(a=t.children)==null||a.unshift(rW(e)),(u=t.children)==null||u.push(oW(e))}function iW(t,e){let i=new e("html_inline","",0),n=o1?' disabled="" ':"";return t!=null&&t.content.startsWith("[ ] ")?i.content=``:(t!=null&&t.content.startsWith("[x] ")||t!=null&&t.content.startsWith("[X] "))&&(i.content=``),i}function rW(t){let e=new t("html_inline","",0);return e.content="",e}function sW(t,e,i){let n=new i("html_inline","",0);return n.content=``,n.attrs=[{for:e}],n}function aW(t){return t.type==="inline"}function uW(t){return t.type==="paragraph_open"}function lW(t){return t.type==="list_item_open"}function cW(t){return t.content.startsWith("[ ] ")||t.content.startsWith("[x] ")||t.content.startsWith("[X] ")}var dW=X.create({name:"taskList"}).extend({addStorage(){return{markdown:{serialize:sO.storage.markdown.serialize,parse:{setup(t){t.use(JG)},updateDOM(t){Array.from(t.querySelectorAll(".contains-task-list")).forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),fW=X.create({name:"text"}).extend({addStorage(){return{markdown:{serialize(t,e){t.text(OG(e.text))},parse:{}}}}}),pW=[BG,sO,VG,aO,UG,$G,Xh,GG,WG,ZG,KG,YG,XG,dW,fW,PG,FG,oO,RG,LG,HG];function Qh(t){var n,r;let e=(n=t.storage)==null?void 0:n.markdown,i=(r=pW.find(o=>o.name===t.name))==null?void 0:r.storage.markdown;return e||i?M(M({},i),e):null}var s1=class{constructor(e,{html:i,linkify:n,breaks:r}){this.editor=e,this.md=this.withPatchedRenderer(fu({html:i,linkify:n,breaks:r}))}parse(e,{inline:i}={}){if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(o=>{var s,a,u;return(u=(a=(s=Qh(o))==null?void 0:s.parse)==null?void 0:a.setup)==null?void 0:u.call({editor:this.editor,options:o.options},this.md)});let n=this.md.render(e),r=l1(n);return this.editor.extensionManager.extensions.forEach(o=>{var s,a,u;return(u=(a=(s=Qh(o))==null?void 0:s.parse)==null?void 0:a.updateDOM)==null?void 0:u.call({editor:this.editor,options:o.options},r)}),this.normalizeDOM(r,{inline:i,content:e}),r.innerHTML}return e}normalizeDOM(e,{inline:i,content:n}){return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(r=>{var o,s;((o=r.nextSibling)==null?void 0:o.nodeType)===Node.TEXT_NODE&&!r.closest("pre")&&(r.nextSibling.textContent=((s=r.nextSibling.textContent)==null?void 0:s.replace(/^\n/,""))??"")}),i&&this.normalizeInline(e,n),e}normalizeBlocks(e){let n=Object.values(this.editor.schema.nodes).filter(r=>r.isBlock).map(r=>{var o;return(o=r.spec.parseDOM)==null?void 0:o.map(s=>s.tag)}).flat().filter(Boolean).join(",");n&&Array.from(e.querySelectorAll(n)).forEach(r=>{var o;(o=r.parentElement)!=null&&o.matches("p")&&AG(r)})}normalizeInline(e,i){var n,r,o;if((n=e.firstElementChild)!=null&&n.matches("p")){let s=e.firstElementChild,{nextElementSibling:a,innerHTML:u}=s,l=((r=/^\s+/.exec(i))==null?void 0:r[0])??"",c=a?"":((o=/\s+$/.exec(i))==null?void 0:o[0])??"";if(/^\n\n/.exec(i)){s.innerHTML=`${u}${c}`;return}kG(s),e.innerHTML=`${l}${e.innerHTML}${c}`}}withPatchedRenderer(e){let i=n=>(...r)=>{let o=n==null?void 0:n(...r);return o===` +`),(i==null?void 0:i.outerHTML)??""}var aO=X.create({name:"hardBreak"}).extend({addStorage(){return{markdown:{serialize(t,e,i,n){for(let r=n+1;r0&&e.child(i-n-1).type.name===t.type.name;n++);return n}var ZG=X.create({name:"orderedList"}).extend({addStorage(){return{markdown:{serialize(t,e,i,n){let r=e.attrs.start||1,o=String(r+e.childCount-1).length,s=t.repeat(" ",o+2),u=qG(e,i,n)%2?") ":". ";t.renderList(e,s,l=>{let c=String(r+l);return t.repeat(" ",o-c.length)+c+u})},parse:{}}}}}),KG=X.create({name:"paragraph"}).extend({addStorage(){return{markdown:{serialize:rr.nodes.paragraph,parse:{}}}}});function r1(t){var e;return((e=t==null?void 0:t.content)==null?void 0:e.content)??[]}var YG=X.create({name:"table"}).extend({addStorage(){return{markdown:{serialize(t,e,i){if(!QG(e)){Jh.storage.markdown.serialize.call(this,t,e,i);return}t.inTable=!0,e.forEach((n,r,o)=>{if(t.write("| "),n.forEach((s,a,u)=>{u&&t.write(" | ");let l=s.firstChild;l!=null&&l.textContent.trim()&&t.renderInline(l)}),t.write(" |"),t.ensureNewLine(),!o){let s=Array.from({length:n.childCount}).map(()=>"---").join(" | ");t.write(`| ${s} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function nO(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function QG(t){let e=r1(t),i=e[0],n=e.slice(1);return r1(i).some(r=>r.type.name!=="tableHeader"||nO(r)||r.childCount>1)?!1:!n.some(r=>r1(r).some(o=>o.type.name==="tableHeader"||nO(o)||o.childCount>1))}var XG=X.create({name:"taskItem"}).extend({addStorage(){return{markdown:{serialize(t,e){let i=e.attrs.checked?"[x]":"[ ]";t.write(`${i} `),t.renderContent(e)},parse:{updateDOM(t){Array.from(t.querySelectorAll(".task-list-item")).forEach(e=>{let i=e.querySelector("input");e.setAttribute("data-type","taskItem"),i&&(e.setAttribute("data-checked",i.checked.toString()),i.remove())})}}}}}}),o1=!0,uO=!1,lO=!1;function JG(t,e){e&&(o1=!e.enabled,uO=!!e.label,lO=!!e.labelAfter),t.core.ruler.after("inline","github-task-lists",i=>{let n=i.tokens;for(let r=2;r=0;o--)if(((r=t[o])==null?void 0:r.level)===i)return o;return-1}function tW(t,e){return(t[e]&&aW(t[e])&&t[e-1]&&uW(t[e-1])&&t[e-2]&&lW(t[e-2])&&cW(t[e]))??!1}function nW(t,e){var i,n,r,o,s,a,u;if((i=t.children)==null||i.unshift(iW(t,e)),(n=t.children)!=null&&n[1]&&(t.children[1].content=t.children[1].content.slice(3)),t.content&&(t.content=t.content.slice(3)),uO)if(lO){(r=t.children)==null||r.pop();let l=`task-item-${Math.ceil(Math.random()*(1e4*1e3)-1e3)}`;(o=t.children)!=null&&o[0]&&(t.children[0].content=`${t.children[0].content.slice(0,-1)} id="${l}">`),(s=t.children)==null||s.push(sW(t.content,l,e))}else(a=t.children)==null||a.unshift(rW(e)),(u=t.children)==null||u.push(oW(e))}function iW(t,e){let i=new e("html_inline","",0),n=o1?' disabled="" ':"";return t!=null&&t.content.startsWith("[ ] ")?i.content=``:(t!=null&&t.content.startsWith("[x] ")||t!=null&&t.content.startsWith("[X] "))&&(i.content=``),i}function rW(t){let e=new t("html_inline","",0);return e.content="",e}function sW(t,e,i){let n=new i("html_inline","",0);return n.content=``,n.attrs=[{for:e}],n}function aW(t){return t.type==="inline"}function uW(t){return t.type==="paragraph_open"}function lW(t){return t.type==="list_item_open"}function cW(t){return t.content.startsWith("[ ] ")||t.content.startsWith("[x] ")||t.content.startsWith("[X] ")}var dW=X.create({name:"taskList"}).extend({addStorage(){return{markdown:{serialize:sO.storage.markdown.serialize,parse:{setup(t){t.use(JG)},updateDOM(t){Array.from(t.querySelectorAll(".contains-task-list")).forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),fW=X.create({name:"text"}).extend({addStorage(){return{markdown:{serialize(t,e){t.text(OG(e.text))},parse:{}}}}}),pW=[BG,sO,VG,aO,UG,$G,Jh,GG,WG,ZG,KG,YG,XG,dW,fW,PG,FG,oO,RG,LG,HG];function Xh(t){var n,r;let e=(n=t.storage)==null?void 0:n.markdown,i=(r=pW.find(o=>o.name===t.name))==null?void 0:r.storage.markdown;return e||i?M(M({},i),e):null}var s1=class{constructor(e,{html:i,linkify:n,breaks:r}){this.editor=e,this.md=this.withPatchedRenderer(fu({html:i,linkify:n,breaks:r}))}parse(e,{inline:i}={}){if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(o=>{var s,a,u;return(u=(a=(s=Xh(o))==null?void 0:s.parse)==null?void 0:a.setup)==null?void 0:u.call({editor:this.editor,options:o.options},this.md)});let n=this.md.render(e),r=l1(n);return this.editor.extensionManager.extensions.forEach(o=>{var s,a,u;return(u=(a=(s=Xh(o))==null?void 0:s.parse)==null?void 0:a.updateDOM)==null?void 0:u.call({editor:this.editor,options:o.options},r)}),this.normalizeDOM(r,{inline:i,content:e}),r.innerHTML}return e}normalizeDOM(e,{inline:i,content:n}){return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(r=>{var o,s;((o=r.nextSibling)==null?void 0:o.nodeType)===Node.TEXT_NODE&&!r.closest("pre")&&(r.nextSibling.textContent=((s=r.nextSibling.textContent)==null?void 0:s.replace(/^\n/,""))??"")}),i&&this.normalizeInline(e,n),e}normalizeBlocks(e){let n=Object.values(this.editor.schema.nodes).filter(r=>r.isBlock).map(r=>{var o;return(o=r.spec.parseDOM)==null?void 0:o.map(s=>s.tag)}).flat().filter(Boolean).join(",");n&&Array.from(e.querySelectorAll(n)).forEach(r=>{var o;(o=r.parentElement)!=null&&o.matches("p")&&AG(r)})}normalizeInline(e,i){var n,r,o;if((n=e.firstElementChild)!=null&&n.matches("p")){let s=e.firstElementChild,{nextElementSibling:a,innerHTML:u}=s,l=((r=/^\s+/.exec(i))==null?void 0:r[0])??"",c=a?"":((o=/\s+$/.exec(i))==null?void 0:o[0])??"";if(/^\n\n/.exec(i)){s.innerHTML=`${u}${c}`;return}kG(s),e.innerHTML=`${l}${e.innerHTML}${c}`}}withPatchedRenderer(e){let i=n=>(...r)=>{let o=n==null?void 0:n(...r);return o===` `?o:o!=null&&o.endsWith(` -`)?o.slice(0,-1):o??""};return e.renderer.rules.hardbreak=i(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=i(e.renderer.rules.softbreak),e.renderer.rules.fence=i(e.renderer.rules.fence),e.renderer.rules.code_block=i(e.renderer.rules.code_block),e.renderer.renderToken=i(e.renderer.renderToken.bind(e.renderer)),e}},rO=fu();function cO(t,e){return rO.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new rO.inline.State(t,null,null,[]).scanDelims(e,!0)}function hW(t){let{text:e,delim:i,from:n,to:r}=t,o=n,s=e;for(;on&&!cO(s,o).can_close;)s=dO({text:s,delim:i,start:o,offset:-1}),o--;return{text:s,from:n,to:o}}function gW(t){let{text:e,delim:i,from:n,to:r}=t,o={text:e,from:n,to:r};return o=hW({text:o.text,delim:i,from:o.from,to:o.to}),o=mW({text:o.text,delim:i,from:o.from,to:o.to}),o.to-o.from[e,this.serializeNode(Xh)]))),Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type==="node"&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[]))}get marks(){return M(M({},Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(oO)]))),Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type==="mark"&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[]))}serialize(e){let i=new a1(this.nodes,this.marks,{hardBreakNodeName:aO.name});return i.renderContent(e),i.out}serializeNode(e){var i,n;return(n=(i=Qh(e))==null?void 0:i.serialize)==null?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;let i=(n=Qh(e))==null?void 0:n.serialize;return i?U(M({},i),{open:typeof i.open=="function"?i.open.bind({editor:this.editor,options:e.options}):i.open,close:typeof i.close=="function"?i.close.bind({editor:this.editor,options:e.options}):i.close}):null}},yW=ft.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:t=>t.getAttribute("data-tight")==="true"||!t.querySelector("p"),renderHTML:t=>({class:t.tight?this.options.tightClass:null,"data-tight":t.tight?"true":null})}}}]},addCommands(){return{toggleTight:(t=null)=>({editor:e,commands:i})=>this.options.listTypes.some(n=>{if(!e.isActive(n))return!1;let r=e.getAttributes(n);return i.updateAttributes(n,{tight:t??!(r!=null&&r.tight)})})}}}),Oxe=ft.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){var e,i,n,r;let t=(r=(n=(i=(e=x1)==null?void 0:e.Commands)==null?void 0:i.config)==null?void 0:n.addCommands)==null?void 0:r.call(n);return{setContent:(o,s,a)=>u=>{var l;return(l=t==null?void 0:t.setContent)==null?void 0:l.call(t,u.editor.storage.markdown.parser.parse(o),s,a)(u)},insertContentAt:(o,s,a)=>u=>{var l;return(l=t==null?void 0:t.insertContentAt)==null?void 0:l.call(t,o,u.editor.storage.markdown.parser.parse(s,{inline:!0}),a)(u)}}},onBeforeCreate(){this.editor.storage.markdown={options:M({},this.options),parser:new s1(this.editor,this.options),serializer:new u1(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[yW.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),NG.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});var Hxe=X.create({name:"audio",group:"block",content:"source+",addAttributes(){return Qa(Ev)},parseHTML(){return[{tag:"audio"}]},renderHTML({node:t,HTMLAttributes:e}){return["audio",e,...Gv(t)]}}),Bxe=X.create({name:"source",addAttributes(){return Qa(["src","type","width","height","media","sizes","srcset"])},parseHTML(){return[{tag:"source"}]},renderHTML({HTMLAttributes:t}){return["source",ee(t)]}}),Vxe=X.create({name:"video",group:"block",content:"source+",addAttributes(){return Qa(Ev)},parseHTML(){return[{tag:"video"}]},renderHTML({node:t,HTMLAttributes:e}){return["video",e,...Gv(t)]}});var Uxe=X.create({name:"mention",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},renderHTML({node:t}){return["span",this.HTMLAttributes,`@${t.attrs.label??t.attrs.id}`.replaceAll(/@+/g,"@")]}}},addAttributes(){return{id:{default:null,keepOnSplit:!0,parseHTML:t=>t.innerText,renderHTML:()=>({"data-type":this.name})},class:{default:null,keepOnSplit:!0}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){let i=this.options.renderHTML({options:this.options,node:t});return typeof i=="string"?["span",ee({"data-type":this.name},this.options.HTMLAttributes,e),i]:["span",ee({"data-type":this.name},this.options.HTMLAttributes,e),i==null?void 0:i[2]]}});var vW=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/,bW=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g,pO=t=>t.match(vW),fO=t=>t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",_W=t=>{let{url:e,allowFullscreen:i,autoplay:n,ccLanguage:r,ccLoadPolicy:o,controls:s,disableKBcontrols:a,enableIFrameApi:u,endTime:l,interfaceLanguage:c,ivLoadPolicy:f,loop:p,modestBranding:m,nocookie:g,origin:y,playlist:b,progressBarColor:D,startAt:I}=t;if(!pO(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){let ae=e.split("/").pop();return ae?`${fO(g)}${ae}`:null}let A=/(?:v=|shorts\/)([-\w]+)/gm.exec(e);if(!A||!A[1])return null;let V=`${fO(g)}${A[1]}`,z=[];return i===!1&&z.push("fs=0"),n&&z.push("autoplay=1"),r&&z.push(`cc_lang_pref=${r}`),o&&z.push("cc_load_policy=1"),s||z.push("controls=0"),a&&z.push("disablekb=1"),u&&z.push("enablejsapi=1"),l&&z.push(`end=${l}`),c&&z.push(`hl=${c}`),f&&z.push(`iv_load_policy=${f}`),p&&z.push("loop=1"),m&&z.push("modestbranding=1"),y&&z.push(`origin=${y}`),b&&z.push(`playlist=${b}`),I&&z.push(`start=${I}`),D&&z.push(`color=${D}`),z.length&&(V+=`?${z.join("&")}`),V},hO=X.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>pO(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[S1({find:bW,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){let e=_W({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0});return t.src=e,["div",{"data-youtube-video":""},["iframe",ee(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor},t)]]}});var Zxe=hO.extend({}).configure({autoplay:!1,ccLanguage:"en",interfaceLanguage:"en",allowFullscreen:!0,disableKBcontrols:!0});export{Ut as a,rn as b,vu as c,te as d,ym as e,vm as f,tt as g,on as h,sn as i,Ot as j,yn as k,ce as l,PO as m,FO as n,Jo as o,S as p,In as q,Fi as r,Hr as s,Cu as t,ct as u,gt as v,nt as w,ot as x,Eu as y,mC as z,mo as A,$t as B,wm as C,ke as D,wu as E,e3 as F,xm as G,t3 as H,n3 as I,i3 as J,Li as K,dt as L,bt as M,Kt as N,ei as O,j as P,vi as Q,$ as R,vn as S,$ee as T,k as U,Be as V,$e as W,h as X,qn as Y,Uu as Z,gr as _,Gu as $,k3 as aa,fr as ba,lg as ca,Yt as da,P as ea,F as fa,Gee as ga,re as ha,Wn as ia,it as ja,va as ka,_e as la,me as ma,Wee as na,de as oa,qee as pa,bi as qa,ri as ra,Zd as sa,Kd as ta,Zee as ua,C as va,It as wa,ca as xa,zt as ya,ge as za,N0 as Aa,KR as Ba,H as Ca,bn as Da,T as Ea,$i as Fa,oe as Ga,Mt as Ha,O as Ia,Qw as Ja,Da as Ka,lf as La,vr as Ma,Ke as Na,v as Oa,Ye as Pa,Te as Qa,Qee as Ra,Xee as Sa,Jee as Ta,E as Ua,w as Va,Q as Wa,_t as Xa,Ct as Ya,Qt as Za,q as _a,ms as $a,Ea as ab,x as bb,_ as cb,Xt as db,at as eb,_n as fb,Gt as gb,Qe as hb,Xe as ib,be as jb,he as kb,ey as lb,Nt as mb,cf as nb,ny as ob,df as pb,Z as qb,Qr as rb,Kn as sb,ete as tb,Y as ub,J as vb,hT as wb,tte as xb,nte as yb,We as zb,ite as Ab,rte as Bb,st as Cb,Pt as Db,qe as Eb,U6 as Fb,Lte as Gb,Ci as Hb,ut as Ib,LT as Jb,Re as Kb,wa as Lb,BI as Mb,Foe as Nb,Roe as Ob,Loe as Pb,xv as Qb,Lse as Rb,Hse as Sb,hp as Tb,Yse as Ub,Xse as Vb,_f as Wb,X6 as Xb,So as Yb,an as Zb,Df as _b,_r as $b,S4 as ac,k4 as bc,wf as cc,Jt as dc,Dne as ec,Se as fc,Cn as gc,gx as hc,Tne as ic,W as jc,B as kc,ul as lc,vy as mc,si as nc,xne as oc,Ft as pc,ht as qc,Yne as rc,ui as sc,No as tc,ka as uc,Qne as vc,Ee as wc,xx as xc,Ji as yc,Je as zc,Pn as Ac,Tf as Bc,Di as Cc,Mo as Dc,qie as Ec,Zie as Fc,tv as Gc,nv as Hc,iv as Ic,Ti as Jc,di as Kc,Ds as Lc,ov as Mc,pI as Nc,hI as Oc,mI as Pc,Yie as Qc,Aa as Rc,rt as Sc,Af as Tc,Nne as Uc,Jr as Vc,$H as Wc,Va as Xc,vS as Yc,KH as Zc,Sae as _c,Mae as $c,Aae as ad,kae as bd,Nae as cd,Pae as dd,wp as ed,Rae as fd,Lae as gd,Oo as hd,TS as id,Le as jd,IS as kd,SS as ld,vue as md,Ga as nd,aB as od,II as pd,cv as qd,dv as rd,Rn as sd,Rf as td,rie as ud,Po as vd,Ki as wd,P5 as xd,wy as yd,Ay as zd,Px as Ad,Qf as Bd,Gx as Cd,Wx as Dd,Qi as Ed,Na as Fd,Tie as Gd,Sie as Hd,Yoe as Id,Qoe as Jd,OS as Kd,bB as Ld,Wa as Md,Vue as Nd,zue as Od,Ore as Pd,EI as Qd,YI as Rd,Jue as Sd,ele as Td,ale as Ud,bl as Vd,Uie as Wd,_l as Xd,Cs as Yd,fI as Zd,ple as _d,Ze as $d,LB as ae,Tt as be,Zle as ce,HS as de,Kle as ee,zS as fe,mce as ge,_I as he,Vo as ie,$S as je,kp as ke,ade as le,wI as me,ife as ne,BH as oe,Fa as pe,Oe as qe,Tl as re,Lo as se,VH as te,Ev as ue,Ln as ve,kse as we,wv as xe,tS as ye,xl as ze,zH as Ae,nS as Be,iS as Ce,Tv as De,rS as Ee,xe as Fe,Ose as Ge,oS as He,sS as Ie,aS as Je,uS as Ke,fp as Le,Nse as Me,lt as Ne,lS as Oe,cS as Pe,dS as Qe,fS as Re,pp as Se,Ra as Te,pS as Ue,Il as Ve,ufe as We,Np as Xe,Ya as Ye,t2 as Ze,Gv as _e,Pp as $e,n2 as af,Fp as bf,pfe as cf,hfe as df,Qa as ef,r2 as ff,o2 as gf,mfe as hf,SV as if,je as jf,Ol as kf,Bfe as lf,Qfe as mf,Xfe as nf,ppe as of,xpe as pf,FV as qf,Spe as rf,Kv as sf,lhe as tf,f9 as uf,h9 as vf,g2 as wf,b2 as xf,_2 as yf,C2 as zf,D2 as Af,E2 as Bf,w2 as Cf,x2 as Df,I2 as Ef,S2 as Ff,M2 as Gf,T0e as Hf,N2 as If,I0e as Jf,V0e as Kf,P2 as Lf,z0e as Mf,j0e as Nf,N9 as Of,P9 as Pf,R9 as Qf,G2 as Rf,ege as Sf,nb as Tf,W2 as Uf,q2 as Vf,Z2 as Wf,oge as Xf,Y2 as Yf,Q2 as Zf,uz as _f,Bge as $f,Vge as ag,J2 as bg,eM as cg,tM as dg,nM as eg,iM as fg,eu as gg,rM as hg,oM as ig,sM as jg,ob as kg,_j as lg,aM as mg,Cj as ng,Dj as og,Ej as pg,Ibe as qg,sb as rg,zp as sg,tu as tg,jp as ug,Up as vg,uM as wg,lM as xg,cM as yg,dM as zg,fM as Ag,pM as Bg,hM as Cg,Aj as Dg,mM as Eg,gM as Fg,NM as Gg,PM as Hg,RM as Ig,pA as Jg,GA as Kg,qA as Lg,ZA as Mg,pDe as Ng,bU as Og,yDe as Pg,_U as Qg,CU as Rg,ADe as Sg,xU as Tg,IU as Ug,MU as Vg,AU as Wg,nEe as Xg,l1 as Yg,AG as Zg,kG as _g,OG as $g,NG as ah,r1 as bh,JG as ch,Qh as dh,s1 as eh,gW as fh,dO as gh,a1 as hh,u1 as ih,yW as jh,Oxe as kh,Hxe as lh,Bxe as mh,Vxe as nh,Uxe as oh,Zxe as ph}; -//# sourceMappingURL=chunk-UQ26QW4E.js.map +`)?o.slice(0,-1):o??""};return e.renderer.rules.hardbreak=i(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=i(e.renderer.rules.softbreak),e.renderer.rules.fence=i(e.renderer.rules.fence),e.renderer.rules.code_block=i(e.renderer.rules.code_block),e.renderer.renderToken=i(e.renderer.renderToken.bind(e.renderer)),e}},rO=fu();function cO(t,e){return rO.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new rO.inline.State(t,null,null,[]).scanDelims(e,!0)}function hW(t){let{text:e,delim:i,from:n,to:r}=t,o=n,s=e;for(;on&&!cO(s,o).can_close;)s=dO({text:s,delim:i,start:o,offset:-1}),o--;return{text:s,from:n,to:o}}function gW(t){let{text:e,delim:i,from:n,to:r}=t,o={text:e,from:n,to:r};return o=hW({text:o.text,delim:i,from:o.from,to:o.to}),o=mW({text:o.text,delim:i,from:o.from,to:o.to}),o.to-o.from[e,this.serializeNode(Jh)]))),Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type==="node"&&this.serializeNode(e)).map(e=>[e.name,this.serializeNode(e)])??[]))}get marks(){return M(M({},Object.fromEntries(Object.keys(this.editor.schema.marks).map(e=>[e,this.serializeMark(oO)]))),Object.fromEntries(this.editor.extensionManager.extensions.filter(e=>e.type==="mark"&&this.serializeMark(e)).map(e=>[e.name,this.serializeMark(e)])??[]))}serialize(e){let i=new a1(this.nodes,this.marks,{hardBreakNodeName:aO.name});return i.renderContent(e),i.out}serializeNode(e){var i,n;return(n=(i=Xh(e))==null?void 0:i.serialize)==null?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;let i=(n=Xh(e))==null?void 0:n.serialize;return i?U(M({},i),{open:typeof i.open=="function"?i.open.bind({editor:this.editor,options:e.options}):i.open,close:typeof i.close=="function"?i.close.bind({editor:this.editor,options:e.options}):i.close}):null}},yW=ft.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:t=>t.getAttribute("data-tight")==="true"||!t.querySelector("p"),renderHTML:t=>({class:t.tight?this.options.tightClass:null,"data-tight":t.tight?"true":null})}}}]},addCommands(){return{toggleTight:(t=null)=>({editor:e,commands:i})=>this.options.listTypes.some(n=>{if(!e.isActive(n))return!1;let r=e.getAttributes(n);return i.updateAttributes(n,{tight:t??!(r!=null&&r.tight)})})}}}),Oxe=ft.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){var e,i,n,r;let t=(r=(n=(i=(e=x1)==null?void 0:e.Commands)==null?void 0:i.config)==null?void 0:n.addCommands)==null?void 0:r.call(n);return{setContent:(o,s,a)=>u=>{var l;return(l=t==null?void 0:t.setContent)==null?void 0:l.call(t,u.editor.storage.markdown.parser.parse(o),s,a)(u)},insertContentAt:(o,s,a)=>u=>{var l;return(l=t==null?void 0:t.insertContentAt)==null?void 0:l.call(t,o,u.editor.storage.markdown.parser.parse(s,{inline:!0}),a)(u)}}},onBeforeCreate(){this.editor.storage.markdown={options:M({},this.options),parser:new s1(this.editor,this.options),serializer:new u1(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage(){return{}},addExtensions(){return[yW.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),NG.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});var Hxe=X.create({name:"audio",group:"block",content:"source+",addAttributes(){return Qa(Ev)},parseHTML(){return[{tag:"audio"}]},renderHTML({node:t,HTMLAttributes:e}){return["audio",e,...Gv(t)]}}),Bxe=X.create({name:"source",addAttributes(){return Qa(["src","type","width","height","media","sizes","srcset"])},parseHTML(){return[{tag:"source"}]},renderHTML({HTMLAttributes:t}){return["source",ee(t)]}}),Vxe=X.create({name:"video",group:"block",content:"source+",addAttributes(){return Qa(Ev)},parseHTML(){return[{tag:"video"}]},renderHTML({node:t,HTMLAttributes:e}){return["video",e,...Gv(t)]}});var Uxe=X.create({name:"mention",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},renderHTML({node:t}){return["span",this.HTMLAttributes,`@${t.attrs.label??t.attrs.id}`.replaceAll(/@+/g,"@")]}}},addAttributes(){return{id:{default:null,keepOnSplit:!0,parseHTML:t=>t.innerText,renderHTML:()=>({"data-type":this.name})},class:{default:null,keepOnSplit:!0}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){let i=this.options.renderHTML({options:this.options,node:t});return typeof i=="string"?["span",ee({"data-type":this.name},this.options.HTMLAttributes,e),i]:["span",ee({"data-type":this.name},this.options.HTMLAttributes,e),i==null?void 0:i[2]]}});var vW=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/,bW=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g,pO=t=>t.match(vW),fO=t=>t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",_W=t=>{let{url:e,allowFullscreen:i,autoplay:n,ccLanguage:r,ccLoadPolicy:o,controls:s,disableKBcontrols:a,enableIFrameApi:u,endTime:l,interfaceLanguage:c,ivLoadPolicy:f,loop:p,modestBranding:m,nocookie:g,origin:y,playlist:b,progressBarColor:D,startAt:I}=t;if(!pO(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){let ae=e.split("/").pop();return ae?`${fO(g)}${ae}`:null}let A=/(?:v=|shorts\/)([-\w]+)/gm.exec(e);if(!A||!A[1])return null;let V=`${fO(g)}${A[1]}`,z=[];return i===!1&&z.push("fs=0"),n&&z.push("autoplay=1"),r&&z.push(`cc_lang_pref=${r}`),o&&z.push("cc_load_policy=1"),s||z.push("controls=0"),a&&z.push("disablekb=1"),u&&z.push("enablejsapi=1"),l&&z.push(`end=${l}`),c&&z.push(`hl=${c}`),f&&z.push(`iv_load_policy=${f}`),p&&z.push("loop=1"),m&&z.push("modestbranding=1"),y&&z.push(`origin=${y}`),b&&z.push(`playlist=${b}`),I&&z.push(`start=${I}`),D&&z.push(`color=${D}`),z.length&&(V+=`?${z.join("&")}`),V},hO=X.create({name:"youtube",addOptions(){return{addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML(){return[{tag:"div[data-youtube-video] iframe"}]},addCommands(){return{setYoutubeVideo:t=>({commands:e})=>pO(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[S1({find:bW,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){let e=_W({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0});return t.src=e,["div",{"data-youtube-video":""},["iframe",ee(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor},t)]]}});var Zxe=hO.extend({}).configure({autoplay:!1,ccLanguage:"en",interfaceLanguage:"en",allowFullscreen:!0,disableKBcontrols:!0});export{Ut as a,rn as b,vu as c,te as d,vm as e,bm as f,tt as g,on as h,sn as i,Ot as j,yn as k,ce as l,PO as m,FO as n,Jo as o,S as p,In as q,Fi as r,Hr as s,Cu as t,ct as u,gt as v,nt as w,ot as x,Eu as y,mC as z,mo as A,$t as B,Tm as C,ke as D,wu as E,e3 as F,Im as G,t3 as H,n3 as I,i3 as J,Li as K,dt as L,bt as M,Kt as N,ei as O,j as P,vi as Q,$ as R,vn as S,$ee as T,k as U,Be as V,$e as W,h as X,qn as Y,Uu as Z,gr as _,Gu as $,k3 as aa,fr as ba,cg as ca,Yt as da,P as ea,F as fa,Gee as ga,re as ha,Wn as ia,it as ja,va as ka,_e as la,me as ma,Wee as na,de as oa,qee as pa,bi as qa,ri as ra,Zd as sa,Kd as ta,Zee as ua,C as va,It as wa,ca as xa,zt as ya,ge as za,P0 as Aa,KR as Ba,H as Ca,bn as Da,T as Ea,$i as Fa,oe as Ga,Mt as Ha,O as Ia,Qw as Ja,Da as Ka,lf as La,vr as Ma,Ke as Na,v as Oa,Ye as Pa,Te as Qa,Qee as Ra,Xee as Sa,Jee as Ta,E as Ua,w as Va,Q as Wa,_t as Xa,Ct as Ya,Qt as Za,q as _a,ms as $a,Ea as ab,x as bb,_ as cb,Xt as db,at as eb,_n as fb,Gt as gb,Qe as hb,Xe as ib,be as jb,he as kb,ty as lb,Nt as mb,cf as nb,iy as ob,df as pb,Z as qb,Qr as rb,Kn as sb,ete as tb,Y as ub,J as vb,hT as wb,tte as xb,nte as yb,We as zb,ite as Ab,rte as Bb,st as Cb,Pt as Db,qe as Eb,U6 as Fb,Lte as Gb,Ci as Hb,ut as Ib,LT as Jb,Re as Kb,wa as Lb,BI as Mb,Foe as Nb,Roe as Ob,Loe as Pb,xv as Qb,Lse as Rb,Hse as Sb,mp as Tb,Yse as Ub,Xse as Vb,_f as Wb,X6 as Xb,So as Yb,an as Zb,Df as _b,_r as $b,S4 as ac,k4 as bc,wf as cc,Jt as dc,Dne as ec,Se as fc,Cn as gc,gx as hc,Tne as ic,W as jc,B as kc,ul as lc,by as mc,si as nc,xne as oc,Ft as pc,ht as qc,Yne as rc,ui as sc,No as tc,ka as uc,Qne as vc,Ee as wc,xx as xc,Ji as yc,Je as zc,Pn as Ac,Tf as Bc,Di as Cc,Mo as Dc,qie as Ec,Zie as Fc,nv as Gc,iv as Hc,rv as Ic,Ti as Jc,di as Kc,Ds as Lc,sv as Mc,pI as Nc,hI as Oc,mI as Pc,Yie as Qc,Aa as Rc,rt as Sc,Af as Tc,Nne as Uc,Jr as Vc,$H as Wc,Va as Xc,vS as Yc,KH as Zc,Sae as _c,Mae as $c,Aae as ad,kae as bd,Nae as cd,Pae as dd,Tp as ed,Rae as fd,Lae as gd,Oo as hd,TS as id,Le as jd,IS as kd,SS as ld,vue as md,Ga as nd,aB as od,II as pd,dv as qd,fv as rd,Rn as sd,Rf as td,rie as ud,Po as vd,Ki as wd,P5 as xd,Ty as yd,ky as zd,Px as Ad,Qf as Bd,Gx as Cd,Wx as Dd,Qi as Ed,Na as Fd,Tie as Gd,Sie as Hd,Yoe as Id,Qoe as Jd,OS as Kd,bB as Ld,Wa as Md,Vue as Nd,zue as Od,Ore as Pd,EI as Qd,YI as Rd,Jue as Sd,ele as Td,ale as Ud,bl as Vd,Uie as Wd,_l as Xd,Cs as Yd,fI as Zd,ple as _d,Ze as $d,LB as ae,Tt as be,Zle as ce,HS as de,Kle as ee,zS as fe,mce as ge,_I as he,Vo as ie,$S as je,Op as ke,ade as le,wI as me,ife as ne,BH as oe,Fa as pe,Oe as qe,Tl as re,Lo as se,VH as te,Ev as ue,Ln as ve,kse as we,wv as xe,tS as ye,xl as ze,zH as Ae,nS as Be,iS as Ce,Tv as De,rS as Ee,xe as Fe,Ose as Ge,oS as He,sS as Ie,aS as Je,uS as Ke,pp as Le,Nse as Me,lt as Ne,lS as Oe,cS as Pe,dS as Qe,fS as Re,hp as Se,Ra as Te,pS as Ue,Il as Ve,ufe as We,Pp as Xe,Ya as Ye,t2 as Ze,Gv as _e,Fp as $e,n2 as af,Rp as bf,pfe as cf,hfe as df,Qa as ef,r2 as ff,o2 as gf,mfe as hf,SV as if,je as jf,Ol as kf,Bfe as lf,Qfe as mf,Xfe as nf,ppe as of,xpe as pf,FV as qf,Spe as rf,Kv as sf,lhe as tf,f9 as uf,h9 as vf,g2 as wf,b2 as xf,_2 as yf,C2 as zf,D2 as Af,E2 as Bf,w2 as Cf,x2 as Df,I2 as Ef,S2 as Ff,M2 as Gf,T0e as Hf,N2 as If,I0e as Jf,V0e as Kf,P2 as Lf,z0e as Mf,j0e as Nf,N9 as Of,P9 as Pf,R9 as Qf,G2 as Rf,ege as Sf,nb as Tf,W2 as Uf,q2 as Vf,Z2 as Wf,oge as Xf,Y2 as Yf,Q2 as Zf,uz as _f,Bge as $f,Vge as ag,J2 as bg,eM as cg,tM as dg,nM as eg,iM as fg,eu as gg,rM as hg,oM as ig,sM as jg,ob as kg,_j as lg,aM as mg,Cj as ng,Dj as og,Ej as pg,Ibe as qg,sb as rg,jp as sg,tu as tg,Up as ug,$p as vg,uM as wg,lM as xg,cM as yg,dM as zg,fM as Ag,pM as Bg,hM as Cg,Aj as Dg,mM as Eg,gM as Fg,NM as Gg,PM as Hg,RM as Ig,pA as Jg,GA as Kg,qA as Lg,ZA as Mg,pDe as Ng,bU as Og,yDe as Pg,_U as Qg,CU as Rg,ADe as Sg,xU as Tg,IU as Ug,MU as Vg,AU as Wg,nEe as Xg,l1 as Yg,AG as Zg,kG as _g,OG as $g,NG as ah,r1 as bh,JG as ch,Xh as dh,s1 as eh,gW as fh,dO as gh,a1 as hh,u1 as ih,yW as jh,Oxe as kh,Hxe as lh,Bxe as mh,Vxe as nh,Uxe as oh,Zxe as ph}; +//# sourceMappingURL=chunk-7PCLFWKE.js.map diff --git a/chunk-7PCLFWKE.js.map b/chunk-7PCLFWKE.js.map new file mode 100644 index 00000000..b8077df4 --- /dev/null +++ b/chunk-7PCLFWKE.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/@angular/core/fesm2022/primitives/signals.mjs","node_modules/rxjs/dist/esm/internal/util/isFunction.js","node_modules/rxjs/dist/esm/internal/util/createErrorClass.js","node_modules/rxjs/dist/esm/internal/util/UnsubscriptionError.js","node_modules/rxjs/dist/esm/internal/util/arrRemove.js","node_modules/rxjs/dist/esm/internal/Subscription.js","node_modules/rxjs/dist/esm/internal/config.js","node_modules/rxjs/dist/esm/internal/scheduler/timeoutProvider.js","node_modules/rxjs/dist/esm/internal/util/reportUnhandledError.js","node_modules/rxjs/dist/esm/internal/util/noop.js","node_modules/rxjs/dist/esm/internal/NotificationFactories.js","node_modules/rxjs/dist/esm/internal/util/errorContext.js","node_modules/rxjs/dist/esm/internal/Subscriber.js","node_modules/rxjs/dist/esm/internal/symbol/observable.js","node_modules/rxjs/dist/esm/internal/util/identity.js","node_modules/rxjs/dist/esm/internal/util/pipe.js","node_modules/rxjs/dist/esm/internal/Observable.js","node_modules/rxjs/dist/esm/internal/util/lift.js","node_modules/rxjs/dist/esm/internal/operators/OperatorSubscriber.js","node_modules/rxjs/dist/esm/internal/operators/refCount.js","node_modules/rxjs/dist/esm/internal/observable/ConnectableObservable.js","node_modules/rxjs/dist/esm/internal/util/ObjectUnsubscribedError.js","node_modules/rxjs/dist/esm/internal/Subject.js","node_modules/rxjs/dist/esm/internal/BehaviorSubject.js","node_modules/rxjs/dist/esm/internal/scheduler/dateTimestampProvider.js","node_modules/rxjs/dist/esm/internal/ReplaySubject.js","node_modules/rxjs/dist/esm/internal/scheduler/Action.js","node_modules/rxjs/dist/esm/internal/scheduler/intervalProvider.js","node_modules/rxjs/dist/esm/internal/scheduler/AsyncAction.js","node_modules/rxjs/dist/esm/internal/Scheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/AsyncScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/async.js","node_modules/rxjs/dist/esm/internal/observable/empty.js","node_modules/rxjs/dist/esm/internal/util/isScheduler.js","node_modules/rxjs/dist/esm/internal/util/args.js","node_modules/tslib/tslib.es6.mjs","node_modules/rxjs/dist/esm/internal/util/isArrayLike.js","node_modules/rxjs/dist/esm/internal/util/isPromise.js","node_modules/rxjs/dist/esm/internal/util/isInteropObservable.js","node_modules/rxjs/dist/esm/internal/util/isAsyncIterable.js","node_modules/rxjs/dist/esm/internal/util/throwUnobservableError.js","node_modules/rxjs/dist/esm/internal/symbol/iterator.js","node_modules/rxjs/dist/esm/internal/util/isIterable.js","node_modules/rxjs/dist/esm/internal/util/isReadableStreamLike.js","node_modules/rxjs/dist/esm/internal/observable/innerFrom.js","node_modules/rxjs/dist/esm/internal/util/executeSchedule.js","node_modules/rxjs/dist/esm/internal/operators/observeOn.js","node_modules/rxjs/dist/esm/internal/operators/subscribeOn.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleObservable.js","node_modules/rxjs/dist/esm/internal/scheduled/schedulePromise.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleArray.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleIterable.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleAsyncIterable.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleReadableStreamLike.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduled.js","node_modules/rxjs/dist/esm/internal/observable/from.js","node_modules/rxjs/dist/esm/internal/observable/of.js","node_modules/rxjs/dist/esm/internal/observable/throwError.js","node_modules/rxjs/dist/esm/internal/util/isObservable.js","node_modules/rxjs/dist/esm/internal/util/EmptyError.js","node_modules/rxjs/dist/esm/internal/util/isDate.js","node_modules/rxjs/dist/esm/internal/operators/map.js","node_modules/rxjs/dist/esm/internal/util/mapOneOrManyArgs.js","node_modules/rxjs/dist/esm/internal/util/argsArgArrayOrObject.js","node_modules/rxjs/dist/esm/internal/util/createObject.js","node_modules/rxjs/dist/esm/internal/observable/combineLatest.js","node_modules/rxjs/dist/esm/internal/operators/mergeInternals.js","node_modules/rxjs/dist/esm/internal/operators/mergeMap.js","node_modules/rxjs/dist/esm/internal/operators/mergeAll.js","node_modules/rxjs/dist/esm/internal/operators/concatAll.js","node_modules/rxjs/dist/esm/internal/observable/concat.js","node_modules/rxjs/dist/esm/internal/observable/defer.js","node_modules/rxjs/dist/esm/internal/observable/forkJoin.js","node_modules/rxjs/dist/esm/internal/observable/fromEvent.js","node_modules/rxjs/dist/esm/internal/observable/timer.js","node_modules/rxjs/dist/esm/internal/observable/merge.js","node_modules/rxjs/dist/esm/internal/observable/never.js","node_modules/rxjs/dist/esm/internal/util/argsOrArgArray.js","node_modules/rxjs/dist/esm/internal/operators/filter.js","node_modules/rxjs/dist/esm/internal/observable/race.js","node_modules/rxjs/dist/esm/internal/operators/catchError.js","node_modules/rxjs/dist/esm/internal/operators/scanInternals.js","node_modules/rxjs/dist/esm/internal/operators/concatMap.js","node_modules/rxjs/dist/esm/internal/operators/debounce.js","node_modules/rxjs/dist/esm/internal/operators/defaultIfEmpty.js","node_modules/rxjs/dist/esm/internal/operators/take.js","node_modules/rxjs/dist/esm/internal/operators/ignoreElements.js","node_modules/rxjs/dist/esm/internal/operators/mapTo.js","node_modules/rxjs/dist/esm/internal/operators/delayWhen.js","node_modules/rxjs/dist/esm/internal/operators/delay.js","node_modules/rxjs/dist/esm/internal/operators/distinctUntilChanged.js","node_modules/rxjs/dist/esm/internal/operators/throwIfEmpty.js","node_modules/rxjs/dist/esm/internal/operators/endWith.js","node_modules/rxjs/dist/esm/internal/operators/finalize.js","node_modules/rxjs/dist/esm/internal/operators/first.js","node_modules/rxjs/dist/esm/internal/operators/takeLast.js","node_modules/rxjs/dist/esm/internal/operators/last.js","node_modules/rxjs/dist/esm/internal/operators/pairwise.js","node_modules/rxjs/dist/esm/internal/operators/repeat.js","node_modules/rxjs/dist/esm/internal/operators/scan.js","node_modules/rxjs/dist/esm/internal/operators/share.js","node_modules/rxjs/dist/esm/internal/operators/shareReplay.js","node_modules/rxjs/dist/esm/internal/operators/skip.js","node_modules/rxjs/dist/esm/internal/operators/skipWhile.js","node_modules/rxjs/dist/esm/internal/operators/startWith.js","node_modules/rxjs/dist/esm/internal/operators/switchMap.js","node_modules/rxjs/dist/esm/internal/operators/takeUntil.js","node_modules/rxjs/dist/esm/internal/operators/takeWhile.js","node_modules/rxjs/dist/esm/internal/operators/tap.js","node_modules/rxjs/dist/esm/internal/operators/throttle.js","node_modules/rxjs/dist/esm/internal/operators/throttleTime.js","node_modules/rxjs/dist/esm/internal/operators/withLatestFrom.js","node_modules/@angular/core/fesm2022/core.mjs","node_modules/@angular/core/fesm2022/rxjs-interop.mjs","node_modules/@angular/common/fesm2022/common.mjs","node_modules/@angular/forms/fesm2022/forms.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-constants.mjs","node_modules/@ng-web-apis/common/fesm2022/ng-web-apis-common.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-utils-math.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-utils-miscellaneous.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-observables.mjs","node_modules/@ng-web-apis/platform/fesm2022/ng-web-apis-platform.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-utils-color.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-utils-di.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-utils-dom.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-utils-focus.mjs","node_modules/@angular/animations/fesm2022/animations.mjs","node_modules/@angular/animations/fesm2022/browser.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-tokens.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-classes.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-date-time.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-active-zone.mjs","node_modules/@angular/cdk/fesm2022/coercion.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-auto-focus.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-element.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-hovered.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-item.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-let.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-native-validator.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-obscured.mjs","node_modules/@taiga-ui/polymorpheus/fesm2022/taiga-ui-polymorpheus.mjs","node_modules/@angular/common/fesm2022/http.mjs","node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-services.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-repeat-times.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-resizer.mjs","node_modules/@taiga-ui/i18n/fesm2022/taiga-ui-i18n-languages-english.mjs","node_modules/@taiga-ui/i18n/fesm2022/taiga-ui-i18n-tokens.mjs","node_modules/@taiga-ui/i18n/fesm2022/taiga-ui-i18n-utils.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-common.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-animations.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-classes.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-directives-appearance.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-tokens.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-directives-icons.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-button.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-link.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-utils-dom.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-utils-miscellaneous.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-scrollbar.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-services.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-pipes-month.mjs","node_modules/@taiga-ui/event-plugins/fesm2022/taiga-ui-event-plugins.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-directives-dropdown.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-data-list.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-icon.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-label.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-directives-hint.mjs","node_modules/@ng-web-apis/resize-observer/fesm2022/ng-web-apis-resize-observer.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-textfield.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-directives-group.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-directives-image-preview.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-utils.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-directives-tiptap-editor.mjs","node_modules/@taiga-ui/kit/fesm2022/taiga-ui-kit-directives-chevron.mjs","node_modules/@taiga-ui/kit/fesm2022/taiga-ui-kit-tokens.mjs","node_modules/@taiga-ui/kit/fesm2022/taiga-ui-kit-directives-tooltip.mjs","node_modules/@maskito/core/index.esm.js","node_modules/@taiga-ui/kit/fesm2022/taiga-ui-kit-components-input-inline.mjs","node_modules/@maskito/angular/fesm2022/maskito-angular.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-edit-link.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-editor-socket.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-align-content.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-code.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-details.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-details-details-remove.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-font-size.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-font-style.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-group.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-tokens.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-classes.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-directives-textfield-controller.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-directives-wrapper.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-utils.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-components-tooltip.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-components-primitive-textfield.mjs","node_modules/@taiga-ui/legacy/fesm2022/taiga-ui-legacy-components-color-selector.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-highlight-color.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-list-configs.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-table-cell-color.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-table-create.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-table-merge-cells.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-table-row-column-manager.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar-tools-text-color.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-toolbar.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-editor.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-tiptap-node-view.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-components-editor-resizable.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-background-color.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-details.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-file-link.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-font-color.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-font-size.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-indent-outdent.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-jump-anchor.mjs","node_modules/linkifyjs/dist/linkify.es.js","node_modules/@tiptap/extension-link/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-link.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-enter.mjs","node_modules/@tiptap/extension-horizontal-rule/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-horizontal.mjs","node_modules/@tiptap/extension-blockquote/dist/index.js","node_modules/@tiptap/extension-bold/dist/index.js","node_modules/@tiptap/extension-bullet-list/dist/index.js","node_modules/@tiptap/extension-code/dist/index.js","node_modules/@tiptap/extension-code-block/dist/index.js","node_modules/@tiptap/extension-document/dist/index.js","node_modules/prosemirror-dropcursor/dist/index.js","node_modules/@tiptap/extension-dropcursor/dist/index.js","node_modules/prosemirror-gapcursor/dist/index.js","node_modules/@tiptap/extension-gapcursor/dist/index.js","node_modules/@tiptap/extension-hard-break/dist/index.js","node_modules/@tiptap/extension-heading/dist/index.js","node_modules/rope-sequence/dist/index.js","node_modules/prosemirror-history/dist/index.js","node_modules/@tiptap/extension-history/dist/index.js","node_modules/@tiptap/extension-italic/dist/index.js","node_modules/@tiptap/extension-list-item/dist/index.js","node_modules/@tiptap/extension-ordered-list/dist/index.js","node_modules/@tiptap/extension-paragraph/dist/index.js","node_modules/@tiptap/extension-placeholder/dist/index.js","node_modules/@tiptap/extension-strike/dist/index.js","node_modules/@tiptap/extension-task-item/dist/index.js","node_modules/@tiptap/extension-task-list/dist/index.js","node_modules/@tiptap/extension-text/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-starter-kit.mjs","node_modules/prosemirror-tables/dist/index.js","node_modules/@tiptap/extension-table/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-table.mjs","node_modules/@tiptap/extension-table-cell/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-table-cell.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-table-cell-background.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-default-editor-extensions.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-group.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-iframe-editor.mjs","node_modules/@tiptap/extension-image/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-image-editor.mjs","node_modules/markdown-it/lib/common/utils.mjs","node_modules/mdurl/index.mjs","node_modules/mdurl/lib/decode.mjs","node_modules/mdurl/lib/encode.mjs","node_modules/mdurl/lib/format.mjs","node_modules/mdurl/lib/parse.mjs","node_modules/uc.micro/index.mjs","node_modules/uc.micro/properties/Any/regex.mjs","node_modules/uc.micro/categories/Cc/regex.mjs","node_modules/uc.micro/categories/Cf/regex.mjs","node_modules/uc.micro/categories/P/regex.mjs","node_modules/uc.micro/categories/S/regex.mjs","node_modules/uc.micro/categories/Z/regex.mjs","node_modules/entities/lib/esm/generated/decode-data-html.js","node_modules/entities/lib/esm/generated/decode-data-xml.js","node_modules/entities/lib/esm/decode_codepoint.js","node_modules/entities/lib/esm/decode.js","node_modules/entities/lib/esm/generated/encode-html.js","node_modules/entities/lib/esm/escape.js","node_modules/markdown-it/lib/helpers/index.mjs","node_modules/markdown-it/lib/helpers/parse_link_label.mjs","node_modules/markdown-it/lib/helpers/parse_link_destination.mjs","node_modules/markdown-it/lib/helpers/parse_link_title.mjs","node_modules/markdown-it/lib/renderer.mjs","node_modules/markdown-it/lib/ruler.mjs","node_modules/markdown-it/lib/token.mjs","node_modules/markdown-it/lib/rules_core/state_core.mjs","node_modules/markdown-it/lib/rules_core/normalize.mjs","node_modules/markdown-it/lib/rules_core/block.mjs","node_modules/markdown-it/lib/rules_core/inline.mjs","node_modules/markdown-it/lib/rules_core/linkify.mjs","node_modules/markdown-it/lib/rules_core/replacements.mjs","node_modules/markdown-it/lib/rules_core/smartquotes.mjs","node_modules/markdown-it/lib/rules_core/text_join.mjs","node_modules/markdown-it/lib/parser_core.mjs","node_modules/markdown-it/lib/rules_block/state_block.mjs","node_modules/markdown-it/lib/rules_block/table.mjs","node_modules/markdown-it/lib/rules_block/code.mjs","node_modules/markdown-it/lib/rules_block/fence.mjs","node_modules/markdown-it/lib/rules_block/blockquote.mjs","node_modules/markdown-it/lib/rules_block/hr.mjs","node_modules/markdown-it/lib/rules_block/list.mjs","node_modules/markdown-it/lib/rules_block/reference.mjs","node_modules/markdown-it/lib/common/html_blocks.mjs","node_modules/markdown-it/lib/common/html_re.mjs","node_modules/markdown-it/lib/rules_block/html_block.mjs","node_modules/markdown-it/lib/rules_block/heading.mjs","node_modules/markdown-it/lib/rules_block/lheading.mjs","node_modules/markdown-it/lib/rules_block/paragraph.mjs","node_modules/markdown-it/lib/parser_block.mjs","node_modules/markdown-it/lib/rules_inline/state_inline.mjs","node_modules/markdown-it/lib/rules_inline/text.mjs","node_modules/markdown-it/lib/rules_inline/linkify.mjs","node_modules/markdown-it/lib/rules_inline/newline.mjs","node_modules/markdown-it/lib/rules_inline/escape.mjs","node_modules/markdown-it/lib/rules_inline/backticks.mjs","node_modules/markdown-it/lib/rules_inline/strikethrough.mjs","node_modules/markdown-it/lib/rules_inline/emphasis.mjs","node_modules/markdown-it/lib/rules_inline/link.mjs","node_modules/markdown-it/lib/rules_inline/image.mjs","node_modules/markdown-it/lib/rules_inline/autolink.mjs","node_modules/markdown-it/lib/rules_inline/html_inline.mjs","node_modules/markdown-it/lib/rules_inline/entity.mjs","node_modules/markdown-it/lib/rules_inline/balance_pairs.mjs","node_modules/markdown-it/lib/rules_inline/fragments_join.mjs","node_modules/markdown-it/lib/parser_inline.mjs","node_modules/linkify-it/lib/re.mjs","node_modules/linkify-it/index.mjs","node_modules/punycode.js/punycode.es6.js","node_modules/markdown-it/lib/presets/default.mjs","node_modules/markdown-it/lib/presets/zero.mjs","node_modules/markdown-it/lib/presets/commonmark.mjs","node_modules/markdown-it/lib/index.mjs","node_modules/prosemirror-markdown/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-markdown.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-media.mjs","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-mention.mjs","node_modules/@tiptap/extension-youtube/dist/index.js","node_modules/@taiga-ui/editor/fesm2022/taiga-ui-editor-extensions-youtube.mjs"],"sourcesContent":["/**\n * @license Angular v19.0.4\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\n/**\n * The default equality function used for `signal` and `computed`, which uses referential equality.\n */\nfunction defaultEquals(a, b) {\n return Object.is(a, b);\n}\n\n/**\n * The currently active consumer `ReactiveNode`, if running code in a reactive context.\n *\n * Change this via `setActiveConsumer`.\n */\nlet activeConsumer = null;\nlet inNotificationPhase = false;\n/**\n * Global epoch counter. Incremented whenever a source signal is set.\n */\nlet epoch = 1;\n/**\n * Symbol used to tell `Signal`s apart from other functions.\n *\n * This can be used to auto-unwrap signals in various cases, or to auto-wrap non-signal values.\n */\nconst SIGNAL = /* @__PURE__ */Symbol('SIGNAL');\nfunction setActiveConsumer(consumer) {\n const prev = activeConsumer;\n activeConsumer = consumer;\n return prev;\n}\nfunction getActiveConsumer() {\n return activeConsumer;\n}\nfunction isInNotificationPhase() {\n return inNotificationPhase;\n}\nfunction isReactive(value) {\n return value[SIGNAL] !== undefined;\n}\nconst REACTIVE_NODE = {\n version: 0,\n lastCleanEpoch: 0,\n dirty: false,\n producerNode: undefined,\n producerLastReadVersion: undefined,\n producerIndexOfThis: undefined,\n nextProducerIndex: 0,\n liveConsumerNode: undefined,\n liveConsumerIndexOfThis: undefined,\n consumerAllowSignalWrites: false,\n consumerIsAlwaysLive: false,\n producerMustRecompute: () => false,\n producerRecomputeValue: () => {},\n consumerMarkedDirty: () => {},\n consumerOnSignalRead: () => {}\n};\n/**\n * Called by implementations when a producer's signal is read.\n */\nfunction producerAccessed(node) {\n if (inNotificationPhase) {\n throw new Error(typeof ngDevMode !== 'undefined' && ngDevMode ? `Assertion error: signal read during notification phase` : '');\n }\n if (activeConsumer === null) {\n // Accessed outside of a reactive context, so nothing to record.\n return;\n }\n activeConsumer.consumerOnSignalRead(node);\n // This producer is the `idx`th dependency of `activeConsumer`.\n const idx = activeConsumer.nextProducerIndex++;\n assertConsumerNode(activeConsumer);\n if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node) {\n // There's been a change in producers since the last execution of `activeConsumer`.\n // `activeConsumer.producerNode[idx]` holds a stale dependency which will be be removed and\n // replaced with `this`.\n //\n // If `activeConsumer` isn't live, then this is a no-op, since we can replace the producer in\n // `activeConsumer.producerNode` directly. However, if `activeConsumer` is live, then we need\n // to remove it from the stale producer's `liveConsumer`s.\n if (consumerIsLive(activeConsumer)) {\n const staleProducer = activeConsumer.producerNode[idx];\n producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);\n // At this point, the only record of `staleProducer` is the reference at\n // `activeConsumer.producerNode[idx]` which will be overwritten below.\n }\n }\n if (activeConsumer.producerNode[idx] !== node) {\n // We're a new dependency of the consumer (at `idx`).\n activeConsumer.producerNode[idx] = node;\n // If the active consumer is live, then add it as a live consumer. If not, then use 0 as a\n // placeholder value.\n activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node, activeConsumer, idx) : 0;\n }\n activeConsumer.producerLastReadVersion[idx] = node.version;\n}\n/**\n * Increment the global epoch counter.\n *\n * Called by source producers (that is, not computeds) whenever their values change.\n */\nfunction producerIncrementEpoch() {\n epoch++;\n}\n/**\n * Ensure this producer's `version` is up-to-date.\n */\nfunction producerUpdateValueVersion(node) {\n if (consumerIsLive(node) && !node.dirty) {\n // A live consumer will be marked dirty by producers, so a clean state means that its version\n // is guaranteed to be up-to-date.\n return;\n }\n if (!node.dirty && node.lastCleanEpoch === epoch) {\n // Even non-live consumers can skip polling if they previously found themselves to be clean at\n // the current epoch, since their dependencies could not possibly have changed (such a change\n // would've increased the epoch).\n return;\n }\n if (!node.producerMustRecompute(node) && !consumerPollProducersForChange(node)) {\n // None of our producers report a change since the last time they were read, so no\n // recomputation of our value is necessary, and we can consider ourselves clean.\n producerMarkClean(node);\n return;\n }\n node.producerRecomputeValue(node);\n // After recomputing the value, we're no longer dirty.\n producerMarkClean(node);\n}\n/**\n * Propagate a dirty notification to live consumers of this producer.\n */\nfunction producerNotifyConsumers(node) {\n if (node.liveConsumerNode === undefined) {\n return;\n }\n // Prevent signal reads when we're updating the graph\n const prev = inNotificationPhase;\n inNotificationPhase = true;\n try {\n for (const consumer of node.liveConsumerNode) {\n if (!consumer.dirty) {\n consumerMarkDirty(consumer);\n }\n }\n } finally {\n inNotificationPhase = prev;\n }\n}\n/**\n * Whether this `ReactiveNode` in its producer capacity is currently allowed to initiate updates,\n * based on the current consumer context.\n */\nfunction producerUpdatesAllowed() {\n return activeConsumer?.consumerAllowSignalWrites !== false;\n}\nfunction consumerMarkDirty(node) {\n node.dirty = true;\n producerNotifyConsumers(node);\n node.consumerMarkedDirty?.(node);\n}\nfunction producerMarkClean(node) {\n node.dirty = false;\n node.lastCleanEpoch = epoch;\n}\n/**\n * Prepare this consumer to run a computation in its reactive context.\n *\n * Must be called by subclasses which represent reactive computations, before those computations\n * begin.\n */\nfunction consumerBeforeComputation(node) {\n node && (node.nextProducerIndex = 0);\n return setActiveConsumer(node);\n}\n/**\n * Finalize this consumer's state after a reactive computation has run.\n *\n * Must be called by subclasses which represent reactive computations, after those computations\n * have finished.\n */\nfunction consumerAfterComputation(node, prevConsumer) {\n setActiveConsumer(prevConsumer);\n if (!node || node.producerNode === undefined || node.producerIndexOfThis === undefined || node.producerLastReadVersion === undefined) {\n return;\n }\n if (consumerIsLive(node)) {\n // For live consumers, we need to remove the producer -> consumer edge for any stale producers\n // which weren't dependencies after the recomputation.\n for (let i = node.nextProducerIndex; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n // Truncate the producer tracking arrays.\n // Perf note: this is essentially truncating the length to `node.nextProducerIndex`, but\n // benchmarking has shown that individual pop operations are faster.\n while (node.producerNode.length > node.nextProducerIndex) {\n node.producerNode.pop();\n node.producerLastReadVersion.pop();\n node.producerIndexOfThis.pop();\n }\n}\n/**\n * Determine whether this consumer has any dependencies which have changed since the last time\n * they were read.\n */\nfunction consumerPollProducersForChange(node) {\n assertConsumerNode(node);\n // Poll producers for change.\n for (let i = 0; i < node.producerNode.length; i++) {\n const producer = node.producerNode[i];\n const seenVersion = node.producerLastReadVersion[i];\n // First check the versions. A mismatch means that the producer's value is known to have\n // changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n // The producer's version is the same as the last time we read it, but it might itself be\n // stale. Force the producer to recompute its version (calculating a new value if necessary).\n producerUpdateValueVersion(producer);\n // Now when we do this check, `producer.version` is guaranteed to be up to date, so if the\n // versions still match then it has not changed since the last time we read it.\n if (seenVersion !== producer.version) {\n return true;\n }\n }\n return false;\n}\n/**\n * Disconnect this consumer from the graph.\n */\nfunction consumerDestroy(node) {\n assertConsumerNode(node);\n if (consumerIsLive(node)) {\n // Drop all connections from the graph to this node.\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n // Truncate all the arrays to drop all connection from this node to the graph.\n node.producerNode.length = node.producerLastReadVersion.length = node.producerIndexOfThis.length = 0;\n if (node.liveConsumerNode) {\n node.liveConsumerNode.length = node.liveConsumerIndexOfThis.length = 0;\n }\n}\n/**\n * Add `consumer` as a live consumer of this node.\n *\n * Note that this operation is potentially transitive. If this node becomes live, then it becomes\n * a live consumer of all of its current producers.\n */\nfunction producerAddLiveConsumer(node, consumer, indexOfThis) {\n assertProducerNode(node);\n if (node.liveConsumerNode.length === 0 && isConsumerNode(node)) {\n // When going from 0 to 1 live consumers, we become a live consumer to our producers.\n for (let i = 0; i < node.producerNode.length; i++) {\n node.producerIndexOfThis[i] = producerAddLiveConsumer(node.producerNode[i], node, i);\n }\n }\n node.liveConsumerIndexOfThis.push(indexOfThis);\n return node.liveConsumerNode.push(consumer) - 1;\n}\n/**\n * Remove the live consumer at `idx`.\n */\nfunction producerRemoveLiveConsumerAtIndex(node, idx) {\n assertProducerNode(node);\n if (typeof ngDevMode !== 'undefined' && ngDevMode && idx >= node.liveConsumerNode.length) {\n throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node.liveConsumerNode.length} consumers)`);\n }\n if (node.liveConsumerNode.length === 1 && isConsumerNode(node)) {\n // When removing the last live consumer, we will no longer be live. We need to remove\n // ourselves from our producers' tracking (which may cause consumer-producers to lose\n // liveness as well).\n for (let i = 0; i < node.producerNode.length; i++) {\n producerRemoveLiveConsumerAtIndex(node.producerNode[i], node.producerIndexOfThis[i]);\n }\n }\n // Move the last value of `liveConsumers` into `idx`. Note that if there's only a single\n // live consumer, this is a no-op.\n const lastIdx = node.liveConsumerNode.length - 1;\n node.liveConsumerNode[idx] = node.liveConsumerNode[lastIdx];\n node.liveConsumerIndexOfThis[idx] = node.liveConsumerIndexOfThis[lastIdx];\n // Truncate the array.\n node.liveConsumerNode.length--;\n node.liveConsumerIndexOfThis.length--;\n // If the index is still valid, then we need to fix the index pointer from the producer to this\n // consumer, and update it from `lastIdx` to `idx` (accounting for the move above).\n if (idx < node.liveConsumerNode.length) {\n const idxProducer = node.liveConsumerIndexOfThis[idx];\n const consumer = node.liveConsumerNode[idx];\n assertConsumerNode(consumer);\n consumer.producerIndexOfThis[idxProducer] = idx;\n }\n}\nfunction consumerIsLive(node) {\n return node.consumerIsAlwaysLive || (node?.liveConsumerNode?.length ?? 0) > 0;\n}\nfunction assertConsumerNode(node) {\n node.producerNode ??= [];\n node.producerIndexOfThis ??= [];\n node.producerLastReadVersion ??= [];\n}\nfunction assertProducerNode(node) {\n node.liveConsumerNode ??= [];\n node.liveConsumerIndexOfThis ??= [];\n}\nfunction isConsumerNode(node) {\n return node.producerNode !== undefined;\n}\n\n/**\n * Create a computed signal which derives a reactive value from an expression.\n */\nfunction createComputed(computation) {\n const node = Object.create(COMPUTED_NODE);\n node.computation = computation;\n const computed = () => {\n // Check if the value needs updating before returning it.\n producerUpdateValueVersion(node);\n // Record that someone looked at this signal.\n producerAccessed(node);\n if (node.value === ERRORED) {\n throw node.error;\n }\n return node.value;\n };\n computed[SIGNAL] = node;\n return computed;\n}\n/**\n * A dedicated symbol used before a computed value has been calculated for the first time.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst UNSET = /* @__PURE__ */Symbol('UNSET');\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * is in progress. Used to detect cycles in computation chains.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst COMPUTING = /* @__PURE__ */Symbol('COMPUTING');\n/**\n * A dedicated symbol used in place of a computed signal value to indicate that a given computation\n * failed. The thrown error is cached until the computation gets dirty again.\n * Explicitly typed as `any` so we can use it as signal's value.\n */\nconst ERRORED = /* @__PURE__ */Symbol('ERRORED');\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst COMPUTED_NODE = /* @__PURE__ */(() => {\n return {\n ...REACTIVE_NODE,\n value: UNSET,\n dirty: true,\n error: null,\n equal: defaultEquals,\n producerMustRecompute(node) {\n // Force a recomputation if there's no current value, or if the current value is in the\n // process of being calculated (which should throw an error).\n return node.value === UNSET || node.value === COMPUTING;\n },\n producerRecomputeValue(node) {\n if (node.value === COMPUTING) {\n // Our computation somehow led to a cyclic read of itself.\n throw new Error('Detected cycle in computations.');\n }\n const oldValue = node.value;\n node.value = COMPUTING;\n const prevConsumer = consumerBeforeComputation(node);\n let newValue;\n try {\n newValue = node.computation();\n } catch (err) {\n newValue = ERRORED;\n node.error = err;\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n if (oldValue !== UNSET && oldValue !== ERRORED && newValue !== ERRORED && node.equal(oldValue, newValue)) {\n // No change to `valueVersion` - old and new values are\n // semantically equivalent.\n node.value = oldValue;\n return;\n }\n node.value = newValue;\n node.version++;\n }\n };\n})();\nfunction defaultThrowError() {\n throw new Error();\n}\nlet throwInvalidWriteToSignalErrorFn = defaultThrowError;\nfunction throwInvalidWriteToSignalError() {\n throwInvalidWriteToSignalErrorFn();\n}\nfunction setThrowInvalidWriteToSignalError(fn) {\n throwInvalidWriteToSignalErrorFn = fn;\n}\n\n/**\n * If set, called after `WritableSignal`s are updated.\n *\n * This hook can be used to achieve various effects, such as running effects synchronously as part\n * of setting a signal.\n */\nlet postSignalSetFn = null;\n/**\n * Create a `Signal` that can be set or updated directly.\n */\nfunction createSignal(initialValue) {\n const node = Object.create(SIGNAL_NODE);\n node.value = initialValue;\n const getter = () => {\n producerAccessed(node);\n return node.value;\n };\n getter[SIGNAL] = node;\n return getter;\n}\nfunction setPostSignalSetFn(fn) {\n const prev = postSignalSetFn;\n postSignalSetFn = fn;\n return prev;\n}\nfunction signalGetFn() {\n producerAccessed(this);\n return this.value;\n}\nfunction signalSetFn(node, newValue) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n if (!node.equal(node.value, newValue)) {\n node.value = newValue;\n signalValueChanged(node);\n }\n}\nfunction signalUpdateFn(node, updater) {\n if (!producerUpdatesAllowed()) {\n throwInvalidWriteToSignalError();\n }\n signalSetFn(node, updater(node.value));\n}\nfunction runPostSignalSetFn() {\n postSignalSetFn?.();\n}\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst SIGNAL_NODE = /* @__PURE__ */(() => {\n return {\n ...REACTIVE_NODE,\n equal: defaultEquals,\n value: undefined\n };\n})();\nfunction signalValueChanged(node) {\n node.version++;\n producerIncrementEpoch();\n producerNotifyConsumers(node);\n postSignalSetFn?.();\n}\nfunction createWatch(fn, schedule, allowSignalWrites) {\n const node = Object.create(WATCH_NODE);\n if (allowSignalWrites) {\n node.consumerAllowSignalWrites = true;\n }\n node.fn = fn;\n node.schedule = schedule;\n const registerOnCleanup = cleanupFn => {\n node.cleanupFn = cleanupFn;\n };\n function isWatchNodeDestroyed(node) {\n return node.fn === null && node.schedule === null;\n }\n function destroyWatchNode(node) {\n if (!isWatchNodeDestroyed(node)) {\n consumerDestroy(node); // disconnect watcher from the reactive graph\n node.cleanupFn();\n // nullify references to the integration functions to mark node as destroyed\n node.fn = null;\n node.schedule = null;\n node.cleanupFn = NOOP_CLEANUP_FN;\n }\n }\n const run = () => {\n if (node.fn === null) {\n // trying to run a destroyed watch is noop\n return;\n }\n if (isInNotificationPhase()) {\n throw new Error(`Schedulers cannot synchronously execute watches while scheduling.`);\n }\n node.dirty = false;\n if (node.hasRun && !consumerPollProducersForChange(node)) {\n return;\n }\n node.hasRun = true;\n const prevConsumer = consumerBeforeComputation(node);\n try {\n node.cleanupFn();\n node.cleanupFn = NOOP_CLEANUP_FN;\n node.fn(registerOnCleanup);\n } finally {\n consumerAfterComputation(node, prevConsumer);\n }\n };\n node.ref = {\n notify: () => consumerMarkDirty(node),\n run,\n cleanup: () => node.cleanupFn(),\n destroy: () => destroyWatchNode(node),\n [SIGNAL]: node\n };\n return node.ref;\n}\nconst NOOP_CLEANUP_FN = () => {};\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst WATCH_NODE = /* @__PURE__ */(() => {\n return {\n ...REACTIVE_NODE,\n consumerIsAlwaysLive: true,\n consumerAllowSignalWrites: false,\n consumerMarkedDirty: node => {\n if (node.schedule !== null) {\n node.schedule(node.ref);\n }\n },\n hasRun: false,\n cleanupFn: NOOP_CLEANUP_FN\n };\n})();\nfunction setAlternateWeakRefImpl(impl) {\n // TODO: remove this function\n}\nexport { REACTIVE_NODE, SIGNAL, SIGNAL_NODE, consumerAfterComputation, consumerBeforeComputation, consumerDestroy, consumerMarkDirty, consumerPollProducersForChange, createComputed, createSignal, createWatch, defaultEquals, getActiveConsumer, isInNotificationPhase, isReactive, producerAccessed, producerIncrementEpoch, producerMarkClean, producerNotifyConsumers, producerUpdateValueVersion, producerUpdatesAllowed, runPostSignalSetFn, setActiveConsumer, setAlternateWeakRefImpl, setPostSignalSetFn, setThrowInvalidWriteToSignalError, signalSetFn, signalUpdateFn };\n","export function isFunction(value) {\n return typeof value === 'function';\n}\n","export function createErrorClass(createImpl) {\n const _super = instance => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n","import { createErrorClass } from './createErrorClass';\nexport const UnsubscriptionError = createErrorClass(_super => function UnsubscriptionErrorImpl(errors) {\n _super(this);\n this.message = errors ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}` : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n});\n","export function arrRemove(arr, item) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { arrRemove } from './util/arrRemove';\nexport class Subscription {\n constructor(initialTeardown) {\n this.initialTeardown = initialTeardown;\n this.closed = false;\n this._parentage = null;\n this._finalizers = null;\n }\n unsubscribe() {\n let errors;\n if (!this.closed) {\n this.closed = true;\n const {\n _parentage\n } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n const {\n initialTeardown: initialFinalizer\n } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n const {\n _finalizers\n } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors !== null && errors !== void 0 ? errors : [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n add(teardown) {\n var _a;\n if (teardown && teardown !== this) {\n if (this.closed) {\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);\n }\n }\n }\n _hasParent(parent) {\n const {\n _parentage\n } = this;\n return _parentage === parent || Array.isArray(_parentage) && _parentage.includes(parent);\n }\n _addParent(parent) {\n const {\n _parentage\n } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n _removeParent(parent) {\n const {\n _parentage\n } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n remove(teardown) {\n const {\n _finalizers\n } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\nSubscription.EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n})();\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\nexport function isSubscription(value) {\n return value instanceof Subscription || value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe);\n}\nfunction execFinalizer(finalizer) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n","export const config = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false\n};\n","export const timeoutProvider = {\n setTimeout(handler, timeout, ...args) {\n const {\n delegate\n } = timeoutProvider;\n if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const {\n delegate\n } = timeoutProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearTimeout) || clearTimeout)(handle);\n },\n delegate: undefined\n};\n","import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\nexport function reportUnhandledError(err) {\n timeoutProvider.setTimeout(() => {\n const {\n onUnhandledError\n } = config;\n if (onUnhandledError) {\n onUnhandledError(err);\n } else {\n throw err;\n }\n });\n}\n","export function noop() {}\n","export const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined))();\nexport function errorNotification(error) {\n return createNotification('E', undefined, error);\n}\nexport function nextNotification(value) {\n return createNotification('N', value, undefined);\n}\nexport function createNotification(kind, value, error) {\n return {\n kind,\n value,\n error\n };\n}\n","import { config } from '../config';\nlet context = null;\nexport function errorContext(cb) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = {\n errorThrown: false,\n error: null\n };\n }\n cb();\n if (isRoot) {\n const {\n errorThrown,\n error\n } = context;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n cb();\n }\n}\nexport function captureError(err) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n","import { isFunction } from './util/isFunction';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\nexport class Subscriber extends Subscription {\n constructor(destination) {\n super();\n this.isStopped = false;\n if (destination) {\n this.destination = destination;\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n static create(next, error, complete) {\n return new SafeSubscriber(next, error, complete);\n }\n next(value) {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value);\n }\n }\n error(err) {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n complete() {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n unsubscribe() {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null;\n }\n }\n _next(value) {\n this.destination.next(value);\n }\n _error(err) {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n _complete() {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\nconst _bind = Function.prototype.bind;\nfunction bind(fn, thisArg) {\n return _bind.call(fn, thisArg);\n}\nclass ConsumerObserver {\n constructor(partialObserver) {\n this.partialObserver = partialObserver;\n }\n next(value) {\n const {\n partialObserver\n } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n error(err) {\n const {\n partialObserver\n } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n complete() {\n const {\n partialObserver\n } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\nexport class SafeSubscriber extends Subscriber {\n constructor(observerOrNext, error, complete) {\n super();\n let partialObserver;\n if (isFunction(observerOrNext) || !observerOrNext) {\n partialObserver = {\n next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,\n error: error !== null && error !== void 0 ? error : undefined,\n complete: complete !== null && complete !== void 0 ? complete : undefined\n };\n } else {\n let context;\n if (this && config.useDeprecatedNextContext) {\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context)\n };\n } else {\n partialObserver = observerOrNext;\n }\n }\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\nfunction handleUnhandledError(error) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n reportUnhandledError(error);\n }\n}\nfunction defaultErrorHandler(err) {\n throw err;\n}\nfunction handleStoppedNotification(notification, subscriber) {\n const {\n onStoppedNotification\n } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\nexport const EMPTY_OBSERVER = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop\n};\n","export const observable = (() => typeof Symbol === 'function' && Symbol.observable || '@@observable')();\n","export function identity(x) {\n return x;\n}\n","import { identity } from './identity';\nexport function pipe(...fns) {\n return pipeFromArray(fns);\n}\nexport function pipeFromArray(fns) {\n if (fns.length === 0) {\n return identity;\n }\n if (fns.length === 1) {\n return fns[0];\n }\n return function piped(input) {\n return fns.reduce((prev, fn) => fn(prev), input);\n };\n}\n","import { SafeSubscriber, Subscriber } from './Subscriber';\nimport { isSubscription } from './Subscription';\nimport { observable as Symbol_observable } from './symbol/observable';\nimport { pipeFromArray } from './util/pipe';\nimport { config } from './config';\nimport { isFunction } from './util/isFunction';\nimport { errorContext } from './util/errorContext';\nexport let Observable = /*#__PURE__*/(() => {\n class Observable {\n constructor(subscribe) {\n if (subscribe) {\n this._subscribe = subscribe;\n }\n }\n lift(operator) {\n const observable = new Observable();\n observable.source = this;\n observable.operator = operator;\n return observable;\n }\n subscribe(observerOrNext, error, complete) {\n const subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);\n errorContext(() => {\n const {\n operator,\n source\n } = this;\n subscriber.add(operator ? operator.call(subscriber, source) : source ? this._subscribe(subscriber) : this._trySubscribe(subscriber));\n });\n return subscriber;\n }\n _trySubscribe(sink) {\n try {\n return this._subscribe(sink);\n } catch (err) {\n sink.error(err);\n }\n }\n forEach(next, promiseCtor) {\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor((resolve, reject) => {\n const subscriber = new SafeSubscriber({\n next: value => {\n try {\n next(value);\n } catch (err) {\n reject(err);\n subscriber.unsubscribe();\n }\n },\n error: reject,\n complete: resolve\n });\n this.subscribe(subscriber);\n });\n }\n _subscribe(subscriber) {\n var _a;\n return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);\n }\n [Symbol_observable]() {\n return this;\n }\n pipe(...operations) {\n return pipeFromArray(operations)(this);\n }\n toPromise(promiseCtor) {\n promiseCtor = getPromiseCtor(promiseCtor);\n return new promiseCtor((resolve, reject) => {\n let value;\n this.subscribe(x => value = x, err => reject(err), () => resolve(value));\n });\n }\n }\n Observable.create = subscribe => {\n return new Observable(subscribe);\n };\n return Observable;\n})();\nfunction getPromiseCtor(promiseCtor) {\n var _a;\n return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;\n}\nfunction isObserver(value) {\n return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);\n}\nfunction isSubscriber(value) {\n return value && value instanceof Subscriber || isObserver(value) && isSubscription(value);\n}\n","import { isFunction } from './isFunction';\nexport function hasLift(source) {\n return isFunction(source === null || source === void 0 ? void 0 : source.lift);\n}\nexport function operate(init) {\n return source => {\n if (hasLift(source)) {\n return source.lift(function (liftedSource) {\n try {\n return init(liftedSource, this);\n } catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n","import { Subscriber } from '../Subscriber';\nexport function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\nexport class OperatorSubscriber extends Subscriber {\n constructor(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {\n super(destination);\n this.onFinalize = onFinalize;\n this.shouldUnsubscribe = shouldUnsubscribe;\n this._next = onNext ? function (value) {\n try {\n onNext(value);\n } catch (err) {\n destination.error(err);\n }\n } : super._next;\n this._error = onError ? function (err) {\n try {\n onError(err);\n } catch (err) {\n destination.error(err);\n } finally {\n this.unsubscribe();\n }\n } : super._error;\n this._complete = onComplete ? function () {\n try {\n onComplete();\n } catch (err) {\n destination.error(err);\n } finally {\n this.unsubscribe();\n }\n } : super._complete;\n }\n unsubscribe() {\n var _a;\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n const {\n closed\n } = this;\n super.unsubscribe();\n !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));\n }\n }\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function refCount() {\n return operate((source, subscriber) => {\n let connection = null;\n source._refCount++;\n const refCounter = createOperatorSubscriber(subscriber, undefined, undefined, undefined, () => {\n if (!source || source._refCount <= 0 || 0 < --source._refCount) {\n connection = null;\n return;\n }\n const sharedConnection = source._connection;\n const conn = connection;\n connection = null;\n if (sharedConnection && (!conn || sharedConnection === conn)) {\n sharedConnection.unsubscribe();\n }\n subscriber.unsubscribe();\n });\n source.subscribe(refCounter);\n if (!refCounter.closed) {\n connection = source.connect();\n }\n });\n}\n","import { Observable } from '../Observable';\nimport { Subscription } from '../Subscription';\nimport { refCount as higherOrderRefCount } from '../operators/refCount';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { hasLift } from '../util/lift';\nexport class ConnectableObservable extends Observable {\n constructor(source, subjectFactory) {\n super();\n this.source = source;\n this.subjectFactory = subjectFactory;\n this._subject = null;\n this._refCount = 0;\n this._connection = null;\n if (hasLift(source)) {\n this.lift = source.lift;\n }\n }\n _subscribe(subscriber) {\n return this.getSubject().subscribe(subscriber);\n }\n getSubject() {\n const subject = this._subject;\n if (!subject || subject.isStopped) {\n this._subject = this.subjectFactory();\n }\n return this._subject;\n }\n _teardown() {\n this._refCount = 0;\n const {\n _connection\n } = this;\n this._subject = this._connection = null;\n _connection === null || _connection === void 0 ? void 0 : _connection.unsubscribe();\n }\n connect() {\n let connection = this._connection;\n if (!connection) {\n connection = this._connection = new Subscription();\n const subject = this.getSubject();\n connection.add(this.source.subscribe(createOperatorSubscriber(subject, undefined, () => {\n this._teardown();\n subject.complete();\n }, err => {\n this._teardown();\n subject.error(err);\n }, () => this._teardown())));\n if (connection.closed) {\n this._connection = null;\n connection = Subscription.EMPTY;\n }\n }\n return connection;\n }\n refCount() {\n return higherOrderRefCount()(this);\n }\n}\n","import { createErrorClass } from './createErrorClass';\nexport const ObjectUnsubscribedError = createErrorClass(_super => function ObjectUnsubscribedErrorImpl() {\n _super(this);\n this.name = 'ObjectUnsubscribedError';\n this.message = 'object unsubscribed';\n});\n","import { Observable } from './Observable';\nimport { Subscription, EMPTY_SUBSCRIPTION } from './Subscription';\nimport { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError';\nimport { arrRemove } from './util/arrRemove';\nimport { errorContext } from './util/errorContext';\nexport let Subject = /*#__PURE__*/(() => {\n class Subject extends Observable {\n constructor() {\n super();\n this.closed = false;\n this.currentObservers = null;\n this.observers = [];\n this.isStopped = false;\n this.hasError = false;\n this.thrownError = null;\n }\n lift(operator) {\n const subject = new AnonymousSubject(this, this);\n subject.operator = operator;\n return subject;\n }\n _throwIfClosed() {\n if (this.closed) {\n throw new ObjectUnsubscribedError();\n }\n }\n next(value) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n if (!this.currentObservers) {\n this.currentObservers = Array.from(this.observers);\n }\n for (const observer of this.currentObservers) {\n observer.next(value);\n }\n }\n });\n }\n error(err) {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.hasError = this.isStopped = true;\n this.thrownError = err;\n const {\n observers\n } = this;\n while (observers.length) {\n observers.shift().error(err);\n }\n }\n });\n }\n complete() {\n errorContext(() => {\n this._throwIfClosed();\n if (!this.isStopped) {\n this.isStopped = true;\n const {\n observers\n } = this;\n while (observers.length) {\n observers.shift().complete();\n }\n }\n });\n }\n unsubscribe() {\n this.isStopped = this.closed = true;\n this.observers = this.currentObservers = null;\n }\n get observed() {\n var _a;\n return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;\n }\n _trySubscribe(subscriber) {\n this._throwIfClosed();\n return super._trySubscribe(subscriber);\n }\n _subscribe(subscriber) {\n this._throwIfClosed();\n this._checkFinalizedStatuses(subscriber);\n return this._innerSubscribe(subscriber);\n }\n _innerSubscribe(subscriber) {\n const {\n hasError,\n isStopped,\n observers\n } = this;\n if (hasError || isStopped) {\n return EMPTY_SUBSCRIPTION;\n }\n this.currentObservers = null;\n observers.push(subscriber);\n return new Subscription(() => {\n this.currentObservers = null;\n arrRemove(observers, subscriber);\n });\n }\n _checkFinalizedStatuses(subscriber) {\n const {\n hasError,\n thrownError,\n isStopped\n } = this;\n if (hasError) {\n subscriber.error(thrownError);\n } else if (isStopped) {\n subscriber.complete();\n }\n }\n asObservable() {\n const observable = new Observable();\n observable.source = this;\n return observable;\n }\n }\n Subject.create = (destination, source) => {\n return new AnonymousSubject(destination, source);\n };\n return Subject;\n})();\nexport class AnonymousSubject extends Subject {\n constructor(destination, source) {\n super();\n this.destination = destination;\n this.source = source;\n }\n next(value) {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);\n }\n error(err) {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);\n }\n complete() {\n var _a, _b;\n (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);\n }\n _subscribe(subscriber) {\n var _a, _b;\n return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;\n }\n}\n","import { Subject } from './Subject';\nexport class BehaviorSubject extends Subject {\n constructor(_value) {\n super();\n this._value = _value;\n }\n get value() {\n return this.getValue();\n }\n _subscribe(subscriber) {\n const subscription = super._subscribe(subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n }\n getValue() {\n const {\n hasError,\n thrownError,\n _value\n } = this;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n }\n next(value) {\n super.next(this._value = value);\n }\n}\n","export const dateTimestampProvider = {\n now() {\n return (dateTimestampProvider.delegate || Date).now();\n },\n delegate: undefined\n};\n","import { Subject } from './Subject';\nimport { dateTimestampProvider } from './scheduler/dateTimestampProvider';\nexport class ReplaySubject extends Subject {\n constructor(_bufferSize = Infinity, _windowTime = Infinity, _timestampProvider = dateTimestampProvider) {\n super();\n this._bufferSize = _bufferSize;\n this._windowTime = _windowTime;\n this._timestampProvider = _timestampProvider;\n this._buffer = [];\n this._infiniteTimeWindow = true;\n this._infiniteTimeWindow = _windowTime === Infinity;\n this._bufferSize = Math.max(1, _bufferSize);\n this._windowTime = Math.max(1, _windowTime);\n }\n next(value) {\n const {\n isStopped,\n _buffer,\n _infiniteTimeWindow,\n _timestampProvider,\n _windowTime\n } = this;\n if (!isStopped) {\n _buffer.push(value);\n !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);\n }\n this._trimBuffer();\n super.next(value);\n }\n _subscribe(subscriber) {\n this._throwIfClosed();\n this._trimBuffer();\n const subscription = this._innerSubscribe(subscriber);\n const {\n _infiniteTimeWindow,\n _buffer\n } = this;\n const copy = _buffer.slice();\n for (let i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {\n subscriber.next(copy[i]);\n }\n this._checkFinalizedStatuses(subscriber);\n return subscription;\n }\n _trimBuffer() {\n const {\n _bufferSize,\n _timestampProvider,\n _buffer,\n _infiniteTimeWindow\n } = this;\n const adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;\n _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);\n if (!_infiniteTimeWindow) {\n const now = _timestampProvider.now();\n let last = 0;\n for (let i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {\n last = i;\n }\n last && _buffer.splice(0, last + 1);\n }\n }\n}\n","import { Subscription } from '../Subscription';\nexport class Action extends Subscription {\n constructor(scheduler, work) {\n super();\n }\n schedule(state, delay = 0) {\n return this;\n }\n}\n","export const intervalProvider = {\n setInterval(handler, timeout, ...args) {\n const {\n delegate\n } = intervalProvider;\n if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {\n return delegate.setInterval(handler, timeout, ...args);\n }\n return setInterval(handler, timeout, ...args);\n },\n clearInterval(handle) {\n const {\n delegate\n } = intervalProvider;\n return ((delegate === null || delegate === void 0 ? void 0 : delegate.clearInterval) || clearInterval)(handle);\n },\n delegate: undefined\n};\n","import { Action } from './Action';\nimport { intervalProvider } from './intervalProvider';\nimport { arrRemove } from '../util/arrRemove';\nexport class AsyncAction extends Action {\n constructor(scheduler, work) {\n super(scheduler, work);\n this.scheduler = scheduler;\n this.work = work;\n this.pending = false;\n }\n schedule(state, delay = 0) {\n var _a;\n if (this.closed) {\n return this;\n }\n this.state = state;\n const id = this.id;\n const scheduler = this.scheduler;\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, delay);\n }\n this.pending = true;\n this.delay = delay;\n this.id = (_a = this.id) !== null && _a !== void 0 ? _a : this.requestAsyncId(scheduler, this.id, delay);\n return this;\n }\n requestAsyncId(scheduler, _id, delay = 0) {\n return intervalProvider.setInterval(scheduler.flush.bind(scheduler, this), delay);\n }\n recycleAsyncId(_scheduler, id, delay = 0) {\n if (delay != null && this.delay === delay && this.pending === false) {\n return id;\n }\n if (id != null) {\n intervalProvider.clearInterval(id);\n }\n return undefined;\n }\n execute(state, delay) {\n if (this.closed) {\n return new Error('executing a cancelled action');\n }\n this.pending = false;\n const error = this._execute(state, delay);\n if (error) {\n return error;\n } else if (this.pending === false && this.id != null) {\n this.id = this.recycleAsyncId(this.scheduler, this.id, null);\n }\n }\n _execute(state, _delay) {\n let errored = false;\n let errorValue;\n try {\n this.work(state);\n } catch (e) {\n errored = true;\n errorValue = e ? e : new Error('Scheduled action threw falsy error');\n }\n if (errored) {\n this.unsubscribe();\n return errorValue;\n }\n }\n unsubscribe() {\n if (!this.closed) {\n const {\n id,\n scheduler\n } = this;\n const {\n actions\n } = scheduler;\n this.work = this.state = this.scheduler = null;\n this.pending = false;\n arrRemove(actions, this);\n if (id != null) {\n this.id = this.recycleAsyncId(scheduler, id, null);\n }\n this.delay = null;\n super.unsubscribe();\n }\n }\n}\n","import { dateTimestampProvider } from './scheduler/dateTimestampProvider';\nexport class Scheduler {\n constructor(schedulerActionCtor, now = Scheduler.now) {\n this.schedulerActionCtor = schedulerActionCtor;\n this.now = now;\n }\n schedule(work, delay = 0, state) {\n return new this.schedulerActionCtor(this, work).schedule(state, delay);\n }\n}\nScheduler.now = dateTimestampProvider.now;\n","import { Scheduler } from '../Scheduler';\nexport class AsyncScheduler extends Scheduler {\n constructor(SchedulerAction, now = Scheduler.now) {\n super(SchedulerAction, now);\n this.actions = [];\n this._active = false;\n }\n flush(action) {\n const {\n actions\n } = this;\n if (this._active) {\n actions.push(action);\n return;\n }\n let error;\n this._active = true;\n do {\n if (error = action.execute(action.state, action.delay)) {\n break;\n }\n } while (action = actions.shift());\n this._active = false;\n if (error) {\n while (action = actions.shift()) {\n action.unsubscribe();\n }\n throw error;\n }\n }\n}\n","import { AsyncAction } from './AsyncAction';\nimport { AsyncScheduler } from './AsyncScheduler';\nexport const asyncScheduler = new AsyncScheduler(AsyncAction);\nexport const async = asyncScheduler;\n","import { Observable } from '../Observable';\nexport const EMPTY = new Observable(subscriber => subscriber.complete());\nexport function empty(scheduler) {\n return scheduler ? emptyScheduled(scheduler) : EMPTY;\n}\nfunction emptyScheduled(scheduler) {\n return new Observable(subscriber => scheduler.schedule(() => subscriber.complete()));\n}\n","import { isFunction } from './isFunction';\nexport function isScheduler(value) {\n return value && isFunction(value.schedule);\n}\n","import { isFunction } from './isFunction';\nimport { isScheduler } from './isScheduler';\nfunction last(arr) {\n return arr[arr.length - 1];\n}\nexport function popResultSelector(args) {\n return isFunction(last(args)) ? args.pop() : undefined;\n}\nexport function popScheduler(args) {\n return isScheduler(last(args)) ? args.pop() : undefined;\n}\nexport function popNumber(args, defaultValue) {\n return typeof last(args) === 'number' ? args.pop() : defaultValue;\n}\n","/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf || {\n __proto__: []\n } instanceof Array && function (d, b) {\n d.__proto__ = b;\n } || function (d, b) {\n for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];\n };\n return extendStatics(d, b);\n};\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null) throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() {\n this.constructor = d;\n }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\nexport var __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n}\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length,\n r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,\n d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\nexport function __param(paramIndex, decorator) {\n return function (target, key) {\n decorator(target, key, paramIndex);\n };\n}\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) {\n if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\");\n return f;\n }\n var kind = contextIn.kind,\n key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _,\n done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) {\n if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\");\n extraInitializers.push(accept(f || null));\n };\n var result = (0, decorators[i])(kind === \"accessor\" ? {\n get: descriptor.get,\n set: descriptor.set\n } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n } else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n}\n;\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n}\n;\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n}\n;\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", {\n configurable: true,\n value: prefix ? \"\".concat(prefix, \" \", name) : name\n });\n}\n;\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) {\n return value instanceof P ? value : new P(function (resolve) {\n resolve(value);\n });\n }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n }\n function rejected(value) {\n try {\n step(generator[\"throw\"](value));\n } catch (e) {\n reject(e);\n }\n }\n function step(result) {\n result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);\n }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\nexport function __generator(thisArg, body) {\n var _ = {\n label: 0,\n sent: function () {\n if (t[0] & 1) throw t[1];\n return t[1];\n },\n trys: [],\n ops: []\n },\n f,\n y,\n t,\n g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function () {\n return this;\n }), g;\n function verb(n) {\n return function (v) {\n return step([n, v]);\n };\n }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return {\n value: op[1],\n done: false\n };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2]) _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n } catch (e) {\n op = [6, e];\n y = 0;\n } finally {\n f = t = 0;\n }\n if (op[0] & 5) throw op[1];\n return {\n value: op[0] ? op[1] : void 0,\n done: true\n };\n }\n}\nexport var __createBinding = Object.create ? function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = {\n enumerable: true,\n get: function () {\n return m[k];\n }\n };\n }\n Object.defineProperty(o, k2, desc);\n} : function (o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n};\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator,\n m = s && o[s],\n i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return {\n value: o && o[i++],\n done: !o\n };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o),\n r,\n ar = [],\n e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n } catch (error) {\n e = {\n error: error\n };\n } finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n } finally {\n if (e) throw e.error;\n }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++) for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) r[k] = a[j];\n return r;\n}\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []),\n i,\n q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () {\n return this;\n }, i;\n function awaitReturn(f) {\n return function (v) {\n return Promise.resolve(v).then(f, reject);\n };\n }\n function verb(n, f) {\n if (g[n]) {\n i[n] = function (v) {\n return new Promise(function (a, b) {\n q.push([n, v, a, b]) > 1 || resume(n, v);\n });\n };\n if (f) i[n] = f(i[n]);\n }\n }\n function resume(n, v) {\n try {\n step(g[n](v));\n } catch (e) {\n settle(q[0][3], e);\n }\n }\n function step(r) {\n r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r);\n }\n function fulfill(value) {\n resume(\"next\", value);\n }\n function reject(value) {\n resume(\"throw\", value);\n }\n function settle(f, v) {\n if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]);\n }\n}\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) {\n throw e;\n }), verb(\"return\"), i[Symbol.iterator] = function () {\n return this;\n }, i;\n function verb(n, f) {\n i[n] = o[n] ? function (v) {\n return (p = !p) ? {\n value: __await(o[n](v)),\n done: false\n } : f ? f(v) : v;\n } : f;\n }\n}\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator],\n i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () {\n return this;\n }, i);\n function verb(n) {\n i[n] = o[n] && function (v) {\n return new Promise(function (resolve, reject) {\n v = o[n](v), settle(resolve, reject, v.done, v.value);\n });\n };\n }\n function settle(resolve, reject, d, v) {\n Promise.resolve(v).then(function (v) {\n resolve({\n value: v,\n done: d\n });\n }, reject);\n }\n}\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", {\n value: raw\n });\n } else {\n cooked.raw = raw;\n }\n return cooked;\n}\n;\nvar __setModuleDefault = Object.create ? function (o, v) {\n Object.defineProperty(o, \"default\", {\n enumerable: true,\n value: v\n });\n} : function (o, v) {\n o[\"default\"] = v;\n};\nvar ownKeys = function (o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\nexport function __importDefault(mod) {\n return mod && mod.__esModule ? mod : {\n default: mod\n };\n}\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;\n}\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || typeof receiver !== \"object\" && typeof receiver !== \"function\") throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function () {\n try {\n inner.call(this);\n } catch (e) {\n return Promise.reject(e);\n }\n };\n env.stack.push({\n value: value,\n dispose: dispose,\n async: async\n });\n } else if (async) {\n env.stack.push({\n async: true\n });\n }\n return value;\n}\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r,\n s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function (e) {\n fail(e);\n return next();\n });\n } else s |= 1;\n } catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : d + ext + \".\" + cm.toLowerCase() + \"js\";\n });\n }\n return path;\n}\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension\n};","export const isArrayLike = x => x && typeof x.length === 'number' && typeof x !== 'function';\n","import { isFunction } from \"./isFunction\";\nexport function isPromise(value) {\n return isFunction(value === null || value === void 0 ? void 0 : value.then);\n}\n","import { observable as Symbol_observable } from '../symbol/observable';\nimport { isFunction } from './isFunction';\nexport function isInteropObservable(input) {\n return isFunction(input[Symbol_observable]);\n}\n","import { isFunction } from './isFunction';\nexport function isAsyncIterable(obj) {\n return Symbol.asyncIterator && isFunction(obj === null || obj === void 0 ? void 0 : obj[Symbol.asyncIterator]);\n}\n","export function createInvalidObservableTypeError(input) {\n return new TypeError(`You provided ${input !== null && typeof input === 'object' ? 'an invalid object' : `'${input}'`} where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.`);\n}\n","export function getSymbolIterator() {\n if (typeof Symbol !== 'function' || !Symbol.iterator) {\n return '@@iterator';\n }\n return Symbol.iterator;\n}\nexport const iterator = getSymbolIterator();\n","import { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from './isFunction';\nexport function isIterable(input) {\n return isFunction(input === null || input === void 0 ? void 0 : input[Symbol_iterator]);\n}\n","import { __asyncGenerator, __await } from \"tslib\";\nimport { isFunction } from './isFunction';\nexport function readableStreamLikeToAsyncGenerator(readableStream) {\n return __asyncGenerator(this, arguments, function* readableStreamLikeToAsyncGenerator_1() {\n const reader = readableStream.getReader();\n try {\n while (true) {\n const {\n value,\n done\n } = yield __await(reader.read());\n if (done) {\n return yield __await(void 0);\n }\n yield yield __await(value);\n }\n } finally {\n reader.releaseLock();\n }\n });\n}\nexport function isReadableStreamLike(obj) {\n return isFunction(obj === null || obj === void 0 ? void 0 : obj.getReader);\n}\n","import { __asyncValues, __awaiter } from \"tslib\";\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isPromise } from '../util/isPromise';\nimport { Observable } from '../Observable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isIterable } from '../util/isIterable';\nimport { isReadableStreamLike, readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\nimport { isFunction } from '../util/isFunction';\nimport { reportUnhandledError } from '../util/reportUnhandledError';\nimport { observable as Symbol_observable } from '../symbol/observable';\nexport function innerFrom(input) {\n if (input instanceof Observable) {\n return input;\n }\n if (input != null) {\n if (isInteropObservable(input)) {\n return fromInteropObservable(input);\n }\n if (isArrayLike(input)) {\n return fromArrayLike(input);\n }\n if (isPromise(input)) {\n return fromPromise(input);\n }\n if (isAsyncIterable(input)) {\n return fromAsyncIterable(input);\n }\n if (isIterable(input)) {\n return fromIterable(input);\n }\n if (isReadableStreamLike(input)) {\n return fromReadableStreamLike(input);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\nexport function fromInteropObservable(obj) {\n return new Observable(subscriber => {\n const obs = obj[Symbol_observable]();\n if (isFunction(obs.subscribe)) {\n return obs.subscribe(subscriber);\n }\n throw new TypeError('Provided object does not correctly implement Symbol.observable');\n });\n}\nexport function fromArrayLike(array) {\n return new Observable(subscriber => {\n for (let i = 0; i < array.length && !subscriber.closed; i++) {\n subscriber.next(array[i]);\n }\n subscriber.complete();\n });\n}\nexport function fromPromise(promise) {\n return new Observable(subscriber => {\n promise.then(value => {\n if (!subscriber.closed) {\n subscriber.next(value);\n subscriber.complete();\n }\n }, err => subscriber.error(err)).then(null, reportUnhandledError);\n });\n}\nexport function fromIterable(iterable) {\n return new Observable(subscriber => {\n for (const value of iterable) {\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n subscriber.complete();\n });\n}\nexport function fromAsyncIterable(asyncIterable) {\n return new Observable(subscriber => {\n process(asyncIterable, subscriber).catch(err => subscriber.error(err));\n });\n}\nexport function fromReadableStreamLike(readableStream) {\n return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));\n}\nfunction process(asyncIterable, subscriber) {\n var asyncIterable_1, asyncIterable_1_1;\n var e_1, _a;\n return __awaiter(this, void 0, void 0, function* () {\n try {\n for (asyncIterable_1 = __asyncValues(asyncIterable); asyncIterable_1_1 = yield asyncIterable_1.next(), !asyncIterable_1_1.done;) {\n const value = asyncIterable_1_1.value;\n subscriber.next(value);\n if (subscriber.closed) {\n return;\n }\n }\n } catch (e_1_1) {\n e_1 = {\n error: e_1_1\n };\n } finally {\n try {\n if (asyncIterable_1_1 && !asyncIterable_1_1.done && (_a = asyncIterable_1.return)) yield _a.call(asyncIterable_1);\n } finally {\n if (e_1) throw e_1.error;\n }\n }\n subscriber.complete();\n });\n}\n","export function executeSchedule(parentSubscription, scheduler, work, delay = 0, repeat = false) {\n const scheduleSubscription = scheduler.schedule(function () {\n work();\n if (repeat) {\n parentSubscription.add(this.schedule(null, delay));\n } else {\n this.unsubscribe();\n }\n }, delay);\n parentSubscription.add(scheduleSubscription);\n if (!repeat) {\n return scheduleSubscription;\n }\n}\n","import { executeSchedule } from '../util/executeSchedule';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function observeOn(scheduler, delay = 0) {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, value => executeSchedule(subscriber, scheduler, () => subscriber.next(value), delay), () => executeSchedule(subscriber, scheduler, () => subscriber.complete(), delay), err => executeSchedule(subscriber, scheduler, () => subscriber.error(err), delay)));\n });\n}\n","import { operate } from '../util/lift';\nexport function subscribeOn(scheduler, delay = 0) {\n return operate((source, subscriber) => {\n subscriber.add(scheduler.schedule(() => source.subscribe(subscriber), delay));\n });\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nexport function scheduleObservable(input, scheduler) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { observeOn } from '../operators/observeOn';\nimport { subscribeOn } from '../operators/subscribeOn';\nexport function schedulePromise(input, scheduler) {\n return innerFrom(input).pipe(subscribeOn(scheduler), observeOn(scheduler));\n}\n","import { Observable } from '../Observable';\nexport function scheduleArray(input, scheduler) {\n return new Observable(subscriber => {\n let i = 0;\n return scheduler.schedule(function () {\n if (i === input.length) {\n subscriber.complete();\n } else {\n subscriber.next(input[i++]);\n if (!subscriber.closed) {\n this.schedule();\n }\n }\n });\n });\n}\n","import { Observable } from '../Observable';\nimport { iterator as Symbol_iterator } from '../symbol/iterator';\nimport { isFunction } from '../util/isFunction';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function scheduleIterable(input, scheduler) {\n return new Observable(subscriber => {\n let iterator;\n executeSchedule(subscriber, scheduler, () => {\n iterator = input[Symbol_iterator]();\n executeSchedule(subscriber, scheduler, () => {\n let value;\n let done;\n try {\n ({\n value,\n done\n } = iterator.next());\n } catch (err) {\n subscriber.error(err);\n return;\n }\n if (done) {\n subscriber.complete();\n } else {\n subscriber.next(value);\n }\n }, 0, true);\n });\n return () => isFunction(iterator === null || iterator === void 0 ? void 0 : iterator.return) && iterator.return();\n });\n}\n","import { Observable } from '../Observable';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function scheduleAsyncIterable(input, scheduler) {\n if (!input) {\n throw new Error('Iterable cannot be null');\n }\n return new Observable(subscriber => {\n executeSchedule(subscriber, scheduler, () => {\n const iterator = input[Symbol.asyncIterator]();\n executeSchedule(subscriber, scheduler, () => {\n iterator.next().then(result => {\n if (result.done) {\n subscriber.complete();\n } else {\n subscriber.next(result.value);\n }\n });\n }, 0, true);\n });\n });\n}\n","import { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike';\nexport function scheduleReadableStreamLike(input, scheduler) {\n return scheduleAsyncIterable(readableStreamLikeToAsyncGenerator(input), scheduler);\n}\n","import { scheduleObservable } from './scheduleObservable';\nimport { schedulePromise } from './schedulePromise';\nimport { scheduleArray } from './scheduleArray';\nimport { scheduleIterable } from './scheduleIterable';\nimport { scheduleAsyncIterable } from './scheduleAsyncIterable';\nimport { isInteropObservable } from '../util/isInteropObservable';\nimport { isPromise } from '../util/isPromise';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isIterable } from '../util/isIterable';\nimport { isAsyncIterable } from '../util/isAsyncIterable';\nimport { createInvalidObservableTypeError } from '../util/throwUnobservableError';\nimport { isReadableStreamLike } from '../util/isReadableStreamLike';\nimport { scheduleReadableStreamLike } from './scheduleReadableStreamLike';\nexport function scheduled(input, scheduler) {\n if (input != null) {\n if (isInteropObservable(input)) {\n return scheduleObservable(input, scheduler);\n }\n if (isArrayLike(input)) {\n return scheduleArray(input, scheduler);\n }\n if (isPromise(input)) {\n return schedulePromise(input, scheduler);\n }\n if (isAsyncIterable(input)) {\n return scheduleAsyncIterable(input, scheduler);\n }\n if (isIterable(input)) {\n return scheduleIterable(input, scheduler);\n }\n if (isReadableStreamLike(input)) {\n return scheduleReadableStreamLike(input, scheduler);\n }\n }\n throw createInvalidObservableTypeError(input);\n}\n","import { scheduled } from '../scheduled/scheduled';\nimport { innerFrom } from './innerFrom';\nexport function from(input, scheduler) {\n return scheduler ? scheduled(input, scheduler) : innerFrom(input);\n}\n","import { popScheduler } from '../util/args';\nimport { from } from './from';\nexport function of(...args) {\n const scheduler = popScheduler(args);\n return from(args, scheduler);\n}\n","import { Observable } from '../Observable';\nimport { isFunction } from '../util/isFunction';\nexport function throwError(errorOrErrorFactory, scheduler) {\n const errorFactory = isFunction(errorOrErrorFactory) ? errorOrErrorFactory : () => errorOrErrorFactory;\n const init = subscriber => subscriber.error(errorFactory());\n return new Observable(scheduler ? subscriber => scheduler.schedule(init, 0, subscriber) : init);\n}\n","import { Observable } from '../Observable';\nimport { isFunction } from './isFunction';\nexport function isObservable(obj) {\n return !!obj && (obj instanceof Observable || isFunction(obj.lift) && isFunction(obj.subscribe));\n}\n","import { createErrorClass } from './createErrorClass';\nexport const EmptyError = createErrorClass(_super => function EmptyErrorImpl() {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n});\n","export function isValidDate(value) {\n return value instanceof Date && !isNaN(value);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function map(project, thisArg) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n subscriber.next(project.call(thisArg, value, index++));\n }));\n });\n}\n","import { map } from \"../operators/map\";\nconst {\n isArray\n} = Array;\nfunction callOrApply(fn, args) {\n return isArray(args) ? fn(...args) : fn(args);\n}\nexport function mapOneOrManyArgs(fn) {\n return map(args => callOrApply(fn, args));\n}\n","const {\n isArray\n} = Array;\nconst {\n getPrototypeOf,\n prototype: objectProto,\n keys: getKeys\n} = Object;\nexport function argsArgArrayOrObject(args) {\n if (args.length === 1) {\n const first = args[0];\n if (isArray(first)) {\n return {\n args: first,\n keys: null\n };\n }\n if (isPOJO(first)) {\n const keys = getKeys(first);\n return {\n args: keys.map(key => first[key]),\n keys\n };\n }\n }\n return {\n args: args,\n keys: null\n };\n}\nfunction isPOJO(obj) {\n return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;\n}\n","export function createObject(keys, values) {\n return keys.reduce((result, key, i) => (result[key] = values[i], result), {});\n}\n","import { Observable } from '../Observable';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { from } from './from';\nimport { identity } from '../util/identity';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { popResultSelector, popScheduler } from '../util/args';\nimport { createObject } from '../util/createObject';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { executeSchedule } from '../util/executeSchedule';\nexport function combineLatest(...args) {\n const scheduler = popScheduler(args);\n const resultSelector = popResultSelector(args);\n const {\n args: observables,\n keys\n } = argsArgArrayOrObject(args);\n if (observables.length === 0) {\n return from([], scheduler);\n }\n const result = new Observable(combineLatestInit(observables, scheduler, keys ? values => createObject(keys, values) : identity));\n return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;\n}\nexport function combineLatestInit(observables, scheduler, valueTransform = identity) {\n return subscriber => {\n maybeSchedule(scheduler, () => {\n const {\n length\n } = observables;\n const values = new Array(length);\n let active = length;\n let remainingFirstValues = length;\n for (let i = 0; i < length; i++) {\n maybeSchedule(scheduler, () => {\n const source = from(observables[i], scheduler);\n let hasFirstValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n values[i] = value;\n if (!hasFirstValue) {\n hasFirstValue = true;\n remainingFirstValues--;\n }\n if (!remainingFirstValues) {\n subscriber.next(valueTransform(values.slice()));\n }\n }, () => {\n if (! --active) {\n subscriber.complete();\n }\n }));\n }, subscriber);\n }\n }, subscriber);\n };\n}\nfunction maybeSchedule(scheduler, execute, subscription) {\n if (scheduler) {\n executeSchedule(subscription, scheduler, execute);\n } else {\n execute();\n }\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { executeSchedule } from '../util/executeSchedule';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {\n const buffer = [];\n let active = 0;\n let index = 0;\n let isComplete = false;\n const checkComplete = () => {\n if (isComplete && !buffer.length && !active) {\n subscriber.complete();\n }\n };\n const outerNext = value => active < concurrent ? doInnerSub(value) : buffer.push(value);\n const doInnerSub = value => {\n expand && subscriber.next(value);\n active++;\n let innerComplete = false;\n innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, innerValue => {\n onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);\n if (expand) {\n outerNext(innerValue);\n } else {\n subscriber.next(innerValue);\n }\n }, () => {\n innerComplete = true;\n }, undefined, () => {\n if (innerComplete) {\n try {\n active--;\n while (buffer.length && active < concurrent) {\n const bufferedValue = buffer.shift();\n if (innerSubScheduler) {\n executeSchedule(subscriber, innerSubScheduler, () => doInnerSub(bufferedValue));\n } else {\n doInnerSub(bufferedValue);\n }\n }\n checkComplete();\n } catch (err) {\n subscriber.error(err);\n }\n }\n }));\n };\n source.subscribe(createOperatorSubscriber(subscriber, outerNext, () => {\n isComplete = true;\n checkComplete();\n }));\n return () => {\n additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();\n };\n}\n","import { map } from './map';\nimport { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { mergeInternals } from './mergeInternals';\nimport { isFunction } from '../util/isFunction';\nexport function mergeMap(project, resultSelector, concurrent = Infinity) {\n if (isFunction(resultSelector)) {\n return mergeMap((a, i) => map((b, ii) => resultSelector(a, b, i, ii))(innerFrom(project(a, i))), concurrent);\n } else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n return operate((source, subscriber) => mergeInternals(source, subscriber, project, concurrent));\n}\n","import { mergeMap } from './mergeMap';\nimport { identity } from '../util/identity';\nexport function mergeAll(concurrent = Infinity) {\n return mergeMap(identity, concurrent);\n}\n","import { mergeAll } from './mergeAll';\nexport function concatAll() {\n return mergeAll(1);\n}\n","import { concatAll } from '../operators/concatAll';\nimport { popScheduler } from '../util/args';\nimport { from } from './from';\nexport function concat(...args) {\n return concatAll()(from(args, popScheduler(args)));\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nexport function defer(observableFactory) {\n return new Observable(subscriber => {\n innerFrom(observableFactory()).subscribe(subscriber);\n });\n}\n","import { Observable } from '../Observable';\nimport { argsArgArrayOrObject } from '../util/argsArgArrayOrObject';\nimport { innerFrom } from './innerFrom';\nimport { popResultSelector } from '../util/args';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nimport { createObject } from '../util/createObject';\nexport function forkJoin(...args) {\n const resultSelector = popResultSelector(args);\n const {\n args: sources,\n keys\n } = argsArgArrayOrObject(args);\n const result = new Observable(subscriber => {\n const {\n length\n } = sources;\n if (!length) {\n subscriber.complete();\n return;\n }\n const values = new Array(length);\n let remainingCompletions = length;\n let remainingEmissions = length;\n for (let sourceIndex = 0; sourceIndex < length; sourceIndex++) {\n let hasValue = false;\n innerFrom(sources[sourceIndex]).subscribe(createOperatorSubscriber(subscriber, value => {\n if (!hasValue) {\n hasValue = true;\n remainingEmissions--;\n }\n values[sourceIndex] = value;\n }, () => remainingCompletions--, undefined, () => {\n if (!remainingCompletions || !hasValue) {\n if (!remainingEmissions) {\n subscriber.next(keys ? createObject(keys, values) : values);\n }\n subscriber.complete();\n }\n }));\n }\n });\n return resultSelector ? result.pipe(mapOneOrManyArgs(resultSelector)) : result;\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { Observable } from '../Observable';\nimport { mergeMap } from '../operators/mergeMap';\nimport { isArrayLike } from '../util/isArrayLike';\nimport { isFunction } from '../util/isFunction';\nimport { mapOneOrManyArgs } from '../util/mapOneOrManyArgs';\nconst nodeEventEmitterMethods = ['addListener', 'removeListener'];\nconst eventTargetMethods = ['addEventListener', 'removeEventListener'];\nconst jqueryMethods = ['on', 'off'];\nexport function fromEvent(target, eventName, options, resultSelector) {\n if (isFunction(options)) {\n resultSelector = options;\n options = undefined;\n }\n if (resultSelector) {\n return fromEvent(target, eventName, options).pipe(mapOneOrManyArgs(resultSelector));\n }\n const [add, remove] = isEventTarget(target) ? eventTargetMethods.map(methodName => handler => target[methodName](eventName, handler, options)) : isNodeStyleEventEmitter(target) ? nodeEventEmitterMethods.map(toCommonHandlerRegistry(target, eventName)) : isJQueryStyleEventEmitter(target) ? jqueryMethods.map(toCommonHandlerRegistry(target, eventName)) : [];\n if (!add) {\n if (isArrayLike(target)) {\n return mergeMap(subTarget => fromEvent(subTarget, eventName, options))(innerFrom(target));\n }\n }\n if (!add) {\n throw new TypeError('Invalid event target');\n }\n return new Observable(subscriber => {\n const handler = (...args) => subscriber.next(1 < args.length ? args : args[0]);\n add(handler);\n return () => remove(handler);\n });\n}\nfunction toCommonHandlerRegistry(target, eventName) {\n return methodName => handler => target[methodName](eventName, handler);\n}\nfunction isNodeStyleEventEmitter(target) {\n return isFunction(target.addListener) && isFunction(target.removeListener);\n}\nfunction isJQueryStyleEventEmitter(target) {\n return isFunction(target.on) && isFunction(target.off);\n}\nfunction isEventTarget(target) {\n return isFunction(target.addEventListener) && isFunction(target.removeEventListener);\n}\n","import { Observable } from '../Observable';\nimport { async as asyncScheduler } from '../scheduler/async';\nimport { isScheduler } from '../util/isScheduler';\nimport { isValidDate } from '../util/isDate';\nexport function timer(dueTime = 0, intervalOrScheduler, scheduler = asyncScheduler) {\n let intervalDuration = -1;\n if (intervalOrScheduler != null) {\n if (isScheduler(intervalOrScheduler)) {\n scheduler = intervalOrScheduler;\n } else {\n intervalDuration = intervalOrScheduler;\n }\n }\n return new Observable(subscriber => {\n let due = isValidDate(dueTime) ? +dueTime - scheduler.now() : dueTime;\n if (due < 0) {\n due = 0;\n }\n let n = 0;\n return scheduler.schedule(function () {\n if (!subscriber.closed) {\n subscriber.next(n++);\n if (0 <= intervalDuration) {\n this.schedule(undefined, intervalDuration);\n } else {\n subscriber.complete();\n }\n }\n }, due);\n });\n}\n","import { mergeAll } from '../operators/mergeAll';\nimport { innerFrom } from './innerFrom';\nimport { EMPTY } from './empty';\nimport { popNumber, popScheduler } from '../util/args';\nimport { from } from './from';\nexport function merge(...args) {\n const scheduler = popScheduler(args);\n const concurrent = popNumber(args, Infinity);\n const sources = args;\n return !sources.length ? EMPTY : sources.length === 1 ? innerFrom(sources[0]) : mergeAll(concurrent)(from(sources, scheduler));\n}\n","import { Observable } from '../Observable';\nimport { noop } from '../util/noop';\nexport const NEVER = new Observable(noop);\nexport function never() {\n return NEVER;\n}\n","const {\n isArray\n} = Array;\nexport function argsOrArgArray(args) {\n return args.length === 1 && isArray(args[0]) ? args[0] : args;\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function filter(predicate, thisArg) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => predicate.call(thisArg, value, index++) && subscriber.next(value)));\n });\n}\n","import { Observable } from '../Observable';\nimport { innerFrom } from './innerFrom';\nimport { argsOrArgArray } from '../util/argsOrArgArray';\nimport { createOperatorSubscriber } from '../operators/OperatorSubscriber';\nexport function race(...sources) {\n sources = argsOrArgArray(sources);\n return sources.length === 1 ? innerFrom(sources[0]) : new Observable(raceInit(sources));\n}\nexport function raceInit(sources) {\n return subscriber => {\n let subscriptions = [];\n for (let i = 0; subscriptions && !subscriber.closed && i < sources.length; i++) {\n subscriptions.push(innerFrom(sources[i]).subscribe(createOperatorSubscriber(subscriber, value => {\n if (subscriptions) {\n for (let s = 0; s < subscriptions.length; s++) {\n s !== i && subscriptions[s].unsubscribe();\n }\n subscriptions = null;\n }\n subscriber.next(value);\n })));\n }\n };\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { operate } from '../util/lift';\nexport function catchError(selector) {\n return operate((source, subscriber) => {\n let innerSub = null;\n let syncUnsub = false;\n let handledResult;\n innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, err => {\n handledResult = innerFrom(selector(err, catchError(selector)(source)));\n if (innerSub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n } else {\n syncUnsub = true;\n }\n }));\n if (syncUnsub) {\n innerSub.unsubscribe();\n innerSub = null;\n handledResult.subscribe(subscriber);\n }\n });\n}\n","import { createOperatorSubscriber } from './OperatorSubscriber';\nexport function scanInternals(accumulator, seed, hasSeed, emitOnNext, emitBeforeComplete) {\n return (source, subscriber) => {\n let hasState = hasSeed;\n let state = seed;\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const i = index++;\n state = hasState ? accumulator(state, value, i) : (hasState = true, value);\n emitOnNext && subscriber.next(state);\n }, emitBeforeComplete && (() => {\n hasState && subscriber.next(state);\n subscriber.complete();\n })));\n };\n}\n","import { mergeMap } from './mergeMap';\nimport { isFunction } from '../util/isFunction';\nexport function concatMap(project, resultSelector) {\n return isFunction(resultSelector) ? mergeMap(project, resultSelector, 1) : mergeMap(project, 1);\n}\n","import { operate } from '../util/lift';\nimport { noop } from '../util/noop';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nexport function debounce(durationSelector) {\n return operate((source, subscriber) => {\n let hasValue = false;\n let lastValue = null;\n let durationSubscriber = null;\n const emit = () => {\n durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();\n durationSubscriber = null;\n if (hasValue) {\n hasValue = false;\n const value = lastValue;\n lastValue = null;\n subscriber.next(value);\n }\n };\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n durationSubscriber === null || durationSubscriber === void 0 ? void 0 : durationSubscriber.unsubscribe();\n hasValue = true;\n lastValue = value;\n durationSubscriber = createOperatorSubscriber(subscriber, emit, noop);\n innerFrom(durationSelector(value)).subscribe(durationSubscriber);\n }, () => {\n emit();\n subscriber.complete();\n }, undefined, () => {\n lastValue = durationSubscriber = null;\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function defaultIfEmpty(defaultValue) {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n hasValue = true;\n subscriber.next(value);\n }, () => {\n if (!hasValue) {\n subscriber.next(defaultValue);\n }\n subscriber.complete();\n }));\n });\n}\n","import { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function take(count) {\n return count <= 0 ? () => EMPTY : operate((source, subscriber) => {\n let seen = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n if (++seen <= count) {\n subscriber.next(value);\n if (count <= seen) {\n subscriber.complete();\n }\n }\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { noop } from '../util/noop';\nexport function ignoreElements() {\n return operate((source, subscriber) => {\n source.subscribe(createOperatorSubscriber(subscriber, noop));\n });\n}\n","import { map } from './map';\nexport function mapTo(value) {\n return map(() => value);\n}\n","import { concat } from '../observable/concat';\nimport { take } from './take';\nimport { ignoreElements } from './ignoreElements';\nimport { mapTo } from './mapTo';\nimport { mergeMap } from './mergeMap';\nimport { innerFrom } from '../observable/innerFrom';\nexport function delayWhen(delayDurationSelector, subscriptionDelay) {\n if (subscriptionDelay) {\n return source => concat(subscriptionDelay.pipe(take(1), ignoreElements()), source.pipe(delayWhen(delayDurationSelector)));\n }\n return mergeMap((value, index) => innerFrom(delayDurationSelector(value, index)).pipe(take(1), mapTo(value)));\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { delayWhen } from './delayWhen';\nimport { timer } from '../observable/timer';\nexport function delay(due, scheduler = asyncScheduler) {\n const duration = timer(due, scheduler);\n return delayWhen(() => duration);\n}\n","import { identity } from '../util/identity';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function distinctUntilChanged(comparator, keySelector = identity) {\n comparator = comparator !== null && comparator !== void 0 ? comparator : defaultCompare;\n return operate((source, subscriber) => {\n let previousKey;\n let first = true;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const currentKey = keySelector(value);\n if (first || !comparator(previousKey, currentKey)) {\n first = false;\n previousKey = currentKey;\n subscriber.next(value);\n }\n }));\n });\n}\nfunction defaultCompare(a, b) {\n return a === b;\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function throwIfEmpty(errorFactory = defaultErrorFactory) {\n return operate((source, subscriber) => {\n let hasValue = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n hasValue = true;\n subscriber.next(value);\n }, () => hasValue ? subscriber.complete() : subscriber.error(errorFactory())));\n });\n}\nfunction defaultErrorFactory() {\n return new EmptyError();\n}\n","import { concat } from '../observable/concat';\nimport { of } from '../observable/of';\nexport function endWith(...values) {\n return source => concat(source, of(...values));\n}\n","import { operate } from '../util/lift';\nexport function finalize(callback) {\n return operate((source, subscriber) => {\n try {\n source.subscribe(subscriber);\n } finally {\n subscriber.add(callback);\n }\n });\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { filter } from './filter';\nimport { take } from './take';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { identity } from '../util/identity';\nexport function first(predicate, defaultValue) {\n const hasDefaultValue = arguments.length >= 2;\n return source => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, take(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));\n}\n","import { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function takeLast(count) {\n return count <= 0 ? () => EMPTY : operate((source, subscriber) => {\n let buffer = [];\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n buffer.push(value);\n count < buffer.length && buffer.shift();\n }, () => {\n for (const value of buffer) {\n subscriber.next(value);\n }\n subscriber.complete();\n }, undefined, () => {\n buffer = null;\n }));\n });\n}\n","import { EmptyError } from '../util/EmptyError';\nimport { filter } from './filter';\nimport { takeLast } from './takeLast';\nimport { throwIfEmpty } from './throwIfEmpty';\nimport { defaultIfEmpty } from './defaultIfEmpty';\nimport { identity } from '../util/identity';\nexport function last(predicate, defaultValue) {\n const hasDefaultValue = arguments.length >= 2;\n return source => source.pipe(predicate ? filter((v, i) => predicate(v, i, source)) : identity, takeLast(1), hasDefaultValue ? defaultIfEmpty(defaultValue) : throwIfEmpty(() => new EmptyError()));\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function pairwise() {\n return operate((source, subscriber) => {\n let prev;\n let hasPrev = false;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const p = prev;\n prev = value;\n hasPrev && subscriber.next([p, value]);\n hasPrev = true;\n }));\n });\n}\n","import { EMPTY } from '../observable/empty';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { timer } from '../observable/timer';\nexport function repeat(countOrConfig) {\n let count = Infinity;\n let delay;\n if (countOrConfig != null) {\n if (typeof countOrConfig === 'object') {\n ({\n count = Infinity,\n delay\n } = countOrConfig);\n } else {\n count = countOrConfig;\n }\n }\n return count <= 0 ? () => EMPTY : operate((source, subscriber) => {\n let soFar = 0;\n let sourceSub;\n const resubscribe = () => {\n sourceSub === null || sourceSub === void 0 ? void 0 : sourceSub.unsubscribe();\n sourceSub = null;\n if (delay != null) {\n const notifier = typeof delay === 'number' ? timer(delay) : innerFrom(delay(soFar));\n const notifierSubscriber = createOperatorSubscriber(subscriber, () => {\n notifierSubscriber.unsubscribe();\n subscribeToSource();\n });\n notifier.subscribe(notifierSubscriber);\n } else {\n subscribeToSource();\n }\n };\n const subscribeToSource = () => {\n let syncUnsub = false;\n sourceSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, () => {\n if (++soFar < count) {\n if (sourceSub) {\n resubscribe();\n } else {\n syncUnsub = true;\n }\n } else {\n subscriber.complete();\n }\n }));\n if (syncUnsub) {\n resubscribe();\n }\n };\n subscribeToSource();\n });\n}\n","import { operate } from '../util/lift';\nimport { scanInternals } from './scanInternals';\nexport function scan(accumulator, seed) {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, true));\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { Subject } from '../Subject';\nimport { SafeSubscriber } from '../Subscriber';\nimport { operate } from '../util/lift';\nexport function share(options = {}) {\n const {\n connector = () => new Subject(),\n resetOnError = true,\n resetOnComplete = true,\n resetOnRefCountZero = true\n } = options;\n return wrapperSource => {\n let connection;\n let resetConnection;\n let subject;\n let refCount = 0;\n let hasCompleted = false;\n let hasErrored = false;\n const cancelReset = () => {\n resetConnection === null || resetConnection === void 0 ? void 0 : resetConnection.unsubscribe();\n resetConnection = undefined;\n };\n const reset = () => {\n cancelReset();\n connection = subject = undefined;\n hasCompleted = hasErrored = false;\n };\n const resetAndUnsubscribe = () => {\n const conn = connection;\n reset();\n conn === null || conn === void 0 ? void 0 : conn.unsubscribe();\n };\n return operate((source, subscriber) => {\n refCount++;\n if (!hasErrored && !hasCompleted) {\n cancelReset();\n }\n const dest = subject = subject !== null && subject !== void 0 ? subject : connector();\n subscriber.add(() => {\n refCount--;\n if (refCount === 0 && !hasErrored && !hasCompleted) {\n resetConnection = handleReset(resetAndUnsubscribe, resetOnRefCountZero);\n }\n });\n dest.subscribe(subscriber);\n if (!connection && refCount > 0) {\n connection = new SafeSubscriber({\n next: value => dest.next(value),\n error: err => {\n hasErrored = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnError, err);\n dest.error(err);\n },\n complete: () => {\n hasCompleted = true;\n cancelReset();\n resetConnection = handleReset(reset, resetOnComplete);\n dest.complete();\n }\n });\n innerFrom(source).subscribe(connection);\n }\n })(wrapperSource);\n };\n}\nfunction handleReset(reset, on, ...args) {\n if (on === true) {\n reset();\n return;\n }\n if (on === false) {\n return;\n }\n const onSubscriber = new SafeSubscriber({\n next: () => {\n onSubscriber.unsubscribe();\n reset();\n }\n });\n return innerFrom(on(...args)).subscribe(onSubscriber);\n}\n","import { ReplaySubject } from '../ReplaySubject';\nimport { share } from './share';\nexport function shareReplay(configOrBufferSize, windowTime, scheduler) {\n let bufferSize;\n let refCount = false;\n if (configOrBufferSize && typeof configOrBufferSize === 'object') {\n ({\n bufferSize = Infinity,\n windowTime = Infinity,\n refCount = false,\n scheduler\n } = configOrBufferSize);\n } else {\n bufferSize = configOrBufferSize !== null && configOrBufferSize !== void 0 ? configOrBufferSize : Infinity;\n }\n return share({\n connector: () => new ReplaySubject(bufferSize, windowTime, scheduler),\n resetOnError: true,\n resetOnComplete: false,\n resetOnRefCountZero: refCount\n });\n}\n","import { filter } from './filter';\nexport function skip(count) {\n return filter((_, index) => count <= index);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function skipWhile(predicate) {\n return operate((source, subscriber) => {\n let taking = false;\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => (taking || (taking = !predicate(value, index++))) && subscriber.next(value)));\n });\n}\n","import { concat } from '../observable/concat';\nimport { popScheduler } from '../util/args';\nimport { operate } from '../util/lift';\nexport function startWith(...values) {\n const scheduler = popScheduler(values);\n return operate((source, subscriber) => {\n (scheduler ? concat(values, source, scheduler) : concat(values, source)).subscribe(subscriber);\n });\n}\n","import { innerFrom } from '../observable/innerFrom';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function switchMap(project, resultSelector) {\n return operate((source, subscriber) => {\n let innerSubscriber = null;\n let index = 0;\n let isComplete = false;\n const checkComplete = () => isComplete && !innerSubscriber && subscriber.complete();\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();\n let innerIndex = 0;\n const outerIndex = index++;\n innerFrom(project(value, outerIndex)).subscribe(innerSubscriber = createOperatorSubscriber(subscriber, innerValue => subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue), () => {\n innerSubscriber = null;\n checkComplete();\n }));\n }, () => {\n isComplete = true;\n checkComplete();\n }));\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { noop } from '../util/noop';\nexport function takeUntil(notifier) {\n return operate((source, subscriber) => {\n innerFrom(notifier).subscribe(createOperatorSubscriber(subscriber, () => subscriber.complete(), noop));\n !subscriber.closed && source.subscribe(subscriber);\n });\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nexport function takeWhile(predicate, inclusive = false) {\n return operate((source, subscriber) => {\n let index = 0;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n const result = predicate(value, index++);\n (result || inclusive) && subscriber.next(value);\n !result && subscriber.complete();\n }));\n });\n}\n","import { isFunction } from '../util/isFunction';\nimport { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { identity } from '../util/identity';\nexport function tap(observerOrNext, error, complete) {\n const tapObserver = isFunction(observerOrNext) || error || complete ? {\n next: observerOrNext,\n error,\n complete\n } : observerOrNext;\n return tapObserver ? operate((source, subscriber) => {\n var _a;\n (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n let isUnsub = true;\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n var _a;\n (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);\n subscriber.next(value);\n }, () => {\n var _a;\n isUnsub = false;\n (_a = tapObserver.complete) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n subscriber.complete();\n }, err => {\n var _a;\n isUnsub = false;\n (_a = tapObserver.error) === null || _a === void 0 ? void 0 : _a.call(tapObserver, err);\n subscriber.error(err);\n }, () => {\n var _a, _b;\n if (isUnsub) {\n (_a = tapObserver.unsubscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);\n }\n (_b = tapObserver.finalize) === null || _b === void 0 ? void 0 : _b.call(tapObserver);\n }));\n }) : identity;\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nexport function throttle(durationSelector, config) {\n return operate((source, subscriber) => {\n const {\n leading = true,\n trailing = false\n } = config !== null && config !== void 0 ? config : {};\n let hasValue = false;\n let sendValue = null;\n let throttled = null;\n let isComplete = false;\n const endThrottling = () => {\n throttled === null || throttled === void 0 ? void 0 : throttled.unsubscribe();\n throttled = null;\n if (trailing) {\n send();\n isComplete && subscriber.complete();\n }\n };\n const cleanupThrottling = () => {\n throttled = null;\n isComplete && subscriber.complete();\n };\n const startThrottle = value => throttled = innerFrom(durationSelector(value)).subscribe(createOperatorSubscriber(subscriber, endThrottling, cleanupThrottling));\n const send = () => {\n if (hasValue) {\n hasValue = false;\n const value = sendValue;\n sendValue = null;\n subscriber.next(value);\n !isComplete && startThrottle(value);\n }\n };\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n hasValue = true;\n sendValue = value;\n !(throttled && !throttled.closed) && (leading ? send() : startThrottle(value));\n }, () => {\n isComplete = true;\n !(trailing && hasValue && throttled && !throttled.closed) && subscriber.complete();\n }));\n });\n}\n","import { asyncScheduler } from '../scheduler/async';\nimport { throttle } from './throttle';\nimport { timer } from '../observable/timer';\nexport function throttleTime(duration, scheduler = asyncScheduler, config) {\n const duration$ = timer(duration, scheduler);\n return throttle(() => duration$, config);\n}\n","import { operate } from '../util/lift';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\nimport { innerFrom } from '../observable/innerFrom';\nimport { identity } from '../util/identity';\nimport { noop } from '../util/noop';\nimport { popResultSelector } from '../util/args';\nexport function withLatestFrom(...inputs) {\n const project = popResultSelector(inputs);\n return operate((source, subscriber) => {\n const len = inputs.length;\n const otherValues = new Array(len);\n let hasValue = inputs.map(() => false);\n let ready = false;\n for (let i = 0; i < len; i++) {\n innerFrom(inputs[i]).subscribe(createOperatorSubscriber(subscriber, value => {\n otherValues[i] = value;\n if (!ready && !hasValue[i]) {\n hasValue[i] = true;\n (ready = hasValue.every(identity)) && (hasValue = null);\n }\n }, noop));\n }\n source.subscribe(createOperatorSubscriber(subscriber, value => {\n if (ready) {\n const values = [value, ...otherValues];\n subscriber.next(project ? project(...values) : values);\n }\n }));\n });\n}\n","/**\n * @license Angular v19.0.4\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport { SIGNAL_NODE as SIGNAL_NODE$1, signalSetFn as signalSetFn$1, producerAccessed as producerAccessed$1, SIGNAL as SIGNAL$1, getActiveConsumer as getActiveConsumer$1, setActiveConsumer as setActiveConsumer$1, consumerDestroy as consumerDestroy$1, REACTIVE_NODE as REACTIVE_NODE$1, consumerBeforeComputation as consumerBeforeComputation$1, consumerAfterComputation as consumerAfterComputation$1, consumerPollProducersForChange as consumerPollProducersForChange$1, createSignal as createSignal$1, signalUpdateFn as signalUpdateFn$1, createComputed as createComputed$1, setThrowInvalidWriteToSignalError as setThrowInvalidWriteToSignalError$1, producerUpdateValueVersion as producerUpdateValueVersion$1, producerMarkClean as producerMarkClean$1, defaultEquals as defaultEquals$1, createWatch as createWatch$1, isInNotificationPhase as isInNotificationPhase$1 } from '@angular/core/primitives/signals';\nexport { SIGNAL as ɵSIGNAL } from '@angular/core/primitives/signals';\nimport { BehaviorSubject, Subject, Subscription } from 'rxjs';\nimport { Attribute as Attribute$1, EventContract, EventContractContainer, getAppScopedQueuedEventInfos, clearAppScopedEarlyEventContract, EventDispatcher, registerDispatcher, isEarlyEventType, isCaptureEventType, EventPhase } from '@angular/core/primitives/event-dispatch';\nimport { map } from 'rxjs/operators';\n\n/**\n * Base URL for the error details page.\n *\n * Keep this constant in sync across:\n * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts\n * - packages/core/src/error_details_base_url.ts\n */\nconst ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.dev/errors';\n/**\n * URL for the XSS security documentation.\n */\nconst XSS_SECURITY_URL = 'https://g.co/ng/security#xss';\n\n/**\n * Class that represents a runtime error.\n * Formats and outputs the error message in a consistent way.\n *\n * Example:\n * ```ts\n * throw new RuntimeError(\n * RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,\n * ngDevMode && 'Injector has already been destroyed.');\n * ```\n *\n * Note: the `message` argument contains a descriptive error message as a string in development\n * mode (when the `ngDevMode` is defined). In production mode (after tree-shaking pass), the\n * `message` argument becomes `false`, thus we account for it in the typings and the runtime\n * logic.\n */\nclass RuntimeError extends Error {\n code;\n constructor(code, message) {\n super(formatRuntimeError(code, message));\n this.code = code;\n }\n}\n/**\n * Called to format a runtime error.\n * See additional info on the `message` argument type in the `RuntimeError` class description.\n */\nfunction formatRuntimeError(code, message) {\n // Error code might be a negative number, which is a special marker that instructs the logic to\n // generate a link to the error details page on angular.io.\n // We also prepend `0` to non-compile-time errors.\n const fullCode = `NG0${Math.abs(code)}`;\n let errorMessage = `${fullCode}${message ? ': ' + message : ''}`;\n if (ngDevMode && code < 0) {\n const addPeriodSeparator = !errorMessage.match(/[.,;!?\\n]$/);\n const separator = addPeriodSeparator ? '.' : '';\n errorMessage = `${errorMessage}${separator} Find more at ${ERROR_DETAILS_PAGE_BASE_URL}/${fullCode}`;\n }\n return errorMessage;\n}\nconst REQUIRED_UNSET_VALUE = /* @__PURE__ */Symbol('InputSignalNode#UNSET');\n// Note: Using an IIFE here to ensure that the spread assignment is not considered\n// a side-effect, ending up preserving `COMPUTED_NODE` and `REACTIVE_NODE`.\n// TODO: remove when https://github.com/evanw/esbuild/issues/3392 is resolved.\nconst INPUT_SIGNAL_NODE = /* @__PURE__ */(() => {\n return {\n ...SIGNAL_NODE$1,\n transformFn: undefined,\n applyValueToInputSignal(node, value) {\n signalSetFn$1(node, value);\n }\n };\n})();\nconst ɵINPUT_SIGNAL_BRAND_READ_TYPE = /* @__PURE__ */Symbol();\nconst ɵINPUT_SIGNAL_BRAND_WRITE_TYPE = /* @__PURE__ */Symbol();\n/**\n * Creates an input signal.\n *\n * @param initialValue The initial value.\n * Can be set to {@link REQUIRED_UNSET_VALUE} for required inputs.\n * @param options Additional options for the input. e.g. a transform, or an alias.\n */\nfunction createInputSignal(initialValue, options) {\n const node = Object.create(INPUT_SIGNAL_NODE);\n node.value = initialValue;\n // Perf note: Always set `transformFn` here to ensure that `node` always\n // has the same v8 class shape, allowing monomorphic reads on input signals.\n node.transformFn = options?.transform;\n function inputValueFn() {\n // Record that someone looked at this signal.\n producerAccessed$1(node);\n if (node.value === REQUIRED_UNSET_VALUE) {\n throw new RuntimeError(-950 /* RuntimeErrorCode.REQUIRED_INPUT_NO_VALUE */, ngDevMode && 'Input is required but no value is available yet.');\n }\n return node.value;\n }\n inputValueFn[SIGNAL$1] = node;\n if (ngDevMode) {\n inputValueFn.toString = () => `[Input Signal: ${inputValueFn()}]`;\n node.debugName = options?.debugName;\n }\n return inputValueFn;\n}\n\n/**\n * Convince closure compiler that the wrapped function has no side-effects.\n *\n * Closure compiler always assumes that `toString` has no side-effects. We use this quirk to\n * allow us to execute a function but have closure compiler mark the call as no-side-effects.\n * It is important that the return value for the `noSideEffects` function be assigned\n * to something which is retained otherwise the call to `noSideEffects` will be removed by closure\n * compiler.\n */\nfunction noSideEffects(fn) {\n return {\n toString: fn\n }.toString();\n}\nconst ANNOTATIONS = '__annotations__';\nconst PARAMETERS = '__parameters__';\nconst PROP_METADATA = '__prop__metadata__';\n/**\n * @suppress {globalThis}\n */\nfunction makeDecorator(name, props, parentClass, additionalProcessing, typeFn) {\n return noSideEffects(() => {\n const metaCtor = makeMetadataCtor(props);\n function DecoratorFactory(...args) {\n if (this instanceof DecoratorFactory) {\n metaCtor.call(this, ...args);\n return this;\n }\n const annotationInstance = new DecoratorFactory(...args);\n return function TypeDecorator(cls) {\n if (typeFn) typeFn(cls, ...args);\n // Use of Object.defineProperty is important since it creates non-enumerable property which\n // prevents the property is copied during subclassing.\n const annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, {\n value: []\n })[ANNOTATIONS];\n annotations.push(annotationInstance);\n if (additionalProcessing) additionalProcessing(cls);\n return cls;\n };\n }\n if (parentClass) {\n DecoratorFactory.prototype = Object.create(parentClass.prototype);\n }\n DecoratorFactory.prototype.ngMetadataName = name;\n DecoratorFactory.annotationCls = DecoratorFactory;\n return DecoratorFactory;\n });\n}\nfunction makeMetadataCtor(props) {\n return function ctor(...args) {\n if (props) {\n const values = props(...args);\n for (const propName in values) {\n this[propName] = values[propName];\n }\n }\n };\n}\nfunction makeParamDecorator(name, props, parentClass) {\n return noSideEffects(() => {\n const metaCtor = makeMetadataCtor(props);\n function ParamDecoratorFactory(...args) {\n if (this instanceof ParamDecoratorFactory) {\n metaCtor.apply(this, args);\n return this;\n }\n const annotationInstance = new ParamDecoratorFactory(...args);\n ParamDecorator.annotation = annotationInstance;\n return ParamDecorator;\n function ParamDecorator(cls, unusedKey, index) {\n // Use of Object.defineProperty is important since it creates non-enumerable property which\n // prevents the property is copied during subclassing.\n const parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, {\n value: []\n })[PARAMETERS];\n // there might be gaps if some in between parameters do not have annotations.\n // we pad with nulls.\n while (parameters.length <= index) {\n parameters.push(null);\n }\n (parameters[index] = parameters[index] || []).push(annotationInstance);\n return cls;\n }\n }\n if (parentClass) {\n ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);\n }\n ParamDecoratorFactory.prototype.ngMetadataName = name;\n ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;\n return ParamDecoratorFactory;\n });\n}\nfunction makePropDecorator(name, props, parentClass, additionalProcessing) {\n return noSideEffects(() => {\n const metaCtor = makeMetadataCtor(props);\n function PropDecoratorFactory(...args) {\n if (this instanceof PropDecoratorFactory) {\n metaCtor.apply(this, args);\n return this;\n }\n const decoratorInstance = new PropDecoratorFactory(...args);\n function PropDecorator(target, name) {\n // target is undefined with standard decorators. This case is not supported and will throw\n // if this decorator is used in JIT mode with standard decorators.\n if (target === undefined) {\n throw new Error('Standard Angular field decorators are not supported in JIT mode.');\n }\n const constructor = target.constructor;\n // Use of Object.defineProperty is important because it creates a non-enumerable property\n // which prevents the property from being copied during subclassing.\n const meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, {\n value: {}\n })[PROP_METADATA];\n meta[name] = meta.hasOwnProperty(name) && meta[name] || [];\n meta[name].unshift(decoratorInstance);\n if (additionalProcessing) additionalProcessing(target, name, ...args);\n }\n return PropDecorator;\n }\n if (parentClass) {\n PropDecoratorFactory.prototype = Object.create(parentClass.prototype);\n }\n PropDecoratorFactory.prototype.ngMetadataName = name;\n PropDecoratorFactory.annotationCls = PropDecoratorFactory;\n return PropDecoratorFactory;\n });\n}\nconst _global = globalThis;\nfunction ngDevModeResetPerfCounters() {\n const locationString = typeof location !== 'undefined' ? location.toString() : '';\n const newCounters = {\n namedConstructors: locationString.indexOf('ngDevMode=namedConstructors') != -1,\n firstCreatePass: 0,\n tNode: 0,\n tView: 0,\n rendererCreateTextNode: 0,\n rendererSetText: 0,\n rendererCreateElement: 0,\n rendererAddEventListener: 0,\n rendererSetAttribute: 0,\n rendererRemoveAttribute: 0,\n rendererSetProperty: 0,\n rendererSetClassName: 0,\n rendererAddClass: 0,\n rendererRemoveClass: 0,\n rendererSetStyle: 0,\n rendererRemoveStyle: 0,\n rendererDestroy: 0,\n rendererDestroyNode: 0,\n rendererMoveNode: 0,\n rendererRemoveNode: 0,\n rendererAppendChild: 0,\n rendererInsertBefore: 0,\n rendererCreateComment: 0,\n hydratedNodes: 0,\n hydratedComponents: 0,\n dehydratedViewsRemoved: 0,\n dehydratedViewsCleanupRuns: 0,\n componentsSkippedHydration: 0\n };\n // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.\n const allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1;\n if (!allowNgDevModeTrue) {\n _global['ngDevMode'] = false;\n } else {\n if (typeof _global['ngDevMode'] !== 'object') {\n _global['ngDevMode'] = {};\n }\n Object.assign(_global['ngDevMode'], newCounters);\n }\n return newCounters;\n}\n/**\n * This function checks to see if the `ngDevMode` has been set. If yes,\n * then we honor it, otherwise we default to dev mode with additional checks.\n *\n * The idea is that unless we are doing production build where we explicitly\n * set `ngDevMode == false` we should be helping the developer by providing\n * as much early warning and errors as possible.\n *\n * `ɵɵdefineComponent` is guaranteed to have been called before any component template functions\n * (and thus Ivy instructions), so a single initialization there is sufficient to ensure ngDevMode\n * is defined for the entire instruction set.\n *\n * When checking `ngDevMode` on toplevel, always init it before referencing it\n * (e.g. `((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode())`), otherwise you can\n * get a `ReferenceError` like in https://github.com/angular/angular/issues/31595.\n *\n * Details on possible values for `ngDevMode` can be found on its docstring.\n *\n * NOTE:\n * - changes to the `ngDevMode` name must be synced with `compiler-cli/src/tooling.ts`.\n */\nfunction initNgDevMode() {\n // The below checks are to ensure that calling `initNgDevMode` multiple times does not\n // reset the counters.\n // If the `ngDevMode` is not an object, then it means we have not created the perf counters\n // yet.\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (typeof ngDevMode !== 'object' || Object.keys(ngDevMode).length === 0) {\n ngDevModeResetPerfCounters();\n }\n return typeof ngDevMode !== 'undefined' && !!ngDevMode;\n }\n return false;\n}\nfunction getClosureSafeProperty(objWithPropertyToExtract) {\n for (let key in objWithPropertyToExtract) {\n if (objWithPropertyToExtract[key] === getClosureSafeProperty) {\n return key;\n }\n }\n throw Error('Could not find renamed property on target object.');\n}\n/**\n * Sets properties on a target object from a source object, but only if\n * the property doesn't already exist on the target object.\n * @param target The target to set properties on\n * @param source The source of the property keys and values to set\n */\nfunction fillProperties(target, source) {\n for (const key in source) {\n if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {\n target[key] = source[key];\n }\n }\n}\nfunction stringify(token) {\n if (typeof token === 'string') {\n return token;\n }\n if (Array.isArray(token)) {\n return '[' + token.map(stringify).join(', ') + ']';\n }\n if (token == null) {\n return '' + token;\n }\n if (token.overriddenName) {\n return `${token.overriddenName}`;\n }\n if (token.name) {\n return `${token.name}`;\n }\n const res = token.toString();\n if (res == null) {\n return '' + res;\n }\n const newLineIndex = res.indexOf('\\n');\n return newLineIndex === -1 ? res : res.substring(0, newLineIndex);\n}\n/**\n * Concatenates two strings with separator, allocating new strings only when necessary.\n *\n * @param before before string.\n * @param separator separator string.\n * @param after after string.\n * @returns concatenated string.\n */\nfunction concatStringsWithSpace(before, after) {\n return before == null || before === '' ? after === null ? '' : after : after == null || after === '' ? before : before + ' ' + after;\n}\n/**\n * Ellipses the string in the middle when longer than the max length\n *\n * @param string\n * @param maxLength of the output string\n * @returns ellipsed string with ... in the middle\n */\nfunction truncateMiddle(str, maxLength = 100) {\n if (!str || maxLength < 1 || str.length <= maxLength) return str;\n if (maxLength == 1) return str.substring(0, 1) + '...';\n const halfLimit = Math.round(maxLength / 2);\n return str.substring(0, halfLimit) + '...' + str.substring(str.length - halfLimit);\n}\nconst __forward_ref__ = /*#__PURE__*/getClosureSafeProperty({\n __forward_ref__: getClosureSafeProperty\n});\n/**\n * Allows to refer to references which are not yet defined.\n *\n * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of\n * DI is declared, but not yet defined. It is also used when the `token` which we use when creating\n * a query is not yet defined.\n *\n * `forwardRef` is also used to break circularities in standalone components imports.\n *\n * @usageNotes\n * ### Circular dependency example\n * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}\n *\n * ### Circular standalone reference import example\n * ```angular-ts\n * @Component({\n * standalone: true,\n * imports: [ChildComponent],\n * selector: 'app-parent',\n * template: ``,\n * })\n * export class ParentComponent {\n * @Input() hideParent: boolean;\n * }\n *\n *\n * @Component({\n * standalone: true,\n * imports: [CommonModule, forwardRef(() => ParentComponent)],\n * selector: 'app-child',\n * template: ``,\n * })\n * export class ChildComponent {\n * @Input() hideParent: boolean;\n * }\n * ```\n *\n * @publicApi\n */\nfunction forwardRef(forwardRefFn) {\n forwardRefFn.__forward_ref__ = forwardRef;\n forwardRefFn.toString = function () {\n return stringify(this());\n };\n return forwardRefFn;\n}\n/**\n * Lazily retrieves the reference value from a forwardRef.\n *\n * Acts as the identity function when given a non-forward-ref value.\n *\n * @usageNotes\n * ### Example\n *\n * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}\n *\n * @see {@link forwardRef}\n * @publicApi\n */\nfunction resolveForwardRef(type) {\n return isForwardRef(type) ? type() : type;\n}\n/** Checks whether a function is wrapped by a `forwardRef`. */\nfunction isForwardRef(fn) {\n return typeof fn === 'function' && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef;\n}\n\n// The functions in this file verify that the assumptions we are making\nfunction assertNumber(actual, msg) {\n if (!(typeof actual === 'number')) {\n throwError(msg, typeof actual, 'number', '===');\n }\n}\nfunction assertNumberInRange(actual, minInclusive, maxInclusive) {\n assertNumber(actual, 'Expected a number');\n assertLessThanOrEqual(actual, maxInclusive, 'Expected number to be less than or equal to');\n assertGreaterThanOrEqual(actual, minInclusive, 'Expected number to be greater than or equal to');\n}\nfunction assertString(actual, msg) {\n if (!(typeof actual === 'string')) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');\n }\n}\nfunction assertFunction(actual, msg) {\n if (!(typeof actual === 'function')) {\n throwError(msg, actual === null ? 'null' : typeof actual, 'function', '===');\n }\n}\nfunction assertEqual(actual, expected, msg) {\n if (!(actual == expected)) {\n throwError(msg, actual, expected, '==');\n }\n}\nfunction assertNotEqual(actual, expected, msg) {\n if (!(actual != expected)) {\n throwError(msg, actual, expected, '!=');\n }\n}\nfunction assertSame(actual, expected, msg) {\n if (!(actual === expected)) {\n throwError(msg, actual, expected, '===');\n }\n}\nfunction assertNotSame(actual, expected, msg) {\n if (!(actual !== expected)) {\n throwError(msg, actual, expected, '!==');\n }\n}\nfunction assertLessThan(actual, expected, msg) {\n if (!(actual < expected)) {\n throwError(msg, actual, expected, '<');\n }\n}\nfunction assertLessThanOrEqual(actual, expected, msg) {\n if (!(actual <= expected)) {\n throwError(msg, actual, expected, '<=');\n }\n}\nfunction assertGreaterThan(actual, expected, msg) {\n if (!(actual > expected)) {\n throwError(msg, actual, expected, '>');\n }\n}\nfunction assertGreaterThanOrEqual(actual, expected, msg) {\n if (!(actual >= expected)) {\n throwError(msg, actual, expected, '>=');\n }\n}\nfunction assertNotDefined(actual, msg) {\n if (actual != null) {\n throwError(msg, actual, null, '==');\n }\n}\nfunction assertDefined(actual, msg) {\n if (actual == null) {\n throwError(msg, actual, null, '!=');\n }\n}\nfunction throwError(msg, actual, expected, comparison) {\n throw new Error(`ASSERTION ERROR: ${msg}` + (comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`));\n}\nfunction assertDomNode(node) {\n if (!(node instanceof Node)) {\n throwError(`The provided value must be an instance of a DOM Node but got ${stringify(node)}`);\n }\n}\nfunction assertElement(node) {\n if (!(node instanceof Element)) {\n throwError(`The provided value must be an element but got ${stringify(node)}`);\n }\n}\nfunction assertIndexInRange(arr, index) {\n assertDefined(arr, 'Array must be defined.');\n const maxLen = arr.length;\n if (index < 0 || index >= maxLen) {\n throwError(`Index expected to be less than ${maxLen} but got ${index}`);\n }\n}\nfunction assertOneOf(value, ...validValues) {\n if (validValues.indexOf(value) !== -1) return true;\n throwError(`Expected value to be one of ${JSON.stringify(validValues)} but was ${JSON.stringify(value)}.`);\n}\nfunction assertNotReactive(fn) {\n if (getActiveConsumer$1() !== null) {\n throwError(`${fn}() should never be called in a reactive context.`);\n }\n}\n\n/**\n * Construct an injectable definition which defines how a token will be constructed by the DI\n * system, and in which injectors (if any) it will be available.\n *\n * This should be assigned to a static `ɵprov` field on a type, which will then be an\n * `InjectableType`.\n *\n * Options:\n * * `providedIn` determines which injectors will include the injectable, by either associating it\n * with an `@NgModule` or other `InjectorType`, or by specifying that this injectable should be\n * provided in the `'root'` injector, which will be the application-level injector in most apps.\n * * `factory` gives the zero argument function which will create an instance of the injectable.\n * The factory can call [`inject`](api/core/inject) to access the `Injector` and request injection\n * of dependencies.\n *\n * @codeGenApi\n * @publicApi This instruction has been emitted by ViewEngine for some time and is deployed to npm.\n */\nfunction ɵɵdefineInjectable(opts) {\n return {\n token: opts.token,\n providedIn: opts.providedIn || null,\n factory: opts.factory,\n value: undefined\n };\n}\n/**\n * @deprecated in v8, delete after v10. This API should be used only by generated code, and that\n * code should now use ɵɵdefineInjectable instead.\n * @publicApi\n */\nconst defineInjectable = ɵɵdefineInjectable;\n/**\n * Construct an `InjectorDef` which configures an injector.\n *\n * This should be assigned to a static injector def (`ɵinj`) field on a type, which will then be an\n * `InjectorType`.\n *\n * Options:\n *\n * * `providers`: an optional array of providers to add to the injector. Each provider must\n * either have a factory or point to a type which has a `ɵprov` static property (the\n * type must be an `InjectableType`).\n * * `imports`: an optional array of imports of other `InjectorType`s or `InjectorTypeWithModule`s\n * whose providers will also be added to the injector. Locally provided types will override\n * providers from imports.\n *\n * @codeGenApi\n */\nfunction ɵɵdefineInjector(options) {\n return {\n providers: options.providers || [],\n imports: options.imports || []\n };\n}\n/**\n * Read the injectable def (`ɵprov`) for `type` in a way which is immune to accidentally reading\n * inherited value.\n *\n * @param type A type which may have its own (non-inherited) `ɵprov`.\n */\nfunction getInjectableDef(type) {\n return getOwnDefinition(type, NG_PROV_DEF) || getOwnDefinition(type, NG_INJECTABLE_DEF);\n}\nfunction isInjectable(type) {\n return getInjectableDef(type) !== null;\n}\n/**\n * Return definition only if it is defined directly on `type` and is not inherited from a base\n * class of `type`.\n */\nfunction getOwnDefinition(type, field) {\n return type.hasOwnProperty(field) ? type[field] : null;\n}\n/**\n * Read the injectable def (`ɵprov`) for `type` or read the `ɵprov` from one of its ancestors.\n *\n * @param type A type which may have `ɵprov`, via inheritance.\n *\n * @deprecated Will be removed in a future version of Angular, where an error will occur in the\n * scenario if we find the `ɵprov` on an ancestor only.\n */\nfunction getInheritedInjectableDef(type) {\n const def = type && (type[NG_PROV_DEF] || type[NG_INJECTABLE_DEF]);\n if (def) {\n ngDevMode && console.warn(`DEPRECATED: DI is instantiating a token \"${type.name}\" that inherits its @Injectable decorator but does not provide one itself.\\n` + `This will become an error in a future version of Angular. Please add @Injectable() to the \"${type.name}\" class.`);\n return def;\n } else {\n return null;\n }\n}\n/**\n * Read the injector def type in a way which is immune to accidentally reading inherited value.\n *\n * @param type type which may have an injector def (`ɵinj`)\n */\nfunction getInjectorDef(type) {\n return type && (type.hasOwnProperty(NG_INJ_DEF) || type.hasOwnProperty(NG_INJECTOR_DEF)) ? type[NG_INJ_DEF] : null;\n}\nconst NG_PROV_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵprov: getClosureSafeProperty\n});\nconst NG_INJ_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵinj: getClosureSafeProperty\n});\n// We need to keep these around so we can read off old defs if new defs are unavailable\nconst NG_INJECTABLE_DEF = /*#__PURE__*/getClosureSafeProperty({\n ngInjectableDef: getClosureSafeProperty\n});\nconst NG_INJECTOR_DEF = /*#__PURE__*/getClosureSafeProperty({\n ngInjectorDef: getClosureSafeProperty\n});\n\n/**\n * Creates a token that can be used in a DI Provider.\n *\n * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a\n * runtime representation) such as when injecting an interface, callable type, array or\n * parameterized type.\n *\n * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by\n * the `Injector`. This provides an additional level of type safety.\n *\n *
          \n *\n * **Important Note**: Ensure that you use the same instance of the `InjectionToken` in both the\n * provider and the injection call. Creating a new instance of `InjectionToken` in different places,\n * even with the same description, will be treated as different tokens by Angular's DI system,\n * leading to a `NullInjectorError`.\n *\n *
          \n *\n * {@example injection-token/src/main.ts region='InjectionToken'}\n *\n * When creating an `InjectionToken`, you can optionally specify a factory function which returns\n * (possibly by creating) a default value of the parameterized type `T`. This sets up the\n * `InjectionToken` using this factory as a provider as if it was defined explicitly in the\n * application's root injector. If the factory function, which takes zero arguments, needs to inject\n * dependencies, it can do so using the [`inject`](api/core/inject) function.\n * As you can see in the Tree-shakable InjectionToken example below.\n *\n * Additionally, if a `factory` is specified you can also specify the `providedIn` option, which\n * overrides the above behavior and marks the token as belonging to a particular `@NgModule` (note:\n * this option is now deprecated). As mentioned above, `'root'` is the default value for\n * `providedIn`.\n *\n * The `providedIn: NgModule` and `providedIn: 'any'` options are deprecated.\n *\n * @usageNotes\n * ### Basic Examples\n *\n * ### Plain InjectionToken\n *\n * {@example core/di/ts/injector_spec.ts region='InjectionToken'}\n *\n * ### Tree-shakable InjectionToken\n *\n * {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}\n *\n * @publicApi\n */\nclass InjectionToken {\n _desc;\n /** @internal */\n ngMetadataName = 'InjectionToken';\n ɵprov;\n /**\n * @param _desc Description for the token,\n * used only for debugging purposes,\n * it should but does not need to be unique\n * @param options Options for the token's usage, as described above\n */\n constructor(_desc, options) {\n this._desc = _desc;\n this.ɵprov = undefined;\n if (typeof options == 'number') {\n (typeof ngDevMode === 'undefined' || ngDevMode) && assertLessThan(options, 0, 'Only negative numbers are supported here');\n // This is a special hack to assign __NG_ELEMENT_ID__ to this instance.\n // See `InjectorMarkers`\n this.__NG_ELEMENT_ID__ = options;\n } else if (options !== undefined) {\n this.ɵprov = ɵɵdefineInjectable({\n token: this,\n providedIn: options.providedIn || 'root',\n factory: options.factory\n });\n }\n }\n /**\n * @internal\n */\n get multi() {\n return this;\n }\n toString() {\n return `InjectionToken ${this._desc}`;\n }\n}\nlet _injectorProfilerContext;\nfunction getInjectorProfilerContext() {\n !ngDevMode && throwError('getInjectorProfilerContext should never be called in production mode');\n return _injectorProfilerContext;\n}\nfunction setInjectorProfilerContext(context) {\n !ngDevMode && throwError('setInjectorProfilerContext should never be called in production mode');\n const previous = _injectorProfilerContext;\n _injectorProfilerContext = context;\n return previous;\n}\nlet injectorProfilerCallback = null;\n/**\n * Sets the callback function which will be invoked during certain DI events within the\n * runtime (for example: injecting services, creating injectable instances, configuring providers)\n *\n * Warning: this function is *INTERNAL* and should not be relied upon in application's code.\n * The contract of the function might be changed in any release and/or the function can be removed\n * completely.\n *\n * @param profiler function provided by the caller or null value to disable profiling.\n */\nconst setInjectorProfiler = injectorProfiler => {\n !ngDevMode && throwError('setInjectorProfiler should never be called in production mode');\n injectorProfilerCallback = injectorProfiler;\n};\n/**\n * Injector profiler function which emits on DI events executed by the runtime.\n *\n * @param event InjectorProfilerEvent corresponding to the DI event being emitted\n */\nfunction injectorProfiler(event) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n if (injectorProfilerCallback != null /* both `null` and `undefined` */) {\n injectorProfilerCallback(event);\n }\n}\n/**\n * Emits an InjectorProfilerEventType.ProviderConfigured to the injector profiler. The data in the\n * emitted event includes the raw provider, as well as the token that provider is providing.\n *\n * @param eventProvider A provider object\n */\nfunction emitProviderConfiguredEvent(eventProvider, isViewProvider = false) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n let token;\n // if the provider is a TypeProvider (typeof provider is function) then the token is the\n // provider itself\n if (typeof eventProvider === 'function') {\n token = eventProvider;\n }\n // if the provider is an injection token, then the token is the injection token.\n else if (eventProvider instanceof InjectionToken) {\n token = eventProvider;\n }\n // in all other cases we can access the token via the `provide` property of the provider\n else {\n token = resolveForwardRef(eventProvider.provide);\n }\n let provider = eventProvider;\n // Injection tokens may define their own default provider which gets attached to the token itself\n // as `ɵprov`. In this case, we want to emit the provider that is attached to the token, not the\n // token itself.\n if (eventProvider instanceof InjectionToken) {\n provider = eventProvider.ɵprov || eventProvider;\n }\n injectorProfiler({\n type: 2 /* InjectorProfilerEventType.ProviderConfigured */,\n context: getInjectorProfilerContext(),\n providerRecord: {\n token,\n provider,\n isViewProvider\n }\n });\n}\n/**\n * Emits an event to the injector profiler with the instance that was created. Note that\n * the injector associated with this emission can be accessed by using getDebugInjectContext()\n *\n * @param instance an object created by an injector\n */\nfunction emitInstanceCreatedByInjectorEvent(instance) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n injectorProfiler({\n type: 1 /* InjectorProfilerEventType.InstanceCreatedByInjector */,\n context: getInjectorProfilerContext(),\n instance: {\n value: instance\n }\n });\n}\n/**\n * @param token DI token associated with injected service\n * @param value the instance of the injected service (i.e the result of `inject(token)`)\n * @param flags the flags that the token was injected with\n */\nfunction emitInjectEvent(token, value, flags) {\n !ngDevMode && throwError('Injector profiler should never be called in production mode');\n injectorProfiler({\n type: 0 /* InjectorProfilerEventType.Inject */,\n context: getInjectorProfilerContext(),\n service: {\n token,\n value,\n flags\n }\n });\n}\nfunction runInInjectorProfilerContext(injector, token, callback) {\n !ngDevMode && throwError('runInInjectorProfilerContext should never be called in production mode');\n const prevInjectContext = setInjectorProfilerContext({\n injector,\n token\n });\n try {\n callback();\n } finally {\n setInjectorProfilerContext(prevInjectContext);\n }\n}\nfunction isEnvironmentProviders(value) {\n return value && !!value.ɵproviders;\n}\nconst NG_COMP_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵcmp: getClosureSafeProperty\n});\nconst NG_DIR_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵdir: getClosureSafeProperty\n});\nconst NG_PIPE_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵpipe: getClosureSafeProperty\n});\nconst NG_MOD_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵmod: getClosureSafeProperty\n});\nconst NG_FACTORY_DEF = /*#__PURE__*/getClosureSafeProperty({\n ɵfac: getClosureSafeProperty\n});\n/**\n * If a directive is diPublic, bloomAdd sets a property on the type with this constant as\n * the key and the directive's unique ID as the value. This allows us to map directives to their\n * bloom filter bit for DI.\n */\n// TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified.\nconst NG_ELEMENT_ID = /*#__PURE__*/getClosureSafeProperty({\n __NG_ELEMENT_ID__: getClosureSafeProperty\n});\n/**\n * The `NG_ENV_ID` field on a DI token indicates special processing in the `EnvironmentInjector`:\n * getting such tokens from the `EnvironmentInjector` will bypass the standard DI resolution\n * strategy and instead will return implementation produced by the `NG_ENV_ID` factory function.\n *\n * This particular retrieval of DI tokens is mostly done to eliminate circular dependencies and\n * improve tree-shaking.\n */\nconst NG_ENV_ID = /*#__PURE__*/getClosureSafeProperty({\n __NG_ENV_ID__: getClosureSafeProperty\n});\n\n/**\n * Used for stringify render output in Ivy.\n * Important! This function is very performance-sensitive and we should\n * be extra careful not to introduce megamorphic reads in it.\n * Check `core/test/render3/perf/render_stringify` for benchmarks and alternate implementations.\n */\nfunction renderStringify(value) {\n if (typeof value === 'string') return value;\n if (value == null) return '';\n // Use `String` so that it invokes the `toString` method of the value. Note that this\n // appears to be faster than calling `value.toString` (see `render_stringify` benchmark).\n return String(value);\n}\n/**\n * Used to stringify a value so that it can be displayed in an error message.\n *\n * Important! This function contains a megamorphic read and should only be\n * used for error messages.\n */\nfunction stringifyForError(value) {\n if (typeof value === 'function') return value.name || value.toString();\n if (typeof value === 'object' && value != null && typeof value.type === 'function') {\n return value.type.name || value.type.toString();\n }\n return renderStringify(value);\n}\n/**\n * Used to stringify a `Type` and including the file path and line number in which it is defined, if\n * possible, for better debugging experience.\n *\n * Important! This function contains a megamorphic read and should only be used for error messages.\n */\nfunction debugStringifyTypeForError(type) {\n // TODO(pmvald): Do some refactoring so that we can use getComponentDef here without creating\n // circular deps.\n let componentDef = type[NG_COMP_DEF] || null;\n if (componentDef !== null && componentDef.debugInfo) {\n return stringifyTypeFromDebugInfo(componentDef.debugInfo);\n }\n return stringifyForError(type);\n}\n// TODO(pmvald): Do some refactoring so that we can use the type ClassDebugInfo for the param\n// debugInfo here without creating circular deps.\nfunction stringifyTypeFromDebugInfo(debugInfo) {\n if (!debugInfo.filePath || !debugInfo.lineNumber) {\n return debugInfo.className;\n } else {\n return `${debugInfo.className} (at ${debugInfo.filePath}:${debugInfo.lineNumber})`;\n }\n}\n\n/** Called when directives inject each other (creating a circular dependency) */\nfunction throwCyclicDependencyError(token, path) {\n const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';\n throw new RuntimeError(-200 /* RuntimeErrorCode.CYCLIC_DI_DEPENDENCY */, ngDevMode ? `Circular dependency in DI detected for ${token}${depPath}` : token);\n}\nfunction throwMixedMultiProviderError() {\n throw new Error(`Cannot mix multi providers and regular providers`);\n}\nfunction throwInvalidProviderError(ngModuleType, providers, provider) {\n if (ngModuleType && providers) {\n const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');\n throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`);\n } else if (isEnvironmentProviders(provider)) {\n if (provider.ɵfromNgModule) {\n throw new RuntimeError(207 /* RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT */, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`);\n } else {\n throw new RuntimeError(207 /* RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT */, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`);\n }\n } else {\n throw new Error('Invalid provider');\n }\n}\n/** Throws an error when a token is not found in DI. */\nfunction throwProviderNotFoundError(token, injectorName) {\n const errorMessage = ngDevMode && `No provider for ${stringifyForError(token)} found${injectorName ? ` in ${injectorName}` : ''}`;\n throw new RuntimeError(-201 /* RuntimeErrorCode.PROVIDER_NOT_FOUND */, errorMessage);\n}\n\n/**\n * Injection flags for DI.\n *\n * @publicApi\n * @deprecated use an options object for [`inject`](api/core/inject) instead.\n */\nvar InjectFlags = /*#__PURE__*/function (InjectFlags) {\n // TODO(alxhub): make this 'const' (and remove `InternalInjectFlags` enum) when ngc no longer\n // writes exports of it into ngfactory files.\n /** Check self and check parent injector if needed */\n InjectFlags[InjectFlags[\"Default\"] = 0] = \"Default\";\n /**\n * Specifies that an injector should retrieve a dependency from any injector until reaching the\n * host element of the current component. (Only used with Element Injector)\n */\n InjectFlags[InjectFlags[\"Host\"] = 1] = \"Host\";\n /** Don't ascend to ancestors of the node requesting injection. */\n InjectFlags[InjectFlags[\"Self\"] = 2] = \"Self\";\n /** Skip the node that is requesting injection. */\n InjectFlags[InjectFlags[\"SkipSelf\"] = 4] = \"SkipSelf\";\n /** Inject `defaultValue` instead if token not found. */\n InjectFlags[InjectFlags[\"Optional\"] = 8] = \"Optional\";\n return InjectFlags;\n}(InjectFlags || {});\n/**\n * Current implementation of inject.\n *\n * By default, it is `injectInjectorOnly`, which makes it `Injector`-only aware. It can be changed\n * to `directiveInject`, which brings in the `NodeInjector` system of ivy. It is designed this\n * way for two reasons:\n * 1. `Injector` should not depend on ivy logic.\n * 2. To maintain tree shake-ability we don't want to bring in unnecessary code.\n */\nlet _injectImplementation;\nfunction getInjectImplementation() {\n return _injectImplementation;\n}\n/**\n * Sets the current inject implementation.\n */\nfunction setInjectImplementation(impl) {\n const previous = _injectImplementation;\n _injectImplementation = impl;\n return previous;\n}\n/**\n * Injects `root` tokens in limp mode.\n *\n * If no injector exists, we can still inject tree-shakable providers which have `providedIn` set to\n * `\"root\"`. This is known as the limp mode injection. In such case the value is stored in the\n * injectable definition.\n */\nfunction injectRootLimpMode(token, notFoundValue, flags) {\n const injectableDef = getInjectableDef(token);\n if (injectableDef && injectableDef.providedIn == 'root') {\n return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() : injectableDef.value;\n }\n if (flags & InjectFlags.Optional) return null;\n if (notFoundValue !== undefined) return notFoundValue;\n throwProviderNotFoundError(token, 'Injector');\n}\n/**\n * Assert that `_injectImplementation` is not `fn`.\n *\n * This is useful, to prevent infinite recursion.\n *\n * @param fn Function which it should not equal to\n */\nfunction assertInjectImplementationNotEqual(fn) {\n ngDevMode && assertNotEqual(_injectImplementation, fn, 'Calling ɵɵinject would cause infinite recursion');\n}\nconst _THROW_IF_NOT_FOUND = {};\nconst THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;\n/*\n * Name of a property (that we patch onto DI decorator), which is used as an annotation of which\n * InjectFlag this decorator represents. This allows to avoid direct references to the DI decorators\n * in the code, thus making them tree-shakable.\n */\nconst DI_DECORATOR_FLAG = '__NG_DI_FLAG__';\nconst NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';\nconst NG_TOKEN_PATH = 'ngTokenPath';\nconst NEW_LINE = /\\n/gm;\nconst NO_NEW_LINE = 'ɵ';\nconst SOURCE = '__source';\n/**\n * Current injector value used by `inject`.\n * - `undefined`: it is an error to call `inject`\n * - `null`: `inject` can be called but there is no injector (limp-mode).\n * - Injector instance: Use the injector for resolution.\n */\nlet _currentInjector = undefined;\nfunction getCurrentInjector() {\n return _currentInjector;\n}\nfunction setCurrentInjector(injector) {\n const former = _currentInjector;\n _currentInjector = injector;\n return former;\n}\nfunction injectInjectorOnly(token, flags = InjectFlags.Default) {\n if (_currentInjector === undefined) {\n throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode && `inject() must be called from an injection context such as a constructor, a factory function, a field initializer, or a function used with \\`runInInjectionContext\\`.`);\n } else if (_currentInjector === null) {\n return injectRootLimpMode(token, undefined, flags);\n } else {\n const value = _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags);\n ngDevMode && emitInjectEvent(token, value, flags);\n return value;\n }\n}\nfunction ɵɵinject(token, flags = InjectFlags.Default) {\n return (getInjectImplementation() || injectInjectorOnly)(resolveForwardRef(token), flags);\n}\n/**\n * Throws an error indicating that a factory function could not be generated by the compiler for a\n * particular class.\n *\n * The name of the class is not mentioned here, but will be in the generated factory function name\n * and thus in the stack trace.\n *\n * @codeGenApi\n */\nfunction ɵɵinvalidFactoryDep(index) {\n throw new RuntimeError(202 /* RuntimeErrorCode.INVALID_FACTORY_DEPENDENCY */, ngDevMode && `This constructor is not compatible with Angular Dependency Injection because its dependency at index ${index} of the parameter list is invalid.\nThis can happen if the dependency type is a primitive like a string or if an ancestor of this class is missing an Angular decorator.\n\nPlease check that 1) the type for the parameter at index ${index} is correct and 2) the correct Angular decorators are defined for this class and its ancestors.`);\n}\n/**\n * Injects a token from the currently active injector.\n * `inject` is only supported in an [injection context](guide/di/dependency-injection-context). It\n * can be used during:\n * - Construction (via the `constructor`) of a class being instantiated by the DI system, such\n * as an `@Injectable` or `@Component`.\n * - In the initializer for fields of such classes.\n * - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.\n * - In the `factory` function specified for an `InjectionToken`.\n * - In a stackframe of a function call in a DI context\n *\n * @param token A token that represents a dependency that should be injected.\n * @param flags Optional flags that control how injection is executed.\n * The flags correspond to injection strategies that can be specified with\n * parameter decorators `@Host`, `@Self`, `@SkipSelf`, and `@Optional`.\n * @returns the injected value if operation is successful, `null` otherwise.\n * @throws if called outside of a supported context.\n *\n * @usageNotes\n * In practice the `inject()` calls are allowed in a constructor, a constructor parameter and a\n * field initializer:\n *\n * ```ts\n * @Injectable({providedIn: 'root'})\n * export class Car {\n * radio: Radio|undefined;\n * // OK: field initializer\n * spareTyre = inject(Tyre);\n *\n * constructor() {\n * // OK: constructor body\n * this.radio = inject(Radio);\n * }\n * }\n * ```\n *\n * It is also legal to call `inject` from a provider's factory:\n *\n * ```ts\n * providers: [\n * {provide: Car, useFactory: () => {\n * // OK: a class factory\n * const engine = inject(Engine);\n * return new Car(engine);\n * }}\n * ]\n * ```\n *\n * Calls to the `inject()` function outside of the class creation context will result in error. Most\n * notably, calls to `inject()` are disallowed after a class instance was created, in methods\n * (including lifecycle hooks):\n *\n * ```ts\n * @Component({ ... })\n * export class CarComponent {\n * ngOnInit() {\n * // ERROR: too late, the component instance was already created\n * const engine = inject(Engine);\n * engine.start();\n * }\n * }\n * ```\n *\n * @publicApi\n */\nfunction inject(token, flags = InjectFlags.Default) {\n // The `as any` here _shouldn't_ be necessary, but without it JSCompiler\n // throws a disambiguation error due to the multiple signatures.\n return ɵɵinject(token, convertToBitFlags(flags));\n}\n// Converts object-based DI flags (`InjectOptions`) to bit flags (`InjectFlags`).\nfunction convertToBitFlags(flags) {\n if (typeof flags === 'undefined' || typeof flags === 'number') {\n return flags;\n }\n // While TypeScript doesn't accept it without a cast, bitwise OR with false-y values in\n // JavaScript is a no-op. We can use that for a very codesize-efficient conversion from\n // `InjectOptions` to `InjectFlags`.\n return 0 /* InternalInjectFlags.Default */ | (\n // comment to force a line break in the formatter\n flags.optional && 8 /* InternalInjectFlags.Optional */) | (flags.host && 1 /* InternalInjectFlags.Host */) | (flags.self && 2 /* InternalInjectFlags.Self */) | (flags.skipSelf && 4 /* InternalInjectFlags.SkipSelf */);\n}\nfunction injectArgs(types) {\n const args = [];\n for (let i = 0; i < types.length; i++) {\n const arg = resolveForwardRef(types[i]);\n if (Array.isArray(arg)) {\n if (arg.length === 0) {\n throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');\n }\n let type = undefined;\n let flags = InjectFlags.Default;\n for (let j = 0; j < arg.length; j++) {\n const meta = arg[j];\n const flag = getInjectFlag(meta);\n if (typeof flag === 'number') {\n // Special case when we handle @Inject decorator.\n if (flag === -1 /* DecoratorFlags.Inject */) {\n type = meta.token;\n } else {\n flags |= flag;\n }\n } else {\n type = meta;\n }\n }\n args.push(ɵɵinject(type, flags));\n } else {\n args.push(ɵɵinject(arg));\n }\n }\n return args;\n}\n/**\n * Attaches a given InjectFlag to a given decorator using monkey-patching.\n * Since DI decorators can be used in providers `deps` array (when provider is configured using\n * `useFactory`) without initialization (e.g. `Host`) and as an instance (e.g. `new Host()`), we\n * attach the flag to make it available both as a static property and as a field on decorator\n * instance.\n *\n * @param decorator Provided DI decorator.\n * @param flag InjectFlag that should be applied.\n */\nfunction attachInjectFlag(decorator, flag) {\n decorator[DI_DECORATOR_FLAG] = flag;\n decorator.prototype[DI_DECORATOR_FLAG] = flag;\n return decorator;\n}\n/**\n * Reads monkey-patched property that contains InjectFlag attached to a decorator.\n *\n * @param token Token that may contain monkey-patched DI flags property.\n */\nfunction getInjectFlag(token) {\n return token[DI_DECORATOR_FLAG];\n}\nfunction catchInjectorError(e, token, injectorErrorName, source) {\n const tokenPath = e[NG_TEMP_TOKEN_PATH];\n if (token[SOURCE]) {\n tokenPath.unshift(token[SOURCE]);\n }\n e.message = formatError('\\n' + e.message, tokenPath, injectorErrorName, source);\n e[NG_TOKEN_PATH] = tokenPath;\n e[NG_TEMP_TOKEN_PATH] = null;\n throw e;\n}\nfunction formatError(text, obj, injectorErrorName, source = null) {\n text = text && text.charAt(0) === '\\n' && text.charAt(1) == NO_NEW_LINE ? text.slice(2) : text;\n let context = stringify(obj);\n if (Array.isArray(obj)) {\n context = obj.map(stringify).join(' -> ');\n } else if (typeof obj === 'object') {\n let parts = [];\n for (let key in obj) {\n if (obj.hasOwnProperty(key)) {\n let value = obj[key];\n parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));\n }\n }\n context = `{${parts.join(', ')}}`;\n }\n return `${injectorErrorName}${source ? '(' + source + ')' : ''}[${context}]: ${text.replace(NEW_LINE, '\\n ')}`;\n}\n\n/**\n * Inject decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Inject = /*#__PURE__*/attachInjectFlag(\n/*#__PURE__*/\n// Disable tslint because `DecoratorFlags` is a const enum which gets inlined.\nmakeParamDecorator('Inject', token => ({\n token\n})), -1 /* DecoratorFlags.Inject */);\n/**\n * Optional decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Optional =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag(/*#__PURE__*/makeParamDecorator('Optional'), 8 /* InternalInjectFlags.Optional */);\n/**\n * Self decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Self =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag(/*#__PURE__*/makeParamDecorator('Self'), 2 /* InternalInjectFlags.Self */);\n/**\n * `SkipSelf` decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst SkipSelf =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag(/*#__PURE__*/makeParamDecorator('SkipSelf'), 4 /* InternalInjectFlags.SkipSelf */);\n/**\n * Host decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Host =\n/*#__PURE__*/\n// Disable tslint because `InternalInjectFlags` is a const enum which gets inlined.\n// tslint:disable-next-line: no-toplevel-property-access\nattachInjectFlag(/*#__PURE__*/makeParamDecorator('Host'), 1 /* InternalInjectFlags.Host */);\nfunction getFactoryDef(type, throwNotFound) {\n const hasFactoryDef = type.hasOwnProperty(NG_FACTORY_DEF);\n if (!hasFactoryDef && throwNotFound === true && ngDevMode) {\n throw new Error(`Type ${stringify(type)} does not have 'ɵfac' property.`);\n }\n return hasFactoryDef ? type[NG_FACTORY_DEF] : null;\n}\n\n/**\n * Determines if the contents of two arrays is identical\n *\n * @param a first array\n * @param b second array\n * @param identityAccessor Optional function for extracting stable object identity from a value in\n * the array.\n */\nfunction arrayEquals(a, b, identityAccessor) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; i++) {\n let valueA = a[i];\n let valueB = b[i];\n if (identityAccessor) {\n valueA = identityAccessor(valueA);\n valueB = identityAccessor(valueB);\n }\n if (valueB !== valueA) {\n return false;\n }\n }\n return true;\n}\n/**\n * Flattens an array.\n */\nfunction flatten(list) {\n return list.flat(Number.POSITIVE_INFINITY);\n}\nfunction deepForEach(input, fn) {\n input.forEach(value => Array.isArray(value) ? deepForEach(value, fn) : fn(value));\n}\nfunction addToArray(arr, index, value) {\n // perf: array.push is faster than array.splice!\n if (index >= arr.length) {\n arr.push(value);\n } else {\n arr.splice(index, 0, value);\n }\n}\nfunction removeFromArray(arr, index) {\n // perf: array.pop is faster than array.splice!\n if (index >= arr.length - 1) {\n return arr.pop();\n } else {\n return arr.splice(index, 1)[0];\n }\n}\nfunction newArray(size, value) {\n const list = [];\n for (let i = 0; i < size; i++) {\n list.push(value);\n }\n return list;\n}\n/**\n * Remove item from array (Same as `Array.splice()` but faster.)\n *\n * `Array.splice()` is not as fast because it has to allocate an array for the elements which were\n * removed. This causes memory pressure and slows down code when most of the time we don't\n * care about the deleted items array.\n *\n * https://jsperf.com/fast-array-splice (About 20x faster)\n *\n * @param array Array to splice\n * @param index Index of element in array to remove.\n * @param count Number of items to remove.\n */\nfunction arraySplice(array, index, count) {\n const length = array.length - count;\n while (index < length) {\n array[index] = array[index + count];\n index++;\n }\n while (count--) {\n array.pop(); // shrink the array\n }\n}\n/**\n * Same as `Array.splice(index, 0, value)` but faster.\n *\n * `Array.splice()` is not fast because it has to allocate an array for the elements which were\n * removed. This causes memory pressure and slows down code when most of the time we don't\n * care about the deleted items array.\n *\n * @param array Array to splice.\n * @param index Index in array where the `value` should be added.\n * @param value Value to add to array.\n */\nfunction arrayInsert(array, index, value) {\n ngDevMode && assertLessThanOrEqual(index, array.length, \"Can't insert past array end.\");\n let end = array.length;\n while (end > index) {\n const previousEnd = end - 1;\n array[end] = array[previousEnd];\n end = previousEnd;\n }\n array[index] = value;\n}\n/**\n * Same as `Array.splice2(index, 0, value1, value2)` but faster.\n *\n * `Array.splice()` is not fast because it has to allocate an array for the elements which were\n * removed. This causes memory pressure and slows down code when most of the time we don't\n * care about the deleted items array.\n *\n * @param array Array to splice.\n * @param index Index in array where the `value` should be added.\n * @param value1 Value to add to array.\n * @param value2 Value to add to array.\n */\nfunction arrayInsert2(array, index, value1, value2) {\n ngDevMode && assertLessThanOrEqual(index, array.length, \"Can't insert past array end.\");\n let end = array.length;\n if (end == index) {\n // inserting at the end.\n array.push(value1, value2);\n } else if (end === 1) {\n // corner case when we have less items in array than we have items to insert.\n array.push(value2, array[0]);\n array[0] = value1;\n } else {\n end--;\n array.push(array[end - 1], array[end]);\n while (end > index) {\n const previousEnd = end - 2;\n array[end] = array[previousEnd];\n end--;\n }\n array[index] = value1;\n array[index + 1] = value2;\n }\n}\n/**\n * Get an index of an `value` in a sorted `array`.\n *\n * NOTE:\n * - This uses binary search algorithm for fast removals.\n *\n * @param array A sorted array to binary search.\n * @param value The value to look for.\n * @returns index of the value.\n * - positive index if value found.\n * - negative index if value not found. (`~index` to get the value where it should have been\n * located)\n */\nfunction arrayIndexOfSorted(array, value) {\n return _arrayIndexOfSorted(array, value, 0);\n}\n/**\n * Set a `value` for a `key`.\n *\n * @param keyValueArray to modify.\n * @param key The key to locate or create.\n * @param value The value to set for a `key`.\n * @returns index (always even) of where the value vas set.\n */\nfunction keyValueArraySet(keyValueArray, key, value) {\n let index = keyValueArrayIndexOf(keyValueArray, key);\n if (index >= 0) {\n // if we found it set it.\n keyValueArray[index | 1] = value;\n } else {\n index = ~index;\n arrayInsert2(keyValueArray, index, key, value);\n }\n return index;\n}\n/**\n * Retrieve a `value` for a `key` (on `undefined` if not found.)\n *\n * @param keyValueArray to search.\n * @param key The key to locate.\n * @return The `value` stored at the `key` location or `undefined if not found.\n */\nfunction keyValueArrayGet(keyValueArray, key) {\n const index = keyValueArrayIndexOf(keyValueArray, key);\n if (index >= 0) {\n // if we found it retrieve it.\n return keyValueArray[index | 1];\n }\n return undefined;\n}\n/**\n * Retrieve a `key` index value in the array or `-1` if not found.\n *\n * @param keyValueArray to search.\n * @param key The key to locate.\n * @returns index of where the key is (or should have been.)\n * - positive (even) index if key found.\n * - negative index if key not found. (`~index` (even) to get the index where it should have\n * been inserted.)\n */\nfunction keyValueArrayIndexOf(keyValueArray, key) {\n return _arrayIndexOfSorted(keyValueArray, key, 1);\n}\n/**\n * Delete a `key` (and `value`) from the `KeyValueArray`.\n *\n * @param keyValueArray to modify.\n * @param key The key to locate or delete (if exist).\n * @returns index of where the key was (or should have been.)\n * - positive (even) index if key found and deleted.\n * - negative index if key not found. (`~index` (even) to get the index where it should have\n * been.)\n */\nfunction keyValueArrayDelete(keyValueArray, key) {\n const index = keyValueArrayIndexOf(keyValueArray, key);\n if (index >= 0) {\n // if we found it remove it.\n arraySplice(keyValueArray, index, 2);\n }\n return index;\n}\n/**\n * INTERNAL: Get an index of an `value` in a sorted `array` by grouping search by `shift`.\n *\n * NOTE:\n * - This uses binary search algorithm for fast removals.\n *\n * @param array A sorted array to binary search.\n * @param value The value to look for.\n * @param shift grouping shift.\n * - `0` means look at every location\n * - `1` means only look at every other (even) location (the odd locations are to be ignored as\n * they are values.)\n * @returns index of the value.\n * - positive index if value found.\n * - negative index if value not found. (`~index` to get the value where it should have been\n * inserted)\n */\nfunction _arrayIndexOfSorted(array, value, shift) {\n ngDevMode && assertEqual(Array.isArray(array), true, 'Expecting an array');\n let start = 0;\n let end = array.length >> shift;\n while (end !== start) {\n const middle = start + (end - start >> 1); // find the middle.\n const current = array[middle << shift];\n if (value === current) {\n return middle << shift;\n } else if (current > value) {\n end = middle;\n } else {\n start = middle + 1; // We already searched middle so make it non-inclusive by adding 1\n }\n }\n return ~(end << shift);\n}\n\n/**\n * This file contains reuseable \"empty\" symbols that can be used as default return values\n * in different parts of the rendering code. Because the same symbols are returned, this\n * allows for identity checks against these values to be consistently used by the framework\n * code.\n */\nconst EMPTY_OBJ = {};\nconst EMPTY_ARRAY = [];\n// freezing the values prevents any code from accidentally inserting new values in\nif ((typeof ngDevMode === 'undefined' || ngDevMode) && /*#__PURE__*/initNgDevMode()) {\n // These property accesses can be ignored because ngDevMode will be set to false\n // when optimizing code and the whole if statement will be dropped.\n // tslint:disable-next-line:no-toplevel-property-access\n /*#__PURE__*/Object.freeze(EMPTY_OBJ);\n // tslint:disable-next-line:no-toplevel-property-access\n /*#__PURE__*/Object.freeze(EMPTY_ARRAY);\n}\n\n/**\n * A multi-provider token for initialization functions that will run upon construction of an\n * environment injector.\n *\n * @deprecated from v19.0.0, use provideEnvironmentInitializer instead\n *\n * @see {@link provideEnvironmentInitializer}\n *\n * Note: As opposed to the `APP_INITIALIZER` token, the `ENVIRONMENT_INITIALIZER` functions are not awaited,\n * hence they should not be `async`.\n *\n * @publicApi\n */\nconst ENVIRONMENT_INITIALIZER = /*#__PURE__*/new InjectionToken(ngDevMode ? 'ENVIRONMENT_INITIALIZER' : '');\n\n/**\n * An InjectionToken that gets the current `Injector` for `createInjector()`-style injectors.\n *\n * Requesting this token instead of `Injector` allows `StaticInjector` to be tree-shaken from a\n * project.\n *\n * @publicApi\n */\nconst INJECTOR$1 = /*#__PURE__*/new InjectionToken(ngDevMode ? 'INJECTOR' : '',\n// Disable tslint because this is const enum which gets inlined not top level prop access.\n// tslint:disable-next-line: no-toplevel-property-access\n-1 /* InjectorMarkers.Injector */);\nconst INJECTOR_DEF_TYPES = /*#__PURE__*/new InjectionToken(ngDevMode ? 'INJECTOR_DEF_TYPES' : '');\nclass NullInjector {\n get(token, notFoundValue = THROW_IF_NOT_FOUND) {\n if (notFoundValue === THROW_IF_NOT_FOUND) {\n const error = new Error(`NullInjectorError: No provider for ${stringify(token)}!`);\n error.name = 'NullInjectorError';\n throw error;\n }\n return notFoundValue;\n }\n}\nfunction getNgModuleDef(type, throwNotFound) {\n const ngModuleDef = type[NG_MOD_DEF] || null;\n if (!ngModuleDef && throwNotFound === true) {\n throw new Error(`Type ${stringify(type)} does not have 'ɵmod' property.`);\n }\n return ngModuleDef;\n}\n/**\n * The following getter methods retrieve the definition from the type. Currently the retrieval\n * honors inheritance, but in the future we may change the rule to require that definitions are\n * explicit. This would require some sort of migration strategy.\n */\nfunction getComponentDef(type) {\n return type[NG_COMP_DEF] || null;\n}\nfunction getDirectiveDef(type) {\n return type[NG_DIR_DEF] || null;\n}\nfunction getPipeDef$1(type) {\n return type[NG_PIPE_DEF] || null;\n}\n/**\n * Checks whether a given Component, Directive or Pipe is marked as standalone.\n * This will return false if passed anything other than a Component, Directive, or Pipe class\n * See [this guide](guide/components/importing) for additional information:\n *\n * @param type A reference to a Component, Directive or Pipe.\n * @publicApi\n */\nfunction isStandalone(type) {\n const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);\n // TODO: standalone as default value (invert the condition)\n return def !== null ? def.standalone : false;\n}\n\n/**\n * Wrap an array of `Provider`s into `EnvironmentProviders`, preventing them from being accidentally\n * referenced in `@Component` in a component injector.\n */\nfunction makeEnvironmentProviders(providers) {\n return {\n ɵproviders: providers\n };\n}\n/**\n * @description\n * This function is used to provide initialization functions that will be executed upon construction\n * of an environment injector.\n *\n * Note that the provided initializer is run in the injection context.\n *\n * Previously, this was achieved using the `ENVIRONMENT_INITIALIZER` token which is now deprecated.\n *\n * @see {@link ENVIRONMENT_INITIALIZER}\n *\n * @usageNotes\n * The following example illustrates how to configure an initialization function using\n * `provideEnvironmentInitializer()`\n * ```ts\n * createEnvironmentInjector(\n * [\n * provideEnvironmentInitializer(() => {\n * console.log('environment initialized');\n * }),\n * ],\n * parentInjector\n * );\n * ```\n *\n * @publicApi\n */\nfunction provideEnvironmentInitializer(initializerFn) {\n return makeEnvironmentProviders([{\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useValue: initializerFn\n }]);\n}\n/**\n * Collects providers from all NgModules and standalone components, including transitively imported\n * ones.\n *\n * Providers extracted via `importProvidersFrom` are only usable in an application injector or\n * another environment injector (such as a route injector). They should not be used in component\n * providers.\n *\n * More information about standalone components can be found in [this\n * guide](guide/components/importing).\n *\n * @usageNotes\n * The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:\n *\n * ```ts\n * await bootstrapApplication(RootComponent, {\n * providers: [\n * importProvidersFrom(NgModuleOne, NgModuleTwo)\n * ]\n * });\n * ```\n *\n * You can also use the `importProvidersFrom` results in the `providers` field of a route, when a\n * standalone component is used:\n *\n * ```ts\n * export const ROUTES: Route[] = [\n * {\n * path: 'foo',\n * providers: [\n * importProvidersFrom(NgModuleOne, NgModuleTwo)\n * ],\n * component: YourStandaloneComponent\n * }\n * ];\n * ```\n *\n * @returns Collected providers from the specified list of types.\n * @publicApi\n */\nfunction importProvidersFrom(...sources) {\n return {\n ɵproviders: internalImportProvidersFrom(true, sources),\n ɵfromNgModule: true\n };\n}\nfunction internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {\n const providersOut = [];\n const dedup = new Set(); // already seen types\n let injectorTypesWithProviders;\n const collectProviders = provider => {\n providersOut.push(provider);\n };\n deepForEach(sources, source => {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && checkForStandaloneCmp) {\n const cmpDef = getComponentDef(source);\n if (cmpDef?.standalone) {\n throw new RuntimeError(800 /* RuntimeErrorCode.IMPORT_PROVIDERS_FROM_STANDALONE */, `Importing providers supports NgModule or ModuleWithProviders but got a standalone component \"${stringifyForError(source)}\"`);\n }\n }\n // Narrow `source` to access the internal type analogue for `ModuleWithProviders`.\n const internalSource = source;\n if (walkProviderTree(internalSource, collectProviders, [], dedup)) {\n injectorTypesWithProviders ||= [];\n injectorTypesWithProviders.push(internalSource);\n }\n });\n // Collect all providers from `ModuleWithProviders` types.\n if (injectorTypesWithProviders !== undefined) {\n processInjectorTypesWithProviders(injectorTypesWithProviders, collectProviders);\n }\n return providersOut;\n}\n/**\n * Collects all providers from the list of `ModuleWithProviders` and appends them to the provided\n * array.\n */\nfunction processInjectorTypesWithProviders(typesWithProviders, visitor) {\n for (let i = 0; i < typesWithProviders.length; i++) {\n const {\n ngModule,\n providers\n } = typesWithProviders[i];\n deepForEachProvider(providers, provider => {\n ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule);\n visitor(provider, ngModule);\n });\n }\n}\n/**\n * The logic visits an `InjectorType`, an `InjectorTypeWithProviders`, or a standalone\n * `ComponentType`, and all of its transitive providers and collects providers.\n *\n * If an `InjectorTypeWithProviders` that declares providers besides the type is specified,\n * the function will return \"true\" to indicate that the providers of the type definition need\n * to be processed. This allows us to process providers of injector types after all imports of\n * an injector definition are processed. (following View Engine semantics: see FW-1349)\n */\nfunction walkProviderTree(container, visitor, parents, dedup) {\n container = resolveForwardRef(container);\n if (!container) return false;\n // The actual type which had the definition. Usually `container`, but may be an unwrapped type\n // from `InjectorTypeWithProviders`.\n let defType = null;\n let injDef = getInjectorDef(container);\n const cmpDef = !injDef && getComponentDef(container);\n if (!injDef && !cmpDef) {\n // `container` is not an injector type or a component type. It might be:\n // * An `InjectorTypeWithProviders` that wraps an injector type.\n // * A standalone directive or pipe that got pulled in from a standalone component's\n // dependencies.\n // Try to unwrap it as an `InjectorTypeWithProviders` first.\n const ngModule = container.ngModule;\n injDef = getInjectorDef(ngModule);\n if (injDef) {\n defType = ngModule;\n } else {\n // Not a component or injector type, so ignore it.\n return false;\n }\n } else if (cmpDef && !cmpDef.standalone) {\n return false;\n } else {\n defType = container;\n }\n // Check for circular dependencies.\n if (ngDevMode && parents.indexOf(defType) !== -1) {\n const defName = stringify(defType);\n const path = parents.map(stringify);\n throwCyclicDependencyError(defName, path);\n }\n // Check for multiple imports of the same module\n const isDuplicate = dedup.has(defType);\n if (cmpDef) {\n if (isDuplicate) {\n // This component definition has already been processed.\n return false;\n }\n dedup.add(defType);\n if (cmpDef.dependencies) {\n const deps = typeof cmpDef.dependencies === 'function' ? cmpDef.dependencies() : cmpDef.dependencies;\n for (const dep of deps) {\n walkProviderTree(dep, visitor, parents, dedup);\n }\n }\n } else if (injDef) {\n // First, include providers from any imports.\n if (injDef.imports != null && !isDuplicate) {\n // Before processing defType's imports, add it to the set of parents. This way, if it ends\n // up deeply importing itself, this can be detected.\n ngDevMode && parents.push(defType);\n // Add it to the set of dedups. This way we can detect multiple imports of the same module\n dedup.add(defType);\n let importTypesWithProviders;\n try {\n deepForEach(injDef.imports, imported => {\n if (walkProviderTree(imported, visitor, parents, dedup)) {\n importTypesWithProviders ||= [];\n // If the processed import is an injector type with providers, we store it in the\n // list of import types with providers, so that we can process those afterwards.\n importTypesWithProviders.push(imported);\n }\n });\n } finally {\n // Remove it from the parents set when finished.\n ngDevMode && parents.pop();\n }\n // Imports which are declared with providers (TypeWithProviders) need to be processed\n // after all imported modules are processed. This is similar to how View Engine\n // processes/merges module imports in the metadata resolver. See: FW-1349.\n if (importTypesWithProviders !== undefined) {\n processInjectorTypesWithProviders(importTypesWithProviders, visitor);\n }\n }\n if (!isDuplicate) {\n // Track the InjectorType and add a provider for it.\n // It's important that this is done after the def's imports.\n const factory = getFactoryDef(defType) || (() => new defType());\n // Append extra providers to make more info available for consumers (to retrieve an injector\n // type), as well as internally (to calculate an injection scope correctly and eagerly\n // instantiate a `defType` when an injector is created).\n // Provider to create `defType` using its factory.\n visitor({\n provide: defType,\n useFactory: factory,\n deps: EMPTY_ARRAY\n }, defType);\n // Make this `defType` available to an internal logic that calculates injector scope.\n visitor({\n provide: INJECTOR_DEF_TYPES,\n useValue: defType,\n multi: true\n }, defType);\n // Provider to eagerly instantiate `defType` via `INJECTOR_INITIALIZER`.\n visitor({\n provide: ENVIRONMENT_INITIALIZER,\n useValue: () => ɵɵinject(defType),\n multi: true\n }, defType);\n }\n // Next, include providers listed on the definition itself.\n const defProviders = injDef.providers;\n if (defProviders != null && !isDuplicate) {\n const injectorType = container;\n deepForEachProvider(defProviders, provider => {\n ngDevMode && validateProvider(provider, defProviders, injectorType);\n visitor(provider, injectorType);\n });\n }\n } else {\n // Should not happen, but just in case.\n return false;\n }\n return defType !== container && container.providers !== undefined;\n}\nfunction validateProvider(provider, providers, containerType) {\n if (isTypeProvider(provider) || isValueProvider(provider) || isFactoryProvider(provider) || isExistingProvider(provider)) {\n return;\n }\n // Here we expect the provider to be a `useClass` provider (by elimination).\n const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));\n if (!classRef) {\n throwInvalidProviderError(containerType, providers, provider);\n }\n}\nfunction deepForEachProvider(providers, fn) {\n for (let provider of providers) {\n if (isEnvironmentProviders(provider)) {\n provider = provider.ɵproviders;\n }\n if (Array.isArray(provider)) {\n deepForEachProvider(provider, fn);\n } else {\n fn(provider);\n }\n }\n}\nconst USE_VALUE$1 = /*#__PURE__*/getClosureSafeProperty({\n provide: String,\n useValue: getClosureSafeProperty\n});\nfunction isValueProvider(value) {\n return value !== null && typeof value == 'object' && USE_VALUE$1 in value;\n}\nfunction isExistingProvider(value) {\n return !!(value && value.useExisting);\n}\nfunction isFactoryProvider(value) {\n return !!(value && value.useFactory);\n}\nfunction isTypeProvider(value) {\n return typeof value === 'function';\n}\nfunction isClassProvider(value) {\n return !!value.useClass;\n}\n\n/**\n * An internal token whose presence in an injector indicates that the injector should treat itself\n * as a root scoped injector when processing requests for unknown tokens which may indicate\n * they are provided in the root scope.\n */\nconst INJECTOR_SCOPE = /*#__PURE__*/new InjectionToken(ngDevMode ? 'Set Injector scope.' : '');\n\n/**\n * Marker which indicates that a value has not yet been created from the factory function.\n */\nconst NOT_YET = {};\n/**\n * Marker which indicates that the factory function for a token is in the process of being called.\n *\n * If the injector is asked to inject a token with its value set to CIRCULAR, that indicates\n * injection of a dependency has recursively attempted to inject the original token, and there is\n * a circular dependency among the providers.\n */\nconst CIRCULAR = {};\n/**\n * A lazily initialized NullInjector.\n */\nlet NULL_INJECTOR = undefined;\nfunction getNullInjector() {\n if (NULL_INJECTOR === undefined) {\n NULL_INJECTOR = new NullInjector();\n }\n return NULL_INJECTOR;\n}\n/**\n * An `Injector` that's part of the environment injector hierarchy, which exists outside of the\n * component tree.\n */\nclass EnvironmentInjector {}\nclass R3Injector extends EnvironmentInjector {\n parent;\n source;\n scopes;\n /**\n * Map of tokens to records which contain the instances of those tokens.\n * - `null` value implies that we don't have the record. Used by tree-shakable injectors\n * to prevent further searches.\n */\n records = /*#__PURE__*/new Map();\n /**\n * Set of values instantiated by this injector which contain `ngOnDestroy` lifecycle hooks.\n */\n _ngOnDestroyHooks = /*#__PURE__*/new Set();\n _onDestroyHooks = [];\n /**\n * Flag indicating that this injector was previously destroyed.\n */\n get destroyed() {\n return this._destroyed;\n }\n _destroyed = false;\n injectorDefTypes;\n constructor(providers, parent, source, scopes) {\n super();\n this.parent = parent;\n this.source = source;\n this.scopes = scopes;\n // Start off by creating Records for every provider.\n forEachSingleProvider(providers, provider => this.processProvider(provider));\n // Make sure the INJECTOR token provides this injector.\n this.records.set(INJECTOR$1, makeRecord(undefined, this));\n // And `EnvironmentInjector` if the current injector is supposed to be env-scoped.\n if (scopes.has('environment')) {\n this.records.set(EnvironmentInjector, makeRecord(undefined, this));\n }\n // Detect whether this injector has the APP_ROOT_SCOPE token and thus should provide\n // any injectable scoped to APP_ROOT_SCOPE.\n const record = this.records.get(INJECTOR_SCOPE);\n if (record != null && typeof record.value === 'string') {\n this.scopes.add(record.value);\n }\n this.injectorDefTypes = new Set(this.get(INJECTOR_DEF_TYPES, EMPTY_ARRAY, InjectFlags.Self));\n }\n /**\n * Destroy the injector and release references to every instance or provider associated with it.\n *\n * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a\n * hook was found.\n */\n destroy() {\n assertNotDestroyed(this);\n // Set destroyed = true first, in case lifecycle hooks re-enter destroy().\n this._destroyed = true;\n const prevConsumer = setActiveConsumer$1(null);\n try {\n // Call all the lifecycle hooks.\n for (const service of this._ngOnDestroyHooks) {\n service.ngOnDestroy();\n }\n const onDestroyHooks = this._onDestroyHooks;\n // Reset the _onDestroyHooks array before iterating over it to prevent hooks that unregister\n // themselves from mutating the array during iteration.\n this._onDestroyHooks = [];\n for (const hook of onDestroyHooks) {\n hook();\n }\n } finally {\n // Release all references.\n this.records.clear();\n this._ngOnDestroyHooks.clear();\n this.injectorDefTypes.clear();\n setActiveConsumer$1(prevConsumer);\n }\n }\n onDestroy(callback) {\n assertNotDestroyed(this);\n this._onDestroyHooks.push(callback);\n return () => this.removeOnDestroy(callback);\n }\n runInContext(fn) {\n assertNotDestroyed(this);\n const previousInjector = setCurrentInjector(this);\n const previousInjectImplementation = setInjectImplementation(undefined);\n let prevInjectContext;\n if (ngDevMode) {\n prevInjectContext = setInjectorProfilerContext({\n injector: this,\n token: null\n });\n }\n try {\n return fn();\n } finally {\n setCurrentInjector(previousInjector);\n setInjectImplementation(previousInjectImplementation);\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n }\n }\n get(token, notFoundValue = THROW_IF_NOT_FOUND, flags = InjectFlags.Default) {\n assertNotDestroyed(this);\n if (token.hasOwnProperty(NG_ENV_ID)) {\n return token[NG_ENV_ID](this);\n }\n flags = convertToBitFlags(flags);\n // Set the injection context.\n let prevInjectContext;\n if (ngDevMode) {\n prevInjectContext = setInjectorProfilerContext({\n injector: this,\n token: token\n });\n }\n const previousInjector = setCurrentInjector(this);\n const previousInjectImplementation = setInjectImplementation(undefined);\n try {\n // Check for the SkipSelf flag.\n if (!(flags & InjectFlags.SkipSelf)) {\n // SkipSelf isn't set, check if the record belongs to this injector.\n let record = this.records.get(token);\n if (record === undefined) {\n // No record, but maybe the token is scoped to this injector. Look for an injectable\n // def with a scope matching this injector.\n const def = couldBeInjectableType(token) && getInjectableDef(token);\n if (def && this.injectableDefInScope(def)) {\n // Found an injectable def and it's scoped to this injector. Pretend as if it was here\n // all along.\n if (ngDevMode) {\n runInInjectorProfilerContext(this, token, () => {\n emitProviderConfiguredEvent(token);\n });\n }\n record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET);\n } else {\n record = null;\n }\n this.records.set(token, record);\n }\n // If a record was found, get the instance for it and return it.\n if (record != null /* NOT null || undefined */) {\n return this.hydrate(token, record);\n }\n }\n // Select the next injector based on the Self flag - if self is set, the next injector is\n // the NullInjector, otherwise it's the parent.\n const nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector();\n // Set the notFoundValue based on the Optional flag - if optional is set and notFoundValue\n // is undefined, the value is null, otherwise it's the notFoundValue.\n notFoundValue = flags & InjectFlags.Optional && notFoundValue === THROW_IF_NOT_FOUND ? null : notFoundValue;\n return nextInjector.get(token, notFoundValue);\n } catch (e) {\n if (e.name === 'NullInjectorError') {\n const path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];\n path.unshift(stringify(token));\n if (previousInjector) {\n // We still have a parent injector, keep throwing\n throw e;\n } else {\n // Format & throw the final error message when we don't have any previous injector\n return catchInjectorError(e, token, 'R3InjectorError', this.source);\n }\n } else {\n throw e;\n }\n } finally {\n // Lastly, restore the previous injection context.\n setInjectImplementation(previousInjectImplementation);\n setCurrentInjector(previousInjector);\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n }\n }\n /** @internal */\n resolveInjectorInitializers() {\n const prevConsumer = setActiveConsumer$1(null);\n const previousInjector = setCurrentInjector(this);\n const previousInjectImplementation = setInjectImplementation(undefined);\n let prevInjectContext;\n if (ngDevMode) {\n prevInjectContext = setInjectorProfilerContext({\n injector: this,\n token: null\n });\n }\n try {\n const initializers = this.get(ENVIRONMENT_INITIALIZER, EMPTY_ARRAY, InjectFlags.Self);\n if (ngDevMode && !Array.isArray(initializers)) {\n throw new RuntimeError(-209 /* RuntimeErrorCode.INVALID_MULTI_PROVIDER */, 'Unexpected type of the `ENVIRONMENT_INITIALIZER` token value ' + `(expected an array, but got ${typeof initializers}). ` + 'Please check that the `ENVIRONMENT_INITIALIZER` token is configured as a ' + '`multi: true` provider.');\n }\n for (const initializer of initializers) {\n initializer();\n }\n } finally {\n setCurrentInjector(previousInjector);\n setInjectImplementation(previousInjectImplementation);\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n setActiveConsumer$1(prevConsumer);\n }\n }\n toString() {\n const tokens = [];\n const records = this.records;\n for (const token of records.keys()) {\n tokens.push(stringify(token));\n }\n return `R3Injector[${tokens.join(', ')}]`;\n }\n /**\n * Process a `SingleProvider` and add it.\n */\n processProvider(provider) {\n // Determine the token from the provider. Either it's its own token, or has a {provide: ...}\n // property.\n provider = resolveForwardRef(provider);\n let token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide);\n // Construct a `Record` for the provider.\n const record = providerToRecord(provider);\n if (ngDevMode) {\n runInInjectorProfilerContext(this, token, () => {\n // Emit InjectorProfilerEventType.Create if provider is a value provider because\n // these are the only providers that do not go through the value hydration logic\n // where this event would normally be emitted from.\n if (isValueProvider(provider)) {\n emitInstanceCreatedByInjectorEvent(provider.useValue);\n }\n emitProviderConfiguredEvent(provider);\n });\n }\n if (!isTypeProvider(provider) && provider.multi === true) {\n // If the provider indicates that it's a multi-provider, process it specially.\n // First check whether it's been defined already.\n let multiRecord = this.records.get(token);\n if (multiRecord) {\n // It has. Throw a nice error if\n if (ngDevMode && multiRecord.multi === undefined) {\n throwMixedMultiProviderError();\n }\n } else {\n multiRecord = makeRecord(undefined, NOT_YET, true);\n multiRecord.factory = () => injectArgs(multiRecord.multi);\n this.records.set(token, multiRecord);\n }\n token = provider;\n multiRecord.multi.push(provider);\n } else {\n if (ngDevMode) {\n const existing = this.records.get(token);\n if (existing && existing.multi !== undefined) {\n throwMixedMultiProviderError();\n }\n }\n }\n this.records.set(token, record);\n }\n hydrate(token, record) {\n const prevConsumer = setActiveConsumer$1(null);\n try {\n if (ngDevMode && record.value === CIRCULAR) {\n throwCyclicDependencyError(stringify(token));\n } else if (record.value === NOT_YET) {\n record.value = CIRCULAR;\n if (ngDevMode) {\n runInInjectorProfilerContext(this, token, () => {\n record.value = record.factory();\n emitInstanceCreatedByInjectorEvent(record.value);\n });\n } else {\n record.value = record.factory();\n }\n }\n if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) {\n this._ngOnDestroyHooks.add(record.value);\n }\n return record.value;\n } finally {\n setActiveConsumer$1(prevConsumer);\n }\n }\n injectableDefInScope(def) {\n if (!def.providedIn) {\n return false;\n }\n const providedIn = resolveForwardRef(def.providedIn);\n if (typeof providedIn === 'string') {\n return providedIn === 'any' || this.scopes.has(providedIn);\n } else {\n return this.injectorDefTypes.has(providedIn);\n }\n }\n removeOnDestroy(callback) {\n const destroyCBIdx = this._onDestroyHooks.indexOf(callback);\n if (destroyCBIdx !== -1) {\n this._onDestroyHooks.splice(destroyCBIdx, 1);\n }\n }\n}\nfunction injectableDefOrInjectorDefFactory(token) {\n // Most tokens will have an injectable def directly on them, which specifies a factory directly.\n const injectableDef = getInjectableDef(token);\n const factory = injectableDef !== null ? injectableDef.factory : getFactoryDef(token);\n if (factory !== null) {\n return factory;\n }\n // InjectionTokens should have an injectable def (ɵprov) and thus should be handled above.\n // If it's missing that, it's an error.\n if (token instanceof InjectionToken) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Token ${stringify(token)} is missing a ɵprov definition.`);\n }\n // Undecorated types can sometimes be created if they have no constructor arguments.\n if (token instanceof Function) {\n return getUndecoratedInjectableFactory(token);\n }\n // There was no way to resolve a factory for this token.\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && 'unreachable');\n}\nfunction getUndecoratedInjectableFactory(token) {\n // If the token has parameters then it has dependencies that we cannot resolve implicitly.\n const paramLength = token.length;\n if (paramLength > 0) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Can't resolve all parameters for ${stringify(token)}: (${newArray(paramLength, '?').join(', ')}).`);\n }\n // The constructor function appears to have no parameters.\n // This might be because it inherits from a super-class. In which case, use an injectable\n // def from an ancestor if there is one.\n // Otherwise this really is a simple class with no dependencies, so return a factory that\n // just instantiates the zero-arg constructor.\n const inheritedInjectableDef = getInheritedInjectableDef(token);\n if (inheritedInjectableDef !== null) {\n return () => inheritedInjectableDef.factory(token);\n } else {\n return () => new token();\n }\n}\nfunction providerToRecord(provider) {\n if (isValueProvider(provider)) {\n return makeRecord(undefined, provider.useValue);\n } else {\n const factory = providerToFactory(provider);\n return makeRecord(factory, NOT_YET);\n }\n}\n/**\n * Converts a `SingleProvider` into a factory function.\n *\n * @param provider provider to convert to factory\n */\nfunction providerToFactory(provider, ngModuleType, providers) {\n let factory = undefined;\n if (ngDevMode && isEnvironmentProviders(provider)) {\n throwInvalidProviderError(undefined, providers, provider);\n }\n if (isTypeProvider(provider)) {\n const unwrappedProvider = resolveForwardRef(provider);\n return getFactoryDef(unwrappedProvider) || injectableDefOrInjectorDefFactory(unwrappedProvider);\n } else {\n if (isValueProvider(provider)) {\n factory = () => resolveForwardRef(provider.useValue);\n } else if (isFactoryProvider(provider)) {\n factory = () => provider.useFactory(...injectArgs(provider.deps || []));\n } else if (isExistingProvider(provider)) {\n factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));\n } else {\n const classRef = resolveForwardRef(provider && (provider.useClass || provider.provide));\n if (ngDevMode && !classRef) {\n throwInvalidProviderError(ngModuleType, providers, provider);\n }\n if (hasDeps(provider)) {\n factory = () => new classRef(...injectArgs(provider.deps));\n } else {\n return getFactoryDef(classRef) || injectableDefOrInjectorDefFactory(classRef);\n }\n }\n }\n return factory;\n}\nfunction assertNotDestroyed(injector) {\n if (injector.destroyed) {\n throw new RuntimeError(205 /* RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED */, ngDevMode && 'Injector has already been destroyed.');\n }\n}\nfunction makeRecord(factory, value, multi = false) {\n return {\n factory: factory,\n value: value,\n multi: multi ? [] : undefined\n };\n}\nfunction hasDeps(value) {\n return !!value.deps;\n}\nfunction hasOnDestroy(value) {\n return value !== null && typeof value === 'object' && typeof value.ngOnDestroy === 'function';\n}\nfunction couldBeInjectableType(value) {\n return typeof value === 'function' || typeof value === 'object' && value instanceof InjectionToken;\n}\nfunction forEachSingleProvider(providers, fn) {\n for (const provider of providers) {\n if (Array.isArray(provider)) {\n forEachSingleProvider(provider, fn);\n } else if (provider && isEnvironmentProviders(provider)) {\n forEachSingleProvider(provider.ɵproviders, fn);\n } else {\n fn(provider);\n }\n }\n}\n\n/**\n * Runs the given function in the [context](guide/di/dependency-injection-context) of the given\n * `Injector`.\n *\n * Within the function's stack frame, [`inject`](api/core/inject) can be used to inject dependencies\n * from the given `Injector`. Note that `inject` is only usable synchronously, and cannot be used in\n * any asynchronous callbacks or after any `await` points.\n *\n * @param injector the injector which will satisfy calls to [`inject`](api/core/inject) while `fn`\n * is executing\n * @param fn the closure to be run in the context of `injector`\n * @returns the return value of the function, if any\n * @publicApi\n */\nfunction runInInjectionContext(injector, fn) {\n if (injector instanceof R3Injector) {\n assertNotDestroyed(injector);\n }\n let prevInjectorProfilerContext;\n if (ngDevMode) {\n prevInjectorProfilerContext = setInjectorProfilerContext({\n injector,\n token: null\n });\n }\n const prevInjector = setCurrentInjector(injector);\n const previousInjectImplementation = setInjectImplementation(undefined);\n try {\n return fn();\n } finally {\n setCurrentInjector(prevInjector);\n ngDevMode && setInjectorProfilerContext(prevInjectorProfilerContext);\n setInjectImplementation(previousInjectImplementation);\n }\n}\n/**\n * Whether the current stack frame is inside an injection context.\n */\nfunction isInInjectionContext() {\n return getInjectImplementation() !== undefined || getCurrentInjector() != null;\n}\n/**\n * Asserts that the current stack frame is within an [injection\n * context](guide/di/dependency-injection-context) and has access to `inject`.\n *\n * @param debugFn a reference to the function making the assertion (used for the error message).\n *\n * @publicApi\n */\nfunction assertInInjectionContext(debugFn) {\n // Taking a `Function` instead of a string name here prevents the unminified name of the function\n // from being retained in the bundle regardless of minification.\n if (!isInInjectionContext()) {\n throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode && debugFn.name + '() can only be used within an injection context such as a constructor, a factory function, a field initializer, or a function used with `runInInjectionContext`');\n }\n}\nvar FactoryTarget = /*#__PURE__*/function (FactoryTarget) {\n FactoryTarget[FactoryTarget[\"Directive\"] = 0] = \"Directive\";\n FactoryTarget[FactoryTarget[\"Component\"] = 1] = \"Component\";\n FactoryTarget[FactoryTarget[\"Injectable\"] = 2] = \"Injectable\";\n FactoryTarget[FactoryTarget[\"Pipe\"] = 3] = \"Pipe\";\n FactoryTarget[FactoryTarget[\"NgModule\"] = 4] = \"NgModule\";\n return FactoryTarget;\n}(FactoryTarget || {});\nvar R3TemplateDependencyKind = /*#__PURE__*/function (R3TemplateDependencyKind) {\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"Directive\"] = 0] = \"Directive\";\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"Pipe\"] = 1] = \"Pipe\";\n R3TemplateDependencyKind[R3TemplateDependencyKind[\"NgModule\"] = 2] = \"NgModule\";\n return R3TemplateDependencyKind;\n}(R3TemplateDependencyKind || {});\nvar ViewEncapsulation$1 = /*#__PURE__*/function (ViewEncapsulation) {\n ViewEncapsulation[ViewEncapsulation[\"Emulated\"] = 0] = \"Emulated\";\n // Historically the 1 value was for `Native` encapsulation which has been removed as of v11.\n ViewEncapsulation[ViewEncapsulation[\"None\"] = 2] = \"None\";\n ViewEncapsulation[ViewEncapsulation[\"ShadowDom\"] = 3] = \"ShadowDom\";\n return ViewEncapsulation;\n}(ViewEncapsulation$1 || {});\nfunction getCompilerFacade(request) {\n const globalNg = _global['ng'];\n if (globalNg && globalNg.ɵcompilerFacade) {\n return globalNg.ɵcompilerFacade;\n }\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // Log the type as an error so that a developer can easily navigate to the type from the\n // console.\n console.error(`JIT compilation failed for ${request.kind}`, request.type);\n let message = `The ${request.kind} '${request.type.name}' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.\\n\\n`;\n if (request.usage === 1 /* JitCompilerUsage.PartialDeclaration */) {\n message += `The ${request.kind} is part of a library that has been partially compiled.\\n`;\n message += `However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.\\n`;\n message += '\\n';\n message += `Ideally, the library is processed using the Angular Linker to become fully AOT compiled.\\n`;\n } else {\n message += `JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.\\n`;\n }\n message += `Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',\\n`;\n message += `or manually provide the compiler with 'import \"@angular/compiler\";' before bootstrapping.`;\n throw new Error(message);\n } else {\n throw new Error('JIT compiler unavailable');\n }\n}\n\n/**\n * A mapping of the @angular/core API surface used in generated expressions to the actual symbols.\n *\n * This should be kept up to date with the public exports of @angular/core.\n */\nconst angularCoreDiEnv = {\n 'ɵɵdefineInjectable': ɵɵdefineInjectable,\n 'ɵɵdefineInjector': ɵɵdefineInjector,\n 'ɵɵinject': ɵɵinject,\n 'ɵɵinvalidFactoryDep': ɵɵinvalidFactoryDep,\n 'resolveForwardRef': resolveForwardRef\n};\n\n/**\n * @description\n *\n * Represents a type that a Component or other object is instances of.\n *\n * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is represented by\n * the `MyCustomComponent` constructor function.\n *\n * @publicApi\n */\nconst Type = Function;\nfunction isType(v) {\n return typeof v === 'function';\n}\n\n/*\n * #########################\n * Attention: These Regular expressions have to hold even if the code is minified!\n * ##########################\n */\n/**\n * Regular expression that detects pass-through constructors for ES5 output. This Regex\n * intends to capture the common delegation pattern emitted by TypeScript and Babel. Also\n * it intends to capture the pattern where existing constructors have been downleveled from\n * ES2015 to ES5 using TypeScript w/ downlevel iteration. e.g.\n *\n * ```ts\n * function MyClass() {\n * var _this = _super.apply(this, arguments) || this;\n * ```\n *\n * downleveled to ES5 with `downlevelIteration` for TypeScript < 4.2:\n * ```ts\n * function MyClass() {\n * var _this = _super.apply(this, __spread(arguments)) || this;\n * ```\n *\n * or downleveled to ES5 with `downlevelIteration` for TypeScript >= 4.2:\n * ```ts\n * function MyClass() {\n * var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;\n * ```\n *\n * More details can be found in: https://github.com/angular/angular/issues/38453.\n */\nconst ES5_DELEGATE_CTOR = /^function\\s+\\S+\\(\\)\\s*{[\\s\\S]+\\.apply\\(this,\\s*(arguments|(?:[^()]+\\(\\[\\],)?[^()]+\\(arguments\\).*)\\)/;\n/** Regular expression that detects ES2015 classes which extend from other classes. */\nconst ES2015_INHERITED_CLASS = /^class\\s+[A-Za-z\\d$_]*\\s*extends\\s+[^{]+{/;\n/**\n * Regular expression that detects ES2015 classes which extend from other classes and\n * have an explicit constructor defined.\n */\nconst ES2015_INHERITED_CLASS_WITH_CTOR = /^class\\s+[A-Za-z\\d$_]*\\s*extends\\s+[^{]+{[\\s\\S]*constructor\\s*\\(/;\n/**\n * Regular expression that detects ES2015 classes which extend from other classes\n * and inherit a constructor.\n */\nconst ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\\s+[A-Za-z\\d$_]*\\s*extends\\s+[^{]+{[\\s\\S]*constructor\\s*\\(\\)\\s*{[^}]*super\\(\\.\\.\\.arguments\\)/;\n/**\n * Determine whether a stringified type is a class which delegates its constructor\n * to its parent.\n *\n * This is not trivial since compiled code can actually contain a constructor function\n * even if the original source code did not. For instance, when the child class contains\n * an initialized instance property.\n */\nfunction isDelegateCtor(typeStr) {\n return ES5_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || ES2015_INHERITED_CLASS.test(typeStr) && !ES2015_INHERITED_CLASS_WITH_CTOR.test(typeStr);\n}\nclass ReflectionCapabilities {\n _reflect;\n constructor(reflect) {\n this._reflect = reflect || _global['Reflect'];\n }\n factory(t) {\n return (...args) => new t(...args);\n }\n /** @internal */\n _zipTypesAndAnnotations(paramTypes, paramAnnotations) {\n let result;\n if (typeof paramTypes === 'undefined') {\n result = newArray(paramAnnotations.length);\n } else {\n result = newArray(paramTypes.length);\n }\n for (let i = 0; i < result.length; i++) {\n // TS outputs Object for parameters without types, while Traceur omits\n // the annotations. For now we preserve the Traceur behavior to aid\n // migration, but this can be revisited.\n if (typeof paramTypes === 'undefined') {\n result[i] = [];\n } else if (paramTypes[i] && paramTypes[i] != Object) {\n result[i] = [paramTypes[i]];\n } else {\n result[i] = [];\n }\n if (paramAnnotations && paramAnnotations[i] != null) {\n result[i] = result[i].concat(paramAnnotations[i]);\n }\n }\n return result;\n }\n _ownParameters(type, parentCtor) {\n const typeStr = type.toString();\n // If we have no decorators, we only have function.length as metadata.\n // In that case, to detect whether a child class declared an own constructor or not,\n // we need to look inside of that constructor to check whether it is\n // just calling the parent.\n // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439\n // that sets 'design:paramtypes' to []\n // if a class inherits from another class but has no ctor declared itself.\n if (isDelegateCtor(typeStr)) {\n return null;\n }\n // Prefer the direct API.\n if (type.parameters && type.parameters !== parentCtor.parameters) {\n return type.parameters;\n }\n // API of tsickle for lowering decorators to properties on the class.\n const tsickleCtorParams = type.ctorParameters;\n if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {\n // Newer tsickle uses a function closure\n // Retain the non-function case for compatibility with older tsickle\n const ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;\n const paramTypes = ctorParameters.map(ctorParam => ctorParam && ctorParam.type);\n const paramAnnotations = ctorParameters.map(ctorParam => ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators));\n return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);\n }\n // API for metadata created by invoking the decorators.\n const paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS];\n const paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata('design:paramtypes', type);\n if (paramTypes || paramAnnotations) {\n return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);\n }\n // If a class has no decorators, at least create metadata\n // based on function.length.\n // Note: We know that this is a real constructor as we checked\n // the content of the constructor above.\n return newArray(type.length);\n }\n parameters(type) {\n // Note: only report metadata if we have at least one class decorator\n // to stay in sync with the static reflector.\n if (!isType(type)) {\n return [];\n }\n const parentCtor = getParentCtor(type);\n let parameters = this._ownParameters(type, parentCtor);\n if (!parameters && parentCtor !== Object) {\n parameters = this.parameters(parentCtor);\n }\n return parameters || [];\n }\n _ownAnnotations(typeOrFunc, parentCtor) {\n // Prefer the direct API.\n if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) {\n let annotations = typeOrFunc.annotations;\n if (typeof annotations === 'function' && annotations.annotations) {\n annotations = annotations.annotations;\n }\n return annotations;\n }\n // API of tsickle for lowering decorators to properties on the class.\n if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) {\n return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);\n }\n // API for metadata created by invoking the decorators.\n if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {\n return typeOrFunc[ANNOTATIONS];\n }\n return null;\n }\n annotations(typeOrFunc) {\n if (!isType(typeOrFunc)) {\n return [];\n }\n const parentCtor = getParentCtor(typeOrFunc);\n const ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];\n const parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];\n return parentAnnotations.concat(ownAnnotations);\n }\n _ownPropMetadata(typeOrFunc, parentCtor) {\n // Prefer the direct API.\n if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) {\n let propMetadata = typeOrFunc.propMetadata;\n if (typeof propMetadata === 'function' && propMetadata.propMetadata) {\n propMetadata = propMetadata.propMetadata;\n }\n return propMetadata;\n }\n // API of tsickle for lowering decorators to properties on the class.\n if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) {\n const propDecorators = typeOrFunc.propDecorators;\n const propMetadata = {};\n Object.keys(propDecorators).forEach(prop => {\n propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]);\n });\n return propMetadata;\n }\n // API for metadata created by invoking the decorators.\n if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {\n return typeOrFunc[PROP_METADATA];\n }\n return null;\n }\n propMetadata(typeOrFunc) {\n if (!isType(typeOrFunc)) {\n return {};\n }\n const parentCtor = getParentCtor(typeOrFunc);\n const propMetadata = {};\n if (parentCtor !== Object) {\n const parentPropMetadata = this.propMetadata(parentCtor);\n Object.keys(parentPropMetadata).forEach(propName => {\n propMetadata[propName] = parentPropMetadata[propName];\n });\n }\n const ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);\n if (ownPropMetadata) {\n Object.keys(ownPropMetadata).forEach(propName => {\n const decorators = [];\n if (propMetadata.hasOwnProperty(propName)) {\n decorators.push(...propMetadata[propName]);\n }\n decorators.push(...ownPropMetadata[propName]);\n propMetadata[propName] = decorators;\n });\n }\n return propMetadata;\n }\n ownPropMetadata(typeOrFunc) {\n if (!isType(typeOrFunc)) {\n return {};\n }\n return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {};\n }\n hasLifecycleHook(type, lcProperty) {\n return type instanceof Type && lcProperty in type.prototype;\n }\n}\nfunction convertTsickleDecoratorIntoMetadata(decoratorInvocations) {\n if (!decoratorInvocations) {\n return [];\n }\n return decoratorInvocations.map(decoratorInvocation => {\n const decoratorType = decoratorInvocation.type;\n const annotationCls = decoratorType.annotationCls;\n const annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];\n return new annotationCls(...annotationArgs);\n });\n}\nfunction getParentCtor(ctor) {\n const parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;\n const parentCtor = parentProto ? parentProto.constructor : null;\n // Note: We always use `Object` as the null value\n // to simplify checking later on.\n return parentCtor || Object;\n}\n\n// Below are constants for LView indices to help us look up LView members\n// without having to remember the specific indices.\n// Uglify will inline these when minifying so there shouldn't be a cost.\nconst HOST = 0;\nconst TVIEW = 1;\n// Shared with LContainer\nconst FLAGS = 2;\nconst PARENT = 3;\nconst NEXT = 4;\nconst T_HOST = 5;\n// End shared with LContainer\nconst HYDRATION = 6;\nconst CLEANUP = 7;\nconst CONTEXT = 8;\nconst INJECTOR = 9;\nconst ENVIRONMENT = 10;\nconst RENDERER = 11;\nconst CHILD_HEAD = 12;\nconst CHILD_TAIL = 13;\n// FIXME(misko): Investigate if the three declarations aren't all same thing.\nconst DECLARATION_VIEW = 14;\nconst DECLARATION_COMPONENT_VIEW = 15;\nconst DECLARATION_LCONTAINER = 16;\nconst PREORDER_HOOK_FLAGS = 17;\nconst QUERIES = 18;\nconst ID = 19;\nconst EMBEDDED_VIEW_INJECTOR = 20;\nconst ON_DESTROY_HOOKS = 21;\nconst EFFECTS_TO_SCHEDULE = 22;\nconst EFFECTS = 23;\nconst REACTIVE_TEMPLATE_CONSUMER = 24;\n/**\n * Size of LView's header. Necessary to adjust for it when setting slots.\n *\n * IMPORTANT: `HEADER_OFFSET` should only be referred to the in the `ɵɵ*` instructions to translate\n * instruction index into `LView` index. All other indexes should be in the `LView` index space and\n * there should be no need to refer to `HEADER_OFFSET` anywhere else.\n */\nconst HEADER_OFFSET = 25;\n\n/**\n * Special location which allows easy identification of type. If we have an array which was\n * retrieved from the `LView` and that array has `true` at `TYPE` location, we know it is\n * `LContainer`.\n */\nconst TYPE = 1;\n/**\n * Below are constants for LContainer indices to help us look up LContainer members\n * without having to remember the specific indices.\n * Uglify will inline these when minifying so there shouldn't be a cost.\n */\n// FLAGS, PARENT, NEXT, and T_HOST are indices 2, 3, 4, and 5\n// As we already have these constants in LView, we don't need to re-create them.\nconst DEHYDRATED_VIEWS = 6;\nconst NATIVE = 7;\nconst VIEW_REFS = 8;\nconst MOVED_VIEWS = 9;\n/**\n * Size of LContainer's header. Represents the index after which all views in the\n * container will be inserted. We need to keep a record of current views so we know\n * which views are already in the DOM (and don't need to be re-added) and so we can\n * remove views from the DOM when they are no longer required.\n */\nconst CONTAINER_HEADER_OFFSET = 10;\n/** Flags associated with an LContainer (saved in LContainer[FLAGS]) */\nvar LContainerFlags = /*#__PURE__*/function (LContainerFlags) {\n LContainerFlags[LContainerFlags[\"None\"] = 0] = \"None\";\n /**\n * Flag to signify that this `LContainer` may have transplanted views which need to be change\n * detected. (see: `LView[DECLARATION_COMPONENT_VIEW])`.\n *\n * This flag, once set, is never unset for the `LContainer`.\n */\n LContainerFlags[LContainerFlags[\"HasTransplantedViews\"] = 2] = \"HasTransplantedViews\";\n return LContainerFlags;\n}(LContainerFlags || {});\n/**\n * True if `value` is `LView`.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction isLView(value) {\n return Array.isArray(value) && typeof value[TYPE] === 'object';\n}\n/**\n * True if `value` is `LContainer`.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction isLContainer(value) {\n return Array.isArray(value) && value[TYPE] === true;\n}\nfunction isContentQueryHost(tNode) {\n return (tNode.flags & 4 /* TNodeFlags.hasContentQuery */) !== 0;\n}\nfunction isComponentHost(tNode) {\n return tNode.componentOffset > -1;\n}\nfunction isDirectiveHost(tNode) {\n return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;\n}\nfunction isComponentDef(def) {\n return !!def.template;\n}\nfunction isRootView(target) {\n return (target[FLAGS] & 512 /* LViewFlags.IsRoot */) !== 0;\n}\nfunction isProjectionTNode(tNode) {\n return (tNode.type & 16 /* TNodeType.Projection */) === 16 /* TNodeType.Projection */;\n}\nfunction hasI18n(lView) {\n return (lView[FLAGS] & 32 /* LViewFlags.HasI18n */) === 32 /* LViewFlags.HasI18n */;\n}\nfunction isDestroyed(lView) {\n return (lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */;\n}\n\n// [Assert functions do not constraint type when they are guarded by a truthy\n// expression.](https://github.com/microsoft/TypeScript/issues/37295)\nfunction assertTNodeForLView(tNode, lView) {\n assertTNodeForTView(tNode, lView[TVIEW]);\n}\nfunction assertTNodeForTView(tNode, tView) {\n assertTNode(tNode);\n const tData = tView.data;\n for (let i = HEADER_OFFSET; i < tData.length; i++) {\n if (tData[i] === tNode) {\n return;\n }\n }\n throwError('This TNode does not belong to this TView.');\n}\nfunction assertTNode(tNode) {\n assertDefined(tNode, 'TNode must be defined');\n if (!(tNode && typeof tNode === 'object' && tNode.hasOwnProperty('directiveStylingLast'))) {\n throwError('Not of type TNode, got: ' + tNode);\n }\n}\nfunction assertTIcu(tIcu) {\n assertDefined(tIcu, 'Expected TIcu to be defined');\n if (!(typeof tIcu.currentCaseLViewIndex === 'number')) {\n throwError('Object is not of TIcu type.');\n }\n}\nfunction assertComponentType(actual, msg = \"Type passed in is not ComponentType, it does not have 'ɵcmp' property.\") {\n if (!getComponentDef(actual)) {\n throwError(msg);\n }\n}\nfunction assertNgModuleType(actual, msg = \"Type passed in is not NgModuleType, it does not have 'ɵmod' property.\") {\n if (!getNgModuleDef(actual)) {\n throwError(msg);\n }\n}\nfunction assertCurrentTNodeIsParent(isParent) {\n assertEqual(isParent, true, 'currentTNode should be a parent');\n}\nfunction assertHasParent(tNode) {\n assertDefined(tNode, 'currentTNode should exist!');\n assertDefined(tNode.parent, 'currentTNode should have a parent');\n}\nfunction assertLContainer(value) {\n assertDefined(value, 'LContainer must be defined');\n assertEqual(isLContainer(value), true, 'Expecting LContainer');\n}\nfunction assertLViewOrUndefined(value) {\n value && assertEqual(isLView(value), true, 'Expecting LView or undefined or null');\n}\nfunction assertLView(value) {\n assertDefined(value, 'LView must be defined');\n assertEqual(isLView(value), true, 'Expecting LView');\n}\nfunction assertFirstCreatePass(tView, errMessage) {\n assertEqual(tView.firstCreatePass, true, errMessage || 'Should only be called in first create pass.');\n}\nfunction assertFirstUpdatePass(tView, errMessage) {\n assertEqual(tView.firstUpdatePass, true, errMessage || 'Should only be called in first update pass.');\n}\n/**\n * This is a basic sanity check that an object is probably a directive def. DirectiveDef is\n * an interface, so we can't do a direct instanceof check.\n */\nfunction assertDirectiveDef(obj) {\n if (obj.type === undefined || obj.selectors == undefined || obj.inputs === undefined) {\n throwError(`Expected a DirectiveDef/ComponentDef and this object does not seem to have the expected shape.`);\n }\n}\nfunction assertIndexInDeclRange(tView, index) {\n assertBetween(HEADER_OFFSET, tView.bindingStartIndex, index);\n}\nfunction assertIndexInExpandoRange(lView, index) {\n const tView = lView[1];\n assertBetween(tView.expandoStartIndex, lView.length, index);\n}\nfunction assertBetween(lower, upper, index) {\n if (!(lower <= index && index < upper)) {\n throwError(`Index out of range (expecting ${lower} <= ${index} < ${upper})`);\n }\n}\nfunction assertProjectionSlots(lView, errMessage) {\n assertDefined(lView[DECLARATION_COMPONENT_VIEW], 'Component views should exist.');\n assertDefined(lView[DECLARATION_COMPONENT_VIEW][T_HOST].projection, errMessage || 'Components with projection nodes () must have projection slots defined.');\n}\nfunction assertParentView(lView, errMessage) {\n assertDefined(lView, errMessage || \"Component views should always have a parent view (component's host view)\");\n}\nfunction assertNoDuplicateDirectives(directives) {\n // The array needs at least two elements in order to have duplicates.\n if (directives.length < 2) {\n return;\n }\n const seenDirectives = new Set();\n for (const current of directives) {\n if (seenDirectives.has(current)) {\n throw new RuntimeError(309 /* RuntimeErrorCode.DUPLICATE_DIRECTIVE */, `Directive ${current.type.name} matches multiple times on the same element. ` + `Directives can only match an element once.`);\n }\n seenDirectives.add(current);\n }\n}\n/**\n * This is a basic sanity check that the `injectorIndex` seems to point to what looks like a\n * NodeInjector data structure.\n *\n * @param lView `LView` which should be checked.\n * @param injectorIndex index into the `LView` where the `NodeInjector` is expected.\n */\nfunction assertNodeInjector(lView, injectorIndex) {\n assertIndexInExpandoRange(lView, injectorIndex);\n assertIndexInExpandoRange(lView, injectorIndex + 8 /* NodeInjectorOffset.PARENT */);\n assertNumber(lView[injectorIndex + 0], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 1], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 2], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 3], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 4], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 5], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 6], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 7], 'injectorIndex should point to a bloom filter');\n assertNumber(lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */], 'injectorIndex should point to parent injector');\n}\n\n/**\n * Represents a basic change from a previous to a new value for a single\n * property on a directive instance. Passed as a value in a\n * {@link SimpleChanges} object to the `ngOnChanges` hook.\n *\n * @see {@link OnChanges}\n *\n * @publicApi\n */\nclass SimpleChange {\n previousValue;\n currentValue;\n firstChange;\n constructor(previousValue, currentValue, firstChange) {\n this.previousValue = previousValue;\n this.currentValue = currentValue;\n this.firstChange = firstChange;\n }\n /**\n * Check whether the new value is the first value assigned.\n */\n isFirstChange() {\n return this.firstChange;\n }\n}\nfunction applyValueToInputField(instance, inputSignalNode, privateName, value) {\n if (inputSignalNode !== null) {\n inputSignalNode.applyValueToInputSignal(inputSignalNode, value);\n } else {\n instance[privateName] = value;\n }\n}\n\n/**\n * The NgOnChangesFeature decorates a component with support for the ngOnChanges\n * lifecycle hook, so it should be included in any component that implements\n * that hook.\n *\n * If the component or directive uses inheritance, the NgOnChangesFeature MUST\n * be included as a feature AFTER {@link InheritDefinitionFeature}, otherwise\n * inherited properties will not be propagated to the ngOnChanges lifecycle\n * hook.\n *\n * Example usage:\n *\n * ```ts\n * static ɵcmp = defineComponent({\n * ...\n * inputs: {name: 'publicName'},\n * features: [NgOnChangesFeature]\n * });\n * ```\n *\n * @codeGenApi\n */\nconst ɵɵNgOnChangesFeature = /* @__PURE__ */(() => {\n const ɵɵNgOnChangesFeatureImpl = () => NgOnChangesFeatureImpl;\n // This option ensures that the ngOnChanges lifecycle hook will be inherited\n // from superclasses (in InheritDefinitionFeature).\n /** @nocollapse */\n ɵɵNgOnChangesFeatureImpl.ngInherit = true;\n return ɵɵNgOnChangesFeatureImpl;\n})();\nfunction NgOnChangesFeatureImpl(definition) {\n if (definition.type.prototype.ngOnChanges) {\n definition.setInput = ngOnChangesSetInput;\n }\n return rememberChangeHistoryAndInvokeOnChangesHook;\n}\n/**\n * This is a synthetic lifecycle hook which gets inserted into `TView.preOrderHooks` to simulate\n * `ngOnChanges`.\n *\n * The hook reads the `NgSimpleChangesStore` data from the component instance and if changes are\n * found it invokes `ngOnChanges` on the component instance.\n *\n * @param this Component instance. Because this function gets inserted into `TView.preOrderHooks`,\n * it is guaranteed to be called with component instance.\n */\nfunction rememberChangeHistoryAndInvokeOnChangesHook() {\n const simpleChangesStore = getSimpleChangesStore(this);\n const current = simpleChangesStore?.current;\n if (current) {\n const previous = simpleChangesStore.previous;\n if (previous === EMPTY_OBJ) {\n simpleChangesStore.previous = current;\n } else {\n // New changes are copied to the previous store, so that we don't lose history for inputs\n // which were not changed this time\n for (let key in current) {\n previous[key] = current[key];\n }\n }\n simpleChangesStore.current = null;\n this.ngOnChanges(current);\n }\n}\nfunction ngOnChangesSetInput(instance, inputSignalNode, value, publicName, privateName) {\n const declaredName = this.declaredInputs[publicName];\n ngDevMode && assertString(declaredName, 'Name of input in ngOnChanges has to be a string');\n const simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, {\n previous: EMPTY_OBJ,\n current: null\n });\n const current = simpleChangesStore.current || (simpleChangesStore.current = {});\n const previous = simpleChangesStore.previous;\n const previousChange = previous[declaredName];\n current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);\n applyValueToInputField(instance, inputSignalNode, privateName, value);\n}\nconst SIMPLE_CHANGES_STORE = '__ngSimpleChanges__';\nfunction getSimpleChangesStore(instance) {\n return instance[SIMPLE_CHANGES_STORE] || null;\n}\nfunction setSimpleChangesStore(instance, store) {\n return instance[SIMPLE_CHANGES_STORE] = store;\n}\nlet profilerCallback = null;\n/**\n * Sets the callback function which will be invoked before and after performing certain actions at\n * runtime (for example, before and after running change detection).\n *\n * Warning: this function is *INTERNAL* and should not be relied upon in application's code.\n * The contract of the function might be changed in any release and/or the function can be removed\n * completely.\n *\n * @param profiler function provided by the caller or null value to disable profiling.\n */\nconst setProfiler = profiler => {\n profilerCallback = profiler;\n};\n/**\n * Profiler function which wraps user code executed by the runtime.\n *\n * @param event ProfilerEvent corresponding to the execution context\n * @param instance component instance\n * @param hookOrListener lifecycle hook function or output listener. The value depends on the\n * execution context\n * @returns\n */\nconst profiler = function (event, instance, hookOrListener) {\n if (profilerCallback != null /* both `null` and `undefined` */) {\n profilerCallback(event, instance, hookOrListener);\n }\n};\nconst SVG_NAMESPACE = 'svg';\nconst MATH_ML_NAMESPACE = 'math';\n\n/**\n * For efficiency reasons we often put several different data types (`RNode`, `LView`, `LContainer`)\n * in same location in `LView`. This is because we don't want to pre-allocate space for it\n * because the storage is sparse. This file contains utilities for dealing with such data types.\n *\n * How do we know what is stored at a given location in `LView`.\n * - `Array.isArray(value) === false` => `RNode` (The normal storage value)\n * - `Array.isArray(value) === true` => then the `value[0]` represents the wrapped value.\n * - `typeof value[TYPE] === 'object'` => `LView`\n * - This happens when we have a component at a given location\n * - `typeof value[TYPE] === true` => `LContainer`\n * - This happens when we have `LContainer` binding at a given location.\n *\n *\n * NOTE: it is assumed that `Array.isArray` and `typeof` operations are very efficient.\n */\n/**\n * Returns `RNode`.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction unwrapRNode(value) {\n while (Array.isArray(value)) {\n value = value[HOST];\n }\n return value;\n}\n/**\n * Returns `LView` or `null` if not found.\n * @param value wrapped value of `RNode`, `LView`, `LContainer`\n */\nfunction unwrapLView(value) {\n while (Array.isArray(value)) {\n // This check is same as `isLView()` but we don't call at as we don't want to call\n // `Array.isArray()` twice and give JITer more work for inlining.\n if (typeof value[TYPE] === 'object') return value;\n value = value[HOST];\n }\n return null;\n}\n/**\n * Retrieves an element value from the provided `viewData`, by unwrapping\n * from any containers, component views, or style contexts.\n */\nfunction getNativeByIndex(index, lView) {\n ngDevMode && assertIndexInRange(lView, index);\n ngDevMode && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Expected to be past HEADER_OFFSET');\n return unwrapRNode(lView[index]);\n}\n/**\n * Retrieve an `RNode` for a given `TNode` and `LView`.\n *\n * This function guarantees in dev mode to retrieve a non-null `RNode`.\n *\n * @param tNode\n * @param lView\n */\nfunction getNativeByTNode(tNode, lView) {\n ngDevMode && assertTNodeForLView(tNode, lView);\n ngDevMode && assertIndexInRange(lView, tNode.index);\n const node = unwrapRNode(lView[tNode.index]);\n return node;\n}\n/**\n * Retrieve an `RNode` or `null` for a given `TNode` and `LView`.\n *\n * Some `TNode`s don't have associated `RNode`s. For example `Projection`\n *\n * @param tNode\n * @param lView\n */\nfunction getNativeByTNodeOrNull(tNode, lView) {\n const index = tNode === null ? -1 : tNode.index;\n if (index !== -1) {\n ngDevMode && assertTNodeForLView(tNode, lView);\n const node = unwrapRNode(lView[index]);\n return node;\n }\n return null;\n}\n// fixme(misko): The return Type should be `TNode|null`\nfunction getTNode(tView, index) {\n ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode');\n ngDevMode && assertLessThan(index, tView.data.length, 'wrong index for TNode');\n const tNode = tView.data[index];\n ngDevMode && tNode !== null && assertTNode(tNode);\n return tNode;\n}\n/** Retrieves a value from any `LView` or `TData`. */\nfunction load(view, index) {\n ngDevMode && assertIndexInRange(view, index);\n return view[index];\n}\nfunction getComponentLViewByIndex(nodeIndex, hostView) {\n // Could be an LView or an LContainer. If LContainer, unwrap to find LView.\n ngDevMode && assertIndexInRange(hostView, nodeIndex);\n const slotValue = hostView[nodeIndex];\n const lView = isLView(slotValue) ? slotValue : slotValue[HOST];\n return lView;\n}\n/** Checks whether a given view is in creation mode */\nfunction isCreationMode(view) {\n return (view[FLAGS] & 4 /* LViewFlags.CreationMode */) === 4 /* LViewFlags.CreationMode */;\n}\n/**\n * Returns a boolean for whether the view is attached to the change detection tree.\n *\n * Note: This determines whether a view should be checked, not whether it's inserted\n * into a container. For that, you'll want `viewAttachedToContainer` below.\n */\nfunction viewAttachedToChangeDetector(view) {\n return (view[FLAGS] & 128 /* LViewFlags.Attached */) === 128 /* LViewFlags.Attached */;\n}\n/** Returns a boolean for whether the view is attached to a container. */\nfunction viewAttachedToContainer(view) {\n return isLContainer(view[PARENT]);\n}\nfunction getConstant(consts, index) {\n if (index === null || index === undefined) return null;\n ngDevMode && assertIndexInRange(consts, index);\n return consts[index];\n}\n/**\n * Resets the pre-order hook flags of the view.\n * @param lView the LView on which the flags are reset\n */\nfunction resetPreOrderHookFlags(lView) {\n lView[PREORDER_HOOK_FLAGS] = 0;\n}\n/**\n * Adds the `RefreshView` flag from the lView and updates HAS_CHILD_VIEWS_TO_REFRESH flag of\n * parents.\n */\nfunction markViewForRefresh(lView) {\n if (lView[FLAGS] & 1024 /* LViewFlags.RefreshView */) {\n return;\n }\n lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;\n if (viewAttachedToChangeDetector(lView)) {\n markAncestorsForTraversal(lView);\n }\n}\n/**\n * Walks up the LView hierarchy.\n * @param nestingLevel Number of times to walk up in hierarchy.\n * @param currentView View from which to start the lookup.\n */\nfunction walkUpViews(nestingLevel, currentView) {\n while (nestingLevel > 0) {\n ngDevMode && assertDefined(currentView[DECLARATION_VIEW], 'Declaration view should be defined if nesting level is greater than 0.');\n currentView = currentView[DECLARATION_VIEW];\n nestingLevel--;\n }\n return currentView;\n}\nfunction requiresRefreshOrTraversal(lView) {\n return !!(lView[FLAGS] & (1024 /* LViewFlags.RefreshView */ | 8192 /* LViewFlags.HasChildViewsToRefresh */) || lView[REACTIVE_TEMPLATE_CONSUMER]?.dirty);\n}\n/**\n * Updates the `HasChildViewsToRefresh` flag on the parents of the `LView` as well as the\n * parents above.\n */\nfunction updateAncestorTraversalFlagsOnAttach(lView) {\n lView[ENVIRONMENT].changeDetectionScheduler?.notify(9 /* NotificationSource.ViewAttached */);\n if (lView[FLAGS] & 64 /* LViewFlags.Dirty */) {\n lView[FLAGS] |= 1024 /* LViewFlags.RefreshView */;\n }\n if (requiresRefreshOrTraversal(lView)) {\n markAncestorsForTraversal(lView);\n }\n}\n/**\n * Ensures views above the given `lView` are traversed during change detection even when they are\n * not dirty.\n *\n * This is done by setting the `HAS_CHILD_VIEWS_TO_REFRESH` flag up to the root, stopping when the\n * flag is already `true` or the `lView` is detached.\n */\nfunction markAncestorsForTraversal(lView) {\n lView[ENVIRONMENT].changeDetectionScheduler?.notify(0 /* NotificationSource.MarkAncestorsForTraversal */);\n let parent = getLViewParent(lView);\n while (parent !== null) {\n // We stop adding markers to the ancestors once we reach one that already has the marker. This\n // is to avoid needlessly traversing all the way to the root when the marker already exists.\n if (parent[FLAGS] & 8192 /* LViewFlags.HasChildViewsToRefresh */) {\n break;\n }\n parent[FLAGS] |= 8192 /* LViewFlags.HasChildViewsToRefresh */;\n if (!viewAttachedToChangeDetector(parent)) {\n break;\n }\n parent = getLViewParent(parent);\n }\n}\n/**\n * Stores a LView-specific destroy callback.\n */\nfunction storeLViewOnDestroy(lView, onDestroyCallback) {\n if ((lView[FLAGS] & 256 /* LViewFlags.Destroyed */) === 256 /* LViewFlags.Destroyed */) {\n throw new RuntimeError(911 /* RuntimeErrorCode.VIEW_ALREADY_DESTROYED */, ngDevMode && 'View has already been destroyed.');\n }\n if (lView[ON_DESTROY_HOOKS] === null) {\n lView[ON_DESTROY_HOOKS] = [];\n }\n lView[ON_DESTROY_HOOKS].push(onDestroyCallback);\n}\n/**\n * Removes previously registered LView-specific destroy callback.\n */\nfunction removeLViewOnDestroy(lView, onDestroyCallback) {\n if (lView[ON_DESTROY_HOOKS] === null) return;\n const destroyCBIdx = lView[ON_DESTROY_HOOKS].indexOf(onDestroyCallback);\n if (destroyCBIdx !== -1) {\n lView[ON_DESTROY_HOOKS].splice(destroyCBIdx, 1);\n }\n}\n/**\n * Gets the parent LView of the passed LView, if the PARENT is an LContainer, will get the parent of\n * that LContainer, which is an LView\n * @param lView the lView whose parent to get\n */\nfunction getLViewParent(lView) {\n ngDevMode && assertLView(lView);\n const parent = lView[PARENT];\n return isLContainer(parent) ? parent[PARENT] : parent;\n}\nconst instructionState = {\n lFrame: /*#__PURE__*/createLFrame(null),\n bindingsEnabled: true,\n skipHydrationRootTNode: null\n};\nvar CheckNoChangesMode = /*#__PURE__*/function (CheckNoChangesMode) {\n CheckNoChangesMode[CheckNoChangesMode[\"Off\"] = 0] = \"Off\";\n CheckNoChangesMode[CheckNoChangesMode[\"Exhaustive\"] = 1] = \"Exhaustive\";\n CheckNoChangesMode[CheckNoChangesMode[\"OnlyDirtyViews\"] = 2] = \"OnlyDirtyViews\";\n return CheckNoChangesMode;\n}(CheckNoChangesMode || {});\n/**\n * In this mode, any changes in bindings will throw an ExpressionChangedAfterChecked error.\n *\n * Necessary to support ChangeDetectorRef.checkNoChanges().\n *\n * The `checkNoChanges` function is invoked only in ngDevMode=true and verifies that no unintended\n * changes exist in the change detector or its children.\n */\nlet _checkNoChangesMode = 0; /* CheckNoChangesMode.Off */\n/**\n * Flag used to indicate that we are in the middle running change detection on a view\n *\n * @see detectChangesInViewWhileDirty\n */\nlet _isRefreshingViews = false;\n/**\n * Returns true if the instruction state stack is empty.\n *\n * Intended to be called from tests only (tree shaken otherwise).\n */\nfunction specOnlyIsInstructionStateEmpty() {\n return instructionState.lFrame.parent === null;\n}\nfunction getElementDepthCount() {\n return instructionState.lFrame.elementDepthCount;\n}\nfunction increaseElementDepthCount() {\n instructionState.lFrame.elementDepthCount++;\n}\nfunction decreaseElementDepthCount() {\n instructionState.lFrame.elementDepthCount--;\n}\nfunction getBindingsEnabled() {\n return instructionState.bindingsEnabled;\n}\n/**\n * Returns true if currently inside a skip hydration block.\n * @returns boolean\n */\nfunction isInSkipHydrationBlock$1() {\n return instructionState.skipHydrationRootTNode !== null;\n}\n/**\n * Returns true if this is the root TNode of the skip hydration block.\n * @param tNode the current TNode\n * @returns boolean\n */\nfunction isSkipHydrationRootTNode(tNode) {\n return instructionState.skipHydrationRootTNode === tNode;\n}\n/**\n * Enables directive matching on elements.\n *\n * * Example:\n * ```html\n * \n * Should match component / directive.\n * \n *
          \n * \n * \n * Should not match component / directive because we are in ngNonBindable.\n * \n * \n *
          \n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵenableBindings() {\n instructionState.bindingsEnabled = true;\n}\n/**\n * Sets a flag to specify that the TNode is in a skip hydration block.\n * @param tNode the current TNode\n */\nfunction enterSkipHydrationBlock(tNode) {\n instructionState.skipHydrationRootTNode = tNode;\n}\n/**\n * Disables directive matching on element.\n *\n * * Example:\n * ```html\n * \n * Should match component / directive.\n * \n *
          \n * \n * \n * Should not match component / directive because we are in ngNonBindable.\n * \n * \n *
          \n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵdisableBindings() {\n instructionState.bindingsEnabled = false;\n}\n/**\n * Clears the root skip hydration node when leaving a skip hydration block.\n */\nfunction leaveSkipHydrationBlock() {\n instructionState.skipHydrationRootTNode = null;\n}\n/**\n * Return the current `LView`.\n */\nfunction getLView() {\n return instructionState.lFrame.lView;\n}\n/**\n * Return the current `TView`.\n */\nfunction getTView() {\n return instructionState.lFrame.tView;\n}\n/**\n * Restores `contextViewData` to the given OpaqueViewState instance.\n *\n * Used in conjunction with the getCurrentView() instruction to save a snapshot\n * of the current view and restore it when listeners are invoked. This allows\n * walking the declaration view tree in listeners to get vars from parent views.\n *\n * @param viewToRestore The OpaqueViewState instance to restore.\n * @returns Context of the restored OpaqueViewState instance.\n *\n * @codeGenApi\n */\nfunction ɵɵrestoreView(viewToRestore) {\n instructionState.lFrame.contextLView = viewToRestore;\n return viewToRestore[CONTEXT];\n}\n/**\n * Clears the view set in `ɵɵrestoreView` from memory. Returns the passed in\n * value so that it can be used as a return value of an instruction.\n *\n * @codeGenApi\n */\nfunction ɵɵresetView(value) {\n instructionState.lFrame.contextLView = null;\n return value;\n}\nfunction getCurrentTNode() {\n let currentTNode = getCurrentTNodePlaceholderOk();\n while (currentTNode !== null && currentTNode.type === 64 /* TNodeType.Placeholder */) {\n currentTNode = currentTNode.parent;\n }\n return currentTNode;\n}\nfunction getCurrentTNodePlaceholderOk() {\n return instructionState.lFrame.currentTNode;\n}\nfunction getCurrentParentTNode() {\n const lFrame = instructionState.lFrame;\n const currentTNode = lFrame.currentTNode;\n return lFrame.isParent ? currentTNode : currentTNode.parent;\n}\nfunction setCurrentTNode(tNode, isParent) {\n ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);\n const lFrame = instructionState.lFrame;\n lFrame.currentTNode = tNode;\n lFrame.isParent = isParent;\n}\nfunction isCurrentTNodeParent() {\n return instructionState.lFrame.isParent;\n}\nfunction setCurrentTNodeAsNotParent() {\n instructionState.lFrame.isParent = false;\n}\nfunction getContextLView() {\n const contextLView = instructionState.lFrame.contextLView;\n ngDevMode && assertDefined(contextLView, 'contextLView must be defined.');\n return contextLView;\n}\nfunction isInCheckNoChangesMode() {\n !ngDevMode && throwError('Must never be called in production mode');\n return _checkNoChangesMode !== CheckNoChangesMode.Off;\n}\nfunction isExhaustiveCheckNoChanges() {\n !ngDevMode && throwError('Must never be called in production mode');\n return _checkNoChangesMode === CheckNoChangesMode.Exhaustive;\n}\nfunction setIsInCheckNoChangesMode(mode) {\n !ngDevMode && throwError('Must never be called in production mode');\n _checkNoChangesMode = mode;\n}\nfunction isRefreshingViews() {\n return _isRefreshingViews;\n}\nfunction setIsRefreshingViews(mode) {\n const prev = _isRefreshingViews;\n _isRefreshingViews = mode;\n return prev;\n}\n// top level variables should not be exported for performance reasons (PERF_NOTES.md)\nfunction getBindingRoot() {\n const lFrame = instructionState.lFrame;\n let index = lFrame.bindingRootIndex;\n if (index === -1) {\n index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;\n }\n return index;\n}\nfunction getBindingIndex() {\n return instructionState.lFrame.bindingIndex;\n}\nfunction setBindingIndex(value) {\n return instructionState.lFrame.bindingIndex = value;\n}\nfunction nextBindingIndex() {\n return instructionState.lFrame.bindingIndex++;\n}\nfunction incrementBindingIndex(count) {\n const lFrame = instructionState.lFrame;\n const index = lFrame.bindingIndex;\n lFrame.bindingIndex = lFrame.bindingIndex + count;\n return index;\n}\nfunction isInI18nBlock() {\n return instructionState.lFrame.inI18n;\n}\nfunction setInI18nBlock(isInI18nBlock) {\n instructionState.lFrame.inI18n = isInI18nBlock;\n}\n/**\n * Set a new binding root index so that host template functions can execute.\n *\n * Bindings inside the host template are 0 index. But because we don't know ahead of time\n * how many host bindings we have we can't pre-compute them. For this reason they are all\n * 0 index and we just shift the root so that they match next available location in the LView.\n *\n * @param bindingRootIndex Root index for `hostBindings`\n * @param currentDirectiveIndex `TData[currentDirectiveIndex]` will point to the current directive\n * whose `hostBindings` are being processed.\n */\nfunction setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {\n const lFrame = instructionState.lFrame;\n lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;\n setCurrentDirectiveIndex(currentDirectiveIndex);\n}\n/**\n * When host binding is executing this points to the directive index.\n * `TView.data[getCurrentDirectiveIndex()]` is `DirectiveDef`\n * `LView[getCurrentDirectiveIndex()]` is directive instance.\n */\nfunction getCurrentDirectiveIndex() {\n return instructionState.lFrame.currentDirectiveIndex;\n}\n/**\n * Sets an index of a directive whose `hostBindings` are being processed.\n *\n * @param currentDirectiveIndex `TData` index where current directive instance can be found.\n */\nfunction setCurrentDirectiveIndex(currentDirectiveIndex) {\n instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;\n}\n/**\n * Retrieve the current `DirectiveDef` which is active when `hostBindings` instruction is being\n * executed.\n *\n * @param tData Current `TData` where the `DirectiveDef` will be looked up at.\n */\nfunction getCurrentDirectiveDef(tData) {\n const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;\n return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];\n}\nfunction getCurrentQueryIndex() {\n return instructionState.lFrame.currentQueryIndex;\n}\nfunction setCurrentQueryIndex(value) {\n instructionState.lFrame.currentQueryIndex = value;\n}\n/**\n * Returns a `TNode` of the location where the current `LView` is declared at.\n *\n * @param lView an `LView` that we want to find parent `TNode` for.\n */\nfunction getDeclarationTNode(lView) {\n const tView = lView[TVIEW];\n // Return the declaration parent for embedded views\n if (tView.type === 2 /* TViewType.Embedded */) {\n ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');\n return tView.declTNode;\n }\n // Components don't have `TView.declTNode` because each instance of component could be\n // inserted in different location, hence `TView.declTNode` is meaningless.\n // Falling back to `T_HOST` in case we cross component boundary.\n if (tView.type === 1 /* TViewType.Component */) {\n return lView[T_HOST];\n }\n // Remaining TNode type is `TViewType.Root` which doesn't have a parent TNode.\n return null;\n}\n/**\n * This is a light weight version of the `enterView` which is needed by the DI system.\n *\n * @param lView `LView` location of the DI context.\n * @param tNode `TNode` for DI context\n * @param flags DI context flags. if `SkipSelf` flag is set than we walk up the declaration\n * tree from `tNode` until we find parent declared `TElementNode`.\n * @returns `true` if we have successfully entered DI associated with `tNode` (or with declared\n * `TNode` if `flags` has `SkipSelf`). Failing to enter DI implies that no associated\n * `NodeInjector` can be found and we should instead use `ModuleInjector`.\n * - If `true` than this call must be fallowed by `leaveDI`\n * - If `false` than this call failed and we should NOT call `leaveDI`\n */\nfunction enterDI(lView, tNode, flags) {\n ngDevMode && assertLViewOrUndefined(lView);\n if (flags & InjectFlags.SkipSelf) {\n ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);\n let parentTNode = tNode;\n let parentLView = lView;\n while (true) {\n ngDevMode && assertDefined(parentTNode, 'Parent TNode should be defined');\n parentTNode = parentTNode.parent;\n if (parentTNode === null && !(flags & InjectFlags.Host)) {\n parentTNode = getDeclarationTNode(parentLView);\n if (parentTNode === null) break;\n // In this case, a parent exists and is definitely an element. So it will definitely\n // have an existing lView as the declaration view, which is why we can assume it's defined.\n ngDevMode && assertDefined(parentLView, 'Parent LView should be defined');\n parentLView = parentLView[DECLARATION_VIEW];\n // In Ivy there are Comment nodes that correspond to ngIf and NgFor embedded directives\n // We want to skip those and look only at Elements and ElementContainers to ensure\n // we're looking at true parent nodes, and not content or other types.\n if (parentTNode.type & (2 /* TNodeType.Element */ | 8 /* TNodeType.ElementContainer */)) {\n break;\n }\n } else {\n break;\n }\n }\n if (parentTNode === null) {\n // If we failed to find a parent TNode this means that we should use module injector.\n return false;\n } else {\n tNode = parentTNode;\n lView = parentLView;\n }\n }\n ngDevMode && assertTNodeForLView(tNode, lView);\n const lFrame = instructionState.lFrame = allocLFrame();\n lFrame.currentTNode = tNode;\n lFrame.lView = lView;\n return true;\n}\n/**\n * Swap the current lView with a new lView.\n *\n * For performance reasons we store the lView in the top level of the module.\n * This way we minimize the number of properties to read. Whenever a new view\n * is entered we have to store the lView for later, and when the view is\n * exited the state has to be restored\n *\n * @param newView New lView to become active\n * @returns the previously active lView;\n */\nfunction enterView(newView) {\n ngDevMode && assertNotEqual(newView[0], newView[1], '????');\n ngDevMode && assertLViewOrUndefined(newView);\n const newLFrame = allocLFrame();\n if (ngDevMode) {\n assertEqual(newLFrame.isParent, true, 'Expected clean LFrame');\n assertEqual(newLFrame.lView, null, 'Expected clean LFrame');\n assertEqual(newLFrame.tView, null, 'Expected clean LFrame');\n assertEqual(newLFrame.selectedIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.elementDepthCount, 0, 'Expected clean LFrame');\n assertEqual(newLFrame.currentDirectiveIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.currentNamespace, null, 'Expected clean LFrame');\n assertEqual(newLFrame.bindingRootIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.currentQueryIndex, 0, 'Expected clean LFrame');\n }\n const tView = newView[TVIEW];\n instructionState.lFrame = newLFrame;\n ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);\n newLFrame.currentTNode = tView.firstChild;\n newLFrame.lView = newView;\n newLFrame.tView = tView;\n newLFrame.contextLView = newView;\n newLFrame.bindingIndex = tView.bindingStartIndex;\n newLFrame.inI18n = false;\n}\n/**\n * Allocates next free LFrame. This function tries to reuse the `LFrame`s to lower memory pressure.\n */\nfunction allocLFrame() {\n const currentLFrame = instructionState.lFrame;\n const childLFrame = currentLFrame === null ? null : currentLFrame.child;\n const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;\n return newLFrame;\n}\nfunction createLFrame(parent) {\n const lFrame = {\n currentTNode: null,\n isParent: true,\n lView: null,\n tView: null,\n selectedIndex: -1,\n contextLView: null,\n elementDepthCount: 0,\n currentNamespace: null,\n currentDirectiveIndex: -1,\n bindingRootIndex: -1,\n bindingIndex: -1,\n currentQueryIndex: 0,\n parent: parent,\n child: null,\n inI18n: false\n };\n parent !== null && (parent.child = lFrame); // link the new LFrame for reuse.\n return lFrame;\n}\n/**\n * A lightweight version of leave which is used with DI.\n *\n * This function only resets `currentTNode` and `LView` as those are the only properties\n * used with DI (`enterDI()`).\n *\n * NOTE: This function is reexported as `leaveDI`. However `leaveDI` has return type of `void` where\n * as `leaveViewLight` has `LFrame`. This is so that `leaveViewLight` can be used in `leaveView`.\n */\nfunction leaveViewLight() {\n const oldLFrame = instructionState.lFrame;\n instructionState.lFrame = oldLFrame.parent;\n oldLFrame.currentTNode = null;\n oldLFrame.lView = null;\n return oldLFrame;\n}\n/**\n * This is a lightweight version of the `leaveView` which is needed by the DI system.\n *\n * NOTE: this function is an alias so that we can change the type of the function to have `void`\n * return type.\n */\nconst leaveDI = leaveViewLight;\n/**\n * Leave the current `LView`\n *\n * This pops the `LFrame` with the associated `LView` from the stack.\n *\n * IMPORTANT: We must zero out the `LFrame` values here otherwise they will be retained. This is\n * because for performance reasons we don't release `LFrame` but rather keep it for next use.\n */\nfunction leaveView() {\n const oldLFrame = leaveViewLight();\n oldLFrame.isParent = true;\n oldLFrame.tView = null;\n oldLFrame.selectedIndex = -1;\n oldLFrame.contextLView = null;\n oldLFrame.elementDepthCount = 0;\n oldLFrame.currentDirectiveIndex = -1;\n oldLFrame.currentNamespace = null;\n oldLFrame.bindingRootIndex = -1;\n oldLFrame.bindingIndex = -1;\n oldLFrame.currentQueryIndex = 0;\n}\nfunction nextContextImpl(level) {\n const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView);\n return contextLView[CONTEXT];\n}\n/**\n * Gets the currently selected element index.\n *\n * Used with {@link property} instruction (and more in the future) to identify the index in the\n * current `LView` to act on.\n */\nfunction getSelectedIndex() {\n return instructionState.lFrame.selectedIndex;\n}\n/**\n * Sets the most recent index passed to {@link select}\n *\n * Used with {@link property} instruction (and more in the future) to identify the index in the\n * current `LView` to act on.\n *\n * (Note that if an \"exit function\" was set earlier (via `setElementExitFn()`) then that will be\n * run if and when the provided `index` value is different from the current selected index value.)\n */\nfunction setSelectedIndex(index) {\n ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Index must be past HEADER_OFFSET (or -1).');\n ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, \"Can't set index passed end of LView\");\n instructionState.lFrame.selectedIndex = index;\n}\n/**\n * Gets the `tNode` that represents currently selected element.\n */\nfunction getSelectedTNode() {\n const lFrame = instructionState.lFrame;\n return getTNode(lFrame.tView, lFrame.selectedIndex);\n}\n/**\n * Sets the namespace used to create elements to `'http://www.w3.org/2000/svg'` in global state.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceSVG() {\n instructionState.lFrame.currentNamespace = SVG_NAMESPACE;\n}\n/**\n * Sets the namespace used to create elements to `'http://www.w3.org/1998/MathML/'` in global state.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceMathML() {\n instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;\n}\n/**\n * Sets the namespace used to create elements to `null`, which forces element creation to use\n * `createElement` rather than `createElementNS`.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}\n/**\n * Sets the namespace used to create elements to `null`, which forces element creation to use\n * `createElement` rather than `createElementNS`.\n */\nfunction namespaceHTMLInternal() {\n instructionState.lFrame.currentNamespace = null;\n}\nfunction getNamespace$1() {\n return instructionState.lFrame.currentNamespace;\n}\nlet _wasLastNodeCreated = true;\n/**\n * Retrieves a global flag that indicates whether the most recent DOM node\n * was created or hydrated.\n */\nfunction wasLastNodeCreated() {\n return _wasLastNodeCreated;\n}\n/**\n * Sets a global flag to indicate whether the most recent DOM node\n * was created or hydrated.\n */\nfunction lastNodeWasCreated(flag) {\n _wasLastNodeCreated = flag;\n}\n\n/**\n * Adds all directive lifecycle hooks from the given `DirectiveDef` to the given `TView`.\n *\n * Must be run *only* on the first template pass.\n *\n * Sets up the pre-order hooks on the provided `tView`,\n * see {@link HookData} for details about the data structure.\n *\n * @param directiveIndex The index of the directive in LView\n * @param directiveDef The definition containing the hooks to setup in tView\n * @param tView The current TView\n */\nfunction registerPreOrderHooks(directiveIndex, directiveDef, tView) {\n ngDevMode && assertFirstCreatePass(tView);\n const {\n ngOnChanges,\n ngOnInit,\n ngDoCheck\n } = directiveDef.type.prototype;\n if (ngOnChanges) {\n const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);\n (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges);\n (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges);\n }\n if (ngOnInit) {\n (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit);\n }\n if (ngDoCheck) {\n (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck);\n (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck);\n }\n}\n/**\n *\n * Loops through the directives on the provided `tNode` and queues hooks to be\n * run that are not initialization hooks.\n *\n * Should be executed during `elementEnd()` and similar to\n * preserve hook execution order. Content, view, and destroy hooks for projected\n * components and directives must be called *before* their hosts.\n *\n * Sets up the content, view, and destroy hooks on the provided `tView`,\n * see {@link HookData} for details about the data structure.\n *\n * NOTE: This does not set up `onChanges`, `onInit` or `doCheck`, those are set up\n * separately at `elementStart`.\n *\n * @param tView The current TView\n * @param tNode The TNode whose directives are to be searched for hooks to queue\n */\nfunction registerPostOrderHooks(tView, tNode) {\n ngDevMode && assertFirstCreatePass(tView);\n // It's necessary to loop through the directives at elementEnd() (rather than processing in\n // directiveCreate) so we can preserve the current hook order. Content, view, and destroy\n // hooks for projected components and directives must be called *before* their hosts.\n for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {\n const directiveDef = tView.data[i];\n ngDevMode && assertDefined(directiveDef, 'Expecting DirectiveDef');\n const lifecycleHooks = directiveDef.type.prototype;\n const {\n ngAfterContentInit,\n ngAfterContentChecked,\n ngAfterViewInit,\n ngAfterViewChecked,\n ngOnDestroy\n } = lifecycleHooks;\n if (ngAfterContentInit) {\n (tView.contentHooks ??= []).push(-i, ngAfterContentInit);\n }\n if (ngAfterContentChecked) {\n (tView.contentHooks ??= []).push(i, ngAfterContentChecked);\n (tView.contentCheckHooks ??= []).push(i, ngAfterContentChecked);\n }\n if (ngAfterViewInit) {\n (tView.viewHooks ??= []).push(-i, ngAfterViewInit);\n }\n if (ngAfterViewChecked) {\n (tView.viewHooks ??= []).push(i, ngAfterViewChecked);\n (tView.viewCheckHooks ??= []).push(i, ngAfterViewChecked);\n }\n if (ngOnDestroy != null) {\n (tView.destroyHooks ??= []).push(i, ngOnDestroy);\n }\n }\n}\n/**\n * Executing hooks requires complex logic as we need to deal with 2 constraints.\n *\n * 1. Init hooks (ngOnInit, ngAfterContentInit, ngAfterViewInit) must all be executed once and only\n * once, across many change detection cycles. This must be true even if some hooks throw, or if\n * some recursively trigger a change detection cycle.\n * To solve that, it is required to track the state of the execution of these init hooks.\n * This is done by storing and maintaining flags in the view: the {@link InitPhaseState},\n * and the index within that phase. They can be seen as a cursor in the following structure:\n * [[onInit1, onInit2], [afterContentInit1], [afterViewInit1, afterViewInit2, afterViewInit3]]\n * They are stored as flags in LView[FLAGS].\n *\n * 2. Pre-order hooks can be executed in batches, because of the select instruction.\n * To be able to pause and resume their execution, we also need some state about the hook's array\n * that is being processed:\n * - the index of the next hook to be executed\n * - the number of init hooks already found in the processed part of the array\n * They are stored as flags in LView[PREORDER_HOOK_FLAGS].\n */\n/**\n * Executes pre-order check hooks ( OnChanges, DoChanges) given a view where all the init hooks were\n * executed once. This is a light version of executeInitAndCheckPreOrderHooks where we can skip read\n * / write of the init-hooks related flags.\n * @param lView The LView where hooks are defined\n * @param hooks Hooks to be run\n * @param nodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction executeCheckHooks(lView, hooks, nodeIndex) {\n callHooks(lView, hooks, 3 /* InitPhaseState.InitPhaseCompleted */, nodeIndex);\n}\n/**\n * Executes post-order init and check hooks (one of AfterContentInit, AfterContentChecked,\n * AfterViewInit, AfterViewChecked) given a view where there are pending init hooks to be executed.\n * @param lView The LView where hooks are defined\n * @param hooks Hooks to be run\n * @param initPhase A phase for which hooks should be run\n * @param nodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) {\n ngDevMode && assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init pre-order hooks should not be called more than once');\n if ((lView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n callHooks(lView, hooks, initPhase, nodeIndex);\n }\n}\nfunction incrementInitPhaseFlags(lView, initPhase) {\n ngDevMode && assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init hooks phase should not be incremented after all init hooks have been run.');\n let flags = lView[FLAGS];\n if ((flags & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n flags &= 16383 /* LViewFlags.IndexWithinInitPhaseReset */;\n flags += 1 /* LViewFlags.InitPhaseStateIncrementer */;\n lView[FLAGS] = flags;\n }\n}\n/**\n * Calls lifecycle hooks with their contexts, skipping init hooks if it's not\n * the first LView pass\n *\n * @param currentView The current view\n * @param arr The array in which the hooks are found\n * @param initPhaseState the current state of the init phase\n * @param currentNodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode && assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ? currentView[PREORDER_HOOK_FLAGS] & 65535 /* PreOrderHookFlags.IndexOfTheNextPreOrderHookMaskMask */ : 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n } else {\n const isInitHook = arr[i] < 0;\n if (isInitHook) {\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* PreOrderHookFlags.NumberOfInitHooksCalledIncrementer */;\n }\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* PreOrderHookFlags.NumberOfInitHooksCalledMask */) + i + 2;\n }\n i++;\n }\n }\n}\n/**\n * Executes a single lifecycle hook, making sure that:\n * - it is called in the non-reactive context;\n * - profiling data are registered.\n */\nfunction callHookInternal(directive, hook) {\n profiler(4 /* ProfilerEvent.LifecycleHookStart */, directive, hook);\n const prevConsumer = setActiveConsumer$1(null);\n try {\n hook.call(directive);\n } finally {\n setActiveConsumer$1(prevConsumer);\n profiler(5 /* ProfilerEvent.LifecycleHookEnd */, directive, hook);\n }\n}\n/**\n * Execute one hook against the current `LView`.\n *\n * @param currentView The current view\n * @param initPhaseState the current state of the init phase\n * @param arr The array in which the hooks are found\n * @param i The current index within the hook data array\n */\nfunction callHook(currentView, initPhase, arr, i) {\n const isInitHook = arr[i] < 0;\n const hook = arr[i + 1];\n const directiveIndex = isInitHook ? -arr[i] : arr[i];\n const directive = currentView[directiveIndex];\n if (isInitHook) {\n const indexWithintInitPhase = currentView[FLAGS] >> 14 /* LViewFlags.IndexWithinInitPhaseShift */;\n // The init phase state must be always checked here as it may have been recursively updated.\n if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 /* PreOrderHookFlags.NumberOfInitHooksCalledShift */ && (currentView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n currentView[FLAGS] += 16384 /* LViewFlags.IndexWithinInitPhaseIncrementer */;\n callHookInternal(directive, hook);\n }\n } else {\n callHookInternal(directive, hook);\n }\n}\nconst NO_PARENT_INJECTOR = -1;\n/**\n * Each injector is saved in 9 contiguous slots in `LView` and 9 contiguous slots in\n * `TView.data`. This allows us to store information about the current node's tokens (which\n * can be shared in `TView`) as well as the tokens of its ancestor nodes (which cannot be\n * shared, so they live in `LView`).\n *\n * Each of these slots (aside from the last slot) contains a bloom filter. This bloom filter\n * determines whether a directive is available on the associated node or not. This prevents us\n * from searching the directives array at this level unless it's probable the directive is in it.\n *\n * See: https://en.wikipedia.org/wiki/Bloom_filter for more about bloom filters.\n *\n * Because all injectors have been flattened into `LView` and `TViewData`, they cannot typed\n * using interfaces as they were previously. The start index of each `LInjector` and `TInjector`\n * will differ based on where it is flattened into the main array, so it's not possible to know\n * the indices ahead of time and save their types here. The interfaces are still included here\n * for documentation purposes.\n *\n * export interface LInjector extends Array {\n *\n * // Cumulative bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)\n * [0]: number;\n *\n * // Cumulative bloom for directive IDs 32-63\n * [1]: number;\n *\n * // Cumulative bloom for directive IDs 64-95\n * [2]: number;\n *\n * // Cumulative bloom for directive IDs 96-127\n * [3]: number;\n *\n * // Cumulative bloom for directive IDs 128-159\n * [4]: number;\n *\n * // Cumulative bloom for directive IDs 160 - 191\n * [5]: number;\n *\n * // Cumulative bloom for directive IDs 192 - 223\n * [6]: number;\n *\n * // Cumulative bloom for directive IDs 224 - 255\n * [7]: number;\n *\n * // We need to store a reference to the injector's parent so DI can keep looking up\n * // the injector tree until it finds the dependency it's looking for.\n * [PARENT_INJECTOR]: number;\n * }\n *\n * export interface TInjector extends Array {\n *\n * // Shared node bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)\n * [0]: number;\n *\n * // Shared node bloom for directive IDs 32-63\n * [1]: number;\n *\n * // Shared node bloom for directive IDs 64-95\n * [2]: number;\n *\n * // Shared node bloom for directive IDs 96-127\n * [3]: number;\n *\n * // Shared node bloom for directive IDs 128-159\n * [4]: number;\n *\n * // Shared node bloom for directive IDs 160 - 191\n * [5]: number;\n *\n * // Shared node bloom for directive IDs 192 - 223\n * [6]: number;\n *\n * // Shared node bloom for directive IDs 224 - 255\n * [7]: number;\n *\n * // Necessary to find directive indices for a particular node.\n * [TNODE]: TElementNode|TElementContainerNode|TContainerNode;\n * }\n */\n/**\n * Factory for creating instances of injectors in the NodeInjector.\n *\n * This factory is complicated by the fact that it can resolve `multi` factories as well.\n *\n * NOTE: Some of the fields are optional which means that this class has two hidden classes.\n * - One without `multi` support (most common)\n * - One with `multi` values, (rare).\n *\n * Since VMs can cache up to 4 inline hidden classes this is OK.\n *\n * - Single factory: Only `resolving` and `factory` is defined.\n * - `providers` factory: `componentProviders` is a number and `index = -1`.\n * - `viewProviders` factory: `componentProviders` is a number and `index` points to `providers`.\n */\nclass NodeInjectorFactory {\n factory;\n /**\n * The inject implementation to be activated when using the factory.\n */\n injectImpl;\n /**\n * Marker set to true during factory invocation to see if we get into recursive loop.\n * Recursive loop causes an error to be displayed.\n */\n resolving = false;\n /**\n * Marks that the token can see other Tokens declared in `viewProviders` on the same node.\n */\n canSeeViewProviders;\n /**\n * An array of factories to use in case of `multi` provider.\n */\n multi;\n /**\n * Number of `multi`-providers which belong to the component.\n *\n * This is needed because when multiple components and directives declare the `multi` provider\n * they have to be concatenated in the correct order.\n *\n * Example:\n *\n * If we have a component and directive active an a single element as declared here\n * ```\n * component:\n * providers: [ {provide: String, useValue: 'component', multi: true} ],\n * viewProviders: [ {provide: String, useValue: 'componentView', multi: true} ],\n *\n * directive:\n * providers: [ {provide: String, useValue: 'directive', multi: true} ],\n * ```\n *\n * Then the expected results are:\n *\n * ```\n * providers: ['component', 'directive']\n * viewProviders: ['component', 'componentView', 'directive']\n * ```\n *\n * The way to think about it is that the `viewProviders` have been inserted after the component\n * but before the directives, which is why we need to know how many `multi`s have been declared by\n * the component.\n */\n componentProviders;\n /**\n * Current index of the Factory in the `data`. Needed for `viewProviders` and `providers` merging.\n * See `providerFactory`.\n */\n index;\n /**\n * Because the same `multi` provider can be declared in `providers` and `viewProviders` it is\n * possible for `viewProviders` to shadow the `providers`. For this reason we store the\n * `provideFactory` of the `providers` so that `providers` can be extended with `viewProviders`.\n *\n * Example:\n *\n * Given:\n * ```\n * providers: [ {provide: String, useValue: 'all', multi: true} ],\n * viewProviders: [ {provide: String, useValue: 'viewOnly', multi: true} ],\n * ```\n *\n * We have to return `['all']` in case of content injection, but `['all', 'viewOnly']` in case\n * of view injection. We further have to make sure that the shared instances (in our case\n * `all`) are the exact same instance in both the content as well as the view injection. (We\n * have to make sure that we don't double instantiate.) For this reason the `viewProviders`\n * `Factory` has a pointer to the shadowed `providers` factory so that it can instantiate the\n * `providers` (`['all']`) and then extend it with `viewProviders` (`['all'] + ['viewOnly'] =\n * ['all', 'viewOnly']`).\n */\n providerFactory;\n constructor(\n /**\n * Factory to invoke in order to create a new instance.\n */\n factory,\n /**\n * Set to `true` if the token is declared in `viewProviders` (or if it is component).\n */\n isViewProvider, injectImplementation) {\n this.factory = factory;\n ngDevMode && assertDefined(factory, 'Factory not specified');\n ngDevMode && assertEqual(typeof factory, 'function', 'Expected factory function.');\n this.canSeeViewProviders = isViewProvider;\n this.injectImpl = injectImplementation;\n }\n}\nfunction isFactory(obj) {\n return obj instanceof NodeInjectorFactory;\n}\n\n/**\n * Converts `TNodeType` into human readable text.\n * Make sure this matches with `TNodeType`\n */\nfunction toTNodeTypeAsString(tNodeType) {\n let text = '';\n tNodeType & 1 /* TNodeType.Text */ && (text += '|Text');\n tNodeType & 2 /* TNodeType.Element */ && (text += '|Element');\n tNodeType & 4 /* TNodeType.Container */ && (text += '|Container');\n tNodeType & 8 /* TNodeType.ElementContainer */ && (text += '|ElementContainer');\n tNodeType & 16 /* TNodeType.Projection */ && (text += '|Projection');\n tNodeType & 32 /* TNodeType.Icu */ && (text += '|IcuContainer');\n tNodeType & 64 /* TNodeType.Placeholder */ && (text += '|Placeholder');\n tNodeType & 128 /* TNodeType.LetDeclaration */ && (text += '|LetDeclaration');\n return text.length > 0 ? text.substring(1) : text;\n}\n/**\n * Helper function to detect if a given value matches a `TNode` shape.\n *\n * The logic uses the `insertBeforeIndex` and its possible values as\n * a way to differentiate a TNode shape from other types of objects\n * within the `TView.data`. This is not a perfect check, but it can\n * be a reasonable differentiator, since we control the shapes of objects\n * within `TView.data`.\n */\nfunction isTNodeShape(value) {\n return value != null && typeof value === 'object' && (value.insertBeforeIndex === null || typeof value.insertBeforeIndex === 'number' || Array.isArray(value.insertBeforeIndex));\n}\nfunction isLetDeclaration(tNode) {\n return !!(tNode.type & 128 /* TNodeType.LetDeclaration */);\n}\n/**\n * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.\n *\n * ```html\n *
          \n * ```\n * and\n * ```ts\n * @Directive({\n * })\n * class MyDirective {\n * @Input()\n * class: string;\n * }\n * ```\n *\n * In the above case it is necessary to write the reconciled styling information into the\n * directive's input.\n *\n * @param tNode\n */\nfunction hasClassInput(tNode) {\n return (tNode.flags & 8 /* TNodeFlags.hasClassInput */) !== 0;\n}\n/**\n * Returns `true` if the `TNode` has a directive which has `@Input()` for `style` binding.\n *\n * ```html\n *
          \n * ```\n * and\n * ```ts\n * @Directive({\n * })\n * class MyDirective {\n * @Input()\n * class: string;\n * }\n * ```\n *\n * In the above case it is necessary to write the reconciled styling information into the\n * directive's input.\n *\n * @param tNode\n */\nfunction hasStyleInput(tNode) {\n return (tNode.flags & 16 /* TNodeFlags.hasStyleInput */) !== 0;\n}\nfunction assertTNodeType(tNode, expectedTypes, message) {\n assertDefined(tNode, 'should be called with a TNode');\n if ((tNode.type & expectedTypes) === 0) {\n throwError(message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`);\n }\n}\nfunction assertPureTNodeType(type) {\n if (!(type === 2 /* TNodeType.Element */ || type === 1 /* TNodeType.Text */ || type === 4 /* TNodeType.Container */ || type === 8 /* TNodeType.ElementContainer */ || type === 32 /* TNodeType.Icu */ || type === 16 /* TNodeType.Projection */ || type === 64 /* TNodeType.Placeholder */ || type === 128 /* TNodeType.LetDeclaration */)) {\n throwError(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`);\n }\n}\n\n/**\n * Assigns all attribute values to the provided element via the inferred renderer.\n *\n * This function accepts two forms of attribute entries:\n *\n * default: (key, value):\n * attrs = [key1, value1, key2, value2]\n *\n * namespaced: (NAMESPACE_MARKER, uri, name, value)\n * attrs = [NAMESPACE_MARKER, uri, name, value, NAMESPACE_MARKER, uri, name, value]\n *\n * The `attrs` array can contain a mix of both the default and namespaced entries.\n * The \"default\" values are set without a marker, but if the function comes across\n * a marker value then it will attempt to set a namespaced value. If the marker is\n * not of a namespaced value then the function will quit and return the index value\n * where it stopped during the iteration of the attrs array.\n *\n * See [AttributeMarker] to understand what the namespace marker value is.\n *\n * Note that this instruction does not support assigning style and class values to\n * an element. See `elementStart` and `elementHostAttrs` to learn how styling values\n * are applied to an element.\n * @param renderer The renderer to be used\n * @param native The element that the attributes will be assigned to\n * @param attrs The attribute array of values that will be assigned to the element\n * @returns the index value that was last accessed in the attributes array\n */\nfunction setUpAttributes(renderer, native, attrs) {\n let i = 0;\n while (i < attrs.length) {\n const value = attrs[i];\n if (typeof value === 'number') {\n // only namespaces are supported. Other value types (such as style/class\n // entries) are not supported in this function.\n if (value !== 0 /* AttributeMarker.NamespaceURI */) {\n break;\n }\n // we just landed on the marker value ... therefore\n // we should skip to the next entry\n i++;\n const namespaceURI = attrs[i++];\n const attrName = attrs[i++];\n const attrVal = attrs[i++];\n ngDevMode && ngDevMode.rendererSetAttribute++;\n renderer.setAttribute(native, attrName, attrVal, namespaceURI);\n } else {\n // attrName is string;\n const attrName = value;\n const attrVal = attrs[++i];\n // Standard attributes\n ngDevMode && ngDevMode.rendererSetAttribute++;\n if (isAnimationProp(attrName)) {\n renderer.setProperty(native, attrName, attrVal);\n } else {\n renderer.setAttribute(native, attrName, attrVal);\n }\n i++;\n }\n }\n // another piece of code may iterate over the same attributes array. Therefore\n // it may be helpful to return the exact spot where the attributes array exited\n // whether by running into an unsupported marker or if all the static values were\n // iterated over.\n return i;\n}\n/**\n * Test whether the given value is a marker that indicates that the following\n * attribute values in a `TAttributes` array are only the names of attributes,\n * and not name-value pairs.\n * @param marker The attribute marker to test.\n * @returns true if the marker is a \"name-only\" marker (e.g. `Bindings`, `Template` or `I18n`).\n */\nfunction isNameOnlyAttributeMarker(marker) {\n return marker === 3 /* AttributeMarker.Bindings */ || marker === 4 /* AttributeMarker.Template */ || marker === 6 /* AttributeMarker.I18n */;\n}\nfunction isAnimationProp(name) {\n // Perf note: accessing charCodeAt to check for the first character of a string is faster as\n // compared to accessing a character at index 0 (ex. name[0]). The main reason for this is that\n // charCodeAt doesn't allocate memory to return a substring.\n return name.charCodeAt(0) === 64 /* CharCode.AT_SIGN */;\n}\n/**\n * Merges `src` `TAttributes` into `dst` `TAttributes` removing any duplicates in the process.\n *\n * This merge function keeps the order of attrs same.\n *\n * @param dst Location of where the merged `TAttributes` should end up.\n * @param src `TAttributes` which should be appended to `dst`\n */\nfunction mergeHostAttrs(dst, src) {\n if (src === null || src.length === 0) {\n // do nothing\n } else if (dst === null || dst.length === 0) {\n // We have source, but dst is empty, just make a copy.\n dst = src.slice();\n } else {\n let srcMarker = -1 /* AttributeMarker.ImplicitAttributes */;\n for (let i = 0; i < src.length; i++) {\n const item = src[i];\n if (typeof item === 'number') {\n srcMarker = item;\n } else {\n if (srcMarker === 0 /* AttributeMarker.NamespaceURI */) {\n // Case where we need to consume `key1`, `key2`, `value` items.\n } else if (srcMarker === -1 /* AttributeMarker.ImplicitAttributes */ || srcMarker === 2 /* AttributeMarker.Styles */) {\n // Case where we have to consume `key1` and `value` only.\n mergeHostAttribute(dst, srcMarker, item, null, src[++i]);\n } else {\n // Case where we have to consume `key1` only.\n mergeHostAttribute(dst, srcMarker, item, null, null);\n }\n }\n }\n }\n return dst;\n}\n/**\n * Append `key`/`value` to existing `TAttributes` taking region marker and duplicates into account.\n *\n * @param dst `TAttributes` to append to.\n * @param marker Region where the `key`/`value` should be added.\n * @param key1 Key to add to `TAttributes`\n * @param key2 Key to add to `TAttributes` (in case of `AttributeMarker.NamespaceURI`)\n * @param value Value to add or to overwrite to `TAttributes` Only used if `marker` is not Class.\n */\nfunction mergeHostAttribute(dst, marker, key1, key2, value) {\n let i = 0;\n // Assume that new markers will be inserted at the end.\n let markerInsertPosition = dst.length;\n // scan until correct type.\n if (marker === -1 /* AttributeMarker.ImplicitAttributes */) {\n markerInsertPosition = -1;\n } else {\n while (i < dst.length) {\n const dstValue = dst[i++];\n if (typeof dstValue === 'number') {\n if (dstValue === marker) {\n markerInsertPosition = -1;\n break;\n } else if (dstValue > marker) {\n // We need to save this as we want the markers to be inserted in specific order.\n markerInsertPosition = i - 1;\n break;\n }\n }\n }\n }\n // search until you find place of insertion\n while (i < dst.length) {\n const item = dst[i];\n if (typeof item === 'number') {\n // since `i` started as the index after the marker, we did not find it if we are at the next\n // marker\n break;\n } else if (item === key1) {\n // We already have same token\n if (key2 === null) {\n if (value !== null) {\n dst[i + 1] = value;\n }\n return;\n } else if (key2 === dst[i + 1]) {\n dst[i + 2] = value;\n return;\n }\n }\n // Increment counter.\n i++;\n if (key2 !== null) i++;\n if (value !== null) i++;\n }\n // insert at location.\n if (markerInsertPosition !== -1) {\n dst.splice(markerInsertPosition, 0, marker);\n i = markerInsertPosition + 1;\n }\n dst.splice(i++, 0, key1);\n if (key2 !== null) {\n dst.splice(i++, 0, key2);\n }\n if (value !== null) {\n dst.splice(i++, 0, value);\n }\n}\n\n// This default value is when checking the hierarchy for a token.\n//\n// It means both:\n// - the token is not provided by the current injector,\n// - only the element injectors should be checked (ie do not check module injectors\n//\n// mod1\n// /\n// el1 mod2\n// \\ /\n// el2\n//\n// When requesting el2.injector.get(token), we should check in the following order and return the\n// first found value:\n// - el2.injector.get(token, default)\n// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module\n// - mod2.injector.get(token, default)\nconst NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};\n\n/**\n * Injector that looks up a value using a specific injector, before falling back to the module\n * injector. Used primarily when creating components or embedded views dynamically.\n */\nclass ChainedInjector {\n injector;\n parentInjector;\n constructor(injector, parentInjector) {\n this.injector = injector;\n this.parentInjector = parentInjector;\n }\n get(token, notFoundValue, flags) {\n flags = convertToBitFlags(flags);\n const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);\n if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {\n // Return the value from the root element injector when\n // - it provides it\n // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)\n // - the module injector should not be checked\n // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)\n return value;\n }\n return this.parentInjector.get(token, notFoundValue, flags);\n }\n}\n\n/// Parent Injector Utils ///////////////////////////////////////////////////////////////\nfunction hasParentInjector(parentLocation) {\n return parentLocation !== NO_PARENT_INJECTOR;\n}\nfunction getParentInjectorIndex(parentLocation) {\n if (ngDevMode) {\n assertNumber(parentLocation, 'Number expected');\n assertNotEqual(parentLocation, -1, 'Not a valid state.');\n const parentInjectorIndex = parentLocation & 32767 /* RelativeInjectorLocationFlags.InjectorIndexMask */;\n assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, 'Parent injector must be pointing past HEADER_OFFSET.');\n }\n return parentLocation & 32767 /* RelativeInjectorLocationFlags.InjectorIndexMask */;\n}\nfunction getParentInjectorViewOffset(parentLocation) {\n return parentLocation >> 16 /* RelativeInjectorLocationFlags.ViewOffsetShift */;\n}\n/**\n * Unwraps a parent injector location number to find the view offset from the current injector,\n * then walks up the declaration view tree until the view is found that contains the parent\n * injector.\n *\n * @param location The location of the parent injector, which contains the view offset\n * @param startView The LView instance from which to start walking up the view tree\n * @returns The LView instance that contains the parent injector\n */\nfunction getParentInjectorView(location, startView) {\n let viewOffset = getParentInjectorViewOffset(location);\n let parentView = startView;\n // For most cases, the parent injector can be found on the host node (e.g. for component\n // or container), but we must keep the loop here to support the rarer case of deeply nested\n // tags or inline views, where the parent injector might live many views\n // above the child injector.\n while (viewOffset > 0) {\n parentView = parentView[DECLARATION_VIEW];\n viewOffset--;\n }\n return parentView;\n}\n/**\n * Detects whether an injector is an instance of a `ChainedInjector`,\n * created based on the `OutletInjector`.\n */\nfunction isRouterOutletInjector(currentInjector) {\n return currentInjector instanceof ChainedInjector && typeof currentInjector.injector.__ngOutletInjector === 'function';\n}\n\n/**\n * Defines if the call to `inject` should include `viewProviders` in its resolution.\n *\n * This is set to true when we try to instantiate a component. This value is reset in\n * `getNodeInjectable` to a value which matches the declaration location of the token about to be\n * instantiated. This is done so that if we are injecting a token which was declared outside of\n * `viewProviders` we don't accidentally pull `viewProviders` in.\n *\n * Example:\n *\n * ```ts\n * @Injectable()\n * class MyService {\n * constructor(public value: String) {}\n * }\n *\n * @Component({\n * providers: [\n * MyService,\n * {provide: String, value: 'providers' }\n * ]\n * viewProviders: [\n * {provide: String, value: 'viewProviders'}\n * ]\n * })\n * class MyComponent {\n * constructor(myService: MyService, value: String) {\n * // We expect that Component can see into `viewProviders`.\n * expect(value).toEqual('viewProviders');\n * // `MyService` was not declared in `viewProviders` hence it can't see it.\n * expect(myService.value).toEqual('providers');\n * }\n * }\n *\n * ```\n */\nlet includeViewProviders = true;\nfunction setIncludeViewProviders(v) {\n const oldValue = includeViewProviders;\n includeViewProviders = v;\n return oldValue;\n}\n/**\n * The number of slots in each bloom filter (used by DI). The larger this number, the fewer\n * directives that will share slots, and thus, the fewer false positives when checking for\n * the existence of a directive.\n */\nconst BLOOM_SIZE = 256;\nconst BLOOM_MASK = BLOOM_SIZE - 1;\n/**\n * The number of bits that is represented by a single bloom bucket. JS bit operations are 32 bits,\n * so each bucket represents 32 distinct tokens which accounts for log2(32) = 5 bits of a bloom hash\n * number.\n */\nconst BLOOM_BUCKET_BITS = 5;\n/** Counter used to generate unique IDs for directives. */\nlet nextNgElementId = 0;\n/** Value used when something wasn't found by an injector. */\nconst NOT_FOUND = {};\n/**\n * Registers this directive as present in its node's injector by flipping the directive's\n * corresponding bit in the injector's bloom filter.\n *\n * @param injectorIndex The index of the node injector where this token should be registered\n * @param tView The TView for the injector's bloom filters\n * @param type The directive token to register\n */\nfunction bloomAdd(injectorIndex, tView, type) {\n ngDevMode && assertEqual(tView.firstCreatePass, true, 'expected firstCreatePass to be true');\n let id;\n if (typeof type === 'string') {\n id = type.charCodeAt(0) || 0;\n } else if (type.hasOwnProperty(NG_ELEMENT_ID)) {\n id = type[NG_ELEMENT_ID];\n }\n // Set a unique ID on the directive type, so if something tries to inject the directive,\n // we can easily retrieve the ID and hash it into the bloom bit that should be checked.\n if (id == null) {\n id = type[NG_ELEMENT_ID] = nextNgElementId++;\n }\n // We only have BLOOM_SIZE (256) slots in our bloom filter (8 buckets * 32 bits each),\n // so all unique IDs must be modulo-ed into a number from 0 - 255 to fit into the filter.\n const bloomHash = id & BLOOM_MASK;\n // Create a mask that targets the specific bit associated with the directive.\n // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding\n // to bit positions 0 - 31 in a 32 bit integer.\n const mask = 1 << bloomHash;\n // Each bloom bucket in `tData` represents `BLOOM_BUCKET_BITS` number of bits of `bloomHash`.\n // Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset that the mask\n // should be written to.\n tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask;\n}\n/**\n * Creates (or gets an existing) injector for a given element or container.\n *\n * @param tNode for which an injector should be retrieved / created.\n * @param lView View where the node is stored\n * @returns Node injector\n */\nfunction getOrCreateNodeInjectorForNode(tNode, lView) {\n const existingInjectorIndex = getInjectorIndex(tNode, lView);\n if (existingInjectorIndex !== -1) {\n return existingInjectorIndex;\n }\n const tView = lView[TVIEW];\n if (tView.firstCreatePass) {\n tNode.injectorIndex = lView.length;\n insertBloom(tView.data, tNode); // foundation for node bloom\n insertBloom(lView, null); // foundation for cumulative bloom\n insertBloom(tView.blueprint, null);\n }\n const parentLoc = getParentInjectorLocation(tNode, lView);\n const injectorIndex = tNode.injectorIndex;\n // If a parent injector can't be found, its location is set to -1.\n // In that case, we don't need to set up a cumulative bloom\n if (hasParentInjector(parentLoc)) {\n const parentIndex = getParentInjectorIndex(parentLoc);\n const parentLView = getParentInjectorView(parentLoc, lView);\n const parentData = parentLView[TVIEW].data;\n // Creates a cumulative bloom filter that merges the parent's bloom filter\n // and its own cumulative bloom (which contains tokens for all ancestors)\n for (let i = 0; i < 8 /* NodeInjectorOffset.BLOOM_SIZE */; i++) {\n lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];\n }\n }\n lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */] = parentLoc;\n return injectorIndex;\n}\nfunction insertBloom(arr, footer) {\n arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);\n}\nfunction getInjectorIndex(tNode, lView) {\n if (tNode.injectorIndex === -1 ||\n // If the injector index is the same as its parent's injector index, then the index has been\n // copied down from the parent node. No injector has been created yet on this node.\n tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex ||\n // After the first template pass, the injector index might exist but the parent values\n // might not have been calculated yet for this instance\n lView[tNode.injectorIndex + 8 /* NodeInjectorOffset.PARENT */] === null) {\n return -1;\n } else {\n ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);\n return tNode.injectorIndex;\n }\n}\n/**\n * Finds the index of the parent injector, with a view offset if applicable. Used to set the\n * parent injector initially.\n *\n * @returns Returns a number that is the combination of the number of LViews that we have to go up\n * to find the LView containing the parent inject AND the index of the injector within that LView.\n */\nfunction getParentInjectorLocation(tNode, lView) {\n if (tNode.parent && tNode.parent.injectorIndex !== -1) {\n // If we have a parent `TNode` and there is an injector associated with it we are done, because\n // the parent injector is within the current `LView`.\n return tNode.parent.injectorIndex; // ViewOffset is 0\n }\n // When parent injector location is computed it may be outside of the current view. (ie it could\n // be pointing to a declared parent location). This variable stores number of declaration parents\n // we need to walk up in order to find the parent injector location.\n let declarationViewOffset = 0;\n let parentTNode = null;\n let lViewCursor = lView;\n // The parent injector is not in the current `LView`. We will have to walk the declared parent\n // `LView` hierarchy and look for it. If we walk of the top, that means that there is no parent\n // `NodeInjector`.\n while (lViewCursor !== null) {\n parentTNode = getTNodeFromLView(lViewCursor);\n if (parentTNode === null) {\n // If we have no parent, than we are done.\n return NO_PARENT_INJECTOR;\n }\n ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]);\n // Every iteration of the loop requires that we go to the declared parent.\n declarationViewOffset++;\n lViewCursor = lViewCursor[DECLARATION_VIEW];\n if (parentTNode.injectorIndex !== -1) {\n // We found a NodeInjector which points to something.\n return parentTNode.injectorIndex | declarationViewOffset << 16 /* RelativeInjectorLocationFlags.ViewOffsetShift */;\n }\n }\n return NO_PARENT_INJECTOR;\n}\n/**\n * Makes a type or an injection token public to the DI system by adding it to an\n * injector's bloom filter.\n *\n * @param di The node injector in which a directive will be added\n * @param token The type or the injection token to be made public\n */\nfunction diPublicInInjector(injectorIndex, tView, token) {\n bloomAdd(injectorIndex, tView, token);\n}\n/**\n * Inject static attribute value into directive constructor.\n *\n * This method is used with `factory` functions which are generated as part of\n * `defineDirective` or `defineComponent`. The method retrieves the static value\n * of an attribute. (Dynamic attributes are not supported since they are not resolved\n * at the time of injection and can change over time.)\n *\n * # Example\n * Given:\n * ```ts\n * @Component(...)\n * class MyComponent {\n * constructor(@Attribute('title') title: string) { ... }\n * }\n * ```\n * When instantiated with\n * ```html\n * \n * ```\n *\n * Then factory method generated is:\n * ```ts\n * MyComponent.ɵcmp = defineComponent({\n * factory: () => new MyComponent(injectAttribute('title'))\n * ...\n * })\n * ```\n *\n * @publicApi\n */\nfunction injectAttributeImpl(tNode, attrNameToInject) {\n ngDevMode && assertTNodeType(tNode, 12 /* TNodeType.AnyContainer */ | 3 /* TNodeType.AnyRNode */);\n ngDevMode && assertDefined(tNode, 'expecting tNode');\n if (attrNameToInject === 'class') {\n return tNode.classes;\n }\n if (attrNameToInject === 'style') {\n return tNode.styles;\n }\n const attrs = tNode.attrs;\n if (attrs) {\n const attrsLength = attrs.length;\n let i = 0;\n while (i < attrsLength) {\n const value = attrs[i];\n // If we hit a `Bindings` or `Template` marker then we are done.\n if (isNameOnlyAttributeMarker(value)) break;\n // Skip namespaced attributes\n if (value === 0 /* AttributeMarker.NamespaceURI */) {\n // we skip the next two values\n // as namespaced attributes looks like\n // [..., AttributeMarker.NamespaceURI, 'http://someuri.com/test', 'test:exist',\n // 'existValue', ...]\n i = i + 2;\n } else if (typeof value === 'number') {\n // Skip to the first value of the marked attribute.\n i++;\n while (i < attrsLength && typeof attrs[i] === 'string') {\n i++;\n }\n } else if (value === attrNameToInject) {\n return attrs[i + 1];\n } else {\n i = i + 2;\n }\n }\n }\n return null;\n}\nfunction notFoundValueOrThrow(notFoundValue, token, flags) {\n if (flags & InjectFlags.Optional || notFoundValue !== undefined) {\n return notFoundValue;\n } else {\n throwProviderNotFoundError(token, 'NodeInjector');\n }\n}\n/**\n * Returns the value associated to the given token from the ModuleInjector or throws exception\n *\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector or throws an exception\n */\nfunction lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {\n if (flags & InjectFlags.Optional && notFoundValue === undefined) {\n // This must be set or the NullInjector will throw for optional deps\n notFoundValue = null;\n }\n if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) {\n const moduleInjector = lView[INJECTOR];\n // switch to `injectInjectorOnly` implementation for module injector, since module injector\n // should not have access to Component/Directive DI scope (that may happen through\n // `directiveInject` implementation)\n const previousInjectImplementation = setInjectImplementation(undefined);\n try {\n if (moduleInjector) {\n return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional);\n } else {\n return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional);\n }\n } finally {\n setInjectImplementation(previousInjectImplementation);\n }\n }\n return notFoundValueOrThrow(notFoundValue, token, flags);\n}\n/**\n * Returns the value associated to the given token from the NodeInjectors => ModuleInjector.\n *\n * Look for the injector providing the token by walking up the node injector tree and then\n * the module injector tree.\n *\n * This function patches `token` with `__NG_ELEMENT_ID__` which contains the id for the bloom\n * filter. `-1` is reserved for injecting `Injector` (implemented by `NodeInjector`)\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, notFoundValue) {\n if (tNode !== null) {\n // If the view or any of its ancestors have an embedded\n // view injector, we have to look it up there first.\n if (lView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ &&\n // The token must be present on the current node injector when the `Self`\n // flag is set, so the lookup on embedded view injector(s) can be skipped.\n !(flags & InjectFlags.Self)) {\n const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND);\n if (embeddedInjectorValue !== NOT_FOUND) {\n return embeddedInjectorValue;\n }\n }\n // Otherwise try the node injector.\n const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND);\n if (value !== NOT_FOUND) {\n return value;\n }\n }\n // Finally, fall back to the module injector.\n return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);\n}\n/**\n * Returns the value associated to the given token from the node injector.\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) {\n const bloomHash = bloomHashBitOrFactory(token);\n // If the ID stored here is a function, this is a special object like ElementRef or TemplateRef\n // so just call the factory function to create it.\n if (typeof bloomHash === 'function') {\n if (!enterDI(lView, tNode, flags)) {\n // Failed to enter DI, try module injector instead. If a token is injected with the @Host\n // flag, the module injector is not searched for that token in Ivy.\n return flags & InjectFlags.Host ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);\n }\n try {\n let value;\n if (ngDevMode) {\n runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => {\n value = bloomHash(flags);\n if (value != null) {\n emitInstanceCreatedByInjectorEvent(value);\n }\n });\n } else {\n value = bloomHash(flags);\n }\n if (value == null && !(flags & InjectFlags.Optional)) {\n throwProviderNotFoundError(token);\n } else {\n return value;\n }\n } finally {\n leaveDI();\n }\n } else if (typeof bloomHash === 'number') {\n // A reference to the previous injector TView that was found while climbing the element\n // injector tree. This is used to know if viewProviders can be accessed on the current\n // injector.\n let previousTView = null;\n let injectorIndex = getInjectorIndex(tNode, lView);\n let parentLocation = NO_PARENT_INJECTOR;\n let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;\n // If we should skip this injector, or if there is no injector on this node, start by\n // searching the parent injector.\n if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {\n parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];\n if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) {\n injectorIndex = -1;\n } else {\n previousTView = lView[TVIEW];\n injectorIndex = getParentInjectorIndex(parentLocation);\n lView = getParentInjectorView(parentLocation, lView);\n }\n }\n // Traverse up the injector tree until we find a potential match or until we know there\n // *isn't* a match.\n while (injectorIndex !== -1) {\n ngDevMode && assertNodeInjector(lView, injectorIndex);\n // Check the current injector. If it matches, see if it contains token.\n const tView = lView[TVIEW];\n ngDevMode && assertTNodeForLView(tView.data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */], lView);\n if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {\n // At this point, we have an injector which *may* contain the token, so we step through\n // the providers and directives associated with the injector's corresponding node to get\n // the instance.\n const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);\n if (instance !== NOT_FOUND) {\n return instance;\n }\n }\n parentLocation = lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];\n if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) {\n // The def wasn't found anywhere on this node, so it was a false positive.\n // Traverse up the tree and continue searching.\n previousTView = tView;\n injectorIndex = getParentInjectorIndex(parentLocation);\n lView = getParentInjectorView(parentLocation, lView);\n } else {\n // If we should not search parent OR If the ancestor bloom filter value does not have the\n // bit corresponding to the directive we can give up on traversing up to find the specific\n // injector.\n injectorIndex = -1;\n }\n }\n }\n return notFoundValue;\n}\nfunction searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {\n const currentTView = lView[TVIEW];\n const tNode = currentTView.data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */];\n // First, we need to determine if view providers can be accessed by the starting element.\n // There are two possibilities\n const canAccessViewProviders = previousTView == null ?\n // 1) This is the first invocation `previousTView == null` which means that we are at the\n // `TNode` of where injector is starting to look. In such a case the only time we are allowed\n // to look into the ViewProviders is if:\n // - we are on a component\n // - AND the injector set `includeViewProviders` to true (implying that the token can see\n // ViewProviders because it is the Component or a Service which itself was declared in\n // ViewProviders)\n isComponentHost(tNode) && includeViewProviders :\n // 2) `previousTView != null` which means that we are now walking across the parent nodes.\n // In such a case we are only allowed to look into the ViewProviders if:\n // - We just crossed from child View to Parent View `previousTView != currentTView`\n // - AND the parent TNode is an Element.\n // This means that we just came from the Component's View and therefore are allowed to see\n // into the ViewProviders.\n previousTView != currentTView && (tNode.type & 3 /* TNodeType.AnyRNode */) !== 0;\n // This special case happens when there is a @host on the inject and when we are searching\n // on the host element node.\n const isHostSpecialCase = flags & InjectFlags.Host && hostTElementNode === tNode;\n const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);\n if (injectableIdx !== null) {\n return getNodeInjectable(lView, currentTView, injectableIdx, tNode);\n } else {\n return NOT_FOUND;\n }\n}\n/**\n * Searches for the given token among the node's directives and providers.\n *\n * @param tNode TNode on which directives are present.\n * @param tView The tView we are currently processing\n * @param token Provider token or type of a directive to look for.\n * @param canAccessViewProviders Whether view providers should be considered.\n * @param isHostSpecialCase Whether the host special case applies.\n * @returns Index of a found directive or provider, or null when none found.\n */\nfunction locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {\n const nodeProviderIndexes = tNode.providerIndexes;\n const tInjectables = tView.data;\n const injectablesStart = nodeProviderIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;\n const directivesStart = tNode.directiveStart;\n const directiveEnd = tNode.directiveEnd;\n const cptViewProvidersCount = nodeProviderIndexes >> 20 /* TNodeProviderIndexes.CptViewProvidersCountShift */;\n const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;\n // When the host special case applies, only the viewProviders and the component are visible\n const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;\n for (let i = startingIndex; i < endIndex; i++) {\n const providerTokenOrDef = tInjectables[i];\n if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && providerTokenOrDef.type === token) {\n return i;\n }\n }\n if (isHostSpecialCase) {\n const dirDef = tInjectables[directivesStart];\n if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {\n return directivesStart;\n }\n }\n return null;\n}\n/**\n * Retrieve or instantiate the injectable from the `LView` at particular `index`.\n *\n * This function checks to see if the value has already been instantiated and if so returns the\n * cached `injectable`. Otherwise if it detects that the value is still a factory it\n * instantiates the `injectable` and caches the value.\n */\nfunction getNodeInjectable(lView, tView, index, tNode) {\n let value = lView[index];\n const tData = tView.data;\n if (isFactory(value)) {\n const factory = value;\n if (factory.resolving) {\n throwCyclicDependencyError(stringifyForError(tData[index]));\n }\n const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);\n factory.resolving = true;\n let prevInjectContext;\n if (ngDevMode) {\n // tData indexes mirror the concrete instances in its corresponding LView.\n // lView[index] here is either the injectable instace itself or a factory,\n // therefore tData[index] is the constructor of that injectable or a\n // definition object that contains the constructor in a `.type` field.\n const token = tData[index].type || tData[index];\n const injector = new NodeInjector(tNode, lView);\n prevInjectContext = setInjectorProfilerContext({\n injector,\n token\n });\n }\n const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;\n const success = enterDI(lView, tNode, InjectFlags.Default);\n ngDevMode && assertEqual(success, true, \"Because flags do not contain `SkipSelf' we expect this to always succeed.\");\n try {\n value = lView[index] = factory.factory(undefined, tData, lView, tNode);\n ngDevMode && emitInstanceCreatedByInjectorEvent(value);\n // This code path is hit for both directives and providers.\n // For perf reasons, we want to avoid searching for hooks on providers.\n // It does no harm to try (the hooks just won't exist), but the extra\n // checks are unnecessary and this is a hot path. So we check to see\n // if the index of the dependency is in the directive range for this\n // tNode. If it's not, we know it's a provider and skip hook registration.\n if (tView.firstCreatePass && index >= tNode.directiveStart) {\n ngDevMode && assertDirectiveDef(tData[index]);\n registerPreOrderHooks(index, tData[index], tView);\n }\n } finally {\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation);\n setIncludeViewProviders(previousIncludeViewProviders);\n factory.resolving = false;\n leaveDI();\n }\n }\n return value;\n}\n/**\n * Returns the bit in an injector's bloom filter that should be used to determine whether or not\n * the directive might be provided by the injector.\n *\n * When a directive is public, it is added to the bloom filter and given a unique ID that can be\n * retrieved on the Type. When the directive isn't public or the token is not a directive `null`\n * is returned as the node injector can not possibly provide that token.\n *\n * @param token the injection token\n * @returns the matching bit to check in the bloom filter or `null` if the token is not known.\n * When the returned value is negative then it represents special values such as `Injector`.\n */\nfunction bloomHashBitOrFactory(token) {\n ngDevMode && assertDefined(token, 'token must be defined');\n if (typeof token === 'string') {\n return token.charCodeAt(0) || 0;\n }\n const tokenId =\n // First check with `hasOwnProperty` so we don't get an inherited ID.\n token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : undefined;\n // Negative token IDs are used for special objects such as `Injector`\n if (typeof tokenId === 'number') {\n if (tokenId >= 0) {\n return tokenId & BLOOM_MASK;\n } else {\n ngDevMode && assertEqual(tokenId, -1 /* InjectorMarkers.Injector */, 'Expecting to get Special Injector Id');\n return createNodeInjector;\n }\n } else {\n return tokenId;\n }\n}\nfunction bloomHasToken(bloomHash, injectorIndex, injectorView) {\n // Create a mask that targets the specific bit associated with the directive we're looking for.\n // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding\n // to bit positions 0 - 31 in a 32 bit integer.\n const mask = 1 << bloomHash;\n // Each bloom bucket in `injectorView` represents `BLOOM_BUCKET_BITS` number of bits of\n // `bloomHash`. Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset\n // that should be used.\n const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)];\n // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,\n // this injector is a potential match.\n return !!(value & mask);\n}\n/** Returns true if flags prevent parent injector from being searched for tokens */\nfunction shouldSearchParent(flags, isFirstHostTNode) {\n return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);\n}\nfunction getNodeInjectorLView(nodeInjector) {\n return nodeInjector._lView;\n}\nfunction getNodeInjectorTNode(nodeInjector) {\n return nodeInjector._tNode;\n}\nclass NodeInjector {\n _tNode;\n _lView;\n constructor(_tNode, _lView) {\n this._tNode = _tNode;\n this._lView = _lView;\n }\n get(token, notFoundValue, flags) {\n return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);\n }\n}\n/** Creates a `NodeInjector` for the current node. */\nfunction createNodeInjector() {\n return new NodeInjector(getCurrentTNode(), getLView());\n}\n/**\n * @codeGenApi\n */\nfunction ɵɵgetInheritedFactory(type) {\n return noSideEffects(() => {\n const ownConstructor = type.prototype.constructor;\n const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor);\n const objectPrototype = Object.prototype;\n let parent = Object.getPrototypeOf(type.prototype).constructor;\n // Go up the prototype until we hit `Object`.\n while (parent && parent !== objectPrototype) {\n const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent);\n // If we hit something that has a factory and the factory isn't the same as the type,\n // we've found the inherited factory. Note the check that the factory isn't the type's\n // own factory is redundant in most cases, but if the user has custom decorators on the\n // class, this lookup will start one level down in the prototype chain, causing us to\n // find the own factory first and potentially triggering an infinite loop downstream.\n if (factory && factory !== ownFactory) {\n return factory;\n }\n parent = Object.getPrototypeOf(parent);\n }\n // There is no factory defined. Either this was improper usage of inheritance\n // (no Angular decorator on the superclass) or there is no constructor at all\n // in the inheritance chain. Since the two cases cannot be distinguished, the\n // latter has to be assumed.\n return t => new t();\n });\n}\nfunction getFactoryOf(type) {\n if (isForwardRef(type)) {\n return () => {\n const factory = getFactoryOf(resolveForwardRef(type));\n return factory && factory();\n };\n }\n return getFactoryDef(type);\n}\n/**\n * Returns a value from the closest embedded or node injector.\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) {\n let currentTNode = tNode;\n let currentLView = lView;\n // When an LView with an embedded view injector is inserted, it'll likely be interlaced with\n // nodes who may have injectors (e.g. node injector -> embedded view injector -> node injector).\n // Since the bloom filters for the node injectors have already been constructed and we don't\n // have a way of extracting the records from an injector, the only way to maintain the correct\n // hierarchy when resolving the value is to walk it node-by-node while attempting to resolve\n // the token at each level.\n while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ && !(currentLView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {\n ngDevMode && assertTNodeForLView(currentTNode, currentLView);\n // Note that this lookup on the node injector is using the `Self` flag, because\n // we don't want the node injector to look at any parent injectors since we\n // may hit the embedded view injector first.\n const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | InjectFlags.Self, NOT_FOUND);\n if (nodeInjectorValue !== NOT_FOUND) {\n return nodeInjectorValue;\n }\n // Has an explicit type due to a TS bug: https://github.com/microsoft/TypeScript/issues/33191\n let parentTNode = currentTNode.parent;\n // `TNode.parent` includes the parent within the current view only. If it doesn't exist,\n // it means that we've hit the view boundary and we need to go up to the next view.\n if (!parentTNode) {\n // Before we go to the next LView, check if the token exists on the current embedded injector.\n const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR];\n if (embeddedViewInjector) {\n const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND, flags);\n if (embeddedViewInjectorValue !== NOT_FOUND) {\n return embeddedViewInjectorValue;\n }\n }\n // Otherwise keep going up the tree.\n parentTNode = getTNodeFromLView(currentLView);\n currentLView = currentLView[DECLARATION_VIEW];\n }\n currentTNode = parentTNode;\n }\n return notFoundValue;\n}\n/** Gets the TNode associated with an LView inside of the declaration view. */\nfunction getTNodeFromLView(lView) {\n const tView = lView[TVIEW];\n const tViewType = tView.type;\n // The parent pointer differs based on `TView.type`.\n if (tViewType === 2 /* TViewType.Embedded */) {\n ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');\n return tView.declTNode;\n } else if (tViewType === 1 /* TViewType.Component */) {\n // Components don't have `TView.declTNode` because each instance of component could be\n // inserted in different location, hence `TView.declTNode` is meaningless.\n return lView[T_HOST];\n }\n return null;\n}\n\n/**\n * Facade for the attribute injection from DI.\n *\n * @codeGenApi\n */\nfunction ɵɵinjectAttribute(attrNameToInject) {\n return injectAttributeImpl(getCurrentTNode(), attrNameToInject);\n}\n\n/**\n * Attribute decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Attribute = /*#__PURE__*/makeParamDecorator('Attribute', attributeName => ({\n attributeName,\n __NG_ELEMENT_ID__: () => ɵɵinjectAttribute(attributeName)\n}));\nlet _reflect = null;\nfunction getReflect() {\n return _reflect = _reflect || new ReflectionCapabilities();\n}\nfunction reflectDependencies(type) {\n return convertDependencies(getReflect().parameters(type));\n}\nfunction convertDependencies(deps) {\n return deps.map(dep => reflectDependency(dep));\n}\nfunction reflectDependency(dep) {\n const meta = {\n token: null,\n attribute: null,\n host: false,\n optional: false,\n self: false,\n skipSelf: false\n };\n if (Array.isArray(dep) && dep.length > 0) {\n for (let j = 0; j < dep.length; j++) {\n const param = dep[j];\n if (param === undefined) {\n // param may be undefined if type of dep is not set by ngtsc\n continue;\n }\n const proto = Object.getPrototypeOf(param);\n if (param instanceof Optional || proto.ngMetadataName === 'Optional') {\n meta.optional = true;\n } else if (param instanceof SkipSelf || proto.ngMetadataName === 'SkipSelf') {\n meta.skipSelf = true;\n } else if (param instanceof Self || proto.ngMetadataName === 'Self') {\n meta.self = true;\n } else if (param instanceof Host || proto.ngMetadataName === 'Host') {\n meta.host = true;\n } else if (param instanceof Inject) {\n meta.token = param.token;\n } else if (param instanceof Attribute) {\n if (param.attributeName === undefined) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);\n }\n meta.attribute = param.attributeName;\n } else {\n meta.token = param;\n }\n }\n } else if (dep === undefined || Array.isArray(dep) && dep.length === 0) {\n meta.token = null;\n } else {\n meta.token = dep;\n }\n return meta;\n}\n\n/**\n * Compile an Angular injectable according to its `Injectable` metadata, and patch the resulting\n * injectable def (`ɵprov`) onto the injectable type.\n */\nfunction compileInjectable(type, meta) {\n let ngInjectableDef = null;\n let ngFactoryDef = null;\n // if NG_PROV_DEF is already defined on this class then don't overwrite it\n if (!type.hasOwnProperty(NG_PROV_DEF)) {\n Object.defineProperty(type, NG_PROV_DEF, {\n get: () => {\n if (ngInjectableDef === null) {\n const compiler = getCompilerFacade({\n usage: 0 /* JitCompilerUsage.Decorator */,\n kind: 'injectable',\n type\n });\n ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/ɵprov.js`, getInjectableMetadata(type, meta));\n }\n return ngInjectableDef;\n }\n });\n }\n // if NG_FACTORY_DEF is already defined on this class then don't overwrite it\n if (!type.hasOwnProperty(NG_FACTORY_DEF)) {\n Object.defineProperty(type, NG_FACTORY_DEF, {\n get: () => {\n if (ngFactoryDef === null) {\n const compiler = getCompilerFacade({\n usage: 0 /* JitCompilerUsage.Decorator */,\n kind: 'injectable',\n type\n });\n ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/ɵfac.js`, {\n name: type.name,\n type,\n typeArgumentCount: 0,\n // In JIT mode types are not available nor used.\n deps: reflectDependencies(type),\n target: compiler.FactoryTarget.Injectable\n });\n }\n return ngFactoryDef;\n },\n // Leave this configurable so that the factories from directives or pipes can take precedence.\n configurable: true\n });\n }\n}\nconst USE_VALUE = /*#__PURE__*/getClosureSafeProperty({\n provide: String,\n useValue: getClosureSafeProperty\n});\nfunction isUseClassProvider(meta) {\n return meta.useClass !== undefined;\n}\nfunction isUseValueProvider(meta) {\n return USE_VALUE in meta;\n}\nfunction isUseFactoryProvider(meta) {\n return meta.useFactory !== undefined;\n}\nfunction isUseExistingProvider(meta) {\n return meta.useExisting !== undefined;\n}\nfunction getInjectableMetadata(type, srcMeta) {\n // Allow the compilation of a class with a `@Injectable()` decorator without parameters\n const meta = srcMeta || {\n providedIn: null\n };\n const compilerMeta = {\n name: type.name,\n type: type,\n typeArgumentCount: 0,\n providedIn: meta.providedIn\n };\n if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== undefined) {\n compilerMeta.deps = convertDependencies(meta.deps);\n }\n // Check to see if the user explicitly provided a `useXxxx` property.\n if (isUseClassProvider(meta)) {\n compilerMeta.useClass = meta.useClass;\n } else if (isUseValueProvider(meta)) {\n compilerMeta.useValue = meta.useValue;\n } else if (isUseFactoryProvider(meta)) {\n compilerMeta.useFactory = meta.useFactory;\n } else if (isUseExistingProvider(meta)) {\n compilerMeta.useExisting = meta.useExisting;\n }\n return compilerMeta;\n}\n\n/**\n * Injectable decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Injectable = /*#__PURE__*/makeDecorator('Injectable', undefined, undefined, undefined, (type, meta) => compileInjectable(type, meta));\n\n/**\n * Create a new `Injector` which is configured using a `defType` of `InjectorType`s.\n */\nfunction createInjector(defType, parent = null, additionalProviders = null, name) {\n const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);\n injector.resolveInjectorInitializers();\n return injector;\n}\n/**\n * Creates a new injector without eagerly resolving its injector types. Can be used in places\n * where resolving the injector types immediately can lead to an infinite loop. The injector types\n * should be resolved at a later point by calling `_resolveInjectorDefTypes`.\n */\nfunction createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name, scopes = new Set()) {\n const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)];\n name = name || (typeof defType === 'object' ? undefined : stringify(defType));\n return new R3Injector(providers, parent || getNullInjector(), name || null, scopes);\n}\n\n/**\n * Concrete injectors implement this interface. Injectors are configured\n * with [providers](guide/di/dependency-injection-providers) that associate\n * dependencies of various types with [injection tokens](guide/di/dependency-injection-providers).\n *\n * @see [DI Providers](guide/di/dependency-injection-providers).\n * @see {@link StaticProvider}\n *\n * @usageNotes\n *\n * The following example creates a service injector instance.\n *\n * {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}\n *\n * ### Usage example\n *\n * {@example core/di/ts/injector_spec.ts region='Injector'}\n *\n * `Injector` returns itself when given `Injector` as a token:\n *\n * {@example core/di/ts/injector_spec.ts region='injectInjector'}\n *\n * @publicApi\n */\nclass Injector {\n static THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;\n static NULL = /*#__PURE__*/new NullInjector();\n static create(options, parent) {\n if (Array.isArray(options)) {\n return createInjector({\n name: ''\n }, parent, options, '');\n } else {\n const name = options.name ?? '';\n return createInjector({\n name\n }, options.parent, options.providers, name);\n }\n }\n /** @nocollapse */\n static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ɵɵdefineInjectable({\n token: Injector,\n providedIn: 'any',\n factory: () => ɵɵinject(INJECTOR$1)\n });\n /**\n * @internal\n * @nocollapse\n */\n static __NG_ELEMENT_ID__ = -1 /* InjectorMarkers.Injector */;\n}\n\n/*!\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.dev/license\n */\n/**\n * Creates a token that can be used to inject static attributes of the host node.\n *\n * @usageNotes\n * ### Injecting an attribute that is known to exist\n * ```ts\n * @Directive()\n * class MyDir {\n * attr: string = inject(new HostAttributeToken('some-attr'));\n * }\n * ```\n *\n * ### Optionally injecting an attribute\n * ```ts\n * @Directive()\n * class MyDir {\n * attr: string | null = inject(new HostAttributeToken('some-attr'), {optional: true});\n * }\n * ```\n * @publicApi\n */\nclass HostAttributeToken {\n attributeName;\n constructor(attributeName) {\n this.attributeName = attributeName;\n }\n /** @internal */\n __NG_ELEMENT_ID__ = () => ɵɵinjectAttribute(this.attributeName);\n toString() {\n return `HostAttributeToken ${this.attributeName}`;\n }\n}\n\n/**\n * A token that can be used to inject the tag name of the host node.\n *\n * @usageNotes\n * ### Injecting a tag name that is known to exist\n * ```ts\n * @Directive()\n * class MyDir {\n * tagName: string = inject(HOST_TAG_NAME);\n * }\n * ```\n *\n * ### Optionally injecting a tag name\n * ```ts\n * @Directive()\n * class MyDir {\n * tagName: string | null = inject(HOST_TAG_NAME, {optional: true});\n * }\n * ```\n * @publicApi\n */\nconst HOST_TAG_NAME = /*#__PURE__*/new InjectionToken(ngDevMode ? 'HOST_TAG_NAME' : '');\n// HOST_TAG_NAME should be resolved at the current node, similar to e.g. ElementRef,\n// so we manually specify __NG_ELEMENT_ID__ here, instead of using a factory.\n// tslint:disable-next-line:no-toplevel-property-access\nHOST_TAG_NAME.__NG_ELEMENT_ID__ = flags => {\n const tNode = getCurrentTNode();\n if (tNode === null) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && 'HOST_TAG_NAME can only be injected in directives and components ' + 'during construction time (in a class constructor or as a class field initializer)');\n }\n if (tNode.type & 2 /* TNodeType.Element */) {\n return tNode.value;\n }\n if (flags & InjectFlags.Optional) {\n return null;\n }\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `HOST_TAG_NAME was used on ${getDevModeNodeName(tNode)} which doesn't have an underlying element in the DOM. ` + `This is invalid, and so the dependency should be marked as optional.`);\n};\nfunction getDevModeNodeName(tNode) {\n if (tNode.type & 8 /* TNodeType.ElementContainer */) {\n return 'an ';\n } else if (tNode.type & 4 /* TNodeType.Container */) {\n return 'an ';\n } else if (tNode.type & 128 /* TNodeType.LetDeclaration */) {\n return 'an @let declaration';\n } else {\n return 'a node';\n }\n}\n\n/**\n * @module\n * @description\n * The `di` module provides dependency injection container services.\n */\n\n/**\n * This file should not be necessary because node resolution should just default to `./di/index`!\n *\n * However it does not seem to work and it breaks:\n * - //packages/animations/browser/test:test_web_chromium-local\n * - //packages/compiler-cli/test:extract_i18n\n * - //packages/compiler-cli/test:ngc\n * - //packages/compiler-cli/test:perform_watch\n * - //packages/compiler-cli/test/diagnostics:check_types\n * - //packages/compiler-cli/test/transformers:test\n * - //packages/compiler/test:test\n * - //tools/public_api_guard:core_api\n *\n * Remove this file once the above is solved or wait until `ngc` is deleted and then it should be\n * safe to delete this file.\n */\n\nconst SCHEDULE_IN_ROOT_ZONE_DEFAULT = false;\n\n/**\n * `DestroyRef` lets you set callbacks to run for any cleanup or destruction behavior.\n * The scope of this destruction depends on where `DestroyRef` is injected. If `DestroyRef`\n * is injected in a component or directive, the callbacks run when that component or\n * directive is destroyed. Otherwise the callbacks run when a corresponding injector is destroyed.\n *\n * @publicApi\n */\nlet DestroyRef = /*#__PURE__*/(() => {\n class DestroyRef {\n /**\n * @internal\n * @nocollapse\n */\n static __NG_ELEMENT_ID__ = injectDestroyRef;\n /**\n * @internal\n * @nocollapse\n */\n static __NG_ENV_ID__ = injector => injector;\n }\n return DestroyRef;\n})();\nclass NodeInjectorDestroyRef extends DestroyRef {\n _lView;\n constructor(_lView) {\n super();\n this._lView = _lView;\n }\n onDestroy(callback) {\n storeLViewOnDestroy(this._lView, callback);\n return () => removeLViewOnDestroy(this._lView, callback);\n }\n}\nfunction injectDestroyRef() {\n return new NodeInjectorDestroyRef(getLView());\n}\n\n/**\n * Injectable that is notified when an `LView` is made aware of changes to application state.\n */\nclass ChangeDetectionScheduler {}\n/** Token used to indicate if zoneless was enabled via provideZonelessChangeDetection(). */\nconst ZONELESS_ENABLED = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Zoneless enabled' : '', {\n providedIn: 'root',\n factory: () => false\n});\n/** Token used to indicate `provideExperimentalZonelessChangeDetection` was used. */\nconst PROVIDED_ZONELESS = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Zoneless provided' : '', {\n providedIn: 'root',\n factory: () => false\n});\nconst ZONELESS_SCHEDULER_DISABLED = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'scheduler disabled' : '');\n// TODO(atscott): Remove in v19. Scheduler should be done with runOutsideAngular.\nconst SCHEDULE_IN_ROOT_ZONE = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'run changes outside zone in root' : '');\n\n/**\n * Internal implementation of the pending tasks service.\n */\nlet PendingTasksInternal = /*#__PURE__*/(() => {\n class PendingTasksInternal {\n taskId = 0;\n pendingTasks = new Set();\n get _hasPendingTasks() {\n return this.hasPendingTasks.value;\n }\n hasPendingTasks = new BehaviorSubject(false);\n add() {\n if (!this._hasPendingTasks) {\n this.hasPendingTasks.next(true);\n }\n const taskId = this.taskId++;\n this.pendingTasks.add(taskId);\n return taskId;\n }\n has(taskId) {\n return this.pendingTasks.has(taskId);\n }\n remove(taskId) {\n this.pendingTasks.delete(taskId);\n if (this.pendingTasks.size === 0 && this._hasPendingTasks) {\n this.hasPendingTasks.next(false);\n }\n }\n ngOnDestroy() {\n this.pendingTasks.clear();\n if (this._hasPendingTasks) {\n this.hasPendingTasks.next(false);\n }\n }\n /** @nocollapse */\n static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ɵɵdefineInjectable({\n token: PendingTasksInternal,\n providedIn: 'root',\n factory: () => new PendingTasksInternal()\n });\n }\n return PendingTasksInternal;\n})();\n/**\n * Service that keeps track of pending tasks contributing to the stableness of Angular\n * application. While several existing Angular services (ex.: `HttpClient`) will internally manage\n * tasks influencing stability, this API gives control over stability to library and application\n * developers for specific cases not covered by Angular internals.\n *\n * The concept of stability comes into play in several important scenarios:\n * - SSR process needs to wait for the application stability before serializing and sending rendered\n * HTML;\n * - tests might want to delay assertions until the application becomes stable;\n *\n * @usageNotes\n * ```ts\n * const pendingTasks = inject(PendingTasks);\n * const taskCleanup = pendingTasks.add();\n * // do work that should block application's stability and then:\n * taskCleanup();\n * ```\n *\n * @publicApi\n * @developerPreview\n */\nlet PendingTasks = /*#__PURE__*/(() => {\n class PendingTasks {\n internalPendingTasks = inject(PendingTasksInternal);\n scheduler = inject(ChangeDetectionScheduler);\n /**\n * Adds a new task that should block application's stability.\n * @returns A cleanup function that removes a task when called.\n */\n add() {\n const taskId = this.internalPendingTasks.add();\n return () => {\n if (!this.internalPendingTasks.has(taskId)) {\n // This pending task has already been cleared.\n return;\n }\n // Notifying the scheduler will hold application stability open until the next tick.\n this.scheduler.notify(12 /* NotificationSource.PendingTaskRemoved */);\n this.internalPendingTasks.remove(taskId);\n };\n }\n /**\n * Runs an asynchronous function and blocks the application's stability until the function completes.\n *\n * ```\n * pendingTasks.run(async () => {\n * const userData = await fetch('/api/user');\n * this.userData.set(userData);\n * });\n * ```\n *\n * Application stability is at least delayed until the next tick after the `run` method resolves\n * so it is safe to make additional updates to application state that would require UI synchronization:\n *\n * ```\n * const userData = await pendingTasks.run(() => fetch('/api/user'));\n * this.userData.set(userData);\n * ```\n *\n * @param fn The asynchronous function to execute\n */\n async run(fn) {\n const removeTask = this.add();\n try {\n return await fn();\n } finally {\n removeTask();\n }\n }\n /** @nocollapse */\n static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ɵɵdefineInjectable({\n token: PendingTasks,\n providedIn: 'root',\n factory: () => new PendingTasks()\n });\n }\n return PendingTasks;\n})();\nclass EventEmitter_ extends Subject {\n __isAsync; // tslint:disable-line\n destroyRef = undefined;\n pendingTasks = undefined;\n constructor(isAsync = false) {\n super();\n this.__isAsync = isAsync;\n // Attempt to retrieve a `DestroyRef` and `PendingTasks` optionally.\n // For backwards compatibility reasons, this cannot be required.\n if (isInInjectionContext()) {\n // `DestroyRef` is optional because it is not available in all contexts.\n // But it is useful to properly complete the `EventEmitter` if used with `outputToObservable`\n // when the component/directive is destroyed. (See `outputToObservable` for more details.)\n this.destroyRef = inject(DestroyRef, {\n optional: true\n }) ?? undefined;\n this.pendingTasks = inject(PendingTasksInternal, {\n optional: true\n }) ?? undefined;\n }\n }\n emit(value) {\n const prevConsumer = setActiveConsumer$1(null);\n try {\n super.next(value);\n } finally {\n setActiveConsumer$1(prevConsumer);\n }\n }\n subscribe(observerOrNext, error, complete) {\n let nextFn = observerOrNext;\n let errorFn = error || (() => null);\n let completeFn = complete;\n if (observerOrNext && typeof observerOrNext === 'object') {\n const observer = observerOrNext;\n nextFn = observer.next?.bind(observer);\n errorFn = observer.error?.bind(observer);\n completeFn = observer.complete?.bind(observer);\n }\n if (this.__isAsync) {\n errorFn = this.wrapInTimeout(errorFn);\n if (nextFn) {\n nextFn = this.wrapInTimeout(nextFn);\n }\n if (completeFn) {\n completeFn = this.wrapInTimeout(completeFn);\n }\n }\n const sink = super.subscribe({\n next: nextFn,\n error: errorFn,\n complete: completeFn\n });\n if (observerOrNext instanceof Subscription) {\n observerOrNext.add(sink);\n }\n return sink;\n }\n wrapInTimeout(fn) {\n return value => {\n const taskId = this.pendingTasks?.add();\n setTimeout(() => {\n fn(value);\n if (taskId !== undefined) {\n this.pendingTasks?.remove(taskId);\n }\n });\n };\n }\n}\n/**\n * @publicApi\n */\nconst EventEmitter = EventEmitter_;\nfunction noop(...args) {\n // Do nothing.\n}\n\n/**\n * Gets a scheduling function that runs the callback after the first of setTimeout and\n * requestAnimationFrame resolves.\n *\n * - `requestAnimationFrame` ensures that change detection runs ahead of a browser repaint.\n * This ensures that the create and update passes of a change detection always happen\n * in the same frame.\n * - When the browser is resource-starved, `rAF` can execute _before_ a `setTimeout` because\n * rendering is a very high priority process. This means that `setTimeout` cannot guarantee\n * same-frame create and update pass, when `setTimeout` is used to schedule the update phase.\n * - While `rAF` gives us the desirable same-frame updates, it has two limitations that\n * prevent it from being used alone. First, it does not run in background tabs, which would\n * prevent Angular from initializing an application when opened in a new tab (for example).\n * Second, repeated calls to requestAnimationFrame will execute at the refresh rate of the\n * hardware (~16ms for a 60Hz display). This would cause significant slowdown of tests that\n * are written with several updates and asserts in the form of \"update; await stable; assert;\".\n * - Both `setTimeout` and `rAF` are able to \"coalesce\" several events from a single user\n * interaction into a single change detection. Importantly, this reduces view tree traversals when\n * compared to an alternative timing mechanism like `queueMicrotask`, where change detection would\n * then be interleaves between each event.\n *\n * By running change detection after the first of `setTimeout` and `rAF` to execute, we get the\n * best of both worlds.\n *\n * @returns a function to cancel the scheduled callback\n */\nfunction scheduleCallbackWithRafRace(callback) {\n let timeoutId;\n let animationFrameId;\n function cleanup() {\n callback = noop;\n try {\n if (animationFrameId !== undefined && typeof cancelAnimationFrame === 'function') {\n cancelAnimationFrame(animationFrameId);\n }\n if (timeoutId !== undefined) {\n clearTimeout(timeoutId);\n }\n } catch {\n // Clearing/canceling can fail in tests due to the timing of functions being patched and unpatched\n // Just ignore the errors - we protect ourselves from this issue by also making the callback a no-op.\n }\n }\n timeoutId = setTimeout(() => {\n callback();\n cleanup();\n });\n if (typeof requestAnimationFrame === 'function') {\n animationFrameId = requestAnimationFrame(() => {\n callback();\n cleanup();\n });\n }\n return () => cleanup();\n}\nfunction scheduleCallbackWithMicrotask(callback) {\n queueMicrotask(() => callback());\n return () => {\n callback = noop;\n };\n}\nclass AsyncStackTaggingZoneSpec {\n createTask;\n constructor(namePrefix, consoleAsyncStackTaggingImpl = console) {\n this.name = 'asyncStackTagging for ' + namePrefix;\n this.createTask = consoleAsyncStackTaggingImpl?.createTask ?? (() => null);\n }\n // ZoneSpec implementation below.\n name;\n onScheduleTask(delegate, _current, target, task) {\n task.consoleTask = this.createTask(`Zone - ${task.source || task.type}`);\n return delegate.scheduleTask(target, task);\n }\n onInvokeTask(delegate, _currentZone, targetZone, task, applyThis, applyArgs) {\n let ret;\n if (task.consoleTask) {\n ret = task.consoleTask.run(() => delegate.invokeTask(targetZone, task, applyThis, applyArgs));\n } else {\n ret = delegate.invokeTask(targetZone, task, applyThis, applyArgs);\n }\n return ret;\n }\n}\nconst isAngularZoneProperty = 'isAngularZone';\nconst angularZoneInstanceIdProperty = isAngularZoneProperty + '_ID';\nlet ngZoneInstanceId = 0;\n/**\n * An injectable service for executing work inside or outside of the Angular zone.\n *\n * The most common use of this service is to optimize performance when starting a work consisting of\n * one or more asynchronous tasks that don't require UI updates or error handling to be handled by\n * Angular. Such tasks can be kicked off via {@link #runOutsideAngular} and if needed, these tasks\n * can reenter the Angular zone via {@link #run}.\n *\n * \n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * import {Component, NgZone} from '@angular/core';\n * import {NgIf} from '@angular/common';\n *\n * @Component({\n * selector: 'ng-zone-demo',\n * template: `\n *

          Demo: NgZone

          \n *\n *

          Progress: {{progress}}%

          \n *

          = 100\">Done processing {{label}} of Angular zone!

          \n *\n * \n * \n * `,\n * })\n * export class NgZoneDemo {\n * progress: number = 0;\n * label: string;\n *\n * constructor(private _ngZone: NgZone) {}\n *\n * // Loop inside the Angular zone\n * // so the UI DOES refresh after each setTimeout cycle\n * processWithinAngularZone() {\n * this.label = 'inside';\n * this.progress = 0;\n * this._increaseProgress(() => console.log('Inside Done!'));\n * }\n *\n * // Loop outside of the Angular zone\n * // so the UI DOES NOT refresh after each setTimeout cycle\n * processOutsideOfAngularZone() {\n * this.label = 'outside';\n * this.progress = 0;\n * this._ngZone.runOutsideAngular(() => {\n * this._increaseProgress(() => {\n * // reenter the Angular zone and display done\n * this._ngZone.run(() => { console.log('Outside Done!'); });\n * });\n * });\n * }\n *\n * _increaseProgress(doneCallback: () => void) {\n * this.progress += 1;\n * console.log(`Current progress: ${this.progress}%`);\n *\n * if (this.progress < 100) {\n * window.setTimeout(() => this._increaseProgress(doneCallback), 10);\n * } else {\n * doneCallback();\n * }\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass NgZone {\n hasPendingMacrotasks = false;\n hasPendingMicrotasks = false;\n /**\n * Whether there are no outstanding microtasks or macrotasks.\n */\n isStable = true;\n /**\n * Notifies when code enters Angular Zone. This gets fired first on VM Turn.\n */\n onUnstable = /*#__PURE__*/new EventEmitter(false);\n /**\n * Notifies when there is no more microtasks enqueued in the current VM Turn.\n * This is a hint for Angular to do change detection, which may enqueue more microtasks.\n * For this reason this event can fire multiple times per VM Turn.\n */\n onMicrotaskEmpty = /*#__PURE__*/new EventEmitter(false);\n /**\n * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which\n * implies we are about to relinquish VM turn.\n * This event gets called just once.\n */\n onStable = /*#__PURE__*/new EventEmitter(false);\n /**\n * Notifies that an error has been delivered.\n */\n onError = /*#__PURE__*/new EventEmitter(false);\n constructor(options) {\n const {\n enableLongStackTrace = false,\n shouldCoalesceEventChangeDetection = false,\n shouldCoalesceRunChangeDetection = false,\n scheduleInRootZone = SCHEDULE_IN_ROOT_ZONE_DEFAULT\n } = options;\n if (typeof Zone == 'undefined') {\n throw new RuntimeError(908 /* RuntimeErrorCode.MISSING_ZONEJS */, ngDevMode && `In this configuration Angular requires Zone.js`);\n }\n Zone.assertZonePatched();\n const self = this;\n self._nesting = 0;\n self._outer = self._inner = Zone.current;\n // AsyncStackTaggingZoneSpec provides `linked stack traces` to show\n // where the async operation is scheduled. For more details, refer\n // to this article, https://developer.chrome.com/blog/devtools-better-angular-debugging/\n // And we only import this AsyncStackTaggingZoneSpec in development mode,\n // in the production mode, the AsyncStackTaggingZoneSpec will be tree shaken away.\n if (ngDevMode) {\n self._inner = self._inner.fork(new AsyncStackTaggingZoneSpec('Angular'));\n }\n if (Zone['TaskTrackingZoneSpec']) {\n self._inner = self._inner.fork(new Zone['TaskTrackingZoneSpec']());\n }\n if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {\n self._inner = self._inner.fork(Zone['longStackTraceZoneSpec']);\n }\n // if shouldCoalesceRunChangeDetection is true, all tasks including event tasks will be\n // coalesced, so shouldCoalesceEventChangeDetection option is not necessary and can be skipped.\n self.shouldCoalesceEventChangeDetection = !shouldCoalesceRunChangeDetection && shouldCoalesceEventChangeDetection;\n self.shouldCoalesceRunChangeDetection = shouldCoalesceRunChangeDetection;\n self.callbackScheduled = false;\n self.scheduleInRootZone = scheduleInRootZone;\n forkInnerZoneWithAngularBehavior(self);\n }\n /**\n This method checks whether the method call happens within an Angular Zone instance.\n */\n static isInAngularZone() {\n // Zone needs to be checked, because this method might be called even when NoopNgZone is used.\n return typeof Zone !== 'undefined' && Zone.current.get(isAngularZoneProperty) === true;\n }\n /**\n Assures that the method is called within the Angular Zone, otherwise throws an error.\n */\n static assertInAngularZone() {\n if (!NgZone.isInAngularZone()) {\n throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');\n }\n }\n /**\n Assures that the method is called outside of the Angular Zone, otherwise throws an error.\n */\n static assertNotInAngularZone() {\n if (NgZone.isInAngularZone()) {\n throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');\n }\n }\n /**\n * Executes the `fn` function synchronously within the Angular zone and returns value returned by\n * the function.\n *\n * Running functions via `run` allows you to reenter Angular zone from a task that was executed\n * outside of the Angular zone (typically started via {@link #runOutsideAngular}).\n *\n * Any future tasks or microtasks scheduled from within this function will continue executing from\n * within the Angular zone.\n *\n * If a synchronous error happens it will be rethrown and not reported via `onError`.\n */\n run(fn, applyThis, applyArgs) {\n return this._inner.run(fn, applyThis, applyArgs);\n }\n /**\n * Executes the `fn` function synchronously within the Angular zone as a task and returns value\n * returned by the function.\n *\n * Running functions via `run` allows you to reenter Angular zone from a task that was executed\n * outside of the Angular zone (typically started via {@link #runOutsideAngular}).\n *\n * Any future tasks or microtasks scheduled from within this function will continue executing from\n * within the Angular zone.\n *\n * If a synchronous error happens it will be rethrown and not reported via `onError`.\n */\n runTask(fn, applyThis, applyArgs, name) {\n const zone = this._inner;\n const task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);\n try {\n return zone.runTask(task, applyThis, applyArgs);\n } finally {\n zone.cancelTask(task);\n }\n }\n /**\n * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not\n * rethrown.\n */\n runGuarded(fn, applyThis, applyArgs) {\n return this._inner.runGuarded(fn, applyThis, applyArgs);\n }\n /**\n * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by\n * the function.\n *\n * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do\n * work that\n * doesn't trigger Angular change-detection or is subject to Angular's error handling.\n *\n * Any future tasks or microtasks scheduled from within this function will continue executing from\n * outside of the Angular zone.\n *\n * Use {@link #run} to reenter the Angular zone and do work that updates the application model.\n */\n runOutsideAngular(fn) {\n return this._outer.run(fn);\n }\n}\nconst EMPTY_PAYLOAD = {};\nfunction checkStable(zone) {\n // TODO: @JiaLiPassion, should check zone.isCheckStableRunning to prevent\n // re-entry. The case is:\n //\n // @Component({...})\n // export class AppComponent {\n // constructor(private ngZone: NgZone) {\n // this.ngZone.onStable.subscribe(() => {\n // this.ngZone.run(() => console.log('stable'););\n // });\n // }\n //\n // The onStable subscriber run another function inside ngZone\n // which causes `checkStable()` re-entry.\n // But this fix causes some issues in g3, so this fix will be\n // launched in another PR.\n if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {\n try {\n zone._nesting++;\n zone.onMicrotaskEmpty.emit(null);\n } finally {\n zone._nesting--;\n if (!zone.hasPendingMicrotasks) {\n try {\n zone.runOutsideAngular(() => zone.onStable.emit(null));\n } finally {\n zone.isStable = true;\n }\n }\n }\n }\n}\nfunction delayChangeDetectionForEvents(zone) {\n /**\n * We also need to check _nesting here\n * Consider the following case with shouldCoalesceRunChangeDetection = true\n *\n * ngZone.run(() => {});\n * ngZone.run(() => {});\n *\n * We want the two `ngZone.run()` only trigger one change detection\n * when shouldCoalesceRunChangeDetection is true.\n * And because in this case, change detection run in async way(requestAnimationFrame),\n * so we also need to check the _nesting here to prevent multiple\n * change detections.\n */\n if (zone.isCheckStableRunning || zone.callbackScheduled) {\n return;\n }\n zone.callbackScheduled = true;\n function scheduleCheckStable() {\n scheduleCallbackWithRafRace(() => {\n zone.callbackScheduled = false;\n updateMicroTaskStatus(zone);\n zone.isCheckStableRunning = true;\n checkStable(zone);\n zone.isCheckStableRunning = false;\n });\n }\n if (zone.scheduleInRootZone) {\n Zone.root.run(() => {\n scheduleCheckStable();\n });\n } else {\n zone._outer.run(() => {\n scheduleCheckStable();\n });\n }\n updateMicroTaskStatus(zone);\n}\nfunction forkInnerZoneWithAngularBehavior(zone) {\n const delayChangeDetectionForEventsDelegate = () => {\n delayChangeDetectionForEvents(zone);\n };\n const instanceId = ngZoneInstanceId++;\n zone._inner = zone._inner.fork({\n name: 'angular',\n properties: {\n [isAngularZoneProperty]: true,\n [angularZoneInstanceIdProperty]: instanceId,\n [angularZoneInstanceIdProperty + instanceId]: true\n },\n onInvokeTask: (delegate, current, target, task, applyThis, applyArgs) => {\n // Prevent triggering change detection when the flag is detected.\n if (shouldBeIgnoredByZone(applyArgs)) {\n return delegate.invokeTask(target, task, applyThis, applyArgs);\n }\n try {\n onEnter(zone);\n return delegate.invokeTask(target, task, applyThis, applyArgs);\n } finally {\n if (zone.shouldCoalesceEventChangeDetection && task.type === 'eventTask' || zone.shouldCoalesceRunChangeDetection) {\n delayChangeDetectionForEventsDelegate();\n }\n onLeave(zone);\n }\n },\n onInvoke: (delegate, current, target, callback, applyThis, applyArgs, source) => {\n try {\n onEnter(zone);\n return delegate.invoke(target, callback, applyThis, applyArgs, source);\n } finally {\n if (zone.shouldCoalesceRunChangeDetection &&\n // Do not delay change detection when the task is the scheduler's tick.\n // We need to synchronously trigger the stability logic so that the\n // zone-based scheduler can prevent a duplicate ApplicationRef.tick\n // by first checking if the scheduler tick is running. This does seem a bit roundabout,\n // but we _do_ still want to trigger all the correct events when we exit the zone.run\n // (`onMicrotaskEmpty` and `onStable` _should_ emit; developers can have code which\n // relies on these events happening after change detection runs).\n // Note: `zone.callbackScheduled` is already in delayChangeDetectionForEventsDelegate\n // but is added here as well to prevent reads of applyArgs when not necessary\n !zone.callbackScheduled && !isSchedulerTick(applyArgs)) {\n delayChangeDetectionForEventsDelegate();\n }\n onLeave(zone);\n }\n },\n onHasTask: (delegate, current, target, hasTaskState) => {\n delegate.hasTask(target, hasTaskState);\n if (current === target) {\n // We are only interested in hasTask events which originate from our zone\n // (A child hasTask event is not interesting to us)\n if (hasTaskState.change == 'microTask') {\n zone._hasPendingMicrotasks = hasTaskState.microTask;\n updateMicroTaskStatus(zone);\n checkStable(zone);\n } else if (hasTaskState.change == 'macroTask') {\n zone.hasPendingMacrotasks = hasTaskState.macroTask;\n }\n }\n },\n onHandleError: (delegate, current, target, error) => {\n delegate.handleError(target, error);\n zone.runOutsideAngular(() => zone.onError.emit(error));\n return false;\n }\n });\n}\nfunction updateMicroTaskStatus(zone) {\n if (zone._hasPendingMicrotasks || (zone.shouldCoalesceEventChangeDetection || zone.shouldCoalesceRunChangeDetection) && zone.callbackScheduled === true) {\n zone.hasPendingMicrotasks = true;\n } else {\n zone.hasPendingMicrotasks = false;\n }\n}\nfunction onEnter(zone) {\n zone._nesting++;\n if (zone.isStable) {\n zone.isStable = false;\n zone.onUnstable.emit(null);\n }\n}\nfunction onLeave(zone) {\n zone._nesting--;\n checkStable(zone);\n}\n/**\n * Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls\n * to framework to perform rendering.\n */\nclass NoopNgZone {\n hasPendingMicrotasks = false;\n hasPendingMacrotasks = false;\n isStable = true;\n onUnstable = /*#__PURE__*/new EventEmitter();\n onMicrotaskEmpty = /*#__PURE__*/new EventEmitter();\n onStable = /*#__PURE__*/new EventEmitter();\n onError = /*#__PURE__*/new EventEmitter();\n run(fn, applyThis, applyArgs) {\n return fn.apply(applyThis, applyArgs);\n }\n runGuarded(fn, applyThis, applyArgs) {\n return fn.apply(applyThis, applyArgs);\n }\n runOutsideAngular(fn) {\n return fn();\n }\n runTask(fn, applyThis, applyArgs, name) {\n return fn.apply(applyThis, applyArgs);\n }\n}\nfunction shouldBeIgnoredByZone(applyArgs) {\n return hasApplyArgsData(applyArgs, '__ignore_ng_zone__');\n}\nfunction isSchedulerTick(applyArgs) {\n return hasApplyArgsData(applyArgs, '__scheduler_tick__');\n}\nfunction hasApplyArgsData(applyArgs, key) {\n if (!Array.isArray(applyArgs)) {\n return false;\n }\n // We should only ever get 1 arg passed through to invokeTask.\n // Short circuit here incase that behavior changes.\n if (applyArgs.length !== 1) {\n return false;\n }\n return applyArgs[0]?.data?.[key] === true;\n}\nfunction getNgZone(ngZoneToUse = 'zone.js', options) {\n if (ngZoneToUse === 'noop') {\n return new NoopNgZone();\n }\n if (ngZoneToUse === 'zone.js') {\n return new NgZone(options);\n }\n return ngZoneToUse;\n}\n\n// Public API for Zone\n\n/**\n * Provides a hook for centralized exception handling.\n *\n * The default implementation of `ErrorHandler` prints error messages to the `console`. To\n * intercept error handling, write a custom exception handler that replaces this default as\n * appropriate for your app.\n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * class MyErrorHandler implements ErrorHandler {\n * handleError(error) {\n * // do something with the exception\n * }\n * }\n *\n * // Provide in standalone apps\n * bootstrapApplication(AppComponent, {\n * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]\n * })\n *\n * // Provide in module-based apps\n * @NgModule({\n * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]\n * })\n * class MyModule {}\n * ```\n *\n * @publicApi\n */\nclass ErrorHandler {\n /**\n * @internal\n */\n _console = console;\n handleError(error) {\n this._console.error('ERROR', error);\n }\n}\n/**\n * `InjectionToken` used to configure how to call the `ErrorHandler`.\n *\n * `NgZone` is provided by default today so the default (and only) implementation for this\n * is calling `ErrorHandler.handleError` outside of the Angular zone.\n */\nconst INTERNAL_APPLICATION_ERROR_HANDLER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'internal error handler' : '', {\n providedIn: 'root',\n factory: () => {\n const zone = inject(NgZone);\n const userErrorHandler = inject(ErrorHandler);\n return e => zone.runOutsideAngular(() => userErrorHandler.handleError(e));\n }\n});\n\n/**\n * An `OutputEmitterRef` is created by the `output()` function and can be\n * used to emit values to consumers of your directive or component.\n *\n * Consumers of your directive/component can bind to the output and\n * subscribe to changes via the bound event syntax. For example:\n *\n * ```html\n * \n * ```\n *\n * @publicAPI\n */\nclass OutputEmitterRef {\n destroyed = false;\n listeners = null;\n errorHandler = /*#__PURE__*/inject(ErrorHandler, {\n optional: true\n });\n /** @internal */\n destroyRef = /*#__PURE__*/inject(DestroyRef);\n constructor() {\n // Clean-up all listeners and mark as destroyed upon destroy.\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.listeners = null;\n });\n }\n subscribe(callback) {\n if (this.destroyed) {\n throw new RuntimeError(953 /* RuntimeErrorCode.OUTPUT_REF_DESTROYED */, ngDevMode && 'Unexpected subscription to destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');\n }\n (this.listeners ??= []).push(callback);\n return {\n unsubscribe: () => {\n const idx = this.listeners?.indexOf(callback);\n if (idx !== undefined && idx !== -1) {\n this.listeners?.splice(idx, 1);\n }\n }\n };\n }\n /** Emits a new value to the output. */\n emit(value) {\n if (this.destroyed) {\n throw new RuntimeError(953 /* RuntimeErrorCode.OUTPUT_REF_DESTROYED */, ngDevMode && 'Unexpected emit for destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');\n }\n if (this.listeners === null) {\n return;\n }\n const previousConsumer = setActiveConsumer$1(null);\n try {\n for (const listenerFn of this.listeners) {\n try {\n listenerFn(value);\n } catch (err) {\n this.errorHandler?.handleError(err);\n }\n }\n } finally {\n setActiveConsumer$1(previousConsumer);\n }\n }\n}\n/** Gets the owning `DestroyRef` for the given output. */\nfunction getOutputDestroyRef(ref) {\n return ref.destroyRef;\n}\n\n/**\n * The `output` function allows declaration of Angular outputs in\n * directives and components.\n *\n * You can use outputs to emit values to parent directives and component.\n * Parents can subscribe to changes via:\n *\n * - template event bindings. For example, `(myOutput)=\"doSomething($event)\"`\n * - programmatic subscription by using `OutputRef#subscribe`.\n *\n * @usageNotes\n *\n * To use `output()`, import the function from `@angular/core`.\n *\n * ```ts\n * import {output} from '@angular/core';\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `output`.\n *\n * ```ts\n * @Directive({\n * ...\n * })\n * export class MyDir {\n * nameChange = output(); // OutputEmitterRef\n * onClick = output(); // OutputEmitterRef\n * }\n * ```\n *\n * You can emit values to consumers of your directive, by using\n * the `emit` method from `OutputEmitterRef`.\n *\n * ```ts\n * updateName(newName: string): void {\n * this.nameChange.emit(newName);\n * }\n * ```\n * @initializerApiFunction {\"showTypesInSignaturePreview\": true}\n * @publicAPI\n */\nfunction output(opts) {\n ngDevMode && assertInInjectionContext(output);\n return new OutputEmitterRef();\n}\nfunction inputFunction(initialValue, opts) {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(initialValue, opts);\n}\nfunction inputRequiredFunction(opts) {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(REQUIRED_UNSET_VALUE, opts);\n}\n/**\n * The `input` function allows declaration of Angular inputs in directives\n * and components.\n *\n * There are two variants of inputs that can be declared:\n *\n * 1. **Optional inputs** with an initial value.\n * 2. **Required inputs** that consumers need to set.\n *\n * By default, the `input` function will declare optional inputs that\n * always have an initial value. Required inputs can be declared\n * using the `input.required()` function.\n *\n * Inputs are signals. The values of an input are exposed as a `Signal`.\n * The signal always holds the latest value of the input that is bound\n * from the parent.\n *\n * @usageNotes\n * To use signal-based inputs, import `input` from `@angular/core`.\n *\n * ```ts\n * import {input} from '@angular/core`;\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `input` or `input.required`.\n *\n * ```ts\n * @Component({\n * ...\n * })\n * export class UserProfileComponent {\n * firstName = input(); // Signal\n * lastName = input.required(); // Signal\n * age = input(0) // Signal\n * }\n * ```\n *\n * Inside your component template, you can display values of the inputs\n * by calling the signal.\n *\n * ```html\n * {{firstName()}}\n * ```\n *\n * @publicAPI\n * @initializerApiFunction\n */\nconst input = /*#__PURE__*/(() => {\n // Note: This may be considered a side-effect, but nothing will depend on\n // this assignment, unless this `input` constant export is accessed. It's a\n // self-contained side effect that is local to the user facing`input` export.\n inputFunction.required = inputRequiredFunction;\n return inputFunction;\n})();\n\n/**\n * Creates an ElementRef from the most recent node.\n *\n * @returns The ElementRef instance to use\n */\nfunction injectElementRef() {\n return createElementRef(getCurrentTNode(), getLView());\n}\n/**\n * Creates an ElementRef given a node.\n *\n * @param tNode The node for which you'd like an ElementRef\n * @param lView The view to which the node belongs\n * @returns The ElementRef instance to use\n */\nfunction createElementRef(tNode, lView) {\n return new ElementRef(getNativeByTNode(tNode, lView));\n}\n/**\n * A wrapper around a native element inside of a View.\n *\n * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM\n * element.\n *\n * @security Permitting direct access to the DOM can make your application more vulnerable to\n * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the\n * [Security Guide](https://g.co/ng/security).\n *\n * @publicApi\n */\n// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,\n// i.e. users have to ask for what they need. With that, we can build better analysis tools\n// and could do better codegen in the future.\nlet ElementRef = /*#__PURE__*/(() => {\n class ElementRef {\n /**\n *
          \n *
          Use with caution
          \n *

          \n * Use this API as the last resort when direct access to DOM is needed. Use templating and\n * data-binding provided by Angular instead. Alternatively you can take a look at\n * {@link Renderer2} which provides an API that can be safely used.\n *

          \n *
          \n */\n nativeElement;\n constructor(nativeElement) {\n this.nativeElement = nativeElement;\n }\n /**\n * @internal\n * @nocollapse\n */\n static __NG_ELEMENT_ID__ = injectElementRef;\n }\n return ElementRef;\n})();\n/**\n * Unwraps `ElementRef` and return the `nativeElement`.\n *\n * @param value value to unwrap\n * @returns `nativeElement` if `ElementRef` otherwise returns value as is.\n */\nfunction unwrapElementRef(value) {\n return value instanceof ElementRef ? value.nativeElement : value;\n}\nfunction symbolIterator() {\n // @ts-expect-error accessing a private member\n return this._results[Symbol.iterator]();\n}\n/**\n * An unmodifiable list of items that Angular keeps up to date when the state\n * of the application changes.\n *\n * The type of object that {@link ViewChildren}, {@link ContentChildren}, and {@link QueryList}\n * provide.\n *\n * Implements an iterable interface, therefore it can be used in both ES6\n * javascript `for (var i of items)` loops as well as in Angular templates with\n * `*ngFor=\"let i of myList\"`.\n *\n * Changes can be observed by subscribing to the changes `Observable`.\n *\n * NOTE: In the future this class will implement an `Observable` interface.\n *\n * @usageNotes\n * ### Example\n * ```ts\n * @Component({...})\n * class Container {\n * @ViewChildren(Item) items:QueryList;\n * }\n * ```\n *\n * @publicApi\n */\nclass QueryList {\n _emitDistinctChangesOnly;\n dirty = true;\n _onDirty = undefined;\n _results = [];\n _changesDetected = false;\n _changes = undefined;\n length = 0;\n first = undefined;\n last = undefined;\n /**\n * Returns `Observable` of `QueryList` notifying the subscriber of changes.\n */\n get changes() {\n return this._changes ??= new Subject();\n }\n /**\n * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change\n * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in\n * the same result)\n */\n constructor(_emitDistinctChangesOnly = false) {\n this._emitDistinctChangesOnly = _emitDistinctChangesOnly;\n }\n /**\n * Returns the QueryList entry at `index`.\n */\n get(index) {\n return this._results[index];\n }\n /**\n * See\n * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\n */\n map(fn) {\n return this._results.map(fn);\n }\n filter(fn) {\n return this._results.filter(fn);\n }\n /**\n * See\n * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)\n */\n find(fn) {\n return this._results.find(fn);\n }\n /**\n * See\n * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)\n */\n reduce(fn, init) {\n return this._results.reduce(fn, init);\n }\n /**\n * See\n * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)\n */\n forEach(fn) {\n this._results.forEach(fn);\n }\n /**\n * See\n * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)\n */\n some(fn) {\n return this._results.some(fn);\n }\n /**\n * Returns a copy of the internal results list as an Array.\n */\n toArray() {\n return this._results.slice();\n }\n toString() {\n return this._results.toString();\n }\n /**\n * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that\n * on change detection, it will not notify of changes to the queries, unless a new change\n * occurs.\n *\n * @param resultsTree The query results to store\n * @param identityAccessor Optional function for extracting stable object identity from a value\n * in the array. This function is executed for each element of the query result list while\n * comparing current query list with the new one (provided as a first argument of the `reset`\n * function) to detect if the lists are different. If the function is not provided, elements\n * are compared as is (without any pre-processing).\n */\n reset(resultsTree, identityAccessor) {\n this.dirty = false;\n const newResultFlat = flatten(resultsTree);\n if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) {\n this._results = newResultFlat;\n this.length = newResultFlat.length;\n this.last = newResultFlat[this.length - 1];\n this.first = newResultFlat[0];\n }\n }\n /**\n * Triggers a change event by emitting on the `changes` {@link EventEmitter}.\n */\n notifyOnChanges() {\n if (this._changes !== undefined && (this._changesDetected || !this._emitDistinctChangesOnly)) this._changes.next(this);\n }\n /** @internal */\n onDirty(cb) {\n this._onDirty = cb;\n }\n /** internal */\n setDirty() {\n this.dirty = true;\n this._onDirty?.();\n }\n /** internal */\n destroy() {\n if (this._changes !== undefined) {\n this._changes.complete();\n this._changes.unsubscribe();\n }\n }\n [Symbol.iterator] = /*#__PURE__*/(() => symbolIterator)();\n}\n\n/**\n * The name of an attribute that can be added to the hydration boundary node\n * (component host node) to disable hydration for the content within that boundary.\n */\nconst SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration';\n/** Lowercase name of the `ngSkipHydration` attribute used for case-insensitive comparisons. */\nconst SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = 'ngskiphydration';\n/**\n * Helper function to check if a given TNode has the 'ngSkipHydration' attribute.\n */\nfunction hasSkipHydrationAttrOnTNode(tNode) {\n const attrs = tNode.mergedAttrs;\n if (attrs === null) return false;\n // only ever look at the attribute name and skip the values\n for (let i = 0; i < attrs.length; i += 2) {\n const value = attrs[i];\n // This is a marker, which means that the static attributes section is over,\n // so we can exit early.\n if (typeof value === 'number') return false;\n if (typeof value === 'string' && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) {\n return true;\n }\n }\n return false;\n}\n/**\n * Helper function to check if a given RElement has the 'ngSkipHydration' attribute.\n */\nfunction hasSkipHydrationAttrOnRElement(rNode) {\n return rNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME);\n}\n/**\n * Checks whether a TNode has a flag to indicate that it's a part of\n * a skip hydration block.\n */\nfunction hasInSkipHydrationBlockFlag(tNode) {\n return (tNode.flags & 128 /* TNodeFlags.inSkipHydrationBlock */) === 128 /* TNodeFlags.inSkipHydrationBlock */;\n}\n/**\n * Helper function that determines if a given node is within a skip hydration block\n * by navigating up the TNode tree to see if any parent nodes have skip hydration\n * attribute.\n */\nfunction isInSkipHydrationBlock(tNode) {\n if (hasInSkipHydrationBlockFlag(tNode)) {\n return true;\n }\n let currentTNode = tNode.parent;\n while (currentTNode) {\n if (hasInSkipHydrationBlockFlag(tNode) || hasSkipHydrationAttrOnTNode(currentTNode)) {\n return true;\n }\n currentTNode = currentTNode.parent;\n }\n return false;\n}\n/**\n * Check if an i18n block is in a skip hydration section by looking at a parent TNode\n * to determine if this TNode is in a skip hydration section or the TNode has\n * the `ngSkipHydration` attribute.\n */\nfunction isI18nInSkipHydrationBlock(parentTNode) {\n return hasInSkipHydrationBlockFlag(parentTNode) || hasSkipHydrationAttrOnTNode(parentTNode) || isInSkipHydrationBlock(parentTNode);\n}\n\n/**\n * The strategy that the default change detector uses to detect changes.\n * When set, takes effect the next time change detection is triggered.\n *\n * @see [Change detection usage](/api/core/ChangeDetectorRef?tab=usage-notes)\n * @see [Skipping component subtrees](/best-practices/skipping-subtrees)\n *\n * @publicApi\n */\nvar ChangeDetectionStrategy = /*#__PURE__*/function (ChangeDetectionStrategy) {\n /**\n * Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated\n * until reactivated by setting the strategy to `Default` (`CheckAlways`).\n * Change detection can still be explicitly invoked.\n * This strategy applies to all child directives and cannot be overridden.\n */\n ChangeDetectionStrategy[ChangeDetectionStrategy[\"OnPush\"] = 0] = \"OnPush\";\n /**\n * Use the default `CheckAlways` strategy, in which change detection is automatic until\n * explicitly deactivated.\n */\n ChangeDetectionStrategy[ChangeDetectionStrategy[\"Default\"] = 1] = \"Default\";\n return ChangeDetectionStrategy;\n}(ChangeDetectionStrategy || {});\n// Keeps track of the currently-active LViews.\nconst TRACKED_LVIEWS = /*#__PURE__*/new Map();\n// Used for generating unique IDs for LViews.\nlet uniqueIdCounter = 0;\n/** Gets a unique ID that can be assigned to an LView. */\nfunction getUniqueLViewId() {\n return uniqueIdCounter++;\n}\n/** Starts tracking an LView. */\nfunction registerLView(lView) {\n ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');\n TRACKED_LVIEWS.set(lView[ID], lView);\n}\n/** Gets an LView by its unique ID. */\nfunction getLViewById(id) {\n ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');\n return TRACKED_LVIEWS.get(id) || null;\n}\n/** Stops tracking an LView. */\nfunction unregisterLView(lView) {\n ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');\n TRACKED_LVIEWS.delete(lView[ID]);\n}\n/** Gets the currently-tracked views. */\nfunction getTrackedLViews() {\n return TRACKED_LVIEWS;\n}\n\n/**\n * The internal view context which is specific to a given DOM element, directive or\n * component instance. Each value in here (besides the LView and element node details)\n * can be present, null or undefined. If undefined then it implies the value has not been\n * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.\n *\n * Each value will get filled when the respective value is examined within the getContext\n * function. The component, element and each directive instance will share the same instance\n * of the context.\n */\nclass LContext {\n lViewId;\n nodeIndex;\n native;\n /**\n * The instance of the Component node.\n */\n component;\n /**\n * The list of active directives that exist on this element.\n */\n directives;\n /**\n * The map of local references (local reference name => element or directive instance) that\n * exist on this element.\n */\n localRefs;\n /** Component's parent view data. */\n get lView() {\n return getLViewById(this.lViewId);\n }\n constructor(\n /**\n * ID of the component's parent view data.\n */\n lViewId,\n /**\n * The index instance of the node.\n */\n nodeIndex,\n /**\n * The instance of the DOM node that is attached to the lNode.\n */\n native) {\n this.lViewId = lViewId;\n this.nodeIndex = nodeIndex;\n this.native = native;\n }\n}\n\n/**\n * Returns the matching `LContext` data for a given DOM node, directive or component instance.\n *\n * This function will examine the provided DOM element, component, or directive instance\\'s\n * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched\n * value will be that of the newly created `LContext`.\n *\n * If the monkey-patched value is the `LView` instance then the context value for that\n * target will be created and the monkey-patch reference will be updated. Therefore when this\n * function is called it may mutate the provided element\\'s, component\\'s or any of the associated\n * directive\\'s monkey-patch values.\n *\n * If the monkey-patch value is not detected then the code will walk up the DOM until an element\n * is found which contains a monkey-patch reference. When that occurs then the provided element\n * will be updated with a new context (which is then returned). If the monkey-patch value is not\n * detected for a component/directive instance then it will throw an error (all components and\n * directives should be automatically monkey-patched by ivy).\n *\n * @param target Component, Directive or DOM Node.\n */\nfunction getLContext(target) {\n let mpValue = readPatchedData(target);\n if (mpValue) {\n // only when it's an array is it considered an LView instance\n // ... otherwise it's an already constructed LContext instance\n if (isLView(mpValue)) {\n const lView = mpValue;\n let nodeIndex;\n let component = undefined;\n let directives = undefined;\n if (isComponentInstance(target)) {\n nodeIndex = findViaComponent(lView, target);\n if (nodeIndex == -1) {\n throw new Error('The provided component was not found in the application');\n }\n component = target;\n } else if (isDirectiveInstance(target)) {\n nodeIndex = findViaDirective(lView, target);\n if (nodeIndex == -1) {\n throw new Error('The provided directive was not found in the application');\n }\n directives = getDirectivesAtNodeIndex(nodeIndex, lView);\n } else {\n nodeIndex = findViaNativeElement(lView, target);\n if (nodeIndex == -1) {\n return null;\n }\n }\n // the goal is not to fill the entire context full of data because the lookups\n // are expensive. Instead, only the target data (the element, component, container, ICU\n // expression or directive details) are filled into the context. If called multiple times\n // with different target values then the missing target data will be filled in.\n const native = unwrapRNode(lView[nodeIndex]);\n const existingCtx = readPatchedData(native);\n const context = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native);\n // only when the component has been discovered then update the monkey-patch\n if (component && context.component === undefined) {\n context.component = component;\n attachPatchData(context.component, context);\n }\n // only when the directives have been discovered then update the monkey-patch\n if (directives && context.directives === undefined) {\n context.directives = directives;\n for (let i = 0; i < directives.length; i++) {\n attachPatchData(directives[i], context);\n }\n }\n attachPatchData(context.native, context);\n mpValue = context;\n }\n } else {\n const rElement = target;\n ngDevMode && assertDomNode(rElement);\n // if the context is not found then we need to traverse upwards up the DOM\n // to find the nearest element that has already been monkey patched with data\n let parent = rElement;\n while (parent = parent.parentNode) {\n const parentContext = readPatchedData(parent);\n if (parentContext) {\n const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;\n // the edge of the app was also reached here through another means\n // (maybe because the DOM was changed manually).\n if (!lView) {\n return null;\n }\n const index = findViaNativeElement(lView, rElement);\n if (index >= 0) {\n const native = unwrapRNode(lView[index]);\n const context = createLContext(lView, index, native);\n attachPatchData(native, context);\n mpValue = context;\n break;\n }\n }\n }\n }\n return mpValue || null;\n}\n/**\n * Creates an empty instance of a `LContext` context\n */\nfunction createLContext(lView, nodeIndex, native) {\n return new LContext(lView[ID], nodeIndex, native);\n}\n/**\n * Takes a component instance and returns the view for that component.\n *\n * @param componentInstance\n * @returns The component's view\n */\nfunction getComponentViewByInstance(componentInstance) {\n let patchedData = readPatchedData(componentInstance);\n let lView;\n if (isLView(patchedData)) {\n const contextLView = patchedData;\n const nodeIndex = findViaComponent(contextLView, componentInstance);\n lView = getComponentLViewByIndex(nodeIndex, contextLView);\n const context = createLContext(contextLView, nodeIndex, lView[HOST]);\n context.component = componentInstance;\n attachPatchData(componentInstance, context);\n attachPatchData(context.native, context);\n } else {\n const context = patchedData;\n const contextLView = context.lView;\n ngDevMode && assertLView(contextLView);\n lView = getComponentLViewByIndex(context.nodeIndex, contextLView);\n }\n return lView;\n}\n/**\n * This property will be monkey-patched on elements, components and directives.\n */\nconst MONKEY_PATCH_KEY_NAME = '__ngContext__';\nfunction attachLViewId(target, data) {\n target[MONKEY_PATCH_KEY_NAME] = data[ID];\n}\n/**\n * Returns the monkey-patch value data present on the target (which could be\n * a component, directive or a DOM node).\n */\nfunction readLView(target) {\n const data = readPatchedData(target);\n if (isLView(data)) {\n return data;\n }\n return data ? data.lView : null;\n}\n/**\n * Assigns the given data to the given target (which could be a component,\n * directive or DOM node instance) using monkey-patching.\n */\nfunction attachPatchData(target, data) {\n ngDevMode && assertDefined(target, 'Target expected');\n // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this\n // for `LView`, because we have control over when an `LView` is created and destroyed, whereas\n // we can't know when to remove an `LContext`.\n if (isLView(data)) {\n target[MONKEY_PATCH_KEY_NAME] = data[ID];\n registerLView(data);\n } else {\n target[MONKEY_PATCH_KEY_NAME] = data;\n }\n}\n/**\n * Returns the monkey-patch value data present on the target (which could be\n * a component, directive or a DOM node).\n */\nfunction readPatchedData(target) {\n ngDevMode && assertDefined(target, 'Target expected');\n const data = target[MONKEY_PATCH_KEY_NAME];\n return typeof data === 'number' ? getLViewById(data) : data || null;\n}\nfunction readPatchedLView(target) {\n const value = readPatchedData(target);\n if (value) {\n return isLView(value) ? value : value.lView;\n }\n return null;\n}\nfunction isComponentInstance(instance) {\n return instance && instance.constructor && instance.constructor.ɵcmp;\n}\nfunction isDirectiveInstance(instance) {\n return instance && instance.constructor && instance.constructor.ɵdir;\n}\n/**\n * Locates the element within the given LView and returns the matching index\n */\nfunction findViaNativeElement(lView, target) {\n const tView = lView[TVIEW];\n for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {\n if (unwrapRNode(lView[i]) === target) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Locates the next tNode (child, sibling or parent).\n */\nfunction traverseNextElement(tNode) {\n if (tNode.child) {\n return tNode.child;\n } else if (tNode.next) {\n return tNode.next;\n } else {\n // Let's take the following template:
          text
          \n // After checking the text node, we need to find the next parent that has a \"next\" TNode,\n // in this case the parent `div`, so that we can find the component.\n while (tNode.parent && !tNode.parent.next) {\n tNode = tNode.parent;\n }\n return tNode.parent && tNode.parent.next;\n }\n}\n/**\n * Locates the component within the given LView and returns the matching index\n */\nfunction findViaComponent(lView, componentInstance) {\n const componentIndices = lView[TVIEW].components;\n if (componentIndices) {\n for (let i = 0; i < componentIndices.length; i++) {\n const elementComponentIndex = componentIndices[i];\n const componentView = getComponentLViewByIndex(elementComponentIndex, lView);\n if (componentView[CONTEXT] === componentInstance) {\n return elementComponentIndex;\n }\n }\n } else {\n const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);\n const rootComponent = rootComponentView[CONTEXT];\n if (rootComponent === componentInstance) {\n // we are dealing with the root element here therefore we know that the\n // element is the very first element after the HEADER data in the lView\n return HEADER_OFFSET;\n }\n }\n return -1;\n}\n/**\n * Locates the directive within the given LView and returns the matching index\n */\nfunction findViaDirective(lView, directiveInstance) {\n // if a directive is monkey patched then it will (by default)\n // have a reference to the LView of the current view. The\n // element bound to the directive being search lives somewhere\n // in the view data. We loop through the nodes and check their\n // list of directives for the instance.\n let tNode = lView[TVIEW].firstChild;\n while (tNode) {\n const directiveIndexStart = tNode.directiveStart;\n const directiveIndexEnd = tNode.directiveEnd;\n for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {\n if (lView[i] === directiveInstance) {\n return tNode.index;\n }\n }\n tNode = traverseNextElement(tNode);\n }\n return -1;\n}\n/**\n * Returns a list of directives applied to a node at a specific index. The list includes\n * directives matched by selector and any host directives, but it excludes components.\n * Use `getComponentAtNodeIndex` to find the component applied to a node.\n *\n * @param nodeIndex The node index\n * @param lView The target view data\n */\nfunction getDirectivesAtNodeIndex(nodeIndex, lView) {\n const tNode = lView[TVIEW].data[nodeIndex];\n if (tNode.directiveStart === 0) return EMPTY_ARRAY;\n const results = [];\n for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {\n const directiveInstance = lView[i];\n if (!isComponentInstance(directiveInstance)) {\n results.push(directiveInstance);\n }\n }\n return results;\n}\nfunction getComponentAtNodeIndex(nodeIndex, lView) {\n const tNode = lView[TVIEW].data[nodeIndex];\n const {\n directiveStart,\n componentOffset\n } = tNode;\n return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;\n}\n/**\n * Returns a map of local references (local reference name => element or directive instance) that\n * exist on a given element.\n */\nfunction discoverLocalRefs(lView, nodeIndex) {\n const tNode = lView[TVIEW].data[nodeIndex];\n if (tNode && tNode.localNames) {\n const result = {};\n let localIndex = tNode.index + 1;\n for (let i = 0; i < tNode.localNames.length; i += 2) {\n result[tNode.localNames[i]] = lView[localIndex];\n localIndex++;\n }\n return result;\n }\n return null;\n}\n\n/**\n * Retrieve the root view from any component or `LView` by walking the parent `LView` until\n * reaching the root `LView`.\n *\n * @param componentOrLView any component or `LView`\n */\nfunction getRootView(componentOrLView) {\n ngDevMode && assertDefined(componentOrLView, 'component');\n let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);\n while (lView && !(lView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {\n lView = getLViewParent(lView);\n }\n ngDevMode && assertLView(lView);\n return lView;\n}\n/**\n * Returns the context information associated with the application where the target is situated. It\n * does this by walking the parent views until it gets to the root view, then getting the context\n * off of that.\n *\n * @param viewOrComponent the `LView` or component to get the root context for.\n */\nfunction getRootContext(viewOrComponent) {\n const rootView = getRootView(viewOrComponent);\n ngDevMode && assertDefined(rootView[CONTEXT], 'Root view has no context. Perhaps it is disconnected?');\n return rootView[CONTEXT];\n}\n/**\n * Gets the first `LContainer` in the LView or `null` if none exists.\n */\nfunction getFirstLContainer(lView) {\n return getNearestLContainer(lView[CHILD_HEAD]);\n}\n/**\n * Gets the next `LContainer` that is a sibling of the given container.\n */\nfunction getNextLContainer(container) {\n return getNearestLContainer(container[NEXT]);\n}\nfunction getNearestLContainer(viewOrContainer) {\n while (viewOrContainer !== null && !isLContainer(viewOrContainer)) {\n viewOrContainer = viewOrContainer[NEXT];\n }\n return viewOrContainer;\n}\n\n/**\n * Retrieves the component instance associated with a given DOM element.\n *\n * @usageNotes\n * Given the following DOM structure:\n *\n * ```html\n * \n *
          \n * \n *
          \n *
          \n * ```\n *\n * Calling `getComponent` on `` will return the instance of `ChildComponent`\n * associated with this DOM element.\n *\n * Calling the function on `` will return the `MyApp` instance.\n *\n *\n * @param element DOM element from which the component should be retrieved.\n * @returns Component instance associated with the element or `null` if there\n * is no component associated with it.\n *\n * @publicApi\n */\nfunction getComponent(element) {\n ngDevMode && assertDomElement(element);\n const context = getLContext(element);\n if (context === null) return null;\n if (context.component === undefined) {\n const lView = context.lView;\n if (lView === null) {\n return null;\n }\n context.component = getComponentAtNodeIndex(context.nodeIndex, lView);\n }\n return context.component;\n}\n/**\n * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded\n * view that the element is part of. Otherwise retrieves the instance of the component whose view\n * owns the element (in this case, the result is the same as calling `getOwningComponent`).\n *\n * @param element Element for which to get the surrounding component instance.\n * @returns Instance of the component that is around the element or null if the element isn't\n * inside any component.\n *\n * @publicApi\n */\nfunction getContext(element) {\n assertDomElement(element);\n const context = getLContext(element);\n const lView = context ? context.lView : null;\n return lView === null ? null : lView[CONTEXT];\n}\n/**\n * Retrieves the component instance whose view contains the DOM element.\n *\n * For example, if `` is used in the template of ``\n * (i.e. a `ViewChild` of ``), calling `getOwningComponent` on ``\n * would return ``.\n *\n * @param elementOrDir DOM element, component or directive instance\n * for which to retrieve the root components.\n * @returns Component instance whose view owns the DOM element or null if the element is not\n * part of a component view.\n *\n * @publicApi\n */\nfunction getOwningComponent(elementOrDir) {\n const context = getLContext(elementOrDir);\n let lView = context ? context.lView : null;\n if (lView === null) return null;\n let parent;\n while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {\n lView = parent;\n }\n return lView[FLAGS] & 512 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];\n}\n/**\n * Retrieves all root components associated with a DOM element, directive or component instance.\n * Root components are those which have been bootstrapped by Angular.\n *\n * @param elementOrDir DOM element, component or directive instance\n * for which to retrieve the root components.\n * @returns Root components associated with the target object.\n *\n * @publicApi\n */\nfunction getRootComponents(elementOrDir) {\n const lView = readPatchedLView(elementOrDir);\n return lView !== null ? [getRootContext(lView)] : [];\n}\n/**\n * Retrieves an `Injector` associated with an element, component or directive instance.\n *\n * @param elementOrDir DOM element, component or directive instance for which to\n * retrieve the injector.\n * @returns Injector associated with the element, component or directive instance.\n *\n * @publicApi\n */\nfunction getInjector(elementOrDir) {\n const context = getLContext(elementOrDir);\n const lView = context ? context.lView : null;\n if (lView === null) return Injector.NULL;\n const tNode = lView[TVIEW].data[context.nodeIndex];\n return new NodeInjector(tNode, lView);\n}\n/**\n * Retrieve a set of injection tokens at a given DOM node.\n *\n * @param element Element for which the injection tokens should be retrieved.\n */\nfunction getInjectionTokens(element) {\n const context = getLContext(element);\n const lView = context ? context.lView : null;\n if (lView === null) return [];\n const tView = lView[TVIEW];\n const tNode = tView.data[context.nodeIndex];\n const providerTokens = [];\n const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;\n const endIndex = tNode.directiveEnd;\n for (let i = startIndex; i < endIndex; i++) {\n let value = tView.data[i];\n if (isDirectiveDefHack(value)) {\n // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a\n // design flaw. We should always store same type so that we can be monomorphic. The issue\n // is that for Components/Directives we store the def instead the type. The correct behavior\n // is that we should always be storing injectable type in this location.\n value = value.type;\n }\n providerTokens.push(value);\n }\n return providerTokens;\n}\n/**\n * Retrieves directive instances associated with a given DOM node. Does not include\n * component instances.\n *\n * @usageNotes\n * Given the following DOM structure:\n *\n * ```html\n * \n * \n * \n * \n * ```\n *\n * Calling `getDirectives` on ` December
          Mon
          Tue
          Wed
          Thu
          Fri
          Sat
          Sun
          25
          26
          27
          28
          29
          30
          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          16
          17
          18
          19
          20
          21
          22
          23
          24
          25
          26
          27
          28
          29
          30
          31
          1
          2
          3
          4
          5

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
          - +

          Dozens of
          components +

          Angular
          Open source
          December
          Mon
          Tue
          Wed
          Thu
          Fri
          Sat
          Sun
          25
          26
          27
          28
          29
          30
          1
          2
          3
          4
          5
          6
          7
          8
          9
          10
          11
          12
          13
          14
          15
          16
          17
          18
          19
          20
          21
          22
          23
          24
          25
          26
          27
          28
          29
          30
          31
          1
          2
          3
          4
          5

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit leo lobortis eget.
          + \ No newline at end of file diff --git a/main-2JDNF67F.js.map b/main-2JDNF67F.js.map deleted file mode 100644 index 8c9d76ee..00000000 --- a/main-2JDNF67F.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["node_modules/@angular/router/fesm2022/router.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-platform.mjs","node_modules/@ng-web-apis/screen-orientation/fesm2022/ng-web-apis-screen-orientation.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-visual-viewport.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-directives-popup.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-root.mjs","apps/demo/src/app/app.component.ts","apps/demo/src/app/app.component.html","node_modules/@angular/platform-browser/fesm2022/animations.mjs","apps/demo/src/app/app.config.ts","apps/demo/src/environments/environment.ts","apps/demo/src/main.ts"],"sourcesContent":["/**\n * @license Angular v19.0.3\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { ɵisPromise, ɵRuntimeError, Injectable, createEnvironmentInjector, ɵisNgModule, isStandalone, InjectionToken, EventEmitter, input, inject, ViewContainerRef, ChangeDetectorRef, Directive, Input, Output, reflectComponentType, ɵisInjectable, runInInjectionContext, Component, Compiler, NgModuleFactory, NgZone, afterNextRender, EnvironmentInjector, ɵConsole, ɵPendingTasks, ɵɵsanitizeUrlOrResourceUrl, booleanAttribute, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, InjectFlags, APP_INITIALIZER, SkipSelf, NgModule, Inject, Version, ɵpublishExternalGlobalUtil } from '@angular/core';\nimport { isObservable, from, of, BehaviorSubject, combineLatest, EmptyError, concat, defer, pipe, throwError, EMPTY, ConnectableObservable, Subject, Subscription } from 'rxjs';\nimport * as i3 from '@angular/common';\nimport { DOCUMENT, Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';\nimport { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, defaultIfEmpty, last as last$1, takeLast, mapTo, finalize, refCount, takeUntil, mergeAll } from 'rxjs/operators';\nimport * as i1 from '@angular/platform-browser';\n\n/**\n * The primary routing outlet.\n *\n * @publicApi\n */\nconst PRIMARY_OUTLET = 'primary';\n/**\n * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a\n * static string or `Route.resolve` if anything else. This allows us to reuse the existing route\n * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.\n */\nconst RouteTitleKey = /* @__PURE__ */Symbol('RouteTitle');\nclass ParamsAsMap {\n params;\n constructor(params) {\n this.params = params || {};\n }\n has(name) {\n return Object.prototype.hasOwnProperty.call(this.params, name);\n }\n get(name) {\n if (this.has(name)) {\n const v = this.params[name];\n return Array.isArray(v) ? v[0] : v;\n }\n return null;\n }\n getAll(name) {\n if (this.has(name)) {\n const v = this.params[name];\n return Array.isArray(v) ? v : [v];\n }\n return [];\n }\n get keys() {\n return Object.keys(this.params);\n }\n}\n/**\n * Converts a `Params` instance to a `ParamMap`.\n * @param params The instance to convert.\n * @returns The new map instance.\n *\n * @publicApi\n */\nfunction convertToParamMap(params) {\n return new ParamsAsMap(params);\n}\n/**\n * Matches the route configuration (`route`) against the actual URL (`segments`).\n *\n * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.\n *\n * @param segments The remaining unmatched segments in the current navigation\n * @param segmentGroup The current segment group being matched\n * @param route The `Route` to match against.\n *\n * @see {@link UrlMatchResult}\n * @see {@link Route}\n *\n * @returns The resulting match information or `null` if the `route` should not match.\n * @publicApi\n */\nfunction defaultUrlMatcher(segments, segmentGroup, route) {\n const parts = route.path.split('/');\n if (parts.length > segments.length) {\n // The actual URL is shorter than the config, no match\n return null;\n }\n if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) {\n // The config is longer than the actual URL but we are looking for a full match, return null\n return null;\n }\n const posParams = {};\n // Check each config part against the actual URL\n for (let index = 0; index < parts.length; index++) {\n const part = parts[index];\n const segment = segments[index];\n const isParameter = part[0] === ':';\n if (isParameter) {\n posParams[part.substring(1)] = segment;\n } else if (part !== segment.path) {\n // The actual URL part does not match the config, no match\n return null;\n }\n }\n return {\n consumed: segments.slice(0, parts.length),\n posParams\n };\n}\nfunction shallowEqualArrays(a, b) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (!shallowEqual(a[i], b[i])) return false;\n }\n return true;\n}\nfunction shallowEqual(a, b) {\n // While `undefined` should never be possible, it would sometimes be the case in IE 11\n // and pre-chromium Edge. The check below accounts for this edge case.\n const k1 = a ? getDataKeys(a) : undefined;\n const k2 = b ? getDataKeys(b) : undefined;\n if (!k1 || !k2 || k1.length != k2.length) {\n return false;\n }\n let key;\n for (let i = 0; i < k1.length; i++) {\n key = k1[i];\n if (!equalArraysOrString(a[key], b[key])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Gets the keys of an object, including `symbol` keys.\n */\nfunction getDataKeys(obj) {\n return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];\n}\n/**\n * Test equality for arrays of strings or a string.\n */\nfunction equalArraysOrString(a, b) {\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n const aSorted = [...a].sort();\n const bSorted = [...b].sort();\n return aSorted.every((val, index) => bSorted[index] === val);\n } else {\n return a === b;\n }\n}\n/**\n * Return the last element of an array.\n */\nfunction last(a) {\n return a.length > 0 ? a[a.length - 1] : null;\n}\nfunction wrapIntoObservable(value) {\n if (isObservable(value)) {\n return value;\n }\n if (ɵisPromise(value)) {\n // Use `Promise.resolve()` to wrap promise-like instances.\n // Required ie when a Resolver returns a AngularJS `$q` promise to correctly trigger the\n // change detection.\n return from(Promise.resolve(value));\n }\n return of(value);\n}\nconst pathCompareMap = {\n 'exact': equalSegmentGroups,\n 'subset': containsSegmentGroup\n};\nconst paramCompareMap = {\n 'exact': equalParams,\n 'subset': containsParams,\n 'ignored': () => true\n};\nfunction containsTree(container, containee, options) {\n return pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) && paramCompareMap[options.queryParams](container.queryParams, containee.queryParams) && !(options.fragment === 'exact' && container.fragment !== containee.fragment);\n}\nfunction equalParams(container, containee) {\n // TODO: This does not handle array params correctly.\n return shallowEqual(container, containee);\n}\nfunction equalSegmentGroups(container, containee, matrixParams) {\n if (!equalPath(container.segments, containee.segments)) return false;\n if (!matrixParamsMatch(container.segments, containee.segments, matrixParams)) {\n return false;\n }\n if (container.numberOfChildren !== containee.numberOfChildren) return false;\n for (const c in containee.children) {\n if (!container.children[c]) return false;\n if (!equalSegmentGroups(container.children[c], containee.children[c], matrixParams)) return false;\n }\n return true;\n}\nfunction containsParams(container, containee) {\n return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every(key => equalArraysOrString(container[key], containee[key]));\n}\nfunction containsSegmentGroup(container, containee, matrixParams) {\n return containsSegmentGroupHelper(container, containee, containee.segments, matrixParams);\n}\nfunction containsSegmentGroupHelper(container, containee, containeePaths, matrixParams) {\n if (container.segments.length > containeePaths.length) {\n const current = container.segments.slice(0, containeePaths.length);\n if (!equalPath(current, containeePaths)) return false;\n if (containee.hasChildren()) return false;\n if (!matrixParamsMatch(current, containeePaths, matrixParams)) return false;\n return true;\n } else if (container.segments.length === containeePaths.length) {\n if (!equalPath(container.segments, containeePaths)) return false;\n if (!matrixParamsMatch(container.segments, containeePaths, matrixParams)) return false;\n for (const c in containee.children) {\n if (!container.children[c]) return false;\n if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) {\n return false;\n }\n }\n return true;\n } else {\n const current = containeePaths.slice(0, container.segments.length);\n const next = containeePaths.slice(container.segments.length);\n if (!equalPath(container.segments, current)) return false;\n if (!matrixParamsMatch(container.segments, current, matrixParams)) return false;\n if (!container.children[PRIMARY_OUTLET]) return false;\n return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next, matrixParams);\n }\n}\nfunction matrixParamsMatch(containerPaths, containeePaths, options) {\n return containeePaths.every((containeeSegment, i) => {\n return paramCompareMap[options](containerPaths[i].parameters, containeeSegment.parameters);\n });\n}\n/**\n * @description\n *\n * Represents the parsed URL.\n *\n * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a\n * serialized tree.\n * UrlTree is a data structure that provides a lot of affordances in dealing with URLs\n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const tree: UrlTree =\n * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');\n * const f = tree.fragment; // return 'fragment'\n * const q = tree.queryParams; // returns {debug: 'true'}\n * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];\n * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'\n * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'\n * g.children['support'].segments; // return 1 segment 'help'\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass UrlTree {\n root;\n queryParams;\n fragment;\n /** @internal */\n _queryParamMap;\n constructor(/** The root segment group of the URL tree */\n root = new UrlSegmentGroup([], {}), /** The query params of the URL */\n queryParams = {}, /** The fragment of the URL */\n fragment = null) {\n this.root = root;\n this.queryParams = queryParams;\n this.fragment = fragment;\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (root.segments.length > 0) {\n throw new ɵRuntimeError(4015 /* RuntimeErrorCode.INVALID_ROOT_URL_SEGMENT */, 'The root `UrlSegmentGroup` should not contain `segments`. ' + 'Instead, these segments belong in the `children` so they can be associated with a named outlet.');\n }\n }\n }\n get queryParamMap() {\n this._queryParamMap ??= convertToParamMap(this.queryParams);\n return this._queryParamMap;\n }\n /** @docsNotRequired */\n toString() {\n return DEFAULT_SERIALIZER.serialize(this);\n }\n}\n/**\n * @description\n *\n * Represents the parsed URL segment group.\n *\n * See `UrlTree` for more information.\n *\n * @publicApi\n */\nclass UrlSegmentGroup {\n segments;\n children;\n /** The parent node in the url tree */\n parent = null;\n constructor(/** The URL segments of this group. See `UrlSegment` for more information */\n segments, /** The list of children of this group */\n children) {\n this.segments = segments;\n this.children = children;\n Object.values(children).forEach(v => v.parent = this);\n }\n /** Whether the segment has child segments */\n hasChildren() {\n return this.numberOfChildren > 0;\n }\n /** Number of child segments */\n get numberOfChildren() {\n return Object.keys(this.children).length;\n }\n /** @docsNotRequired */\n toString() {\n return serializePaths(this);\n }\n}\n/**\n * @description\n *\n * Represents a single URL segment.\n *\n * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix\n * parameters associated with the segment.\n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const tree: UrlTree = router.parseUrl('/team;id=33');\n * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];\n * const s: UrlSegment[] = g.segments;\n * s[0].path; // returns 'team'\n * s[0].parameters; // returns {id: 33}\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass UrlSegment {\n path;\n parameters;\n /** @internal */\n _parameterMap;\n constructor(/** The path part of a URL segment */\n path, /** The matrix parameters associated with a segment */\n parameters) {\n this.path = path;\n this.parameters = parameters;\n }\n get parameterMap() {\n this._parameterMap ??= convertToParamMap(this.parameters);\n return this._parameterMap;\n }\n /** @docsNotRequired */\n toString() {\n return serializePath(this);\n }\n}\nfunction equalSegments(as, bs) {\n return equalPath(as, bs) && as.every((a, i) => shallowEqual(a.parameters, bs[i].parameters));\n}\nfunction equalPath(as, bs) {\n if (as.length !== bs.length) return false;\n return as.every((a, i) => a.path === bs[i].path);\n}\nfunction mapChildrenIntoArray(segment, fn) {\n let res = [];\n Object.entries(segment.children).forEach(([childOutlet, child]) => {\n if (childOutlet === PRIMARY_OUTLET) {\n res = res.concat(fn(child, childOutlet));\n }\n });\n Object.entries(segment.children).forEach(([childOutlet, child]) => {\n if (childOutlet !== PRIMARY_OUTLET) {\n res = res.concat(fn(child, childOutlet));\n }\n });\n return res;\n}\n/**\n * @description\n *\n * Serializes and deserializes a URL string into a URL tree.\n *\n * The url serialization strategy is customizable. You can\n * make all URLs case insensitive by providing a custom UrlSerializer.\n *\n * See `DefaultUrlSerializer` for an example of a URL serializer.\n *\n * @publicApi\n */\nlet UrlSerializer = /*#__PURE__*/(() => {\n class UrlSerializer {\n static ɵfac = function UrlSerializer_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UrlSerializer)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlSerializer,\n factory: () => (() => new DefaultUrlSerializer())(),\n providedIn: 'root'\n });\n }\n return UrlSerializer;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * A default implementation of the `UrlSerializer`.\n *\n * Example URLs:\n *\n * ```\n * /inbox/33(popup:compose)\n * /inbox/33;open=true/messages/44\n * ```\n *\n * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the\n * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to\n * specify route specific parameters.\n *\n * @publicApi\n */\nclass DefaultUrlSerializer {\n /** Parses a url into a `UrlTree` */\n parse(url) {\n const p = new UrlParser(url);\n return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());\n }\n /** Converts a `UrlTree` into a url */\n serialize(tree) {\n const segment = `/${serializeSegment(tree.root, true)}`;\n const query = serializeQueryParams(tree.queryParams);\n const fragment = typeof tree.fragment === `string` ? `#${encodeUriFragment(tree.fragment)}` : '';\n return `${segment}${query}${fragment}`;\n }\n}\nconst DEFAULT_SERIALIZER = /*#__PURE__*/new DefaultUrlSerializer();\nfunction serializePaths(segment) {\n return segment.segments.map(p => serializePath(p)).join('/');\n}\nfunction serializeSegment(segment, root) {\n if (!segment.hasChildren()) {\n return serializePaths(segment);\n }\n if (root) {\n const primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : '';\n const children = [];\n Object.entries(segment.children).forEach(([k, v]) => {\n if (k !== PRIMARY_OUTLET) {\n children.push(`${k}:${serializeSegment(v, false)}`);\n }\n });\n return children.length > 0 ? `${primary}(${children.join('//')})` : primary;\n } else {\n const children = mapChildrenIntoArray(segment, (v, k) => {\n if (k === PRIMARY_OUTLET) {\n return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];\n }\n return [`${k}:${serializeSegment(v, false)}`];\n });\n // use no parenthesis if the only child is a primary outlet route\n if (Object.keys(segment.children).length === 1 && segment.children[PRIMARY_OUTLET] != null) {\n return `${serializePaths(segment)}/${children[0]}`;\n }\n return `${serializePaths(segment)}/(${children.join('//')})`;\n }\n}\n/**\n * Encodes a URI string with the default encoding. This function will only ever be called from\n * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need\n * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't\n * have to be encoded per https://url.spec.whatwg.org.\n */\nfunction encodeUriString(s) {\n return encodeURIComponent(s).replace(/%40/g, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',');\n}\n/**\n * This function should be used to encode both keys and values in a query string key/value. In\n * the following URL, you need to call encodeUriQuery on \"k\" and \"v\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriQuery(s) {\n return encodeUriString(s).replace(/%3B/gi, ';');\n}\n/**\n * This function should be used to encode a URL fragment. In the following URL, you need to call\n * encodeUriFragment on \"f\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriFragment(s) {\n return encodeURI(s);\n}\n/**\n * This function should be run on any URI segment as well as the key and value in a key/value\n * pair for matrix params. In the following URL, you need to call encodeUriSegment on \"html\",\n * \"mk\", and \"mv\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriSegment(s) {\n return encodeUriString(s).replace(/\\(/g, '%28').replace(/\\)/g, '%29').replace(/%26/gi, '&');\n}\nfunction decode(s) {\n return decodeURIComponent(s);\n}\n// Query keys/values should have the \"+\" replaced first, as \"+\" in a query string is \" \".\n// decodeURIComponent function will not decode \"+\" as a space.\nfunction decodeQuery(s) {\n return decode(s.replace(/\\+/g, '%20'));\n}\nfunction serializePath(path) {\n return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`;\n}\nfunction serializeMatrixParams(params) {\n return Object.entries(params).map(([key, value]) => `;${encodeUriSegment(key)}=${encodeUriSegment(value)}`).join('');\n}\nfunction serializeQueryParams(params) {\n const strParams = Object.entries(params).map(([name, value]) => {\n return Array.isArray(value) ? value.map(v => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&') : `${encodeUriQuery(name)}=${encodeUriQuery(value)}`;\n }).filter(s => s);\n return strParams.length ? `?${strParams.join('&')}` : '';\n}\nconst SEGMENT_RE = /^[^\\/()?;#]+/;\nfunction matchSegments(str) {\n const match = str.match(SEGMENT_RE);\n return match ? match[0] : '';\n}\nconst MATRIX_PARAM_SEGMENT_RE = /^[^\\/()?;=#]+/;\nfunction matchMatrixKeySegments(str) {\n const match = str.match(MATRIX_PARAM_SEGMENT_RE);\n return match ? match[0] : '';\n}\nconst QUERY_PARAM_RE = /^[^=?&#]+/;\n// Return the name of the query param at the start of the string or an empty string\nfunction matchQueryParams(str) {\n const match = str.match(QUERY_PARAM_RE);\n return match ? match[0] : '';\n}\nconst QUERY_PARAM_VALUE_RE = /^[^&#]+/;\n// Return the value of the query param at the start of the string or an empty string\nfunction matchUrlQueryParamValue(str) {\n const match = str.match(QUERY_PARAM_VALUE_RE);\n return match ? match[0] : '';\n}\nclass UrlParser {\n url;\n remaining;\n constructor(url) {\n this.url = url;\n this.remaining = url;\n }\n parseRootSegment() {\n this.consumeOptional('/');\n if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) {\n return new UrlSegmentGroup([], {});\n }\n // The root segment group never has segments\n return new UrlSegmentGroup([], this.parseChildren());\n }\n parseQueryParams() {\n const params = {};\n if (this.consumeOptional('?')) {\n do {\n this.parseQueryParam(params);\n } while (this.consumeOptional('&'));\n }\n return params;\n }\n parseFragment() {\n return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;\n }\n parseChildren() {\n if (this.remaining === '') {\n return {};\n }\n this.consumeOptional('/');\n const segments = [];\n if (!this.peekStartsWith('(')) {\n segments.push(this.parseSegment());\n }\n while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {\n this.capture('/');\n segments.push(this.parseSegment());\n }\n let children = {};\n if (this.peekStartsWith('/(')) {\n this.capture('/');\n children = this.parseParens(true);\n }\n let res = {};\n if (this.peekStartsWith('(')) {\n res = this.parseParens(false);\n }\n if (segments.length > 0 || Object.keys(children).length > 0) {\n res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);\n }\n return res;\n }\n // parse a segment with its matrix parameters\n // ie `name;k1=v1;k2`\n parseSegment() {\n const path = matchSegments(this.remaining);\n if (path === '' && this.peekStartsWith(';')) {\n throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Empty path url segment cannot have parameters: '${this.remaining}'.`);\n }\n this.capture(path);\n return new UrlSegment(decode(path), this.parseMatrixParams());\n }\n parseMatrixParams() {\n const params = {};\n while (this.consumeOptional(';')) {\n this.parseParam(params);\n }\n return params;\n }\n parseParam(params) {\n const key = matchMatrixKeySegments(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchSegments(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n params[decode(key)] = decode(value);\n }\n // Parse a single query parameter `name[=value]`\n parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n } else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }\n // parse `(a/b//outlet_name:c/d)`\n parseParens(allowPrimary) {\n const segments = {};\n this.capture('(');\n while (!this.consumeOptional(')') && this.remaining.length > 0) {\n const path = matchSegments(this.remaining);\n const next = this.remaining[path.length];\n // if is is not one of these characters, then the segment was unescaped\n // or the group was not closed\n if (next !== '/' && next !== ')' && next !== ';') {\n throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot parse url '${this.url}'`);\n }\n let outletName = undefined;\n if (path.indexOf(':') > -1) {\n outletName = path.slice(0, path.indexOf(':'));\n this.capture(outletName);\n this.capture(':');\n } else if (allowPrimary) {\n outletName = PRIMARY_OUTLET;\n }\n const children = this.parseChildren();\n segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children);\n this.consumeOptional('//');\n }\n return segments;\n }\n peekStartsWith(str) {\n return this.remaining.startsWith(str);\n }\n // Consumes the prefix when it is present and returns whether it has been consumed\n consumeOptional(str) {\n if (this.peekStartsWith(str)) {\n this.remaining = this.remaining.substring(str.length);\n return true;\n }\n return false;\n }\n capture(str) {\n if (!this.consumeOptional(str)) {\n throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Expected \"${str}\".`);\n }\n }\n}\nfunction createRoot(rootCandidate) {\n return rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], {\n [PRIMARY_OUTLET]: rootCandidate\n }) : rootCandidate;\n}\n/**\n * Recursively\n * - merges primary segment children into their parents\n * - drops empty children (those which have no segments and no children themselves). This latter\n * prevents serializing a group into something like `/a(aux:)`, where `aux` is an empty child\n * segment.\n * - merges named outlets without a primary segment sibling into the children. This prevents\n * serializing a URL like `//(a:a)(b:b) instead of `/(a:a//b:b)` when the aux b route lives on the\n * root but the `a` route lives under an empty path primary route.\n */\nfunction squashSegmentGroup(segmentGroup) {\n const newChildren = {};\n for (const [childOutlet, child] of Object.entries(segmentGroup.children)) {\n const childCandidate = squashSegmentGroup(child);\n // moves named children in an empty path primary child into this group\n if (childOutlet === PRIMARY_OUTLET && childCandidate.segments.length === 0 && childCandidate.hasChildren()) {\n for (const [grandChildOutlet, grandChild] of Object.entries(childCandidate.children)) {\n newChildren[grandChildOutlet] = grandChild;\n }\n } // don't add empty children\n else if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {\n newChildren[childOutlet] = childCandidate;\n }\n }\n const s = new UrlSegmentGroup(segmentGroup.segments, newChildren);\n return mergeTrivialChildren(s);\n}\n/**\n * When possible, merges the primary outlet child into the parent `UrlSegmentGroup`.\n *\n * When a segment group has only one child which is a primary outlet, merges that child into the\n * parent. That is, the child segment group's segments are merged into the `s` and the child's\n * children become the children of `s`. Think of this like a 'squash', merging the child segment\n * group into the parent.\n */\nfunction mergeTrivialChildren(s) {\n if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {\n const c = s.children[PRIMARY_OUTLET];\n return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);\n }\n return s;\n}\nfunction isUrlTree(v) {\n return v instanceof UrlTree;\n}\n\n/**\n * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.\n *\n * @publicApi\n *\n *\n * @param relativeTo The `ActivatedRouteSnapshot` to apply the commands to\n * @param commands An array of URL fragments with which to construct the new URL tree.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the one provided in the `relativeTo` parameter.\n * @param queryParams The query parameters for the `UrlTree`. `null` if the `UrlTree` does not have\n * any query parameters.\n * @param fragment The fragment for the `UrlTree`. `null` if the `UrlTree` does not have a fragment.\n *\n * @usageNotes\n *\n * ```ts\n * // create /team/33/user/11\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, 'user', 11]);\n *\n * // create /team/33;expand=true/user/11\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {expand: true}, 'user', 11]);\n *\n * // you can collapse static segments like this (this works only with the first passed-in value):\n * createUrlTreeFromSnapshot(snapshot, ['/team/33/user', userId]);\n *\n * // If the first segment can contain slashes, and you do not want the router to split it,\n * // you can do the following:\n * createUrlTreeFromSnapshot(snapshot, [{segmentPath: '/one/two'}]);\n *\n * // create /team/33/(user/11//right:chat)\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right:\n * 'chat'}}], null, null);\n *\n * // remove the right secondary node\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right: null}}]);\n *\n * // For the examples below, assume the current URL is for the `/team/33/user/11` and the\n * `ActivatedRouteSnapshot` points to `user/11`:\n *\n * // navigate to /team/33/user/11/details\n * createUrlTreeFromSnapshot(snapshot, ['details']);\n *\n * // navigate to /team/33/user/22\n * createUrlTreeFromSnapshot(snapshot, ['../22']);\n *\n * // navigate to /team/44/user/22\n * createUrlTreeFromSnapshot(snapshot, ['../../team/44/user/22']);\n * ```\n */\nfunction createUrlTreeFromSnapshot(relativeTo, commands, queryParams = null, fragment = null) {\n const relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeTo);\n return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, queryParams, fragment);\n}\nfunction createSegmentGroupFromRoute(route) {\n let targetGroup;\n function createSegmentGroupFromRouteRecursive(currentRoute) {\n const childOutlets = {};\n for (const childSnapshot of currentRoute.children) {\n const root = createSegmentGroupFromRouteRecursive(childSnapshot);\n childOutlets[childSnapshot.outlet] = root;\n }\n const segmentGroup = new UrlSegmentGroup(currentRoute.url, childOutlets);\n if (currentRoute === route) {\n targetGroup = segmentGroup;\n }\n return segmentGroup;\n }\n const rootCandidate = createSegmentGroupFromRouteRecursive(route.root);\n const rootSegmentGroup = createRoot(rootCandidate);\n return targetGroup ?? rootSegmentGroup;\n}\nfunction createUrlTreeFromSegmentGroup(relativeTo, commands, queryParams, fragment) {\n let root = relativeTo;\n while (root.parent) {\n root = root.parent;\n }\n // There are no commands so the `UrlTree` goes to the same path as the one created from the\n // `UrlSegmentGroup`. All we need to do is update the `queryParams` and `fragment` without\n // applying any other logic.\n if (commands.length === 0) {\n return tree(root, root, root, queryParams, fragment);\n }\n const nav = computeNavigation(commands);\n if (nav.toRoot()) {\n return tree(root, root, new UrlSegmentGroup([], {}), queryParams, fragment);\n }\n const position = findStartingPositionForTargetGroup(nav, root, relativeTo);\n const newSegmentGroup = position.processChildren ? updateSegmentGroupChildren(position.segmentGroup, position.index, nav.commands) : updateSegmentGroup(position.segmentGroup, position.index, nav.commands);\n return tree(root, position.segmentGroup, newSegmentGroup, queryParams, fragment);\n}\nfunction isMatrixParams(command) {\n return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath;\n}\n/**\n * Determines if a given command has an `outlets` map. When we encounter a command\n * with an outlets k/v map, we need to apply each outlet individually to the existing segment.\n */\nfunction isCommandWithOutlets(command) {\n return typeof command === 'object' && command != null && command.outlets;\n}\nfunction tree(oldRoot, oldSegmentGroup, newSegmentGroup, queryParams, fragment) {\n let qp = {};\n if (queryParams) {\n Object.entries(queryParams).forEach(([name, value]) => {\n qp[name] = Array.isArray(value) ? value.map(v => `${v}`) : `${value}`;\n });\n }\n let rootCandidate;\n if (oldRoot === oldSegmentGroup) {\n rootCandidate = newSegmentGroup;\n } else {\n rootCandidate = replaceSegment(oldRoot, oldSegmentGroup, newSegmentGroup);\n }\n const newRoot = createRoot(squashSegmentGroup(rootCandidate));\n return new UrlTree(newRoot, qp, fragment);\n}\n/**\n * Replaces the `oldSegment` which is located in some child of the `current` with the `newSegment`.\n * This also has the effect of creating new `UrlSegmentGroup` copies to update references. This\n * shouldn't be necessary but the fallback logic for an invalid ActivatedRoute in the creation uses\n * the Router's current url tree. If we don't create new segment groups, we end up modifying that\n * value.\n */\nfunction replaceSegment(current, oldSegment, newSegment) {\n const children = {};\n Object.entries(current.children).forEach(([outletName, c]) => {\n if (c === oldSegment) {\n children[outletName] = newSegment;\n } else {\n children[outletName] = replaceSegment(c, oldSegment, newSegment);\n }\n });\n return new UrlSegmentGroup(current.segments, children);\n}\nclass Navigation {\n isAbsolute;\n numberOfDoubleDots;\n commands;\n constructor(isAbsolute, numberOfDoubleDots, commands) {\n this.isAbsolute = isAbsolute;\n this.numberOfDoubleDots = numberOfDoubleDots;\n this.commands = commands;\n if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {\n throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Root segment cannot have matrix parameters');\n }\n const cmdWithOutlet = commands.find(isCommandWithOutlets);\n if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {\n throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) && '{outlets:{}} has to be the last command');\n }\n }\n toRoot() {\n return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/';\n }\n}\n/** Transforms commands to a normalized `Navigation` */\nfunction computeNavigation(commands) {\n if (typeof commands[0] === 'string' && commands.length === 1 && commands[0] === '/') {\n return new Navigation(true, 0, commands);\n }\n let numberOfDoubleDots = 0;\n let isAbsolute = false;\n const res = commands.reduce((res, cmd, cmdIdx) => {\n if (typeof cmd === 'object' && cmd != null) {\n if (cmd.outlets) {\n const outlets = {};\n Object.entries(cmd.outlets).forEach(([name, commands]) => {\n outlets[name] = typeof commands === 'string' ? commands.split('/') : commands;\n });\n return [...res, {\n outlets\n }];\n }\n if (cmd.segmentPath) {\n return [...res, cmd.segmentPath];\n }\n }\n if (!(typeof cmd === 'string')) {\n return [...res, cmd];\n }\n if (cmdIdx === 0) {\n cmd.split('/').forEach((urlPart, partIndex) => {\n if (partIndex == 0 && urlPart === '.') {\n // skip './a'\n } else if (partIndex == 0 && urlPart === '') {\n // '/a'\n isAbsolute = true;\n } else if (urlPart === '..') {\n // '../a'\n numberOfDoubleDots++;\n } else if (urlPart != '') {\n res.push(urlPart);\n }\n });\n return res;\n }\n return [...res, cmd];\n }, []);\n return new Navigation(isAbsolute, numberOfDoubleDots, res);\n}\nclass Position {\n segmentGroup;\n processChildren;\n index;\n constructor(segmentGroup, processChildren, index) {\n this.segmentGroup = segmentGroup;\n this.processChildren = processChildren;\n this.index = index;\n }\n}\nfunction findStartingPositionForTargetGroup(nav, root, target) {\n if (nav.isAbsolute) {\n return new Position(root, true, 0);\n }\n if (!target) {\n // `NaN` is used only to maintain backwards compatibility with incorrectly mocked\n // `ActivatedRouteSnapshot` in tests. In prior versions of this code, the position here was\n // determined based on an internal property that was rarely mocked, resulting in `NaN`. In\n // reality, this code path should _never_ be touched since `target` is not allowed to be falsey.\n return new Position(root, false, NaN);\n }\n if (target.parent === null) {\n return new Position(target, true, 0);\n }\n const modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;\n const index = target.segments.length - 1 + modifier;\n return createPositionApplyingDoubleDots(target, index, nav.numberOfDoubleDots);\n}\nfunction createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {\n let g = group;\n let ci = index;\n let dd = numberOfDoubleDots;\n while (dd > ci) {\n dd -= ci;\n g = g.parent;\n if (!g) {\n throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, (typeof ngDevMode === 'undefined' || ngDevMode) && \"Invalid number of '../'\");\n }\n ci = g.segments.length;\n }\n return new Position(g, false, ci - dd);\n}\nfunction getOutlets(commands) {\n if (isCommandWithOutlets(commands[0])) {\n return commands[0].outlets;\n }\n return {\n [PRIMARY_OUTLET]: commands\n };\n}\nfunction updateSegmentGroup(segmentGroup, startIndex, commands) {\n segmentGroup ??= new UrlSegmentGroup([], {});\n if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {\n return updateSegmentGroupChildren(segmentGroup, startIndex, commands);\n }\n const m = prefixedWith(segmentGroup, startIndex, commands);\n const slicedCommands = commands.slice(m.commandIndex);\n if (m.match && m.pathIndex < segmentGroup.segments.length) {\n const g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});\n g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);\n return updateSegmentGroupChildren(g, 0, slicedCommands);\n } else if (m.match && slicedCommands.length === 0) {\n return new UrlSegmentGroup(segmentGroup.segments, {});\n } else if (m.match && !segmentGroup.hasChildren()) {\n return createNewSegmentGroup(segmentGroup, startIndex, commands);\n } else if (m.match) {\n return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands);\n } else {\n return createNewSegmentGroup(segmentGroup, startIndex, commands);\n }\n}\nfunction updateSegmentGroupChildren(segmentGroup, startIndex, commands) {\n if (commands.length === 0) {\n return new UrlSegmentGroup(segmentGroup.segments, {});\n } else {\n const outlets = getOutlets(commands);\n const children = {};\n // If the set of commands applies to anything other than the primary outlet and the child\n // segment is an empty path primary segment on its own, we want to apply the commands to the\n // empty child path rather than here. The outcome is that the empty primary child is effectively\n // removed from the final output UrlTree. Imagine the following config:\n //\n // {path: '', children: [{path: '**', outlet: 'popup'}]}.\n //\n // Navigation to /(popup:a) will activate the child outlet correctly Given a follow-up\n // navigation with commands\n // ['/', {outlets: {'popup': 'b'}}], we _would not_ want to apply the outlet commands to the\n // root segment because that would result in\n // //(popup:a)(popup:b) since the outlet command got applied one level above where it appears in\n // the `ActivatedRoute` rather than updating the existing one.\n //\n // Because empty paths do not appear in the URL segments and the fact that the segments used in\n // the output `UrlTree` are squashed to eliminate these empty paths where possible\n // https://github.com/angular/angular/blob/13f10de40e25c6900ca55bd83b36bd533dacfa9e/packages/router/src/url_tree.ts#L755\n // it can be hard to determine what is the right thing to do when applying commands to a\n // `UrlSegmentGroup` that is created from an \"unsquashed\"/expanded `ActivatedRoute` tree.\n // This code effectively \"squashes\" empty path primary routes when they have no siblings on\n // the same level of the tree.\n if (Object.keys(outlets).some(o => o !== PRIMARY_OUTLET) && segmentGroup.children[PRIMARY_OUTLET] && segmentGroup.numberOfChildren === 1 && segmentGroup.children[PRIMARY_OUTLET].segments.length === 0) {\n const childrenOfEmptyChild = updateSegmentGroupChildren(segmentGroup.children[PRIMARY_OUTLET], startIndex, commands);\n return new UrlSegmentGroup(segmentGroup.segments, childrenOfEmptyChild.children);\n }\n Object.entries(outlets).forEach(([outlet, commands]) => {\n if (typeof commands === 'string') {\n commands = [commands];\n }\n if (commands !== null) {\n children[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands);\n }\n });\n Object.entries(segmentGroup.children).forEach(([childOutlet, child]) => {\n if (outlets[childOutlet] === undefined) {\n children[childOutlet] = child;\n }\n });\n return new UrlSegmentGroup(segmentGroup.segments, children);\n }\n}\nfunction prefixedWith(segmentGroup, startIndex, commands) {\n let currentCommandIndex = 0;\n let currentPathIndex = startIndex;\n const noMatch = {\n match: false,\n pathIndex: 0,\n commandIndex: 0\n };\n while (currentPathIndex < segmentGroup.segments.length) {\n if (currentCommandIndex >= commands.length) return noMatch;\n const path = segmentGroup.segments[currentPathIndex];\n const command = commands[currentCommandIndex];\n // Do not try to consume command as part of the prefixing if it has outlets because it can\n // contain outlets other than the one being processed. Consuming the outlets command would\n // result in other outlets being ignored.\n if (isCommandWithOutlets(command)) {\n break;\n }\n const curr = `${command}`;\n const next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;\n if (currentPathIndex > 0 && curr === undefined) break;\n if (curr && next && typeof next === 'object' && next.outlets === undefined) {\n if (!compare(curr, next, path)) return noMatch;\n currentCommandIndex += 2;\n } else {\n if (!compare(curr, {}, path)) return noMatch;\n currentCommandIndex++;\n }\n currentPathIndex++;\n }\n return {\n match: true,\n pathIndex: currentPathIndex,\n commandIndex: currentCommandIndex\n };\n}\nfunction createNewSegmentGroup(segmentGroup, startIndex, commands) {\n const paths = segmentGroup.segments.slice(0, startIndex);\n let i = 0;\n while (i < commands.length) {\n const command = commands[i];\n if (isCommandWithOutlets(command)) {\n const children = createNewSegmentChildren(command.outlets);\n return new UrlSegmentGroup(paths, children);\n }\n // if we start with an object literal, we need to reuse the path part from the segment\n if (i === 0 && isMatrixParams(commands[0])) {\n const p = segmentGroup.segments[startIndex];\n paths.push(new UrlSegment(p.path, stringify(commands[0])));\n i++;\n continue;\n }\n const curr = isCommandWithOutlets(command) ? command.outlets[PRIMARY_OUTLET] : `${command}`;\n const next = i < commands.length - 1 ? commands[i + 1] : null;\n if (curr && next && isMatrixParams(next)) {\n paths.push(new UrlSegment(curr, stringify(next)));\n i += 2;\n } else {\n paths.push(new UrlSegment(curr, {}));\n i++;\n }\n }\n return new UrlSegmentGroup(paths, {});\n}\nfunction createNewSegmentChildren(outlets) {\n const children = {};\n Object.entries(outlets).forEach(([outlet, commands]) => {\n if (typeof commands === 'string') {\n commands = [commands];\n }\n if (commands !== null) {\n children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands);\n }\n });\n return children;\n}\nfunction stringify(params) {\n const res = {};\n Object.entries(params).forEach(([k, v]) => res[k] = `${v}`);\n return res;\n}\nfunction compare(path, params, segment) {\n return path == segment.path && shallowEqual(params, segment.parameters);\n}\nconst IMPERATIVE_NAVIGATION = 'imperative';\n/**\n * Identifies the type of a router event.\n *\n * @publicApi\n */\nvar EventType = /*#__PURE__*/function (EventType) {\n EventType[EventType[\"NavigationStart\"] = 0] = \"NavigationStart\";\n EventType[EventType[\"NavigationEnd\"] = 1] = \"NavigationEnd\";\n EventType[EventType[\"NavigationCancel\"] = 2] = \"NavigationCancel\";\n EventType[EventType[\"NavigationError\"] = 3] = \"NavigationError\";\n EventType[EventType[\"RoutesRecognized\"] = 4] = \"RoutesRecognized\";\n EventType[EventType[\"ResolveStart\"] = 5] = \"ResolveStart\";\n EventType[EventType[\"ResolveEnd\"] = 6] = \"ResolveEnd\";\n EventType[EventType[\"GuardsCheckStart\"] = 7] = \"GuardsCheckStart\";\n EventType[EventType[\"GuardsCheckEnd\"] = 8] = \"GuardsCheckEnd\";\n EventType[EventType[\"RouteConfigLoadStart\"] = 9] = \"RouteConfigLoadStart\";\n EventType[EventType[\"RouteConfigLoadEnd\"] = 10] = \"RouteConfigLoadEnd\";\n EventType[EventType[\"ChildActivationStart\"] = 11] = \"ChildActivationStart\";\n EventType[EventType[\"ChildActivationEnd\"] = 12] = \"ChildActivationEnd\";\n EventType[EventType[\"ActivationStart\"] = 13] = \"ActivationStart\";\n EventType[EventType[\"ActivationEnd\"] = 14] = \"ActivationEnd\";\n EventType[EventType[\"Scroll\"] = 15] = \"Scroll\";\n EventType[EventType[\"NavigationSkipped\"] = 16] = \"NavigationSkipped\";\n return EventType;\n}(EventType || {});\n/**\n * Base for events the router goes through, as opposed to events tied to a specific\n * route. Fired one time for any given navigation.\n *\n * The following code shows how a class subscribes to router events.\n *\n * ```ts\n * import {Event, RouterEvent, Router} from '@angular/router';\n *\n * class MyService {\n * constructor(public router: Router) {\n * router.events.pipe(\n * filter((e: Event | RouterEvent): e is RouterEvent => e instanceof RouterEvent)\n * ).subscribe((e: RouterEvent) => {\n * // Do something\n * });\n * }\n * }\n * ```\n *\n * @see {@link Event}\n * @see [Router events summary](guide/routing/router-reference#router-events)\n * @publicApi\n */\nclass RouterEvent {\n id;\n url;\n constructor(/** A unique ID that the router assigns to every router navigation. */\n id, /** The URL that is the destination for this navigation. */\n url) {\n this.id = id;\n this.url = url;\n }\n}\n/**\n * An event triggered when a navigation starts.\n *\n * @publicApi\n */\nclass NavigationStart extends RouterEvent {\n type = EventType.NavigationStart;\n /**\n * Identifies the call or event that triggered the navigation.\n * An `imperative` trigger is a call to `router.navigateByUrl()` or `router.navigate()`.\n *\n * @see {@link NavigationEnd}\n * @see {@link NavigationCancel}\n * @see {@link NavigationError}\n */\n navigationTrigger;\n /**\n * The navigation state that was previously supplied to the `pushState` call,\n * when the navigation is triggered by a `popstate` event. Otherwise null.\n *\n * The state object is defined by `NavigationExtras`, and contains any\n * developer-defined state value, as well as a unique ID that\n * the router assigns to every router transition/navigation.\n *\n * From the perspective of the router, the router never \"goes back\".\n * When the user clicks on the back button in the browser,\n * a new navigation ID is created.\n *\n * Use the ID in this previous-state object to differentiate between a newly created\n * state and one returned to by a `popstate` event, so that you can restore some\n * remembered state, such as scroll position.\n *\n */\n restoredState;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n navigationTrigger = 'imperative', /** @docsNotRequired */\n restoredState = null) {\n super(id, url);\n this.navigationTrigger = navigationTrigger;\n this.restoredState = restoredState;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationStart(id: ${this.id}, url: '${this.url}')`;\n }\n}\n/**\n * An event triggered when a navigation ends successfully.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationCancel}\n * @see {@link NavigationError}\n *\n * @publicApi\n */\nclass NavigationEnd extends RouterEvent {\n urlAfterRedirects;\n type = EventType.NavigationEnd;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`;\n }\n}\n/**\n * A code for the `NavigationCancel` event of the `Router` to indicate the\n * reason a navigation failed.\n *\n * @publicApi\n */\nvar NavigationCancellationCode = /*#__PURE__*/function (NavigationCancellationCode) {\n /**\n * A navigation failed because a guard returned a `UrlTree` to redirect.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"Redirect\"] = 0] = \"Redirect\";\n /**\n * A navigation failed because a more recent navigation started.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"SupersededByNewNavigation\"] = 1] = \"SupersededByNewNavigation\";\n /**\n * A navigation failed because one of the resolvers completed without emitting a value.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"NoDataFromResolver\"] = 2] = \"NoDataFromResolver\";\n /**\n * A navigation failed because a guard returned `false`.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"GuardRejected\"] = 3] = \"GuardRejected\";\n return NavigationCancellationCode;\n}(NavigationCancellationCode || {});\n/**\n * A code for the `NavigationSkipped` event of the `Router` to indicate the\n * reason a navigation was skipped.\n *\n * @publicApi\n */\nvar NavigationSkippedCode = /*#__PURE__*/function (NavigationSkippedCode) {\n /**\n * A navigation was skipped because the navigation URL was the same as the current Router URL.\n */\n NavigationSkippedCode[NavigationSkippedCode[\"IgnoredSameUrlNavigation\"] = 0] = \"IgnoredSameUrlNavigation\";\n /**\n * A navigation was skipped because the configured `UrlHandlingStrategy` return `false` for both\n * the current Router URL and the target of the navigation.\n *\n * @see {@link UrlHandlingStrategy}\n */\n NavigationSkippedCode[NavigationSkippedCode[\"IgnoredByUrlHandlingStrategy\"] = 1] = \"IgnoredByUrlHandlingStrategy\";\n return NavigationSkippedCode;\n}(NavigationSkippedCode || {});\n/**\n * An event triggered when a navigation is canceled, directly or indirectly.\n * This can happen for several reasons including when a route guard\n * returns `false` or initiates a redirect by returning a `UrlTree`.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationEnd}\n * @see {@link NavigationError}\n *\n * @publicApi\n */\nclass NavigationCancel extends RouterEvent {\n reason;\n code;\n type = EventType.NavigationCancel;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url,\n /**\n * A description of why the navigation was cancelled. For debug purposes only. Use `code`\n * instead for a stable cancellation reason that can be used in production.\n */\n reason,\n /**\n * A code to indicate why the navigation was canceled. This cancellation code is stable for\n * the reason and can be relied on whereas the `reason` string could change and should not be\n * used in production.\n */\n code) {\n super(id, url);\n this.reason = reason;\n this.code = code;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;\n }\n}\n/**\n * An event triggered when a navigation is skipped.\n * This can happen for a couple reasons including onSameUrlHandling\n * is set to `ignore` and the navigation URL is not different than the\n * current state.\n *\n * @publicApi\n */\nclass NavigationSkipped extends RouterEvent {\n reason;\n code;\n type = EventType.NavigationSkipped;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url,\n /**\n * A description of why the navigation was skipped. For debug purposes only. Use `code`\n * instead for a stable skipped reason that can be used in production.\n */\n reason,\n /**\n * A code to indicate why the navigation was skipped. This code is stable for\n * the reason and can be relied on whereas the `reason` string could change and should not be\n * used in production.\n */\n code) {\n super(id, url);\n this.reason = reason;\n this.code = code;\n }\n}\n/**\n * An event triggered when a navigation fails due to an unexpected error.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationEnd}\n * @see {@link NavigationCancel}\n *\n * @publicApi\n */\nclass NavigationError extends RouterEvent {\n error;\n target;\n type = EventType.NavigationError;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n error,\n /**\n * The target of the navigation when the error occurred.\n *\n * Note that this can be `undefined` because an error could have occurred before the\n * `RouterStateSnapshot` was created for the navigation.\n */\n target) {\n super(id, url);\n this.error = error;\n this.target = target;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`;\n }\n}\n/**\n * An event triggered when routes are recognized.\n *\n * @publicApi\n */\nclass RoutesRecognized extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.RoutesRecognized;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n /** @docsNotRequired */\n toString() {\n return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the start of the Guard phase of routing.\n *\n * @see {@link GuardsCheckEnd}\n *\n * @publicApi\n */\nclass GuardsCheckStart extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.GuardsCheckStart;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n toString() {\n return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the end of the Guard phase of routing.\n *\n * @see {@link GuardsCheckStart}\n *\n * @publicApi\n */\nclass GuardsCheckEnd extends RouterEvent {\n urlAfterRedirects;\n state;\n shouldActivate;\n type = EventType.GuardsCheckEnd;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state, /** @docsNotRequired */\n shouldActivate) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n this.shouldActivate = shouldActivate;\n }\n toString() {\n return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`;\n }\n}\n/**\n * An event triggered at the start of the Resolve phase of routing.\n *\n * Runs in the \"resolve\" phase whether or not there is anything to resolve.\n * In future, may change to only run when there are things to be resolved.\n *\n * @see {@link ResolveEnd}\n *\n * @publicApi\n */\nclass ResolveStart extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.ResolveStart;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n toString() {\n return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the end of the Resolve phase of routing.\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ResolveEnd extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.ResolveEnd;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n toString() {\n return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered before lazy loading a route configuration.\n *\n * @see {@link RouteConfigLoadEnd}\n *\n * @publicApi\n */\nclass RouteConfigLoadStart {\n route;\n type = EventType.RouteConfigLoadStart;\n constructor(/** @docsNotRequired */\n route) {\n this.route = route;\n }\n toString() {\n return `RouteConfigLoadStart(path: ${this.route.path})`;\n }\n}\n/**\n * An event triggered when a route has been lazy loaded.\n *\n * @see {@link RouteConfigLoadStart}\n *\n * @publicApi\n */\nclass RouteConfigLoadEnd {\n route;\n type = EventType.RouteConfigLoadEnd;\n constructor(/** @docsNotRequired */\n route) {\n this.route = route;\n }\n toString() {\n return `RouteConfigLoadEnd(path: ${this.route.path})`;\n }\n}\n/**\n * An event triggered at the start of the child-activation\n * part of the Resolve phase of routing.\n * @see {@link ChildActivationEnd}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ChildActivationStart {\n snapshot;\n type = EventType.ChildActivationStart;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ChildActivationStart(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the end of the child-activation part\n * of the Resolve phase of routing.\n * @see {@link ChildActivationStart}\n * @see {@link ResolveStart}\n * @publicApi\n */\nclass ChildActivationEnd {\n snapshot;\n type = EventType.ChildActivationEnd;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ChildActivationEnd(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the start of the activation part\n * of the Resolve phase of routing.\n * @see {@link ActivationEnd}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ActivationStart {\n snapshot;\n type = EventType.ActivationStart;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ActivationStart(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the end of the activation part\n * of the Resolve phase of routing.\n * @see {@link ActivationStart}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ActivationEnd {\n snapshot;\n type = EventType.ActivationEnd;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ActivationEnd(path: '${path}')`;\n }\n}\n/**\n * An event triggered by scrolling.\n *\n * @publicApi\n */\nclass Scroll {\n routerEvent;\n position;\n anchor;\n type = EventType.Scroll;\n constructor(/** @docsNotRequired */\n routerEvent, /** @docsNotRequired */\n position, /** @docsNotRequired */\n anchor) {\n this.routerEvent = routerEvent;\n this.position = position;\n this.anchor = anchor;\n }\n toString() {\n const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null;\n return `Scroll(anchor: '${this.anchor}', position: '${pos}')`;\n }\n}\nclass BeforeActivateRoutes {}\nclass RedirectRequest {\n url;\n navigationBehaviorOptions;\n constructor(url, navigationBehaviorOptions) {\n this.url = url;\n this.navigationBehaviorOptions = navigationBehaviorOptions;\n }\n}\nfunction stringifyEvent(routerEvent) {\n switch (routerEvent.type) {\n case EventType.ActivationEnd:\n return `ActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ActivationStart:\n return `ActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ChildActivationEnd:\n return `ChildActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ChildActivationStart:\n return `ChildActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.GuardsCheckEnd:\n return `GuardsCheckEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state}, shouldActivate: ${routerEvent.shouldActivate})`;\n case EventType.GuardsCheckStart:\n return `GuardsCheckStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.NavigationCancel:\n return `NavigationCancel(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.NavigationSkipped:\n return `NavigationSkipped(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.NavigationEnd:\n return `NavigationEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}')`;\n case EventType.NavigationError:\n return `NavigationError(id: ${routerEvent.id}, url: '${routerEvent.url}', error: ${routerEvent.error})`;\n case EventType.NavigationStart:\n return `NavigationStart(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.ResolveEnd:\n return `ResolveEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.ResolveStart:\n return `ResolveStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.RouteConfigLoadEnd:\n return `RouteConfigLoadEnd(path: ${routerEvent.route.path})`;\n case EventType.RouteConfigLoadStart:\n return `RouteConfigLoadStart(path: ${routerEvent.route.path})`;\n case EventType.RoutesRecognized:\n return `RoutesRecognized(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.Scroll:\n const pos = routerEvent.position ? `${routerEvent.position[0]}, ${routerEvent.position[1]}` : null;\n return `Scroll(anchor: '${routerEvent.anchor}', position: '${pos}')`;\n }\n}\n\n/**\n * Creates an `EnvironmentInjector` if the `Route` has providers and one does not already exist\n * and returns the injector. Otherwise, if the `Route` does not have `providers`, returns the\n * `currentInjector`.\n *\n * @param route The route that might have providers\n * @param currentInjector The parent injector of the `Route`\n */\nfunction getOrCreateRouteInjectorIfNeeded(route, currentInjector) {\n if (route.providers && !route._injector) {\n route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);\n }\n return route._injector ?? currentInjector;\n}\nfunction getLoadedRoutes$1(route) {\n return route._loadedRoutes;\n}\nfunction getLoadedInjector(route) {\n return route._loadedInjector;\n}\nfunction getLoadedComponent(route) {\n return route._loadedComponent;\n}\nfunction getProvidersInjector(route) {\n return route._injector;\n}\nfunction validateConfig(config, parentPath = '', requireStandaloneComponents = false) {\n // forEach doesn't iterate undefined values\n for (let i = 0; i < config.length; i++) {\n const route = config[i];\n const fullPath = getFullPath(parentPath, route);\n validateNode(route, fullPath, requireStandaloneComponents);\n }\n}\nfunction assertStandalone(fullPath, component) {\n if (component && ɵisNgModule(component)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` + `but it must be used with standalone components. Use 'loadChildren' instead.`);\n } else if (component && !isStandalone(component)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);\n }\n}\nfunction validateNode(route, fullPath, requireStandaloneComponents) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!route) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `\n Invalid configuration of route '${fullPath}': Encountered undefined route.\n The reason might be an extra comma.\n\n Example:\n const routes: Routes = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n { path: 'dashboard', component: DashboardComponent },, << two commas\n { path: 'detail/:id', component: HeroDetailComponent }\n ];\n `);\n }\n if (Array.isArray(route)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);\n }\n if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);\n }\n if (route.redirectTo && route.children) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);\n }\n if (route.redirectTo && route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);\n }\n if (route.children && route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);\n }\n if (route.redirectTo && (route.component || route.loadComponent)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);\n }\n if (route.component && route.loadComponent) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);\n }\n if (route.redirectTo && route.canActivate) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` + `so canActivate will never be executed.`);\n }\n if (route.path && route.matcher) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);\n }\n if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);\n }\n if (route.path === void 0 && route.matcher === void 0) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);\n }\n if (typeof route.path === 'string' && route.path.charAt(0) === '/') {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);\n }\n if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {\n const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: \"${fullPath}\", redirectTo: \"${route.redirectTo}\"}': please provide 'pathMatch'. ${exp}`);\n }\n if (requireStandaloneComponents) {\n assertStandalone(fullPath, route.component);\n }\n }\n if (route.children) {\n validateConfig(route.children, fullPath, requireStandaloneComponents);\n }\n}\nfunction getFullPath(parentPath, currentRoute) {\n if (!currentRoute) {\n return parentPath;\n }\n if (!parentPath && !currentRoute.path) {\n return '';\n } else if (parentPath && !currentRoute.path) {\n return `${parentPath}/`;\n } else if (!parentPath && currentRoute.path) {\n return currentRoute.path;\n } else {\n return `${parentPath}/${currentRoute.path}`;\n }\n}\n/** Returns the `route.outlet` or PRIMARY_OUTLET if none exists. */\nfunction getOutlet(route) {\n return route.outlet || PRIMARY_OUTLET;\n}\n/**\n * Sorts the `routes` such that the ones with an outlet matching `outletName` come first.\n * The order of the configs is otherwise preserved.\n */\nfunction sortByMatchingOutlets(routes, outletName) {\n const sortedConfig = routes.filter(r => getOutlet(r) === outletName);\n sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));\n return sortedConfig;\n}\n/**\n * Gets the first injector in the snapshot's parent tree.\n *\n * If the `Route` has a static list of providers, the returned injector will be the one created from\n * those. If it does not exist, the returned injector may come from the parents, which may be from a\n * loaded config or their static providers.\n *\n * Returns `null` if there is neither this nor any parents have a stored injector.\n *\n * Generally used for retrieving the injector to use for getting tokens for guards/resolvers and\n * also used for getting the correct injector to use for creating components.\n */\nfunction getClosestRouteInjector(snapshot) {\n if (!snapshot) return null;\n // If the current route has its own injector, which is created from the static providers on the\n // route itself, we should use that. Otherwise, we start at the parent since we do not want to\n // include the lazy loaded injector from this route.\n if (snapshot.routeConfig?._injector) {\n return snapshot.routeConfig._injector;\n }\n for (let s = snapshot.parent; s; s = s.parent) {\n const route = s.routeConfig;\n // Note that the order here is important. `_loadedInjector` stored on the route with\n // `loadChildren: () => NgModule` so it applies to child routes with priority. The `_injector`\n // is created from the static providers on that parent route, so it applies to the children as\n // well, but only if there is no lazy loaded NgModuleRef injector.\n if (route?._loadedInjector) return route._loadedInjector;\n if (route?._injector) return route._injector;\n }\n return null;\n}\n\n/**\n * Store contextual information about a `RouterOutlet`\n *\n * @publicApi\n */\nclass OutletContext {\n rootInjector;\n outlet = null;\n route = null;\n children;\n attachRef = null;\n get injector() {\n return getClosestRouteInjector(this.route?.snapshot) ?? this.rootInjector;\n }\n constructor(rootInjector) {\n this.rootInjector = rootInjector;\n this.children = new ChildrenOutletContexts(this.rootInjector);\n }\n}\n/**\n * Store contextual information about the children (= nested) `RouterOutlet`\n *\n * @publicApi\n */\nlet ChildrenOutletContexts = /*#__PURE__*/(() => {\n class ChildrenOutletContexts {\n rootInjector;\n // contexts for child outlets, by name.\n contexts = new Map();\n /** @nodoc */\n constructor(rootInjector) {\n this.rootInjector = rootInjector;\n }\n /** Called when a `RouterOutlet` directive is instantiated */\n onChildOutletCreated(childName, outlet) {\n const context = this.getOrCreateContext(childName);\n context.outlet = outlet;\n this.contexts.set(childName, context);\n }\n /**\n * Called when a `RouterOutlet` directive is destroyed.\n * We need to keep the context as the outlet could be destroyed inside a NgIf and might be\n * re-created later.\n */\n onChildOutletDestroyed(childName) {\n const context = this.getContext(childName);\n if (context) {\n context.outlet = null;\n context.attachRef = null;\n }\n }\n /**\n * Called when the corresponding route is deactivated during navigation.\n * Because the component get destroyed, all children outlet are destroyed.\n */\n onOutletDeactivated() {\n const contexts = this.contexts;\n this.contexts = new Map();\n return contexts;\n }\n onOutletReAttached(contexts) {\n this.contexts = contexts;\n }\n getOrCreateContext(childName) {\n let context = this.getContext(childName);\n if (!context) {\n context = new OutletContext(this.rootInjector);\n this.contexts.set(childName, context);\n }\n return context;\n }\n getContext(childName) {\n return this.contexts.get(childName) || null;\n }\n static ɵfac = function ChildrenOutletContexts_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ChildrenOutletContexts)(i0.ɵɵinject(i0.EnvironmentInjector));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ChildrenOutletContexts,\n factory: ChildrenOutletContexts.ɵfac,\n providedIn: 'root'\n });\n }\n return ChildrenOutletContexts;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass Tree {\n /** @internal */\n _root;\n constructor(root) {\n this._root = root;\n }\n get root() {\n return this._root.value;\n }\n /**\n * @internal\n */\n parent(t) {\n const p = this.pathFromRoot(t);\n return p.length > 1 ? p[p.length - 2] : null;\n }\n /**\n * @internal\n */\n children(t) {\n const n = findNode(t, this._root);\n return n ? n.children.map(t => t.value) : [];\n }\n /**\n * @internal\n */\n firstChild(t) {\n const n = findNode(t, this._root);\n return n && n.children.length > 0 ? n.children[0].value : null;\n }\n /**\n * @internal\n */\n siblings(t) {\n const p = findPath(t, this._root);\n if (p.length < 2) return [];\n const c = p[p.length - 2].children.map(c => c.value);\n return c.filter(cc => cc !== t);\n }\n /**\n * @internal\n */\n pathFromRoot(t) {\n return findPath(t, this._root).map(s => s.value);\n }\n}\n// DFS for the node matching the value\nfunction findNode(value, node) {\n if (value === node.value) return node;\n for (const child of node.children) {\n const node = findNode(value, child);\n if (node) return node;\n }\n return null;\n}\n// Return the path to the node with the given value using DFS\nfunction findPath(value, node) {\n if (value === node.value) return [node];\n for (const child of node.children) {\n const path = findPath(value, child);\n if (path.length) {\n path.unshift(node);\n return path;\n }\n }\n return [];\n}\nclass TreeNode {\n value;\n children;\n constructor(value, children) {\n this.value = value;\n this.children = children;\n }\n toString() {\n return `TreeNode(${this.value})`;\n }\n}\n// Return the list of T indexed by outlet name\nfunction nodeChildrenAsMap(node) {\n const map = {};\n if (node) {\n node.children.forEach(child => map[child.value.outlet] = child);\n }\n return map;\n}\n\n/**\n * Represents the state of the router as a tree of activated routes.\n *\n * @usageNotes\n *\n * Every node in the route tree is an `ActivatedRoute` instance\n * that knows about the \"consumed\" URL segments, the extracted parameters,\n * and the resolved data.\n * Use the `ActivatedRoute` properties to traverse the tree from any node.\n *\n * The following fragment shows how a component gets the root node\n * of the current state to establish its own route tree:\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const state: RouterState = router.routerState;\n * const root: ActivatedRoute = state.root;\n * const child = root.firstChild;\n * const id: Observable = child.params.map(p => p.id);\n * //...\n * }\n * }\n * ```\n *\n * @see {@link ActivatedRoute}\n * @see [Getting route information](guide/routing/common-router-tasks#getting-route-information)\n *\n * @publicApi\n */\nclass RouterState extends Tree {\n snapshot;\n /** @internal */\n constructor(root, /** The current snapshot of the router state */\n snapshot) {\n super(root);\n this.snapshot = snapshot;\n setRouterState(this, root);\n }\n toString() {\n return this.snapshot.toString();\n }\n}\nfunction createEmptyState(rootComponent) {\n const snapshot = createEmptyStateSnapshot(rootComponent);\n const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);\n const emptyParams = new BehaviorSubject({});\n const emptyData = new BehaviorSubject({});\n const emptyQueryParams = new BehaviorSubject({});\n const fragment = new BehaviorSubject('');\n const activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);\n activated.snapshot = snapshot.root;\n return new RouterState(new TreeNode(activated, []), snapshot);\n}\nfunction createEmptyStateSnapshot(rootComponent) {\n const emptyParams = {};\n const emptyData = {};\n const emptyQueryParams = {};\n const fragment = '';\n const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});\n return new RouterStateSnapshot('', new TreeNode(activated, []));\n}\n/**\n * Provides access to information about a route associated with a component\n * that is loaded in an outlet.\n * Use to traverse the `RouterState` tree and extract information from nodes.\n *\n * The following example shows how to construct a component using information from a\n * currently activated route.\n *\n * Note: the observables in this class only emit when the current and previous values differ based\n * on shallow equality. For example, changing deeply nested properties in resolved `data` will not\n * cause the `ActivatedRoute.data` `Observable` to emit a new value.\n *\n * {@example router/activated-route/module.ts region=\"activated-route\"\n * header=\"activated-route.component.ts\"}\n *\n * @see [Getting route information](guide/routing/common-router-tasks#getting-route-information)\n *\n * @publicApi\n */\nclass ActivatedRoute {\n urlSubject;\n paramsSubject;\n queryParamsSubject;\n fragmentSubject;\n dataSubject;\n outlet;\n component;\n /** The current snapshot of this route */\n snapshot;\n /** @internal */\n _futureSnapshot;\n /** @internal */\n _routerState;\n /** @internal */\n _paramMap;\n /** @internal */\n _queryParamMap;\n /** An Observable of the resolved route title */\n title;\n /** An observable of the URL segments matched by this route. */\n url;\n /** An observable of the matrix parameters scoped to this route. */\n params;\n /** An observable of the query parameters shared by all the routes. */\n queryParams;\n /** An observable of the URL fragment shared by all the routes. */\n fragment;\n /** An observable of the static and resolved data of this route. */\n data;\n /** @internal */\n constructor(/** @internal */\n urlSubject, /** @internal */\n paramsSubject, /** @internal */\n queryParamsSubject, /** @internal */\n fragmentSubject, /** @internal */\n dataSubject, /** The outlet name of the route, a constant. */\n outlet, /** The component of the route, a constant. */\n component, futureSnapshot) {\n this.urlSubject = urlSubject;\n this.paramsSubject = paramsSubject;\n this.queryParamsSubject = queryParamsSubject;\n this.fragmentSubject = fragmentSubject;\n this.dataSubject = dataSubject;\n this.outlet = outlet;\n this.component = component;\n this._futureSnapshot = futureSnapshot;\n this.title = this.dataSubject?.pipe(map(d => d[RouteTitleKey])) ?? of(undefined);\n // TODO(atscott): Verify that these can be changed to `.asObservable()` with TGP.\n this.url = urlSubject;\n this.params = paramsSubject;\n this.queryParams = queryParamsSubject;\n this.fragment = fragmentSubject;\n this.data = dataSubject;\n }\n /** The configuration used to match this route. */\n get routeConfig() {\n return this._futureSnapshot.routeConfig;\n }\n /** The root of the router state. */\n get root() {\n return this._routerState.root;\n }\n /** The parent of this route in the router state tree. */\n get parent() {\n return this._routerState.parent(this);\n }\n /** The first child of this route in the router state tree. */\n get firstChild() {\n return this._routerState.firstChild(this);\n }\n /** The children of this route in the router state tree. */\n get children() {\n return this._routerState.children(this);\n }\n /** The path from the root of the router state tree to this route. */\n get pathFromRoot() {\n return this._routerState.pathFromRoot(this);\n }\n /**\n * An Observable that contains a map of the required and optional parameters\n * specific to the route.\n * The map supports retrieving single and multiple values from the same parameter.\n */\n get paramMap() {\n this._paramMap ??= this.params.pipe(map(p => convertToParamMap(p)));\n return this._paramMap;\n }\n /**\n * An Observable that contains a map of the query parameters available to all routes.\n * The map supports retrieving single and multiple values from the query parameter.\n */\n get queryParamMap() {\n this._queryParamMap ??= this.queryParams.pipe(map(p => convertToParamMap(p)));\n return this._queryParamMap;\n }\n toString() {\n return this.snapshot ? this.snapshot.toString() : `Future(${this._futureSnapshot})`;\n }\n}\n/**\n * Returns the inherited params, data, and resolve for a given route.\n *\n * By default, we do not inherit parent data unless the current route is path-less or the parent\n * route is component-less.\n */\nfunction getInherited(route, parent, paramsInheritanceStrategy = 'emptyOnly') {\n let inherited;\n const {\n routeConfig\n } = route;\n if (parent !== null && (paramsInheritanceStrategy === 'always' ||\n // inherit parent data if route is empty path\n routeConfig?.path === '' ||\n // inherit parent data if parent was componentless\n !parent.component && !parent.routeConfig?.loadComponent)) {\n inherited = {\n params: {\n ...parent.params,\n ...route.params\n },\n data: {\n ...parent.data,\n ...route.data\n },\n resolve: {\n // Snapshots are created with data inherited from parent and guards (i.e. canActivate) can\n // change data because it's not frozen...\n // This first line could be deleted chose to break/disallow mutating the `data` object in\n // guards.\n // Note that data from parents still override this mutated data so anyone relying on this\n // might be surprised that it doesn't work if parent data is inherited but otherwise does.\n ...route.data,\n // Ensure inherited resolved data overrides inherited static data\n ...parent.data,\n // static data from the current route overrides any inherited data\n ...routeConfig?.data,\n // resolved data from current route overrides everything\n ...route._resolvedData\n }\n };\n } else {\n inherited = {\n params: {\n ...route.params\n },\n data: {\n ...route.data\n },\n resolve: {\n ...route.data,\n ...(route._resolvedData ?? {})\n }\n };\n }\n if (routeConfig && hasStaticTitle(routeConfig)) {\n inherited.resolve[RouteTitleKey] = routeConfig.title;\n }\n return inherited;\n}\n/**\n * @description\n *\n * Contains the information about a route associated with a component loaded in an\n * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to\n * traverse the router state tree.\n *\n * The following example initializes a component with route information extracted\n * from the snapshot of the root node at the time of creation.\n *\n * ```ts\n * @Component({templateUrl:'./my-component.html'})\n * class MyComponent {\n * constructor(route: ActivatedRoute) {\n * const id: string = route.snapshot.params.id;\n * const url: string = route.snapshot.url.join('');\n * const user = route.snapshot.data.user;\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass ActivatedRouteSnapshot {\n url;\n params;\n queryParams;\n fragment;\n data;\n outlet;\n component;\n /** The configuration used to match this route **/\n routeConfig;\n /** @internal */\n _resolve;\n /** @internal */\n _resolvedData;\n /** @internal */\n _routerState;\n /** @internal */\n _paramMap;\n /** @internal */\n _queryParamMap;\n /** The resolved route title */\n get title() {\n // Note: This _must_ be a getter because the data is mutated in the resolvers. Title will not be\n // available at the time of class instantiation.\n return this.data?.[RouteTitleKey];\n }\n /** @internal */\n constructor(/** The URL segments matched by this route */\n url,\n /**\n * The matrix parameters scoped to this route.\n *\n * You can compute all params (or data) in the router state or to get params outside\n * of an activated component by traversing the `RouterState` tree as in the following\n * example:\n * ```\n * collectRouteParams(router: Router) {\n * let params = {};\n * let stack: ActivatedRouteSnapshot[] = [router.routerState.snapshot.root];\n * while (stack.length > 0) {\n * const route = stack.pop()!;\n * params = {...params, ...route.params};\n * stack.push(...route.children);\n * }\n * return params;\n * }\n * ```\n */\n params, /** The query parameters shared by all the routes */\n queryParams, /** The URL fragment shared by all the routes */\n fragment, /** The static and resolved data of this route */\n data, /** The outlet name of the route */\n outlet, /** The component of the route */\n component, routeConfig, resolve) {\n this.url = url;\n this.params = params;\n this.queryParams = queryParams;\n this.fragment = fragment;\n this.data = data;\n this.outlet = outlet;\n this.component = component;\n this.routeConfig = routeConfig;\n this._resolve = resolve;\n }\n /** The root of the router state */\n get root() {\n return this._routerState.root;\n }\n /** The parent of this route in the router state tree */\n get parent() {\n return this._routerState.parent(this);\n }\n /** The first child of this route in the router state tree */\n get firstChild() {\n return this._routerState.firstChild(this);\n }\n /** The children of this route in the router state tree */\n get children() {\n return this._routerState.children(this);\n }\n /** The path from the root of the router state tree to this route */\n get pathFromRoot() {\n return this._routerState.pathFromRoot(this);\n }\n get paramMap() {\n this._paramMap ??= convertToParamMap(this.params);\n return this._paramMap;\n }\n get queryParamMap() {\n this._queryParamMap ??= convertToParamMap(this.queryParams);\n return this._queryParamMap;\n }\n toString() {\n const url = this.url.map(segment => segment.toString()).join('/');\n const matched = this.routeConfig ? this.routeConfig.path : '';\n return `Route(url:'${url}', path:'${matched}')`;\n }\n}\n/**\n * @description\n *\n * Represents the state of the router at a moment in time.\n *\n * This is a tree of activated route snapshots. Every node in this tree knows about\n * the \"consumed\" URL segments, the extracted parameters, and the resolved data.\n *\n * The following example shows how a component is initialized with information\n * from the snapshot of the root node's state at the time of creation.\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const state: RouterState = router.routerState;\n * const snapshot: RouterStateSnapshot = state.snapshot;\n * const root: ActivatedRouteSnapshot = snapshot.root;\n * const child = root.firstChild;\n * const id: Observable = child.params.map(p => p.id);\n * //...\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass RouterStateSnapshot extends Tree {\n url;\n /** @internal */\n constructor(/** The url from which this snapshot was created */\n url, root) {\n super(root);\n this.url = url;\n setRouterState(this, root);\n }\n toString() {\n return serializeNode(this._root);\n }\n}\nfunction setRouterState(state, node) {\n node.value._routerState = state;\n node.children.forEach(c => setRouterState(state, c));\n}\nfunction serializeNode(node) {\n const c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(', ')} } ` : '';\n return `${node.value}${c}`;\n}\n/**\n * The expectation is that the activate route is created with the right set of parameters.\n * So we push new values into the observables only when they are not the initial values.\n * And we detect that by checking if the snapshot field is set.\n */\nfunction advanceActivatedRoute(route) {\n if (route.snapshot) {\n const currentSnapshot = route.snapshot;\n const nextSnapshot = route._futureSnapshot;\n route.snapshot = nextSnapshot;\n if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {\n route.queryParamsSubject.next(nextSnapshot.queryParams);\n }\n if (currentSnapshot.fragment !== nextSnapshot.fragment) {\n route.fragmentSubject.next(nextSnapshot.fragment);\n }\n if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {\n route.paramsSubject.next(nextSnapshot.params);\n }\n if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {\n route.urlSubject.next(nextSnapshot.url);\n }\n if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {\n route.dataSubject.next(nextSnapshot.data);\n }\n } else {\n route.snapshot = route._futureSnapshot;\n // this is for resolved data\n route.dataSubject.next(route._futureSnapshot.data);\n }\n}\nfunction equalParamsAndUrlSegments(a, b) {\n const equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);\n const parentsMismatch = !a.parent !== !b.parent;\n return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));\n}\nfunction hasStaticTitle(config) {\n return typeof config.title === 'string' || config.title === null;\n}\n\n/**\n * An `InjectionToken` provided by the `RouterOutlet` and can be set using the `routerOutletData`\n * input.\n *\n * When unset, this value is `null` by default.\n *\n * @usageNotes\n *\n * To set the data from the template of the component with `router-outlet`:\n * ```html\n * \n * ```\n *\n * To read the data in the routed component:\n * ```ts\n * data = inject(ROUTER_OUTLET_DATA) as Signal<{name: string}>;\n * ```\n *\n * @publicApi\n */\nconst ROUTER_OUTLET_DATA = /*#__PURE__*/new InjectionToken(ngDevMode ? 'RouterOutlet data' : '');\n/**\n * @description\n *\n * Acts as a placeholder that Angular dynamically fills based on the current router state.\n *\n * Each outlet can have a unique name, determined by the optional `name` attribute.\n * The name cannot be set or changed dynamically. If not set, default value is \"primary\".\n *\n * ```html\n * \n * \n * \n * ```\n *\n * Named outlets can be the targets of secondary routes.\n * The `Route` object for a secondary route has an `outlet` property to identify the target outlet:\n *\n * `{path: , component: , outlet: }`\n *\n * Using named outlets and secondary routes, you can target multiple outlets in\n * the same `RouterLink` directive.\n *\n * The router keeps track of separate branches in a navigation tree for each named outlet and\n * generates a representation of that tree in the URL.\n * The URL for a secondary route uses the following syntax to specify both the primary and secondary\n * routes at the same time:\n *\n * `http://base-path/primary-route-path(outlet-name:route-path)`\n *\n * A router outlet emits an activate event when a new component is instantiated,\n * deactivate event when a component is destroyed.\n * An attached event emits when the `RouteReuseStrategy` instructs the outlet to reattach the\n * subtree, and the detached event emits when the `RouteReuseStrategy` instructs the outlet to\n * detach the subtree.\n *\n * ```html\n * \n * ```\n *\n * @see {@link RouterLink}\n * @see {@link Route}\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterOutlet = /*#__PURE__*/(() => {\n class RouterOutlet {\n activated = null;\n /** @internal */\n get activatedComponentRef() {\n return this.activated;\n }\n _activatedRoute = null;\n /**\n * The name of the outlet\n *\n */\n name = PRIMARY_OUTLET;\n activateEvents = new EventEmitter();\n deactivateEvents = new EventEmitter();\n /**\n * Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a\n * previously detached subtree.\n **/\n attachEvents = new EventEmitter();\n /**\n * Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the\n * subtree.\n */\n detachEvents = new EventEmitter();\n /**\n * Data that will be provided to the child injector through the `ROUTER_OUTLET_DATA` token.\n *\n * When unset, the value of the token is `undefined` by default.\n */\n routerOutletData = input(undefined);\n parentContexts = inject(ChildrenOutletContexts);\n location = inject(ViewContainerRef);\n changeDetector = inject(ChangeDetectorRef);\n inputBinder = inject(INPUT_BINDER, {\n optional: true\n });\n /** @nodoc */\n supportsBindingToComponentInputs = true;\n /** @nodoc */\n ngOnChanges(changes) {\n if (changes['name']) {\n const {\n firstChange,\n previousValue\n } = changes['name'];\n if (firstChange) {\n // The first change is handled by ngOnInit. Because ngOnChanges doesn't get called when no\n // input is set at all, we need to centrally handle the first change there.\n return;\n }\n // unregister with the old name\n if (this.isTrackedInParentContexts(previousValue)) {\n this.deactivate();\n this.parentContexts.onChildOutletDestroyed(previousValue);\n }\n // register the new name\n this.initializeOutletWithName();\n }\n }\n /** @nodoc */\n ngOnDestroy() {\n // Ensure that the registered outlet is this one before removing it on the context.\n if (this.isTrackedInParentContexts(this.name)) {\n this.parentContexts.onChildOutletDestroyed(this.name);\n }\n this.inputBinder?.unsubscribeFromRouteData(this);\n }\n isTrackedInParentContexts(outletName) {\n return this.parentContexts.getContext(outletName)?.outlet === this;\n }\n /** @nodoc */\n ngOnInit() {\n this.initializeOutletWithName();\n }\n initializeOutletWithName() {\n this.parentContexts.onChildOutletCreated(this.name, this);\n if (this.activated) {\n return;\n }\n // If the outlet was not instantiated at the time the route got activated we need to populate\n // the outlet when it is initialized (ie inside a NgIf)\n const context = this.parentContexts.getContext(this.name);\n if (context?.route) {\n if (context.attachRef) {\n // `attachRef` is populated when there is an existing component to mount\n this.attach(context.attachRef, context.route);\n } else {\n // otherwise the component defined in the configuration is created\n this.activateWith(context.route, context.injector);\n }\n }\n }\n get isActivated() {\n return !!this.activated;\n }\n /**\n * @returns The currently activated component instance.\n * @throws An error if the outlet is not activated.\n */\n get component() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n return this.activated.instance;\n }\n get activatedRoute() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n return this._activatedRoute;\n }\n get activatedRouteData() {\n if (this._activatedRoute) {\n return this._activatedRoute.snapshot.data;\n }\n return {};\n }\n /**\n * Called when the `RouteReuseStrategy` instructs to detach the subtree\n */\n detach() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n this.location.detach();\n const cmp = this.activated;\n this.activated = null;\n this._activatedRoute = null;\n this.detachEvents.emit(cmp.instance);\n return cmp;\n }\n /**\n * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree\n */\n attach(ref, activatedRoute) {\n this.activated = ref;\n this._activatedRoute = activatedRoute;\n this.location.insert(ref.hostView);\n this.inputBinder?.bindActivatedRouteToOutletComponent(this);\n this.attachEvents.emit(ref.instance);\n }\n deactivate() {\n if (this.activated) {\n const c = this.component;\n this.activated.destroy();\n this.activated = null;\n this._activatedRoute = null;\n this.deactivateEvents.emit(c);\n }\n }\n activateWith(activatedRoute, environmentInjector) {\n if (this.isActivated) {\n throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Cannot activate an already activated outlet');\n }\n this._activatedRoute = activatedRoute;\n const location = this.location;\n const snapshot = activatedRoute.snapshot;\n const component = snapshot.component;\n const childContexts = this.parentContexts.getOrCreateContext(this.name).children;\n const injector = new OutletInjector(activatedRoute, childContexts, location.injector, this.routerOutletData);\n this.activated = location.createComponent(component, {\n index: location.length,\n injector,\n environmentInjector: environmentInjector\n });\n // Calling `markForCheck` to make sure we will run the change detection when the\n // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.\n this.changeDetector.markForCheck();\n this.inputBinder?.bindActivatedRouteToOutletComponent(this);\n this.activateEvents.emit(this.activated.instance);\n }\n static ɵfac = function RouterOutlet_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterOutlet)();\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterOutlet,\n selectors: [[\"router-outlet\"]],\n inputs: {\n name: \"name\",\n routerOutletData: [1, \"routerOutletData\"]\n },\n outputs: {\n activateEvents: \"activate\",\n deactivateEvents: \"deactivate\",\n attachEvents: \"attach\",\n detachEvents: \"detach\"\n },\n exportAs: [\"outlet\"],\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n return RouterOutlet;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass OutletInjector {\n route;\n childContexts;\n parent;\n outletData;\n /**\n * This injector has a special handing for the `ActivatedRoute` and\n * `ChildrenOutletContexts` tokens: it returns corresponding values for those\n * tokens dynamically. This behavior is different from the regular injector logic,\n * when we initialize and store a value, which is later returned for all inject\n * requests.\n *\n * In some cases (e.g. when using `@defer`), this dynamic behavior requires special\n * handling. This function allows to identify an instance of the `OutletInjector` and\n * create an instance of it without referring to the class itself (so this logic can\n * be invoked from the `core` package). This helps to retain dynamic behavior for the\n * mentioned tokens.\n *\n * Note: it's a temporary solution and we should explore how to support this case better.\n */\n __ngOutletInjector(parentInjector) {\n return new OutletInjector(this.route, this.childContexts, parentInjector, this.outletData);\n }\n constructor(route, childContexts, parent, outletData) {\n this.route = route;\n this.childContexts = childContexts;\n this.parent = parent;\n this.outletData = outletData;\n }\n get(token, notFoundValue) {\n if (token === ActivatedRoute) {\n return this.route;\n }\n if (token === ChildrenOutletContexts) {\n return this.childContexts;\n }\n if (token === ROUTER_OUTLET_DATA) {\n return this.outletData;\n }\n return this.parent.get(token, notFoundValue);\n }\n}\nconst INPUT_BINDER = /*#__PURE__*/new InjectionToken('');\n/**\n * Injectable used as a tree-shakable provider for opting in to binding router data to component\n * inputs.\n *\n * The RouterOutlet registers itself with this service when an `ActivatedRoute` is attached or\n * activated. When this happens, the service subscribes to the `ActivatedRoute` observables (params,\n * queryParams, data) and sets the inputs of the component using `ComponentRef.setInput`.\n * Importantly, when an input does not have an item in the route data with a matching key, this\n * input is set to `undefined`. If it were not done this way, the previous information would be\n * retained if the data got removed from the route (i.e. if a query parameter is removed).\n *\n * The `RouterOutlet` should unregister itself when destroyed via `unsubscribeFromRouteData` so that\n * the subscriptions are cleaned up.\n */\nlet RoutedComponentInputBinder = /*#__PURE__*/(() => {\n class RoutedComponentInputBinder {\n outletDataSubscriptions = new Map();\n bindActivatedRouteToOutletComponent(outlet) {\n this.unsubscribeFromRouteData(outlet);\n this.subscribeToRouteData(outlet);\n }\n unsubscribeFromRouteData(outlet) {\n this.outletDataSubscriptions.get(outlet)?.unsubscribe();\n this.outletDataSubscriptions.delete(outlet);\n }\n subscribeToRouteData(outlet) {\n const {\n activatedRoute\n } = outlet;\n const dataSubscription = combineLatest([activatedRoute.queryParams, activatedRoute.params, activatedRoute.data]).pipe(switchMap(([queryParams, params, data], index) => {\n data = {\n ...queryParams,\n ...params,\n ...data\n };\n // Get the first result from the data subscription synchronously so it's available to\n // the component as soon as possible (and doesn't require a second change detection).\n if (index === 0) {\n return of(data);\n }\n // Promise.resolve is used to avoid synchronously writing the wrong data when\n // two of the Observables in the `combineLatest` stream emit one after\n // another.\n return Promise.resolve(data);\n })).subscribe(data => {\n // Outlet may have been deactivated or changed names to be associated with a different\n // route\n if (!outlet.isActivated || !outlet.activatedComponentRef || outlet.activatedRoute !== activatedRoute || activatedRoute.component === null) {\n this.unsubscribeFromRouteData(outlet);\n return;\n }\n const mirror = reflectComponentType(activatedRoute.component);\n if (!mirror) {\n this.unsubscribeFromRouteData(outlet);\n return;\n }\n for (const {\n templateName\n } of mirror.inputs) {\n outlet.activatedComponentRef.setInput(templateName, data[templateName]);\n }\n });\n this.outletDataSubscriptions.set(outlet, dataSubscription);\n }\n static ɵfac = function RoutedComponentInputBinder_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RoutedComponentInputBinder)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RoutedComponentInputBinder,\n factory: RoutedComponentInputBinder.ɵfac\n });\n }\n return RoutedComponentInputBinder;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction createRouterState(routeReuseStrategy, curr, prevState) {\n const root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined);\n return new RouterState(root, curr);\n}\nfunction createNode(routeReuseStrategy, curr, prevState) {\n // reuse an activated route that is currently displayed on the screen\n if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) {\n const value = prevState.value;\n value._futureSnapshot = curr.value;\n const children = createOrReuseChildren(routeReuseStrategy, curr, prevState);\n return new TreeNode(value, children);\n } else {\n if (routeReuseStrategy.shouldAttach(curr.value)) {\n // retrieve an activated route that is used to be displayed, but is not currently displayed\n const detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);\n if (detachedRouteHandle !== null) {\n const tree = detachedRouteHandle.route;\n tree.value._futureSnapshot = curr.value;\n tree.children = curr.children.map(c => createNode(routeReuseStrategy, c));\n return tree;\n }\n }\n const value = createActivatedRoute(curr.value);\n const children = curr.children.map(c => createNode(routeReuseStrategy, c));\n return new TreeNode(value, children);\n }\n}\nfunction createOrReuseChildren(routeReuseStrategy, curr, prevState) {\n return curr.children.map(child => {\n for (const p of prevState.children) {\n if (routeReuseStrategy.shouldReuseRoute(child.value, p.value.snapshot)) {\n return createNode(routeReuseStrategy, child, p);\n }\n }\n return createNode(routeReuseStrategy, child);\n });\n}\nfunction createActivatedRoute(c) {\n return new ActivatedRoute(new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c);\n}\n\n/**\n * Can be returned by a `Router` guard to instruct the `Router` to redirect rather than continue\n * processing the path of the in-flight navigation. The `redirectTo` indicates _where_ the new\n * navigation should go to and the optional `navigationBehaviorOptions` can provide more information\n * about _how_ to perform the navigation.\n *\n * ```ts\n * const route: Route = {\n * path: \"user/:userId\",\n * component: User,\n * canActivate: [\n * () => {\n * const router = inject(Router);\n * const authService = inject(AuthenticationService);\n *\n * if (!authService.isLoggedIn()) {\n * const loginPath = router.parseUrl(\"/login\");\n * return new RedirectCommand(loginPath, {\n * skipLocationChange: \"true\",\n * });\n * }\n *\n * return true;\n * },\n * ],\n * };\n * ```\n * @see [Routing guide](guide/routing/common-router-tasks#preventing-unauthorized-access)\n *\n * @publicApi\n */\nclass RedirectCommand {\n redirectTo;\n navigationBehaviorOptions;\n constructor(redirectTo, navigationBehaviorOptions) {\n this.redirectTo = redirectTo;\n this.navigationBehaviorOptions = navigationBehaviorOptions;\n }\n}\nconst NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';\nfunction redirectingNavigationError(urlSerializer, redirect) {\n const {\n redirectTo,\n navigationBehaviorOptions\n } = isUrlTree(redirect) ? {\n redirectTo: redirect,\n navigationBehaviorOptions: undefined\n } : redirect;\n const error = navigationCancelingError(ngDevMode && `Redirecting to \"${urlSerializer.serialize(redirectTo)}\"`, NavigationCancellationCode.Redirect);\n error.url = redirectTo;\n error.navigationBehaviorOptions = navigationBehaviorOptions;\n return error;\n}\nfunction navigationCancelingError(message, code) {\n const error = new Error(`NavigationCancelingError: ${message || ''}`);\n error[NAVIGATION_CANCELING_ERROR] = true;\n error.cancellationCode = code;\n return error;\n}\nfunction isRedirectingNavigationCancelingError(error) {\n return isNavigationCancelingError(error) && isUrlTree(error.url);\n}\nfunction isNavigationCancelingError(error) {\n return !!error && error[NAVIGATION_CANCELING_ERROR];\n}\nlet warnedAboutUnsupportedInputBinding = false;\nconst activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map(t => {\n new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled).activate(rootContexts);\n return t;\n});\nclass ActivateRoutes {\n routeReuseStrategy;\n futureState;\n currState;\n forwardEvent;\n inputBindingEnabled;\n constructor(routeReuseStrategy, futureState, currState, forwardEvent, inputBindingEnabled) {\n this.routeReuseStrategy = routeReuseStrategy;\n this.futureState = futureState;\n this.currState = currState;\n this.forwardEvent = forwardEvent;\n this.inputBindingEnabled = inputBindingEnabled;\n }\n activate(parentContexts) {\n const futureRoot = this.futureState._root;\n const currRoot = this.currState ? this.currState._root : null;\n this.deactivateChildRoutes(futureRoot, currRoot, parentContexts);\n advanceActivatedRoute(this.futureState.root);\n this.activateChildRoutes(futureRoot, currRoot, parentContexts);\n }\n // De-activate the child route that are not re-used for the future state\n deactivateChildRoutes(futureNode, currNode, contexts) {\n const children = nodeChildrenAsMap(currNode);\n // Recurse on the routes active in the future state to de-activate deeper children\n futureNode.children.forEach(futureChild => {\n const childOutletName = futureChild.value.outlet;\n this.deactivateRoutes(futureChild, children[childOutletName], contexts);\n delete children[childOutletName];\n });\n // De-activate the routes that will not be re-used\n Object.values(children).forEach(v => {\n this.deactivateRouteAndItsChildren(v, contexts);\n });\n }\n deactivateRoutes(futureNode, currNode, parentContext) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n if (future === curr) {\n // Reusing the node, check to see if the children need to be de-activated\n if (future.component) {\n // If we have a normal route, we need to go through an outlet.\n const context = parentContext.getContext(future.outlet);\n if (context) {\n this.deactivateChildRoutes(futureNode, currNode, context.children);\n }\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.deactivateChildRoutes(futureNode, currNode, parentContext);\n }\n } else {\n if (curr) {\n // Deactivate the current route which will not be re-used\n this.deactivateRouteAndItsChildren(currNode, parentContext);\n }\n }\n }\n deactivateRouteAndItsChildren(route, parentContexts) {\n // If there is no component, the Route is never attached to an outlet (because there is no\n // component to attach).\n if (route.value.component && this.routeReuseStrategy.shouldDetach(route.value.snapshot)) {\n this.detachAndStoreRouteSubtree(route, parentContexts);\n } else {\n this.deactivateRouteAndOutlet(route, parentContexts);\n }\n }\n detachAndStoreRouteSubtree(route, parentContexts) {\n const context = parentContexts.getContext(route.value.outlet);\n const contexts = context && route.value.component ? context.children : parentContexts;\n const children = nodeChildrenAsMap(route);\n for (const treeNode of Object.values(children)) {\n this.deactivateRouteAndItsChildren(treeNode, contexts);\n }\n if (context && context.outlet) {\n const componentRef = context.outlet.detach();\n const contexts = context.children.onOutletDeactivated();\n this.routeReuseStrategy.store(route.value.snapshot, {\n componentRef,\n route,\n contexts\n });\n }\n }\n deactivateRouteAndOutlet(route, parentContexts) {\n const context = parentContexts.getContext(route.value.outlet);\n // The context could be `null` if we are on a componentless route but there may still be\n // children that need deactivating.\n const contexts = context && route.value.component ? context.children : parentContexts;\n const children = nodeChildrenAsMap(route);\n for (const treeNode of Object.values(children)) {\n this.deactivateRouteAndItsChildren(treeNode, contexts);\n }\n if (context) {\n if (context.outlet) {\n // Destroy the component\n context.outlet.deactivate();\n // Destroy the contexts for all the outlets that were in the component\n context.children.onOutletDeactivated();\n }\n // Clear the information about the attached component on the context but keep the reference to\n // the outlet. Clear even if outlet was not yet activated to avoid activating later with old\n // info\n context.attachRef = null;\n context.route = null;\n }\n }\n activateChildRoutes(futureNode, currNode, contexts) {\n const children = nodeChildrenAsMap(currNode);\n futureNode.children.forEach(c => {\n this.activateRoutes(c, children[c.value.outlet], contexts);\n this.forwardEvent(new ActivationEnd(c.value.snapshot));\n });\n if (futureNode.children.length) {\n this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot));\n }\n }\n activateRoutes(futureNode, currNode, parentContexts) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n advanceActivatedRoute(future);\n // reusing the node\n if (future === curr) {\n if (future.component) {\n // If we have a normal route, we need to go through an outlet.\n const context = parentContexts.getOrCreateContext(future.outlet);\n this.activateChildRoutes(futureNode, currNode, context.children);\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.activateChildRoutes(futureNode, currNode, parentContexts);\n }\n } else {\n if (future.component) {\n // if we have a normal route, we need to place the component into the outlet and recurse.\n const context = parentContexts.getOrCreateContext(future.outlet);\n if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {\n const stored = this.routeReuseStrategy.retrieve(future.snapshot);\n this.routeReuseStrategy.store(future.snapshot, null);\n context.children.onOutletReAttached(stored.contexts);\n context.attachRef = stored.componentRef;\n context.route = stored.route.value;\n if (context.outlet) {\n // Attach right away when the outlet has already been instantiated\n // Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated\n context.outlet.attach(stored.componentRef, stored.route.value);\n }\n advanceActivatedRoute(stored.route.value);\n this.activateChildRoutes(futureNode, null, context.children);\n } else {\n context.attachRef = null;\n context.route = future;\n if (context.outlet) {\n // Activate the outlet when it has already been instantiated\n // Otherwise it will get activated from its `ngOnInit` when instantiated\n context.outlet.activateWith(future, context.injector);\n }\n this.activateChildRoutes(futureNode, null, context.children);\n }\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.activateChildRoutes(futureNode, null, parentContexts);\n }\n }\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const context = parentContexts.getOrCreateContext(future.outlet);\n const outlet = context.outlet;\n if (outlet && this.inputBindingEnabled && !outlet.supportsBindingToComponentInputs && !warnedAboutUnsupportedInputBinding) {\n console.warn(`'withComponentInputBinding' feature is enabled but ` + `this application is using an outlet that may not support binding to component inputs.`);\n warnedAboutUnsupportedInputBinding = true;\n }\n }\n }\n}\nclass CanActivate {\n path;\n route;\n constructor(path) {\n this.path = path;\n this.route = this.path[this.path.length - 1];\n }\n}\nclass CanDeactivate {\n component;\n route;\n constructor(component, route) {\n this.component = component;\n this.route = route;\n }\n}\nfunction getAllRouteGuards(future, curr, parentContexts) {\n const futureRoot = future._root;\n const currRoot = curr ? curr._root : null;\n return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);\n}\nfunction getCanActivateChild(p) {\n const canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;\n if (!canActivateChild || canActivateChild.length === 0) return null;\n return {\n node: p,\n guards: canActivateChild\n };\n}\nfunction getTokenOrFunctionIdentity(tokenOrFunction, injector) {\n const NOT_FOUND = Symbol();\n const result = injector.get(tokenOrFunction, NOT_FOUND);\n if (result === NOT_FOUND) {\n if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {\n // We think the token is just a function so return it as-is\n return tokenOrFunction;\n } else {\n // This will throw the not found error\n return injector.get(tokenOrFunction);\n }\n }\n return result;\n}\nfunction getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {\n canDeactivateChecks: [],\n canActivateChecks: []\n}) {\n const prevChildren = nodeChildrenAsMap(currNode);\n // Process the children of the future route\n futureNode.children.forEach(c => {\n getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);\n delete prevChildren[c.value.outlet];\n });\n // Process any children left from the current route (not active for the future route)\n Object.entries(prevChildren).forEach(([k, v]) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));\n return checks;\n}\nfunction getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {\n canDeactivateChecks: [],\n canActivateChecks: []\n}) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n const context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;\n // reusing the node\n if (curr && future.routeConfig === curr.routeConfig) {\n const shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);\n if (shouldRun) {\n checks.canActivateChecks.push(new CanActivate(futurePath));\n } else {\n // we need to set the data\n future.data = curr.data;\n future._resolvedData = curr._resolvedData;\n }\n // If we have a component, we need to go through an outlet.\n if (future.component) {\n getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks);\n // if we have a componentless route, we recurse but keep the same outlet map.\n } else {\n getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);\n }\n if (shouldRun && context && context.outlet && context.outlet.isActivated) {\n checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, curr));\n }\n } else {\n if (curr) {\n deactivateRouteAndItsChildren(currNode, context, checks);\n }\n checks.canActivateChecks.push(new CanActivate(futurePath));\n // If we have a component, we need to go through an outlet.\n if (future.component) {\n getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks);\n // if we have a componentless route, we recurse but keep the same outlet map.\n } else {\n getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);\n }\n }\n return checks;\n}\nfunction shouldRunGuardsAndResolvers(curr, future, mode) {\n if (typeof mode === 'function') {\n return mode(curr, future);\n }\n switch (mode) {\n case 'pathParamsChange':\n return !equalPath(curr.url, future.url);\n case 'pathParamsOrQueryParamsChange':\n return !equalPath(curr.url, future.url) || !shallowEqual(curr.queryParams, future.queryParams);\n case 'always':\n return true;\n case 'paramsOrQueryParamsChange':\n return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams);\n case 'paramsChange':\n default:\n return !equalParamsAndUrlSegments(curr, future);\n }\n}\nfunction deactivateRouteAndItsChildren(route, context, checks) {\n const children = nodeChildrenAsMap(route);\n const r = route.value;\n Object.entries(children).forEach(([childName, node]) => {\n if (!r.component) {\n deactivateRouteAndItsChildren(node, context, checks);\n } else if (context) {\n deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks);\n } else {\n deactivateRouteAndItsChildren(node, null, checks);\n }\n });\n if (!r.component) {\n checks.canDeactivateChecks.push(new CanDeactivate(null, r));\n } else if (context && context.outlet && context.outlet.isActivated) {\n checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));\n } else {\n checks.canDeactivateChecks.push(new CanDeactivate(null, r));\n }\n}\n\n/**\n * Simple function check, but generic so type inference will flow. Example:\n *\n * function product(a: number, b: number) {\n * return a * b;\n * }\n *\n * if (isFunction(fn)) {\n * return fn(1, 2);\n * } else {\n * throw \"Must provide the `product` function\";\n * }\n */\nfunction isFunction(v) {\n return typeof v === 'function';\n}\nfunction isBoolean(v) {\n return typeof v === 'boolean';\n}\nfunction isCanLoad(guard) {\n return guard && isFunction(guard.canLoad);\n}\nfunction isCanActivate(guard) {\n return guard && isFunction(guard.canActivate);\n}\nfunction isCanActivateChild(guard) {\n return guard && isFunction(guard.canActivateChild);\n}\nfunction isCanDeactivate(guard) {\n return guard && isFunction(guard.canDeactivate);\n}\nfunction isCanMatch(guard) {\n return guard && isFunction(guard.canMatch);\n}\nfunction isEmptyError(e) {\n return e instanceof EmptyError || e?.name === 'EmptyError';\n}\nconst INITIAL_VALUE = /* @__PURE__ */Symbol('INITIAL_VALUE');\nfunction prioritizedGuardValue() {\n return switchMap(obs => {\n return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE)))).pipe(map(results => {\n for (const result of results) {\n if (result === true) {\n // If result is true, check the next one\n continue;\n } else if (result === INITIAL_VALUE) {\n // If guard has not finished, we need to stop processing.\n return INITIAL_VALUE;\n } else if (result === false || isRedirect(result)) {\n // Result finished and was not true. Return the result.\n // Note that we only allow false/UrlTree/RedirectCommand. Other values are considered invalid and\n // ignored.\n return result;\n }\n }\n // Everything resolved to true. Return true.\n return true;\n }), filter(item => item !== INITIAL_VALUE), take(1));\n });\n}\nfunction isRedirect(val) {\n return isUrlTree(val) || val instanceof RedirectCommand;\n}\nfunction checkGuards(injector, forwardEvent) {\n return mergeMap(t => {\n const {\n targetSnapshot,\n currentSnapshot,\n guards: {\n canActivateChecks,\n canDeactivateChecks\n }\n } = t;\n if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {\n return of({\n ...t,\n guardsResult: true\n });\n }\n return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector).pipe(mergeMap(canDeactivate => {\n return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) : of(canDeactivate);\n }), map(guardsResult => ({\n ...t,\n guardsResult\n })));\n });\n}\nfunction runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {\n return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {\n return result !== true;\n }, true));\n}\nfunction runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {\n return from(checks).pipe(concatMap(check => {\n return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));\n }), first(result => {\n return result !== true;\n }, true));\n}\n/**\n * This should fire off `ActivationStart` events for each route being activated at this\n * level.\n * In other words, if you're activating `a` and `b` below, `path` will contain the\n * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always\n * return\n * `true` so checks continue to run.\n */\nfunction fireActivationStart(snapshot, forwardEvent) {\n if (snapshot !== null && forwardEvent) {\n forwardEvent(new ActivationStart(snapshot));\n }\n return of(true);\n}\n/**\n * This should fire off `ChildActivationStart` events for each route being activated at this\n * level.\n * In other words, if you're activating `a` and `b` below, `path` will contain the\n * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always\n * return\n * `true` so checks continue to run.\n */\nfunction fireChildActivationStart(snapshot, forwardEvent) {\n if (snapshot !== null && forwardEvent) {\n forwardEvent(new ChildActivationStart(snapshot));\n }\n return of(true);\n}\nfunction runCanActivate(futureRSS, futureARS, injector) {\n const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;\n if (!canActivate || canActivate.length === 0) return of(true);\n const canActivateObservables = canActivate.map(canActivate => {\n return defer(() => {\n const closestInjector = getClosestRouteInjector(futureARS) ?? injector;\n const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);\n const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n });\n return of(canActivateObservables).pipe(prioritizedGuardValue());\n}\nfunction runCanActivateChild(futureRSS, path, injector) {\n const futureARS = path[path.length - 1];\n const canActivateChildGuards = path.slice(0, path.length - 1).reverse().map(p => getCanActivateChild(p)).filter(_ => _ !== null);\n const canActivateChildGuardsMapped = canActivateChildGuards.map(d => {\n return defer(() => {\n const guardsMapped = d.guards.map(canActivateChild => {\n const closestInjector = getClosestRouteInjector(d.node) ?? injector;\n const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);\n const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n return of(guardsMapped).pipe(prioritizedGuardValue());\n });\n });\n return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());\n}\nfunction runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {\n const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;\n if (!canDeactivate || canDeactivate.length === 0) return of(true);\n const canDeactivateObservables = canDeactivate.map(c => {\n const closestInjector = getClosestRouteInjector(currARS) ?? injector;\n const guard = getTokenOrFunctionIdentity(c, closestInjector);\n const guardVal = isCanDeactivate(guard) ? guard.canDeactivate(component, currARS, currRSS, futureRSS) : runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n return of(canDeactivateObservables).pipe(prioritizedGuardValue());\n}\nfunction runCanLoadGuards(injector, route, segments, urlSerializer) {\n const canLoad = route.canLoad;\n if (canLoad === undefined || canLoad.length === 0) {\n return of(true);\n }\n const canLoadObservables = canLoad.map(injectionToken => {\n const guard = getTokenOrFunctionIdentity(injectionToken, injector);\n const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : runInInjectionContext(injector, () => guard(route, segments));\n return wrapIntoObservable(guardVal);\n });\n return of(canLoadObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));\n}\nfunction redirectIfUrlTree(urlSerializer) {\n return pipe(tap(result => {\n if (typeof result === 'boolean') return;\n throw redirectingNavigationError(urlSerializer, result);\n }), map(result => result === true));\n}\nfunction runCanMatchGuards(injector, route, segments, urlSerializer) {\n const canMatch = route.canMatch;\n if (!canMatch || canMatch.length === 0) return of(true);\n const canMatchObservables = canMatch.map(injectionToken => {\n const guard = getTokenOrFunctionIdentity(injectionToken, injector);\n const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : runInInjectionContext(injector, () => guard(route, segments));\n return wrapIntoObservable(guardVal);\n });\n return of(canMatchObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));\n}\nclass NoMatch {\n segmentGroup;\n constructor(segmentGroup) {\n this.segmentGroup = segmentGroup || null;\n }\n}\nclass AbsoluteRedirect extends Error {\n urlTree;\n constructor(urlTree) {\n super();\n this.urlTree = urlTree;\n }\n}\nfunction noMatch$1(segmentGroup) {\n return throwError(new NoMatch(segmentGroup));\n}\nfunction absoluteRedirect(newTree) {\n return throwError(new AbsoluteRedirect(newTree));\n}\nfunction namedOutletsRedirect(redirectTo) {\n return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));\n}\nfunction canLoadFails(route) {\n return throwError(navigationCancelingError((typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot load children because the guard of the route \"path: '${route.path}'\" returned false`, NavigationCancellationCode.GuardRejected));\n}\nclass ApplyRedirects {\n urlSerializer;\n urlTree;\n constructor(urlSerializer, urlTree) {\n this.urlSerializer = urlSerializer;\n this.urlTree = urlTree;\n }\n lineralizeSegments(route, urlTree) {\n let res = [];\n let c = urlTree.root;\n while (true) {\n res = res.concat(c.segments);\n if (c.numberOfChildren === 0) {\n return of(res);\n }\n if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {\n return namedOutletsRedirect(`${route.redirectTo}`);\n }\n c = c.children[PRIMARY_OUTLET];\n }\n }\n applyRedirectCommands(segments, redirectTo, posParams, currentSnapshot, injector) {\n if (typeof redirectTo !== 'string') {\n const redirectToFn = redirectTo;\n const {\n queryParams,\n fragment,\n routeConfig,\n url,\n outlet,\n params,\n data,\n title\n } = currentSnapshot;\n const newRedirect = runInInjectionContext(injector, () => redirectToFn({\n params,\n data,\n queryParams,\n fragment,\n routeConfig,\n url,\n outlet,\n title\n }));\n if (newRedirect instanceof UrlTree) {\n throw new AbsoluteRedirect(newRedirect);\n }\n redirectTo = newRedirect;\n }\n const newTree = this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);\n if (redirectTo[0] === '/') {\n throw new AbsoluteRedirect(newTree);\n }\n return newTree;\n }\n applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {\n const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);\n return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);\n }\n createQueryParams(redirectToParams, actualParams) {\n const res = {};\n Object.entries(redirectToParams).forEach(([k, v]) => {\n const copySourceValue = typeof v === 'string' && v[0] === ':';\n if (copySourceValue) {\n const sourceName = v.substring(1);\n res[k] = actualParams[sourceName];\n } else {\n res[k] = v;\n }\n });\n return res;\n }\n createSegmentGroup(redirectTo, group, segments, posParams) {\n const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);\n let children = {};\n Object.entries(group.children).forEach(([name, child]) => {\n children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams);\n });\n return new UrlSegmentGroup(updatedSegments, children);\n }\n createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {\n return redirectToSegments.map(s => s.path[0] === ':' ? this.findPosParam(redirectTo, s, posParams) : this.findOrReturn(s, actualSegments));\n }\n findPosParam(redirectTo, redirectToUrlSegment, posParams) {\n const pos = posParams[redirectToUrlSegment.path.substring(1)];\n if (!pos) throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);\n return pos;\n }\n findOrReturn(redirectToUrlSegment, actualSegments) {\n let idx = 0;\n for (const s of actualSegments) {\n if (s.path === redirectToUrlSegment.path) {\n actualSegments.splice(idx);\n return s;\n }\n idx++;\n }\n return redirectToUrlSegment;\n }\n}\nconst noMatch = {\n matched: false,\n consumedSegments: [],\n remainingSegments: [],\n parameters: {},\n positionalParamSegments: {}\n};\nfunction matchWithChecks(segmentGroup, route, segments, injector, urlSerializer) {\n const result = match(segmentGroup, route, segments);\n if (!result.matched) {\n return of(result);\n }\n // Only create the Route's `EnvironmentInjector` if it matches the attempted\n // navigation\n injector = getOrCreateRouteInjectorIfNeeded(route, injector);\n return runCanMatchGuards(injector, route, segments, urlSerializer).pipe(map(v => v === true ? result : {\n ...noMatch\n }));\n}\nfunction match(segmentGroup, route, segments) {\n if (route.path === '**') {\n return createWildcardMatchResult(segments);\n }\n if (route.path === '') {\n if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {\n return {\n ...noMatch\n };\n }\n return {\n matched: true,\n consumedSegments: [],\n remainingSegments: segments,\n parameters: {},\n positionalParamSegments: {}\n };\n }\n const matcher = route.matcher || defaultUrlMatcher;\n const res = matcher(segments, segmentGroup, route);\n if (!res) return {\n ...noMatch\n };\n const posParams = {};\n Object.entries(res.posParams ?? {}).forEach(([k, v]) => {\n posParams[k] = v.path;\n });\n const parameters = res.consumed.length > 0 ? {\n ...posParams,\n ...res.consumed[res.consumed.length - 1].parameters\n } : posParams;\n return {\n matched: true,\n consumedSegments: res.consumed,\n remainingSegments: segments.slice(res.consumed.length),\n // TODO(atscott): investigate combining parameters and positionalParamSegments\n parameters,\n positionalParamSegments: res.posParams ?? {}\n };\n}\nfunction createWildcardMatchResult(segments) {\n return {\n matched: true,\n parameters: segments.length > 0 ? last(segments).parameters : {},\n consumedSegments: segments,\n remainingSegments: [],\n positionalParamSegments: {}\n };\n}\nfunction split(segmentGroup, consumedSegments, slicedSegments, config) {\n if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {\n const s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));\n return {\n segmentGroup: s,\n slicedSegments: []\n };\n }\n if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config)) {\n const s = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children));\n return {\n segmentGroup: s,\n slicedSegments\n };\n }\n const s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);\n return {\n segmentGroup: s,\n slicedSegments\n };\n}\nfunction addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) {\n const res = {};\n for (const r of routes) {\n if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {\n const s = new UrlSegmentGroup([], {});\n res[getOutlet(r)] = s;\n }\n }\n return {\n ...children,\n ...res\n };\n}\nfunction createChildrenForEmptyPaths(routes, primarySegment) {\n const res = {};\n res[PRIMARY_OUTLET] = primarySegment;\n for (const r of routes) {\n if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {\n const s = new UrlSegmentGroup([], {});\n res[getOutlet(r)] = s;\n }\n }\n return res;\n}\nfunction containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) {\n return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet(r) !== PRIMARY_OUTLET);\n}\nfunction containsEmptyPathMatches(segmentGroup, slicedSegments, routes) {\n return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r));\n}\nfunction emptyPathMatch(segmentGroup, slicedSegments, r) {\n if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') {\n return false;\n }\n return r.path === '';\n}\nfunction noLeftoversInUrl(segmentGroup, segments, outlet) {\n return segments.length === 0 && !segmentGroup.children[outlet];\n}\n\n/**\n * Class used to indicate there were no additional route config matches but that all segments of\n * the URL were consumed during matching so the route was URL matched. When this happens, we still\n * try to match child configs in case there are empty path children.\n */\nclass NoLeftoversInUrl {}\nfunction recognize$1(injector, configLoader, rootComponentType, config, urlTree, urlSerializer, paramsInheritanceStrategy = 'emptyOnly') {\n return new Recognizer(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer).recognize();\n}\nconst MAX_ALLOWED_REDIRECTS = 31;\nclass Recognizer {\n injector;\n configLoader;\n rootComponentType;\n config;\n urlTree;\n paramsInheritanceStrategy;\n urlSerializer;\n applyRedirects;\n absoluteRedirectCount = 0;\n allowRedirects = true;\n constructor(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer) {\n this.injector = injector;\n this.configLoader = configLoader;\n this.rootComponentType = rootComponentType;\n this.config = config;\n this.urlTree = urlTree;\n this.paramsInheritanceStrategy = paramsInheritanceStrategy;\n this.urlSerializer = urlSerializer;\n this.applyRedirects = new ApplyRedirects(this.urlSerializer, this.urlTree);\n }\n noMatchError(e) {\n return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, typeof ngDevMode === 'undefined' || ngDevMode ? `Cannot match any routes. URL Segment: '${e.segmentGroup}'` : `'${e.segmentGroup}'`);\n }\n recognize() {\n const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;\n return this.match(rootSegmentGroup).pipe(map(({\n children,\n rootSnapshot\n }) => {\n const rootNode = new TreeNode(rootSnapshot, children);\n const routeState = new RouterStateSnapshot('', rootNode);\n const tree = createUrlTreeFromSnapshot(rootSnapshot, [], this.urlTree.queryParams, this.urlTree.fragment);\n // https://github.com/angular/angular/issues/47307\n // Creating the tree stringifies the query params\n // We don't want to do this here so reassign them to the original.\n tree.queryParams = this.urlTree.queryParams;\n routeState.url = this.urlSerializer.serialize(tree);\n return {\n state: routeState,\n tree\n };\n }));\n }\n match(rootSegmentGroup) {\n // Use Object.freeze to prevent readers of the Router state from modifying it outside\n // of a navigation, resulting in the router being out of sync with the browser.\n const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});\n return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot).pipe(map(children => {\n return {\n children,\n rootSnapshot\n };\n }), catchError(e => {\n if (e instanceof AbsoluteRedirect) {\n this.urlTree = e.urlTree;\n return this.match(e.urlTree.root);\n }\n if (e instanceof NoMatch) {\n throw this.noMatchError(e);\n }\n throw e;\n }));\n }\n processSegmentGroup(injector, config, segmentGroup, outlet, parentRoute) {\n if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {\n return this.processChildren(injector, config, segmentGroup, parentRoute);\n }\n return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true, parentRoute).pipe(map(child => child instanceof TreeNode ? [child] : []));\n }\n /**\n * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if\n * we cannot find a match for _any_ of the children.\n *\n * @param config - The `Routes` to match against\n * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the\n * config.\n */\n processChildren(injector, config, segmentGroup, parentRoute) {\n // Expand outlets one at a time, starting with the primary outlet. We need to do it this way\n // because an absolute redirect from the primary outlet takes precedence.\n const childOutlets = [];\n for (const child of Object.keys(segmentGroup.children)) {\n if (child === 'primary') {\n childOutlets.unshift(child);\n } else {\n childOutlets.push(child);\n }\n }\n return from(childOutlets).pipe(concatMap(childOutlet => {\n const child = segmentGroup.children[childOutlet];\n // Sort the config so that routes with outlets that match the one being activated\n // appear first, followed by routes for other outlets, which might match if they have\n // an empty path.\n const sortedConfig = sortByMatchingOutlets(config, childOutlet);\n return this.processSegmentGroup(injector, sortedConfig, child, childOutlet, parentRoute);\n }), scan((children, outletChildren) => {\n children.push(...outletChildren);\n return children;\n }), defaultIfEmpty(null), last$1(), mergeMap(children => {\n if (children === null) return noMatch$1(segmentGroup);\n // Because we may have matched two outlets to the same empty path segment, we can have\n // multiple activated results for the same outlet. We should merge the children of\n // these results so the final return value is only one `TreeNode` per outlet.\n const mergedChildren = mergeEmptyPathMatches(children);\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // This should really never happen - we are only taking the first match for each\n // outlet and merge the empty path matches.\n checkOutletNameUniqueness(mergedChildren);\n }\n sortActivatedRouteSnapshots(mergedChildren);\n return of(mergedChildren);\n }));\n }\n processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects, parentRoute) {\n return from(routes).pipe(concatMap(r => {\n return this.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects, parentRoute).pipe(catchError(e => {\n if (e instanceof NoMatch) {\n return of(null);\n }\n throw e;\n }));\n }), first(x => !!x), catchError(e => {\n if (isEmptyError(e)) {\n if (noLeftoversInUrl(segmentGroup, segments, outlet)) {\n return of(new NoLeftoversInUrl());\n }\n return noMatch$1(segmentGroup);\n }\n throw e;\n }));\n }\n processSegmentAgainstRoute(injector, routes, route, rawSegment, segments, outlet, allowRedirects, parentRoute) {\n // We allow matches to empty paths when the outlets differ so we can match a url like `/(b:b)` to\n // a config like\n // * `{path: '', children: [{path: 'b', outlet: 'b'}]}`\n // or even\n // * `{path: '', outlet: 'a', children: [{path: 'b', outlet: 'b'}]`\n //\n // The exception here is when the segment outlet is for the primary outlet. This would\n // result in a match inside the named outlet because all children there are written as primary\n // outlets. So we need to prevent child named outlet matches in a url like `/b` in a config like\n // * `{path: '', outlet: 'x' children: [{path: 'b'}]}`\n // This should only match if the url is `/(x:b)`.\n if (getOutlet(route) !== outlet && (outlet === PRIMARY_OUTLET || !emptyPathMatch(rawSegment, segments, route))) {\n return noMatch$1(rawSegment);\n }\n if (route.redirectTo === undefined) {\n return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute);\n }\n if (this.allowRedirects && allowRedirects) {\n return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes, route, segments, outlet, parentRoute);\n }\n return noMatch$1(rawSegment);\n }\n expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet, parentRoute) {\n const {\n matched,\n parameters,\n consumedSegments,\n positionalParamSegments,\n remainingSegments\n } = match(segmentGroup, route, segments);\n if (!matched) return noMatch$1(segmentGroup);\n // TODO(atscott): Move all of this under an if(ngDevMode) as a breaking change and allow stack\n // size exceeded in production\n if (typeof route.redirectTo === 'string' && route.redirectTo[0] === '/') {\n this.absoluteRedirectCount++;\n if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) {\n if (ngDevMode) {\n throw new ɵRuntimeError(4016 /* RuntimeErrorCode.INFINITE_REDIRECT */, `Detected possible infinite redirect when redirecting from '${this.urlTree}' to '${route.redirectTo}'.\\n` + `This is currently a dev mode only error but will become a` + ` call stack size exceeded error in production in a future major version.`);\n }\n this.allowRedirects = false;\n }\n }\n const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));\n const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);\n currentSnapshot.params = Object.freeze(inherited.params);\n currentSnapshot.data = Object.freeze(inherited.data);\n const newTree = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments, currentSnapshot, injector);\n return this.applyRedirects.lineralizeSegments(route, newTree).pipe(mergeMap(newSegments => {\n return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false, parentRoute);\n }));\n }\n matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute) {\n const matchResult = matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer);\n if (route.path === '**') {\n // Prior versions of the route matching algorithm would stop matching at the wildcard route.\n // We should investigate a better strategy for any existing children. Otherwise, these\n // child segments are silently dropped from the navigation.\n // https://github.com/angular/angular/issues/40089\n rawSegment.children = {};\n }\n return matchResult.pipe(switchMap(result => {\n if (!result.matched) {\n return noMatch$1(rawSegment);\n }\n // If the route has an injector created from providers, we should start using that.\n injector = route._injector ?? injector;\n return this.getChildConfig(injector, route, segments).pipe(switchMap(({\n routes: childConfig\n }) => {\n const childInjector = route._loadedInjector ?? injector;\n const {\n parameters,\n consumedSegments,\n remainingSegments\n } = result;\n const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));\n const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);\n snapshot.params = Object.freeze(inherited.params);\n snapshot.data = Object.freeze(inherited.data);\n const {\n segmentGroup,\n slicedSegments\n } = split(rawSegment, consumedSegments, remainingSegments, childConfig);\n if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {\n return this.processChildren(childInjector, childConfig, segmentGroup, snapshot).pipe(map(children => {\n return new TreeNode(snapshot, children);\n }));\n }\n if (childConfig.length === 0 && slicedSegments.length === 0) {\n return of(new TreeNode(snapshot, []));\n }\n const matchedOnOutlet = getOutlet(route) === outlet;\n // If we matched a config due to empty path match on a different outlet, we need to\n // continue passing the current outlet for the segment rather than switch to PRIMARY.\n // Note that we switch to primary when we have a match because outlet configs look like\n // this: {path: 'a', outlet: 'a', children: [\n // {path: 'b', component: B},\n // {path: 'c', component: C},\n // ]}\n // Notice that the children of the named outlet are configured with the primary outlet\n return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true, snapshot).pipe(map(child => {\n return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);\n }));\n }));\n }));\n }\n getChildConfig(injector, route, segments) {\n if (route.children) {\n // The children belong to the same module\n return of({\n routes: route.children,\n injector\n });\n }\n if (route.loadChildren) {\n // lazy children belong to the loaded module\n if (route._loadedRoutes !== undefined) {\n return of({\n routes: route._loadedRoutes,\n injector: route._loadedInjector\n });\n }\n return runCanLoadGuards(injector, route, segments, this.urlSerializer).pipe(mergeMap(shouldLoadResult => {\n if (shouldLoadResult) {\n return this.configLoader.loadChildren(injector, route).pipe(tap(cfg => {\n route._loadedRoutes = cfg.routes;\n route._loadedInjector = cfg.injector;\n }));\n }\n return canLoadFails(route);\n }));\n }\n return of({\n routes: [],\n injector\n });\n }\n}\nfunction sortActivatedRouteSnapshots(nodes) {\n nodes.sort((a, b) => {\n if (a.value.outlet === PRIMARY_OUTLET) return -1;\n if (b.value.outlet === PRIMARY_OUTLET) return 1;\n return a.value.outlet.localeCompare(b.value.outlet);\n });\n}\nfunction hasEmptyPathConfig(node) {\n const config = node.value.routeConfig;\n return config && config.path === '';\n}\n/**\n * Finds `TreeNode`s with matching empty path route configs and merges them into `TreeNode` with\n * the children from each duplicate. This is necessary because different outlets can match a\n * single empty path route config and the results need to then be merged.\n */\nfunction mergeEmptyPathMatches(nodes) {\n const result = [];\n // The set of nodes which contain children that were merged from two duplicate empty path nodes.\n const mergedNodes = new Set();\n for (const node of nodes) {\n if (!hasEmptyPathConfig(node)) {\n result.push(node);\n continue;\n }\n const duplicateEmptyPathNode = result.find(resultNode => node.value.routeConfig === resultNode.value.routeConfig);\n if (duplicateEmptyPathNode !== undefined) {\n duplicateEmptyPathNode.children.push(...node.children);\n mergedNodes.add(duplicateEmptyPathNode);\n } else {\n result.push(node);\n }\n }\n // For each node which has children from multiple sources, we need to recompute a new `TreeNode`\n // by also merging those children. This is necessary when there are multiple empty path configs\n // in a row. Put another way: whenever we combine children of two nodes, we need to also check\n // if any of those children can be combined into a single node as well.\n for (const mergedNode of mergedNodes) {\n const mergedChildren = mergeEmptyPathMatches(mergedNode.children);\n result.push(new TreeNode(mergedNode.value, mergedChildren));\n }\n return result.filter(n => !mergedNodes.has(n));\n}\nfunction checkOutletNameUniqueness(nodes) {\n const names = {};\n nodes.forEach(n => {\n const routeWithSameOutletName = names[n.value.outlet];\n if (routeWithSameOutletName) {\n const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');\n const c = n.value.url.map(s => s.toString()).join('/');\n throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);\n }\n names[n.value.outlet] = n.value;\n });\n}\nfunction getData(route) {\n return route.data || {};\n}\nfunction getResolve(route) {\n return route.resolve || {};\n}\nfunction recognize(injector, configLoader, rootComponentType, config, serializer, paramsInheritanceStrategy) {\n return mergeMap(t => recognize$1(injector, configLoader, rootComponentType, config, t.extractedUrl, serializer, paramsInheritanceStrategy).pipe(map(({\n state: targetSnapshot,\n tree: urlAfterRedirects\n }) => {\n return {\n ...t,\n targetSnapshot,\n urlAfterRedirects\n };\n })));\n}\nfunction resolveData(paramsInheritanceStrategy, injector) {\n return mergeMap(t => {\n const {\n targetSnapshot,\n guards: {\n canActivateChecks\n }\n } = t;\n if (!canActivateChecks.length) {\n return of(t);\n }\n // Iterating a Set in javascript happens in insertion order so it is safe to use a `Set` to\n // preserve the correct order that the resolvers should run in.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#description\n const routesWithResolversToRun = new Set(canActivateChecks.map(check => check.route));\n const routesNeedingDataUpdates = new Set();\n for (const route of routesWithResolversToRun) {\n if (routesNeedingDataUpdates.has(route)) {\n continue;\n }\n // All children under the route with a resolver to run need to recompute inherited data.\n for (const newRoute of flattenRouteTree(route)) {\n routesNeedingDataUpdates.add(newRoute);\n }\n }\n let routesProcessed = 0;\n return from(routesNeedingDataUpdates).pipe(concatMap(route => {\n if (routesWithResolversToRun.has(route)) {\n return runResolve(route, targetSnapshot, paramsInheritanceStrategy, injector);\n } else {\n route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;\n return of(void 0);\n }\n }), tap(() => routesProcessed++), takeLast(1), mergeMap(_ => routesProcessed === routesNeedingDataUpdates.size ? of(t) : EMPTY));\n });\n}\n/**\n * Returns the `ActivatedRouteSnapshot` tree as an array, using DFS to traverse the route tree.\n */\nfunction flattenRouteTree(route) {\n const descendants = route.children.map(child => flattenRouteTree(child)).flat();\n return [route, ...descendants];\n}\nfunction runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {\n const config = futureARS.routeConfig;\n const resolve = futureARS._resolve;\n if (config?.title !== undefined && !hasStaticTitle(config)) {\n resolve[RouteTitleKey] = config.title;\n }\n return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map(resolvedData => {\n futureARS._resolvedData = resolvedData;\n futureARS.data = getInherited(futureARS, futureARS.parent, paramsInheritanceStrategy).resolve;\n return null;\n }));\n}\nfunction resolveNode(resolve, futureARS, futureRSS, injector) {\n const keys = getDataKeys(resolve);\n if (keys.length === 0) {\n return of({});\n }\n const data = {};\n return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector).pipe(first(), tap(value => {\n if (value instanceof RedirectCommand) {\n throw redirectingNavigationError(new DefaultUrlSerializer(), value);\n }\n data[key] = value;\n }))), takeLast(1), mapTo(data), catchError(e => isEmptyError(e) ? EMPTY : throwError(e)));\n}\nfunction getResolver(injectionToken, futureARS, futureRSS, injector) {\n const closestInjector = getClosestRouteInjector(futureARS) ?? injector;\n const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);\n const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));\n return wrapIntoObservable(resolverValue);\n}\n\n/**\n * Perform a side effect through a switchMap for every emission on the source Observable,\n * but return an Observable that is identical to the source. It's essentially the same as\n * the `tap` operator, but if the side effectful `next` function returns an ObservableInput,\n * it will wait before continuing with the original value.\n */\nfunction switchTap(next) {\n return switchMap(v => {\n const nextResult = next(v);\n if (nextResult) {\n return from(nextResult).pipe(map(() => v));\n }\n return of(v);\n });\n}\n\n/**\n * Provides a strategy for setting the page title after a router navigation.\n *\n * The built-in implementation traverses the router state snapshot and finds the deepest primary\n * outlet with `title` property. Given the `Routes` below, navigating to\n * `/base/child(popup:aux)` would result in the document title being set to \"child\".\n * ```ts\n * [\n * {path: 'base', title: 'base', children: [\n * {path: 'child', title: 'child'},\n * ],\n * {path: 'aux', outlet: 'popup', title: 'popupTitle'}\n * ]\n * ```\n *\n * This class can be used as a base class for custom title strategies. That is, you can create your\n * own class that extends the `TitleStrategy`. Note that in the above example, the `title`\n * from the named outlet is never used. However, a custom strategy might be implemented to\n * incorporate titles in named outlets.\n *\n * @publicApi\n * @see [Page title guide](guide/routing/common-router-tasks#setting-the-page-title)\n */\nlet TitleStrategy = /*#__PURE__*/(() => {\n class TitleStrategy {\n /**\n * @returns The `title` of the deepest primary route.\n */\n buildTitle(snapshot) {\n let pageTitle;\n let route = snapshot.root;\n while (route !== undefined) {\n pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;\n route = route.children.find(child => child.outlet === PRIMARY_OUTLET);\n }\n return pageTitle;\n }\n /**\n * Given an `ActivatedRouteSnapshot`, returns the final value of the\n * `Route.title` property, which can either be a static string or a resolved value.\n */\n getResolvedTitleForRoute(snapshot) {\n return snapshot.data[RouteTitleKey];\n }\n static ɵfac = function TitleStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TitleStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TitleStrategy,\n factory: () => (() => inject(DefaultTitleStrategy))(),\n providedIn: 'root'\n });\n }\n return TitleStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * The default `TitleStrategy` used by the router that updates the title using the `Title` service.\n */\nlet DefaultTitleStrategy = /*#__PURE__*/(() => {\n class DefaultTitleStrategy extends TitleStrategy {\n title;\n constructor(title) {\n super();\n this.title = title;\n }\n /**\n * Sets the title of the browser to the given value.\n *\n * @param title The `pageTitle` from the deepest primary route.\n */\n updateTitle(snapshot) {\n const title = this.buildTitle(snapshot);\n if (title !== undefined) {\n this.title.setTitle(title);\n }\n }\n static ɵfac = function DefaultTitleStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultTitleStrategy)(i0.ɵɵinject(i1.Title));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultTitleStrategy,\n factory: DefaultTitleStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n return DefaultTitleStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * A DI token for the router service.\n *\n * @publicApi\n */\nconst ROUTER_CONFIGURATION = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router config' : '', {\n providedIn: 'root',\n factory: () => ({})\n});\n\n/**\n * This component is used internally within the router to be a placeholder when an empty\n * router-outlet is needed. For example, with a config such as:\n *\n * `{path: 'parent', outlet: 'nav', children: [...]}`\n *\n * In order to render, there needs to be a component on this config, which will default\n * to this `EmptyOutletComponent`.\n */\nlet ɵEmptyOutletComponent = /*#__PURE__*/(() => {\n class ɵEmptyOutletComponent {\n static ɵfac = function ɵEmptyOutletComponent_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ɵEmptyOutletComponent)();\n };\n static ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: ɵEmptyOutletComponent,\n selectors: [[\"ng-component\"]],\n decls: 1,\n vars: 0,\n template: function _EmptyOutletComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"router-outlet\");\n }\n },\n dependencies: [RouterOutlet],\n encapsulation: 2\n });\n }\n return ɵEmptyOutletComponent;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Makes a copy of the config and adds any default required properties.\n */\nfunction standardizeConfig(r) {\n const children = r.children && r.children.map(standardizeConfig);\n const c = children ? {\n ...r,\n children\n } : {\n ...r\n };\n if (!c.component && !c.loadComponent && (children || c.loadChildren) && c.outlet && c.outlet !== PRIMARY_OUTLET) {\n c.component = ɵEmptyOutletComponent;\n }\n return c;\n}\n\n/**\n * The DI token for a router configuration.\n *\n * `ROUTES` is a low level API for router configuration via dependency injection.\n *\n * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,\n * `provideRouter`, or `Router.resetConfig()`.\n *\n * @publicApi\n */\nconst ROUTES = /*#__PURE__*/new InjectionToken(ngDevMode ? 'ROUTES' : '');\nlet RouterConfigLoader = /*#__PURE__*/(() => {\n class RouterConfigLoader {\n componentLoaders = new WeakMap();\n childrenLoaders = new WeakMap();\n onLoadStartListener;\n onLoadEndListener;\n compiler = inject(Compiler);\n loadComponent(route) {\n if (this.componentLoaders.get(route)) {\n return this.componentLoaders.get(route);\n } else if (route._loadedComponent) {\n return of(route._loadedComponent);\n }\n if (this.onLoadStartListener) {\n this.onLoadStartListener(route);\n }\n const loadRunner = wrapIntoObservable(route.loadComponent()).pipe(map(maybeUnwrapDefaultExport), tap(component => {\n if (this.onLoadEndListener) {\n this.onLoadEndListener(route);\n }\n (typeof ngDevMode === 'undefined' || ngDevMode) && assertStandalone(route.path ?? '', component);\n route._loadedComponent = component;\n }), finalize(() => {\n this.componentLoaders.delete(route);\n }));\n // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much\n const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());\n this.componentLoaders.set(route, loader);\n return loader;\n }\n loadChildren(parentInjector, route) {\n if (this.childrenLoaders.get(route)) {\n return this.childrenLoaders.get(route);\n } else if (route._loadedRoutes) {\n return of({\n routes: route._loadedRoutes,\n injector: route._loadedInjector\n });\n }\n if (this.onLoadStartListener) {\n this.onLoadStartListener(route);\n }\n const moduleFactoryOrRoutes$ = loadChildren(route, this.compiler, parentInjector, this.onLoadEndListener);\n const loadRunner = moduleFactoryOrRoutes$.pipe(finalize(() => {\n this.childrenLoaders.delete(route);\n }));\n // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much\n const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());\n this.childrenLoaders.set(route, loader);\n return loader;\n }\n static ɵfac = function RouterConfigLoader_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterConfigLoader)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterConfigLoader,\n factory: RouterConfigLoader.ɵfac,\n providedIn: 'root'\n });\n }\n return RouterConfigLoader;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Executes a `route.loadChildren` callback and converts the result to an array of child routes and\n * an injector if that callback returned a module.\n *\n * This function is used for the route discovery during prerendering\n * in @angular-devkit/build-angular. If there are any updates to the contract here, it will require\n * an update to the extractor.\n */\nfunction loadChildren(route, compiler, parentInjector, onLoadEndListener) {\n return wrapIntoObservable(route.loadChildren()).pipe(map(maybeUnwrapDefaultExport), mergeMap(t => {\n if (t instanceof NgModuleFactory || Array.isArray(t)) {\n return of(t);\n } else {\n return from(compiler.compileModuleAsync(t));\n }\n }), map(factoryOrRoutes => {\n if (onLoadEndListener) {\n onLoadEndListener(route);\n }\n // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is\n // no injector associated with lazy loading a `Route` array.\n let injector;\n let rawRoutes;\n let requireStandaloneComponents = false;\n if (Array.isArray(factoryOrRoutes)) {\n rawRoutes = factoryOrRoutes;\n requireStandaloneComponents = true;\n } else {\n injector = factoryOrRoutes.create(parentInjector).injector;\n // When loading a module that doesn't provide `RouterModule.forChild()` preloader\n // will get stuck in an infinite loop. The child module's Injector will look to\n // its parent `Injector` when it doesn't find any ROUTES so it will return routes\n // for it's parent module instead.\n rawRoutes = injector.get(ROUTES, [], {\n optional: true,\n self: true\n }).flat();\n }\n const routes = rawRoutes.map(standardizeConfig);\n (typeof ngDevMode === 'undefined' || ngDevMode) && validateConfig(routes, route.path, requireStandaloneComponents);\n return {\n routes,\n injector\n };\n }));\n}\nfunction isWrappedDefaultExport(value) {\n // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be\n // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that\n // `default` will be a renamed property.\n return value && typeof value === 'object' && 'default' in value;\n}\nfunction maybeUnwrapDefaultExport(input) {\n // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not\n // subject to property renaming, so we reference it with bracket access.\n return isWrappedDefaultExport(input) ? input['default'] : input;\n}\n\n/**\n * @description\n *\n * Provides a way to migrate AngularJS applications to Angular.\n *\n * @publicApi\n */\nlet UrlHandlingStrategy = /*#__PURE__*/(() => {\n class UrlHandlingStrategy {\n static ɵfac = function UrlHandlingStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UrlHandlingStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlHandlingStrategy,\n factory: () => (() => inject(DefaultUrlHandlingStrategy))(),\n providedIn: 'root'\n });\n }\n return UrlHandlingStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @publicApi\n */\nlet DefaultUrlHandlingStrategy = /*#__PURE__*/(() => {\n class DefaultUrlHandlingStrategy {\n shouldProcessUrl(url) {\n return true;\n }\n extract(url) {\n return url;\n }\n merge(newUrlPart, wholeUrl) {\n return newUrlPart;\n }\n static ɵfac = function DefaultUrlHandlingStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultUrlHandlingStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultUrlHandlingStrategy,\n factory: DefaultUrlHandlingStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n return DefaultUrlHandlingStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/// \nconst CREATE_VIEW_TRANSITION = /*#__PURE__*/new InjectionToken(ngDevMode ? 'view transition helper' : '');\nconst VIEW_TRANSITION_OPTIONS = /*#__PURE__*/new InjectionToken(ngDevMode ? 'view transition options' : '');\n/**\n * A helper function for using browser view transitions. This function skips the call to\n * `startViewTransition` if the browser does not support it.\n *\n * @returns A Promise that resolves when the view transition callback begins.\n */\nfunction createViewTransition(injector, from, to) {\n const transitionOptions = injector.get(VIEW_TRANSITION_OPTIONS);\n const document = injector.get(DOCUMENT);\n // Create promises outside the Angular zone to avoid causing extra change detections\n return injector.get(NgZone).runOutsideAngular(() => {\n if (!document.startViewTransition || transitionOptions.skipNextTransition) {\n transitionOptions.skipNextTransition = false;\n // The timing of `startViewTransition` is closer to a macrotask. It won't be called\n // until the current event loop exits so we use a promise resolved in a timeout instead\n // of Promise.resolve().\n return new Promise(resolve => setTimeout(resolve));\n }\n let resolveViewTransitionStarted;\n const viewTransitionStarted = new Promise(resolve => {\n resolveViewTransitionStarted = resolve;\n });\n const transition = document.startViewTransition(() => {\n resolveViewTransitionStarted();\n // We don't actually update dom within the transition callback. The resolving of the above\n // promise unblocks the Router navigation, which synchronously activates and deactivates\n // routes (the DOM update). This view transition waits for the next change detection to\n // complete (below), which includes the update phase of the routed components.\n return createRenderPromise(injector);\n });\n const {\n onViewTransitionCreated\n } = transitionOptions;\n if (onViewTransitionCreated) {\n runInInjectionContext(injector, () => onViewTransitionCreated({\n transition,\n from,\n to\n }));\n }\n return viewTransitionStarted;\n });\n}\n/**\n * Creates a promise that resolves after next render.\n */\nfunction createRenderPromise(injector) {\n return new Promise(resolve => {\n // Wait for the microtask queue to empty after the next render happens (by waiting a macrotask).\n // This ensures any follow-up renders in the microtask queue are completed before the\n // view transition starts animating.\n afterNextRender({\n read: () => setTimeout(resolve)\n }, {\n injector\n });\n });\n}\nconst NAVIGATION_ERROR_HANDLER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'navigation error handler' : '');\nlet NavigationTransitions = /*#__PURE__*/(() => {\n class NavigationTransitions {\n currentNavigation = null;\n currentTransition = null;\n lastSuccessfulNavigation = null;\n /**\n * These events are used to communicate back to the Router about the state of the transition. The\n * Router wants to respond to these events in various ways. Because the `NavigationTransition`\n * class is not public, this event subject is not publicly exposed.\n */\n events = new Subject();\n /**\n * Used to abort the current transition with an error.\n */\n transitionAbortSubject = new Subject();\n configLoader = inject(RouterConfigLoader);\n environmentInjector = inject(EnvironmentInjector);\n urlSerializer = inject(UrlSerializer);\n rootContexts = inject(ChildrenOutletContexts);\n location = inject(Location);\n inputBindingEnabled = inject(INPUT_BINDER, {\n optional: true\n }) !== null;\n titleStrategy = inject(TitleStrategy);\n options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || 'emptyOnly';\n urlHandlingStrategy = inject(UrlHandlingStrategy);\n createViewTransition = inject(CREATE_VIEW_TRANSITION, {\n optional: true\n });\n navigationErrorHandler = inject(NAVIGATION_ERROR_HANDLER, {\n optional: true\n });\n navigationId = 0;\n get hasRequestedNavigation() {\n return this.navigationId !== 0;\n }\n transitions;\n /**\n * Hook that enables you to pause navigation after the preactivation phase.\n * Used by `RouterModule`.\n *\n * @internal\n */\n afterPreactivation = () => of(void 0);\n /** @internal */\n rootComponentType = null;\n constructor() {\n const onLoadStart = r => this.events.next(new RouteConfigLoadStart(r));\n const onLoadEnd = r => this.events.next(new RouteConfigLoadEnd(r));\n this.configLoader.onLoadEndListener = onLoadEnd;\n this.configLoader.onLoadStartListener = onLoadStart;\n }\n complete() {\n this.transitions?.complete();\n }\n handleNavigationRequest(request) {\n const id = ++this.navigationId;\n this.transitions?.next({\n ...this.transitions.value,\n ...request,\n id\n });\n }\n setupNavigations(router, initialUrlTree, initialRouterState) {\n this.transitions = new BehaviorSubject({\n id: 0,\n currentUrlTree: initialUrlTree,\n currentRawUrl: initialUrlTree,\n extractedUrl: this.urlHandlingStrategy.extract(initialUrlTree),\n urlAfterRedirects: this.urlHandlingStrategy.extract(initialUrlTree),\n rawUrl: initialUrlTree,\n extras: {},\n resolve: () => {},\n reject: () => {},\n promise: Promise.resolve(true),\n source: IMPERATIVE_NAVIGATION,\n restoredState: null,\n currentSnapshot: initialRouterState.snapshot,\n targetSnapshot: null,\n currentRouterState: initialRouterState,\n targetRouterState: null,\n guards: {\n canActivateChecks: [],\n canDeactivateChecks: []\n },\n guardsResult: null\n });\n return this.transitions.pipe(filter(t => t.id !== 0),\n // Extract URL\n map(t => ({\n ...t,\n extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl)\n })),\n // Using switchMap so we cancel executing navigations when a new one comes in\n switchMap(overallTransitionState => {\n let completed = false;\n let errored = false;\n return of(overallTransitionState).pipe(switchMap(t => {\n // It is possible that `switchMap` fails to cancel previous navigations if a new one happens synchronously while the operator\n // is processing the `next` notification of that previous navigation. This can happen when a new navigation (say 2) cancels a\n // previous one (1) and yet another navigation (3) happens synchronously in response to the `NavigationCancel` event for (1).\n // https://github.com/ReactiveX/rxjs/issues/7455\n if (this.navigationId > overallTransitionState.id) {\n const cancellationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';\n this.cancelNavigationTransition(overallTransitionState, cancellationReason, NavigationCancellationCode.SupersededByNewNavigation);\n return EMPTY;\n }\n this.currentTransition = overallTransitionState;\n // Store the Navigation object\n this.currentNavigation = {\n id: t.id,\n initialUrl: t.rawUrl,\n extractedUrl: t.extractedUrl,\n targetBrowserUrl: typeof t.extras.browserUrl === 'string' ? this.urlSerializer.parse(t.extras.browserUrl) : t.extras.browserUrl,\n trigger: t.source,\n extras: t.extras,\n previousNavigation: !this.lastSuccessfulNavigation ? null : {\n ...this.lastSuccessfulNavigation,\n previousNavigation: null\n }\n };\n const urlTransition = !router.navigated || this.isUpdatingInternalState() || this.isUpdatedBrowserUrl();\n const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;\n if (!urlTransition && onSameUrlNavigation !== 'reload') {\n const reason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` : '';\n this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.rawUrl), reason, NavigationSkippedCode.IgnoredSameUrlNavigation));\n t.resolve(false);\n return EMPTY;\n }\n if (this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {\n return of(t).pipe(\n // Fire NavigationStart event\n switchMap(t => {\n const transition = this.transitions?.getValue();\n this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));\n if (transition !== this.transitions?.getValue()) {\n return EMPTY;\n }\n // This delay is required to match old behavior that forced\n // navigation to always be async\n return Promise.resolve(t);\n }),\n // Recognize\n recognize(this.environmentInjector, this.configLoader, this.rootComponentType, router.config, this.urlSerializer, this.paramsInheritanceStrategy),\n // Update URL if in `eager` update mode\n tap(t => {\n overallTransitionState.targetSnapshot = t.targetSnapshot;\n overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;\n this.currentNavigation = {\n ...this.currentNavigation,\n finalUrl: t.urlAfterRedirects\n };\n // Fire RoutesRecognized\n const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(routesRecognized);\n }));\n } else if (urlTransition && this.urlHandlingStrategy.shouldProcessUrl(t.currentRawUrl)) {\n /* When the current URL shouldn't be processed, but the previous one\n * was, we handle this \"error condition\" by navigating to the\n * previously successful URL, but leaving the URL intact.*/\n const {\n id,\n extractedUrl,\n source,\n restoredState,\n extras\n } = t;\n const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);\n this.events.next(navStart);\n const targetSnapshot = createEmptyState(this.rootComponentType).snapshot;\n this.currentTransition = overallTransitionState = {\n ...t,\n targetSnapshot,\n urlAfterRedirects: extractedUrl,\n extras: {\n ...extras,\n skipLocationChange: false,\n replaceUrl: false\n }\n };\n this.currentNavigation.finalUrl = extractedUrl;\n return of(overallTransitionState);\n } else {\n /* When neither the current or previous URL can be processed, do\n * nothing other than update router's internal reference to the\n * current \"settled\" URL. This way the next navigation will be coming\n * from the current URL in the browser.\n */\n const reason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation was ignored because the UrlHandlingStrategy` + ` indicated neither the current URL ${t.currentRawUrl} nor target URL ${t.rawUrl} should be processed.` : '';\n this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, NavigationSkippedCode.IgnoredByUrlHandlingStrategy));\n t.resolve(false);\n return EMPTY;\n }\n }),\n // --- GUARDS ---\n tap(t => {\n const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(guardsStart);\n }), map(t => {\n this.currentTransition = overallTransitionState = {\n ...t,\n guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)\n };\n return overallTransitionState;\n }), checkGuards(this.environmentInjector, evt => this.events.next(evt)), tap(t => {\n overallTransitionState.guardsResult = t.guardsResult;\n if (t.guardsResult && typeof t.guardsResult !== 'boolean') {\n throw redirectingNavigationError(this.urlSerializer, t.guardsResult);\n }\n const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);\n this.events.next(guardsEnd);\n }), filter(t => {\n if (!t.guardsResult) {\n this.cancelNavigationTransition(t, '', NavigationCancellationCode.GuardRejected);\n return false;\n }\n return true;\n }),\n // --- RESOLVE ---\n switchTap(t => {\n if (t.guards.canActivateChecks.length) {\n return of(t).pipe(tap(t => {\n const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(resolveStart);\n }), switchMap(t => {\n let dataResolved = false;\n return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.environmentInjector), tap({\n next: () => dataResolved = true,\n complete: () => {\n if (!dataResolved) {\n this.cancelNavigationTransition(t, typeof ngDevMode === 'undefined' || ngDevMode ? `At least one route resolver didn't emit any value.` : '', NavigationCancellationCode.NoDataFromResolver);\n }\n }\n }));\n }), tap(t => {\n const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(resolveEnd);\n }));\n }\n return undefined;\n }),\n // --- LOAD COMPONENTS ---\n switchTap(t => {\n const loadComponents = route => {\n const loaders = [];\n if (route.routeConfig?.loadComponent && !route.routeConfig._loadedComponent) {\n loaders.push(this.configLoader.loadComponent(route.routeConfig).pipe(tap(loadedComponent => {\n route.component = loadedComponent;\n }), map(() => void 0)));\n }\n for (const child of route.children) {\n loaders.push(...loadComponents(child));\n }\n return loaders;\n };\n return combineLatest(loadComponents(t.targetSnapshot.root)).pipe(defaultIfEmpty(null), take(1));\n }), switchTap(() => this.afterPreactivation()), switchMap(() => {\n const {\n currentSnapshot,\n targetSnapshot\n } = overallTransitionState;\n const viewTransitionStarted = this.createViewTransition?.(this.environmentInjector, currentSnapshot.root, targetSnapshot.root);\n // If view transitions are enabled, block the navigation until the view\n // transition callback starts. Otherwise, continue immediately.\n return viewTransitionStarted ? from(viewTransitionStarted).pipe(map(() => overallTransitionState)) : of(overallTransitionState);\n }), map(t => {\n const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);\n this.currentTransition = overallTransitionState = {\n ...t,\n targetRouterState\n };\n this.currentNavigation.targetRouterState = targetRouterState;\n return overallTransitionState;\n }), tap(() => {\n this.events.next(new BeforeActivateRoutes());\n }), activateRoutes(this.rootContexts, router.routeReuseStrategy, evt => this.events.next(evt), this.inputBindingEnabled),\n // Ensure that if some observable used to drive the transition doesn't\n // complete, the navigation still finalizes This should never happen, but\n // this is done as a safety measure to avoid surfacing this error (#49567).\n take(1), tap({\n next: t => {\n completed = true;\n this.lastSuccessfulNavigation = this.currentNavigation;\n this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects)));\n this.titleStrategy?.updateTitle(t.targetRouterState.snapshot);\n t.resolve(true);\n },\n complete: () => {\n completed = true;\n }\n }),\n // There used to be a lot more logic happening directly within the\n // transition Observable. Some of this logic has been refactored out to\n // other places but there may still be errors that happen there. This gives\n // us a way to cancel the transition from the outside. This may also be\n // required in the future to support something like the abort signal of the\n // Navigation API where the navigation gets aborted from outside the\n // transition.\n takeUntil(this.transitionAbortSubject.pipe(tap(err => {\n throw err;\n }))), finalize(() => {\n /* When the navigation stream finishes either through error or success,\n * we set the `completed` or `errored` flag. However, there are some\n * situations where we could get here without either of those being set.\n * For instance, a redirect during NavigationStart. Therefore, this is a\n * catch-all to make sure the NavigationCancel event is fired when a\n * navigation gets cancelled but not caught by other means. */\n if (!completed && !errored) {\n const cancelationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';\n this.cancelNavigationTransition(overallTransitionState, cancelationReason, NavigationCancellationCode.SupersededByNewNavigation);\n }\n // Only clear current navigation if it is still set to the one that\n // finalized.\n if (this.currentTransition?.id === overallTransitionState.id) {\n this.currentNavigation = null;\n this.currentTransition = null;\n }\n }), catchError(e => {\n errored = true;\n /* This error type is issued during Redirect, and is handled as a\n * cancellation rather than an error. */\n if (isNavigationCancelingError(e)) {\n this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode));\n // When redirecting, we need to delay resolving the navigation\n // promise and push it to the redirect navigation\n if (!isRedirectingNavigationCancelingError(e)) {\n overallTransitionState.resolve(false);\n } else {\n this.events.next(new RedirectRequest(e.url, e.navigationBehaviorOptions));\n }\n /* All other errors should reset to the router's internal URL reference\n * to the pre-error state. */\n } else {\n const navigationError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);\n try {\n const navigationErrorHandlerResult = runInInjectionContext(this.environmentInjector, () => this.navigationErrorHandler?.(navigationError));\n if (navigationErrorHandlerResult instanceof RedirectCommand) {\n const {\n message,\n cancellationCode\n } = redirectingNavigationError(this.urlSerializer, navigationErrorHandlerResult);\n this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), message, cancellationCode));\n this.events.next(new RedirectRequest(navigationErrorHandlerResult.redirectTo, navigationErrorHandlerResult.navigationBehaviorOptions));\n } else {\n this.events.next(navigationError);\n throw e;\n }\n } catch (ee) {\n // TODO(atscott): consider flipping the default behavior of\n // resolveNavigationPromiseOnError to be `resolve(false)` when\n // undefined. This is the most sane thing to do given that\n // applications very rarely handle the promise rejection and, as a\n // result, would get \"unhandled promise rejection\" console logs.\n // The vast majority of applications would not be affected by this\n // change so omitting a migration seems reasonable. Instead,\n // applications that rely on rejection can specifically opt-in to the\n // old behavior.\n if (this.options.resolveNavigationPromiseOnError) {\n overallTransitionState.resolve(false);\n } else {\n overallTransitionState.reject(ee);\n }\n }\n }\n return EMPTY;\n }));\n // casting because `pipe` returns observable({}) when called with 8+ arguments\n }));\n }\n cancelNavigationTransition(t, reason, code) {\n const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);\n this.events.next(navCancel);\n t.resolve(false);\n }\n /**\n * @returns Whether we're navigating to somewhere that is not what the Router is\n * currently set to.\n */\n isUpdatingInternalState() {\n // TODO(atscott): The serializer should likely be used instead of\n // `UrlTree.toString()`. Custom serializers are often written to handle\n // things better than the default one (objects, for example will be\n // [Object object] with the custom serializer and be \"the same\" when they\n // aren't).\n // (Same for isUpdatedBrowserUrl)\n return this.currentTransition?.extractedUrl.toString() !== this.currentTransition?.currentUrlTree.toString();\n }\n /**\n * @returns Whether we're updating the browser URL to something new (navigation is going\n * to somewhere not displayed in the URL bar and we will update the URL\n * bar if navigation succeeds).\n */\n isUpdatedBrowserUrl() {\n // The extracted URL is the part of the URL that this application cares about. `extract` may\n // return only part of the browser URL and that part may have not changed even if some other\n // portion of the URL did.\n const currentBrowserUrl = this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true)));\n const targetBrowserUrl = this.currentNavigation?.targetBrowserUrl ?? this.currentNavigation?.extractedUrl;\n return currentBrowserUrl.toString() !== targetBrowserUrl?.toString() && !this.currentNavigation?.extras.skipLocationChange;\n }\n static ɵfac = function NavigationTransitions_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NavigationTransitions)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NavigationTransitions,\n factory: NavigationTransitions.ɵfac,\n providedIn: 'root'\n });\n }\n return NavigationTransitions;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction isBrowserTriggeredNavigation(source) {\n return source !== IMPERATIVE_NAVIGATION;\n}\n\n/**\n * @description\n *\n * Provides a way to customize when activated routes get reused.\n *\n * @publicApi\n */\nlet RouteReuseStrategy = /*#__PURE__*/(() => {\n class RouteReuseStrategy {\n static ɵfac = function RouteReuseStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouteReuseStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouteReuseStrategy,\n factory: () => (() => inject(DefaultRouteReuseStrategy))(),\n providedIn: 'root'\n });\n }\n return RouteReuseStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * This base route reuse strategy only reuses routes when the matched router configs are\n * identical. This prevents components from being destroyed and recreated\n * when just the route parameters, query parameters or fragment change\n * (that is, the existing component is _reused_).\n *\n * This strategy does not store any routes for later reuse.\n *\n * Angular uses this strategy by default.\n *\n *\n * It can be used as a base class for custom route reuse strategies, i.e. you can create your own\n * class that extends the `BaseRouteReuseStrategy` one.\n * @publicApi\n */\nclass BaseRouteReuseStrategy {\n /**\n * Whether the given route should detach for later reuse.\n * Always returns false for `BaseRouteReuseStrategy`.\n * */\n shouldDetach(route) {\n return false;\n }\n /**\n * A no-op; the route is never stored since this strategy never detaches routes for later re-use.\n */\n store(route, detachedTree) {}\n /** Returns `false`, meaning the route (and its subtree) is never reattached */\n shouldAttach(route) {\n return false;\n }\n /** Returns `null` because this strategy does not store routes for later re-use. */\n retrieve(route) {\n return null;\n }\n /**\n * Determines if a route should be reused.\n * This strategy returns `true` when the future route config and current route config are\n * identical.\n */\n shouldReuseRoute(future, curr) {\n return future.routeConfig === curr.routeConfig;\n }\n}\nlet DefaultRouteReuseStrategy = /*#__PURE__*/(() => {\n class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {\n static ɵfac = /* @__PURE__ */(() => {\n let ɵDefaultRouteReuseStrategy_BaseFactory;\n return function DefaultRouteReuseStrategy_Factory(__ngFactoryType__) {\n return (ɵDefaultRouteReuseStrategy_BaseFactory || (ɵDefaultRouteReuseStrategy_BaseFactory = i0.ɵɵgetInheritedFactory(DefaultRouteReuseStrategy)))(__ngFactoryType__ || DefaultRouteReuseStrategy);\n };\n })();\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultRouteReuseStrategy,\n factory: DefaultRouteReuseStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n return DefaultRouteReuseStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet StateManager = /*#__PURE__*/(() => {\n class StateManager {\n static ɵfac = function StateManager_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || StateManager)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: StateManager,\n factory: () => (() => inject(HistoryStateManager))(),\n providedIn: 'root'\n });\n }\n return StateManager;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet HistoryStateManager = /*#__PURE__*/(() => {\n class HistoryStateManager extends StateManager {\n location = inject(Location);\n urlSerializer = inject(UrlSerializer);\n options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n canceledNavigationResolution = this.options.canceledNavigationResolution || 'replace';\n urlHandlingStrategy = inject(UrlHandlingStrategy);\n urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';\n currentUrlTree = new UrlTree();\n getCurrentUrlTree() {\n return this.currentUrlTree;\n }\n rawUrlTree = this.currentUrlTree;\n getRawUrlTree() {\n return this.rawUrlTree;\n }\n /**\n * The id of the currently active page in the router.\n * Updated to the transition's target id on a successful navigation.\n *\n * This is used to track what page the router last activated. When an attempted navigation fails,\n * the router can then use this to compute how to restore the state back to the previously active\n * page.\n */\n currentPageId = 0;\n lastSuccessfulId = -1;\n restoredState() {\n return this.location.getState();\n }\n /**\n * The ɵrouterPageId of whatever page is currently active in the browser history. This is\n * important for computing the target page id for new navigations because we need to ensure each\n * page id in the browser history is 1 more than the previous entry.\n */\n get browserPageId() {\n if (this.canceledNavigationResolution !== 'computed') {\n return this.currentPageId;\n }\n return this.restoredState()?.ɵrouterPageId ?? this.currentPageId;\n }\n routerState = createEmptyState(null);\n getRouterState() {\n return this.routerState;\n }\n stateMemento = this.createStateMemento();\n createStateMemento() {\n return {\n rawUrlTree: this.rawUrlTree,\n currentUrlTree: this.currentUrlTree,\n routerState: this.routerState\n };\n }\n registerNonRouterCurrentEntryChangeListener(listener) {\n return this.location.subscribe(event => {\n if (event['type'] === 'popstate') {\n listener(event['url'], event.state);\n }\n });\n }\n handleRouterEvent(e, currentTransition) {\n if (e instanceof NavigationStart) {\n this.stateMemento = this.createStateMemento();\n } else if (e instanceof NavigationSkipped) {\n this.rawUrlTree = currentTransition.initialUrl;\n } else if (e instanceof RoutesRecognized) {\n if (this.urlUpdateStrategy === 'eager') {\n if (!currentTransition.extras.skipLocationChange) {\n const rawUrl = this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);\n this.setBrowserUrl(currentTransition.targetBrowserUrl ?? rawUrl, currentTransition);\n }\n }\n } else if (e instanceof BeforeActivateRoutes) {\n this.currentUrlTree = currentTransition.finalUrl;\n this.rawUrlTree = this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);\n this.routerState = currentTransition.targetRouterState;\n if (this.urlUpdateStrategy === 'deferred' && !currentTransition.extras.skipLocationChange) {\n this.setBrowserUrl(currentTransition.targetBrowserUrl ?? this.rawUrlTree, currentTransition);\n }\n } else if (e instanceof NavigationCancel && (e.code === NavigationCancellationCode.GuardRejected || e.code === NavigationCancellationCode.NoDataFromResolver)) {\n this.restoreHistory(currentTransition);\n } else if (e instanceof NavigationError) {\n this.restoreHistory(currentTransition, true);\n } else if (e instanceof NavigationEnd) {\n this.lastSuccessfulId = e.id;\n this.currentPageId = this.browserPageId;\n }\n }\n setBrowserUrl(url, transition) {\n const path = url instanceof UrlTree ? this.urlSerializer.serialize(url) : url;\n if (this.location.isCurrentPathEqualTo(path) || !!transition.extras.replaceUrl) {\n // replacements do not update the target page\n const currentBrowserPageId = this.browserPageId;\n const state = {\n ...transition.extras.state,\n ...this.generateNgRouterState(transition.id, currentBrowserPageId)\n };\n this.location.replaceState(path, '', state);\n } else {\n const state = {\n ...transition.extras.state,\n ...this.generateNgRouterState(transition.id, this.browserPageId + 1)\n };\n this.location.go(path, '', state);\n }\n }\n /**\n * Performs the necessary rollback action to restore the browser URL to the\n * state before the transition.\n */\n restoreHistory(navigation, restoringFromCaughtError = false) {\n if (this.canceledNavigationResolution === 'computed') {\n const currentBrowserPageId = this.browserPageId;\n const targetPagePosition = this.currentPageId - currentBrowserPageId;\n if (targetPagePosition !== 0) {\n this.location.historyGo(targetPagePosition);\n } else if (this.currentUrlTree === navigation.finalUrl && targetPagePosition === 0) {\n // We got to the activation stage (where currentUrlTree is set to the navigation's\n // finalUrl), but we weren't moving anywhere in history (skipLocationChange or replaceUrl).\n // We still need to reset the router state back to what it was when the navigation started.\n this.resetState(navigation);\n this.resetUrlToCurrentUrlTree();\n } else {\n // The browser URL and router state was not updated before the navigation cancelled so\n // there's no restoration needed.\n }\n } else if (this.canceledNavigationResolution === 'replace') {\n // TODO(atscott): It seems like we should _always_ reset the state here. It would be a no-op\n // for `deferred` navigations that haven't change the internal state yet because guards\n // reject. For 'eager' navigations, it seems like we also really should reset the state\n // because the navigation was cancelled. Investigate if this can be done by running TGP.\n if (restoringFromCaughtError) {\n this.resetState(navigation);\n }\n this.resetUrlToCurrentUrlTree();\n }\n }\n resetState(navigation) {\n this.routerState = this.stateMemento.routerState;\n this.currentUrlTree = this.stateMemento.currentUrlTree;\n // Note here that we use the urlHandlingStrategy to get the reset `rawUrlTree` because it may be\n // configured to handle only part of the navigation URL. This means we would only want to reset\n // the part of the navigation handled by the Angular router rather than the whole URL. In\n // addition, the URLHandlingStrategy may be configured to specifically preserve parts of the URL\n // when merging, such as the query params so they are not lost on a refresh.\n this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, navigation.finalUrl ?? this.rawUrlTree);\n }\n resetUrlToCurrentUrlTree() {\n this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));\n }\n generateNgRouterState(navigationId, routerPageId) {\n if (this.canceledNavigationResolution === 'computed') {\n return {\n navigationId,\n ɵrouterPageId: routerPageId\n };\n }\n return {\n navigationId\n };\n }\n static ɵfac = /* @__PURE__ */(() => {\n let ɵHistoryStateManager_BaseFactory;\n return function HistoryStateManager_Factory(__ngFactoryType__) {\n return (ɵHistoryStateManager_BaseFactory || (ɵHistoryStateManager_BaseFactory = i0.ɵɵgetInheritedFactory(HistoryStateManager)))(__ngFactoryType__ || HistoryStateManager);\n };\n })();\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HistoryStateManager,\n factory: HistoryStateManager.ɵfac,\n providedIn: 'root'\n });\n }\n return HistoryStateManager;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar NavigationResult = /*#__PURE__*/function (NavigationResult) {\n NavigationResult[NavigationResult[\"COMPLETE\"] = 0] = \"COMPLETE\";\n NavigationResult[NavigationResult[\"FAILED\"] = 1] = \"FAILED\";\n NavigationResult[NavigationResult[\"REDIRECTING\"] = 2] = \"REDIRECTING\";\n return NavigationResult;\n}(NavigationResult || {});\n/**\n * Performs the given action once the router finishes its next/current navigation.\n *\n * The navigation is considered complete under the following conditions:\n * - `NavigationCancel` event emits and the code is not `NavigationCancellationCode.Redirect` or\n * `NavigationCancellationCode.SupersededByNewNavigation`. In these cases, the\n * redirecting/superseding navigation must finish.\n * - `NavigationError`, `NavigationEnd`, or `NavigationSkipped` event emits\n */\nfunction afterNextNavigation(router, action) {\n router.events.pipe(filter(e => e instanceof NavigationEnd || e instanceof NavigationCancel || e instanceof NavigationError || e instanceof NavigationSkipped), map(e => {\n if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {\n return NavigationResult.COMPLETE;\n }\n const redirecting = e instanceof NavigationCancel ? e.code === NavigationCancellationCode.Redirect || e.code === NavigationCancellationCode.SupersededByNewNavigation : false;\n return redirecting ? NavigationResult.REDIRECTING : NavigationResult.FAILED;\n }), filter(result => result !== NavigationResult.REDIRECTING), take(1)).subscribe(() => {\n action();\n });\n}\n\n/**\n * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`\n * (exact = true).\n */\nconst exactMatchOptions = {\n paths: 'exact',\n fragment: 'ignored',\n matrixParams: 'ignored',\n queryParams: 'exact'\n};\n/**\n * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `false`\n * (exact = false).\n */\nconst subsetMatchOptions = {\n paths: 'subset',\n fragment: 'ignored',\n matrixParams: 'ignored',\n queryParams: 'subset'\n};\n/**\n * @description\n *\n * A service that facilitates navigation among views and URL manipulation capabilities.\n * This service is provided in the root scope and configured with [provideRouter](api/router/provideRouter).\n *\n * @see {@link Route}\n * @see {@link provideRouter}\n * @see [Routing and Navigation Guide](guide/routing/common-router-tasks).\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet Router = /*#__PURE__*/(() => {\n class Router {\n get currentUrlTree() {\n return this.stateManager.getCurrentUrlTree();\n }\n get rawUrlTree() {\n return this.stateManager.getRawUrlTree();\n }\n disposed = false;\n nonRouterCurrentEntryChangeSubscription;\n console = inject(ɵConsole);\n stateManager = inject(StateManager);\n options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n pendingTasks = inject(ɵPendingTasks);\n urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';\n navigationTransitions = inject(NavigationTransitions);\n urlSerializer = inject(UrlSerializer);\n location = inject(Location);\n urlHandlingStrategy = inject(UrlHandlingStrategy);\n /**\n * The private `Subject` type for the public events exposed in the getter. This is used internally\n * to push events to. The separate field allows us to expose separate types in the public API\n * (i.e., an Observable rather than the Subject).\n */\n _events = new Subject();\n /**\n * An event stream for routing events.\n */\n get events() {\n // TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal\n // cleanup: tests are doing `(route.events as Subject).next(...)`. This isn't\n // allowed/supported but we still have to fix these or file bugs against the teams before making\n // the change.\n return this._events;\n }\n /**\n * The current state of routing in this NgModule.\n */\n get routerState() {\n return this.stateManager.getRouterState();\n }\n /**\n * True if at least one navigation event has occurred,\n * false otherwise.\n */\n navigated = false;\n /**\n * A strategy for re-using routes.\n *\n * @deprecated Configure using `providers` instead:\n * `{provide: RouteReuseStrategy, useClass: MyStrategy}`.\n */\n routeReuseStrategy = inject(RouteReuseStrategy);\n /**\n * How to handle a navigation request to the current URL.\n *\n *\n * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.\n * @see {@link withRouterConfig}\n * @see {@link provideRouter}\n * @see {@link RouterModule}\n */\n onSameUrlNavigation = this.options.onSameUrlNavigation || 'ignore';\n config = inject(ROUTES, {\n optional: true\n })?.flat() ?? [];\n /**\n * Indicates whether the application has opted in to binding Router data to component inputs.\n *\n * This option is enabled by the `withComponentInputBinding` feature of `provideRouter` or\n * `bindToComponentInputs` in the `ExtraOptions` of `RouterModule.forRoot`.\n */\n componentInputBindingEnabled = !!inject(INPUT_BINDER, {\n optional: true\n });\n constructor() {\n this.resetConfig(this.config);\n this.navigationTransitions.setupNavigations(this, this.currentUrlTree, this.routerState).subscribe({\n error: e => {\n this.console.warn(ngDevMode ? `Unhandled Navigation Error: ${e}` : e);\n }\n });\n this.subscribeToNavigationEvents();\n }\n eventsSubscription = new Subscription();\n subscribeToNavigationEvents() {\n const subscription = this.navigationTransitions.events.subscribe(e => {\n try {\n const currentTransition = this.navigationTransitions.currentTransition;\n const currentNavigation = this.navigationTransitions.currentNavigation;\n if (currentTransition !== null && currentNavigation !== null) {\n this.stateManager.handleRouterEvent(e, currentNavigation);\n if (e instanceof NavigationCancel && e.code !== NavigationCancellationCode.Redirect && e.code !== NavigationCancellationCode.SupersededByNewNavigation) {\n // It seems weird that `navigated` is set to `true` when the navigation is rejected,\n // however it's how things were written initially. Investigation would need to be done\n // to determine if this can be removed.\n this.navigated = true;\n } else if (e instanceof NavigationEnd) {\n this.navigated = true;\n } else if (e instanceof RedirectRequest) {\n const opts = e.navigationBehaviorOptions;\n const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);\n const extras = {\n browserUrl: currentTransition.extras.browserUrl,\n info: currentTransition.extras.info,\n skipLocationChange: currentTransition.extras.skipLocationChange,\n // The URL is already updated at this point if we have 'eager' URL\n // updates or if the navigation was triggered by the browser (back\n // button, URL bar, etc). We want to replace that item in history\n // if the navigation is rejected.\n replaceUrl: currentTransition.extras.replaceUrl || this.urlUpdateStrategy === 'eager' || isBrowserTriggeredNavigation(currentTransition.source),\n // allow developer to override default options with RedirectCommand\n ...opts\n };\n this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras, {\n resolve: currentTransition.resolve,\n reject: currentTransition.reject,\n promise: currentTransition.promise\n });\n }\n }\n // Note that it's important to have the Router process the events _before_ the event is\n // pushed through the public observable. This ensures the correct router state is in place\n // before applications observe the events.\n if (isPublicRouterEvent(e)) {\n this._events.next(e);\n }\n } catch (e) {\n this.navigationTransitions.transitionAbortSubject.next(e);\n }\n });\n this.eventsSubscription.add(subscription);\n }\n /** @internal */\n resetRootComponentType(rootComponentType) {\n // TODO: vsavkin router 4.0 should make the root component set to null\n // this will simplify the lifecycle of the router.\n this.routerState.root.component = rootComponentType;\n this.navigationTransitions.rootComponentType = rootComponentType;\n }\n /**\n * Sets up the location change listener and performs the initial navigation.\n */\n initialNavigation() {\n this.setUpLocationChangeListener();\n if (!this.navigationTransitions.hasRequestedNavigation) {\n this.navigateToSyncWithBrowser(this.location.path(true), IMPERATIVE_NAVIGATION, this.stateManager.restoredState());\n }\n }\n /**\n * Sets up the location change listener. This listener detects navigations triggered from outside\n * the Router (the browser back/forward buttons, for example) and schedules a corresponding Router\n * navigation so that the correct events, guards, etc. are triggered.\n */\n setUpLocationChangeListener() {\n // Don't need to use Zone.wrap any more, because zone.js\n // already patch onPopState, so location change callback will\n // run into ngZone\n this.nonRouterCurrentEntryChangeSubscription ??= this.stateManager.registerNonRouterCurrentEntryChangeListener((url, state) => {\n // The `setTimeout` was added in #12160 and is likely to support Angular/AngularJS\n // hybrid apps.\n setTimeout(() => {\n this.navigateToSyncWithBrowser(url, 'popstate', state);\n }, 0);\n });\n }\n /**\n * Schedules a router navigation to synchronize Router state with the browser state.\n *\n * This is done as a response to a popstate event and the initial navigation. These\n * two scenarios represent times when the browser URL/state has been updated and\n * the Router needs to respond to ensure its internal state matches.\n */\n navigateToSyncWithBrowser(url, source, state) {\n const extras = {\n replaceUrl: true\n };\n // TODO: restoredState should always include the entire state, regardless\n // of navigationId. This requires a breaking change to update the type on\n // NavigationStart’s restoredState, which currently requires navigationId\n // to always be present. The Router used to only restore history state if\n // a navigationId was present.\n // The stored navigationId is used by the RouterScroller to retrieve the scroll\n // position for the page.\n const restoredState = state?.navigationId ? state : null;\n // Separate to NavigationStart.restoredState, we must also restore the state to\n // history.state and generate a new navigationId, since it will be overwritten\n if (state) {\n const stateCopy = {\n ...state\n };\n delete stateCopy.navigationId;\n delete stateCopy.ɵrouterPageId;\n if (Object.keys(stateCopy).length !== 0) {\n extras.state = stateCopy;\n }\n }\n const urlTree = this.parseUrl(url);\n this.scheduleNavigation(urlTree, source, restoredState, extras);\n }\n /** The current URL. */\n get url() {\n return this.serializeUrl(this.currentUrlTree);\n }\n /**\n * Returns the current `Navigation` object when the router is navigating,\n * and `null` when idle.\n */\n getCurrentNavigation() {\n return this.navigationTransitions.currentNavigation;\n }\n /**\n * The `Navigation` object of the most recent navigation to succeed and `null` if there\n * has not been a successful navigation yet.\n */\n get lastSuccessfulNavigation() {\n return this.navigationTransitions.lastSuccessfulNavigation;\n }\n /**\n * Resets the route configuration used for navigation and generating links.\n *\n * @param config The route array for the new configuration.\n *\n * @usageNotes\n *\n * ```\n * router.resetConfig([\n * { path: 'team/:id', component: TeamCmp, children: [\n * { path: 'simple', component: SimpleCmp },\n * { path: 'user/:name', component: UserCmp }\n * ]}\n * ]);\n * ```\n */\n resetConfig(config) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && validateConfig(config);\n this.config = config.map(standardizeConfig);\n this.navigated = false;\n }\n /** @nodoc */\n ngOnDestroy() {\n this.dispose();\n }\n /** Disposes of the router. */\n dispose() {\n this.navigationTransitions.complete();\n if (this.nonRouterCurrentEntryChangeSubscription) {\n this.nonRouterCurrentEntryChangeSubscription.unsubscribe();\n this.nonRouterCurrentEntryChangeSubscription = undefined;\n }\n this.disposed = true;\n this.eventsSubscription.unsubscribe();\n }\n /**\n * Appends URL segments to the current URL tree to create a new URL tree.\n *\n * @param commands An array of URL fragments with which to construct the new URL tree.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the current URL tree or the one provided in the `relativeTo`\n * property of the options object, if supplied.\n * @param navigationExtras Options that control the navigation strategy.\n * @returns The new URL tree.\n *\n * @usageNotes\n *\n * ```\n * // create /team/33/user/11\n * router.createUrlTree(['/team', 33, 'user', 11]);\n *\n * // create /team/33;expand=true/user/11\n * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);\n *\n * // you can collapse static segments like this (this works only with the first passed-in value):\n * router.createUrlTree(['/team/33/user', userId]);\n *\n * // If the first segment can contain slashes, and you do not want the router to split it,\n * // you can do the following:\n * router.createUrlTree([{segmentPath: '/one/two'}]);\n *\n * // create /team/33/(user/11//right:chat)\n * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);\n *\n * // remove the right secondary node\n * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);\n *\n * // assuming the current url is `/team/33/user/11` and the route points to `user/11`\n *\n * // navigate to /team/33/user/11/details\n * router.createUrlTree(['details'], {relativeTo: route});\n *\n * // navigate to /team/33/user/22\n * router.createUrlTree(['../22'], {relativeTo: route});\n *\n * // navigate to /team/44/user/22\n * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});\n *\n * Note that a value of `null` or `undefined` for `relativeTo` indicates that the\n * tree should be created relative to the root.\n * ```\n */\n createUrlTree(commands, navigationExtras = {}) {\n const {\n relativeTo,\n queryParams,\n fragment,\n queryParamsHandling,\n preserveFragment\n } = navigationExtras;\n const f = preserveFragment ? this.currentUrlTree.fragment : fragment;\n let q = null;\n switch (queryParamsHandling ?? this.options.defaultQueryParamsHandling) {\n case 'merge':\n q = {\n ...this.currentUrlTree.queryParams,\n ...queryParams\n };\n break;\n case 'preserve':\n q = this.currentUrlTree.queryParams;\n break;\n default:\n q = queryParams || null;\n }\n if (q !== null) {\n q = this.removeEmptyProps(q);\n }\n let relativeToUrlSegmentGroup;\n try {\n const relativeToSnapshot = relativeTo ? relativeTo.snapshot : this.routerState.snapshot.root;\n relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeToSnapshot);\n } catch (e) {\n // This is strictly for backwards compatibility with tests that create\n // invalid `ActivatedRoute` mocks.\n // Note: the difference between having this fallback for invalid `ActivatedRoute` setups and\n // just throwing is ~500 test failures. Fixing all of those tests by hand is not feasible at\n // the moment.\n if (typeof commands[0] !== 'string' || commands[0][0] !== '/') {\n // Navigations that were absolute in the old way of creating UrlTrees\n // would still work because they wouldn't attempt to match the\n // segments in the `ActivatedRoute` to the `currentUrlTree` but\n // instead just replace the root segment with the navigation result.\n // Non-absolute navigations would fail to apply the commands because\n // the logic could not find the segment to replace (so they'd act like there were no\n // commands).\n commands = [];\n }\n relativeToUrlSegmentGroup = this.currentUrlTree.root;\n }\n return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, q, f ?? null);\n }\n /**\n * Navigates to a view using an absolute route path.\n *\n * @param url An absolute path for a defined route. The function does not apply any delta to the\n * current URL.\n * @param extras An object containing properties that modify the navigation strategy.\n *\n * @returns A Promise that resolves to 'true' when navigation succeeds,\n * to 'false' when navigation fails, or is rejected on error.\n *\n * @usageNotes\n *\n * The following calls request navigation to an absolute path.\n *\n * ```\n * router.navigateByUrl(\"/team/33/user/11\");\n *\n * // Navigate without updating the URL\n * router.navigateByUrl(\"/team/33/user/11\", { skipLocationChange: true });\n * ```\n *\n * @see [Routing and Navigation guide](guide/routing/common-router-tasks)\n *\n */\n navigateByUrl(url, extras = {\n skipLocationChange: false\n }) {\n const urlTree = isUrlTree(url) ? url : this.parseUrl(url);\n const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);\n return this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras);\n }\n /**\n * Navigate based on the provided array of commands and a starting point.\n * If no starting route is provided, the navigation is absolute.\n *\n * @param commands An array of URL fragments with which to construct the target URL.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the current URL or the one provided in the `relativeTo` property\n * of the options object, if supplied.\n * @param extras An options object that determines how the URL should be constructed or\n * interpreted.\n *\n * @returns A Promise that resolves to `true` when navigation succeeds, or `false` when navigation\n * fails. The Promise is rejected when an error occurs if `resolveNavigationPromiseOnError` is\n * not `true`.\n *\n * @usageNotes\n *\n * The following calls request navigation to a dynamic route path relative to the current URL.\n *\n * ```\n * router.navigate(['team', 33, 'user', 11], {relativeTo: route});\n *\n * // Navigate without updating the URL, overriding the default behavior\n * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});\n * ```\n *\n * @see [Routing and Navigation guide](guide/routing/common-router-tasks)\n *\n */\n navigate(commands, extras = {\n skipLocationChange: false\n }) {\n validateCommands(commands);\n return this.navigateByUrl(this.createUrlTree(commands, extras), extras);\n }\n /** Serializes a `UrlTree` into a string */\n serializeUrl(url) {\n return this.urlSerializer.serialize(url);\n }\n /** Parses a string into a `UrlTree` */\n parseUrl(url) {\n try {\n return this.urlSerializer.parse(url);\n } catch {\n return this.urlSerializer.parse('/');\n }\n }\n isActive(url, matchOptions) {\n let options;\n if (matchOptions === true) {\n options = {\n ...exactMatchOptions\n };\n } else if (matchOptions === false) {\n options = {\n ...subsetMatchOptions\n };\n } else {\n options = matchOptions;\n }\n if (isUrlTree(url)) {\n return containsTree(this.currentUrlTree, url, options);\n }\n const urlTree = this.parseUrl(url);\n return containsTree(this.currentUrlTree, urlTree, options);\n }\n removeEmptyProps(params) {\n return Object.entries(params).reduce((result, [key, value]) => {\n if (value !== null && value !== undefined) {\n result[key] = value;\n }\n return result;\n }, {});\n }\n scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {\n if (this.disposed) {\n return Promise.resolve(false);\n }\n let resolve;\n let reject;\n let promise;\n if (priorPromise) {\n resolve = priorPromise.resolve;\n reject = priorPromise.reject;\n promise = priorPromise.promise;\n } else {\n promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n }\n // Indicate that the navigation is happening.\n const taskId = this.pendingTasks.add();\n afterNextNavigation(this, () => {\n // Remove pending task in a microtask to allow for cancelled\n // initial navigations and redirects within the same task.\n queueMicrotask(() => this.pendingTasks.remove(taskId));\n });\n this.navigationTransitions.handleNavigationRequest({\n source,\n restoredState,\n currentUrlTree: this.currentUrlTree,\n currentRawUrl: this.currentUrlTree,\n rawUrl,\n extras,\n resolve: resolve,\n reject: reject,\n promise,\n currentSnapshot: this.routerState.snapshot,\n currentRouterState: this.routerState\n });\n // Make sure that the error is propagated even though `processNavigations` catch\n // handler does not rethrow\n return promise.catch(e => {\n return Promise.reject(e);\n });\n }\n static ɵfac = function Router_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || Router)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Router,\n factory: Router.ɵfac,\n providedIn: 'root'\n });\n }\n return Router;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction validateCommands(commands) {\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i];\n if (cmd == null) {\n throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) && `The requested path contains ${cmd} segment at index ${i}`);\n }\n }\n}\nfunction isPublicRouterEvent(e) {\n return !(e instanceof BeforeActivateRoutes) && !(e instanceof RedirectRequest);\n}\n\n/**\n * @description\n *\n * When applied to an element in a template, makes that element a link\n * that initiates navigation to a route. Navigation opens one or more routed components\n * in one or more `` locations on the page.\n *\n * Given a route configuration `[{ path: 'user/:name', component: UserCmp }]`,\n * the following creates a static link to the route:\n * `link to user component`\n *\n * You can use dynamic values to generate the link.\n * For a dynamic link, pass an array of path segments,\n * followed by the params for each segment.\n * For example, `['/team', teamId, 'user', userName, {details: true}]`\n * generates a link to `/team/11/user/bob;details=true`.\n *\n * Multiple static segments can be merged into one term and combined with dynamic segments.\n * For example, `['/team/11/user', userName, {details: true}]`\n *\n * The input that you provide to the link is treated as a delta to the current URL.\n * For instance, suppose the current URL is `/user/(box//aux:team)`.\n * The link `Jim` creates the URL\n * `/user/(jim//aux:team)`.\n * See {@link Router#createUrlTree} for more information.\n *\n * @usageNotes\n *\n * You can use absolute or relative paths in a link, set query parameters,\n * control how parameters are handled, and keep a history of navigation states.\n *\n * ### Relative link paths\n *\n * The first segment name can be prepended with `/`, `./`, or `../`.\n * * If the first segment begins with `/`, the router looks up the route from the root of the\n * app.\n * * If the first segment begins with `./`, or doesn't begin with a slash, the router\n * looks in the children of the current activated route.\n * * If the first segment begins with `../`, the router goes up one level in the route tree.\n *\n * ### Setting and handling query params and fragments\n *\n * The following link adds a query parameter and a fragment to the generated URL:\n *\n * ```html\n * \n * link to user component\n * \n * ```\n * By default, the directive constructs the new URL using the given query parameters.\n * The example generates the link: `/user/bob?debug=true#education`.\n *\n * You can instruct the directive to handle query parameters differently\n * by specifying the `queryParamsHandling` option in the link.\n * Allowed values are:\n *\n * - `'merge'`: Merge the given `queryParams` into the current query params.\n * - `'preserve'`: Preserve the current query params.\n *\n * For example:\n *\n * ```html\n * \n * link to user component\n * \n * ```\n *\n * `queryParams`, `fragment`, `queryParamsHandling`, `preserveFragment`, and `relativeTo`\n * cannot be used when the `routerLink` input is a `UrlTree`.\n *\n * See {@link UrlCreationOptions#queryParamsHandling}.\n *\n * ### Preserving navigation history\n *\n * You can provide a `state` value to be persisted to the browser's\n * [`History.state` property](https://developer.mozilla.org/en-US/docs/Web/API/History#Properties).\n * For example:\n *\n * ```html\n * \n * link to user component\n * \n * ```\n *\n * Use {@link Router#getCurrentNavigation} to retrieve a saved\n * navigation-state value. For example, to capture the `tracingId` during the `NavigationStart`\n * event:\n *\n * ```ts\n * // Get NavigationStart events\n * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => {\n * const navigation = router.getCurrentNavigation();\n * tracingService.trace({id: navigation.extras.state.tracingId});\n * });\n * ```\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterLink = /*#__PURE__*/(() => {\n class RouterLink {\n router;\n route;\n tabIndexAttribute;\n renderer;\n el;\n locationStrategy;\n /**\n * Represents an `href` attribute value applied to a host element,\n * when a host element is ``. For other tags, the value is `null`.\n */\n href = null;\n /**\n * Represents the `target` attribute on a host element.\n * This is only used when the host element is an `` tag.\n */\n target;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#queryParams}\n * @see {@link Router#createUrlTree}\n */\n queryParams;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#fragment}\n * @see {@link Router#createUrlTree}\n */\n fragment;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#queryParamsHandling}\n * @see {@link Router#createUrlTree}\n */\n queryParamsHandling;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#state}\n * @see {@link Router#navigateByUrl}\n */\n state;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#info}\n * @see {@link Router#navigateByUrl}\n */\n info;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * Specify a value here when you do not want to use the default value\n * for `routerLink`, which is the current activated route.\n * Note that a value of `undefined` here will use the `routerLink` default.\n * @see {@link UrlCreationOptions#relativeTo}\n * @see {@link Router#createUrlTree}\n */\n relativeTo;\n /** Whether a host element is an `` tag. */\n isAnchorElement;\n subscription;\n /** @internal */\n onChanges = new Subject();\n constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) {\n this.router = router;\n this.route = route;\n this.tabIndexAttribute = tabIndexAttribute;\n this.renderer = renderer;\n this.el = el;\n this.locationStrategy = locationStrategy;\n const tagName = el.nativeElement.tagName?.toLowerCase();\n this.isAnchorElement = tagName === 'a' || tagName === 'area';\n if (this.isAnchorElement) {\n this.subscription = router.events.subscribe(s => {\n if (s instanceof NavigationEnd) {\n this.updateHref();\n }\n });\n } else {\n this.setTabIndexIfNotOnNativeEl('0');\n }\n }\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#preserveFragment}\n * @see {@link Router#createUrlTree}\n */\n preserveFragment = false;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#skipLocationChange}\n * @see {@link Router#navigateByUrl}\n */\n skipLocationChange = false;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#replaceUrl}\n * @see {@link Router#navigateByUrl}\n */\n replaceUrl = false;\n /**\n * Modifies the tab index if there was not a tabindex attribute on the element during\n * instantiation.\n */\n setTabIndexIfNotOnNativeEl(newTabIndex) {\n if (this.tabIndexAttribute != null /* both `null` and `undefined` */ || this.isAnchorElement) {\n return;\n }\n this.applyAttributeValue('tabindex', newTabIndex);\n }\n /** @nodoc */\n // TODO(atscott): Remove changes parameter in major version as a breaking change.\n ngOnChanges(changes) {\n if (ngDevMode && isUrlTree(this.routerLinkInput) && (this.fragment !== undefined || this.queryParams || this.queryParamsHandling || this.preserveFragment || this.relativeTo)) {\n throw new ɵRuntimeError(4016 /* RuntimeErrorCode.INVALID_ROUTER_LINK_INPUTS */, 'Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.');\n }\n if (this.isAnchorElement) {\n this.updateHref();\n }\n // This is subscribed to by `RouterLinkActive` so that it knows to update when there are changes\n // to the RouterLinks it's tracking.\n this.onChanges.next(this);\n }\n routerLinkInput = null;\n /**\n * Commands to pass to {@link Router#createUrlTree} or a `UrlTree`.\n * - **array**: commands to pass to {@link Router#createUrlTree}.\n * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`\n * - **UrlTree**: a `UrlTree` for this link rather than creating one from the commands\n * and other inputs that correspond to properties of `UrlCreationOptions`.\n * - **null|undefined**: effectively disables the `routerLink`\n * @see {@link Router#createUrlTree}\n */\n set routerLink(commandsOrUrlTree) {\n if (commandsOrUrlTree == null) {\n this.routerLinkInput = null;\n this.setTabIndexIfNotOnNativeEl(null);\n } else {\n if (isUrlTree(commandsOrUrlTree)) {\n this.routerLinkInput = commandsOrUrlTree;\n } else {\n this.routerLinkInput = Array.isArray(commandsOrUrlTree) ? commandsOrUrlTree : [commandsOrUrlTree];\n }\n this.setTabIndexIfNotOnNativeEl('0');\n }\n }\n /** @nodoc */\n onClick(button, ctrlKey, shiftKey, altKey, metaKey) {\n const urlTree = this.urlTree;\n if (urlTree === null) {\n return true;\n }\n if (this.isAnchorElement) {\n if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {\n return true;\n }\n if (typeof this.target === 'string' && this.target != '_self') {\n return true;\n }\n }\n const extras = {\n skipLocationChange: this.skipLocationChange,\n replaceUrl: this.replaceUrl,\n state: this.state,\n info: this.info\n };\n this.router.navigateByUrl(urlTree, extras);\n // Return `false` for `` elements to prevent default action\n // and cancel the native behavior, since the navigation is handled\n // by the Router.\n return !this.isAnchorElement;\n }\n /** @nodoc */\n ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n updateHref() {\n const urlTree = this.urlTree;\n this.href = urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) : null;\n const sanitizedValue = this.href === null ? null :\n // This class represents a directive that can be added to both `` elements,\n // as well as other elements. As a result, we can't define security context at\n // compile time. So the security context is deferred to runtime.\n // The `ɵɵsanitizeUrlOrResourceUrl` selects the necessary sanitizer function\n // based on the tag and property names. The logic mimics the one from\n // `packages/compiler/src/schema/dom_security_schema.ts`, which is used at compile time.\n //\n // Note: we should investigate whether we can switch to using `@HostBinding('attr.href')`\n // instead of applying a value via a renderer, after a final merge of the\n // `RouterLinkWithHref` directive.\n ɵɵsanitizeUrlOrResourceUrl(this.href, this.el.nativeElement.tagName.toLowerCase(), 'href');\n this.applyAttributeValue('href', sanitizedValue);\n }\n applyAttributeValue(attrName, attrValue) {\n const renderer = this.renderer;\n const nativeElement = this.el.nativeElement;\n if (attrValue !== null) {\n renderer.setAttribute(nativeElement, attrName, attrValue);\n } else {\n renderer.removeAttribute(nativeElement, attrName);\n }\n }\n get urlTree() {\n if (this.routerLinkInput === null) {\n return null;\n } else if (isUrlTree(this.routerLinkInput)) {\n return this.routerLinkInput;\n }\n return this.router.createUrlTree(this.routerLinkInput, {\n // If the `relativeTo` input is not defined, we want to use `this.route` by default.\n // Otherwise, we should use the value provided by the user in the input.\n relativeTo: this.relativeTo !== undefined ? this.relativeTo : this.route,\n queryParams: this.queryParams,\n fragment: this.fragment,\n queryParamsHandling: this.queryParamsHandling,\n preserveFragment: this.preserveFragment\n });\n }\n static ɵfac = function RouterLink_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterLink)(i0.ɵɵdirectiveInject(Router), i0.ɵɵdirectiveInject(ActivatedRoute), i0.ɵɵinjectAttribute('tabindex'), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i3.LocationStrategy));\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterLink,\n selectors: [[\"\", \"routerLink\", \"\"]],\n hostVars: 1,\n hostBindings: function RouterLink_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function RouterLink_click_HostBindingHandler($event) {\n return ctx.onClick($event.button, $event.ctrlKey, $event.shiftKey, $event.altKey, $event.metaKey);\n });\n }\n if (rf & 2) {\n i0.ɵɵattribute(\"target\", ctx.target);\n }\n },\n inputs: {\n target: \"target\",\n queryParams: \"queryParams\",\n fragment: \"fragment\",\n queryParamsHandling: \"queryParamsHandling\",\n state: \"state\",\n info: \"info\",\n relativeTo: \"relativeTo\",\n preserveFragment: [2, \"preserveFragment\", \"preserveFragment\", booleanAttribute],\n skipLocationChange: [2, \"skipLocationChange\", \"skipLocationChange\", booleanAttribute],\n replaceUrl: [2, \"replaceUrl\", \"replaceUrl\", booleanAttribute],\n routerLink: \"routerLink\"\n },\n features: [i0.ɵɵInputTransformsFeature, i0.ɵɵNgOnChangesFeature]\n });\n }\n return RouterLink;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n *\n * @description\n *\n * Tracks whether the linked route of an element is currently active, and allows you\n * to specify one or more CSS classes to add to the element when the linked route\n * is active.\n *\n * Use this directive to create a visual distinction for elements associated with an active route.\n * For example, the following code highlights the word \"Bob\" when the router\n * activates the associated route:\n *\n * ```html\n * Bob\n * ```\n *\n * Whenever the URL is either '/user' or '/user/bob', the \"active-link\" class is\n * added to the anchor tag. If the URL changes, the class is removed.\n *\n * You can set more than one class using a space-separated string or an array.\n * For example:\n *\n * ```html\n * Bob\n * Bob\n * ```\n *\n * To add the classes only when the URL matches the link exactly, add the option `exact: true`:\n *\n * ```html\n * Bob\n * ```\n *\n * To directly check the `isActive` status of the link, assign the `RouterLinkActive`\n * instance to a template variable.\n * For example, the following checks the status without assigning any CSS classes:\n *\n * ```html\n * \n * Bob {{ rla.isActive ? '(already open)' : ''}}\n * \n * ```\n *\n * You can apply the `RouterLinkActive` directive to an ancestor of linked elements.\n * For example, the following sets the active-link class on the `
          ` parent tag\n * when the URL is either '/user/jim' or '/user/bob'.\n *\n * ```html\n *
          \n * Jim\n * Bob\n *
          \n * ```\n *\n * The `RouterLinkActive` directive can also be used to set the aria-current attribute\n * to provide an alternative distinction for active elements to visually impaired users.\n *\n * For example, the following code adds the 'active' class to the Home Page link when it is\n * indeed active and in such case also sets its aria-current attribute to 'page':\n *\n * ```html\n * Home Page\n * ```\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterLinkActive = /*#__PURE__*/(() => {\n class RouterLinkActive {\n router;\n element;\n renderer;\n cdr;\n link;\n links;\n classes = [];\n routerEventsSubscription;\n linkInputChangesSubscription;\n _isActive = false;\n get isActive() {\n return this._isActive;\n }\n /**\n * Options to configure how to determine if the router link is active.\n *\n * These options are passed to the `Router.isActive()` function.\n *\n * @see {@link Router#isActive}\n */\n routerLinkActiveOptions = {\n exact: false\n };\n /**\n * Aria-current attribute to apply when the router link is active.\n *\n * Possible values: `'page'` | `'step'` | `'location'` | `'date'` | `'time'` | `true` | `false`.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current}\n */\n ariaCurrentWhenActive;\n /**\n *\n * You can use the output `isActiveChange` to get notified each time the link becomes\n * active or inactive.\n *\n * Emits:\n * true -> Route is active\n * false -> Route is inactive\n *\n * ```\n * Bob\n * ```\n */\n isActiveChange = new EventEmitter();\n constructor(router, element, renderer, cdr, link) {\n this.router = router;\n this.element = element;\n this.renderer = renderer;\n this.cdr = cdr;\n this.link = link;\n this.routerEventsSubscription = router.events.subscribe(s => {\n if (s instanceof NavigationEnd) {\n this.update();\n }\n });\n }\n /** @nodoc */\n ngAfterContentInit() {\n // `of(null)` is used to force subscribe body to execute once immediately (like `startWith`).\n of(this.links.changes, of(null)).pipe(mergeAll()).subscribe(_ => {\n this.update();\n this.subscribeToEachLinkOnChanges();\n });\n }\n subscribeToEachLinkOnChanges() {\n this.linkInputChangesSubscription?.unsubscribe();\n const allLinkChanges = [...this.links.toArray(), this.link].filter(link => !!link).map(link => link.onChanges);\n this.linkInputChangesSubscription = from(allLinkChanges).pipe(mergeAll()).subscribe(link => {\n if (this._isActive !== this.isLinkActive(this.router)(link)) {\n this.update();\n }\n });\n }\n set routerLinkActive(data) {\n const classes = Array.isArray(data) ? data : data.split(' ');\n this.classes = classes.filter(c => !!c);\n }\n /** @nodoc */\n ngOnChanges(changes) {\n this.update();\n }\n /** @nodoc */\n ngOnDestroy() {\n this.routerEventsSubscription.unsubscribe();\n this.linkInputChangesSubscription?.unsubscribe();\n }\n update() {\n if (!this.links || !this.router.navigated) return;\n queueMicrotask(() => {\n const hasActiveLinks = this.hasActiveLinks();\n this.classes.forEach(c => {\n if (hasActiveLinks) {\n this.renderer.addClass(this.element.nativeElement, c);\n } else {\n this.renderer.removeClass(this.element.nativeElement, c);\n }\n });\n if (hasActiveLinks && this.ariaCurrentWhenActive !== undefined) {\n this.renderer.setAttribute(this.element.nativeElement, 'aria-current', this.ariaCurrentWhenActive.toString());\n } else {\n this.renderer.removeAttribute(this.element.nativeElement, 'aria-current');\n }\n // Only emit change if the active state changed.\n if (this._isActive !== hasActiveLinks) {\n this._isActive = hasActiveLinks;\n this.cdr.markForCheck();\n // Emit on isActiveChange after classes are updated\n this.isActiveChange.emit(hasActiveLinks);\n }\n });\n }\n isLinkActive(router) {\n const options = isActiveMatchOptions(this.routerLinkActiveOptions) ? this.routerLinkActiveOptions :\n // While the types should disallow `undefined` here, it's possible without strict inputs\n this.routerLinkActiveOptions.exact || false;\n return link => {\n const urlTree = link.urlTree;\n return urlTree ? router.isActive(urlTree, options) : false;\n };\n }\n hasActiveLinks() {\n const isActiveCheckFn = this.isLinkActive(this.router);\n return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);\n }\n static ɵfac = function RouterLinkActive_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterLinkActive)(i0.ɵɵdirectiveInject(Router), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(RouterLink, 8));\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterLinkActive,\n selectors: [[\"\", \"routerLinkActive\", \"\"]],\n contentQueries: function RouterLinkActive_ContentQueries(rf, ctx, dirIndex) {\n if (rf & 1) {\n i0.ɵɵcontentQuery(dirIndex, RouterLink, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.links = _t);\n }\n },\n inputs: {\n routerLinkActiveOptions: \"routerLinkActiveOptions\",\n ariaCurrentWhenActive: \"ariaCurrentWhenActive\",\n routerLinkActive: \"routerLinkActive\"\n },\n outputs: {\n isActiveChange: \"isActiveChange\"\n },\n exportAs: [\"routerLinkActive\"],\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n return RouterLinkActive;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Use instead of `'paths' in options` to be compatible with property renaming\n */\nfunction isActiveMatchOptions(options) {\n return !!options.paths;\n}\n\n/**\n * @description\n *\n * Provides a preloading strategy.\n *\n * @publicApi\n */\nclass PreloadingStrategy {}\n/**\n * @description\n *\n * Provides a preloading strategy that preloads all modules as quickly as possible.\n *\n * ```ts\n * RouterModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules})\n * ```\n *\n * @publicApi\n */\nlet PreloadAllModules = /*#__PURE__*/(() => {\n class PreloadAllModules {\n preload(route, fn) {\n return fn().pipe(catchError(() => of(null)));\n }\n static ɵfac = function PreloadAllModules_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || PreloadAllModules)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PreloadAllModules,\n factory: PreloadAllModules.ɵfac,\n providedIn: 'root'\n });\n }\n return PreloadAllModules;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * Provides a preloading strategy that does not preload any modules.\n *\n * This strategy is enabled by default.\n *\n * @publicApi\n */\nlet NoPreloading = /*#__PURE__*/(() => {\n class NoPreloading {\n preload(route, fn) {\n return of(null);\n }\n static ɵfac = function NoPreloading_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NoPreloading)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NoPreloading,\n factory: NoPreloading.ɵfac,\n providedIn: 'root'\n });\n }\n return NoPreloading;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * The preloader optimistically loads all router configurations to\n * make navigations into lazily-loaded sections of the application faster.\n *\n * The preloader runs in the background. When the router bootstraps, the preloader\n * starts listening to all navigation events. After every such event, the preloader\n * will check if any configurations can be loaded lazily.\n *\n * If a route is protected by `canLoad` guards, the preloaded will not load it.\n *\n * @publicApi\n */\nlet RouterPreloader = /*#__PURE__*/(() => {\n class RouterPreloader {\n router;\n injector;\n preloadingStrategy;\n loader;\n subscription;\n constructor(router, compiler, injector, preloadingStrategy, loader) {\n this.router = router;\n this.injector = injector;\n this.preloadingStrategy = preloadingStrategy;\n this.loader = loader;\n }\n setUpPreloading() {\n this.subscription = this.router.events.pipe(filter(e => e instanceof NavigationEnd), concatMap(() => this.preload())).subscribe(() => {});\n }\n preload() {\n return this.processRoutes(this.injector, this.router.config);\n }\n /** @nodoc */\n ngOnDestroy() {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n processRoutes(injector, routes) {\n const res = [];\n for (const route of routes) {\n if (route.providers && !route._injector) {\n route._injector = createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);\n }\n const injectorForCurrentRoute = route._injector ?? injector;\n const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;\n // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not\n // `loadComponent`. `canLoad` guards only block loading of child routes by design. This\n // happens as a consequence of needing to descend into children for route matching immediately\n // while component loading is deferred until route activation. Because `canLoad` guards can\n // have side effects, we cannot execute them here so we instead skip preloading altogether\n // when present. Lastly, it remains to be decided whether `canLoad` should behave this way\n // at all. Code splitting and lazy loading is separate from client-side authorization checks\n // and should not be used as a security measure to prevent loading of code.\n if (route.loadChildren && !route._loadedRoutes && route.canLoad === undefined || route.loadComponent && !route._loadedComponent) {\n res.push(this.preloadConfig(injectorForCurrentRoute, route));\n }\n if (route.children || route._loadedRoutes) {\n res.push(this.processRoutes(injectorForChildren, route.children ?? route._loadedRoutes));\n }\n }\n return from(res).pipe(mergeAll());\n }\n preloadConfig(injector, route) {\n return this.preloadingStrategy.preload(route, () => {\n let loadedChildren$;\n if (route.loadChildren && route.canLoad === undefined) {\n loadedChildren$ = this.loader.loadChildren(injector, route);\n } else {\n loadedChildren$ = of(null);\n }\n const recursiveLoadChildren$ = loadedChildren$.pipe(mergeMap(config => {\n if (config === null) {\n return of(void 0);\n }\n route._loadedRoutes = config.routes;\n route._loadedInjector = config.injector;\n // If the loaded config was a module, use that as the module/module injector going\n // forward. Otherwise, continue using the current module/module injector.\n return this.processRoutes(config.injector ?? injector, config.routes);\n }));\n if (route.loadComponent && !route._loadedComponent) {\n const loadComponent$ = this.loader.loadComponent(route);\n return from([recursiveLoadChildren$, loadComponent$]).pipe(mergeAll());\n } else {\n return recursiveLoadChildren$;\n }\n });\n }\n static ɵfac = function RouterPreloader_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterPreloader)(i0.ɵɵinject(Router), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(i0.EnvironmentInjector), i0.ɵɵinject(PreloadingStrategy), i0.ɵɵinject(RouterConfigLoader));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterPreloader,\n factory: RouterPreloader.ɵfac,\n providedIn: 'root'\n });\n }\n return RouterPreloader;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst ROUTER_SCROLLER = /*#__PURE__*/new InjectionToken('');\nlet RouterScroller = /*#__PURE__*/(() => {\n class RouterScroller {\n urlSerializer;\n transitions;\n viewportScroller;\n zone;\n options;\n routerEventsSubscription;\n scrollEventsSubscription;\n lastId = 0;\n lastSource = 'imperative';\n restoredId = 0;\n store = {};\n /** @nodoc */\n constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {\n this.urlSerializer = urlSerializer;\n this.transitions = transitions;\n this.viewportScroller = viewportScroller;\n this.zone = zone;\n this.options = options;\n // Default both options to 'disabled'\n options.scrollPositionRestoration ||= 'disabled';\n options.anchorScrolling ||= 'disabled';\n }\n init() {\n // we want to disable the automatic scrolling because having two places\n // responsible for scrolling results race conditions, especially given\n // that browser don't implement this behavior consistently\n if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.setHistoryScrollRestoration('manual');\n }\n this.routerEventsSubscription = this.createScrollEvents();\n this.scrollEventsSubscription = this.consumeScrollEvents();\n }\n createScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (e instanceof NavigationStart) {\n // store the scroll position of the current stable navigations.\n this.store[this.lastId] = this.viewportScroller.getScrollPosition();\n this.lastSource = e.navigationTrigger;\n this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;\n } else if (e instanceof NavigationEnd) {\n this.lastId = e.id;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);\n } else if (e instanceof NavigationSkipped && e.code === NavigationSkippedCode.IgnoredSameUrlNavigation) {\n this.lastSource = undefined;\n this.restoredId = 0;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.url).fragment);\n }\n });\n }\n consumeScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (!(e instanceof Scroll)) return;\n // a popstate event. The pop state event will always ignore anchor scrolling.\n if (e.position) {\n if (this.options.scrollPositionRestoration === 'top') {\n this.viewportScroller.scrollToPosition([0, 0]);\n } else if (this.options.scrollPositionRestoration === 'enabled') {\n this.viewportScroller.scrollToPosition(e.position);\n }\n // imperative navigation \"forward\"\n } else {\n if (e.anchor && this.options.anchorScrolling === 'enabled') {\n this.viewportScroller.scrollToAnchor(e.anchor);\n } else if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.scrollToPosition([0, 0]);\n }\n }\n });\n }\n scheduleScrollEvent(routerEvent, anchor) {\n this.zone.runOutsideAngular(() => {\n // The scroll event needs to be delayed until after change detection. Otherwise, we may\n // attempt to restore the scroll position before the router outlet has fully rendered the\n // component by executing its update block of the template function.\n setTimeout(() => {\n this.zone.run(() => {\n this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));\n });\n }, 0);\n });\n }\n /** @nodoc */\n ngOnDestroy() {\n this.routerEventsSubscription?.unsubscribe();\n this.scrollEventsSubscription?.unsubscribe();\n }\n static ɵfac = function RouterScroller_Factory(__ngFactoryType__) {\n i0.ɵɵinvalidFactory();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterScroller,\n factory: RouterScroller.ɵfac\n });\n }\n return RouterScroller;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Sets up providers necessary to enable `Router` functionality for the application.\n * Allows to configure a set of routes as well as extra features that should be enabled.\n *\n * @usageNotes\n *\n * Basic example of how you can add a Router to your application:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent, {\n * providers: [provideRouter(appRoutes)]\n * });\n * ```\n *\n * You can also enable optional features in the Router by adding functions from the `RouterFeatures`\n * type:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes,\n * withDebugTracing(),\n * withRouterConfig({paramsInheritanceStrategy: 'always'}))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link RouterFeatures}\n *\n * @publicApi\n * @param routes A set of `Route`s to use for the application routing table.\n * @param features Optional features to configure additional router behaviors.\n * @returns A set of providers to setup a Router.\n */\nfunction provideRouter(routes, ...features) {\n return makeEnvironmentProviders([{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, typeof ngDevMode === 'undefined' || ngDevMode ? {\n provide: ROUTER_IS_PROVIDED,\n useValue: true\n } : [], {\n provide: ActivatedRoute,\n useFactory: rootRoute,\n deps: [Router]\n }, {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: getBootstrapListener\n }, features.map(feature => feature.ɵproviders)]);\n}\nfunction rootRoute(router) {\n return router.routerState.root;\n}\n/**\n * Helper function to create an object that represents a Router feature.\n */\nfunction routerFeature(kind, providers) {\n return {\n ɵkind: kind,\n ɵproviders: providers\n };\n}\n/**\n * An Injection token used to indicate whether `provideRouter` or `RouterModule.forRoot` was ever\n * called.\n */\nconst ROUTER_IS_PROVIDED = /*#__PURE__*/new InjectionToken('', {\n providedIn: 'root',\n factory: () => false\n});\nconst routerIsProvidedDevModeCheck = {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory() {\n return () => {\n if (!inject(ROUTER_IS_PROVIDED)) {\n console.warn('`provideRoutes` was called without `provideRouter` or `RouterModule.forRoot`. ' + 'This is likely a mistake.');\n }\n };\n }\n};\n/**\n * Registers a DI provider for a set of routes.\n * @param routes The route configuration to provide.\n *\n * @usageNotes\n *\n * ```ts\n * @NgModule({\n * providers: [provideRoutes(ROUTES)]\n * })\n * class LazyLoadedChildModule {}\n * ```\n *\n * @deprecated If necessary, provide routes using the `ROUTES` `InjectionToken`.\n * @see {@link ROUTES}\n * @publicApi\n */\nfunction provideRoutes(routes) {\n return [{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, typeof ngDevMode === 'undefined' || ngDevMode ? routerIsProvidedDevModeCheck : []];\n}\n/**\n * Enables customizable scrolling behavior for router navigations.\n *\n * @usageNotes\n *\n * Basic example of how you can enable scrolling feature:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withInMemoryScrolling())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n * @see {@link ViewportScroller}\n *\n * @publicApi\n * @param options Set of configuration parameters to customize scrolling behavior, see\n * `InMemoryScrollingOptions` for additional information.\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withInMemoryScrolling(options = {}) {\n const providers = [{\n provide: ROUTER_SCROLLER,\n useFactory: () => {\n const viewportScroller = inject(ViewportScroller);\n const zone = inject(NgZone);\n const transitions = inject(NavigationTransitions);\n const urlSerializer = inject(UrlSerializer);\n return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);\n }\n }];\n return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);\n}\nfunction getBootstrapListener() {\n const injector = inject(Injector);\n return bootstrappedComponentRef => {\n const ref = injector.get(ApplicationRef);\n if (bootstrappedComponentRef !== ref.components[0]) {\n return;\n }\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {\n router.initialNavigation();\n }\n injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();\n injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();\n router.resetRootComponentType(ref.componentTypes[0]);\n if (!bootstrapDone.closed) {\n bootstrapDone.next();\n bootstrapDone.complete();\n bootstrapDone.unsubscribe();\n }\n };\n}\n/**\n * A subject used to indicate that the bootstrapping phase is done. When initial navigation is\n * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing\n * to the activation phase.\n */\nconst BOOTSTRAP_DONE = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'bootstrap done indicator' : '', {\n factory: () => {\n return new Subject();\n }\n});\nconst INITIAL_NAVIGATION = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'initial navigation' : '', {\n providedIn: 'root',\n factory: () => 1 /* InitialNavigation.EnabledNonBlocking */\n});\n/**\n * Configures initial navigation to start before the root component is created.\n *\n * The bootstrap is blocked until the initial navigation is complete. This should be set in case\n * you use [server-side rendering](guide/ssr), but do not enable [hydration](guide/hydration) for\n * your application.\n *\n * @usageNotes\n *\n * Basic example of how you can enable this navigation behavior:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withEnabledBlockingInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @publicApi\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withEnabledBlockingInitialNavigation() {\n const providers = [{\n provide: INITIAL_NAVIGATION,\n useValue: 0 /* InitialNavigation.EnabledBlocking */\n }, {\n provide: APP_INITIALIZER,\n multi: true,\n deps: [Injector],\n useFactory: injector => {\n const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());\n return () => {\n return locationInitialized.then(() => {\n return new Promise(resolve => {\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n afterNextNavigation(router, () => {\n // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored\n // without a redirect.\n resolve(true);\n });\n injector.get(NavigationTransitions).afterPreactivation = () => {\n // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we\n // assume activation will complete successfully (even though this is not\n // guaranteed).\n resolve(true);\n return bootstrapDone.closed ? of(void 0) : bootstrapDone;\n };\n router.initialNavigation();\n });\n });\n };\n }\n }];\n return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);\n}\n/**\n * Disables initial navigation.\n *\n * Use if there is a reason to have more control over when the router starts its initial navigation\n * due to some complex initialization logic.\n *\n * @usageNotes\n *\n * Basic example of how you can disable initial navigation:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withDisabledInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withDisabledInitialNavigation() {\n const providers = [{\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => {\n const router = inject(Router);\n return () => {\n router.setUpLocationChangeListener();\n };\n }\n }, {\n provide: INITIAL_NAVIGATION,\n useValue: 2 /* InitialNavigation.Disabled */\n }];\n return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);\n}\n/**\n * Enables logging of all internal navigation events to the console.\n * Extra logging might be useful for debugging purposes to inspect Router event sequence.\n *\n * @usageNotes\n *\n * Basic example of how you can enable debug tracing:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withDebugTracing())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withDebugTracing() {\n let providers = [];\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n providers = [{\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory: () => {\n const router = inject(Router);\n return () => router.events.subscribe(e => {\n // tslint:disable:no-console\n console.group?.(`Router Event: ${e.constructor.name}`);\n console.log(stringifyEvent(e));\n console.log(e);\n console.groupEnd?.();\n // tslint:enable:no-console\n });\n }\n }];\n } else {\n providers = [];\n }\n return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);\n}\nconst ROUTER_PRELOADER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router preloader' : '');\n/**\n * Allows to configure a preloading strategy to use. The strategy is configured by providing a\n * reference to a class that implements a `PreloadingStrategy`.\n *\n * @usageNotes\n *\n * Basic example of how you can configure preloading:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withPreloading(PreloadAllModules))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that\n * should be used.\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withPreloading(preloadingStrategy) {\n const providers = [{\n provide: ROUTER_PRELOADER,\n useExisting: RouterPreloader\n }, {\n provide: PreloadingStrategy,\n useExisting: preloadingStrategy\n }];\n return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);\n}\n/**\n * Allows to provide extra parameters to configure Router.\n *\n * @usageNotes\n *\n * Basic example of how you can provide extra configuration options:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withRouterConfig({\n * onSameUrlNavigation: 'reload'\n * }))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @param options A set of parameters to configure Router, see `RouterConfigOptions` for\n * additional information.\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withRouterConfig(options) {\n const providers = [{\n provide: ROUTER_CONFIGURATION,\n useValue: options\n }];\n return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);\n}\n/**\n * Provides the location strategy that uses the URL fragment instead of the history API.\n *\n * @usageNotes\n *\n * Basic example of how you can use the hash location option:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withHashLocation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n * @see {@link HashLocationStrategy}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withHashLocation() {\n const providers = [{\n provide: LocationStrategy,\n useClass: HashLocationStrategy\n }];\n return routerFeature(6 /* RouterFeatureKind.RouterHashLocationFeature */, providers);\n}\n/**\n * Provides a function which is called when a navigation error occurs.\n *\n * This function is run inside application's [injection context](guide/di/dependency-injection-context)\n * so you can use the [`inject`](api/core/inject) function.\n *\n * This function can return a `RedirectCommand` to convert the error to a redirect, similar to returning\n * a `UrlTree` or `RedirectCommand` from a guard. This will also prevent the `Router` from emitting\n * `NavigationError`; it will instead emit `NavigationCancel` with code NavigationCancellationCode.Redirect.\n * Return values other than `RedirectCommand` are ignored and do not change any behavior with respect to\n * how the `Router` handles the error.\n *\n * @usageNotes\n *\n * Basic example of how you can use the error handler option:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withNavigationErrorHandler((e: NavigationError) =>\n * inject(MyErrorTracker).trackError(e)))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link NavigationError}\n * @see {@link core/inject}\n * @see {@link runInInjectionContext}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withNavigationErrorHandler(handler) {\n const providers = [{\n provide: NAVIGATION_ERROR_HANDLER,\n useValue: handler\n }];\n return routerFeature(7 /* RouterFeatureKind.NavigationErrorHandlerFeature */, providers);\n}\n/**\n * Enables binding information from the `Router` state directly to the inputs of the component in\n * `Route` configurations.\n *\n * @usageNotes\n *\n * Basic example of how you can enable the feature:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withComponentInputBinding())\n * ]\n * }\n * );\n * ```\n *\n * The router bindings information from any of the following sources:\n *\n * - query parameters\n * - path and matrix parameters\n * - static route data\n * - data from resolvers\n *\n * Duplicate keys are resolved in the same order from above, from least to greatest,\n * meaning that resolvers have the highest precedence and override any of the other information\n * from the route.\n *\n * Importantly, when an input does not have an item in the route data with a matching key, this\n * input is set to `undefined`. This prevents previous information from being\n * retained if the data got removed from the route (i.e. if a query parameter is removed).\n * Default values can be provided with a resolver on the route to ensure the value is always present\n * or an input and use an input transform in the component.\n *\n * @see {@link guide/components/inputs#input-transforms input transforms}\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withComponentInputBinding() {\n const providers = [RoutedComponentInputBinder, {\n provide: INPUT_BINDER,\n useExisting: RoutedComponentInputBinder\n }];\n return routerFeature(8 /* RouterFeatureKind.ComponentInputBindingFeature */, providers);\n}\n/**\n * Enables view transitions in the Router by running the route activation and deactivation inside of\n * `document.startViewTransition`.\n *\n * Note: The View Transitions API is not available in all browsers. If the browser does not support\n * view transitions, the Router will not attempt to start a view transition and continue processing\n * the navigation as usual.\n *\n * @usageNotes\n *\n * Basic example of how you can enable the feature:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withViewTransitions())\n * ]\n * }\n * );\n * ```\n *\n * @returns A set of providers for use with `provideRouter`.\n * @see https://developer.chrome.com/docs/web-platform/view-transitions/\n * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API\n * @developerPreview\n */\nfunction withViewTransitions(options) {\n const providers = [{\n provide: CREATE_VIEW_TRANSITION,\n useValue: createViewTransition\n }, {\n provide: VIEW_TRANSITION_OPTIONS,\n useValue: {\n skipNextTransition: !!options?.skipInitialTransition,\n ...options\n }\n }];\n return routerFeature(9 /* RouterFeatureKind.ViewTransitionsFeature */, providers);\n}\n\n/**\n * The directives defined in the `RouterModule`.\n */\nconst ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent];\n/**\n * @docsNotRequired\n */\nconst ROUTER_FORROOT_GUARD = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');\n// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept\n// here to avoid a breaking change whereby the provider order matters based on where the\n// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a \"breaking\"\n// change in a major version.\nconst ROUTER_PROVIDERS = [Location, {\n provide: UrlSerializer,\n useClass: DefaultUrlSerializer\n}, Router, ChildrenOutletContexts, {\n provide: ActivatedRoute,\n useFactory: rootRoute,\n deps: [Router]\n}, RouterConfigLoader,\n// Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can\n// be removed when `provideRoutes` is removed.\ntypeof ngDevMode === 'undefined' || ngDevMode ? {\n provide: ROUTER_IS_PROVIDED,\n useValue: true\n} : []];\n/**\n * @description\n *\n * Adds directives and providers for in-app navigation among views defined in an application.\n * Use the Angular `Router` service to declaratively specify application states and manage state\n * transitions.\n *\n * You can import this NgModule multiple times, once for each lazy-loaded bundle.\n * However, only one `Router` service can be active.\n * To ensure this, there are two ways to register routes when importing this module:\n *\n * * The `forRoot()` method creates an `NgModule` that contains all the directives, the given\n * routes, and the `Router` service itself.\n * * The `forChild()` method creates an `NgModule` that contains all the directives and the given\n * routes, but does not include the `Router` service.\n *\n * @see [Routing and Navigation guide](guide/routing/common-router-tasks) for an\n * overview of how the `Router` service should be used.\n *\n * @publicApi\n */\nlet RouterModule = /*#__PURE__*/(() => {\n class RouterModule {\n constructor(guard) {}\n /**\n * Creates and configures a module with all the router providers and directives.\n * Optionally sets up an application listener to perform an initial navigation.\n *\n * When registering the NgModule at the root, import as follows:\n *\n * ```\n * @NgModule({\n * imports: [RouterModule.forRoot(ROUTES)]\n * })\n * class MyNgModule {}\n * ```\n *\n * @param routes An array of `Route` objects that define the navigation paths for the application.\n * @param config An `ExtraOptions` configuration object that controls how navigation is performed.\n * @return The new `NgModule`.\n *\n */\n static forRoot(routes, config) {\n return {\n ngModule: RouterModule,\n providers: [ROUTER_PROVIDERS, typeof ngDevMode === 'undefined' || ngDevMode ? config?.enableTracing ? withDebugTracing().ɵproviders : [] : [], {\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, {\n provide: ROUTER_FORROOT_GUARD,\n useFactory: provideForRootGuard,\n deps: [[Router, new Optional(), new SkipSelf()]]\n }, config?.errorHandler ? {\n provide: NAVIGATION_ERROR_HANDLER,\n useValue: config.errorHandler\n } : [], {\n provide: ROUTER_CONFIGURATION,\n useValue: config ? config : {}\n }, config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(), provideRouterScroller(), config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).ɵproviders : [], config?.initialNavigation ? provideInitialNavigation(config) : [], config?.bindToComponentInputs ? withComponentInputBinding().ɵproviders : [], config?.enableViewTransitions ? withViewTransitions().ɵproviders : [], provideRouterInitializer()]\n };\n }\n /**\n * Creates a module with all the router directives and a provider registering routes,\n * without creating a new Router service.\n * When registering for submodules and lazy-loaded submodules, create the NgModule as follows:\n *\n * ```\n * @NgModule({\n * imports: [RouterModule.forChild(ROUTES)]\n * })\n * class MyNgModule {}\n * ```\n *\n * @param routes An array of `Route` objects that define the navigation paths for the submodule.\n * @return The new NgModule.\n *\n */\n static forChild(routes) {\n return {\n ngModule: RouterModule,\n providers: [{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }]\n };\n }\n static ɵfac = function RouterModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterModule)(i0.ɵɵinject(ROUTER_FORROOT_GUARD, 8));\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: RouterModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return RouterModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`\n * because it reads from the `ExtraOptions` which should not be used in the standalone world.\n */\nfunction provideRouterScroller() {\n return {\n provide: ROUTER_SCROLLER,\n useFactory: () => {\n const viewportScroller = inject(ViewportScroller);\n const zone = inject(NgZone);\n const config = inject(ROUTER_CONFIGURATION);\n const transitions = inject(NavigationTransitions);\n const urlSerializer = inject(UrlSerializer);\n if (config.scrollOffset) {\n viewportScroller.setOffset(config.scrollOffset);\n }\n return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);\n }\n };\n}\n// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should\n// provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.\nfunction provideHashLocationStrategy() {\n return {\n provide: LocationStrategy,\n useClass: HashLocationStrategy\n };\n}\n// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not\n// need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.\nfunction providePathLocationStrategy() {\n return {\n provide: LocationStrategy,\n useClass: PathLocationStrategy\n };\n}\nfunction provideForRootGuard(router) {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && router) {\n throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector.` + ` Lazy loaded modules should use RouterModule.forChild() instead.`);\n }\n return 'guarded';\n}\n// Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`\n// users call `withXInitialNavigation` directly.\nfunction provideInitialNavigation(config) {\n return [config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [], config.initialNavigation === 'enabledBlocking' ? withEnabledBlockingInitialNavigation().ɵproviders : []];\n}\n// TODO(atscott): This should not be in the public API\n/**\n * A DI token for the router initializer that\n * is called after the app is bootstrapped.\n *\n * @publicApi\n */\nconst ROUTER_INITIALIZER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Router Initializer' : '');\nfunction provideRouterInitializer() {\n return [\n // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just\n // have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.\n {\n provide: ROUTER_INITIALIZER,\n useFactory: getBootstrapListener\n }, {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useExisting: ROUTER_INITIALIZER\n }];\n}\n\n/**\n * Maps an array of injectable classes with canMatch functions to an array of equivalent\n * `CanMatchFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanMatch(providers) {\n return providers.map(provider => (...params) => inject(provider).canMatch(...params));\n}\n/**\n * Maps an array of injectable classes with canActivate functions to an array of equivalent\n * `CanActivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanActivate(providers) {\n return providers.map(provider => (...params) => inject(provider).canActivate(...params));\n}\n/**\n * Maps an array of injectable classes with canActivateChild functions to an array of equivalent\n * `CanActivateChildFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanActivateChild(providers) {\n return providers.map(provider => (...params) => inject(provider).canActivateChild(...params));\n}\n/**\n * Maps an array of injectable classes with canDeactivate functions to an array of equivalent\n * `CanDeactivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanDeactivate(providers) {\n return providers.map(provider => (...params) => inject(provider).canDeactivate(...params));\n}\n/**\n * Maps an injectable class with a resolve function to an equivalent `ResolveFn`\n * for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='Resolve'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToResolve(provider) {\n return (...params) => inject(provider).resolve(...params);\n}\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router package.\n */\n/**\n * @publicApi\n */\nconst VERSION = /*#__PURE__*/new Version('19.0.3');\nfunction getLoadedRoutes(route) {\n return route._loadedRoutes;\n}\n/*#__PURE__*/ɵpublishExternalGlobalUtil('ɵgetLoadedRoutes', getLoadedRoutes);\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n// This file only reexports content of the `src` folder. Keep it that way.\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };\n","import * as i0 from '@angular/core';\nimport { inject, Directive, Input } from '@angular/core';\nimport { TUI_PLATFORM } from '@taiga-ui/cdk/tokens';\nlet TuiPlatform = /*#__PURE__*/(() => {\n class TuiPlatform {\n constructor() {\n this.tuiPlatform = inject(TUI_PLATFORM, {\n skipSelf: true\n });\n }\n static {\n this.ɵfac = function TuiPlatform_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiPlatform)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TuiPlatform,\n selectors: [[\"\", \"tuiPlatform\", \"\"]],\n hostVars: 1,\n hostBindings: function TuiPlatform_HostBindings(rf, ctx) {\n if (rf & 2) {\n i0.ɵɵattribute(\"data-platform\", ctx.tuiPlatform);\n }\n },\n inputs: {\n tuiPlatform: \"tuiPlatform\"\n },\n features: [i0.ɵɵProvidersFeature([{\n provide: TUI_PLATFORM,\n useFactory: () => inject(TuiPlatform).tuiPlatform\n }])]\n });\n }\n }\n return TuiPlatform;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiPlatform };\n","import * as i0 from '@angular/core';\nimport { inject, Injectable } from '@angular/core';\nimport { WA_WINDOW, WINDOW } from '@ng-web-apis/common';\nimport { Observable, fromEvent, startWith, map, shareReplay, merge, filter, EMPTY } from 'rxjs';\nlet ScreenOrientationService = /*#__PURE__*/(() => {\n class ScreenOrientationService extends Observable {\n win = inject(WA_WINDOW);\n stream$ = (this.isModern ? fromEvent(this.win.screen.orientation, 'change').pipe(startWith(null), map(() =>\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation\n * The type read-only property of the ScreenOrientation interface returns the document's current orientation type,\n * one of \"portrait-primary\", \"portrait-secondary\", \"landscape-primary\", or \"landscape-secondary\".\n *\n * Browser compatibility:\n * Safari 16.4+, Chrome 38+, Firefox 43+\n */\n this.win.screen.orientation.type)) : fromEvent(this.win, 'orientationchange').pipe(startWith(null), map(() => {\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Window/orientation\n * Its only possible values are -90, 0, 90, and 180.\n * Positive values are counterclockwise; negative values are clockwise.\n */\n const angle = parseInt(this.win.orientation, 10);\n switch (angle) {\n case -90:\n return 'landscape-secondary';\n case 180:\n return 'portrait-secondary';\n case 90:\n return 'landscape-primary';\n case 0:\n default:\n return 'portrait-primary';\n }\n }))).pipe(shareReplay({\n bufferSize: 1,\n refCount: true\n }));\n constructor() {\n super(subscriber => this.stream$.subscribe(subscriber));\n }\n get isModern() {\n return !!this.win?.screen?.orientation;\n }\n static ɵfac = function ScreenOrientationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ScreenOrientationService)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ScreenOrientationService,\n factory: ScreenOrientationService.ɵfac,\n providedIn: 'root'\n });\n }\n return ScreenOrientationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ViewportService = /*#__PURE__*/(() => {\n class ViewportService extends Observable {\n visualViewport = inject(WINDOW).visualViewport;\n stream$ = this.visualViewport ? merge(fromEvent(this.visualViewport, 'resize'), fromEvent(this.visualViewport, 'scroll'), fromEvent(this.visualViewport, 'scrollend')).pipe(startWith(null), map(() => this.visualViewport), filter(Boolean), shareReplay({\n bufferSize: 1,\n refCount: true\n })) : EMPTY;\n constructor() {\n super(subscriber => this.stream$.subscribe(subscriber));\n }\n static ɵfac = function ViewportService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ViewportService)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ViewportService,\n factory: ViewportService.ɵfac,\n providedIn: 'root'\n });\n }\n return ViewportService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ScreenOrientationService, ViewportService };\n","import * as i0 from '@angular/core';\nimport { inject, Directive } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { WA_WINDOW } from '@ng-web-apis/common';\nimport { ViewportService } from '@ng-web-apis/screen-orientation';\nimport { tuiInjectElement, tuiPx } from '@taiga-ui/cdk/utils';\nlet TuiVisualViewport = /*#__PURE__*/(() => {\n class TuiVisualViewport {\n constructor() {\n this.w = inject(WA_WINDOW);\n this.style = tuiInjectElement().style;\n this.$ = inject(ViewportService).pipe(takeUntilDestroyed()).subscribe(({\n offsetLeft,\n offsetTop,\n height,\n width,\n scale\n }) => {\n this.style.setProperty('--tui-viewport-x', tuiPx(offsetLeft));\n this.style.setProperty('--tui-viewport-y', tuiPx(offsetTop));\n this.style.setProperty('--tui-viewport-height', tuiPx(height));\n this.style.setProperty('--tui-viewport-width', tuiPx(width));\n this.style.setProperty('--tui-viewport-scale', String(scale));\n this.style.setProperty('--tui-viewport-vh', tuiPx(this.w.innerHeight / 100));\n this.style.setProperty('--tui-viewport-vw', tuiPx(this.w.innerWidth / 100));\n });\n }\n static {\n this.ɵfac = function TuiVisualViewport_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiVisualViewport)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TuiVisualViewport,\n selectors: [[\"\", \"tuiVisualViewport\", \"\"]]\n });\n }\n }\n return TuiVisualViewport;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiVisualViewport };\n","import * as i0 from '@angular/core';\nimport { Injectable, inject, TemplateRef, Directive, Input } from '@angular/core';\nimport { TuiPortalService } from '@taiga-ui/cdk/classes';\nlet TuiPopupService = /*#__PURE__*/(() => {\n class TuiPopupService extends TuiPortalService {\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵTuiPopupService_BaseFactory;\n return function TuiPopupService_Factory(__ngFactoryType__) {\n return (ɵTuiPopupService_BaseFactory || (ɵTuiPopupService_BaseFactory = i0.ɵɵgetInheritedFactory(TuiPopupService)))(__ngFactoryType__ || TuiPopupService);\n };\n })();\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TuiPopupService,\n factory: TuiPopupService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return TuiPopupService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet TuiPopup = /*#__PURE__*/(() => {\n class TuiPopup {\n constructor() {\n this.template = inject(TemplateRef);\n this.service = inject(TuiPopupService);\n }\n set tuiPopup(show) {\n this.viewRef?.destroy();\n if (show) {\n this.viewRef = this.service.addTemplate(this.template);\n }\n }\n ngOnDestroy() {\n this.viewRef?.destroy();\n }\n static {\n this.ɵfac = function TuiPopup_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiPopup)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TuiPopup,\n selectors: [[\"ng-template\", \"tuiPopup\", \"\"]],\n inputs: {\n tuiPopup: \"tuiPopup\"\n }\n });\n }\n }\n return TuiPopup;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiPopup, TuiPopupService };\n","import { DOCUMENT, NgIf } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { inject, Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';\nimport { TuiPortals, tuiAsPortal } from '@taiga-ui/cdk/classes';\nimport { TUI_VERSION } from '@taiga-ui/cdk/constants';\nimport * as i1 from '@taiga-ui/cdk/directives/platform';\nimport { TuiPlatform } from '@taiga-ui/cdk/directives/platform';\nimport * as i2 from '@taiga-ui/cdk/directives/visual-viewport';\nimport { TuiVisualViewport } from '@taiga-ui/cdk/directives/visual-viewport';\nimport { tuiWatch } from '@taiga-ui/cdk/observables';\nimport { TUI_IS_MOBILE } from '@taiga-ui/cdk/tokens';\nimport { TuiAlerts } from '@taiga-ui/core/components/alert';\nimport { TuiDialogs } from '@taiga-ui/core/components/dialog';\nimport { TUI_SCROLLBAR_OPTIONS, TuiScrollControls } from '@taiga-ui/core/components/scrollbar';\nimport { TuiDropdowns } from '@taiga-ui/core/directives/dropdown';\nimport { TuiHints } from '@taiga-ui/core/directives/hint';\nimport { TuiPopupService } from '@taiga-ui/core/directives/popup';\nimport { TuiBreakpointService } from '@taiga-ui/core/services';\nimport { TUI_REDUCED_MOTION, TUI_ANIMATIONS_SPEED, TUI_THEME } from '@taiga-ui/core/tokens';\nimport { tuiGetDuration } from '@taiga-ui/core/utils';\nimport { PreventEventPlugin } from '@taiga-ui/event-plugins';\nimport { map } from 'rxjs';\n\n/// \n/// \nconst _c0 = [\"*\", [[\"tuiOverContent\"]], [[\"tuiOverDialogs\"]], [[\"tuiOverAlerts\"]], [[\"tuiOverDropdowns\"]], [[\"tuiOverHints\"]]];\nconst _c1 = [\"*\", \"tuiOverContent\", \"tuiOverDialogs\", \"tuiOverAlerts\", \"tuiOverDropdowns\", \"tuiOverHints\"];\nfunction TuiRoot_tui_scroll_controls_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"tui-scroll-controls\", 3);\n }\n}\nlet TuiRoot = /*#__PURE__*/(() => {\n class TuiRoot extends TuiPortals {\n constructor() {\n super();\n this.reducedMotion = inject(TUI_REDUCED_MOTION);\n this.duration = tuiGetDuration(inject(TUI_ANIMATIONS_SPEED));\n this.isMobileRes = toSignal(inject(TuiBreakpointService).pipe(map(breakpoint => breakpoint === 'mobile'), tuiWatch()), {\n initialValue: false\n });\n this.nativeScrollbar = inject(TUI_SCROLLBAR_OPTIONS).mode === 'native';\n this.scrollbars = !(this.nativeScrollbar || inject(TUI_IS_MOBILE));\n inject(DOCUMENT).documentElement.setAttribute('data-tui-theme', inject(TUI_THEME).toLowerCase());\n if (!this.nativeScrollbar) {\n inject(DOCUMENT).defaultView?.document.documentElement.classList.add('tui-zero-scrollbar');\n }\n ngDevMode && console.assert(!!inject(EVENT_MANAGER_PLUGINS).find(plugin => plugin instanceof PreventEventPlugin), 'NG_EVENT_PLUGINS is missing from global providers');\n }\n static {\n this.ɵfac = function TuiRoot_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiRoot)();\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: TuiRoot,\n selectors: [[\"tui-root\"]],\n hostAttrs: [\"data-tui-version\", \"4.18.0\"],\n hostVars: 6,\n hostBindings: function TuiRoot_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"touchstart.passive.silent\", function TuiRoot_touchstart_passive_silent_HostBindingHandler() {\n return 0;\n });\n }\n if (rf & 2) {\n i0.ɵɵstyleProp(\"--tui-duration\", ctx.duration, \"ms\")(\"--tui-scroll-behavior\", ctx.reducedMotion ? \"auto\" : \"smooth\");\n i0.ɵɵclassProp(\"_mobile\", ctx.isMobileRes());\n }\n },\n features: [i0.ɵɵProvidersFeature([], [tuiAsPortal(TuiPopupService)]), i0.ɵɵHostDirectivesFeature([i1.TuiPlatform, i2.TuiVisualViewport]), i0.ɵɵInheritDefinitionFeature],\n ngContentSelectors: _c1,\n decls: 14,\n vars: 1,\n consts: [[\"viewContainer\", \"\"], [1, \"t-root-content\"], [\"class\", \"t-root-scrollbar\", 4, \"ngIf\"], [1, \"t-root-scrollbar\"]],\n template: function TuiRoot_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵprojectionDef(_c0);\n i0.ɵɵelementStart(0, \"div\", 1);\n i0.ɵɵprojection(1);\n i0.ɵɵelementEnd();\n i0.ɵɵtemplate(2, TuiRoot_tui_scroll_controls_2_Template, 1, 0, \"tui-scroll-controls\", 2);\n i0.ɵɵelementContainer(3, null, 0);\n i0.ɵɵprojection(5, 1);\n i0.ɵɵelement(6, \"tui-dialogs\");\n i0.ɵɵprojection(7, 2);\n i0.ɵɵelement(8, \"tui-alerts\");\n i0.ɵɵprojection(9, 3);\n i0.ɵɵelement(10, \"tui-dropdowns\");\n i0.ɵɵprojection(11, 4);\n i0.ɵɵelement(12, \"tui-hints\");\n i0.ɵɵprojection(13, 5);\n }\n if (rf & 2) {\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngIf\", ctx.scrollbars);\n }\n },\n dependencies: [NgIf, TuiAlerts, TuiDialogs, TuiDropdowns, TuiHints, TuiScrollControls],\n styles: [\"@keyframes tuiPresent{to{content:\\\"\\\"}}@keyframes tuiSkeletonVibe{to{opacity:.5}}.tui-zero-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.tui-zero-scrollbar::-webkit-scrollbar,.tui-zero-scrollbar::-webkit-scrollbar-thumb{display:none}body,input{margin:0}tui-root{position:relative;display:block;font:var(--tui-font-text-s);color:var(--tui-text-primary);flex:1;border-image:conic-gradient(var(--tui-background-base) 0 0) fill 0/0/0 0 100vh 0;-webkit-tap-highlight-color:transparent}tui-root>.t-root-scrollbar{position:fixed;top:0;left:0;bottom:0;right:0;z-index:0;display:none;margin:0}[data-tui-theme] tui-root>.t-root-scrollbar{display:block}.t-root-content{position:relative;top:var(--t-root-top);block-size:100%;isolation:isolate}.t-root-content>*{--t-root-top: 0}[tuiDropdownButton][tuiDropdownButton]{display:none}\\n\"],\n encapsulation: 2\n });\n }\n }\n return TuiRoot;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiRoot };\n","import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';\nimport {RouterOutlet} from '@angular/router';\nimport {TuiRoot} from '@taiga-ui/core';\n\n@Component({\n standalone: true,\n selector: 'app-root',\n imports: [RouterOutlet, TuiRoot],\n templateUrl: './app.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AppComponent {}\n","\n \n\n \n \n \n \n \n\n","/**\n * @license Angular v19.0.3\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Injectable, Inject, RendererFactory2, NgZone, ANIMATION_MODULE_TYPE, NgModule, ɵperformanceMarkFeature } from '@angular/core';\nexport { ANIMATION_MODULE_TYPE } from '@angular/core';\nimport { ɵDomRendererFactory2, BrowserModule } from '@angular/platform-browser';\nimport * as i1 from '@angular/animations/browser';\nimport { ɵAnimationEngine, ɵWebAnimationsStyleNormalizer, ɵAnimationRendererFactory, ɵAnimationStyleNormalizer, AnimationDriver, ɵWebAnimationsDriver, NoopAnimationDriver } from '@angular/animations/browser';\nimport { DOCUMENT } from '@angular/common';\nlet InjectableAnimationEngine = /*#__PURE__*/(() => {\n class InjectableAnimationEngine extends ɵAnimationEngine {\n // The `ApplicationRef` is injected here explicitly to force the dependency ordering.\n // Since the `ApplicationRef` should be created earlier before the `AnimationEngine`, they\n // both have `ngOnDestroy` hooks and `flush()` must be called after all views are destroyed.\n constructor(doc, driver, normalizer) {\n super(doc, driver, normalizer);\n }\n ngOnDestroy() {\n this.flush();\n }\n static ɵfac = function InjectableAnimationEngine_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || InjectableAnimationEngine)(i0.ɵɵinject(DOCUMENT), i0.ɵɵinject(i1.AnimationDriver), i0.ɵɵinject(i1.ɵAnimationStyleNormalizer));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InjectableAnimationEngine,\n factory: InjectableAnimationEngine.ɵfac\n });\n }\n return InjectableAnimationEngine;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction instantiateDefaultStyleNormalizer() {\n return new ɵWebAnimationsStyleNormalizer();\n}\nfunction instantiateRendererFactory(renderer, engine, zone) {\n return new ɵAnimationRendererFactory(renderer, engine, zone);\n}\nconst SHARED_ANIMATION_PROVIDERS = [{\n provide: ɵAnimationStyleNormalizer,\n useFactory: instantiateDefaultStyleNormalizer\n}, {\n provide: ɵAnimationEngine,\n useClass: InjectableAnimationEngine\n}, {\n provide: RendererFactory2,\n useFactory: instantiateRendererFactory,\n deps: [ɵDomRendererFactory2, ɵAnimationEngine, NgZone]\n}];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserModule.\n */\nconst BROWSER_ANIMATIONS_PROVIDERS = [{\n provide: AnimationDriver,\n useFactory: () => new ɵWebAnimationsDriver()\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'BrowserAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserTestingModule.\n */\nconst BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{\n provide: AnimationDriver,\n useClass: NoopAnimationDriver\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'NoopAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\n\n/**\n * Exports `BrowserModule` with additional dependency-injection providers\n * for use with animations. See [Animations](guide/animations).\n * @publicApi\n */\nlet BrowserAnimationsModule = /*#__PURE__*/(() => {\n class BrowserAnimationsModule {\n /**\n * Configures the module based on the specified object.\n *\n * @param config Object used to configure the behavior of the `BrowserAnimationsModule`.\n * @see {@link BrowserAnimationsModuleConfig}\n *\n * @usageNotes\n * When registering the `BrowserAnimationsModule`, you can use the `withConfig`\n * function as follows:\n * ```\n * @NgModule({\n * imports: [BrowserAnimationsModule.withConfig(config)]\n * })\n * class MyNgModule {}\n * ```\n */\n static withConfig(config) {\n return {\n ngModule: BrowserAnimationsModule,\n providers: config.disableAnimations ? BROWSER_NOOP_ANIMATIONS_PROVIDERS : BROWSER_ANIMATIONS_PROVIDERS\n };\n }\n static ɵfac = function BrowserAnimationsModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || BrowserAnimationsModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: BrowserAnimationsModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n return BrowserAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of dependency-injection providers\n * to enable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to enable animations in an application\n * bootstrapped using the `bootstrapApplication` function. In this scenario there\n * is no need to import the `BrowserAnimationsModule` NgModule at all, just add\n * providers returned by this function to the `providers` list as show below.\n *\n * ```ts\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideAnimations() {\n ɵperformanceMarkFeature('NgEagerAnimations');\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideAnimations` call results in app code.\n return [...BROWSER_ANIMATIONS_PROVIDERS];\n}\n/**\n * A null player that must be imported to allow disabling of animations.\n * @publicApi\n */\nlet NoopAnimationsModule = /*#__PURE__*/(() => {\n class NoopAnimationsModule {\n static ɵfac = function NoopAnimationsModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NoopAnimationsModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: NoopAnimationsModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n return NoopAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of dependency-injection providers\n * to disable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to bootstrap an application using\n * the `bootstrapApplication` function, but you need to disable animations\n * (for example, when running tests).\n *\n * ```ts\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideNoopAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideNoopAnimations() {\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideNoopAnimations` call results in app code.\n return [...BROWSER_NOOP_ANIMATIONS_PROVIDERS];\n}\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation browser package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BrowserAnimationsModule, NoopAnimationsModule, provideAnimations, provideNoopAnimations, InjectableAnimationEngine as ɵInjectableAnimationEngine };\n","import type {ApplicationConfig, Injector} from '@angular/core';\nimport {\n importProvidersFrom,\n INJECTOR,\n provideExperimentalZonelessChangeDetection,\n} from '@angular/core';\nimport {provideClientHydration} from '@angular/platform-browser';\nimport {provideAnimations} from '@angular/platform-browser/animations';\nimport {provideRouter} from '@angular/router';\nimport {NgDompurifySanitizer} from '@taiga-ui/dompurify';\nimport {TUI_EDITOR_DEFAULT_EXTENSIONS, TUI_EDITOR_EXTENSIONS} from '@taiga-ui/editor';\nimport {NG_EVENT_PLUGINS} from '@taiga-ui/event-plugins';\nimport {TUI_SANITIZER} from '@taiga-ui/legacy';\n\nexport const appConfig: ApplicationConfig = {\n providers: [\n provideExperimentalZonelessChangeDetection(),\n provideClientHydration(),\n provideAnimations(),\n provideRouter([\n {\n path: '',\n pathMatch: 'full',\n loadComponent: async () => import('./home/home.component'),\n },\n ]),\n importProvidersFrom(),\n {\n provide: TUI_EDITOR_EXTENSIONS,\n deps: [INJECTOR],\n useFactory: (injector: Injector) => [\n ...TUI_EDITOR_DEFAULT_EXTENSIONS,\n import('@taiga-ui/editor').then(({tuiCreateImageEditorExtension}) =>\n tuiCreateImageEditorExtension({injector}),\n ),\n ],\n },\n {\n provide: TUI_SANITIZER,\n useClass: NgDompurifySanitizer,\n },\n NG_EVENT_PLUGINS,\n ],\n};\n","export const environment = {\n production: false,\n};\n","import {enableProdMode} from '@angular/core';\nimport {bootstrapApplication} from '@angular/platform-browser';\n\nimport {AppComponent} from './app/app.component';\nimport {appConfig} from './app/app.config';\nimport {environment} from './environments/environment';\n\nif (environment.production) {\n enableProdMode();\n}\n\nbootstrapApplication(AppComponent, appConfig).catch((err: unknown) => console.error(err));\n"],"mappings":"8qCAmBA,IAAMA,EAAiB,UAMjBC,GAA+B,OAAO,YAAY,EAClDC,GAAN,KAAkB,CAEhB,YAAYC,EAAQ,CADpBC,EAAA,eAEE,KAAK,OAASD,GAAU,CAAC,CAC3B,CACA,IAAIE,EAAM,CACR,OAAO,OAAO,UAAU,eAAe,KAAK,KAAK,OAAQA,CAAI,CAC/D,CACA,IAAIA,E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AAU,mBACZ,EAAG,GAAGN,EAA0B,EAK1BO,GAAoC,CAAC,CACzC,QAASjB,GACT,SAAUkB,EACZ,EAAG,CACD,QAASF,GACT,SAAU,gBACZ,EAAG,GAAGN,EAA0B,EAqEhC,SAASS,IAAoB,CAC3B,OAAAC,GAAwB,mBAAmB,EAGpC,CAAC,GAAGC,EAA4B,CACzC,CCvIO,IAAMC,GAA+B,CACxCC,UAAW,CACPC,GAA0C,EAC1CC,GAAsB,EACtBC,GAAiB,EACjBC,GAAc,CACV,CACIC,KAAM,GACNC,UAAW,OACXC,cAAe,SAAY,OAAO,qBAAuB,EAC5D,CACJ,EACDC,GAAmB,EACnB,CACIC,QAASC,GACTC,KAAM,CAACC,EAAQ,EACfC,WAAaC,GAAuB,CAChC,GAAGC,GACH,OAAO,qBAAkB,EAAEC,KAAK,CAAC,CAACC,8BAAAA,CAA6B,IAC3DA,EAA8B,CAACH,SAAAA,CAAQ,CAAC,CAAC,CAC5C,GAGT,CACIL,QAASS,GACTC,SAAUC,IAEdC,EAAgB,GCzCjB,IAAMC,GAAc,CACvBC,WAAY,ICMZC,GAAYC,YACZC,OAGJC,GAAqBC,GAAcC,EAAS,EAAEC,MAAOC,GAAiBC,QAAQC,MAAMF,CAAG,CAAC","names":["PRIMARY_OUTLET","RouteTitleKey","ParamsAsMap","params","__publicField","name","v","convertToParamMap","defaultUrlMatcher","segments","segmentGroup","route","parts","posParams","index","part","segment","shallowEqualArrays","a","b","shallowEqual","k1","getDataKeys","k2","key","i","equalArraysOrString","obj","aSorted","bSorted","val","last","wrapIntoObservable","value","isObservable","isPromise","from","of","pathCompareMap","equalSegmentGroups","containsSegmentGroup","paramCompareMap","equalParams","containsParams","containsTree","container","containee","options","matrixParams","equalPath","matrixParamsMatch","c","containsSegmentGroupHelper","containeePaths","current","next","containerPaths","containeeSegment","UrlTree","root","UrlSegmentGroup","queryParams","fragment","DEFAULT_SERIALIZER","children","serializePaths","UrlSegment","path","parameters","serializePath","equalSegments","as","bs","mapChildrenIntoArray","fn","res","childOutlet","child","UrlSerializer","_UrlSerializer","__ngFactoryType__","ɵɵdefineInjectable","DefaultUrlSerializer","url","p","UrlParser","tree","serializeSegment","query","serializeQueryParams","encodeUriFragment","primary","k","encodeUriString","s","encodeUriQuery","encodeUriSegment","decode","decodeQuery","serializeMatrixParams","strParams","SEGMENT_RE","matchSegments","str","match","MATRIX_PARAM_SEGMENT_RE","matchMatrixKeySegments","QUERY_PARAM_RE","matchQueryParams","QUERY_PARAM_VALUE_RE","matchUrlQueryParamValue","RuntimeError","valueMatch","decodedKey","decodedVal","currentVal","allowPrimary","outletName","createRoot","rootCandidate","squashSegmentGroup","newChildren","childCandidate","grandChildOutlet","grandChild","mergeTrivialChildren","isUrlTree","createUrlTreeFromSnapshot","relativeTo","commands","relativeToUrlSegmentGroup","createSegmentGroupFromRoute","createUrlTreeFromSegmentGroup","targetGroup","createSegmentGroupFromRouteRecursive","currentRoute","childOutlets","childSnapshot","rootSegmentGroup","nav","computeNavigation","position","findStartingPositionForTargetGroup","newSegmentGroup","updateSegmentGroupChildren","updateSegmentGroup","isMatrixParams","command","isCommandWithOutlets","oldRoot","oldSegmentGroup","qp","replaceSegment","newRoot","oldSegment","newSegment","Navigation","isAbsolute","numberOfDoubleDots","cmdWithOutlet","cmd","cmdIdx","outlets","urlPart","partIndex","Position","processChildren","target","modifier","createPositionApplyingDoubleDots","group","g","ci","dd","getOutlets","startIndex","m","prefixedWith","slicedCommands","createNewSegmentGroup","childrenOfEmptyChild","outlet","currentCommandIndex","currentPathIndex","noMatch","curr","compare","paths","createNewSegmentChildren","stringify","IMPERATIVE_NAVIGATION","EventType","RouterEvent","id","NavigationStart","navigationTrigger","restoredState","NavigationEnd","urlAfterRedirects","NavigationCancellationCode","NavigationSkippedCode","NavigationCancel","reason","code","NavigationSkipped","NavigationError","error","RoutesRecognized","state","GuardsCheckStart","GuardsCheckEnd","shouldActivate","ResolveStart","ResolveEnd","RouteConfigLoadStart","RouteConfigLoadEnd","ChildActivationStart","snapshot","ChildActivationEnd","ActivationStart","ActivationEnd","BeforeActivateRoutes","RedirectRequest","url","navigationBehaviorOptions","__publicField","getOrCreateRouteInjectorIfNeeded","route","currentInjector","createEnvironmentInjector","getOutlet","route","PRIMARY_OUTLET","sortByMatchingOutlets","routes","outletName","sortedConfig","r","getClosestRouteInjector","snapshot","_a","s","OutletContext","rootInjector","__publicField","ChildrenOutletContexts","_ChildrenOutletContexts","childName","outlet","context","contexts","__ngFactoryType__","ɵɵinject","EnvironmentInjector","ɵɵdefineInjectable","Tree","root","p","n","findNode","t","findPath","c","cc","value","node","child","path","TreeNode","children","nodeChildrenAsMap","map","RouterState","setRouterState","createEmptyState","rootComponent","createEmptyStateSnapshot","emptyUrl","BehaviorSubject","UrlSegment","emptyParams","emptyData","emptyQueryParams","fragment","activated","ActivatedRoute","ActivatedRouteSnapshot","RouterStateSnapshot","urlSubject","paramsSubject","queryParamsSubject","fragmentSubject","dataSubject","component","futureSnapshot","RouteTitleKey","of","convertToParamMap","getInherited","parent","paramsInheritanceStrategy","inherited","routeConfig","__spreadValues","hasStaticTitle","url","params","queryParams","data","resolve","segment","matched","serializeNode","state","advanceActivatedRoute","currentSnapshot","nextSnapshot","shallowEqual","shallowEqualArrays","equalParamsAndUrlSegments","a","b","equalUrlParams","equalSegments","parentsMismatch","config","ROUTER_OUTLET_DATA","InjectionToken","RouterOutlet","_RouterOutlet","EventEmitter","input","inject","ViewContainerRef","ChangeDetectorRef","INPUT_BINDER","changes","firstChange","previousValue","RuntimeError","cmp","ref","activatedRoute","environmentInjector","location","childContexts","injector","OutletInjector","ɵɵdefineDirective","ɵɵNgOnChangesFeature","_OutletInjector","outletData","parentInjector","token","notFoundValue","createRouterState","routeReuseStrategy","curr","prevState","root","createNode","RouterState","value","children","createOrReuseChildren","TreeNode","detachedRouteHandle","tree","c","createActivatedRoute","child","p","ActivatedRoute","BehaviorSubject","RedirectCommand","redirectTo","navigationBehaviorOptions","__publicField","NAVIGATION_CANCELING_ERROR","redirectingNavigationError","urlSerializer","redirect","isUrlTree","error","navigationCancelingError","NavigationCancellationCode","message","code","isRedirectingNavigationCancelingError","isNavigationCancelingError","activateRoutes","rootContexts","routeReuseStrategy","forwardEvent","inputBindingEnabled","map","t","ActivateRoutes","futureState","currState","__publicField","parentContexts","futureRoot","currRoot","advanceActivatedRoute","futureNode","currNode","contexts","children","nodeChildrenAsMap","futureChild","childOutletName","v","parentContext","future","curr","context","route","treeNode","componentRef","c","ActivationEnd","ChildActivationEnd","stored","CanActivate","path","CanDeactivate","component","getAllRouteGuards","getChildRouteGuards","getCanActivateChild","p","canActivateChild","getTokenOrFunctionIdentity","tokenOrFunction","injector","NOT_FOUND","result","isInjectable","futurePath","checks","prevChildren","getRouteGuards","k","deactivateRouteAndItsChildren","shouldRun","shouldRunGuardsAndResolvers","mode","equalPath","shallowEqual","equalParamsAndUrlSegments","childName","node","isFunction","isBoolean","isCanLoad","guard","isCanActivate","isCanActivateChild","isCanDeactivate","isCanMatch","isEmptyError","EmptyError","INITIAL_VALUE","prioritizedGuardValue","switchMap","obs","combineLatest","o","take","startWith","results","isRedirect","filter","item","val","isUrlTree","RedirectCommand","checkGuards","mergeMap","targetSnapshot","currentSnapshot","canActivateChecks","canDeactivateChecks","of","__spreadProps","__spreadValues","runCanDeactivateChecks","canDeactivate","runCanActivateChecks","guardsResult","futureRSS","currRSS","from","check","runCanDeactivate","first","futureSnapshot","concatMap","concat","fireChildActivationStart","fireActivationStart","runCanActivateChild","runCanActivate","snapshot","ActivationStart","ChildActivationStart","futureARS","canActivate","canActivateObservables","defer","closestInjector","getClosestRouteInjector","guardVal","runInInjectionContext","wrapIntoObservable","canActivateChildGuardsMapped","_","d","guardsMapped","currARS","canDeactivateObservables","runCanLoadGuards","segments","urlSerializer","canLoad","canLoadObservables","injectionToken","redirectIfUrlTree","pipe","tap","redirectingNavigationError","runCanMatchGuards","canMatch","canMatchObservables","NoMatch","segmentGroup","AbsoluteRedirect","urlTree","noMatch$1","throwError","namedOutletsRedirect","redirectTo","throwError","RuntimeError","canLoadFails","route","navigationCancelingError","NavigationCancellationCode","ApplyRedirects","urlSerializer","urlTree","__publicField","res","c","of","PRIMARY_OUTLET","segments","posParams","currentSnapshot","injector","redirectToFn","queryParams","fragment","routeConfig","url","outlet","params","data","title","newRedirect","runInInjectionContext","UrlTree","AbsoluteRedirect","newTree","newRoot","redirectToParams","actualParams","k","v","sourceName","group","updatedSegments","children","name","child","UrlSegmentGroup","redirectToSegments","actualSegments","s","redirectToUrlSegment","pos","idx","noMatch","matchWithChecks","segmentGroup","result","match","getOrCreateRouteInjectorIfNeeded","runCanMatchGuards","map","__spreadValues","createWildcardMatchResult","defaultUrlMatcher","parameters","last","split","consumedSegments","slicedSegments","config","containsEmptyPathMatchesWithNamedOutlets","createChildrenForEmptyPaths","containsEmptyPathMatches","addEmptyPathsToChildrenIfNeeded","routes","r","emptyPathMatch","getOutlet","primarySegment","noLeftoversInUrl","NoLeftoversInUrl","recognize$1","configLoader","rootComponentType","paramsInheritanceStrategy","Recognizer","MAX_ALLOWED_REDIRECTS","e","rootSegmentGroup","rootSnapshot","rootNode","TreeNode","routeState","RouterStateSnapshot","tree","createUrlTreeFromSnapshot","ActivatedRouteSnapshot","catchError","NoMatch","parentRoute","childOutlets","from","concatMap","childOutlet","sortedConfig","sortByMatchingOutlets","scan","outletChildren","defaultIfEmpty","mergeMap","noMatch$1","mergedChildren","mergeEmptyPathMatches","sortActivatedRouteSnapshots","allowRedirects","first","x","isEmptyError","rawSegment","matched","positionalParamSegments","remainingSegments","getData","getResolve","inherited","getInherited","newSegments","matchResult","switchMap","childConfig","childInjector","snapshot","matchedOnOutlet","runCanLoadGuards","shouldLoadResult","tap","cfg","nodes","a","b","hasEmptyPathConfig","node","mergedNodes","duplicateEmptyPathNode","resultNode","mergedNode","getData","route","getResolve","recognize","injector","configLoader","rootComponentType","config","serializer","paramsInheritanceStrategy","mergeMap","t","recognize$1","map","targetSnapshot","urlAfterRedirects","__spreadProps","__spreadValues","resolveData","canActivateChecks","of","routesWithResolversToRun","check","routesNeedingDataUpdates","newRoute","flattenRouteTree","routesProcessed","from","concatMap","runResolve","getInherited","tap","takeLast","_","EMPTY","descendants","child","futureARS","futureRSS","resolve","hasStaticTitle","RouteTitleKey","resolveNode","resolvedData","keys","getDataKeys","data","key","getResolver","first","value","RedirectCommand","redirectingNavigationError","DefaultUrlSerializer","mapTo","catchError","e","isEmptyError","throwError","injectionToken","closestInjector","getClosestRouteInjector","resolver","getTokenOrFunctionIdentity","resolverValue","runInInjectionContext","wrapIntoObservable","switchTap","next","switchMap","v","nextResult","TitleStrategy","_TitleStrategy","snapshot","pageTitle","PRIMARY_OUTLET","__publicField","__ngFactoryType__","ɵɵdefineInjectable","inject","DefaultTitleStrategy","_DefaultTitleStrategy","title","ɵɵinject","Title","ROUTER_CONFIGURATION","InjectionToken","ɵEmptyOutletComponent","_ɵEmptyOutletComponent","ɵɵdefineComponent","rf","ctx","ɵɵelement","RouterOutlet","standardizeConfig","r","children","c","ROUTES","RouterConfigLoader","_RouterConfigLoader","Compiler","loadRunner","maybeUnwrapDefaultExport","component","finalize","loader","ConnectableObservable","Subject","refCount","parentInjector","loadChildren","compiler","onLoadEndListener","NgModuleFactory$1","factoryOrRoutes","rawRoutes","requireStandaloneComponents","isWrappedDefaultExport","input","UrlHandlingStrategy","_UrlHandlingStrategy","DefaultUrlHandlingStrategy","_DefaultUrlHandlingStrategy","url","newUrlPart","wholeUrl","CREATE_VIEW_TRANSITION","NAVIGATION_ERROR_HANDLER","InjectionToken","NavigationTransitions","_NavigationTransitions","__publicField","Subject","inject","RouterConfigLoader","EnvironmentInjector","UrlSerializer","ChildrenOutletContexts","Location","INPUT_BINDER","TitleStrategy","ROUTER_CONFIGURATION","UrlHandlingStrategy","CREATE_VIEW_TRANSITION","of","onLoadStart","r","RouteConfigLoadStart","onLoadEnd","RouteConfigLoadEnd","_a","request","id","__spreadProps","__spreadValues","router","initialUrlTree","initialRouterState","BehaviorSubject","IMPERATIVE_NAVIGATION","filter","t","map","switchMap","overallTransitionState","completed","errored","NavigationCancellationCode","EMPTY","urlTransition","onSameUrlNavigation","reason","NavigationSkipped","NavigationSkippedCode","_b","transition","NavigationStart","recognize","tap","routesRecognized","RoutesRecognized","extractedUrl","source","restoredState","extras","navStart","targetSnapshot","createEmptyState","guardsStart","GuardsCheckStart","getAllRouteGuards","checkGuards","evt","redirectingNavigationError","guardsEnd","GuardsCheckEnd","switchTap","resolveStart","ResolveStart","dataResolved","resolveData","resolveEnd","ResolveEnd","loadComponents","route","loaders","loadedComponent","child","combineLatest","defaultIfEmpty","take","currentSnapshot","viewTransitionStarted","from","targetRouterState","createRouterState","BeforeActivateRoutes","activateRoutes","NavigationEnd","takeUntil","err","finalize","catchError","e","isNavigationCancelingError","NavigationCancel","isRedirectingNavigationCancelingError","RedirectRequest","navigationError","NavigationError","navigationErrorHandlerResult","runInInjectionContext","RedirectCommand","message","cancellationCode","ee","code","navCancel","_c","currentBrowserUrl","targetBrowserUrl","__ngFactoryType__","ɵɵdefineInjectable","isBrowserTriggeredNavigation","RouteReuseStrategy","_RouteReuseStrategy","DefaultRouteReuseStrategy","BaseRouteReuseStrategy","detachedTree","future","curr","_DefaultRouteReuseStrategy","ɵDefaultRouteReuseStrategy_BaseFactory","ɵɵgetInheritedFactory","StateManager","_StateManager","HistoryStateManager","_HistoryStateManager","UrlTree","listener","event","currentTransition","rawUrl","url","path","currentBrowserPageId","state","navigation","restoringFromCaughtError","targetPagePosition","navigationId","routerPageId","ɵHistoryStateManager_BaseFactory","NavigationResult","afterNextNavigation","action","result","exactMatchOptions","subsetMatchOptions","Router","_Router","Console","PendingTasksInternal","ROUTES","Subscription","subscription","currentNavigation","opts","mergedTree","isPublicRouterEvent","rootComponentType","stateCopy","urlTree","config","standardizeConfig","commands","navigationExtras","relativeTo","queryParams","fragment","queryParamsHandling","preserveFragment","f","q","relativeToUrlSegmentGroup","relativeToSnapshot","createSegmentGroupFromRoute","createUrlTreeFromSegmentGroup","isUrlTree","validateCommands","matchOptions","options","containsTree","params","key","value","priorPromise","resolve","reject","promise","res","rej","taskId","i","RuntimeError","ROUTER_SCROLLER","InjectionToken","provideRouter","routes","features","makeEnvironmentProviders","ROUTES","ActivatedRoute","rootRoute","Router","APP_BOOTSTRAP_LISTENER","getBootstrapListener","feature","router","getBootstrapListener","injector","inject","Injector","bootstrappedComponentRef","_a","_b","ref","ApplicationRef","router","Router","bootstrapDone","BOOTSTRAP_DONE","INITIAL_NAVIGATION","ROUTER_PRELOADER","InjectFlags","ROUTER_SCROLLER","InjectionToken","Subject","ROUTER_PRELOADER","InjectionToken","TuiPlatform","_TuiPlatform","inject","TUI_PLATFORM","__ngFactoryType__","ɵɵdefineDirective","rf","ctx","ɵɵattribute","ɵɵProvidersFeature","ViewportService","_ViewportService","Observable","subscriber","__publicField","inject","WINDOW","merge","fromEvent","startWith","map","filter","shareReplay","EMPTY","__ngFactoryType__","ɵɵdefineInjectable","TuiVisualViewport","_TuiVisualViewport","inject","WA_WINDOW","tuiInjectElement","ViewportService","takeUntilDestroyed","offsetLeft","offsetTop","height","width","scale","tuiPx","__ngFactoryType__","ɵɵdefineDirective","TuiPopupService","_TuiPopupService","TuiPortalService","ɵTuiPopupService_BaseFactory","__ngFactoryType__","ɵɵgetInheritedFactory","ɵɵdefineInjectable","_c0","_c1","TuiRoot_tui_scroll_controls_2_Template","rf","ctx","ɵɵelement","TuiRoot","_TuiRoot","TuiPortals","_a","inject","TUI_REDUCED_MOTION","tuiGetDuration","TUI_ANIMATIONS_SPEED","toSignal","TuiBreakpointService","map","breakpoint","tuiWatch","TUI_SCROLLBAR_OPTIONS","TUI_IS_MOBILE","DOCUMENT","TUI_THEME","__ngFactoryType__","ɵɵdefineComponent","ɵɵlistener","ɵɵstyleProp","ɵɵclassProp","ɵɵProvidersFeature","tuiAsPortal","TuiPopupService","ɵɵHostDirectivesFeature","TuiPlatform","TuiVisualViewport","ɵɵInheritDefinitionFeature","ɵɵprojectionDef","ɵɵelementStart","ɵɵprojection","ɵɵelementEnd","ɵɵtemplate","ɵɵelementContainer","ɵɵadvance","ɵɵproperty","NgIf","TuiAlerts","TuiDialogs","TuiDropdowns","TuiHints","TuiScrollControls","AppComponent","selectors","decls","vars","consts","template","rf","ctx","ɵɵelementStart","ɵɵelement","ɵɵelementContainer","ɵɵelementEnd","RouterOutlet","TuiRoot","encapsulation","changeDetection","_AppComponent","InjectableAnimationEngine","_InjectableAnimationEngine","AnimationEngine","doc","driver","normalizer","__publicField","__ngFactoryType__","ɵɵinject","DOCUMENT","AnimationDriver","AnimationStyleNormalizer","ɵɵdefineInjectable","instantiateDefaultStyleNormalizer","WebAnimationsStyleNormalizer","instantiateRendererFactory","renderer","engine","zone","AnimationRendererFactory","SHARED_ANIMATION_PROVIDERS","RendererFactory2","DomRendererFactory2","NgZone","BROWSER_ANIMATIONS_PROVIDERS","WebAnimationsDriver","ANIMATION_MODULE_TYPE","BROWSER_NOOP_ANIMATIONS_PROVIDERS","NoopAnimationDriver","provideAnimations","performanceMarkFeature","BROWSER_ANIMATIONS_PROVIDERS","appConfig","providers","provideExperimentalZonelessChangeDetection","provideClientHydration","provideAnimations","provideRouter","path","pathMatch","loadComponent","importProvidersFrom","provide","TUI_EDITOR_EXTENSIONS","deps","INJECTOR","useFactory","injector","TUI_EDITOR_DEFAULT_EXTENSIONS","then","tuiCreateImageEditorExtension","TUI_SANITIZER","useClass","NgDompurifySanitizer","NG_EVENT_PLUGINS","environment","production","environment","production","enableProdMode","bootstrapApplication","AppComponent","appConfig","catch","err","console","error"],"x_google_ignoreList":[0,1,2,3,4,5,8]} \ No newline at end of file diff --git a/main-2JDNF67F.js b/main-RD4XIA7H.js similarity index 99% rename from main-2JDNF67F.js rename to main-RD4XIA7H.js index 227c6338..7a4a5bab 100644 --- a/main-2JDNF67F.js +++ b/main-RD4XIA7H.js @@ -1,3 +1,3 @@ -import{c as Cn,e as En,f as Un}from"./chunk-VI33G2S5.js";import{$ as Pr,A as Ce,Aa as _r,Ab as Me,Ac as ln,Ad as mn,B as it,Ba as Vr,Bb as tn,Bd as Jt,C as Ir,Ca as ot,Cb as Oe,Cd as yn,Ce as xn,Dd as Sn,E as Bt,Ea as Z,Eb as st,Ed as wn,F as H,Fb as Kt,G as Re,Ga as qr,Gd as Pe,H as Dr,Ha as Br,Hf as Nn,Ia as Hr,Ib as en,J as Ar,Ja as Wr,K as Tr,Ka as Gr,Kd as Rn,L as Ht,La as Qr,Ld as bn,M as k,Ma as Zr,Mb as rn,N as Mr,Na as Ae,Nb as nn,Ng as jn,O as I,Oa as Yr,Ob as on,P as D,Pa as Kr,Pb as sn,Qa as Xr,R,Sd as In,T as Or,U as j,Ua as Gt,V as be,Va as Qt,Vc as dn,W as Q,Wa as z,Wc as hn,X as h,Xc as pn,Xd as Dn,Yd as An,Za as Zt,Zd as Tn,_ as Er,_d as Mn,a as mr,aa as Ur,ba as Wt,bb as Te,c as yr,ca as _,d as Sr,da as xr,db as Jr,e as me,eb as Y,ee as On,f as ye,fc as an,g as G,gc as un,gd as fn,h as O,ha as wt,i as $,ia as Nr,k as N,ka as jr,l as g,la as Ct,le as Pn,m as yt,ma as Ie,n as wr,na as Lr,o as Cr,od as gn,p as y,pa as De,q as Se,qa as $r,qb as Yt,qc as K,r as E,s as Rr,t as we,u as qt,va as kr,w as br,wc as cn,x as B,xa as zr,xd as vn,y as nt,ya as Fr,yd as Rt,z as St,zc as Ee,zd as Xt}from"./chunk-UQ26QW4E.js";import{a as f,b as A,e as a}from"./chunk-5XJ3NODC.js";var v="primary",zt=Symbol("RouteTitle"),Le=class{constructor(t){a(this,"params");this.params=t||{}}has(t){return Object.prototype.hasOwnProperty.call(this.params,t)}get(t){if(this.has(t)){let i=this.params[t];return Array.isArray(i)?i[0]:i}return null}getAll(t){if(this.has(t)){let i=this.params[t];return Array.isArray(i)?i:[i]}return[]}get keys(){return Object.keys(this.params)}};function ht(e){return new Le(e)}function Pi(e,t,i){let n=i.path.split("/");if(n.length>e.length||i.pathMatch==="full"&&(t.hasChildren()||n.lengthn[o]===r)}else return e===t}function Bn(e){return e.length>0?e[e.length-1]:null}function W(e){return wr(e)?e:Gr(e)?N(Promise.resolve(e)):g(e)}var xi={exact:Wn,subset:Gn},Hn={exact:Ni,subset:ji,ignored:()=>!0};function Ln(e,t,i){return xi[i.paths](e.root,t.root,i.matrixParams)&&Hn[i.queryParams](e.queryParams,t.queryParams)&&!(i.fragment==="exact"&&e.fragment!==t.fragment)}function Ni(e,t){return F(e,t)}function Wn(e,t,i){if(!J(e.segments,t.segments)||!re(e.segments,t.segments,i)||e.numberOfChildren!==t.numberOfChildren)return!1;for(let n in t.children)if(!e.children[n]||!Wn(e.children[n],t.children[n],i))return!1;return!0}function ji(e,t){return Object.keys(t).length<=Object.keys(e).length&&Object.keys(t).every(i=>qn(e[i],t[i]))}function Gn(e,t,i){return Qn(e,t,t.segments,i)}function Qn(e,t,i,n){if(e.segments.length>i.length){let r=e.segments.slice(0,i.length);return!(!J(r,i)||t.hasChildren()||!re(r,i,n))}else if(e.segments.length===i.length){if(!J(e.segments,i)||!re(e.segments,i,n))return!1;for(let r in t.children)if(!e.children[r]||!Gn(e.children[r],t.children[r],n))return!1;return!0}else{let r=i.slice(0,e.segments.length),o=i.slice(e.segments.length);return!J(e.segments,r)||!re(e.segments,r,n)||!e.children[v]?!1:Qn(e.children[v],t,o,n)}}function re(e,t,i){return t.every((n,r)=>Hn[i](e[r].parameters,n.parameters))}var q=class{constructor(t=new S([],{}),i={},n=null){a(this,"root");a(this,"queryParams");a(this,"fragment");a(this,"_queryParamMap");this.root=t,this.queryParams=i,this.fragment=n}get queryParamMap(){return this._queryParamMap??(this._queryParamMap=ht(this.queryParams)),this._queryParamMap}toString(){return ki.serialize(this)}},S=class{constructor(t,i){a(this,"segments");a(this,"children");a(this,"parent",null);this.segments=t,this.children=i,Object.values(i).forEach(n=>n.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return ne(this)}},X=class{constructor(t,i){a(this,"path");a(this,"parameters");a(this,"_parameterMap");this.path=t,this.parameters=i}get parameterMap(){return this._parameterMap??(this._parameterMap=ht(this.parameters)),this._parameterMap}toString(){return Yn(this)}};function Li(e,t){return J(e,t)&&e.every((i,n)=>F(i.parameters,t[n].parameters))}function J(e,t){return e.length!==t.length?!1:e.every((i,n)=>i.path===t[n].path)}function $i(e,t){let i=[];return Object.entries(e.children).forEach(([n,r])=>{n===v&&(i=i.concat(t(r,n)))}),Object.entries(e.children).forEach(([n,r])=>{n!==v&&(i=i.concat(t(r,n)))}),i}var cr=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>new Ot,providedIn:"root"}));let e=t;return e})(),Ot=class{parse(t){let i=new ze(t);return new q(i.parseRootSegment(),i.parseQueryParams(),i.parseFragment())}serialize(t){let i=`/${bt(t.root,!0)}`,n=_i(t.queryParams),r=typeof t.fragment=="string"?`#${zi(t.fragment)}`:"";return`${i}${n}${r}`}},ki=new Ot;function ne(e){return e.segments.map(t=>Yn(t)).join("/")}function bt(e,t){if(!e.hasChildren())return ne(e);if(t){let i=e.children[v]?bt(e.children[v],!1):"",n=[];return Object.entries(e.children).forEach(([r,o])=>{r!==v&&n.push(`${r}:${bt(o,!1)}`)}),n.length>0?`${i}(${n.join("//")})`:i}else{let i=$i(e,(n,r)=>r===v?[bt(e.children[v],!1)]:[`${r}:${bt(n,!1)}`]);return Object.keys(e.children).length===1&&e.children[v]!=null?`${ne(e)}/${i[0]}`:`${ne(e)}/(${i.join("//")})`}}function Zn(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function te(e){return Zn(e).replace(/%3B/gi,";")}function zi(e){return encodeURI(e)}function ke(e){return Zn(e).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function ie(e){return decodeURIComponent(e)}function $n(e){return ie(e.replace(/\+/g,"%20"))}function Yn(e){return`${ke(e.path)}${Fi(e.parameters)}`}function Fi(e){return Object.entries(e).map(([t,i])=>`;${ke(t)}=${ke(i)}`).join("")}function _i(e){let t=Object.entries(e).map(([i,n])=>Array.isArray(n)?n.map(r=>`${te(i)}=${te(r)}`).join("&"):`${te(i)}=${te(n)}`).filter(i=>i);return t.length?`?${t.join("&")}`:""}var Vi=/^[^\/()?;#]+/;function Ue(e){let t=e.match(Vi);return t?t[0]:""}var qi=/^[^\/()?;=#]+/;function Bi(e){let t=e.match(qi);return t?t[0]:""}var Hi=/^[^=?&#]+/;function Wi(e){let t=e.match(Hi);return t?t[0]:""}var Gi=/^[^&#]+/;function Qi(e){let t=e.match(Gi);return t?t[0]:""}var ze=class{constructor(t){a(this,"url");a(this,"remaining");this.url=t,this.remaining=t}parseRootSegment(){return this.consumeOptional("/"),this.remaining===""||this.peekStartsWith("?")||this.peekStartsWith("#")?new S([],{}):new S([],this.parseChildren())}parseQueryParams(){let t={};if(this.consumeOptional("?"))do this.parseQueryParam(t);while(this.consumeOptional("&"));return t}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(){if(this.remaining==="")return{};this.consumeOptional("/");let t=[];for(this.peekStartsWith("(")||t.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),t.push(this.parseSegment());let i={};this.peekStartsWith("/(")&&(this.capture("/"),i=this.parseParens(!0));let n={};return this.peekStartsWith("(")&&(n=this.parseParens(!1)),(t.length>0||Object.keys(i).length>0)&&(n[v]=new S(t,i)),n}parseSegment(){let t=Ue(this.remaining);if(t===""&&this.peekStartsWith(";"))throw new D(4009,!1);return this.capture(t),new X(ie(t),this.parseMatrixParams())}parseMatrixParams(){let t={};for(;this.consumeOptional(";");)this.parseParam(t);return t}parseParam(t){let i=Bi(this.remaining);if(!i)return;this.capture(i);let n="";if(this.consumeOptional("=")){let r=Ue(this.remaining);r&&(n=r,this.capture(n))}t[ie(i)]=ie(n)}parseQueryParam(t){let i=Wi(this.remaining);if(!i)return;this.capture(i);let n="";if(this.consumeOptional("=")){let s=Qi(this.remaining);s&&(n=s,this.capture(n))}let r=$n(i),o=$n(n);if(t.hasOwnProperty(r)){let s=t[r];Array.isArray(s)||(s=[s],t[r]=s),s.push(o)}else t[r]=o}parseParens(t){let i={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){let n=Ue(this.remaining),r=this.remaining[n.length];if(r!=="/"&&r!==")"&&r!==";")throw new D(4010,!1);let o;n.indexOf(":")>-1?(o=n.slice(0,n.indexOf(":")),this.capture(o),this.capture(":")):t&&(o=v);let s=this.parseChildren();i[o]=Object.keys(s).length===1?s[v]:new S([],s),this.consumeOptional("//")}return i}peekStartsWith(t){return this.remaining.startsWith(t)}consumeOptional(t){return this.peekStartsWith(t)?(this.remaining=this.remaining.substring(t.length),!0):!1}capture(t){if(!this.consumeOptional(t))throw new D(4011,!1)}};function Kn(e){return e.segments.length>0?new S([],{[v]:e}):e}function Xn(e){let t={};for(let[n,r]of Object.entries(e.children)){let o=Xn(r);if(n===v&&o.segments.length===0&&o.hasChildren())for(let[s,u]of Object.entries(o.children))t[s]=u;else(o.segments.length>0||o.hasChildren())&&(t[n]=o)}let i=new S(e.segments,t);return Zi(i)}function Zi(e){if(e.numberOfChildren===1&&e.children[v]){let t=e.children[v];return new S(e.segments.concat(t.segments),t.children)}return e}function Et(e){return e instanceof q}function Yi(e,t,i=null,n=null){let r=Jn(e);return ti(r,t,i,n)}function Jn(e){let t;function i(o){let s={};for(let l of o.children){let c=i(l);s[l.outlet]=c}let u=new S(o.url,s);return o===e&&(t=u),u}let n=i(e.root),r=Kn(n);return t??r}function ti(e,t,i,n){let r=e;for(;r.parent;)r=r.parent;if(t.length===0)return xe(r,r,r,i,n);let o=Ki(t);if(o.toRoot())return xe(r,r,new S([],{}),i,n);let s=Xi(o,r,e),u=s.processChildren?At(s.segmentGroup,s.index,o.commands):ri(s.segmentGroup,s.index,o.commands);return xe(r,s.segmentGroup,u,i,n)}function oe(e){return typeof e=="object"&&e!=null&&!e.outlets&&!e.segmentPath}function Pt(e){return typeof e=="object"&&e!=null&&e.outlets}function xe(e,t,i,n,r){let o={};n&&Object.entries(n).forEach(([l,c])=>{o[l]=Array.isArray(c)?c.map(d=>`${d}`):`${c}`});let s;e===t?s=i:s=ei(e,t,i);let u=Kn(Xn(s));return new q(u,o,r)}function ei(e,t,i){let n={};return Object.entries(e.children).forEach(([r,o])=>{o===t?n[r]=i:n[r]=ei(o,t,i)}),new S(e.segments,n)}var se=class{constructor(t,i,n){a(this,"isAbsolute");a(this,"numberOfDoubleDots");a(this,"commands");if(this.isAbsolute=t,this.numberOfDoubleDots=i,this.commands=n,t&&n.length>0&&oe(n[0]))throw new D(4003,!1);let r=n.find(Pt);if(r&&r!==Bn(n))throw new D(4004,!1)}toRoot(){return this.isAbsolute&&this.commands.length===1&&this.commands[0]=="/"}};function Ki(e){if(typeof e[0]=="string"&&e.length===1&&e[0]==="/")return new se(!0,0,e);let t=0,i=!1,n=e.reduce((r,o,s)=>{if(typeof o=="object"&&o!=null){if(o.outlets){let u={};return Object.entries(o.outlets).forEach(([l,c])=>{u[l]=typeof c=="string"?c.split("/"):c}),[...r,{outlets:u}]}if(o.segmentPath)return[...r,o.segmentPath]}return typeof o!="string"?[...r,o]:s===0?(o.split("/").forEach((u,l)=>{l==0&&u==="."||(l==0&&u===""?i=!0:u===".."?t++:u!=""&&r.push(u))}),r):[...r,o]},[]);return new se(i,t,n)}var ct=class{constructor(t,i,n){a(this,"segmentGroup");a(this,"processChildren");a(this,"index");this.segmentGroup=t,this.processChildren=i,this.index=n}};function Xi(e,t,i){if(e.isAbsolute)return new ct(t,!0,0);if(!i)return new ct(t,!1,NaN);if(i.parent===null)return new ct(i,!0,0);let n=oe(e.commands[0])?0:1,r=i.segments.length-1+n;return Ji(i,r,e.numberOfDoubleDots)}function Ji(e,t,i){let n=e,r=t,o=i;for(;o>r;){if(o-=r,n=n.parent,!n)throw new D(4005,!1);r=n.segments.length}return new ct(n,!1,r-o)}function to(e){return Pt(e[0])?e[0].outlets:{[v]:e}}function ri(e,t,i){if(e??(e=new S([],{})),e.segments.length===0&&e.hasChildren())return At(e,t,i);let n=eo(e,t,i),r=i.slice(n.commandIndex);if(n.match&&n.pathIndexo!==v)&&e.children[v]&&e.numberOfChildren===1&&e.children[v].segments.length===0){let o=At(e.children[v],t,i);return new S(e.segments,o.children)}return Object.entries(n).forEach(([o,s])=>{typeof s=="string"&&(s=[s]),s!==null&&(r[o]=ri(e.children[o],t,s))}),Object.entries(e.children).forEach(([o,s])=>{n[o]===void 0&&(r[o]=s)}),new S(e.segments,r)}}function eo(e,t,i){let n=0,r=t,o={match:!1,pathIndex:0,commandIndex:0};for(;r=i.length)return o;let s=e.segments[r],u=i[n];if(Pt(u))break;let l=`${u}`,c=n0&&l===void 0)break;if(l&&c&&typeof c=="object"&&c.outlets===void 0){if(!zn(l,c,s))return o;n+=2}else{if(!zn(l,{},s))return o;n++}r++}return{match:!0,pathIndex:r,commandIndex:n}}function Fe(e,t,i){let n=e.segments.slice(0,t),r=0;for(;r{typeof n=="string"&&(n=[n]),n!==null&&(t[i]=Fe(new S([],{}),0,n))}),t}function kn(e){let t={};return Object.entries(e).forEach(([i,n])=>t[i]=`${n}`),t}function zn(e,t,i){return e==i.path&&F(t,i.parameters)}var Tt="imperative",b=function(e){return e[e.NavigationStart=0]="NavigationStart",e[e.NavigationEnd=1]="NavigationEnd",e[e.NavigationCancel=2]="NavigationCancel",e[e.NavigationError=3]="NavigationError",e[e.RoutesRecognized=4]="RoutesRecognized",e[e.ResolveStart=5]="ResolveStart",e[e.ResolveEnd=6]="ResolveEnd",e[e.GuardsCheckStart=7]="GuardsCheckStart",e[e.GuardsCheckEnd=8]="GuardsCheckEnd",e[e.RouteConfigLoadStart=9]="RouteConfigLoadStart",e[e.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",e[e.ChildActivationStart=11]="ChildActivationStart",e[e.ChildActivationEnd=12]="ChildActivationEnd",e[e.ActivationStart=13]="ActivationStart",e[e.ActivationEnd=14]="ActivationEnd",e[e.Scroll=15]="Scroll",e[e.NavigationSkipped=16]="NavigationSkipped",e}(b||{}),P=class{constructor(t,i){a(this,"id");a(this,"url");this.id=t,this.url=i}},Ut=class extends P{constructor(i,n,r="imperative",o=null){super(i,n);a(this,"type",b.NavigationStart);a(this,"navigationTrigger");a(this,"restoredState");this.navigationTrigger=r,this.restoredState=o}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}},tt=class extends P{constructor(i,n,r){super(i,n);a(this,"urlAfterRedirects");a(this,"type",b.NavigationEnd);this.urlAfterRedirects=r}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}},M=function(e){return e[e.Redirect=0]="Redirect",e[e.SupersededByNewNavigation=1]="SupersededByNewNavigation",e[e.NoDataFromResolver=2]="NoDataFromResolver",e[e.GuardRejected=3]="GuardRejected",e}(M||{}),_e=function(e){return e[e.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",e[e.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",e}(_e||{}),V=class extends P{constructor(i,n,r,o){super(i,n);a(this,"reason");a(this,"code");a(this,"type",b.NavigationCancel);this.reason=r,this.code=o}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}},et=class extends P{constructor(i,n,r,o){super(i,n);a(this,"reason");a(this,"code");a(this,"type",b.NavigationSkipped);this.reason=r,this.code=o}},xt=class extends P{constructor(i,n,r,o){super(i,n);a(this,"error");a(this,"target");a(this,"type",b.NavigationError);this.error=r,this.target=o}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}},ae=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.RoutesRecognized);this.urlAfterRedirects=r,this.state=o}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},Ve=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.GuardsCheckStart);this.urlAfterRedirects=r,this.state=o}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},qe=class extends P{constructor(i,n,r,o,s){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"shouldActivate");a(this,"type",b.GuardsCheckEnd);this.urlAfterRedirects=r,this.state=o,this.shouldActivate=s}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}},Be=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.ResolveStart);this.urlAfterRedirects=r,this.state=o}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},He=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.ResolveEnd);this.urlAfterRedirects=r,this.state=o}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},We=class{constructor(t){a(this,"route");a(this,"type",b.RouteConfigLoadStart);this.route=t}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}},Ge=class{constructor(t){a(this,"route");a(this,"type",b.RouteConfigLoadEnd);this.route=t}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}},Qe=class{constructor(t){a(this,"snapshot");a(this,"type",b.ChildActivationStart);this.snapshot=t}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ze=class{constructor(t){a(this,"snapshot");a(this,"type",b.ChildActivationEnd);this.snapshot=t}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ye=class{constructor(t){a(this,"snapshot");a(this,"type",b.ActivationStart);this.snapshot=t}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ke=class{constructor(t){a(this,"snapshot");a(this,"type",b.ActivationEnd);this.snapshot=t}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}};var Nt=class{},pt=class{constructor(t,i){a(this,"url");a(this,"navigationBehaviorOptions");this.url=t,this.navigationBehaviorOptions=i}};function no(e,t){return e.providers&&!e._injector&&(e._injector=Vr(e.providers,t,`Route: ${e.path}`)),e._injector??t}function L(e){return e.outlet||v}function io(e,t){let i=e.filter(n=>L(n)===t);return i.push(...e.filter(n=>L(n)!==t)),i}function Ft(e){var t;if(!e)return null;if((t=e.routeConfig)!=null&&t._injector)return e.routeConfig._injector;for(let i=e.parent;i;i=i.parent){let n=i.routeConfig;if(n!=null&&n._loadedInjector)return n._loadedInjector;if(n!=null&&n._injector)return n._injector}return null}var Xe=class{constructor(t){a(this,"rootInjector");a(this,"outlet",null);a(this,"route",null);a(this,"children");a(this,"attachRef",null);this.rootInjector=t,this.children=new fe(this.rootInjector)}get injector(){var t;return Ft((t=this.route)==null?void 0:t.snapshot)??this.rootInjector}},fe=(()=>{let t=class t{constructor(n){a(this,"rootInjector");a(this,"contexts",new Map);this.rootInjector=n}onChildOutletCreated(n,r){let o=this.getOrCreateContext(n);o.outlet=r,this.contexts.set(n,o)}onChildOutletDestroyed(n){let r=this.getContext(n);r&&(r.outlet=null,r.attachRef=null)}onOutletDeactivated(){let n=this.contexts;return this.contexts=new Map,n}onOutletReAttached(n){this.contexts=n}getOrCreateContext(n){let r=this.getContext(n);return r||(r=new Xe(this.rootInjector),this.contexts.set(n,r)),r}getContext(n){return this.contexts.get(n)||null}};a(t,"\u0275fac",function(r){return new(r||t)(Q(Wt))}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),ue=class{constructor(t){a(this,"_root");this._root=t}get root(){return this._root.value}parent(t){let i=this.pathFromRoot(t);return i.length>1?i[i.length-2]:null}children(t){let i=Je(t,this._root);return i?i.children.map(n=>n.value):[]}firstChild(t){let i=Je(t,this._root);return i&&i.children.length>0?i.children[0].value:null}siblings(t){let i=tr(t,this._root);return i.length<2?[]:i[i.length-2].children.map(r=>r.value).filter(r=>r!==t)}pathFromRoot(t){return tr(t,this._root).map(i=>i.value)}};function Je(e,t){if(e===t.value)return t;for(let i of t.children){let n=Je(e,i);if(n)return n}return null}function tr(e,t){if(e===t.value)return[t];for(let i of t.children){let n=tr(e,i);if(n.length)return n.unshift(t),n}return[]}var T=class{constructor(t,i){a(this,"value");a(this,"children");this.value=t,this.children=i}toString(){return`TreeNode(${this.value})`}};function ut(e){let t={};return e&&e.children.forEach(i=>t[i.value.outlet]=i),t}var ce=class extends ue{constructor(i,n){super(i);a(this,"snapshot");this.snapshot=n,lr(this,i)}toString(){return this.snapshot.toString()}};function ni(e){let t=oo(e),i=new O([new X("",{})]),n=new O({}),r=new O({}),o=new O({}),s=new O(""),u=new ft(i,n,o,s,r,v,e,t.root);return u.snapshot=t.root,new ce(new T(u,[]),t)}function oo(e){let t={},i={},n={},r="",o=new lt([],t,n,r,i,v,e,null,{});return new de("",new T(o,[]))}var ft=class{constructor(t,i,n,r,o,s,u,l){a(this,"urlSubject");a(this,"paramsSubject");a(this,"queryParamsSubject");a(this,"fragmentSubject");a(this,"dataSubject");a(this,"outlet");a(this,"component");a(this,"snapshot");a(this,"_futureSnapshot");a(this,"_routerState");a(this,"_paramMap");a(this,"_queryParamMap");a(this,"title");a(this,"url");a(this,"params");a(this,"queryParams");a(this,"fragment");a(this,"data");var c;this.urlSubject=t,this.paramsSubject=i,this.queryParamsSubject=n,this.fragmentSubject=r,this.dataSubject=o,this.outlet=s,this.component=u,this._futureSnapshot=l,this.title=((c=this.dataSubject)==null?void 0:c.pipe(y(d=>d[zt])))??g(void 0),this.url=t,this.params=i,this.queryParams=n,this.fragment=r,this.data=o}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??(this._paramMap=this.params.pipe(y(t=>ht(t)))),this._paramMap}get queryParamMap(){return this._queryParamMap??(this._queryParamMap=this.queryParams.pipe(y(t=>ht(t)))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}};function le(e,t,i="emptyOnly"){var o;let n,{routeConfig:r}=e;return t!==null&&(i==="always"||(r==null?void 0:r.path)===""||!t.component&&!((o=t.routeConfig)!=null&&o.loadComponent))?n={params:f(f({},t.params),e.params),data:f(f({},t.data),e.data),resolve:f(f(f(f({},e.data),t.data),r==null?void 0:r.data),e._resolvedData)}:n={params:f({},e.params),data:f({},e.data),resolve:f(f({},e.data),e._resolvedData??{})},r&&oi(r)&&(n.resolve[zt]=r.title),n}var lt=class{constructor(t,i,n,r,o,s,u,l,c){a(this,"url");a(this,"params");a(this,"queryParams");a(this,"fragment");a(this,"data");a(this,"outlet");a(this,"component");a(this,"routeConfig");a(this,"_resolve");a(this,"_resolvedData");a(this,"_routerState");a(this,"_paramMap");a(this,"_queryParamMap");this.url=t,this.params=i,this.queryParams=n,this.fragment=r,this.data=o,this.outlet=s,this.component=u,this.routeConfig=l,this._resolve=c}get title(){var t;return(t=this.data)==null?void 0:t[zt]}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??(this._paramMap=ht(this.params)),this._paramMap}get queryParamMap(){return this._queryParamMap??(this._queryParamMap=ht(this.queryParams)),this._queryParamMap}toString(){let t=this.url.map(n=>n.toString()).join("/"),i=this.routeConfig?this.routeConfig.path:"";return`Route(url:'${t}', path:'${i}')`}},de=class extends ue{constructor(i,n){super(n);a(this,"url");this.url=i,lr(this,n)}toString(){return ii(this._root)}};function lr(e,t){t.value._routerState=e,t.children.forEach(i=>lr(e,i))}function ii(e){let t=e.children.length>0?` { ${e.children.map(ii).join(", ")} } `:"";return`${e.value}${t}`}function Ne(e){if(e.snapshot){let t=e.snapshot,i=e._futureSnapshot;e.snapshot=i,F(t.queryParams,i.queryParams)||e.queryParamsSubject.next(i.queryParams),t.fragment!==i.fragment&&e.fragmentSubject.next(i.fragment),F(t.params,i.params)||e.paramsSubject.next(i.params),Ui(t.url,i.url)||e.urlSubject.next(i.url),F(t.data,i.data)||e.dataSubject.next(i.data)}else e.snapshot=e._futureSnapshot,e.dataSubject.next(e._futureSnapshot.data)}function er(e,t){let i=F(e.params,t.params)&&Li(e.url,t.url),n=!e.parent!=!t.parent;return i&&!n&&(!e.parent||er(e.parent,t.parent))}function oi(e){return typeof e.title=="string"||e.title===null}var so=new j(""),dr=(()=>{let t=class t{constructor(){a(this,"activated",null);a(this,"_activatedRoute",null);a(this,"name",v);a(this,"activateEvents",new Ct);a(this,"deactivateEvents",new Ct);a(this,"attachEvents",new Ct);a(this,"detachEvents",new Ct);a(this,"routerOutletData",Lr(void 0));a(this,"parentContexts",h(fe));a(this,"location",h(Fr));a(this,"changeDetector",h(Oe));a(this,"inputBinder",h(hr,{optional:!0}));a(this,"supportsBindingToComponentInputs",!0)}get activatedComponentRef(){return this.activated}ngOnChanges(n){if(n.name){let{firstChange:r,previousValue:o}=n.name;if(r)return;this.isTrackedInParentContexts(o)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(o)),this.initializeOutletWithName()}}ngOnDestroy(){var n;this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),(n=this.inputBinder)==null||n.unsubscribeFromRouteData(this)}isTrackedInParentContexts(n){var r;return((r=this.parentContexts.getContext(n))==null?void 0:r.outlet)===this}ngOnInit(){this.initializeOutletWithName()}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;let n=this.parentContexts.getContext(this.name);n!=null&&n.route&&(n.attachRef?this.attach(n.attachRef,n.route):this.activateWith(n.route,n.injector))}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new D(4012,!1);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new D(4012,!1);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new D(4012,!1);this.location.detach();let n=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(n.instance),n}attach(n,r){var o;this.activated=n,this._activatedRoute=r,this.location.insert(n.hostView),(o=this.inputBinder)==null||o.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(n.instance)}deactivate(){if(this.activated){let n=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(n)}}activateWith(n,r){var d;if(this.isActivated)throw new D(4013,!1);this._activatedRoute=n;let o=this.location,u=n.snapshot.component,l=this.parentContexts.getOrCreateContext(this.name).children,c=new rr(n,l,o.injector,this.routerOutletData);this.activated=o.createComponent(u,{index:o.length,injector:c,environmentInjector:r}),this.changeDetector.markForCheck(),(d=this.inputBinder)==null||d.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance)}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275dir",Z({type:t,selectors:[["router-outlet"]],inputs:{name:"name",routerOutletData:[1,"routerOutletData"]},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],features:[xr]}));let e=t;return e})(),rr=class e{constructor(t,i,n,r){a(this,"route");a(this,"childContexts");a(this,"parent");a(this,"outletData");this.route=t,this.childContexts=i,this.parent=n,this.outletData=r}__ngOutletInjector(t){return new e(this.route,this.childContexts,t,this.outletData)}get(t,i){return t===ft?this.route:t===fe?this.childContexts:t===so?this.outletData:this.parent.get(t,i)}},hr=new j("");function ao(e,t,i){let n=jt(e,t._root,i?i._root:void 0);return new ce(n,t)}function jt(e,t,i){if(i&&e.shouldReuseRoute(t.value,i.value.snapshot)){let n=i.value;n._futureSnapshot=t.value;let r=uo(e,t,i);return new T(n,r)}else{if(e.shouldAttach(t.value)){let o=e.retrieve(t.value);if(o!==null){let s=o.route;return s.value._futureSnapshot=t.value,s.children=t.children.map(u=>jt(e,u)),s}}let n=co(t.value),r=t.children.map(o=>jt(e,o));return new T(n,r)}}function uo(e,t,i){return t.children.map(n=>{for(let r of i.children)if(e.shouldReuseRoute(n.value,r.value.snapshot))return jt(e,n,r);return jt(e,n)})}function co(e){return new ft(new O(e.url),new O(e.params),new O(e.queryParams),new O(e.fragment),new O(e.data),e.outlet,e.component,e)}var Lt=class{constructor(t,i){a(this,"redirectTo");a(this,"navigationBehaviorOptions");this.redirectTo=t,this.navigationBehaviorOptions=i}},si="ngNavigationCancelingError";function he(e,t){let{redirectTo:i,navigationBehaviorOptions:n}=Et(t)?{redirectTo:t,navigationBehaviorOptions:void 0}:t,r=ai(!1,M.Redirect);return r.url=i,r.navigationBehaviorOptions=n,r}function ai(e,t){let i=new Error(`NavigationCancelingError: ${e||""}`);return i[si]=!0,i.cancellationCode=t,i}function lo(e){return ui(e)&&Et(e.url)}function ui(e){return!!e&&e[si]}var ho=(e,t,i,n)=>y(r=>(new nr(t,r.targetRouterState,r.currentRouterState,i,n).activate(e),r)),nr=class{constructor(t,i,n,r,o){a(this,"routeReuseStrategy");a(this,"futureState");a(this,"currState");a(this,"forwardEvent");a(this,"inputBindingEnabled");this.routeReuseStrategy=t,this.futureState=i,this.currState=n,this.forwardEvent=r,this.inputBindingEnabled=o}activate(t){let i=this.futureState._root,n=this.currState?this.currState._root:null;this.deactivateChildRoutes(i,n,t),Ne(this.futureState.root),this.activateChildRoutes(i,n,t)}deactivateChildRoutes(t,i,n){let r=ut(i);t.children.forEach(o=>{let s=o.value.outlet;this.deactivateRoutes(o,r[s],n),delete r[s]}),Object.values(r).forEach(o=>{this.deactivateRouteAndItsChildren(o,n)})}deactivateRoutes(t,i,n){let r=t.value,o=i?i.value:null;if(r===o)if(r.component){let s=n.getContext(r.outlet);s&&this.deactivateChildRoutes(t,i,s.children)}else this.deactivateChildRoutes(t,i,n);else o&&this.deactivateRouteAndItsChildren(i,n)}deactivateRouteAndItsChildren(t,i){t.value.component&&this.routeReuseStrategy.shouldDetach(t.value.snapshot)?this.detachAndStoreRouteSubtree(t,i):this.deactivateRouteAndOutlet(t,i)}detachAndStoreRouteSubtree(t,i){let n=i.getContext(t.value.outlet),r=n&&t.value.component?n.children:i,o=ut(t);for(let s of Object.values(o))this.deactivateRouteAndItsChildren(s,r);if(n&&n.outlet){let s=n.outlet.detach(),u=n.children.onOutletDeactivated();this.routeReuseStrategy.store(t.value.snapshot,{componentRef:s,route:t,contexts:u})}}deactivateRouteAndOutlet(t,i){let n=i.getContext(t.value.outlet),r=n&&t.value.component?n.children:i,o=ut(t);for(let s of Object.values(o))this.deactivateRouteAndItsChildren(s,r);n&&(n.outlet&&(n.outlet.deactivate(),n.children.onOutletDeactivated()),n.attachRef=null,n.route=null)}activateChildRoutes(t,i,n){let r=ut(i);t.children.forEach(o=>{this.activateRoutes(o,r[o.value.outlet],n),this.forwardEvent(new Ke(o.value.snapshot))}),t.children.length&&this.forwardEvent(new Ze(t.value.snapshot))}activateRoutes(t,i,n){let r=t.value,o=i?i.value:null;if(Ne(r),r===o)if(r.component){let s=n.getOrCreateContext(r.outlet);this.activateChildRoutes(t,i,s.children)}else this.activateChildRoutes(t,i,n);else if(r.component){let s=n.getOrCreateContext(r.outlet);if(this.routeReuseStrategy.shouldAttach(r.snapshot)){let u=this.routeReuseStrategy.retrieve(r.snapshot);this.routeReuseStrategy.store(r.snapshot,null),s.children.onOutletReAttached(u.contexts),s.attachRef=u.componentRef,s.route=u.route.value,s.outlet&&s.outlet.attach(u.componentRef,u.route.value),Ne(u.route.value),this.activateChildRoutes(t,null,s.children)}else s.attachRef=null,s.route=r,s.outlet&&s.outlet.activateWith(r,s.injector),this.activateChildRoutes(t,null,s.children)}else this.activateChildRoutes(t,null,n)}},pe=class{constructor(t){a(this,"path");a(this,"route");this.path=t,this.route=this.path[this.path.length-1]}},dt=class{constructor(t,i){a(this,"component");a(this,"route");this.component=t,this.route=i}};function po(e,t,i){let n=e._root,r=t?t._root:null;return It(n,r,i,[n.value])}function fo(e){let t=e.routeConfig?e.routeConfig.canActivateChild:null;return!t||t.length===0?null:{node:e,guards:t}}function vt(e,t){let i=Symbol(),n=t.get(e,i);return n===i?typeof e=="function"&&!Or(e)?e:t.get(e):n}function It(e,t,i,n,r={canDeactivateChecks:[],canActivateChecks:[]}){let o=ut(t);return e.children.forEach(s=>{go(s,o[s.value.outlet],i,n.concat([s.value]),r),delete o[s.value.outlet]}),Object.entries(o).forEach(([s,u])=>Mt(u,i.getContext(s),r)),r}function go(e,t,i,n,r={canDeactivateChecks:[],canActivateChecks:[]}){let o=e.value,s=t?t.value:null,u=i?i.getContext(e.value.outlet):null;if(s&&o.routeConfig===s.routeConfig){let l=vo(s,o,o.routeConfig.runGuardsAndResolvers);l?r.canActivateChecks.push(new pe(n)):(o.data=s.data,o._resolvedData=s._resolvedData),o.component?It(e,t,u?u.children:null,n,r):It(e,t,i,n,r),l&&u&&u.outlet&&u.outlet.isActivated&&r.canDeactivateChecks.push(new dt(u.outlet.component,s))}else s&&Mt(t,u,r),r.canActivateChecks.push(new pe(n)),o.component?It(e,null,u?u.children:null,n,r):It(e,null,i,n,r);return r}function vo(e,t,i){if(typeof i=="function")return i(e,t);switch(i){case"pathParamsChange":return!J(e.url,t.url);case"pathParamsOrQueryParamsChange":return!J(e.url,t.url)||!F(e.queryParams,t.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!er(e,t)||!F(e.queryParams,t.queryParams);case"paramsChange":default:return!er(e,t)}}function Mt(e,t,i){let n=ut(e),r=e.value;Object.entries(n).forEach(([o,s])=>{r.component?t?Mt(s,t.children.getContext(o),i):Mt(s,null,i):Mt(s,t,i)}),r.component?t&&t.outlet&&t.outlet.isActivated?i.canDeactivateChecks.push(new dt(t.outlet.component,r)):i.canDeactivateChecks.push(new dt(null,r)):i.canDeactivateChecks.push(new dt(null,r))}function _t(e){return typeof e=="function"}function mo(e){return typeof e=="boolean"}function yo(e){return e&&_t(e.canLoad)}function So(e){return e&&_t(e.canActivate)}function wo(e){return e&&_t(e.canActivateChild)}function Co(e){return e&&_t(e.canDeactivate)}function Ro(e){return e&&_t(e.canMatch)}function ci(e){return e instanceof Cr||(e==null?void 0:e.name)==="EmptyError"}var ee=Symbol("INITIAL_VALUE");function gt(){return k(e=>Se(e.map(t=>t.pipe(it(1),Ht(ee)))).pipe(y(t=>{for(let i of t)if(i!==!0){if(i===ee)return ee;if(i===!1||bo(i))return i}return!0}),B(t=>t!==ee),it(1)))}function bo(e){return Et(e)||e instanceof Lt}function Io(e,t){return E(i=>{let{targetSnapshot:n,currentSnapshot:r,guards:{canActivateChecks:o,canDeactivateChecks:s}}=i;return s.length===0&&o.length===0?g(A(f({},i),{guardsResult:!0})):Do(s,n,r,e).pipe(E(u=>u&&mo(u)?Ao(n,o,e,t):g(u)),y(u=>A(f({},i),{guardsResult:u})))})}function Do(e,t,i,n){return N(e).pipe(E(r=>Po(r.component,r.route,i,t,n)),H(r=>r!==!0,!0))}function Ao(e,t,i,n){return N(t).pipe(St(r=>Rr(Mo(r.route.parent,n),To(r.route,n),Eo(e,r.path,i),Oo(e,r.route,i))),H(r=>r!==!0,!0))}function To(e,t){return e!==null&&t&&t(new Ye(e)),g(!0)}function Mo(e,t){return e!==null&&t&&t(new Qe(e)),g(!0)}function Oo(e,t,i){let n=t.routeConfig?t.routeConfig.canActivate:null;if(!n||n.length===0)return g(!0);let r=n.map(o=>we(()=>{let s=Ft(t)??i,u=vt(o,s),l=So(u)?u.canActivate(t,e):_(s,()=>u(t,e));return W(l).pipe(H())}));return g(r).pipe(gt())}function Eo(e,t,i){let n=t[t.length-1],o=t.slice(0,t.length-1).reverse().map(s=>fo(s)).filter(s=>s!==null).map(s=>we(()=>{let u=s.guards.map(l=>{let c=Ft(s.node)??i,d=vt(l,c),m=wo(d)?d.canActivateChild(n,e):_(c,()=>d(n,e));return W(m).pipe(H())});return g(u).pipe(gt())}));return g(o).pipe(gt())}function Po(e,t,i,n,r){let o=t&&t.routeConfig?t.routeConfig.canDeactivate:null;if(!o||o.length===0)return g(!0);let s=o.map(u=>{let l=Ft(t)??r,c=vt(u,l),d=Co(c)?c.canDeactivate(e,t,i,n):_(l,()=>c(e,t,i,n));return W(d).pipe(H())});return g(s).pipe(gt())}function Uo(e,t,i,n){let r=t.canLoad;if(r===void 0||r.length===0)return g(!0);let o=r.map(s=>{let u=vt(s,e),l=yo(u)?u.canLoad(t,i):_(e,()=>u(t,i));return W(l)});return g(o).pipe(gt(),li(n))}function li(e){return yr(I(t=>{if(typeof t!="boolean")throw he(e,t)}),y(t=>t===!0))}function xo(e,t,i,n){let r=t.canMatch;if(!r||r.length===0)return g(!0);let o=r.map(s=>{let u=vt(s,e),l=Ro(u)?u.canMatch(t,i):_(e,()=>u(t,i));return W(l)});return g(o).pipe(gt(),li(n))}var $t=class{constructor(t){a(this,"segmentGroup");this.segmentGroup=t||null}},kt=class extends Error{constructor(i){super();a(this,"urlTree");this.urlTree=i}};function at(e){return yt(new $t(e))}function No(e){return yt(new D(4e3,!1))}function jo(e){return yt(ai(!1,M.GuardRejected))}var ir=class{constructor(t,i){a(this,"urlSerializer");a(this,"urlTree");this.urlSerializer=t,this.urlTree=i}lineralizeSegments(t,i){let n=[],r=i.root;for(;;){if(n=n.concat(r.segments),r.numberOfChildren===0)return g(n);if(r.numberOfChildren>1||!r.children[v])return No(`${t.redirectTo}`);r=r.children[v]}}applyRedirectCommands(t,i,n,r,o){if(typeof i!="string"){let u=i,{queryParams:l,fragment:c,routeConfig:d,url:m,outlet:p,params:w,data:C,title:U}=r,x=_(o,()=>u({params:w,data:C,queryParams:l,fragment:c,routeConfig:d,url:m,outlet:p,title:U}));if(x instanceof q)throw new kt(x);i=x}let s=this.applyRedirectCreateUrlTree(i,this.urlSerializer.parse(i),t,n);if(i[0]==="/")throw new kt(s);return s}applyRedirectCreateUrlTree(t,i,n,r){let o=this.createSegmentGroup(t,i.root,n,r);return new q(o,this.createQueryParams(i.queryParams,this.urlTree.queryParams),i.fragment)}createQueryParams(t,i){let n={};return Object.entries(t).forEach(([r,o])=>{if(typeof o=="string"&&o[0]===":"){let u=o.substring(1);n[r]=i[u]}else n[r]=o}),n}createSegmentGroup(t,i,n,r){let o=this.createSegments(t,i.segments,n,r),s={};return Object.entries(i.children).forEach(([u,l])=>{s[u]=this.createSegmentGroup(t,l,n,r)}),new S(o,s)}createSegments(t,i,n,r){return i.map(o=>o.path[0]===":"?this.findPosParam(t,o,r):this.findOrReturn(o,n))}findPosParam(t,i,n){let r=n[i.path.substring(1)];if(!r)throw new D(4001,!1);return r}findOrReturn(t,i){let n=0;for(let r of i){if(r.path===t.path)return i.splice(n),r;n++}return t}},or={matched:!1,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function Lo(e,t,i,n,r){let o=di(e,t,i);return o.matched?(n=no(t,n),xo(n,t,i,r).pipe(y(s=>s===!0?o:f({},or)))):g(o)}function di(e,t,i){if(t.path==="**")return $o(i);if(t.path==="")return t.pathMatch==="full"&&(e.hasChildren()||i.length>0)?f({},or):{matched:!0,consumedSegments:[],remainingSegments:i,parameters:{},positionalParamSegments:{}};let r=(t.matcher||Pi)(i,e,t);if(!r)return f({},or);let o={};Object.entries(r.posParams??{}).forEach(([u,l])=>{o[u]=l.path});let s=r.consumed.length>0?f(f({},o),r.consumed[r.consumed.length-1].parameters):o;return{matched:!0,consumedSegments:r.consumed,remainingSegments:i.slice(r.consumed.length),parameters:s,positionalParamSegments:r.posParams??{}}}function $o(e){return{matched:!0,parameters:e.length>0?Bn(e).parameters:{},consumedSegments:e,remainingSegments:[],positionalParamSegments:{}}}function Fn(e,t,i,n){return i.length>0&&Fo(e,i,n)?{segmentGroup:new S(t,zo(n,new S(i,e.children))),slicedSegments:[]}:i.length===0&&_o(e,i,n)?{segmentGroup:new S(e.segments,ko(e,i,n,e.children)),slicedSegments:i}:{segmentGroup:new S(e.segments,e.children),slicedSegments:i}}function ko(e,t,i,n){let r={};for(let o of i)if(ge(e,t,o)&&!n[L(o)]){let s=new S([],{});r[L(o)]=s}return f(f({},n),r)}function zo(e,t){let i={};i[v]=t;for(let n of e)if(n.path===""&&L(n)!==v){let r=new S([],{});i[L(n)]=r}return i}function Fo(e,t,i){return i.some(n=>ge(e,t,n)&&L(n)!==v)}function _o(e,t,i){return i.some(n=>ge(e,t,n))}function ge(e,t,i){return(e.hasChildren()||t.length>0)&&i.pathMatch==="full"?!1:i.path===""}function Vo(e,t,i){return t.length===0&&!e.children[i]}var sr=class{};function qo(e,t,i,n,r,o,s="emptyOnly"){return new ar(e,t,i,n,r,s,o).recognize()}var Bo=31,ar=class{constructor(t,i,n,r,o,s,u){a(this,"injector");a(this,"configLoader");a(this,"rootComponentType");a(this,"config");a(this,"urlTree");a(this,"paramsInheritanceStrategy");a(this,"urlSerializer");a(this,"applyRedirects");a(this,"absoluteRedirectCount",0);a(this,"allowRedirects",!0);this.injector=t,this.configLoader=i,this.rootComponentType=n,this.config=r,this.urlTree=o,this.paramsInheritanceStrategy=s,this.urlSerializer=u,this.applyRedirects=new ir(this.urlSerializer,this.urlTree)}noMatchError(t){return new D(4002,`'${t.segmentGroup}'`)}recognize(){let t=Fn(this.urlTree.root,[],[],this.config).segmentGroup;return this.match(t).pipe(y(({children:i,rootSnapshot:n})=>{let r=new T(n,i),o=new de("",r),s=Yi(n,[],this.urlTree.queryParams,this.urlTree.fragment);return s.queryParams=this.urlTree.queryParams,o.url=this.urlSerializer.serialize(s),{state:o,tree:s}}))}match(t){let i=new lt([],Object.freeze({}),Object.freeze(f({},this.urlTree.queryParams)),this.urlTree.fragment,Object.freeze({}),v,this.rootComponentType,null,{});return this.processSegmentGroup(this.injector,this.config,t,v,i).pipe(y(n=>({children:n,rootSnapshot:i})),nt(n=>{if(n instanceof kt)return this.urlTree=n.urlTree,this.match(n.urlTree.root);throw n instanceof $t?this.noMatchError(n):n}))}processSegmentGroup(t,i,n,r,o){return n.segments.length===0&&n.hasChildren()?this.processChildren(t,i,n,o):this.processSegment(t,i,n,n.segments,r,!0,o).pipe(y(s=>s instanceof T?[s]:[]))}processChildren(t,i,n,r){let o=[];for(let s of Object.keys(n.children))s==="primary"?o.unshift(s):o.push(s);return N(o).pipe(St(s=>{let u=n.children[s],l=io(i,s);return this.processSegmentGroup(t,l,u,s,r)}),Ar((s,u)=>(s.push(...u),s)),Ce(null),Dr(),E(s=>{if(s===null)return at(n);let u=hi(s);return Ho(u),g(u)}))}processSegment(t,i,n,r,o,s,u){return N(i).pipe(St(l=>this.processSegmentAgainstRoute(l._injector??t,i,l,n,r,o,s,u).pipe(nt(c=>{if(c instanceof $t)return g(null);throw c}))),H(l=>!!l),nt(l=>{if(ci(l))return Vo(n,r,o)?g(new sr):at(n);throw l}))}processSegmentAgainstRoute(t,i,n,r,o,s,u,l){return L(n)!==s&&(s===v||!ge(r,o,n))?at(r):n.redirectTo===void 0?this.matchSegmentAgainstRoute(t,r,n,o,s,l):this.allowRedirects&&u?this.expandSegmentAgainstRouteUsingRedirect(t,r,i,n,o,s,l):at(r)}expandSegmentAgainstRouteUsingRedirect(t,i,n,r,o,s,u){let{matched:l,parameters:c,consumedSegments:d,positionalParamSegments:m,remainingSegments:p}=di(i,r,o);if(!l)return at(i);typeof r.redirectTo=="string"&&r.redirectTo[0]==="/"&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>Bo&&(this.allowRedirects=!1));let w=new lt(o,c,Object.freeze(f({},this.urlTree.queryParams)),this.urlTree.fragment,_n(r),L(r),r.component??r._loadedComponent??null,r,Vn(r)),C=le(w,u,this.paramsInheritanceStrategy);w.params=Object.freeze(C.params),w.data=Object.freeze(C.data);let U=this.applyRedirects.applyRedirectCommands(d,r.redirectTo,m,w,t);return this.applyRedirects.lineralizeSegments(r,U).pipe(E(x=>this.processSegment(t,n,i,x.concat(p),s,!1,u)))}matchSegmentAgainstRoute(t,i,n,r,o,s){let u=Lo(i,n,r,t,this.urlSerializer);return n.path==="**"&&(i.children={}),u.pipe(k(l=>l.matched?(t=n._injector??t,this.getChildConfig(t,n,r).pipe(k(({routes:c})=>{let d=n._loadedInjector??t,{parameters:m,consumedSegments:p,remainingSegments:w}=l,C=new lt(p,m,Object.freeze(f({},this.urlTree.queryParams)),this.urlTree.fragment,_n(n),L(n),n.component??n._loadedComponent??null,n,Vn(n)),U=le(C,s,this.paramsInheritanceStrategy);C.params=Object.freeze(U.params),C.data=Object.freeze(U.data);let{segmentGroup:x,slicedSegments:mt}=Fn(i,p,w,c);if(mt.length===0&&x.hasChildren())return this.processChildren(d,c,x,C).pipe(y(Vt=>new T(C,Vt)));if(c.length===0&&mt.length===0)return g(new T(C,[]));let ve=L(n)===o;return this.processSegment(d,c,x,mt,ve?v:o,!0,C).pipe(y(Vt=>new T(C,Vt instanceof T?[Vt]:[])))}))):at(i)))}getChildConfig(t,i,n){return i.children?g({routes:i.children,injector:t}):i.loadChildren?i._loadedRoutes!==void 0?g({routes:i._loadedRoutes,injector:i._loadedInjector}):Uo(t,i,n,this.urlSerializer).pipe(E(r=>r?this.configLoader.loadChildren(t,i).pipe(I(o=>{i._loadedRoutes=o.routes,i._loadedInjector=o.injector})):jo(i))):g({routes:[],injector:t})}};function Ho(e){e.sort((t,i)=>t.value.outlet===v?-1:i.value.outlet===v?1:t.value.outlet.localeCompare(i.value.outlet))}function Wo(e){let t=e.value.routeConfig;return t&&t.path===""}function hi(e){let t=[],i=new Set;for(let n of e){if(!Wo(n)){t.push(n);continue}let r=t.find(o=>n.value.routeConfig===o.value.routeConfig);r!==void 0?(r.children.push(...n.children),i.add(r)):t.push(n)}for(let n of i){let r=hi(n.children);t.push(new T(n.value,r))}return t.filter(n=>!i.has(n))}function _n(e){return e.data||{}}function Vn(e){return e.resolve||{}}function Go(e,t,i,n,r,o){return E(s=>qo(e,t,i,n,s.extractedUrl,r,o).pipe(y(({state:u,tree:l})=>A(f({},s),{targetSnapshot:u,urlAfterRedirects:l}))))}function Qo(e,t){return E(i=>{let{targetSnapshot:n,guards:{canActivateChecks:r}}=i;if(!r.length)return g(i);let o=new Set(r.map(l=>l.route)),s=new Set;for(let l of o)if(!s.has(l))for(let c of pi(l))s.add(c);let u=0;return N(s).pipe(St(l=>o.has(l)?Zo(l,n,e,t):(l.data=le(l,l.parent,e).resolve,g(void 0))),I(()=>u++),Re(1),E(l=>u===s.size?g(i):$))})}function pi(e){let t=e.children.map(i=>pi(i)).flat();return[e,...t]}function Zo(e,t,i,n){let r=e.routeConfig,o=e._resolve;return(r==null?void 0:r.title)!==void 0&&!oi(r)&&(o[zt]=r.title),Yo(o,e,t,n).pipe(y(s=>(e._resolvedData=s,e.data=le(e,e.parent,i).resolve,null)))}function Yo(e,t,i,n){let r=$e(e);if(r.length===0)return g({});let o={};return N(r).pipe(E(s=>Ko(e[s],t,i,n).pipe(H(),I(u=>{if(u instanceof Lt)throw he(new Ot,u);o[s]=u}))),Re(1),Ir(o),nt(s=>ci(s)?$:yt(s)))}function Ko(e,t,i,n){let r=Ft(t)??n,o=vt(e,r),s=o.resolve?o.resolve(t,i):_(r,()=>o(t,i));return W(s)}function je(e){return k(t=>{let i=e(t);return i?N(i).pipe(y(()=>t)):g(t)})}var fi=(()=>{let t=class t{buildTitle(n){let r,o=n.root;for(;o!==void 0;)r=this.getResolvedTitleForRoute(o)??r,o=o.children.find(s=>s.outlet===v);return r}getResolvedTitleForRoute(n){return n.data[zt]}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(Xo),providedIn:"root"}));let e=t;return e})(),Xo=(()=>{let t=class t extends fi{constructor(r){super();a(this,"title");this.title=r}updateTitle(r){let o=this.buildTitle(r);o!==void 0&&this.title.setTitle(o)}};a(t,"\u0275fac",function(o){return new(o||t)(Q(on))}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),pr=new j("",{providedIn:"root",factory:()=>({})}),Jo=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275cmp",ot({type:t,selectors:[["ng-component"]],decls:1,vars:0,template:function(r,o){r&1&&z(0,"router-outlet")},dependencies:[dr],encapsulation:2}));let e=t;return e})();function fr(e){let t=e.children&&e.children.map(fr),i=t?A(f({},e),{children:t}):f({},e);return!i.component&&!i.loadComponent&&(t||i.loadChildren)&&i.outlet&&i.outlet!==v&&(i.component=Jo),i}var gr=new j(""),ts=(()=>{let t=class t{constructor(){a(this,"componentLoaders",new WeakMap);a(this,"childrenLoaders",new WeakMap);a(this,"onLoadStartListener");a(this,"onLoadEndListener");a(this,"compiler",h(Me))}loadComponent(n){if(this.componentLoaders.get(n))return this.componentLoaders.get(n);if(n._loadedComponent)return g(n._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(n);let r=W(n.loadComponent()).pipe(y(gi),I(s=>{this.onLoadEndListener&&this.onLoadEndListener(n),n._loadedComponent=s}),Bt(()=>{this.componentLoaders.delete(n)})),o=new ye(r,()=>new G).pipe(me());return this.componentLoaders.set(n,o),o}loadChildren(n,r){if(this.childrenLoaders.get(r))return this.childrenLoaders.get(r);if(r._loadedRoutes)return g({routes:r._loadedRoutes,injector:r._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(r);let s=es(r,this.compiler,n,this.onLoadEndListener).pipe(Bt(()=>{this.childrenLoaders.delete(r)})),u=new ye(s,()=>new G).pipe(me());return this.childrenLoaders.set(r,u),u}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})();function es(e,t,i,n){return W(e.loadChildren()).pipe(y(gi),E(r=>r instanceof _r||Array.isArray(r)?g(r):N(t.compileModuleAsync(r))),y(r=>{n&&n(e);let o,s,u=!1;return Array.isArray(r)?(s=r,u=!0):(o=r.create(i).injector,s=o.get(gr,[],{optional:!0,self:!0}).flat()),{routes:s.map(fr),injector:o}}))}function rs(e){return e&&typeof e=="object"&&"default"in e}function gi(e){return rs(e)?e.default:e}var vr=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(ns),providedIn:"root"}));let e=t;return e})(),ns=(()=>{let t=class t{shouldProcessUrl(n){return!0}extract(n){return n}merge(n,r){return n}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),is=new j("");var os=new j(""),ss=(()=>{let t=class t{constructor(){a(this,"currentNavigation",null);a(this,"currentTransition",null);a(this,"lastSuccessfulNavigation",null);a(this,"events",new G);a(this,"transitionAbortSubject",new G);a(this,"configLoader",h(ts));a(this,"environmentInjector",h(Wt));a(this,"urlSerializer",h(cr));a(this,"rootContexts",h(fe));a(this,"location",h(Kt));a(this,"inputBindingEnabled",h(hr,{optional:!0})!==null);a(this,"titleStrategy",h(fi));a(this,"options",h(pr,{optional:!0})||{});a(this,"paramsInheritanceStrategy",this.options.paramsInheritanceStrategy||"emptyOnly");a(this,"urlHandlingStrategy",h(vr));a(this,"createViewTransition",h(is,{optional:!0}));a(this,"navigationErrorHandler",h(os,{optional:!0}));a(this,"navigationId",0);a(this,"transitions");a(this,"afterPreactivation",()=>g(void 0));a(this,"rootComponentType",null);let n=o=>this.events.next(new We(o)),r=o=>this.events.next(new Ge(o));this.configLoader.onLoadEndListener=r,this.configLoader.onLoadStartListener=n}get hasRequestedNavigation(){return this.navigationId!==0}complete(){var n;(n=this.transitions)==null||n.complete()}handleNavigationRequest(n){var o;let r=++this.navigationId;(o=this.transitions)==null||o.next(A(f(f({},this.transitions.value),n),{id:r}))}setupNavigations(n,r,o){return this.transitions=new O({id:0,currentUrlTree:r,currentRawUrl:r,extractedUrl:this.urlHandlingStrategy.extract(r),urlAfterRedirects:this.urlHandlingStrategy.extract(r),rawUrl:r,extras:{},resolve:()=>{},reject:()=>{},promise:Promise.resolve(!0),source:Tt,restoredState:null,currentSnapshot:o.snapshot,targetSnapshot:null,currentRouterState:o,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null}),this.transitions.pipe(B(s=>s.id!==0),y(s=>A(f({},s),{extractedUrl:this.urlHandlingStrategy.extract(s.rawUrl)})),k(s=>{let u=!1,l=!1;return g(s).pipe(k(c=>{if(this.navigationId>s.id)return this.cancelNavigationTransition(s,"",M.SupersededByNewNavigation),$;this.currentTransition=s,this.currentNavigation={id:c.id,initialUrl:c.rawUrl,extractedUrl:c.extractedUrl,targetBrowserUrl:typeof c.extras.browserUrl=="string"?this.urlSerializer.parse(c.extras.browserUrl):c.extras.browserUrl,trigger:c.source,extras:c.extras,previousNavigation:this.lastSuccessfulNavigation?A(f({},this.lastSuccessfulNavigation),{previousNavigation:null}):null};let d=!n.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl(),m=c.extras.onSameUrlNavigation??n.onSameUrlNavigation;if(!d&&m!=="reload"){let p="";return this.events.next(new et(c.id,this.urlSerializer.serialize(c.rawUrl),p,_e.IgnoredSameUrlNavigation)),c.resolve(!1),$}if(this.urlHandlingStrategy.shouldProcessUrl(c.rawUrl))return g(c).pipe(k(p=>{var C,U;let w=(C=this.transitions)==null?void 0:C.getValue();return this.events.next(new Ut(p.id,this.urlSerializer.serialize(p.extractedUrl),p.source,p.restoredState)),w!==((U=this.transitions)==null?void 0:U.getValue())?$:Promise.resolve(p)}),Go(this.environmentInjector,this.configLoader,this.rootComponentType,n.config,this.urlSerializer,this.paramsInheritanceStrategy),I(p=>{s.targetSnapshot=p.targetSnapshot,s.urlAfterRedirects=p.urlAfterRedirects,this.currentNavigation=A(f({},this.currentNavigation),{finalUrl:p.urlAfterRedirects});let w=new ae(p.id,this.urlSerializer.serialize(p.extractedUrl),this.urlSerializer.serialize(p.urlAfterRedirects),p.targetSnapshot);this.events.next(w)}));if(d&&this.urlHandlingStrategy.shouldProcessUrl(c.currentRawUrl)){let{id:p,extractedUrl:w,source:C,restoredState:U,extras:x}=c,mt=new Ut(p,this.urlSerializer.serialize(w),C,U);this.events.next(mt);let ve=ni(this.rootComponentType).snapshot;return this.currentTransition=s=A(f({},c),{targetSnapshot:ve,urlAfterRedirects:w,extras:A(f({},x),{skipLocationChange:!1,replaceUrl:!1})}),this.currentNavigation.finalUrl=w,g(s)}else{let p="";return this.events.next(new et(c.id,this.urlSerializer.serialize(c.extractedUrl),p,_e.IgnoredByUrlHandlingStrategy)),c.resolve(!1),$}}),I(c=>{let d=new Ve(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot);this.events.next(d)}),y(c=>(this.currentTransition=s=A(f({},c),{guards:po(c.targetSnapshot,c.currentSnapshot,this.rootContexts)}),s)),Io(this.environmentInjector,c=>this.events.next(c)),I(c=>{if(s.guardsResult=c.guardsResult,c.guardsResult&&typeof c.guardsResult!="boolean")throw he(this.urlSerializer,c.guardsResult);let d=new qe(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot,!!c.guardsResult);this.events.next(d)}),B(c=>c.guardsResult?!0:(this.cancelNavigationTransition(c,"",M.GuardRejected),!1)),je(c=>{if(c.guards.canActivateChecks.length)return g(c).pipe(I(d=>{let m=new Be(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(m)}),k(d=>{let m=!1;return g(d).pipe(Qo(this.paramsInheritanceStrategy,this.environmentInjector),I({next:()=>m=!0,complete:()=>{m||this.cancelNavigationTransition(d,"",M.NoDataFromResolver)}}))}),I(d=>{let m=new He(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(m)}))}),je(c=>{let d=m=>{var w;let p=[];(w=m.routeConfig)!=null&&w.loadComponent&&!m.routeConfig._loadedComponent&&p.push(this.configLoader.loadComponent(m.routeConfig).pipe(I(C=>{m.component=C}),y(()=>{})));for(let C of m.children)p.push(...d(C));return p};return Se(d(c.targetSnapshot.root)).pipe(Ce(null),it(1))}),je(()=>this.afterPreactivation()),k(()=>{var p;let{currentSnapshot:c,targetSnapshot:d}=s,m=(p=this.createViewTransition)==null?void 0:p.call(this,this.environmentInjector,c.root,d.root);return m?N(m).pipe(y(()=>s)):g(s)}),y(c=>{let d=ao(n.routeReuseStrategy,c.targetSnapshot,c.currentRouterState);return this.currentTransition=s=A(f({},c),{targetRouterState:d}),this.currentNavigation.targetRouterState=d,s}),I(()=>{this.events.next(new Nt)}),ho(this.rootContexts,n.routeReuseStrategy,c=>this.events.next(c),this.inputBindingEnabled),it(1),I({next:c=>{var d;u=!0,this.lastSuccessfulNavigation=this.currentNavigation,this.events.next(new tt(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects))),(d=this.titleStrategy)==null||d.updateTitle(c.targetRouterState.snapshot),c.resolve(!0)},complete:()=>{u=!0}}),Mr(this.transitionAbortSubject.pipe(I(c=>{throw c}))),Bt(()=>{var c;!u&&!l&&this.cancelNavigationTransition(s,"",M.SupersededByNewNavigation),((c=this.currentTransition)==null?void 0:c.id)===s.id&&(this.currentNavigation=null,this.currentTransition=null)}),nt(c=>{if(l=!0,ui(c))this.events.next(new V(s.id,this.urlSerializer.serialize(s.extractedUrl),c.message,c.cancellationCode)),lo(c)?this.events.next(new pt(c.url,c.navigationBehaviorOptions)):s.resolve(!1);else{let d=new xt(s.id,this.urlSerializer.serialize(s.extractedUrl),c,s.targetSnapshot??void 0);try{let m=_(this.environmentInjector,()=>{var p;return(p=this.navigationErrorHandler)==null?void 0:p.call(this,d)});if(m instanceof Lt){let{message:p,cancellationCode:w}=he(this.urlSerializer,m);this.events.next(new V(s.id,this.urlSerializer.serialize(s.extractedUrl),p,w)),this.events.next(new pt(m.redirectTo,m.navigationBehaviorOptions))}else throw this.events.next(d),c}catch(m){this.options.resolveNavigationPromiseOnError?s.resolve(!1):s.reject(m)}}return $}))}))}cancelNavigationTransition(n,r,o){let s=new V(n.id,this.urlSerializer.serialize(n.extractedUrl),r,o);this.events.next(s),n.resolve(!1)}isUpdatingInternalState(){var n,r;return((n=this.currentTransition)==null?void 0:n.extractedUrl.toString())!==((r=this.currentTransition)==null?void 0:r.currentUrlTree.toString())}isUpdatedBrowserUrl(){var o,s,u;let n=this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(!0))),r=((o=this.currentNavigation)==null?void 0:o.targetBrowserUrl)??((s=this.currentNavigation)==null?void 0:s.extractedUrl);return n.toString()!==(r==null?void 0:r.toString())&&!((u=this.currentNavigation)!=null&&u.extras.skipLocationChange)}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})();function as(e){return e!==Tt}var us=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(cs),providedIn:"root"}));let e=t;return e})(),ur=class{shouldDetach(t){return!1}store(t,i){}shouldAttach(t){return!1}retrieve(t){return null}shouldReuseRoute(t,i){return t.routeConfig===i.routeConfig}},cs=(()=>{let t=class t extends ur{};a(t,"\u0275fac",(()=>{let n;return function(o){return(n||(n=wt(t)))(o||t)}})()),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),vi=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(ls),providedIn:"root"}));let e=t;return e})(),ls=(()=>{let t=class t extends vi{constructor(){super(...arguments);a(this,"location",h(Kt));a(this,"urlSerializer",h(cr));a(this,"options",h(pr,{optional:!0})||{});a(this,"canceledNavigationResolution",this.options.canceledNavigationResolution||"replace");a(this,"urlHandlingStrategy",h(vr));a(this,"urlUpdateStrategy",this.options.urlUpdateStrategy||"deferred");a(this,"currentUrlTree",new q);a(this,"rawUrlTree",this.currentUrlTree);a(this,"currentPageId",0);a(this,"lastSuccessfulId",-1);a(this,"routerState",ni(null));a(this,"stateMemento",this.createStateMemento())}getCurrentUrlTree(){return this.currentUrlTree}getRawUrlTree(){return this.rawUrlTree}restoredState(){return this.location.getState()}get browserPageId(){var r;return this.canceledNavigationResolution!=="computed"?this.currentPageId:((r=this.restoredState())==null?void 0:r.\u0275routerPageId)??this.currentPageId}getRouterState(){return this.routerState}createStateMemento(){return{rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}registerNonRouterCurrentEntryChangeListener(r){return this.location.subscribe(o=>{o.type==="popstate"&&r(o.url,o.state)})}handleRouterEvent(r,o){if(r instanceof Ut)this.stateMemento=this.createStateMemento();else if(r instanceof et)this.rawUrlTree=o.initialUrl;else if(r instanceof ae){if(this.urlUpdateStrategy==="eager"&&!o.extras.skipLocationChange){let s=this.urlHandlingStrategy.merge(o.finalUrl,o.initialUrl);this.setBrowserUrl(o.targetBrowserUrl??s,o)}}else r instanceof Nt?(this.currentUrlTree=o.finalUrl,this.rawUrlTree=this.urlHandlingStrategy.merge(o.finalUrl,o.initialUrl),this.routerState=o.targetRouterState,this.urlUpdateStrategy==="deferred"&&!o.extras.skipLocationChange&&this.setBrowserUrl(o.targetBrowserUrl??this.rawUrlTree,o)):r instanceof V&&(r.code===M.GuardRejected||r.code===M.NoDataFromResolver)?this.restoreHistory(o):r instanceof xt?this.restoreHistory(o,!0):r instanceof tt&&(this.lastSuccessfulId=r.id,this.currentPageId=this.browserPageId)}setBrowserUrl(r,o){let s=r instanceof q?this.urlSerializer.serialize(r):r;if(this.location.isCurrentPathEqualTo(s)||o.extras.replaceUrl){let u=this.browserPageId,l=f(f({},o.extras.state),this.generateNgRouterState(o.id,u));this.location.replaceState(s,"",l)}else{let u=f(f({},o.extras.state),this.generateNgRouterState(o.id,this.browserPageId+1));this.location.go(s,"",u)}}restoreHistory(r,o=!1){if(this.canceledNavigationResolution==="computed"){let s=this.browserPageId,u=this.currentPageId-s;u!==0?this.location.historyGo(u):this.currentUrlTree===r.finalUrl&&u===0&&(this.resetState(r),this.resetUrlToCurrentUrlTree())}else this.canceledNavigationResolution==="replace"&&(o&&this.resetState(r),this.resetUrlToCurrentUrlTree())}resetState(r){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,r.finalUrl??this.rawUrlTree)}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}generateNgRouterState(r,o){return this.canceledNavigationResolution==="computed"?{navigationId:r,\u0275routerPageId:o}:{navigationId:r}}};a(t,"\u0275fac",(()=>{let r;return function(s){return(r||(r=wt(t)))(s||t)}})()),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),Dt=function(e){return e[e.COMPLETE=0]="COMPLETE",e[e.FAILED=1]="FAILED",e[e.REDIRECTING=2]="REDIRECTING",e}(Dt||{});function ds(e,t){e.events.pipe(B(i=>i instanceof tt||i instanceof V||i instanceof xt||i instanceof et),y(i=>i instanceof tt||i instanceof et?Dt.COMPLETE:(i instanceof V?i.code===M.Redirect||i.code===M.SupersededByNewNavigation:!1)?Dt.REDIRECTING:Dt.FAILED),B(i=>i!==Dt.REDIRECTING),it(1)).subscribe(()=>{t()})}var hs={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},ps={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"},mi=(()=>{var t;let i=class i{constructor(){a(this,"disposed",!1);a(this,"nonRouterCurrentEntryChangeSubscription");a(this,"console",h(Wr));a(this,"stateManager",h(vi));a(this,"options",h(pr,{optional:!0})||{});a(this,"pendingTasks",h(jr));a(this,"urlUpdateStrategy",this.options.urlUpdateStrategy||"deferred");a(this,"navigationTransitions",h(ss));a(this,"urlSerializer",h(cr));a(this,"location",h(Kt));a(this,"urlHandlingStrategy",h(vr));a(this,"_events",new G);a(this,"navigated",!1);a(this,"routeReuseStrategy",h(us));a(this,"onSameUrlNavigation",this.options.onSameUrlNavigation||"ignore");a(this,"config",((t=h(gr,{optional:!0}))==null?void 0:t.flat())??[]);a(this,"componentInputBindingEnabled",!!h(hr,{optional:!0}));a(this,"eventsSubscription",new mr);this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this,this.currentUrlTree,this.routerState).subscribe({error:r=>{this.console.warn(r)}}),this.subscribeToNavigationEvents()}get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}subscribeToNavigationEvents(){let r=this.navigationTransitions.events.subscribe(o=>{try{let s=this.navigationTransitions.currentTransition,u=this.navigationTransitions.currentNavigation;if(s!==null&&u!==null){if(this.stateManager.handleRouterEvent(o,u),o instanceof V&&o.code!==M.Redirect&&o.code!==M.SupersededByNewNavigation)this.navigated=!0;else if(o instanceof tt)this.navigated=!0;else if(o instanceof pt){let l=o.navigationBehaviorOptions,c=this.urlHandlingStrategy.merge(o.url,s.currentRawUrl),d=f({browserUrl:s.extras.browserUrl,info:s.extras.info,skipLocationChange:s.extras.skipLocationChange,replaceUrl:s.extras.replaceUrl||this.urlUpdateStrategy==="eager"||as(s.source)},l);this.scheduleNavigation(c,Tt,null,d,{resolve:s.resolve,reject:s.reject,promise:s.promise})}}gs(o)&&this._events.next(o)}catch(s){this.navigationTransitions.transitionAbortSubject.next(s)}});this.eventsSubscription.add(r)}resetRootComponentType(r){this.routerState.root.component=r,this.navigationTransitions.rootComponentType=r}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(!0),Tt,this.stateManager.restoredState())}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??(this.nonRouterCurrentEntryChangeSubscription=this.stateManager.registerNonRouterCurrentEntryChangeListener((r,o)=>{setTimeout(()=>{this.navigateToSyncWithBrowser(r,"popstate",o)},0)}))}navigateToSyncWithBrowser(r,o,s){let u={replaceUrl:!0},l=s!=null&&s.navigationId?s:null;if(s){let d=f({},s);delete d.navigationId,delete d.\u0275routerPageId,Object.keys(d).length!==0&&(u.state=d)}let c=this.parseUrl(r);this.scheduleNavigation(c,o,l,u)}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return this.navigationTransitions.currentNavigation}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(r){this.config=r.map(fr),this.navigated=!1}ngOnDestroy(){this.dispose()}dispose(){this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription&&(this.nonRouterCurrentEntryChangeSubscription.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0),this.disposed=!0,this.eventsSubscription.unsubscribe()}createUrlTree(r,o={}){let{relativeTo:s,queryParams:u,fragment:l,queryParamsHandling:c,preserveFragment:d}=o,m=d?this.currentUrlTree.fragment:l,p=null;switch(c??this.options.defaultQueryParamsHandling){case"merge":p=f(f({},this.currentUrlTree.queryParams),u);break;case"preserve":p=this.currentUrlTree.queryParams;break;default:p=u||null}p!==null&&(p=this.removeEmptyProps(p));let w;try{let C=s?s.snapshot:this.routerState.snapshot.root;w=Jn(C)}catch{(typeof r[0]!="string"||r[0][0]!=="/")&&(r=[]),w=this.currentUrlTree.root}return ti(w,r,p,m??null)}navigateByUrl(r,o={skipLocationChange:!1}){let s=Et(r)?r:this.parseUrl(r),u=this.urlHandlingStrategy.merge(s,this.rawUrlTree);return this.scheduleNavigation(u,Tt,null,o)}navigate(r,o={skipLocationChange:!1}){return fs(r),this.navigateByUrl(this.createUrlTree(r,o),o)}serializeUrl(r){return this.urlSerializer.serialize(r)}parseUrl(r){try{return this.urlSerializer.parse(r)}catch{return this.urlSerializer.parse("/")}}isActive(r,o){let s;if(o===!0?s=f({},hs):o===!1?s=f({},ps):s=o,Et(r))return Ln(this.currentUrlTree,r,s);let u=this.parseUrl(r);return Ln(this.currentUrlTree,u,s)}removeEmptyProps(r){return Object.entries(r).reduce((o,[s,u])=>(u!=null&&(o[s]=u),o),{})}scheduleNavigation(r,o,s,u,l){if(this.disposed)return Promise.resolve(!1);let c,d,m;l?(c=l.resolve,d=l.reject,m=l.promise):m=new Promise((w,C)=>{c=w,d=C});let p=this.pendingTasks.add();return ds(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(p))}),this.navigationTransitions.handleNavigationRequest({source:o,restoredState:s,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:r,extras:u,resolve:c,reject:d,promise:m,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),m.catch(w=>Promise.reject(w))}};a(i,"\u0275fac",function(o){return new(o||i)}),a(i,"\u0275prov",R({token:i,factory:i.\u0275fac,providedIn:"root"}));let e=i;return e})();function fs(e){for(let t=0;ti.\u0275providers)])}function ms(e){return e.routerState.root}function ys(){let e=h(Nr);return t=>{var o,s;let i=e.get(Zr);if(t!==i.components[0])return;let n=e.get(mi),r=e.get(Ss);e.get(ws)===1&&n.initialNavigation(),(o=e.get(Cs,null,be.Optional))==null||o.setUpPreloading(),(s=e.get(vs,null,be.Optional))==null||s.init(),n.resetRootComponentType(i.componentTypes[0]),r.closed||(r.next(),r.complete(),r.unsubscribe())}}var Ss=new j("",{factory:()=>new G}),ws=new j("",{providedIn:"root",factory:()=>1});var Cs=new j("");var Si=(()=>{let t=class t{constructor(){this.tuiPlatform=h(Pe,{skipSelf:!0})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=Z({type:t,selectors:[["","tuiPlatform",""]],hostVars:1,hostBindings:function(r,o){r&2&&Ae("data-platform",o.tuiPlatform)},inputs:{tuiPlatform:"tuiPlatform"},features:[Yt([{provide:Pe,useFactory:()=>h(t).tuiPlatform}])]});let e=t;return e})();var wi=(()=>{let t=class t extends Sr{constructor(){super(r=>this.stream$.subscribe(r));a(this,"visualViewport",h(ln).visualViewport);a(this,"stream$",this.visualViewport?br(qt(this.visualViewport,"resize"),qt(this.visualViewport,"scroll"),qt(this.visualViewport,"scrollend")).pipe(Ht(null),y(()=>this.visualViewport),B(Boolean),Tr({bufferSize:1,refCount:!0})):$)}};a(t,"\u0275fac",function(o){return new(o||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})();var Ci=(()=>{let t=class t{constructor(){this.w=h(Ee),this.style=cn().style,this.$=h(wi).pipe(an()).subscribe(({offsetLeft:n,offsetTop:r,height:o,width:s,scale:u})=>{this.style.setProperty("--tui-viewport-x",K(n)),this.style.setProperty("--tui-viewport-y",K(r)),this.style.setProperty("--tui-viewport-height",K(o)),this.style.setProperty("--tui-viewport-width",K(s)),this.style.setProperty("--tui-viewport-scale",String(u)),this.style.setProperty("--tui-viewport-vh",K(this.w.innerHeight/100)),this.style.setProperty("--tui-viewport-vw",K(this.w.innerWidth/100))})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=Z({type:t,selectors:[["","tuiVisualViewport",""]]});let e=t;return e})();var Ri=(()=>{let t=class t extends An{};t.\u0275fac=(()=>{let n;return function(o){return(n||(n=wt(t)))(o||t)}})(),t.\u0275prov=R({token:t,factory:t.\u0275fac,providedIn:"root"});let e=t;return e})();var Is=["*",[["tuiOverContent"]],[["tuiOverDialogs"]],[["tuiOverAlerts"]],[["tuiOverDropdowns"]],[["tuiOverHints"]]],Ds=["*","tuiOverContent","tuiOverDialogs","tuiOverAlerts","tuiOverDropdowns","tuiOverHints"];function As(e,t){e&1&&z(0,"tui-scroll-controls",3)}var bi=(()=>{let t=class t extends Dn{constructor(){var n;super(),this.reducedMotion=h(hn),this.duration=gn(h(pn)),this.isMobileRes=un(h(In).pipe(y(r=>r==="mobile"),dn()),{initialValue:!1}),this.nativeScrollbar=h(Rn).mode==="native",this.scrollbars=!(this.nativeScrollbar||h(wn)),h(st).documentElement.setAttribute("data-tui-theme",h(fn).toLowerCase()),this.nativeScrollbar||(n=h(st).defaultView)==null||n.document.documentElement.classList.add("tui-zero-scrollbar")}};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=ot({type:t,selectors:[["tui-root"]],hostAttrs:["data-tui-version","4.18.0"],hostVars:6,hostBindings:function(r,o){r&1&&Te("touchstart.passive.silent",function(){return 0}),r&2&&(Kr("--tui-duration",o.duration,"ms")("--tui-scroll-behavior",o.reducedMotion?"auto":"smooth"),Xr("_mobile",o.isMobileRes()))},features:[Yt([],[Tn(Ri)]),Br([Si,Ci]),qr],ngContentSelectors:Ds,decls:14,vars:1,consts:[["viewContainer",""],[1,"t-root-content"],["class","t-root-scrollbar",4,"ngIf"],[1,"t-root-scrollbar"]],template:function(r,o){r&1&&(Jr(Is),Gt(0,"div",1),Y(1),Qt(),Hr(2,As,1,0,"tui-scroll-controls",2),Zt(3,null,0),Y(5,1),z(6,"tui-dialogs"),Y(7,2),z(8,"tui-alerts"),Y(9,3),z(10,"tui-dropdowns"),Y(11,4),z(12,"tui-hints"),Y(13,5)),r&2&&(kr(2),Yr("ngIf",o.scrollbars))},dependencies:[en,Cn,En,On,Pn,bn],styles:[`@keyframes tuiPresent{to{content:""}}@keyframes tuiSkeletonVibe{to{opacity:.5}}.tui-zero-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.tui-zero-scrollbar::-webkit-scrollbar,.tui-zero-scrollbar::-webkit-scrollbar-thumb{display:none}body,input{margin:0}tui-root{position:relative;display:block;font:var(--tui-font-text-s);color:var(--tui-text-primary);flex:1;border-image:conic-gradient(var(--tui-background-base) 0 0) fill 0/0/0 0 100vh 0;-webkit-tap-highlight-color:transparent}tui-root>.t-root-scrollbar{position:fixed;top:0;left:0;bottom:0;right:0;z-index:0;display:none;margin:0}[data-tui-theme] tui-root>.t-root-scrollbar{display:block}.t-root-content{position:relative;top:var(--t-root-top);block-size:100%;isolation:isolate}.t-root-content>*{--t-root-top: 0}[tuiDropdownButton][tuiDropdownButton]{display:none} -`],encapsulation:2});let e=t;return e})();var Ii=(()=>{let t=class t{};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=ot({type:t,selectors:[["app-root"]],decls:7,vars:0,consts:[["ngProjectAs","tuiOverContent",5,["tuiOverContent"]],["ngProjectAs","tuiOverDialogs",5,["tuiOverDialogs"]],["ngProjectAs","tuiOverAlerts",5,["tuiOverAlerts"]],["ngProjectAs","tuiOverPortals",5,["tuiOverPortals"]],["ngProjectAs","tuiOverHints",5,["tuiOverHints"]]],template:function(r,o){r&1&&(Gt(0,"tui-root"),z(1,"router-outlet"),Zt(2,0)(3,1)(4,2)(5,3)(6,4),Qt())},dependencies:[dr,bi],encapsulation:2,changeDetection:0});let e=t;return e})();var Ts=(()=>{let t=class t extends Jt{constructor(n,r,o){super(n,r,o)}ngOnDestroy(){this.flush()}};a(t,"\u0275fac",function(r){return new(r||t)(Q(st),Q(Rt),Q(Xt))}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac}));let e=t;return e})();function Ms(){return new mn}function Os(e,t,i){return new Sn(e,t,i)}var Di=[{provide:Xt,useFactory:Ms},{provide:Jt,useClass:Ts},{provide:zr,useFactory:Os,deps:[rn,Jt,Ie]}],Es=[{provide:Rt,useFactory:()=>new yn},{provide:De,useValue:"BrowserAnimations"},...Di],yu=[{provide:Rt,useClass:vn},{provide:De,useValue:"NoopAnimations"},...Di];function Ai(){return $r("NgEagerAnimations"),[...Es]}var Ti={providers:[tn(),sn(),Ai(),yi([{path:"",pathMatch:"full",loadComponent:async()=>import("./chunk-2MGINT6C.js")}]),Ur(),{provide:xn,deps:[Er],useFactory:e=>[...jn,import("./chunk-N6WGK7MX.js").then(({tuiCreateImageEditorExtension:t})=>t({injector:e}))]},{provide:Nn,useClass:Un},Mn]};var Mi={production:!1};Mi.production&&void 0;nn(Ii,Ti).catch(e=>console.error(e)); -//# sourceMappingURL=main-2JDNF67F.js.map +import{c as Cn,e as En,f as Un}from"./chunk-UU7DNZ47.js";import{$ as Pr,A as Ce,Aa as _r,Ab as Me,Ac as ln,Ad as mn,B as it,Ba as Vr,Bb as tn,Bd as Jt,C as Ir,Ca as ot,Cb as Oe,Cd as yn,Ce as xn,Dd as Sn,E as Bt,Ea as Z,Eb as st,Ed as wn,F as H,Fb as Kt,G as Re,Ga as qr,Gd as Pe,H as Dr,Ha as Br,Hf as Nn,Ia as Hr,Ib as en,J as Ar,Ja as Wr,K as Tr,Ka as Gr,Kd as Rn,L as Ht,La as Qr,Ld as bn,M as k,Ma as Zr,Mb as rn,N as Mr,Na as Ae,Nb as nn,Ng as jn,O as I,Oa as Yr,Ob as on,P as D,Pa as Kr,Pb as sn,Qa as Xr,R,Sd as In,T as Or,U as j,Ua as Gt,V as be,Va as Qt,Vc as dn,W as Q,Wa as z,Wc as hn,X as h,Xc as pn,Xd as Dn,Yd as An,Za as Zt,Zd as Tn,_ as Er,_d as Mn,a as mr,aa as Ur,ba as Wt,bb as Te,c as yr,ca as _,d as Sr,da as xr,db as Jr,e as me,eb as Y,ee as On,f as ye,fc as an,g as G,gc as un,gd as fn,h as O,ha as wt,i as $,ia as Nr,k as N,ka as jr,l as g,la as Ct,le as Pn,m as yt,ma as Ie,n as wr,na as Lr,o as Cr,od as gn,p as y,pa as De,q as Se,qa as $r,qb as Yt,qc as K,r as E,s as Rr,t as we,u as qt,va as kr,w as br,wc as cn,x as B,xa as zr,xd as vn,y as nt,ya as Fr,yd as Rt,z as St,zc as Ee,zd as Xt}from"./chunk-7PCLFWKE.js";import{a as f,b as A,e as a}from"./chunk-7OFBBPR7.js";var v="primary",zt=Symbol("RouteTitle"),Le=class{constructor(t){a(this,"params");this.params=t||{}}has(t){return Object.prototype.hasOwnProperty.call(this.params,t)}get(t){if(this.has(t)){let i=this.params[t];return Array.isArray(i)?i[0]:i}return null}getAll(t){if(this.has(t)){let i=this.params[t];return Array.isArray(i)?i:[i]}return[]}get keys(){return Object.keys(this.params)}};function ht(e){return new Le(e)}function Pi(e,t,i){let n=i.path.split("/");if(n.length>e.length||i.pathMatch==="full"&&(t.hasChildren()||n.lengthn[o]===r)}else return e===t}function Bn(e){return e.length>0?e[e.length-1]:null}function W(e){return wr(e)?e:Gr(e)?N(Promise.resolve(e)):g(e)}var xi={exact:Wn,subset:Gn},Hn={exact:Ni,subset:ji,ignored:()=>!0};function Ln(e,t,i){return xi[i.paths](e.root,t.root,i.matrixParams)&&Hn[i.queryParams](e.queryParams,t.queryParams)&&!(i.fragment==="exact"&&e.fragment!==t.fragment)}function Ni(e,t){return F(e,t)}function Wn(e,t,i){if(!J(e.segments,t.segments)||!re(e.segments,t.segments,i)||e.numberOfChildren!==t.numberOfChildren)return!1;for(let n in t.children)if(!e.children[n]||!Wn(e.children[n],t.children[n],i))return!1;return!0}function ji(e,t){return Object.keys(t).length<=Object.keys(e).length&&Object.keys(t).every(i=>qn(e[i],t[i]))}function Gn(e,t,i){return Qn(e,t,t.segments,i)}function Qn(e,t,i,n){if(e.segments.length>i.length){let r=e.segments.slice(0,i.length);return!(!J(r,i)||t.hasChildren()||!re(r,i,n))}else if(e.segments.length===i.length){if(!J(e.segments,i)||!re(e.segments,i,n))return!1;for(let r in t.children)if(!e.children[r]||!Gn(e.children[r],t.children[r],n))return!1;return!0}else{let r=i.slice(0,e.segments.length),o=i.slice(e.segments.length);return!J(e.segments,r)||!re(e.segments,r,n)||!e.children[v]?!1:Qn(e.children[v],t,o,n)}}function re(e,t,i){return t.every((n,r)=>Hn[i](e[r].parameters,n.parameters))}var q=class{constructor(t=new S([],{}),i={},n=null){a(this,"root");a(this,"queryParams");a(this,"fragment");a(this,"_queryParamMap");this.root=t,this.queryParams=i,this.fragment=n}get queryParamMap(){return this._queryParamMap??(this._queryParamMap=ht(this.queryParams)),this._queryParamMap}toString(){return ki.serialize(this)}},S=class{constructor(t,i){a(this,"segments");a(this,"children");a(this,"parent",null);this.segments=t,this.children=i,Object.values(i).forEach(n=>n.parent=this)}hasChildren(){return this.numberOfChildren>0}get numberOfChildren(){return Object.keys(this.children).length}toString(){return ne(this)}},X=class{constructor(t,i){a(this,"path");a(this,"parameters");a(this,"_parameterMap");this.path=t,this.parameters=i}get parameterMap(){return this._parameterMap??(this._parameterMap=ht(this.parameters)),this._parameterMap}toString(){return Yn(this)}};function Li(e,t){return J(e,t)&&e.every((i,n)=>F(i.parameters,t[n].parameters))}function J(e,t){return e.length!==t.length?!1:e.every((i,n)=>i.path===t[n].path)}function $i(e,t){let i=[];return Object.entries(e.children).forEach(([n,r])=>{n===v&&(i=i.concat(t(r,n)))}),Object.entries(e.children).forEach(([n,r])=>{n!==v&&(i=i.concat(t(r,n)))}),i}var cr=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>new Ot,providedIn:"root"}));let e=t;return e})(),Ot=class{parse(t){let i=new ze(t);return new q(i.parseRootSegment(),i.parseQueryParams(),i.parseFragment())}serialize(t){let i=`/${bt(t.root,!0)}`,n=_i(t.queryParams),r=typeof t.fragment=="string"?`#${zi(t.fragment)}`:"";return`${i}${n}${r}`}},ki=new Ot;function ne(e){return e.segments.map(t=>Yn(t)).join("/")}function bt(e,t){if(!e.hasChildren())return ne(e);if(t){let i=e.children[v]?bt(e.children[v],!1):"",n=[];return Object.entries(e.children).forEach(([r,o])=>{r!==v&&n.push(`${r}:${bt(o,!1)}`)}),n.length>0?`${i}(${n.join("//")})`:i}else{let i=$i(e,(n,r)=>r===v?[bt(e.children[v],!1)]:[`${r}:${bt(n,!1)}`]);return Object.keys(e.children).length===1&&e.children[v]!=null?`${ne(e)}/${i[0]}`:`${ne(e)}/(${i.join("//")})`}}function Zn(e){return encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",")}function te(e){return Zn(e).replace(/%3B/gi,";")}function zi(e){return encodeURI(e)}function ke(e){return Zn(e).replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/%26/gi,"&")}function ie(e){return decodeURIComponent(e)}function $n(e){return ie(e.replace(/\+/g,"%20"))}function Yn(e){return`${ke(e.path)}${Fi(e.parameters)}`}function Fi(e){return Object.entries(e).map(([t,i])=>`;${ke(t)}=${ke(i)}`).join("")}function _i(e){let t=Object.entries(e).map(([i,n])=>Array.isArray(n)?n.map(r=>`${te(i)}=${te(r)}`).join("&"):`${te(i)}=${te(n)}`).filter(i=>i);return t.length?`?${t.join("&")}`:""}var Vi=/^[^\/()?;#]+/;function Ue(e){let t=e.match(Vi);return t?t[0]:""}var qi=/^[^\/()?;=#]+/;function Bi(e){let t=e.match(qi);return t?t[0]:""}var Hi=/^[^=?&#]+/;function Wi(e){let t=e.match(Hi);return t?t[0]:""}var Gi=/^[^&#]+/;function Qi(e){let t=e.match(Gi);return t?t[0]:""}var ze=class{constructor(t){a(this,"url");a(this,"remaining");this.url=t,this.remaining=t}parseRootSegment(){return this.consumeOptional("/"),this.remaining===""||this.peekStartsWith("?")||this.peekStartsWith("#")?new S([],{}):new S([],this.parseChildren())}parseQueryParams(){let t={};if(this.consumeOptional("?"))do this.parseQueryParam(t);while(this.consumeOptional("&"));return t}parseFragment(){return this.consumeOptional("#")?decodeURIComponent(this.remaining):null}parseChildren(){if(this.remaining==="")return{};this.consumeOptional("/");let t=[];for(this.peekStartsWith("(")||t.push(this.parseSegment());this.peekStartsWith("/")&&!this.peekStartsWith("//")&&!this.peekStartsWith("/(");)this.capture("/"),t.push(this.parseSegment());let i={};this.peekStartsWith("/(")&&(this.capture("/"),i=this.parseParens(!0));let n={};return this.peekStartsWith("(")&&(n=this.parseParens(!1)),(t.length>0||Object.keys(i).length>0)&&(n[v]=new S(t,i)),n}parseSegment(){let t=Ue(this.remaining);if(t===""&&this.peekStartsWith(";"))throw new D(4009,!1);return this.capture(t),new X(ie(t),this.parseMatrixParams())}parseMatrixParams(){let t={};for(;this.consumeOptional(";");)this.parseParam(t);return t}parseParam(t){let i=Bi(this.remaining);if(!i)return;this.capture(i);let n="";if(this.consumeOptional("=")){let r=Ue(this.remaining);r&&(n=r,this.capture(n))}t[ie(i)]=ie(n)}parseQueryParam(t){let i=Wi(this.remaining);if(!i)return;this.capture(i);let n="";if(this.consumeOptional("=")){let s=Qi(this.remaining);s&&(n=s,this.capture(n))}let r=$n(i),o=$n(n);if(t.hasOwnProperty(r)){let s=t[r];Array.isArray(s)||(s=[s],t[r]=s),s.push(o)}else t[r]=o}parseParens(t){let i={};for(this.capture("(");!this.consumeOptional(")")&&this.remaining.length>0;){let n=Ue(this.remaining),r=this.remaining[n.length];if(r!=="/"&&r!==")"&&r!==";")throw new D(4010,!1);let o;n.indexOf(":")>-1?(o=n.slice(0,n.indexOf(":")),this.capture(o),this.capture(":")):t&&(o=v);let s=this.parseChildren();i[o]=Object.keys(s).length===1?s[v]:new S([],s),this.consumeOptional("//")}return i}peekStartsWith(t){return this.remaining.startsWith(t)}consumeOptional(t){return this.peekStartsWith(t)?(this.remaining=this.remaining.substring(t.length),!0):!1}capture(t){if(!this.consumeOptional(t))throw new D(4011,!1)}};function Kn(e){return e.segments.length>0?new S([],{[v]:e}):e}function Xn(e){let t={};for(let[n,r]of Object.entries(e.children)){let o=Xn(r);if(n===v&&o.segments.length===0&&o.hasChildren())for(let[s,u]of Object.entries(o.children))t[s]=u;else(o.segments.length>0||o.hasChildren())&&(t[n]=o)}let i=new S(e.segments,t);return Zi(i)}function Zi(e){if(e.numberOfChildren===1&&e.children[v]){let t=e.children[v];return new S(e.segments.concat(t.segments),t.children)}return e}function Et(e){return e instanceof q}function Yi(e,t,i=null,n=null){let r=Jn(e);return ti(r,t,i,n)}function Jn(e){let t;function i(o){let s={};for(let l of o.children){let c=i(l);s[l.outlet]=c}let u=new S(o.url,s);return o===e&&(t=u),u}let n=i(e.root),r=Kn(n);return t??r}function ti(e,t,i,n){let r=e;for(;r.parent;)r=r.parent;if(t.length===0)return xe(r,r,r,i,n);let o=Ki(t);if(o.toRoot())return xe(r,r,new S([],{}),i,n);let s=Xi(o,r,e),u=s.processChildren?At(s.segmentGroup,s.index,o.commands):ri(s.segmentGroup,s.index,o.commands);return xe(r,s.segmentGroup,u,i,n)}function oe(e){return typeof e=="object"&&e!=null&&!e.outlets&&!e.segmentPath}function Pt(e){return typeof e=="object"&&e!=null&&e.outlets}function xe(e,t,i,n,r){let o={};n&&Object.entries(n).forEach(([l,c])=>{o[l]=Array.isArray(c)?c.map(d=>`${d}`):`${c}`});let s;e===t?s=i:s=ei(e,t,i);let u=Kn(Xn(s));return new q(u,o,r)}function ei(e,t,i){let n={};return Object.entries(e.children).forEach(([r,o])=>{o===t?n[r]=i:n[r]=ei(o,t,i)}),new S(e.segments,n)}var se=class{constructor(t,i,n){a(this,"isAbsolute");a(this,"numberOfDoubleDots");a(this,"commands");if(this.isAbsolute=t,this.numberOfDoubleDots=i,this.commands=n,t&&n.length>0&&oe(n[0]))throw new D(4003,!1);let r=n.find(Pt);if(r&&r!==Bn(n))throw new D(4004,!1)}toRoot(){return this.isAbsolute&&this.commands.length===1&&this.commands[0]=="/"}};function Ki(e){if(typeof e[0]=="string"&&e.length===1&&e[0]==="/")return new se(!0,0,e);let t=0,i=!1,n=e.reduce((r,o,s)=>{if(typeof o=="object"&&o!=null){if(o.outlets){let u={};return Object.entries(o.outlets).forEach(([l,c])=>{u[l]=typeof c=="string"?c.split("/"):c}),[...r,{outlets:u}]}if(o.segmentPath)return[...r,o.segmentPath]}return typeof o!="string"?[...r,o]:s===0?(o.split("/").forEach((u,l)=>{l==0&&u==="."||(l==0&&u===""?i=!0:u===".."?t++:u!=""&&r.push(u))}),r):[...r,o]},[]);return new se(i,t,n)}var ct=class{constructor(t,i,n){a(this,"segmentGroup");a(this,"processChildren");a(this,"index");this.segmentGroup=t,this.processChildren=i,this.index=n}};function Xi(e,t,i){if(e.isAbsolute)return new ct(t,!0,0);if(!i)return new ct(t,!1,NaN);if(i.parent===null)return new ct(i,!0,0);let n=oe(e.commands[0])?0:1,r=i.segments.length-1+n;return Ji(i,r,e.numberOfDoubleDots)}function Ji(e,t,i){let n=e,r=t,o=i;for(;o>r;){if(o-=r,n=n.parent,!n)throw new D(4005,!1);r=n.segments.length}return new ct(n,!1,r-o)}function to(e){return Pt(e[0])?e[0].outlets:{[v]:e}}function ri(e,t,i){if(e??(e=new S([],{})),e.segments.length===0&&e.hasChildren())return At(e,t,i);let n=eo(e,t,i),r=i.slice(n.commandIndex);if(n.match&&n.pathIndexo!==v)&&e.children[v]&&e.numberOfChildren===1&&e.children[v].segments.length===0){let o=At(e.children[v],t,i);return new S(e.segments,o.children)}return Object.entries(n).forEach(([o,s])=>{typeof s=="string"&&(s=[s]),s!==null&&(r[o]=ri(e.children[o],t,s))}),Object.entries(e.children).forEach(([o,s])=>{n[o]===void 0&&(r[o]=s)}),new S(e.segments,r)}}function eo(e,t,i){let n=0,r=t,o={match:!1,pathIndex:0,commandIndex:0};for(;r=i.length)return o;let s=e.segments[r],u=i[n];if(Pt(u))break;let l=`${u}`,c=n0&&l===void 0)break;if(l&&c&&typeof c=="object"&&c.outlets===void 0){if(!zn(l,c,s))return o;n+=2}else{if(!zn(l,{},s))return o;n++}r++}return{match:!0,pathIndex:r,commandIndex:n}}function Fe(e,t,i){let n=e.segments.slice(0,t),r=0;for(;r{typeof n=="string"&&(n=[n]),n!==null&&(t[i]=Fe(new S([],{}),0,n))}),t}function kn(e){let t={};return Object.entries(e).forEach(([i,n])=>t[i]=`${n}`),t}function zn(e,t,i){return e==i.path&&F(t,i.parameters)}var Tt="imperative",b=function(e){return e[e.NavigationStart=0]="NavigationStart",e[e.NavigationEnd=1]="NavigationEnd",e[e.NavigationCancel=2]="NavigationCancel",e[e.NavigationError=3]="NavigationError",e[e.RoutesRecognized=4]="RoutesRecognized",e[e.ResolveStart=5]="ResolveStart",e[e.ResolveEnd=6]="ResolveEnd",e[e.GuardsCheckStart=7]="GuardsCheckStart",e[e.GuardsCheckEnd=8]="GuardsCheckEnd",e[e.RouteConfigLoadStart=9]="RouteConfigLoadStart",e[e.RouteConfigLoadEnd=10]="RouteConfigLoadEnd",e[e.ChildActivationStart=11]="ChildActivationStart",e[e.ChildActivationEnd=12]="ChildActivationEnd",e[e.ActivationStart=13]="ActivationStart",e[e.ActivationEnd=14]="ActivationEnd",e[e.Scroll=15]="Scroll",e[e.NavigationSkipped=16]="NavigationSkipped",e}(b||{}),P=class{constructor(t,i){a(this,"id");a(this,"url");this.id=t,this.url=i}},Ut=class extends P{constructor(i,n,r="imperative",o=null){super(i,n);a(this,"type",b.NavigationStart);a(this,"navigationTrigger");a(this,"restoredState");this.navigationTrigger=r,this.restoredState=o}toString(){return`NavigationStart(id: ${this.id}, url: '${this.url}')`}},tt=class extends P{constructor(i,n,r){super(i,n);a(this,"urlAfterRedirects");a(this,"type",b.NavigationEnd);this.urlAfterRedirects=r}toString(){return`NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`}},M=function(e){return e[e.Redirect=0]="Redirect",e[e.SupersededByNewNavigation=1]="SupersededByNewNavigation",e[e.NoDataFromResolver=2]="NoDataFromResolver",e[e.GuardRejected=3]="GuardRejected",e}(M||{}),_e=function(e){return e[e.IgnoredSameUrlNavigation=0]="IgnoredSameUrlNavigation",e[e.IgnoredByUrlHandlingStrategy=1]="IgnoredByUrlHandlingStrategy",e}(_e||{}),V=class extends P{constructor(i,n,r,o){super(i,n);a(this,"reason");a(this,"code");a(this,"type",b.NavigationCancel);this.reason=r,this.code=o}toString(){return`NavigationCancel(id: ${this.id}, url: '${this.url}')`}},et=class extends P{constructor(i,n,r,o){super(i,n);a(this,"reason");a(this,"code");a(this,"type",b.NavigationSkipped);this.reason=r,this.code=o}},xt=class extends P{constructor(i,n,r,o){super(i,n);a(this,"error");a(this,"target");a(this,"type",b.NavigationError);this.error=r,this.target=o}toString(){return`NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`}},ae=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.RoutesRecognized);this.urlAfterRedirects=r,this.state=o}toString(){return`RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},Ve=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.GuardsCheckStart);this.urlAfterRedirects=r,this.state=o}toString(){return`GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},qe=class extends P{constructor(i,n,r,o,s){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"shouldActivate");a(this,"type",b.GuardsCheckEnd);this.urlAfterRedirects=r,this.state=o,this.shouldActivate=s}toString(){return`GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`}},Be=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.ResolveStart);this.urlAfterRedirects=r,this.state=o}toString(){return`ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},He=class extends P{constructor(i,n,r,o){super(i,n);a(this,"urlAfterRedirects");a(this,"state");a(this,"type",b.ResolveEnd);this.urlAfterRedirects=r,this.state=o}toString(){return`ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`}},We=class{constructor(t){a(this,"route");a(this,"type",b.RouteConfigLoadStart);this.route=t}toString(){return`RouteConfigLoadStart(path: ${this.route.path})`}},Ge=class{constructor(t){a(this,"route");a(this,"type",b.RouteConfigLoadEnd);this.route=t}toString(){return`RouteConfigLoadEnd(path: ${this.route.path})`}},Qe=class{constructor(t){a(this,"snapshot");a(this,"type",b.ChildActivationStart);this.snapshot=t}toString(){return`ChildActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ze=class{constructor(t){a(this,"snapshot");a(this,"type",b.ChildActivationEnd);this.snapshot=t}toString(){return`ChildActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ye=class{constructor(t){a(this,"snapshot");a(this,"type",b.ActivationStart);this.snapshot=t}toString(){return`ActivationStart(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}},Ke=class{constructor(t){a(this,"snapshot");a(this,"type",b.ActivationEnd);this.snapshot=t}toString(){return`ActivationEnd(path: '${this.snapshot.routeConfig&&this.snapshot.routeConfig.path||""}')`}};var Nt=class{},pt=class{constructor(t,i){a(this,"url");a(this,"navigationBehaviorOptions");this.url=t,this.navigationBehaviorOptions=i}};function no(e,t){return e.providers&&!e._injector&&(e._injector=Vr(e.providers,t,`Route: ${e.path}`)),e._injector??t}function L(e){return e.outlet||v}function io(e,t){let i=e.filter(n=>L(n)===t);return i.push(...e.filter(n=>L(n)!==t)),i}function Ft(e){var t;if(!e)return null;if((t=e.routeConfig)!=null&&t._injector)return e.routeConfig._injector;for(let i=e.parent;i;i=i.parent){let n=i.routeConfig;if(n!=null&&n._loadedInjector)return n._loadedInjector;if(n!=null&&n._injector)return n._injector}return null}var Xe=class{constructor(t){a(this,"rootInjector");a(this,"outlet",null);a(this,"route",null);a(this,"children");a(this,"attachRef",null);this.rootInjector=t,this.children=new fe(this.rootInjector)}get injector(){var t;return Ft((t=this.route)==null?void 0:t.snapshot)??this.rootInjector}},fe=(()=>{let t=class t{constructor(n){a(this,"rootInjector");a(this,"contexts",new Map);this.rootInjector=n}onChildOutletCreated(n,r){let o=this.getOrCreateContext(n);o.outlet=r,this.contexts.set(n,o)}onChildOutletDestroyed(n){let r=this.getContext(n);r&&(r.outlet=null,r.attachRef=null)}onOutletDeactivated(){let n=this.contexts;return this.contexts=new Map,n}onOutletReAttached(n){this.contexts=n}getOrCreateContext(n){let r=this.getContext(n);return r||(r=new Xe(this.rootInjector),this.contexts.set(n,r)),r}getContext(n){return this.contexts.get(n)||null}};a(t,"\u0275fac",function(r){return new(r||t)(Q(Wt))}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),ue=class{constructor(t){a(this,"_root");this._root=t}get root(){return this._root.value}parent(t){let i=this.pathFromRoot(t);return i.length>1?i[i.length-2]:null}children(t){let i=Je(t,this._root);return i?i.children.map(n=>n.value):[]}firstChild(t){let i=Je(t,this._root);return i&&i.children.length>0?i.children[0].value:null}siblings(t){let i=tr(t,this._root);return i.length<2?[]:i[i.length-2].children.map(r=>r.value).filter(r=>r!==t)}pathFromRoot(t){return tr(t,this._root).map(i=>i.value)}};function Je(e,t){if(e===t.value)return t;for(let i of t.children){let n=Je(e,i);if(n)return n}return null}function tr(e,t){if(e===t.value)return[t];for(let i of t.children){let n=tr(e,i);if(n.length)return n.unshift(t),n}return[]}var T=class{constructor(t,i){a(this,"value");a(this,"children");this.value=t,this.children=i}toString(){return`TreeNode(${this.value})`}};function ut(e){let t={};return e&&e.children.forEach(i=>t[i.value.outlet]=i),t}var ce=class extends ue{constructor(i,n){super(i);a(this,"snapshot");this.snapshot=n,lr(this,i)}toString(){return this.snapshot.toString()}};function ni(e){let t=oo(e),i=new O([new X("",{})]),n=new O({}),r=new O({}),o=new O({}),s=new O(""),u=new ft(i,n,o,s,r,v,e,t.root);return u.snapshot=t.root,new ce(new T(u,[]),t)}function oo(e){let t={},i={},n={},r="",o=new lt([],t,n,r,i,v,e,null,{});return new de("",new T(o,[]))}var ft=class{constructor(t,i,n,r,o,s,u,l){a(this,"urlSubject");a(this,"paramsSubject");a(this,"queryParamsSubject");a(this,"fragmentSubject");a(this,"dataSubject");a(this,"outlet");a(this,"component");a(this,"snapshot");a(this,"_futureSnapshot");a(this,"_routerState");a(this,"_paramMap");a(this,"_queryParamMap");a(this,"title");a(this,"url");a(this,"params");a(this,"queryParams");a(this,"fragment");a(this,"data");var c;this.urlSubject=t,this.paramsSubject=i,this.queryParamsSubject=n,this.fragmentSubject=r,this.dataSubject=o,this.outlet=s,this.component=u,this._futureSnapshot=l,this.title=((c=this.dataSubject)==null?void 0:c.pipe(y(d=>d[zt])))??g(void 0),this.url=t,this.params=i,this.queryParams=n,this.fragment=r,this.data=o}get routeConfig(){return this._futureSnapshot.routeConfig}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??(this._paramMap=this.params.pipe(y(t=>ht(t)))),this._paramMap}get queryParamMap(){return this._queryParamMap??(this._queryParamMap=this.queryParams.pipe(y(t=>ht(t)))),this._queryParamMap}toString(){return this.snapshot?this.snapshot.toString():`Future(${this._futureSnapshot})`}};function le(e,t,i="emptyOnly"){var o;let n,{routeConfig:r}=e;return t!==null&&(i==="always"||(r==null?void 0:r.path)===""||!t.component&&!((o=t.routeConfig)!=null&&o.loadComponent))?n={params:f(f({},t.params),e.params),data:f(f({},t.data),e.data),resolve:f(f(f(f({},e.data),t.data),r==null?void 0:r.data),e._resolvedData)}:n={params:f({},e.params),data:f({},e.data),resolve:f(f({},e.data),e._resolvedData??{})},r&&oi(r)&&(n.resolve[zt]=r.title),n}var lt=class{constructor(t,i,n,r,o,s,u,l,c){a(this,"url");a(this,"params");a(this,"queryParams");a(this,"fragment");a(this,"data");a(this,"outlet");a(this,"component");a(this,"routeConfig");a(this,"_resolve");a(this,"_resolvedData");a(this,"_routerState");a(this,"_paramMap");a(this,"_queryParamMap");this.url=t,this.params=i,this.queryParams=n,this.fragment=r,this.data=o,this.outlet=s,this.component=u,this.routeConfig=l,this._resolve=c}get title(){var t;return(t=this.data)==null?void 0:t[zt]}get root(){return this._routerState.root}get parent(){return this._routerState.parent(this)}get firstChild(){return this._routerState.firstChild(this)}get children(){return this._routerState.children(this)}get pathFromRoot(){return this._routerState.pathFromRoot(this)}get paramMap(){return this._paramMap??(this._paramMap=ht(this.params)),this._paramMap}get queryParamMap(){return this._queryParamMap??(this._queryParamMap=ht(this.queryParams)),this._queryParamMap}toString(){let t=this.url.map(n=>n.toString()).join("/"),i=this.routeConfig?this.routeConfig.path:"";return`Route(url:'${t}', path:'${i}')`}},de=class extends ue{constructor(i,n){super(n);a(this,"url");this.url=i,lr(this,n)}toString(){return ii(this._root)}};function lr(e,t){t.value._routerState=e,t.children.forEach(i=>lr(e,i))}function ii(e){let t=e.children.length>0?` { ${e.children.map(ii).join(", ")} } `:"";return`${e.value}${t}`}function Ne(e){if(e.snapshot){let t=e.snapshot,i=e._futureSnapshot;e.snapshot=i,F(t.queryParams,i.queryParams)||e.queryParamsSubject.next(i.queryParams),t.fragment!==i.fragment&&e.fragmentSubject.next(i.fragment),F(t.params,i.params)||e.paramsSubject.next(i.params),Ui(t.url,i.url)||e.urlSubject.next(i.url),F(t.data,i.data)||e.dataSubject.next(i.data)}else e.snapshot=e._futureSnapshot,e.dataSubject.next(e._futureSnapshot.data)}function er(e,t){let i=F(e.params,t.params)&&Li(e.url,t.url),n=!e.parent!=!t.parent;return i&&!n&&(!e.parent||er(e.parent,t.parent))}function oi(e){return typeof e.title=="string"||e.title===null}var so=new j(""),dr=(()=>{let t=class t{constructor(){a(this,"activated",null);a(this,"_activatedRoute",null);a(this,"name",v);a(this,"activateEvents",new Ct);a(this,"deactivateEvents",new Ct);a(this,"attachEvents",new Ct);a(this,"detachEvents",new Ct);a(this,"routerOutletData",Lr(void 0));a(this,"parentContexts",h(fe));a(this,"location",h(Fr));a(this,"changeDetector",h(Oe));a(this,"inputBinder",h(hr,{optional:!0}));a(this,"supportsBindingToComponentInputs",!0)}get activatedComponentRef(){return this.activated}ngOnChanges(n){if(n.name){let{firstChange:r,previousValue:o}=n.name;if(r)return;this.isTrackedInParentContexts(o)&&(this.deactivate(),this.parentContexts.onChildOutletDestroyed(o)),this.initializeOutletWithName()}}ngOnDestroy(){var n;this.isTrackedInParentContexts(this.name)&&this.parentContexts.onChildOutletDestroyed(this.name),(n=this.inputBinder)==null||n.unsubscribeFromRouteData(this)}isTrackedInParentContexts(n){var r;return((r=this.parentContexts.getContext(n))==null?void 0:r.outlet)===this}ngOnInit(){this.initializeOutletWithName()}initializeOutletWithName(){if(this.parentContexts.onChildOutletCreated(this.name,this),this.activated)return;let n=this.parentContexts.getContext(this.name);n!=null&&n.route&&(n.attachRef?this.attach(n.attachRef,n.route):this.activateWith(n.route,n.injector))}get isActivated(){return!!this.activated}get component(){if(!this.activated)throw new D(4012,!1);return this.activated.instance}get activatedRoute(){if(!this.activated)throw new D(4012,!1);return this._activatedRoute}get activatedRouteData(){return this._activatedRoute?this._activatedRoute.snapshot.data:{}}detach(){if(!this.activated)throw new D(4012,!1);this.location.detach();let n=this.activated;return this.activated=null,this._activatedRoute=null,this.detachEvents.emit(n.instance),n}attach(n,r){var o;this.activated=n,this._activatedRoute=r,this.location.insert(n.hostView),(o=this.inputBinder)==null||o.bindActivatedRouteToOutletComponent(this),this.attachEvents.emit(n.instance)}deactivate(){if(this.activated){let n=this.component;this.activated.destroy(),this.activated=null,this._activatedRoute=null,this.deactivateEvents.emit(n)}}activateWith(n,r){var d;if(this.isActivated)throw new D(4013,!1);this._activatedRoute=n;let o=this.location,u=n.snapshot.component,l=this.parentContexts.getOrCreateContext(this.name).children,c=new rr(n,l,o.injector,this.routerOutletData);this.activated=o.createComponent(u,{index:o.length,injector:c,environmentInjector:r}),this.changeDetector.markForCheck(),(d=this.inputBinder)==null||d.bindActivatedRouteToOutletComponent(this),this.activateEvents.emit(this.activated.instance)}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275dir",Z({type:t,selectors:[["router-outlet"]],inputs:{name:"name",routerOutletData:[1,"routerOutletData"]},outputs:{activateEvents:"activate",deactivateEvents:"deactivate",attachEvents:"attach",detachEvents:"detach"},exportAs:["outlet"],features:[xr]}));let e=t;return e})(),rr=class e{constructor(t,i,n,r){a(this,"route");a(this,"childContexts");a(this,"parent");a(this,"outletData");this.route=t,this.childContexts=i,this.parent=n,this.outletData=r}__ngOutletInjector(t){return new e(this.route,this.childContexts,t,this.outletData)}get(t,i){return t===ft?this.route:t===fe?this.childContexts:t===so?this.outletData:this.parent.get(t,i)}},hr=new j("");function ao(e,t,i){let n=jt(e,t._root,i?i._root:void 0);return new ce(n,t)}function jt(e,t,i){if(i&&e.shouldReuseRoute(t.value,i.value.snapshot)){let n=i.value;n._futureSnapshot=t.value;let r=uo(e,t,i);return new T(n,r)}else{if(e.shouldAttach(t.value)){let o=e.retrieve(t.value);if(o!==null){let s=o.route;return s.value._futureSnapshot=t.value,s.children=t.children.map(u=>jt(e,u)),s}}let n=co(t.value),r=t.children.map(o=>jt(e,o));return new T(n,r)}}function uo(e,t,i){return t.children.map(n=>{for(let r of i.children)if(e.shouldReuseRoute(n.value,r.value.snapshot))return jt(e,n,r);return jt(e,n)})}function co(e){return new ft(new O(e.url),new O(e.params),new O(e.queryParams),new O(e.fragment),new O(e.data),e.outlet,e.component,e)}var Lt=class{constructor(t,i){a(this,"redirectTo");a(this,"navigationBehaviorOptions");this.redirectTo=t,this.navigationBehaviorOptions=i}},si="ngNavigationCancelingError";function he(e,t){let{redirectTo:i,navigationBehaviorOptions:n}=Et(t)?{redirectTo:t,navigationBehaviorOptions:void 0}:t,r=ai(!1,M.Redirect);return r.url=i,r.navigationBehaviorOptions=n,r}function ai(e,t){let i=new Error(`NavigationCancelingError: ${e||""}`);return i[si]=!0,i.cancellationCode=t,i}function lo(e){return ui(e)&&Et(e.url)}function ui(e){return!!e&&e[si]}var ho=(e,t,i,n)=>y(r=>(new nr(t,r.targetRouterState,r.currentRouterState,i,n).activate(e),r)),nr=class{constructor(t,i,n,r,o){a(this,"routeReuseStrategy");a(this,"futureState");a(this,"currState");a(this,"forwardEvent");a(this,"inputBindingEnabled");this.routeReuseStrategy=t,this.futureState=i,this.currState=n,this.forwardEvent=r,this.inputBindingEnabled=o}activate(t){let i=this.futureState._root,n=this.currState?this.currState._root:null;this.deactivateChildRoutes(i,n,t),Ne(this.futureState.root),this.activateChildRoutes(i,n,t)}deactivateChildRoutes(t,i,n){let r=ut(i);t.children.forEach(o=>{let s=o.value.outlet;this.deactivateRoutes(o,r[s],n),delete r[s]}),Object.values(r).forEach(o=>{this.deactivateRouteAndItsChildren(o,n)})}deactivateRoutes(t,i,n){let r=t.value,o=i?i.value:null;if(r===o)if(r.component){let s=n.getContext(r.outlet);s&&this.deactivateChildRoutes(t,i,s.children)}else this.deactivateChildRoutes(t,i,n);else o&&this.deactivateRouteAndItsChildren(i,n)}deactivateRouteAndItsChildren(t,i){t.value.component&&this.routeReuseStrategy.shouldDetach(t.value.snapshot)?this.detachAndStoreRouteSubtree(t,i):this.deactivateRouteAndOutlet(t,i)}detachAndStoreRouteSubtree(t,i){let n=i.getContext(t.value.outlet),r=n&&t.value.component?n.children:i,o=ut(t);for(let s of Object.values(o))this.deactivateRouteAndItsChildren(s,r);if(n&&n.outlet){let s=n.outlet.detach(),u=n.children.onOutletDeactivated();this.routeReuseStrategy.store(t.value.snapshot,{componentRef:s,route:t,contexts:u})}}deactivateRouteAndOutlet(t,i){let n=i.getContext(t.value.outlet),r=n&&t.value.component?n.children:i,o=ut(t);for(let s of Object.values(o))this.deactivateRouteAndItsChildren(s,r);n&&(n.outlet&&(n.outlet.deactivate(),n.children.onOutletDeactivated()),n.attachRef=null,n.route=null)}activateChildRoutes(t,i,n){let r=ut(i);t.children.forEach(o=>{this.activateRoutes(o,r[o.value.outlet],n),this.forwardEvent(new Ke(o.value.snapshot))}),t.children.length&&this.forwardEvent(new Ze(t.value.snapshot))}activateRoutes(t,i,n){let r=t.value,o=i?i.value:null;if(Ne(r),r===o)if(r.component){let s=n.getOrCreateContext(r.outlet);this.activateChildRoutes(t,i,s.children)}else this.activateChildRoutes(t,i,n);else if(r.component){let s=n.getOrCreateContext(r.outlet);if(this.routeReuseStrategy.shouldAttach(r.snapshot)){let u=this.routeReuseStrategy.retrieve(r.snapshot);this.routeReuseStrategy.store(r.snapshot,null),s.children.onOutletReAttached(u.contexts),s.attachRef=u.componentRef,s.route=u.route.value,s.outlet&&s.outlet.attach(u.componentRef,u.route.value),Ne(u.route.value),this.activateChildRoutes(t,null,s.children)}else s.attachRef=null,s.route=r,s.outlet&&s.outlet.activateWith(r,s.injector),this.activateChildRoutes(t,null,s.children)}else this.activateChildRoutes(t,null,n)}},pe=class{constructor(t){a(this,"path");a(this,"route");this.path=t,this.route=this.path[this.path.length-1]}},dt=class{constructor(t,i){a(this,"component");a(this,"route");this.component=t,this.route=i}};function po(e,t,i){let n=e._root,r=t?t._root:null;return It(n,r,i,[n.value])}function fo(e){let t=e.routeConfig?e.routeConfig.canActivateChild:null;return!t||t.length===0?null:{node:e,guards:t}}function vt(e,t){let i=Symbol(),n=t.get(e,i);return n===i?typeof e=="function"&&!Or(e)?e:t.get(e):n}function It(e,t,i,n,r={canDeactivateChecks:[],canActivateChecks:[]}){let o=ut(t);return e.children.forEach(s=>{go(s,o[s.value.outlet],i,n.concat([s.value]),r),delete o[s.value.outlet]}),Object.entries(o).forEach(([s,u])=>Mt(u,i.getContext(s),r)),r}function go(e,t,i,n,r={canDeactivateChecks:[],canActivateChecks:[]}){let o=e.value,s=t?t.value:null,u=i?i.getContext(e.value.outlet):null;if(s&&o.routeConfig===s.routeConfig){let l=vo(s,o,o.routeConfig.runGuardsAndResolvers);l?r.canActivateChecks.push(new pe(n)):(o.data=s.data,o._resolvedData=s._resolvedData),o.component?It(e,t,u?u.children:null,n,r):It(e,t,i,n,r),l&&u&&u.outlet&&u.outlet.isActivated&&r.canDeactivateChecks.push(new dt(u.outlet.component,s))}else s&&Mt(t,u,r),r.canActivateChecks.push(new pe(n)),o.component?It(e,null,u?u.children:null,n,r):It(e,null,i,n,r);return r}function vo(e,t,i){if(typeof i=="function")return i(e,t);switch(i){case"pathParamsChange":return!J(e.url,t.url);case"pathParamsOrQueryParamsChange":return!J(e.url,t.url)||!F(e.queryParams,t.queryParams);case"always":return!0;case"paramsOrQueryParamsChange":return!er(e,t)||!F(e.queryParams,t.queryParams);case"paramsChange":default:return!er(e,t)}}function Mt(e,t,i){let n=ut(e),r=e.value;Object.entries(n).forEach(([o,s])=>{r.component?t?Mt(s,t.children.getContext(o),i):Mt(s,null,i):Mt(s,t,i)}),r.component?t&&t.outlet&&t.outlet.isActivated?i.canDeactivateChecks.push(new dt(t.outlet.component,r)):i.canDeactivateChecks.push(new dt(null,r)):i.canDeactivateChecks.push(new dt(null,r))}function _t(e){return typeof e=="function"}function mo(e){return typeof e=="boolean"}function yo(e){return e&&_t(e.canLoad)}function So(e){return e&&_t(e.canActivate)}function wo(e){return e&&_t(e.canActivateChild)}function Co(e){return e&&_t(e.canDeactivate)}function Ro(e){return e&&_t(e.canMatch)}function ci(e){return e instanceof Cr||(e==null?void 0:e.name)==="EmptyError"}var ee=Symbol("INITIAL_VALUE");function gt(){return k(e=>Se(e.map(t=>t.pipe(it(1),Ht(ee)))).pipe(y(t=>{for(let i of t)if(i!==!0){if(i===ee)return ee;if(i===!1||bo(i))return i}return!0}),B(t=>t!==ee),it(1)))}function bo(e){return Et(e)||e instanceof Lt}function Io(e,t){return E(i=>{let{targetSnapshot:n,currentSnapshot:r,guards:{canActivateChecks:o,canDeactivateChecks:s}}=i;return s.length===0&&o.length===0?g(A(f({},i),{guardsResult:!0})):Do(s,n,r,e).pipe(E(u=>u&&mo(u)?Ao(n,o,e,t):g(u)),y(u=>A(f({},i),{guardsResult:u})))})}function Do(e,t,i,n){return N(e).pipe(E(r=>Po(r.component,r.route,i,t,n)),H(r=>r!==!0,!0))}function Ao(e,t,i,n){return N(t).pipe(St(r=>Rr(Mo(r.route.parent,n),To(r.route,n),Eo(e,r.path,i),Oo(e,r.route,i))),H(r=>r!==!0,!0))}function To(e,t){return e!==null&&t&&t(new Ye(e)),g(!0)}function Mo(e,t){return e!==null&&t&&t(new Qe(e)),g(!0)}function Oo(e,t,i){let n=t.routeConfig?t.routeConfig.canActivate:null;if(!n||n.length===0)return g(!0);let r=n.map(o=>we(()=>{let s=Ft(t)??i,u=vt(o,s),l=So(u)?u.canActivate(t,e):_(s,()=>u(t,e));return W(l).pipe(H())}));return g(r).pipe(gt())}function Eo(e,t,i){let n=t[t.length-1],o=t.slice(0,t.length-1).reverse().map(s=>fo(s)).filter(s=>s!==null).map(s=>we(()=>{let u=s.guards.map(l=>{let c=Ft(s.node)??i,d=vt(l,c),m=wo(d)?d.canActivateChild(n,e):_(c,()=>d(n,e));return W(m).pipe(H())});return g(u).pipe(gt())}));return g(o).pipe(gt())}function Po(e,t,i,n,r){let o=t&&t.routeConfig?t.routeConfig.canDeactivate:null;if(!o||o.length===0)return g(!0);let s=o.map(u=>{let l=Ft(t)??r,c=vt(u,l),d=Co(c)?c.canDeactivate(e,t,i,n):_(l,()=>c(e,t,i,n));return W(d).pipe(H())});return g(s).pipe(gt())}function Uo(e,t,i,n){let r=t.canLoad;if(r===void 0||r.length===0)return g(!0);let o=r.map(s=>{let u=vt(s,e),l=yo(u)?u.canLoad(t,i):_(e,()=>u(t,i));return W(l)});return g(o).pipe(gt(),li(n))}function li(e){return yr(I(t=>{if(typeof t!="boolean")throw he(e,t)}),y(t=>t===!0))}function xo(e,t,i,n){let r=t.canMatch;if(!r||r.length===0)return g(!0);let o=r.map(s=>{let u=vt(s,e),l=Ro(u)?u.canMatch(t,i):_(e,()=>u(t,i));return W(l)});return g(o).pipe(gt(),li(n))}var $t=class{constructor(t){a(this,"segmentGroup");this.segmentGroup=t||null}},kt=class extends Error{constructor(i){super();a(this,"urlTree");this.urlTree=i}};function at(e){return yt(new $t(e))}function No(e){return yt(new D(4e3,!1))}function jo(e){return yt(ai(!1,M.GuardRejected))}var ir=class{constructor(t,i){a(this,"urlSerializer");a(this,"urlTree");this.urlSerializer=t,this.urlTree=i}lineralizeSegments(t,i){let n=[],r=i.root;for(;;){if(n=n.concat(r.segments),r.numberOfChildren===0)return g(n);if(r.numberOfChildren>1||!r.children[v])return No(`${t.redirectTo}`);r=r.children[v]}}applyRedirectCommands(t,i,n,r,o){if(typeof i!="string"){let u=i,{queryParams:l,fragment:c,routeConfig:d,url:m,outlet:p,params:w,data:C,title:U}=r,x=_(o,()=>u({params:w,data:C,queryParams:l,fragment:c,routeConfig:d,url:m,outlet:p,title:U}));if(x instanceof q)throw new kt(x);i=x}let s=this.applyRedirectCreateUrlTree(i,this.urlSerializer.parse(i),t,n);if(i[0]==="/")throw new kt(s);return s}applyRedirectCreateUrlTree(t,i,n,r){let o=this.createSegmentGroup(t,i.root,n,r);return new q(o,this.createQueryParams(i.queryParams,this.urlTree.queryParams),i.fragment)}createQueryParams(t,i){let n={};return Object.entries(t).forEach(([r,o])=>{if(typeof o=="string"&&o[0]===":"){let u=o.substring(1);n[r]=i[u]}else n[r]=o}),n}createSegmentGroup(t,i,n,r){let o=this.createSegments(t,i.segments,n,r),s={};return Object.entries(i.children).forEach(([u,l])=>{s[u]=this.createSegmentGroup(t,l,n,r)}),new S(o,s)}createSegments(t,i,n,r){return i.map(o=>o.path[0]===":"?this.findPosParam(t,o,r):this.findOrReturn(o,n))}findPosParam(t,i,n){let r=n[i.path.substring(1)];if(!r)throw new D(4001,!1);return r}findOrReturn(t,i){let n=0;for(let r of i){if(r.path===t.path)return i.splice(n),r;n++}return t}},or={matched:!1,consumedSegments:[],remainingSegments:[],parameters:{},positionalParamSegments:{}};function Lo(e,t,i,n,r){let o=di(e,t,i);return o.matched?(n=no(t,n),xo(n,t,i,r).pipe(y(s=>s===!0?o:f({},or)))):g(o)}function di(e,t,i){if(t.path==="**")return $o(i);if(t.path==="")return t.pathMatch==="full"&&(e.hasChildren()||i.length>0)?f({},or):{matched:!0,consumedSegments:[],remainingSegments:i,parameters:{},positionalParamSegments:{}};let r=(t.matcher||Pi)(i,e,t);if(!r)return f({},or);let o={};Object.entries(r.posParams??{}).forEach(([u,l])=>{o[u]=l.path});let s=r.consumed.length>0?f(f({},o),r.consumed[r.consumed.length-1].parameters):o;return{matched:!0,consumedSegments:r.consumed,remainingSegments:i.slice(r.consumed.length),parameters:s,positionalParamSegments:r.posParams??{}}}function $o(e){return{matched:!0,parameters:e.length>0?Bn(e).parameters:{},consumedSegments:e,remainingSegments:[],positionalParamSegments:{}}}function Fn(e,t,i,n){return i.length>0&&Fo(e,i,n)?{segmentGroup:new S(t,zo(n,new S(i,e.children))),slicedSegments:[]}:i.length===0&&_o(e,i,n)?{segmentGroup:new S(e.segments,ko(e,i,n,e.children)),slicedSegments:i}:{segmentGroup:new S(e.segments,e.children),slicedSegments:i}}function ko(e,t,i,n){let r={};for(let o of i)if(ge(e,t,o)&&!n[L(o)]){let s=new S([],{});r[L(o)]=s}return f(f({},n),r)}function zo(e,t){let i={};i[v]=t;for(let n of e)if(n.path===""&&L(n)!==v){let r=new S([],{});i[L(n)]=r}return i}function Fo(e,t,i){return i.some(n=>ge(e,t,n)&&L(n)!==v)}function _o(e,t,i){return i.some(n=>ge(e,t,n))}function ge(e,t,i){return(e.hasChildren()||t.length>0)&&i.pathMatch==="full"?!1:i.path===""}function Vo(e,t,i){return t.length===0&&!e.children[i]}var sr=class{};function qo(e,t,i,n,r,o,s="emptyOnly"){return new ar(e,t,i,n,r,s,o).recognize()}var Bo=31,ar=class{constructor(t,i,n,r,o,s,u){a(this,"injector");a(this,"configLoader");a(this,"rootComponentType");a(this,"config");a(this,"urlTree");a(this,"paramsInheritanceStrategy");a(this,"urlSerializer");a(this,"applyRedirects");a(this,"absoluteRedirectCount",0);a(this,"allowRedirects",!0);this.injector=t,this.configLoader=i,this.rootComponentType=n,this.config=r,this.urlTree=o,this.paramsInheritanceStrategy=s,this.urlSerializer=u,this.applyRedirects=new ir(this.urlSerializer,this.urlTree)}noMatchError(t){return new D(4002,`'${t.segmentGroup}'`)}recognize(){let t=Fn(this.urlTree.root,[],[],this.config).segmentGroup;return this.match(t).pipe(y(({children:i,rootSnapshot:n})=>{let r=new T(n,i),o=new de("",r),s=Yi(n,[],this.urlTree.queryParams,this.urlTree.fragment);return s.queryParams=this.urlTree.queryParams,o.url=this.urlSerializer.serialize(s),{state:o,tree:s}}))}match(t){let i=new lt([],Object.freeze({}),Object.freeze(f({},this.urlTree.queryParams)),this.urlTree.fragment,Object.freeze({}),v,this.rootComponentType,null,{});return this.processSegmentGroup(this.injector,this.config,t,v,i).pipe(y(n=>({children:n,rootSnapshot:i})),nt(n=>{if(n instanceof kt)return this.urlTree=n.urlTree,this.match(n.urlTree.root);throw n instanceof $t?this.noMatchError(n):n}))}processSegmentGroup(t,i,n,r,o){return n.segments.length===0&&n.hasChildren()?this.processChildren(t,i,n,o):this.processSegment(t,i,n,n.segments,r,!0,o).pipe(y(s=>s instanceof T?[s]:[]))}processChildren(t,i,n,r){let o=[];for(let s of Object.keys(n.children))s==="primary"?o.unshift(s):o.push(s);return N(o).pipe(St(s=>{let u=n.children[s],l=io(i,s);return this.processSegmentGroup(t,l,u,s,r)}),Ar((s,u)=>(s.push(...u),s)),Ce(null),Dr(),E(s=>{if(s===null)return at(n);let u=hi(s);return Ho(u),g(u)}))}processSegment(t,i,n,r,o,s,u){return N(i).pipe(St(l=>this.processSegmentAgainstRoute(l._injector??t,i,l,n,r,o,s,u).pipe(nt(c=>{if(c instanceof $t)return g(null);throw c}))),H(l=>!!l),nt(l=>{if(ci(l))return Vo(n,r,o)?g(new sr):at(n);throw l}))}processSegmentAgainstRoute(t,i,n,r,o,s,u,l){return L(n)!==s&&(s===v||!ge(r,o,n))?at(r):n.redirectTo===void 0?this.matchSegmentAgainstRoute(t,r,n,o,s,l):this.allowRedirects&&u?this.expandSegmentAgainstRouteUsingRedirect(t,r,i,n,o,s,l):at(r)}expandSegmentAgainstRouteUsingRedirect(t,i,n,r,o,s,u){let{matched:l,parameters:c,consumedSegments:d,positionalParamSegments:m,remainingSegments:p}=di(i,r,o);if(!l)return at(i);typeof r.redirectTo=="string"&&r.redirectTo[0]==="/"&&(this.absoluteRedirectCount++,this.absoluteRedirectCount>Bo&&(this.allowRedirects=!1));let w=new lt(o,c,Object.freeze(f({},this.urlTree.queryParams)),this.urlTree.fragment,_n(r),L(r),r.component??r._loadedComponent??null,r,Vn(r)),C=le(w,u,this.paramsInheritanceStrategy);w.params=Object.freeze(C.params),w.data=Object.freeze(C.data);let U=this.applyRedirects.applyRedirectCommands(d,r.redirectTo,m,w,t);return this.applyRedirects.lineralizeSegments(r,U).pipe(E(x=>this.processSegment(t,n,i,x.concat(p),s,!1,u)))}matchSegmentAgainstRoute(t,i,n,r,o,s){let u=Lo(i,n,r,t,this.urlSerializer);return n.path==="**"&&(i.children={}),u.pipe(k(l=>l.matched?(t=n._injector??t,this.getChildConfig(t,n,r).pipe(k(({routes:c})=>{let d=n._loadedInjector??t,{parameters:m,consumedSegments:p,remainingSegments:w}=l,C=new lt(p,m,Object.freeze(f({},this.urlTree.queryParams)),this.urlTree.fragment,_n(n),L(n),n.component??n._loadedComponent??null,n,Vn(n)),U=le(C,s,this.paramsInheritanceStrategy);C.params=Object.freeze(U.params),C.data=Object.freeze(U.data);let{segmentGroup:x,slicedSegments:mt}=Fn(i,p,w,c);if(mt.length===0&&x.hasChildren())return this.processChildren(d,c,x,C).pipe(y(Vt=>new T(C,Vt)));if(c.length===0&&mt.length===0)return g(new T(C,[]));let ve=L(n)===o;return this.processSegment(d,c,x,mt,ve?v:o,!0,C).pipe(y(Vt=>new T(C,Vt instanceof T?[Vt]:[])))}))):at(i)))}getChildConfig(t,i,n){return i.children?g({routes:i.children,injector:t}):i.loadChildren?i._loadedRoutes!==void 0?g({routes:i._loadedRoutes,injector:i._loadedInjector}):Uo(t,i,n,this.urlSerializer).pipe(E(r=>r?this.configLoader.loadChildren(t,i).pipe(I(o=>{i._loadedRoutes=o.routes,i._loadedInjector=o.injector})):jo(i))):g({routes:[],injector:t})}};function Ho(e){e.sort((t,i)=>t.value.outlet===v?-1:i.value.outlet===v?1:t.value.outlet.localeCompare(i.value.outlet))}function Wo(e){let t=e.value.routeConfig;return t&&t.path===""}function hi(e){let t=[],i=new Set;for(let n of e){if(!Wo(n)){t.push(n);continue}let r=t.find(o=>n.value.routeConfig===o.value.routeConfig);r!==void 0?(r.children.push(...n.children),i.add(r)):t.push(n)}for(let n of i){let r=hi(n.children);t.push(new T(n.value,r))}return t.filter(n=>!i.has(n))}function _n(e){return e.data||{}}function Vn(e){return e.resolve||{}}function Go(e,t,i,n,r,o){return E(s=>qo(e,t,i,n,s.extractedUrl,r,o).pipe(y(({state:u,tree:l})=>A(f({},s),{targetSnapshot:u,urlAfterRedirects:l}))))}function Qo(e,t){return E(i=>{let{targetSnapshot:n,guards:{canActivateChecks:r}}=i;if(!r.length)return g(i);let o=new Set(r.map(l=>l.route)),s=new Set;for(let l of o)if(!s.has(l))for(let c of pi(l))s.add(c);let u=0;return N(s).pipe(St(l=>o.has(l)?Zo(l,n,e,t):(l.data=le(l,l.parent,e).resolve,g(void 0))),I(()=>u++),Re(1),E(l=>u===s.size?g(i):$))})}function pi(e){let t=e.children.map(i=>pi(i)).flat();return[e,...t]}function Zo(e,t,i,n){let r=e.routeConfig,o=e._resolve;return(r==null?void 0:r.title)!==void 0&&!oi(r)&&(o[zt]=r.title),Yo(o,e,t,n).pipe(y(s=>(e._resolvedData=s,e.data=le(e,e.parent,i).resolve,null)))}function Yo(e,t,i,n){let r=$e(e);if(r.length===0)return g({});let o={};return N(r).pipe(E(s=>Ko(e[s],t,i,n).pipe(H(),I(u=>{if(u instanceof Lt)throw he(new Ot,u);o[s]=u}))),Re(1),Ir(o),nt(s=>ci(s)?$:yt(s)))}function Ko(e,t,i,n){let r=Ft(t)??n,o=vt(e,r),s=o.resolve?o.resolve(t,i):_(r,()=>o(t,i));return W(s)}function je(e){return k(t=>{let i=e(t);return i?N(i).pipe(y(()=>t)):g(t)})}var fi=(()=>{let t=class t{buildTitle(n){let r,o=n.root;for(;o!==void 0;)r=this.getResolvedTitleForRoute(o)??r,o=o.children.find(s=>s.outlet===v);return r}getResolvedTitleForRoute(n){return n.data[zt]}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(Xo),providedIn:"root"}));let e=t;return e})(),Xo=(()=>{let t=class t extends fi{constructor(r){super();a(this,"title");this.title=r}updateTitle(r){let o=this.buildTitle(r);o!==void 0&&this.title.setTitle(o)}};a(t,"\u0275fac",function(o){return new(o||t)(Q(on))}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),pr=new j("",{providedIn:"root",factory:()=>({})}),Jo=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275cmp",ot({type:t,selectors:[["ng-component"]],decls:1,vars:0,template:function(r,o){r&1&&z(0,"router-outlet")},dependencies:[dr],encapsulation:2}));let e=t;return e})();function fr(e){let t=e.children&&e.children.map(fr),i=t?A(f({},e),{children:t}):f({},e);return!i.component&&!i.loadComponent&&(t||i.loadChildren)&&i.outlet&&i.outlet!==v&&(i.component=Jo),i}var gr=new j(""),ts=(()=>{let t=class t{constructor(){a(this,"componentLoaders",new WeakMap);a(this,"childrenLoaders",new WeakMap);a(this,"onLoadStartListener");a(this,"onLoadEndListener");a(this,"compiler",h(Me))}loadComponent(n){if(this.componentLoaders.get(n))return this.componentLoaders.get(n);if(n._loadedComponent)return g(n._loadedComponent);this.onLoadStartListener&&this.onLoadStartListener(n);let r=W(n.loadComponent()).pipe(y(gi),I(s=>{this.onLoadEndListener&&this.onLoadEndListener(n),n._loadedComponent=s}),Bt(()=>{this.componentLoaders.delete(n)})),o=new ye(r,()=>new G).pipe(me());return this.componentLoaders.set(n,o),o}loadChildren(n,r){if(this.childrenLoaders.get(r))return this.childrenLoaders.get(r);if(r._loadedRoutes)return g({routes:r._loadedRoutes,injector:r._loadedInjector});this.onLoadStartListener&&this.onLoadStartListener(r);let s=es(r,this.compiler,n,this.onLoadEndListener).pipe(Bt(()=>{this.childrenLoaders.delete(r)})),u=new ye(s,()=>new G).pipe(me());return this.childrenLoaders.set(r,u),u}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})();function es(e,t,i,n){return W(e.loadChildren()).pipe(y(gi),E(r=>r instanceof _r||Array.isArray(r)?g(r):N(t.compileModuleAsync(r))),y(r=>{n&&n(e);let o,s,u=!1;return Array.isArray(r)?(s=r,u=!0):(o=r.create(i).injector,s=o.get(gr,[],{optional:!0,self:!0}).flat()),{routes:s.map(fr),injector:o}}))}function rs(e){return e&&typeof e=="object"&&"default"in e}function gi(e){return rs(e)?e.default:e}var vr=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(ns),providedIn:"root"}));let e=t;return e})(),ns=(()=>{let t=class t{shouldProcessUrl(n){return!0}extract(n){return n}merge(n,r){return n}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),is=new j("");var os=new j(""),ss=(()=>{let t=class t{constructor(){a(this,"currentNavigation",null);a(this,"currentTransition",null);a(this,"lastSuccessfulNavigation",null);a(this,"events",new G);a(this,"transitionAbortSubject",new G);a(this,"configLoader",h(ts));a(this,"environmentInjector",h(Wt));a(this,"urlSerializer",h(cr));a(this,"rootContexts",h(fe));a(this,"location",h(Kt));a(this,"inputBindingEnabled",h(hr,{optional:!0})!==null);a(this,"titleStrategy",h(fi));a(this,"options",h(pr,{optional:!0})||{});a(this,"paramsInheritanceStrategy",this.options.paramsInheritanceStrategy||"emptyOnly");a(this,"urlHandlingStrategy",h(vr));a(this,"createViewTransition",h(is,{optional:!0}));a(this,"navigationErrorHandler",h(os,{optional:!0}));a(this,"navigationId",0);a(this,"transitions");a(this,"afterPreactivation",()=>g(void 0));a(this,"rootComponentType",null);let n=o=>this.events.next(new We(o)),r=o=>this.events.next(new Ge(o));this.configLoader.onLoadEndListener=r,this.configLoader.onLoadStartListener=n}get hasRequestedNavigation(){return this.navigationId!==0}complete(){var n;(n=this.transitions)==null||n.complete()}handleNavigationRequest(n){var o;let r=++this.navigationId;(o=this.transitions)==null||o.next(A(f(f({},this.transitions.value),n),{id:r}))}setupNavigations(n,r,o){return this.transitions=new O({id:0,currentUrlTree:r,currentRawUrl:r,extractedUrl:this.urlHandlingStrategy.extract(r),urlAfterRedirects:this.urlHandlingStrategy.extract(r),rawUrl:r,extras:{},resolve:()=>{},reject:()=>{},promise:Promise.resolve(!0),source:Tt,restoredState:null,currentSnapshot:o.snapshot,targetSnapshot:null,currentRouterState:o,targetRouterState:null,guards:{canActivateChecks:[],canDeactivateChecks:[]},guardsResult:null}),this.transitions.pipe(B(s=>s.id!==0),y(s=>A(f({},s),{extractedUrl:this.urlHandlingStrategy.extract(s.rawUrl)})),k(s=>{let u=!1,l=!1;return g(s).pipe(k(c=>{if(this.navigationId>s.id)return this.cancelNavigationTransition(s,"",M.SupersededByNewNavigation),$;this.currentTransition=s,this.currentNavigation={id:c.id,initialUrl:c.rawUrl,extractedUrl:c.extractedUrl,targetBrowserUrl:typeof c.extras.browserUrl=="string"?this.urlSerializer.parse(c.extras.browserUrl):c.extras.browserUrl,trigger:c.source,extras:c.extras,previousNavigation:this.lastSuccessfulNavigation?A(f({},this.lastSuccessfulNavigation),{previousNavigation:null}):null};let d=!n.navigated||this.isUpdatingInternalState()||this.isUpdatedBrowserUrl(),m=c.extras.onSameUrlNavigation??n.onSameUrlNavigation;if(!d&&m!=="reload"){let p="";return this.events.next(new et(c.id,this.urlSerializer.serialize(c.rawUrl),p,_e.IgnoredSameUrlNavigation)),c.resolve(!1),$}if(this.urlHandlingStrategy.shouldProcessUrl(c.rawUrl))return g(c).pipe(k(p=>{var C,U;let w=(C=this.transitions)==null?void 0:C.getValue();return this.events.next(new Ut(p.id,this.urlSerializer.serialize(p.extractedUrl),p.source,p.restoredState)),w!==((U=this.transitions)==null?void 0:U.getValue())?$:Promise.resolve(p)}),Go(this.environmentInjector,this.configLoader,this.rootComponentType,n.config,this.urlSerializer,this.paramsInheritanceStrategy),I(p=>{s.targetSnapshot=p.targetSnapshot,s.urlAfterRedirects=p.urlAfterRedirects,this.currentNavigation=A(f({},this.currentNavigation),{finalUrl:p.urlAfterRedirects});let w=new ae(p.id,this.urlSerializer.serialize(p.extractedUrl),this.urlSerializer.serialize(p.urlAfterRedirects),p.targetSnapshot);this.events.next(w)}));if(d&&this.urlHandlingStrategy.shouldProcessUrl(c.currentRawUrl)){let{id:p,extractedUrl:w,source:C,restoredState:U,extras:x}=c,mt=new Ut(p,this.urlSerializer.serialize(w),C,U);this.events.next(mt);let ve=ni(this.rootComponentType).snapshot;return this.currentTransition=s=A(f({},c),{targetSnapshot:ve,urlAfterRedirects:w,extras:A(f({},x),{skipLocationChange:!1,replaceUrl:!1})}),this.currentNavigation.finalUrl=w,g(s)}else{let p="";return this.events.next(new et(c.id,this.urlSerializer.serialize(c.extractedUrl),p,_e.IgnoredByUrlHandlingStrategy)),c.resolve(!1),$}}),I(c=>{let d=new Ve(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot);this.events.next(d)}),y(c=>(this.currentTransition=s=A(f({},c),{guards:po(c.targetSnapshot,c.currentSnapshot,this.rootContexts)}),s)),Io(this.environmentInjector,c=>this.events.next(c)),I(c=>{if(s.guardsResult=c.guardsResult,c.guardsResult&&typeof c.guardsResult!="boolean")throw he(this.urlSerializer,c.guardsResult);let d=new qe(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects),c.targetSnapshot,!!c.guardsResult);this.events.next(d)}),B(c=>c.guardsResult?!0:(this.cancelNavigationTransition(c,"",M.GuardRejected),!1)),je(c=>{if(c.guards.canActivateChecks.length)return g(c).pipe(I(d=>{let m=new Be(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(m)}),k(d=>{let m=!1;return g(d).pipe(Qo(this.paramsInheritanceStrategy,this.environmentInjector),I({next:()=>m=!0,complete:()=>{m||this.cancelNavigationTransition(d,"",M.NoDataFromResolver)}}))}),I(d=>{let m=new He(d.id,this.urlSerializer.serialize(d.extractedUrl),this.urlSerializer.serialize(d.urlAfterRedirects),d.targetSnapshot);this.events.next(m)}))}),je(c=>{let d=m=>{var w;let p=[];(w=m.routeConfig)!=null&&w.loadComponent&&!m.routeConfig._loadedComponent&&p.push(this.configLoader.loadComponent(m.routeConfig).pipe(I(C=>{m.component=C}),y(()=>{})));for(let C of m.children)p.push(...d(C));return p};return Se(d(c.targetSnapshot.root)).pipe(Ce(null),it(1))}),je(()=>this.afterPreactivation()),k(()=>{var p;let{currentSnapshot:c,targetSnapshot:d}=s,m=(p=this.createViewTransition)==null?void 0:p.call(this,this.environmentInjector,c.root,d.root);return m?N(m).pipe(y(()=>s)):g(s)}),y(c=>{let d=ao(n.routeReuseStrategy,c.targetSnapshot,c.currentRouterState);return this.currentTransition=s=A(f({},c),{targetRouterState:d}),this.currentNavigation.targetRouterState=d,s}),I(()=>{this.events.next(new Nt)}),ho(this.rootContexts,n.routeReuseStrategy,c=>this.events.next(c),this.inputBindingEnabled),it(1),I({next:c=>{var d;u=!0,this.lastSuccessfulNavigation=this.currentNavigation,this.events.next(new tt(c.id,this.urlSerializer.serialize(c.extractedUrl),this.urlSerializer.serialize(c.urlAfterRedirects))),(d=this.titleStrategy)==null||d.updateTitle(c.targetRouterState.snapshot),c.resolve(!0)},complete:()=>{u=!0}}),Mr(this.transitionAbortSubject.pipe(I(c=>{throw c}))),Bt(()=>{var c;!u&&!l&&this.cancelNavigationTransition(s,"",M.SupersededByNewNavigation),((c=this.currentTransition)==null?void 0:c.id)===s.id&&(this.currentNavigation=null,this.currentTransition=null)}),nt(c=>{if(l=!0,ui(c))this.events.next(new V(s.id,this.urlSerializer.serialize(s.extractedUrl),c.message,c.cancellationCode)),lo(c)?this.events.next(new pt(c.url,c.navigationBehaviorOptions)):s.resolve(!1);else{let d=new xt(s.id,this.urlSerializer.serialize(s.extractedUrl),c,s.targetSnapshot??void 0);try{let m=_(this.environmentInjector,()=>{var p;return(p=this.navigationErrorHandler)==null?void 0:p.call(this,d)});if(m instanceof Lt){let{message:p,cancellationCode:w}=he(this.urlSerializer,m);this.events.next(new V(s.id,this.urlSerializer.serialize(s.extractedUrl),p,w)),this.events.next(new pt(m.redirectTo,m.navigationBehaviorOptions))}else throw this.events.next(d),c}catch(m){this.options.resolveNavigationPromiseOnError?s.resolve(!1):s.reject(m)}}return $}))}))}cancelNavigationTransition(n,r,o){let s=new V(n.id,this.urlSerializer.serialize(n.extractedUrl),r,o);this.events.next(s),n.resolve(!1)}isUpdatingInternalState(){var n,r;return((n=this.currentTransition)==null?void 0:n.extractedUrl.toString())!==((r=this.currentTransition)==null?void 0:r.currentUrlTree.toString())}isUpdatedBrowserUrl(){var o,s,u;let n=this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(!0))),r=((o=this.currentNavigation)==null?void 0:o.targetBrowserUrl)??((s=this.currentNavigation)==null?void 0:s.extractedUrl);return n.toString()!==(r==null?void 0:r.toString())&&!((u=this.currentNavigation)!=null&&u.extras.skipLocationChange)}};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})();function as(e){return e!==Tt}var us=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(cs),providedIn:"root"}));let e=t;return e})(),ur=class{shouldDetach(t){return!1}store(t,i){}shouldAttach(t){return!1}retrieve(t){return null}shouldReuseRoute(t,i){return t.routeConfig===i.routeConfig}},cs=(()=>{let t=class t extends ur{};a(t,"\u0275fac",(()=>{let n;return function(o){return(n||(n=wt(t)))(o||t)}})()),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),vi=(()=>{let t=class t{};a(t,"\u0275fac",function(r){return new(r||t)}),a(t,"\u0275prov",R({token:t,factory:()=>h(ls),providedIn:"root"}));let e=t;return e})(),ls=(()=>{let t=class t extends vi{constructor(){super(...arguments);a(this,"location",h(Kt));a(this,"urlSerializer",h(cr));a(this,"options",h(pr,{optional:!0})||{});a(this,"canceledNavigationResolution",this.options.canceledNavigationResolution||"replace");a(this,"urlHandlingStrategy",h(vr));a(this,"urlUpdateStrategy",this.options.urlUpdateStrategy||"deferred");a(this,"currentUrlTree",new q);a(this,"rawUrlTree",this.currentUrlTree);a(this,"currentPageId",0);a(this,"lastSuccessfulId",-1);a(this,"routerState",ni(null));a(this,"stateMemento",this.createStateMemento())}getCurrentUrlTree(){return this.currentUrlTree}getRawUrlTree(){return this.rawUrlTree}restoredState(){return this.location.getState()}get browserPageId(){var r;return this.canceledNavigationResolution!=="computed"?this.currentPageId:((r=this.restoredState())==null?void 0:r.\u0275routerPageId)??this.currentPageId}getRouterState(){return this.routerState}createStateMemento(){return{rawUrlTree:this.rawUrlTree,currentUrlTree:this.currentUrlTree,routerState:this.routerState}}registerNonRouterCurrentEntryChangeListener(r){return this.location.subscribe(o=>{o.type==="popstate"&&r(o.url,o.state)})}handleRouterEvent(r,o){if(r instanceof Ut)this.stateMemento=this.createStateMemento();else if(r instanceof et)this.rawUrlTree=o.initialUrl;else if(r instanceof ae){if(this.urlUpdateStrategy==="eager"&&!o.extras.skipLocationChange){let s=this.urlHandlingStrategy.merge(o.finalUrl,o.initialUrl);this.setBrowserUrl(o.targetBrowserUrl??s,o)}}else r instanceof Nt?(this.currentUrlTree=o.finalUrl,this.rawUrlTree=this.urlHandlingStrategy.merge(o.finalUrl,o.initialUrl),this.routerState=o.targetRouterState,this.urlUpdateStrategy==="deferred"&&!o.extras.skipLocationChange&&this.setBrowserUrl(o.targetBrowserUrl??this.rawUrlTree,o)):r instanceof V&&(r.code===M.GuardRejected||r.code===M.NoDataFromResolver)?this.restoreHistory(o):r instanceof xt?this.restoreHistory(o,!0):r instanceof tt&&(this.lastSuccessfulId=r.id,this.currentPageId=this.browserPageId)}setBrowserUrl(r,o){let s=r instanceof q?this.urlSerializer.serialize(r):r;if(this.location.isCurrentPathEqualTo(s)||o.extras.replaceUrl){let u=this.browserPageId,l=f(f({},o.extras.state),this.generateNgRouterState(o.id,u));this.location.replaceState(s,"",l)}else{let u=f(f({},o.extras.state),this.generateNgRouterState(o.id,this.browserPageId+1));this.location.go(s,"",u)}}restoreHistory(r,o=!1){if(this.canceledNavigationResolution==="computed"){let s=this.browserPageId,u=this.currentPageId-s;u!==0?this.location.historyGo(u):this.currentUrlTree===r.finalUrl&&u===0&&(this.resetState(r),this.resetUrlToCurrentUrlTree())}else this.canceledNavigationResolution==="replace"&&(o&&this.resetState(r),this.resetUrlToCurrentUrlTree())}resetState(r){this.routerState=this.stateMemento.routerState,this.currentUrlTree=this.stateMemento.currentUrlTree,this.rawUrlTree=this.urlHandlingStrategy.merge(this.currentUrlTree,r.finalUrl??this.rawUrlTree)}resetUrlToCurrentUrlTree(){this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree),"",this.generateNgRouterState(this.lastSuccessfulId,this.currentPageId))}generateNgRouterState(r,o){return this.canceledNavigationResolution==="computed"?{navigationId:r,\u0275routerPageId:o}:{navigationId:r}}};a(t,"\u0275fac",(()=>{let r;return function(s){return(r||(r=wt(t)))(s||t)}})()),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})(),Dt=function(e){return e[e.COMPLETE=0]="COMPLETE",e[e.FAILED=1]="FAILED",e[e.REDIRECTING=2]="REDIRECTING",e}(Dt||{});function ds(e,t){e.events.pipe(B(i=>i instanceof tt||i instanceof V||i instanceof xt||i instanceof et),y(i=>i instanceof tt||i instanceof et?Dt.COMPLETE:(i instanceof V?i.code===M.Redirect||i.code===M.SupersededByNewNavigation:!1)?Dt.REDIRECTING:Dt.FAILED),B(i=>i!==Dt.REDIRECTING),it(1)).subscribe(()=>{t()})}var hs={paths:"exact",fragment:"ignored",matrixParams:"ignored",queryParams:"exact"},ps={paths:"subset",fragment:"ignored",matrixParams:"ignored",queryParams:"subset"},mi=(()=>{var t;let i=class i{constructor(){a(this,"disposed",!1);a(this,"nonRouterCurrentEntryChangeSubscription");a(this,"console",h(Wr));a(this,"stateManager",h(vi));a(this,"options",h(pr,{optional:!0})||{});a(this,"pendingTasks",h(jr));a(this,"urlUpdateStrategy",this.options.urlUpdateStrategy||"deferred");a(this,"navigationTransitions",h(ss));a(this,"urlSerializer",h(cr));a(this,"location",h(Kt));a(this,"urlHandlingStrategy",h(vr));a(this,"_events",new G);a(this,"navigated",!1);a(this,"routeReuseStrategy",h(us));a(this,"onSameUrlNavigation",this.options.onSameUrlNavigation||"ignore");a(this,"config",((t=h(gr,{optional:!0}))==null?void 0:t.flat())??[]);a(this,"componentInputBindingEnabled",!!h(hr,{optional:!0}));a(this,"eventsSubscription",new mr);this.resetConfig(this.config),this.navigationTransitions.setupNavigations(this,this.currentUrlTree,this.routerState).subscribe({error:r=>{this.console.warn(r)}}),this.subscribeToNavigationEvents()}get currentUrlTree(){return this.stateManager.getCurrentUrlTree()}get rawUrlTree(){return this.stateManager.getRawUrlTree()}get events(){return this._events}get routerState(){return this.stateManager.getRouterState()}subscribeToNavigationEvents(){let r=this.navigationTransitions.events.subscribe(o=>{try{let s=this.navigationTransitions.currentTransition,u=this.navigationTransitions.currentNavigation;if(s!==null&&u!==null){if(this.stateManager.handleRouterEvent(o,u),o instanceof V&&o.code!==M.Redirect&&o.code!==M.SupersededByNewNavigation)this.navigated=!0;else if(o instanceof tt)this.navigated=!0;else if(o instanceof pt){let l=o.navigationBehaviorOptions,c=this.urlHandlingStrategy.merge(o.url,s.currentRawUrl),d=f({browserUrl:s.extras.browserUrl,info:s.extras.info,skipLocationChange:s.extras.skipLocationChange,replaceUrl:s.extras.replaceUrl||this.urlUpdateStrategy==="eager"||as(s.source)},l);this.scheduleNavigation(c,Tt,null,d,{resolve:s.resolve,reject:s.reject,promise:s.promise})}}gs(o)&&this._events.next(o)}catch(s){this.navigationTransitions.transitionAbortSubject.next(s)}});this.eventsSubscription.add(r)}resetRootComponentType(r){this.routerState.root.component=r,this.navigationTransitions.rootComponentType=r}initialNavigation(){this.setUpLocationChangeListener(),this.navigationTransitions.hasRequestedNavigation||this.navigateToSyncWithBrowser(this.location.path(!0),Tt,this.stateManager.restoredState())}setUpLocationChangeListener(){this.nonRouterCurrentEntryChangeSubscription??(this.nonRouterCurrentEntryChangeSubscription=this.stateManager.registerNonRouterCurrentEntryChangeListener((r,o)=>{setTimeout(()=>{this.navigateToSyncWithBrowser(r,"popstate",o)},0)}))}navigateToSyncWithBrowser(r,o,s){let u={replaceUrl:!0},l=s!=null&&s.navigationId?s:null;if(s){let d=f({},s);delete d.navigationId,delete d.\u0275routerPageId,Object.keys(d).length!==0&&(u.state=d)}let c=this.parseUrl(r);this.scheduleNavigation(c,o,l,u)}get url(){return this.serializeUrl(this.currentUrlTree)}getCurrentNavigation(){return this.navigationTransitions.currentNavigation}get lastSuccessfulNavigation(){return this.navigationTransitions.lastSuccessfulNavigation}resetConfig(r){this.config=r.map(fr),this.navigated=!1}ngOnDestroy(){this.dispose()}dispose(){this.navigationTransitions.complete(),this.nonRouterCurrentEntryChangeSubscription&&(this.nonRouterCurrentEntryChangeSubscription.unsubscribe(),this.nonRouterCurrentEntryChangeSubscription=void 0),this.disposed=!0,this.eventsSubscription.unsubscribe()}createUrlTree(r,o={}){let{relativeTo:s,queryParams:u,fragment:l,queryParamsHandling:c,preserveFragment:d}=o,m=d?this.currentUrlTree.fragment:l,p=null;switch(c??this.options.defaultQueryParamsHandling){case"merge":p=f(f({},this.currentUrlTree.queryParams),u);break;case"preserve":p=this.currentUrlTree.queryParams;break;default:p=u||null}p!==null&&(p=this.removeEmptyProps(p));let w;try{let C=s?s.snapshot:this.routerState.snapshot.root;w=Jn(C)}catch{(typeof r[0]!="string"||r[0][0]!=="/")&&(r=[]),w=this.currentUrlTree.root}return ti(w,r,p,m??null)}navigateByUrl(r,o={skipLocationChange:!1}){let s=Et(r)?r:this.parseUrl(r),u=this.urlHandlingStrategy.merge(s,this.rawUrlTree);return this.scheduleNavigation(u,Tt,null,o)}navigate(r,o={skipLocationChange:!1}){return fs(r),this.navigateByUrl(this.createUrlTree(r,o),o)}serializeUrl(r){return this.urlSerializer.serialize(r)}parseUrl(r){try{return this.urlSerializer.parse(r)}catch{return this.urlSerializer.parse("/")}}isActive(r,o){let s;if(o===!0?s=f({},hs):o===!1?s=f({},ps):s=o,Et(r))return Ln(this.currentUrlTree,r,s);let u=this.parseUrl(r);return Ln(this.currentUrlTree,u,s)}removeEmptyProps(r){return Object.entries(r).reduce((o,[s,u])=>(u!=null&&(o[s]=u),o),{})}scheduleNavigation(r,o,s,u,l){if(this.disposed)return Promise.resolve(!1);let c,d,m;l?(c=l.resolve,d=l.reject,m=l.promise):m=new Promise((w,C)=>{c=w,d=C});let p=this.pendingTasks.add();return ds(this,()=>{queueMicrotask(()=>this.pendingTasks.remove(p))}),this.navigationTransitions.handleNavigationRequest({source:o,restoredState:s,currentUrlTree:this.currentUrlTree,currentRawUrl:this.currentUrlTree,rawUrl:r,extras:u,resolve:c,reject:d,promise:m,currentSnapshot:this.routerState.snapshot,currentRouterState:this.routerState}),m.catch(w=>Promise.reject(w))}};a(i,"\u0275fac",function(o){return new(o||i)}),a(i,"\u0275prov",R({token:i,factory:i.\u0275fac,providedIn:"root"}));let e=i;return e})();function fs(e){for(let t=0;ti.\u0275providers)])}function ms(e){return e.routerState.root}function ys(){let e=h(Nr);return t=>{var o,s;let i=e.get(Zr);if(t!==i.components[0])return;let n=e.get(mi),r=e.get(Ss);e.get(ws)===1&&n.initialNavigation(),(o=e.get(Cs,null,be.Optional))==null||o.setUpPreloading(),(s=e.get(vs,null,be.Optional))==null||s.init(),n.resetRootComponentType(i.componentTypes[0]),r.closed||(r.next(),r.complete(),r.unsubscribe())}}var Ss=new j("",{factory:()=>new G}),ws=new j("",{providedIn:"root",factory:()=>1});var Cs=new j("");var Si=(()=>{let t=class t{constructor(){this.tuiPlatform=h(Pe,{skipSelf:!0})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=Z({type:t,selectors:[["","tuiPlatform",""]],hostVars:1,hostBindings:function(r,o){r&2&&Ae("data-platform",o.tuiPlatform)},inputs:{tuiPlatform:"tuiPlatform"},features:[Yt([{provide:Pe,useFactory:()=>h(t).tuiPlatform}])]});let e=t;return e})();var wi=(()=>{let t=class t extends Sr{constructor(){super(r=>this.stream$.subscribe(r));a(this,"visualViewport",h(ln).visualViewport);a(this,"stream$",this.visualViewport?br(qt(this.visualViewport,"resize"),qt(this.visualViewport,"scroll"),qt(this.visualViewport,"scrollend")).pipe(Ht(null),y(()=>this.visualViewport),B(Boolean),Tr({bufferSize:1,refCount:!0})):$)}};a(t,"\u0275fac",function(o){return new(o||t)}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac,providedIn:"root"}));let e=t;return e})();var Ci=(()=>{let t=class t{constructor(){this.w=h(Ee),this.style=cn().style,this.$=h(wi).pipe(an()).subscribe(({offsetLeft:n,offsetTop:r,height:o,width:s,scale:u})=>{this.style.setProperty("--tui-viewport-x",K(n)),this.style.setProperty("--tui-viewport-y",K(r)),this.style.setProperty("--tui-viewport-height",K(o)),this.style.setProperty("--tui-viewport-width",K(s)),this.style.setProperty("--tui-viewport-scale",String(u)),this.style.setProperty("--tui-viewport-vh",K(this.w.innerHeight/100)),this.style.setProperty("--tui-viewport-vw",K(this.w.innerWidth/100))})}};t.\u0275fac=function(r){return new(r||t)},t.\u0275dir=Z({type:t,selectors:[["","tuiVisualViewport",""]]});let e=t;return e})();var Ri=(()=>{let t=class t extends An{};t.\u0275fac=(()=>{let n;return function(o){return(n||(n=wt(t)))(o||t)}})(),t.\u0275prov=R({token:t,factory:t.\u0275fac,providedIn:"root"});let e=t;return e})();var Is=["*",[["tuiOverContent"]],[["tuiOverDialogs"]],[["tuiOverAlerts"]],[["tuiOverDropdowns"]],[["tuiOverHints"]]],Ds=["*","tuiOverContent","tuiOverDialogs","tuiOverAlerts","tuiOverDropdowns","tuiOverHints"];function As(e,t){e&1&&z(0,"tui-scroll-controls",3)}var bi=(()=>{let t=class t extends Dn{constructor(){var n;super(),this.reducedMotion=h(hn),this.duration=gn(h(pn)),this.isMobileRes=un(h(In).pipe(y(r=>r==="mobile"),dn()),{initialValue:!1}),this.nativeScrollbar=h(Rn).mode==="native",this.scrollbars=!(this.nativeScrollbar||h(wn)),h(st).documentElement.setAttribute("data-tui-theme",h(fn).toLowerCase()),this.nativeScrollbar||(n=h(st).defaultView)==null||n.document.documentElement.classList.add("tui-zero-scrollbar")}};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=ot({type:t,selectors:[["tui-root"]],hostAttrs:["data-tui-version","4.18.0"],hostVars:6,hostBindings:function(r,o){r&1&&Te("touchstart.passive.silent",function(){return 0}),r&2&&(Kr("--tui-duration",o.duration,"ms")("--tui-scroll-behavior",o.reducedMotion?"auto":"smooth"),Xr("_mobile",o.isMobileRes()))},features:[Yt([],[Tn(Ri)]),Br([Si,Ci]),qr],ngContentSelectors:Ds,decls:14,vars:1,consts:[["viewContainer",""],[1,"t-root-content"],["class","t-root-scrollbar",4,"ngIf"],[1,"t-root-scrollbar"]],template:function(r,o){r&1&&(Jr(Is),Gt(0,"div",1),Y(1),Qt(),Hr(2,As,1,0,"tui-scroll-controls",2),Zt(3,null,0),Y(5,1),z(6,"tui-dialogs"),Y(7,2),z(8,"tui-alerts"),Y(9,3),z(10,"tui-dropdowns"),Y(11,4),z(12,"tui-hints"),Y(13,5)),r&2&&(kr(2),Yr("ngIf",o.scrollbars))},dependencies:[en,Cn,En,On,Pn,bn],styles:[`@keyframes tuiPresent{to{content:""}}@keyframes tuiSkeletonVibe{to{opacity:.5}}.tui-zero-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.tui-zero-scrollbar::-webkit-scrollbar,.tui-zero-scrollbar::-webkit-scrollbar-thumb{display:none}body,input{margin:0}tui-root{position:relative;display:block;font:var(--tui-font-text-s);color:var(--tui-text-primary);flex:1;border-image:conic-gradient(var(--tui-background-base) 0 0) fill 0/0/0 0 100vh 0;-webkit-tap-highlight-color:transparent}tui-root>.t-root-scrollbar{position:fixed;top:0;left:0;bottom:0;right:0;z-index:0;display:none;margin:0}[data-tui-theme] tui-root>.t-root-scrollbar{display:block}.t-root-content{position:relative;top:var(--t-root-top);block-size:100%;isolation:isolate}.t-root-content>*{--t-root-top: 0}[tuiDropdownButton][tuiDropdownButton]{display:none} +`],encapsulation:2});let e=t;return e})();var Ii=(()=>{let t=class t{};t.\u0275fac=function(r){return new(r||t)},t.\u0275cmp=ot({type:t,selectors:[["app-root"]],decls:7,vars:0,consts:[["ngProjectAs","tuiOverContent",5,["tuiOverContent"]],["ngProjectAs","tuiOverDialogs",5,["tuiOverDialogs"]],["ngProjectAs","tuiOverAlerts",5,["tuiOverAlerts"]],["ngProjectAs","tuiOverPortals",5,["tuiOverPortals"]],["ngProjectAs","tuiOverHints",5,["tuiOverHints"]]],template:function(r,o){r&1&&(Gt(0,"tui-root"),z(1,"router-outlet"),Zt(2,0)(3,1)(4,2)(5,3)(6,4),Qt())},dependencies:[dr,bi],encapsulation:2,changeDetection:0});let e=t;return e})();var Ts=(()=>{let t=class t extends Jt{constructor(n,r,o){super(n,r,o)}ngOnDestroy(){this.flush()}};a(t,"\u0275fac",function(r){return new(r||t)(Q(st),Q(Rt),Q(Xt))}),a(t,"\u0275prov",R({token:t,factory:t.\u0275fac}));let e=t;return e})();function Ms(){return new mn}function Os(e,t,i){return new Sn(e,t,i)}var Di=[{provide:Xt,useFactory:Ms},{provide:Jt,useClass:Ts},{provide:zr,useFactory:Os,deps:[rn,Jt,Ie]}],Es=[{provide:Rt,useFactory:()=>new yn},{provide:De,useValue:"BrowserAnimations"},...Di],yu=[{provide:Rt,useClass:vn},{provide:De,useValue:"NoopAnimations"},...Di];function Ai(){return $r("NgEagerAnimations"),[...Es]}var Ti={providers:[tn(),sn(),Ai(),yi([{path:"",pathMatch:"full",loadComponent:async()=>import("./chunk-4FJ4CVJB.js")}]),Ur(),{provide:xn,deps:[Er],useFactory:e=>[...jn,import("./chunk-UDWB553C.js").then(({tuiCreateImageEditorExtension:t})=>t({injector:e}))]},{provide:Nn,useClass:Un},Mn]};var Mi={production:!1};Mi.production&&void 0;nn(Ii,Ti).catch(e=>console.error(e)); +//# sourceMappingURL=main-RD4XIA7H.js.map diff --git a/main-RD4XIA7H.js.map b/main-RD4XIA7H.js.map new file mode 100644 index 00000000..ff2164c3 --- /dev/null +++ b/main-RD4XIA7H.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["node_modules/@angular/router/fesm2022/router.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-platform.mjs","node_modules/@ng-web-apis/screen-orientation/fesm2022/ng-web-apis-screen-orientation.mjs","node_modules/@taiga-ui/cdk/fesm2022/taiga-ui-cdk-directives-visual-viewport.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-directives-popup.mjs","node_modules/@taiga-ui/core/fesm2022/taiga-ui-core-components-root.mjs","apps/demo/src/app/app.component.ts","apps/demo/src/app/app.component.html","node_modules/@angular/platform-browser/fesm2022/animations.mjs","apps/demo/src/app/app.config.ts","apps/demo/src/environments/environment.ts","apps/demo/src/main.ts"],"sourcesContent":["/**\n * @license Angular v19.0.4\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { ɵisPromise, ɵRuntimeError, Injectable, createEnvironmentInjector, ɵisNgModule, isStandalone, InjectionToken, EventEmitter, input, inject, ViewContainerRef, ChangeDetectorRef, Directive, Input, Output, reflectComponentType, ɵisInjectable, runInInjectionContext, Component, Compiler, NgModuleFactory, NgZone, afterNextRender, EnvironmentInjector, ɵConsole, ɵPendingTasksInternal, ɵɵsanitizeUrlOrResourceUrl, booleanAttribute, Attribute, HostBinding, HostListener, Optional, ContentChildren, makeEnvironmentProviders, APP_BOOTSTRAP_LISTENER, ENVIRONMENT_INITIALIZER, Injector, ApplicationRef, InjectFlags, APP_INITIALIZER, SkipSelf, NgModule, Inject, Version, ɵpublishExternalGlobalUtil } from '@angular/core';\nimport { isObservable, from, of, BehaviorSubject, combineLatest, EmptyError, concat, defer, pipe, throwError, EMPTY, ConnectableObservable, Subject, Subscription } from 'rxjs';\nimport * as i3 from '@angular/common';\nimport { DOCUMENT, Location, ViewportScroller, LOCATION_INITIALIZED, LocationStrategy, HashLocationStrategy, PathLocationStrategy } from '@angular/common';\nimport { map, switchMap, take, startWith, filter, mergeMap, first, concatMap, tap, catchError, scan, defaultIfEmpty, last as last$1, takeLast, mapTo, finalize, refCount, takeUntil, mergeAll } from 'rxjs/operators';\nimport * as i1 from '@angular/platform-browser';\n\n/**\n * The primary routing outlet.\n *\n * @publicApi\n */\nconst PRIMARY_OUTLET = 'primary';\n/**\n * A private symbol used to store the value of `Route.title` inside the `Route.data` if it is a\n * static string or `Route.resolve` if anything else. This allows us to reuse the existing route\n * data/resolvers to support the title feature without new instrumentation in the `Router` pipeline.\n */\nconst RouteTitleKey = /* @__PURE__ */Symbol('RouteTitle');\nclass ParamsAsMap {\n params;\n constructor(params) {\n this.params = params || {};\n }\n has(name) {\n return Object.prototype.hasOwnProperty.call(this.params, name);\n }\n get(name) {\n if (this.has(name)) {\n const v = this.params[name];\n return Array.isArray(v) ? v[0] : v;\n }\n return null;\n }\n getAll(name) {\n if (this.has(name)) {\n const v = this.params[name];\n return Array.isArray(v) ? v : [v];\n }\n return [];\n }\n get keys() {\n return Object.keys(this.params);\n }\n}\n/**\n * Converts a `Params` instance to a `ParamMap`.\n * @param params The instance to convert.\n * @returns The new map instance.\n *\n * @publicApi\n */\nfunction convertToParamMap(params) {\n return new ParamsAsMap(params);\n}\n/**\n * Matches the route configuration (`route`) against the actual URL (`segments`).\n *\n * When no matcher is defined on a `Route`, this is the matcher used by the Router by default.\n *\n * @param segments The remaining unmatched segments in the current navigation\n * @param segmentGroup The current segment group being matched\n * @param route The `Route` to match against.\n *\n * @see {@link UrlMatchResult}\n * @see {@link Route}\n *\n * @returns The resulting match information or `null` if the `route` should not match.\n * @publicApi\n */\nfunction defaultUrlMatcher(segments, segmentGroup, route) {\n const parts = route.path.split('/');\n if (parts.length > segments.length) {\n // The actual URL is shorter than the config, no match\n return null;\n }\n if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) {\n // The config is longer than the actual URL but we are looking for a full match, return null\n return null;\n }\n const posParams = {};\n // Check each config part against the actual URL\n for (let index = 0; index < parts.length; index++) {\n const part = parts[index];\n const segment = segments[index];\n const isParameter = part[0] === ':';\n if (isParameter) {\n posParams[part.substring(1)] = segment;\n } else if (part !== segment.path) {\n // The actual URL part does not match the config, no match\n return null;\n }\n }\n return {\n consumed: segments.slice(0, parts.length),\n posParams\n };\n}\nfunction shallowEqualArrays(a, b) {\n if (a.length !== b.length) return false;\n for (let i = 0; i < a.length; ++i) {\n if (!shallowEqual(a[i], b[i])) return false;\n }\n return true;\n}\nfunction shallowEqual(a, b) {\n // While `undefined` should never be possible, it would sometimes be the case in IE 11\n // and pre-chromium Edge. The check below accounts for this edge case.\n const k1 = a ? getDataKeys(a) : undefined;\n const k2 = b ? getDataKeys(b) : undefined;\n if (!k1 || !k2 || k1.length != k2.length) {\n return false;\n }\n let key;\n for (let i = 0; i < k1.length; i++) {\n key = k1[i];\n if (!equalArraysOrString(a[key], b[key])) {\n return false;\n }\n }\n return true;\n}\n/**\n * Gets the keys of an object, including `symbol` keys.\n */\nfunction getDataKeys(obj) {\n return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)];\n}\n/**\n * Test equality for arrays of strings or a string.\n */\nfunction equalArraysOrString(a, b) {\n if (Array.isArray(a) && Array.isArray(b)) {\n if (a.length !== b.length) return false;\n const aSorted = [...a].sort();\n const bSorted = [...b].sort();\n return aSorted.every((val, index) => bSorted[index] === val);\n } else {\n return a === b;\n }\n}\n/**\n * Return the last element of an array.\n */\nfunction last(a) {\n return a.length > 0 ? a[a.length - 1] : null;\n}\nfunction wrapIntoObservable(value) {\n if (isObservable(value)) {\n return value;\n }\n if (ɵisPromise(value)) {\n // Use `Promise.resolve()` to wrap promise-like instances.\n // Required ie when a Resolver returns a AngularJS `$q` promise to correctly trigger the\n // change detection.\n return from(Promise.resolve(value));\n }\n return of(value);\n}\nconst pathCompareMap = {\n 'exact': equalSegmentGroups,\n 'subset': containsSegmentGroup\n};\nconst paramCompareMap = {\n 'exact': equalParams,\n 'subset': containsParams,\n 'ignored': () => true\n};\nfunction containsTree(container, containee, options) {\n return pathCompareMap[options.paths](container.root, containee.root, options.matrixParams) && paramCompareMap[options.queryParams](container.queryParams, containee.queryParams) && !(options.fragment === 'exact' && container.fragment !== containee.fragment);\n}\nfunction equalParams(container, containee) {\n // TODO: This does not handle array params correctly.\n return shallowEqual(container, containee);\n}\nfunction equalSegmentGroups(container, containee, matrixParams) {\n if (!equalPath(container.segments, containee.segments)) return false;\n if (!matrixParamsMatch(container.segments, containee.segments, matrixParams)) {\n return false;\n }\n if (container.numberOfChildren !== containee.numberOfChildren) return false;\n for (const c in containee.children) {\n if (!container.children[c]) return false;\n if (!equalSegmentGroups(container.children[c], containee.children[c], matrixParams)) return false;\n }\n return true;\n}\nfunction containsParams(container, containee) {\n return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every(key => equalArraysOrString(container[key], containee[key]));\n}\nfunction containsSegmentGroup(container, containee, matrixParams) {\n return containsSegmentGroupHelper(container, containee, containee.segments, matrixParams);\n}\nfunction containsSegmentGroupHelper(container, containee, containeePaths, matrixParams) {\n if (container.segments.length > containeePaths.length) {\n const current = container.segments.slice(0, containeePaths.length);\n if (!equalPath(current, containeePaths)) return false;\n if (containee.hasChildren()) return false;\n if (!matrixParamsMatch(current, containeePaths, matrixParams)) return false;\n return true;\n } else if (container.segments.length === containeePaths.length) {\n if (!equalPath(container.segments, containeePaths)) return false;\n if (!matrixParamsMatch(container.segments, containeePaths, matrixParams)) return false;\n for (const c in containee.children) {\n if (!container.children[c]) return false;\n if (!containsSegmentGroup(container.children[c], containee.children[c], matrixParams)) {\n return false;\n }\n }\n return true;\n } else {\n const current = containeePaths.slice(0, container.segments.length);\n const next = containeePaths.slice(container.segments.length);\n if (!equalPath(container.segments, current)) return false;\n if (!matrixParamsMatch(container.segments, current, matrixParams)) return false;\n if (!container.children[PRIMARY_OUTLET]) return false;\n return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next, matrixParams);\n }\n}\nfunction matrixParamsMatch(containerPaths, containeePaths, options) {\n return containeePaths.every((containeeSegment, i) => {\n return paramCompareMap[options](containerPaths[i].parameters, containeeSegment.parameters);\n });\n}\n/**\n * @description\n *\n * Represents the parsed URL.\n *\n * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a\n * serialized tree.\n * UrlTree is a data structure that provides a lot of affordances in dealing with URLs\n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const tree: UrlTree =\n * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');\n * const f = tree.fragment; // return 'fragment'\n * const q = tree.queryParams; // returns {debug: 'true'}\n * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];\n * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'\n * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'\n * g.children['support'].segments; // return 1 segment 'help'\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass UrlTree {\n root;\n queryParams;\n fragment;\n /** @internal */\n _queryParamMap;\n constructor(/** The root segment group of the URL tree */\n root = new UrlSegmentGroup([], {}), /** The query params of the URL */\n queryParams = {}, /** The fragment of the URL */\n fragment = null) {\n this.root = root;\n this.queryParams = queryParams;\n this.fragment = fragment;\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (root.segments.length > 0) {\n throw new ɵRuntimeError(4015 /* RuntimeErrorCode.INVALID_ROOT_URL_SEGMENT */, 'The root `UrlSegmentGroup` should not contain `segments`. ' + 'Instead, these segments belong in the `children` so they can be associated with a named outlet.');\n }\n }\n }\n get queryParamMap() {\n this._queryParamMap ??= convertToParamMap(this.queryParams);\n return this._queryParamMap;\n }\n /** @docsNotRequired */\n toString() {\n return DEFAULT_SERIALIZER.serialize(this);\n }\n}\n/**\n * @description\n *\n * Represents the parsed URL segment group.\n *\n * See `UrlTree` for more information.\n *\n * @publicApi\n */\nclass UrlSegmentGroup {\n segments;\n children;\n /** The parent node in the url tree */\n parent = null;\n constructor(/** The URL segments of this group. See `UrlSegment` for more information */\n segments, /** The list of children of this group */\n children) {\n this.segments = segments;\n this.children = children;\n Object.values(children).forEach(v => v.parent = this);\n }\n /** Whether the segment has child segments */\n hasChildren() {\n return this.numberOfChildren > 0;\n }\n /** Number of child segments */\n get numberOfChildren() {\n return Object.keys(this.children).length;\n }\n /** @docsNotRequired */\n toString() {\n return serializePaths(this);\n }\n}\n/**\n * @description\n *\n * Represents a single URL segment.\n *\n * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix\n * parameters associated with the segment.\n *\n * @usageNotes\n * ### Example\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const tree: UrlTree = router.parseUrl('/team;id=33');\n * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];\n * const s: UrlSegment[] = g.segments;\n * s[0].path; // returns 'team'\n * s[0].parameters; // returns {id: 33}\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass UrlSegment {\n path;\n parameters;\n /** @internal */\n _parameterMap;\n constructor(/** The path part of a URL segment */\n path, /** The matrix parameters associated with a segment */\n parameters) {\n this.path = path;\n this.parameters = parameters;\n }\n get parameterMap() {\n this._parameterMap ??= convertToParamMap(this.parameters);\n return this._parameterMap;\n }\n /** @docsNotRequired */\n toString() {\n return serializePath(this);\n }\n}\nfunction equalSegments(as, bs) {\n return equalPath(as, bs) && as.every((a, i) => shallowEqual(a.parameters, bs[i].parameters));\n}\nfunction equalPath(as, bs) {\n if (as.length !== bs.length) return false;\n return as.every((a, i) => a.path === bs[i].path);\n}\nfunction mapChildrenIntoArray(segment, fn) {\n let res = [];\n Object.entries(segment.children).forEach(([childOutlet, child]) => {\n if (childOutlet === PRIMARY_OUTLET) {\n res = res.concat(fn(child, childOutlet));\n }\n });\n Object.entries(segment.children).forEach(([childOutlet, child]) => {\n if (childOutlet !== PRIMARY_OUTLET) {\n res = res.concat(fn(child, childOutlet));\n }\n });\n return res;\n}\n/**\n * @description\n *\n * Serializes and deserializes a URL string into a URL tree.\n *\n * The url serialization strategy is customizable. You can\n * make all URLs case insensitive by providing a custom UrlSerializer.\n *\n * See `DefaultUrlSerializer` for an example of a URL serializer.\n *\n * @publicApi\n */\nlet UrlSerializer = /*#__PURE__*/(() => {\n class UrlSerializer {\n static ɵfac = function UrlSerializer_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UrlSerializer)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlSerializer,\n factory: () => (() => new DefaultUrlSerializer())(),\n providedIn: 'root'\n });\n }\n return UrlSerializer;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * A default implementation of the `UrlSerializer`.\n *\n * Example URLs:\n *\n * ```\n * /inbox/33(popup:compose)\n * /inbox/33;open=true/messages/44\n * ```\n *\n * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the\n * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to\n * specify route specific parameters.\n *\n * @publicApi\n */\nclass DefaultUrlSerializer {\n /** Parses a url into a `UrlTree` */\n parse(url) {\n const p = new UrlParser(url);\n return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());\n }\n /** Converts a `UrlTree` into a url */\n serialize(tree) {\n const segment = `/${serializeSegment(tree.root, true)}`;\n const query = serializeQueryParams(tree.queryParams);\n const fragment = typeof tree.fragment === `string` ? `#${encodeUriFragment(tree.fragment)}` : '';\n return `${segment}${query}${fragment}`;\n }\n}\nconst DEFAULT_SERIALIZER = /*#__PURE__*/new DefaultUrlSerializer();\nfunction serializePaths(segment) {\n return segment.segments.map(p => serializePath(p)).join('/');\n}\nfunction serializeSegment(segment, root) {\n if (!segment.hasChildren()) {\n return serializePaths(segment);\n }\n if (root) {\n const primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : '';\n const children = [];\n Object.entries(segment.children).forEach(([k, v]) => {\n if (k !== PRIMARY_OUTLET) {\n children.push(`${k}:${serializeSegment(v, false)}`);\n }\n });\n return children.length > 0 ? `${primary}(${children.join('//')})` : primary;\n } else {\n const children = mapChildrenIntoArray(segment, (v, k) => {\n if (k === PRIMARY_OUTLET) {\n return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];\n }\n return [`${k}:${serializeSegment(v, false)}`];\n });\n // use no parenthesis if the only child is a primary outlet route\n if (Object.keys(segment.children).length === 1 && segment.children[PRIMARY_OUTLET] != null) {\n return `${serializePaths(segment)}/${children[0]}`;\n }\n return `${serializePaths(segment)}/(${children.join('//')})`;\n }\n}\n/**\n * Encodes a URI string with the default encoding. This function will only ever be called from\n * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need\n * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't\n * have to be encoded per https://url.spec.whatwg.org.\n */\nfunction encodeUriString(s) {\n return encodeURIComponent(s).replace(/%40/g, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ',');\n}\n/**\n * This function should be used to encode both keys and values in a query string key/value. In\n * the following URL, you need to call encodeUriQuery on \"k\" and \"v\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriQuery(s) {\n return encodeUriString(s).replace(/%3B/gi, ';');\n}\n/**\n * This function should be used to encode a URL fragment. In the following URL, you need to call\n * encodeUriFragment on \"f\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriFragment(s) {\n return encodeURI(s);\n}\n/**\n * This function should be run on any URI segment as well as the key and value in a key/value\n * pair for matrix params. In the following URL, you need to call encodeUriSegment on \"html\",\n * \"mk\", and \"mv\":\n *\n * http://www.site.org/html;mk=mv?k=v#f\n */\nfunction encodeUriSegment(s) {\n return encodeUriString(s).replace(/\\(/g, '%28').replace(/\\)/g, '%29').replace(/%26/gi, '&');\n}\nfunction decode(s) {\n return decodeURIComponent(s);\n}\n// Query keys/values should have the \"+\" replaced first, as \"+\" in a query string is \" \".\n// decodeURIComponent function will not decode \"+\" as a space.\nfunction decodeQuery(s) {\n return decode(s.replace(/\\+/g, '%20'));\n}\nfunction serializePath(path) {\n return `${encodeUriSegment(path.path)}${serializeMatrixParams(path.parameters)}`;\n}\nfunction serializeMatrixParams(params) {\n return Object.entries(params).map(([key, value]) => `;${encodeUriSegment(key)}=${encodeUriSegment(value)}`).join('');\n}\nfunction serializeQueryParams(params) {\n const strParams = Object.entries(params).map(([name, value]) => {\n return Array.isArray(value) ? value.map(v => `${encodeUriQuery(name)}=${encodeUriQuery(v)}`).join('&') : `${encodeUriQuery(name)}=${encodeUriQuery(value)}`;\n }).filter(s => s);\n return strParams.length ? `?${strParams.join('&')}` : '';\n}\nconst SEGMENT_RE = /^[^\\/()?;#]+/;\nfunction matchSegments(str) {\n const match = str.match(SEGMENT_RE);\n return match ? match[0] : '';\n}\nconst MATRIX_PARAM_SEGMENT_RE = /^[^\\/()?;=#]+/;\nfunction matchMatrixKeySegments(str) {\n const match = str.match(MATRIX_PARAM_SEGMENT_RE);\n return match ? match[0] : '';\n}\nconst QUERY_PARAM_RE = /^[^=?&#]+/;\n// Return the name of the query param at the start of the string or an empty string\nfunction matchQueryParams(str) {\n const match = str.match(QUERY_PARAM_RE);\n return match ? match[0] : '';\n}\nconst QUERY_PARAM_VALUE_RE = /^[^&#]+/;\n// Return the value of the query param at the start of the string or an empty string\nfunction matchUrlQueryParamValue(str) {\n const match = str.match(QUERY_PARAM_VALUE_RE);\n return match ? match[0] : '';\n}\nclass UrlParser {\n url;\n remaining;\n constructor(url) {\n this.url = url;\n this.remaining = url;\n }\n parseRootSegment() {\n this.consumeOptional('/');\n if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) {\n return new UrlSegmentGroup([], {});\n }\n // The root segment group never has segments\n return new UrlSegmentGroup([], this.parseChildren());\n }\n parseQueryParams() {\n const params = {};\n if (this.consumeOptional('?')) {\n do {\n this.parseQueryParam(params);\n } while (this.consumeOptional('&'));\n }\n return params;\n }\n parseFragment() {\n return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;\n }\n parseChildren() {\n if (this.remaining === '') {\n return {};\n }\n this.consumeOptional('/');\n const segments = [];\n if (!this.peekStartsWith('(')) {\n segments.push(this.parseSegment());\n }\n while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {\n this.capture('/');\n segments.push(this.parseSegment());\n }\n let children = {};\n if (this.peekStartsWith('/(')) {\n this.capture('/');\n children = this.parseParens(true);\n }\n let res = {};\n if (this.peekStartsWith('(')) {\n res = this.parseParens(false);\n }\n if (segments.length > 0 || Object.keys(children).length > 0) {\n res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);\n }\n return res;\n }\n // parse a segment with its matrix parameters\n // ie `name;k1=v1;k2`\n parseSegment() {\n const path = matchSegments(this.remaining);\n if (path === '' && this.peekStartsWith(';')) {\n throw new ɵRuntimeError(4009 /* RuntimeErrorCode.EMPTY_PATH_WITH_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Empty path url segment cannot have parameters: '${this.remaining}'.`);\n }\n this.capture(path);\n return new UrlSegment(decode(path), this.parseMatrixParams());\n }\n parseMatrixParams() {\n const params = {};\n while (this.consumeOptional(';')) {\n this.parseParam(params);\n }\n return params;\n }\n parseParam(params) {\n const key = matchMatrixKeySegments(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchSegments(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n params[decode(key)] = decode(value);\n }\n // Parse a single query parameter `name[=value]`\n parseQueryParam(params) {\n const key = matchQueryParams(this.remaining);\n if (!key) {\n return;\n }\n this.capture(key);\n let value = '';\n if (this.consumeOptional('=')) {\n const valueMatch = matchUrlQueryParamValue(this.remaining);\n if (valueMatch) {\n value = valueMatch;\n this.capture(value);\n }\n }\n const decodedKey = decodeQuery(key);\n const decodedVal = decodeQuery(value);\n if (params.hasOwnProperty(decodedKey)) {\n // Append to existing values\n let currentVal = params[decodedKey];\n if (!Array.isArray(currentVal)) {\n currentVal = [currentVal];\n params[decodedKey] = currentVal;\n }\n currentVal.push(decodedVal);\n } else {\n // Create a new value\n params[decodedKey] = decodedVal;\n }\n }\n // parse `(a/b//outlet_name:c/d)`\n parseParens(allowPrimary) {\n const segments = {};\n this.capture('(');\n while (!this.consumeOptional(')') && this.remaining.length > 0) {\n const path = matchSegments(this.remaining);\n const next = this.remaining[path.length];\n // if is is not one of these characters, then the segment was unescaped\n // or the group was not closed\n if (next !== '/' && next !== ')' && next !== ';') {\n throw new ɵRuntimeError(4010 /* RuntimeErrorCode.UNPARSABLE_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot parse url '${this.url}'`);\n }\n let outletName = undefined;\n if (path.indexOf(':') > -1) {\n outletName = path.slice(0, path.indexOf(':'));\n this.capture(outletName);\n this.capture(':');\n } else if (allowPrimary) {\n outletName = PRIMARY_OUTLET;\n }\n const children = this.parseChildren();\n segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children);\n this.consumeOptional('//');\n }\n return segments;\n }\n peekStartsWith(str) {\n return this.remaining.startsWith(str);\n }\n // Consumes the prefix when it is present and returns whether it has been consumed\n consumeOptional(str) {\n if (this.peekStartsWith(str)) {\n this.remaining = this.remaining.substring(str.length);\n return true;\n }\n return false;\n }\n capture(str) {\n if (!this.consumeOptional(str)) {\n throw new ɵRuntimeError(4011 /* RuntimeErrorCode.UNEXPECTED_VALUE_IN_URL */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Expected \"${str}\".`);\n }\n }\n}\nfunction createRoot(rootCandidate) {\n return rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], {\n [PRIMARY_OUTLET]: rootCandidate\n }) : rootCandidate;\n}\n/**\n * Recursively\n * - merges primary segment children into their parents\n * - drops empty children (those which have no segments and no children themselves). This latter\n * prevents serializing a group into something like `/a(aux:)`, where `aux` is an empty child\n * segment.\n * - merges named outlets without a primary segment sibling into the children. This prevents\n * serializing a URL like `//(a:a)(b:b) instead of `/(a:a//b:b)` when the aux b route lives on the\n * root but the `a` route lives under an empty path primary route.\n */\nfunction squashSegmentGroup(segmentGroup) {\n const newChildren = {};\n for (const [childOutlet, child] of Object.entries(segmentGroup.children)) {\n const childCandidate = squashSegmentGroup(child);\n // moves named children in an empty path primary child into this group\n if (childOutlet === PRIMARY_OUTLET && childCandidate.segments.length === 0 && childCandidate.hasChildren()) {\n for (const [grandChildOutlet, grandChild] of Object.entries(childCandidate.children)) {\n newChildren[grandChildOutlet] = grandChild;\n }\n } // don't add empty children\n else if (childCandidate.segments.length > 0 || childCandidate.hasChildren()) {\n newChildren[childOutlet] = childCandidate;\n }\n }\n const s = new UrlSegmentGroup(segmentGroup.segments, newChildren);\n return mergeTrivialChildren(s);\n}\n/**\n * When possible, merges the primary outlet child into the parent `UrlSegmentGroup`.\n *\n * When a segment group has only one child which is a primary outlet, merges that child into the\n * parent. That is, the child segment group's segments are merged into the `s` and the child's\n * children become the children of `s`. Think of this like a 'squash', merging the child segment\n * group into the parent.\n */\nfunction mergeTrivialChildren(s) {\n if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {\n const c = s.children[PRIMARY_OUTLET];\n return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);\n }\n return s;\n}\nfunction isUrlTree(v) {\n return v instanceof UrlTree;\n}\n\n/**\n * Creates a `UrlTree` relative to an `ActivatedRouteSnapshot`.\n *\n * @publicApi\n *\n *\n * @param relativeTo The `ActivatedRouteSnapshot` to apply the commands to\n * @param commands An array of URL fragments with which to construct the new URL tree.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the one provided in the `relativeTo` parameter.\n * @param queryParams The query parameters for the `UrlTree`. `null` if the `UrlTree` does not have\n * any query parameters.\n * @param fragment The fragment for the `UrlTree`. `null` if the `UrlTree` does not have a fragment.\n *\n * @usageNotes\n *\n * ```ts\n * // create /team/33/user/11\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, 'user', 11]);\n *\n * // create /team/33;expand=true/user/11\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {expand: true}, 'user', 11]);\n *\n * // you can collapse static segments like this (this works only with the first passed-in value):\n * createUrlTreeFromSnapshot(snapshot, ['/team/33/user', userId]);\n *\n * // If the first segment can contain slashes, and you do not want the router to split it,\n * // you can do the following:\n * createUrlTreeFromSnapshot(snapshot, [{segmentPath: '/one/two'}]);\n *\n * // create /team/33/(user/11//right:chat)\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right:\n * 'chat'}}], null, null);\n *\n * // remove the right secondary node\n * createUrlTreeFromSnapshot(snapshot, ['/team', 33, {outlets: {primary: 'user/11', right: null}}]);\n *\n * // For the examples below, assume the current URL is for the `/team/33/user/11` and the\n * `ActivatedRouteSnapshot` points to `user/11`:\n *\n * // navigate to /team/33/user/11/details\n * createUrlTreeFromSnapshot(snapshot, ['details']);\n *\n * // navigate to /team/33/user/22\n * createUrlTreeFromSnapshot(snapshot, ['../22']);\n *\n * // navigate to /team/44/user/22\n * createUrlTreeFromSnapshot(snapshot, ['../../team/44/user/22']);\n * ```\n */\nfunction createUrlTreeFromSnapshot(relativeTo, commands, queryParams = null, fragment = null) {\n const relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeTo);\n return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, queryParams, fragment);\n}\nfunction createSegmentGroupFromRoute(route) {\n let targetGroup;\n function createSegmentGroupFromRouteRecursive(currentRoute) {\n const childOutlets = {};\n for (const childSnapshot of currentRoute.children) {\n const root = createSegmentGroupFromRouteRecursive(childSnapshot);\n childOutlets[childSnapshot.outlet] = root;\n }\n const segmentGroup = new UrlSegmentGroup(currentRoute.url, childOutlets);\n if (currentRoute === route) {\n targetGroup = segmentGroup;\n }\n return segmentGroup;\n }\n const rootCandidate = createSegmentGroupFromRouteRecursive(route.root);\n const rootSegmentGroup = createRoot(rootCandidate);\n return targetGroup ?? rootSegmentGroup;\n}\nfunction createUrlTreeFromSegmentGroup(relativeTo, commands, queryParams, fragment) {\n let root = relativeTo;\n while (root.parent) {\n root = root.parent;\n }\n // There are no commands so the `UrlTree` goes to the same path as the one created from the\n // `UrlSegmentGroup`. All we need to do is update the `queryParams` and `fragment` without\n // applying any other logic.\n if (commands.length === 0) {\n return tree(root, root, root, queryParams, fragment);\n }\n const nav = computeNavigation(commands);\n if (nav.toRoot()) {\n return tree(root, root, new UrlSegmentGroup([], {}), queryParams, fragment);\n }\n const position = findStartingPositionForTargetGroup(nav, root, relativeTo);\n const newSegmentGroup = position.processChildren ? updateSegmentGroupChildren(position.segmentGroup, position.index, nav.commands) : updateSegmentGroup(position.segmentGroup, position.index, nav.commands);\n return tree(root, position.segmentGroup, newSegmentGroup, queryParams, fragment);\n}\nfunction isMatrixParams(command) {\n return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath;\n}\n/**\n * Determines if a given command has an `outlets` map. When we encounter a command\n * with an outlets k/v map, we need to apply each outlet individually to the existing segment.\n */\nfunction isCommandWithOutlets(command) {\n return typeof command === 'object' && command != null && command.outlets;\n}\nfunction tree(oldRoot, oldSegmentGroup, newSegmentGroup, queryParams, fragment) {\n let qp = {};\n if (queryParams) {\n Object.entries(queryParams).forEach(([name, value]) => {\n qp[name] = Array.isArray(value) ? value.map(v => `${v}`) : `${value}`;\n });\n }\n let rootCandidate;\n if (oldRoot === oldSegmentGroup) {\n rootCandidate = newSegmentGroup;\n } else {\n rootCandidate = replaceSegment(oldRoot, oldSegmentGroup, newSegmentGroup);\n }\n const newRoot = createRoot(squashSegmentGroup(rootCandidate));\n return new UrlTree(newRoot, qp, fragment);\n}\n/**\n * Replaces the `oldSegment` which is located in some child of the `current` with the `newSegment`.\n * This also has the effect of creating new `UrlSegmentGroup` copies to update references. This\n * shouldn't be necessary but the fallback logic for an invalid ActivatedRoute in the creation uses\n * the Router's current url tree. If we don't create new segment groups, we end up modifying that\n * value.\n */\nfunction replaceSegment(current, oldSegment, newSegment) {\n const children = {};\n Object.entries(current.children).forEach(([outletName, c]) => {\n if (c === oldSegment) {\n children[outletName] = newSegment;\n } else {\n children[outletName] = replaceSegment(c, oldSegment, newSegment);\n }\n });\n return new UrlSegmentGroup(current.segments, children);\n}\nclass Navigation {\n isAbsolute;\n numberOfDoubleDots;\n commands;\n constructor(isAbsolute, numberOfDoubleDots, commands) {\n this.isAbsolute = isAbsolute;\n this.numberOfDoubleDots = numberOfDoubleDots;\n this.commands = commands;\n if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {\n throw new ɵRuntimeError(4003 /* RuntimeErrorCode.ROOT_SEGMENT_MATRIX_PARAMS */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Root segment cannot have matrix parameters');\n }\n const cmdWithOutlet = commands.find(isCommandWithOutlets);\n if (cmdWithOutlet && cmdWithOutlet !== last(commands)) {\n throw new ɵRuntimeError(4004 /* RuntimeErrorCode.MISPLACED_OUTLETS_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) && '{outlets:{}} has to be the last command');\n }\n }\n toRoot() {\n return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/';\n }\n}\n/** Transforms commands to a normalized `Navigation` */\nfunction computeNavigation(commands) {\n if (typeof commands[0] === 'string' && commands.length === 1 && commands[0] === '/') {\n return new Navigation(true, 0, commands);\n }\n let numberOfDoubleDots = 0;\n let isAbsolute = false;\n const res = commands.reduce((res, cmd, cmdIdx) => {\n if (typeof cmd === 'object' && cmd != null) {\n if (cmd.outlets) {\n const outlets = {};\n Object.entries(cmd.outlets).forEach(([name, commands]) => {\n outlets[name] = typeof commands === 'string' ? commands.split('/') : commands;\n });\n return [...res, {\n outlets\n }];\n }\n if (cmd.segmentPath) {\n return [...res, cmd.segmentPath];\n }\n }\n if (!(typeof cmd === 'string')) {\n return [...res, cmd];\n }\n if (cmdIdx === 0) {\n cmd.split('/').forEach((urlPart, partIndex) => {\n if (partIndex == 0 && urlPart === '.') {\n // skip './a'\n } else if (partIndex == 0 && urlPart === '') {\n // '/a'\n isAbsolute = true;\n } else if (urlPart === '..') {\n // '../a'\n numberOfDoubleDots++;\n } else if (urlPart != '') {\n res.push(urlPart);\n }\n });\n return res;\n }\n return [...res, cmd];\n }, []);\n return new Navigation(isAbsolute, numberOfDoubleDots, res);\n}\nclass Position {\n segmentGroup;\n processChildren;\n index;\n constructor(segmentGroup, processChildren, index) {\n this.segmentGroup = segmentGroup;\n this.processChildren = processChildren;\n this.index = index;\n }\n}\nfunction findStartingPositionForTargetGroup(nav, root, target) {\n if (nav.isAbsolute) {\n return new Position(root, true, 0);\n }\n if (!target) {\n // `NaN` is used only to maintain backwards compatibility with incorrectly mocked\n // `ActivatedRouteSnapshot` in tests. In prior versions of this code, the position here was\n // determined based on an internal property that was rarely mocked, resulting in `NaN`. In\n // reality, this code path should _never_ be touched since `target` is not allowed to be falsey.\n return new Position(root, false, NaN);\n }\n if (target.parent === null) {\n return new Position(target, true, 0);\n }\n const modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;\n const index = target.segments.length - 1 + modifier;\n return createPositionApplyingDoubleDots(target, index, nav.numberOfDoubleDots);\n}\nfunction createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {\n let g = group;\n let ci = index;\n let dd = numberOfDoubleDots;\n while (dd > ci) {\n dd -= ci;\n g = g.parent;\n if (!g) {\n throw new ɵRuntimeError(4005 /* RuntimeErrorCode.INVALID_DOUBLE_DOTS */, (typeof ngDevMode === 'undefined' || ngDevMode) && \"Invalid number of '../'\");\n }\n ci = g.segments.length;\n }\n return new Position(g, false, ci - dd);\n}\nfunction getOutlets(commands) {\n if (isCommandWithOutlets(commands[0])) {\n return commands[0].outlets;\n }\n return {\n [PRIMARY_OUTLET]: commands\n };\n}\nfunction updateSegmentGroup(segmentGroup, startIndex, commands) {\n segmentGroup ??= new UrlSegmentGroup([], {});\n if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {\n return updateSegmentGroupChildren(segmentGroup, startIndex, commands);\n }\n const m = prefixedWith(segmentGroup, startIndex, commands);\n const slicedCommands = commands.slice(m.commandIndex);\n if (m.match && m.pathIndex < segmentGroup.segments.length) {\n const g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});\n g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);\n return updateSegmentGroupChildren(g, 0, slicedCommands);\n } else if (m.match && slicedCommands.length === 0) {\n return new UrlSegmentGroup(segmentGroup.segments, {});\n } else if (m.match && !segmentGroup.hasChildren()) {\n return createNewSegmentGroup(segmentGroup, startIndex, commands);\n } else if (m.match) {\n return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands);\n } else {\n return createNewSegmentGroup(segmentGroup, startIndex, commands);\n }\n}\nfunction updateSegmentGroupChildren(segmentGroup, startIndex, commands) {\n if (commands.length === 0) {\n return new UrlSegmentGroup(segmentGroup.segments, {});\n } else {\n const outlets = getOutlets(commands);\n const children = {};\n // If the set of commands applies to anything other than the primary outlet and the child\n // segment is an empty path primary segment on its own, we want to apply the commands to the\n // empty child path rather than here. The outcome is that the empty primary child is effectively\n // removed from the final output UrlTree. Imagine the following config:\n //\n // {path: '', children: [{path: '**', outlet: 'popup'}]}.\n //\n // Navigation to /(popup:a) will activate the child outlet correctly Given a follow-up\n // navigation with commands\n // ['/', {outlets: {'popup': 'b'}}], we _would not_ want to apply the outlet commands to the\n // root segment because that would result in\n // //(popup:a)(popup:b) since the outlet command got applied one level above where it appears in\n // the `ActivatedRoute` rather than updating the existing one.\n //\n // Because empty paths do not appear in the URL segments and the fact that the segments used in\n // the output `UrlTree` are squashed to eliminate these empty paths where possible\n // https://github.com/angular/angular/blob/13f10de40e25c6900ca55bd83b36bd533dacfa9e/packages/router/src/url_tree.ts#L755\n // it can be hard to determine what is the right thing to do when applying commands to a\n // `UrlSegmentGroup` that is created from an \"unsquashed\"/expanded `ActivatedRoute` tree.\n // This code effectively \"squashes\" empty path primary routes when they have no siblings on\n // the same level of the tree.\n if (Object.keys(outlets).some(o => o !== PRIMARY_OUTLET) && segmentGroup.children[PRIMARY_OUTLET] && segmentGroup.numberOfChildren === 1 && segmentGroup.children[PRIMARY_OUTLET].segments.length === 0) {\n const childrenOfEmptyChild = updateSegmentGroupChildren(segmentGroup.children[PRIMARY_OUTLET], startIndex, commands);\n return new UrlSegmentGroup(segmentGroup.segments, childrenOfEmptyChild.children);\n }\n Object.entries(outlets).forEach(([outlet, commands]) => {\n if (typeof commands === 'string') {\n commands = [commands];\n }\n if (commands !== null) {\n children[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands);\n }\n });\n Object.entries(segmentGroup.children).forEach(([childOutlet, child]) => {\n if (outlets[childOutlet] === undefined) {\n children[childOutlet] = child;\n }\n });\n return new UrlSegmentGroup(segmentGroup.segments, children);\n }\n}\nfunction prefixedWith(segmentGroup, startIndex, commands) {\n let currentCommandIndex = 0;\n let currentPathIndex = startIndex;\n const noMatch = {\n match: false,\n pathIndex: 0,\n commandIndex: 0\n };\n while (currentPathIndex < segmentGroup.segments.length) {\n if (currentCommandIndex >= commands.length) return noMatch;\n const path = segmentGroup.segments[currentPathIndex];\n const command = commands[currentCommandIndex];\n // Do not try to consume command as part of the prefixing if it has outlets because it can\n // contain outlets other than the one being processed. Consuming the outlets command would\n // result in other outlets being ignored.\n if (isCommandWithOutlets(command)) {\n break;\n }\n const curr = `${command}`;\n const next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;\n if (currentPathIndex > 0 && curr === undefined) break;\n if (curr && next && typeof next === 'object' && next.outlets === undefined) {\n if (!compare(curr, next, path)) return noMatch;\n currentCommandIndex += 2;\n } else {\n if (!compare(curr, {}, path)) return noMatch;\n currentCommandIndex++;\n }\n currentPathIndex++;\n }\n return {\n match: true,\n pathIndex: currentPathIndex,\n commandIndex: currentCommandIndex\n };\n}\nfunction createNewSegmentGroup(segmentGroup, startIndex, commands) {\n const paths = segmentGroup.segments.slice(0, startIndex);\n let i = 0;\n while (i < commands.length) {\n const command = commands[i];\n if (isCommandWithOutlets(command)) {\n const children = createNewSegmentChildren(command.outlets);\n return new UrlSegmentGroup(paths, children);\n }\n // if we start with an object literal, we need to reuse the path part from the segment\n if (i === 0 && isMatrixParams(commands[0])) {\n const p = segmentGroup.segments[startIndex];\n paths.push(new UrlSegment(p.path, stringify(commands[0])));\n i++;\n continue;\n }\n const curr = isCommandWithOutlets(command) ? command.outlets[PRIMARY_OUTLET] : `${command}`;\n const next = i < commands.length - 1 ? commands[i + 1] : null;\n if (curr && next && isMatrixParams(next)) {\n paths.push(new UrlSegment(curr, stringify(next)));\n i += 2;\n } else {\n paths.push(new UrlSegment(curr, {}));\n i++;\n }\n }\n return new UrlSegmentGroup(paths, {});\n}\nfunction createNewSegmentChildren(outlets) {\n const children = {};\n Object.entries(outlets).forEach(([outlet, commands]) => {\n if (typeof commands === 'string') {\n commands = [commands];\n }\n if (commands !== null) {\n children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands);\n }\n });\n return children;\n}\nfunction stringify(params) {\n const res = {};\n Object.entries(params).forEach(([k, v]) => res[k] = `${v}`);\n return res;\n}\nfunction compare(path, params, segment) {\n return path == segment.path && shallowEqual(params, segment.parameters);\n}\nconst IMPERATIVE_NAVIGATION = 'imperative';\n/**\n * Identifies the type of a router event.\n *\n * @publicApi\n */\nvar EventType = /*#__PURE__*/function (EventType) {\n EventType[EventType[\"NavigationStart\"] = 0] = \"NavigationStart\";\n EventType[EventType[\"NavigationEnd\"] = 1] = \"NavigationEnd\";\n EventType[EventType[\"NavigationCancel\"] = 2] = \"NavigationCancel\";\n EventType[EventType[\"NavigationError\"] = 3] = \"NavigationError\";\n EventType[EventType[\"RoutesRecognized\"] = 4] = \"RoutesRecognized\";\n EventType[EventType[\"ResolveStart\"] = 5] = \"ResolveStart\";\n EventType[EventType[\"ResolveEnd\"] = 6] = \"ResolveEnd\";\n EventType[EventType[\"GuardsCheckStart\"] = 7] = \"GuardsCheckStart\";\n EventType[EventType[\"GuardsCheckEnd\"] = 8] = \"GuardsCheckEnd\";\n EventType[EventType[\"RouteConfigLoadStart\"] = 9] = \"RouteConfigLoadStart\";\n EventType[EventType[\"RouteConfigLoadEnd\"] = 10] = \"RouteConfigLoadEnd\";\n EventType[EventType[\"ChildActivationStart\"] = 11] = \"ChildActivationStart\";\n EventType[EventType[\"ChildActivationEnd\"] = 12] = \"ChildActivationEnd\";\n EventType[EventType[\"ActivationStart\"] = 13] = \"ActivationStart\";\n EventType[EventType[\"ActivationEnd\"] = 14] = \"ActivationEnd\";\n EventType[EventType[\"Scroll\"] = 15] = \"Scroll\";\n EventType[EventType[\"NavigationSkipped\"] = 16] = \"NavigationSkipped\";\n return EventType;\n}(EventType || {});\n/**\n * Base for events the router goes through, as opposed to events tied to a specific\n * route. Fired one time for any given navigation.\n *\n * The following code shows how a class subscribes to router events.\n *\n * ```ts\n * import {Event, RouterEvent, Router} from '@angular/router';\n *\n * class MyService {\n * constructor(public router: Router) {\n * router.events.pipe(\n * filter((e: Event | RouterEvent): e is RouterEvent => e instanceof RouterEvent)\n * ).subscribe((e: RouterEvent) => {\n * // Do something\n * });\n * }\n * }\n * ```\n *\n * @see {@link Event}\n * @see [Router events summary](guide/routing/router-reference#router-events)\n * @publicApi\n */\nclass RouterEvent {\n id;\n url;\n constructor(/** A unique ID that the router assigns to every router navigation. */\n id, /** The URL that is the destination for this navigation. */\n url) {\n this.id = id;\n this.url = url;\n }\n}\n/**\n * An event triggered when a navigation starts.\n *\n * @publicApi\n */\nclass NavigationStart extends RouterEvent {\n type = EventType.NavigationStart;\n /**\n * Identifies the call or event that triggered the navigation.\n * An `imperative` trigger is a call to `router.navigateByUrl()` or `router.navigate()`.\n *\n * @see {@link NavigationEnd}\n * @see {@link NavigationCancel}\n * @see {@link NavigationError}\n */\n navigationTrigger;\n /**\n * The navigation state that was previously supplied to the `pushState` call,\n * when the navigation is triggered by a `popstate` event. Otherwise null.\n *\n * The state object is defined by `NavigationExtras`, and contains any\n * developer-defined state value, as well as a unique ID that\n * the router assigns to every router transition/navigation.\n *\n * From the perspective of the router, the router never \"goes back\".\n * When the user clicks on the back button in the browser,\n * a new navigation ID is created.\n *\n * Use the ID in this previous-state object to differentiate between a newly created\n * state and one returned to by a `popstate` event, so that you can restore some\n * remembered state, such as scroll position.\n *\n */\n restoredState;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n navigationTrigger = 'imperative', /** @docsNotRequired */\n restoredState = null) {\n super(id, url);\n this.navigationTrigger = navigationTrigger;\n this.restoredState = restoredState;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationStart(id: ${this.id}, url: '${this.url}')`;\n }\n}\n/**\n * An event triggered when a navigation ends successfully.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationCancel}\n * @see {@link NavigationError}\n *\n * @publicApi\n */\nclass NavigationEnd extends RouterEvent {\n urlAfterRedirects;\n type = EventType.NavigationEnd;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}')`;\n }\n}\n/**\n * A code for the `NavigationCancel` event of the `Router` to indicate the\n * reason a navigation failed.\n *\n * @publicApi\n */\nvar NavigationCancellationCode = /*#__PURE__*/function (NavigationCancellationCode) {\n /**\n * A navigation failed because a guard returned a `UrlTree` to redirect.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"Redirect\"] = 0] = \"Redirect\";\n /**\n * A navigation failed because a more recent navigation started.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"SupersededByNewNavigation\"] = 1] = \"SupersededByNewNavigation\";\n /**\n * A navigation failed because one of the resolvers completed without emitting a value.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"NoDataFromResolver\"] = 2] = \"NoDataFromResolver\";\n /**\n * A navigation failed because a guard returned `false`.\n */\n NavigationCancellationCode[NavigationCancellationCode[\"GuardRejected\"] = 3] = \"GuardRejected\";\n return NavigationCancellationCode;\n}(NavigationCancellationCode || {});\n/**\n * A code for the `NavigationSkipped` event of the `Router` to indicate the\n * reason a navigation was skipped.\n *\n * @publicApi\n */\nvar NavigationSkippedCode = /*#__PURE__*/function (NavigationSkippedCode) {\n /**\n * A navigation was skipped because the navigation URL was the same as the current Router URL.\n */\n NavigationSkippedCode[NavigationSkippedCode[\"IgnoredSameUrlNavigation\"] = 0] = \"IgnoredSameUrlNavigation\";\n /**\n * A navigation was skipped because the configured `UrlHandlingStrategy` return `false` for both\n * the current Router URL and the target of the navigation.\n *\n * @see {@link UrlHandlingStrategy}\n */\n NavigationSkippedCode[NavigationSkippedCode[\"IgnoredByUrlHandlingStrategy\"] = 1] = \"IgnoredByUrlHandlingStrategy\";\n return NavigationSkippedCode;\n}(NavigationSkippedCode || {});\n/**\n * An event triggered when a navigation is canceled, directly or indirectly.\n * This can happen for several reasons including when a route guard\n * returns `false` or initiates a redirect by returning a `UrlTree`.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationEnd}\n * @see {@link NavigationError}\n *\n * @publicApi\n */\nclass NavigationCancel extends RouterEvent {\n reason;\n code;\n type = EventType.NavigationCancel;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url,\n /**\n * A description of why the navigation was cancelled. For debug purposes only. Use `code`\n * instead for a stable cancellation reason that can be used in production.\n */\n reason,\n /**\n * A code to indicate why the navigation was canceled. This cancellation code is stable for\n * the reason and can be relied on whereas the `reason` string could change and should not be\n * used in production.\n */\n code) {\n super(id, url);\n this.reason = reason;\n this.code = code;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationCancel(id: ${this.id}, url: '${this.url}')`;\n }\n}\n/**\n * An event triggered when a navigation is skipped.\n * This can happen for a couple reasons including onSameUrlHandling\n * is set to `ignore` and the navigation URL is not different than the\n * current state.\n *\n * @publicApi\n */\nclass NavigationSkipped extends RouterEvent {\n reason;\n code;\n type = EventType.NavigationSkipped;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url,\n /**\n * A description of why the navigation was skipped. For debug purposes only. Use `code`\n * instead for a stable skipped reason that can be used in production.\n */\n reason,\n /**\n * A code to indicate why the navigation was skipped. This code is stable for\n * the reason and can be relied on whereas the `reason` string could change and should not be\n * used in production.\n */\n code) {\n super(id, url);\n this.reason = reason;\n this.code = code;\n }\n}\n/**\n * An event triggered when a navigation fails due to an unexpected error.\n *\n * @see {@link NavigationStart}\n * @see {@link NavigationEnd}\n * @see {@link NavigationCancel}\n *\n * @publicApi\n */\nclass NavigationError extends RouterEvent {\n error;\n target;\n type = EventType.NavigationError;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n error,\n /**\n * The target of the navigation when the error occurred.\n *\n * Note that this can be `undefined` because an error could have occurred before the\n * `RouterStateSnapshot` was created for the navigation.\n */\n target) {\n super(id, url);\n this.error = error;\n this.target = target;\n }\n /** @docsNotRequired */\n toString() {\n return `NavigationError(id: ${this.id}, url: '${this.url}', error: ${this.error})`;\n }\n}\n/**\n * An event triggered when routes are recognized.\n *\n * @publicApi\n */\nclass RoutesRecognized extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.RoutesRecognized;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n /** @docsNotRequired */\n toString() {\n return `RoutesRecognized(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the start of the Guard phase of routing.\n *\n * @see {@link GuardsCheckEnd}\n *\n * @publicApi\n */\nclass GuardsCheckStart extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.GuardsCheckStart;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n toString() {\n return `GuardsCheckStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the end of the Guard phase of routing.\n *\n * @see {@link GuardsCheckStart}\n *\n * @publicApi\n */\nclass GuardsCheckEnd extends RouterEvent {\n urlAfterRedirects;\n state;\n shouldActivate;\n type = EventType.GuardsCheckEnd;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state, /** @docsNotRequired */\n shouldActivate) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n this.shouldActivate = shouldActivate;\n }\n toString() {\n return `GuardsCheckEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state}, shouldActivate: ${this.shouldActivate})`;\n }\n}\n/**\n * An event triggered at the start of the Resolve phase of routing.\n *\n * Runs in the \"resolve\" phase whether or not there is anything to resolve.\n * In future, may change to only run when there are things to be resolved.\n *\n * @see {@link ResolveEnd}\n *\n * @publicApi\n */\nclass ResolveStart extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.ResolveStart;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n toString() {\n return `ResolveStart(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered at the end of the Resolve phase of routing.\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ResolveEnd extends RouterEvent {\n urlAfterRedirects;\n state;\n type = EventType.ResolveEnd;\n constructor(/** @docsNotRequired */\n id, /** @docsNotRequired */\n url, /** @docsNotRequired */\n urlAfterRedirects, /** @docsNotRequired */\n state) {\n super(id, url);\n this.urlAfterRedirects = urlAfterRedirects;\n this.state = state;\n }\n toString() {\n return `ResolveEnd(id: ${this.id}, url: '${this.url}', urlAfterRedirects: '${this.urlAfterRedirects}', state: ${this.state})`;\n }\n}\n/**\n * An event triggered before lazy loading a route configuration.\n *\n * @see {@link RouteConfigLoadEnd}\n *\n * @publicApi\n */\nclass RouteConfigLoadStart {\n route;\n type = EventType.RouteConfigLoadStart;\n constructor(/** @docsNotRequired */\n route) {\n this.route = route;\n }\n toString() {\n return `RouteConfigLoadStart(path: ${this.route.path})`;\n }\n}\n/**\n * An event triggered when a route has been lazy loaded.\n *\n * @see {@link RouteConfigLoadStart}\n *\n * @publicApi\n */\nclass RouteConfigLoadEnd {\n route;\n type = EventType.RouteConfigLoadEnd;\n constructor(/** @docsNotRequired */\n route) {\n this.route = route;\n }\n toString() {\n return `RouteConfigLoadEnd(path: ${this.route.path})`;\n }\n}\n/**\n * An event triggered at the start of the child-activation\n * part of the Resolve phase of routing.\n * @see {@link ChildActivationEnd}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ChildActivationStart {\n snapshot;\n type = EventType.ChildActivationStart;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ChildActivationStart(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the end of the child-activation part\n * of the Resolve phase of routing.\n * @see {@link ChildActivationStart}\n * @see {@link ResolveStart}\n * @publicApi\n */\nclass ChildActivationEnd {\n snapshot;\n type = EventType.ChildActivationEnd;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ChildActivationEnd(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the start of the activation part\n * of the Resolve phase of routing.\n * @see {@link ActivationEnd}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ActivationStart {\n snapshot;\n type = EventType.ActivationStart;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ActivationStart(path: '${path}')`;\n }\n}\n/**\n * An event triggered at the end of the activation part\n * of the Resolve phase of routing.\n * @see {@link ActivationStart}\n * @see {@link ResolveStart}\n *\n * @publicApi\n */\nclass ActivationEnd {\n snapshot;\n type = EventType.ActivationEnd;\n constructor(/** @docsNotRequired */\n snapshot) {\n this.snapshot = snapshot;\n }\n toString() {\n const path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';\n return `ActivationEnd(path: '${path}')`;\n }\n}\n/**\n * An event triggered by scrolling.\n *\n * @publicApi\n */\nclass Scroll {\n routerEvent;\n position;\n anchor;\n type = EventType.Scroll;\n constructor(/** @docsNotRequired */\n routerEvent, /** @docsNotRequired */\n position, /** @docsNotRequired */\n anchor) {\n this.routerEvent = routerEvent;\n this.position = position;\n this.anchor = anchor;\n }\n toString() {\n const pos = this.position ? `${this.position[0]}, ${this.position[1]}` : null;\n return `Scroll(anchor: '${this.anchor}', position: '${pos}')`;\n }\n}\nclass BeforeActivateRoutes {}\nclass RedirectRequest {\n url;\n navigationBehaviorOptions;\n constructor(url, navigationBehaviorOptions) {\n this.url = url;\n this.navigationBehaviorOptions = navigationBehaviorOptions;\n }\n}\nfunction stringifyEvent(routerEvent) {\n switch (routerEvent.type) {\n case EventType.ActivationEnd:\n return `ActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ActivationStart:\n return `ActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ChildActivationEnd:\n return `ChildActivationEnd(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.ChildActivationStart:\n return `ChildActivationStart(path: '${routerEvent.snapshot.routeConfig?.path || ''}')`;\n case EventType.GuardsCheckEnd:\n return `GuardsCheckEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state}, shouldActivate: ${routerEvent.shouldActivate})`;\n case EventType.GuardsCheckStart:\n return `GuardsCheckStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.NavigationCancel:\n return `NavigationCancel(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.NavigationSkipped:\n return `NavigationSkipped(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.NavigationEnd:\n return `NavigationEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}')`;\n case EventType.NavigationError:\n return `NavigationError(id: ${routerEvent.id}, url: '${routerEvent.url}', error: ${routerEvent.error})`;\n case EventType.NavigationStart:\n return `NavigationStart(id: ${routerEvent.id}, url: '${routerEvent.url}')`;\n case EventType.ResolveEnd:\n return `ResolveEnd(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.ResolveStart:\n return `ResolveStart(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.RouteConfigLoadEnd:\n return `RouteConfigLoadEnd(path: ${routerEvent.route.path})`;\n case EventType.RouteConfigLoadStart:\n return `RouteConfigLoadStart(path: ${routerEvent.route.path})`;\n case EventType.RoutesRecognized:\n return `RoutesRecognized(id: ${routerEvent.id}, url: '${routerEvent.url}', urlAfterRedirects: '${routerEvent.urlAfterRedirects}', state: ${routerEvent.state})`;\n case EventType.Scroll:\n const pos = routerEvent.position ? `${routerEvent.position[0]}, ${routerEvent.position[1]}` : null;\n return `Scroll(anchor: '${routerEvent.anchor}', position: '${pos}')`;\n }\n}\n\n/**\n * Creates an `EnvironmentInjector` if the `Route` has providers and one does not already exist\n * and returns the injector. Otherwise, if the `Route` does not have `providers`, returns the\n * `currentInjector`.\n *\n * @param route The route that might have providers\n * @param currentInjector The parent injector of the `Route`\n */\nfunction getOrCreateRouteInjectorIfNeeded(route, currentInjector) {\n if (route.providers && !route._injector) {\n route._injector = createEnvironmentInjector(route.providers, currentInjector, `Route: ${route.path}`);\n }\n return route._injector ?? currentInjector;\n}\nfunction getLoadedRoutes$1(route) {\n return route._loadedRoutes;\n}\nfunction getLoadedInjector(route) {\n return route._loadedInjector;\n}\nfunction getLoadedComponent(route) {\n return route._loadedComponent;\n}\nfunction getProvidersInjector(route) {\n return route._injector;\n}\nfunction validateConfig(config, parentPath = '', requireStandaloneComponents = false) {\n // forEach doesn't iterate undefined values\n for (let i = 0; i < config.length; i++) {\n const route = config[i];\n const fullPath = getFullPath(parentPath, route);\n validateNode(route, fullPath, requireStandaloneComponents);\n }\n}\nfunction assertStandalone(fullPath, component) {\n if (component && ɵisNgModule(component)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. You are using 'loadComponent' with a module, ` + `but it must be used with standalone components. Use 'loadChildren' instead.`);\n } else if (component && !isStandalone(component)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. The component must be standalone.`);\n }\n}\nfunction validateNode(route, fullPath, requireStandaloneComponents) {\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n if (!route) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `\n Invalid configuration of route '${fullPath}': Encountered undefined route.\n The reason might be an extra comma.\n\n Example:\n const routes: Routes = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n { path: 'dashboard', component: DashboardComponent },, << two commas\n { path: 'detail/:id', component: HeroDetailComponent }\n ];\n `);\n }\n if (Array.isArray(route)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': Array cannot be specified`);\n }\n if (!route.redirectTo && !route.component && !route.loadComponent && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': a componentless route without children or loadChildren cannot have a named outlet set`);\n }\n if (route.redirectTo && route.children) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and children cannot be used together`);\n }\n if (route.redirectTo && route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and loadChildren cannot be used together`);\n }\n if (route.children && route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': children and loadChildren cannot be used together`);\n }\n if (route.redirectTo && (route.component || route.loadComponent)) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and component/loadComponent cannot be used together`);\n }\n if (route.component && route.loadComponent) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': component and loadComponent cannot be used together`);\n }\n if (route.redirectTo && route.canActivate) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': redirectTo and canActivate cannot be used together. Redirects happen before activation ` + `so canActivate will never be executed.`);\n }\n if (route.path && route.matcher) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path and matcher cannot be used together`);\n }\n if (route.redirectTo === void 0 && !route.component && !route.loadComponent && !route.children && !route.loadChildren) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}'. One of the following must be provided: component, loadComponent, redirectTo, children or loadChildren`);\n }\n if (route.path === void 0 && route.matcher === void 0) {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': routes must have either a path or a matcher specified`);\n }\n if (typeof route.path === 'string' && route.path.charAt(0) === '/') {\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '${fullPath}': path cannot start with a slash`);\n }\n if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {\n const exp = `The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.`;\n throw new ɵRuntimeError(4014 /* RuntimeErrorCode.INVALID_ROUTE_CONFIG */, `Invalid configuration of route '{path: \"${fullPath}\", redirectTo: \"${route.redirectTo}\"}': please provide 'pathMatch'. ${exp}`);\n }\n if (requireStandaloneComponents) {\n assertStandalone(fullPath, route.component);\n }\n }\n if (route.children) {\n validateConfig(route.children, fullPath, requireStandaloneComponents);\n }\n}\nfunction getFullPath(parentPath, currentRoute) {\n if (!currentRoute) {\n return parentPath;\n }\n if (!parentPath && !currentRoute.path) {\n return '';\n } else if (parentPath && !currentRoute.path) {\n return `${parentPath}/`;\n } else if (!parentPath && currentRoute.path) {\n return currentRoute.path;\n } else {\n return `${parentPath}/${currentRoute.path}`;\n }\n}\n/** Returns the `route.outlet` or PRIMARY_OUTLET if none exists. */\nfunction getOutlet(route) {\n return route.outlet || PRIMARY_OUTLET;\n}\n/**\n * Sorts the `routes` such that the ones with an outlet matching `outletName` come first.\n * The order of the configs is otherwise preserved.\n */\nfunction sortByMatchingOutlets(routes, outletName) {\n const sortedConfig = routes.filter(r => getOutlet(r) === outletName);\n sortedConfig.push(...routes.filter(r => getOutlet(r) !== outletName));\n return sortedConfig;\n}\n/**\n * Gets the first injector in the snapshot's parent tree.\n *\n * If the `Route` has a static list of providers, the returned injector will be the one created from\n * those. If it does not exist, the returned injector may come from the parents, which may be from a\n * loaded config or their static providers.\n *\n * Returns `null` if there is neither this nor any parents have a stored injector.\n *\n * Generally used for retrieving the injector to use for getting tokens for guards/resolvers and\n * also used for getting the correct injector to use for creating components.\n */\nfunction getClosestRouteInjector(snapshot) {\n if (!snapshot) return null;\n // If the current route has its own injector, which is created from the static providers on the\n // route itself, we should use that. Otherwise, we start at the parent since we do not want to\n // include the lazy loaded injector from this route.\n if (snapshot.routeConfig?._injector) {\n return snapshot.routeConfig._injector;\n }\n for (let s = snapshot.parent; s; s = s.parent) {\n const route = s.routeConfig;\n // Note that the order here is important. `_loadedInjector` stored on the route with\n // `loadChildren: () => NgModule` so it applies to child routes with priority. The `_injector`\n // is created from the static providers on that parent route, so it applies to the children as\n // well, but only if there is no lazy loaded NgModuleRef injector.\n if (route?._loadedInjector) return route._loadedInjector;\n if (route?._injector) return route._injector;\n }\n return null;\n}\n\n/**\n * Store contextual information about a `RouterOutlet`\n *\n * @publicApi\n */\nclass OutletContext {\n rootInjector;\n outlet = null;\n route = null;\n children;\n attachRef = null;\n get injector() {\n return getClosestRouteInjector(this.route?.snapshot) ?? this.rootInjector;\n }\n constructor(rootInjector) {\n this.rootInjector = rootInjector;\n this.children = new ChildrenOutletContexts(this.rootInjector);\n }\n}\n/**\n * Store contextual information about the children (= nested) `RouterOutlet`\n *\n * @publicApi\n */\nlet ChildrenOutletContexts = /*#__PURE__*/(() => {\n class ChildrenOutletContexts {\n rootInjector;\n // contexts for child outlets, by name.\n contexts = new Map();\n /** @nodoc */\n constructor(rootInjector) {\n this.rootInjector = rootInjector;\n }\n /** Called when a `RouterOutlet` directive is instantiated */\n onChildOutletCreated(childName, outlet) {\n const context = this.getOrCreateContext(childName);\n context.outlet = outlet;\n this.contexts.set(childName, context);\n }\n /**\n * Called when a `RouterOutlet` directive is destroyed.\n * We need to keep the context as the outlet could be destroyed inside a NgIf and might be\n * re-created later.\n */\n onChildOutletDestroyed(childName) {\n const context = this.getContext(childName);\n if (context) {\n context.outlet = null;\n context.attachRef = null;\n }\n }\n /**\n * Called when the corresponding route is deactivated during navigation.\n * Because the component get destroyed, all children outlet are destroyed.\n */\n onOutletDeactivated() {\n const contexts = this.contexts;\n this.contexts = new Map();\n return contexts;\n }\n onOutletReAttached(contexts) {\n this.contexts = contexts;\n }\n getOrCreateContext(childName) {\n let context = this.getContext(childName);\n if (!context) {\n context = new OutletContext(this.rootInjector);\n this.contexts.set(childName, context);\n }\n return context;\n }\n getContext(childName) {\n return this.contexts.get(childName) || null;\n }\n static ɵfac = function ChildrenOutletContexts_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ChildrenOutletContexts)(i0.ɵɵinject(i0.EnvironmentInjector));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ChildrenOutletContexts,\n factory: ChildrenOutletContexts.ɵfac,\n providedIn: 'root'\n });\n }\n return ChildrenOutletContexts;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass Tree {\n /** @internal */\n _root;\n constructor(root) {\n this._root = root;\n }\n get root() {\n return this._root.value;\n }\n /**\n * @internal\n */\n parent(t) {\n const p = this.pathFromRoot(t);\n return p.length > 1 ? p[p.length - 2] : null;\n }\n /**\n * @internal\n */\n children(t) {\n const n = findNode(t, this._root);\n return n ? n.children.map(t => t.value) : [];\n }\n /**\n * @internal\n */\n firstChild(t) {\n const n = findNode(t, this._root);\n return n && n.children.length > 0 ? n.children[0].value : null;\n }\n /**\n * @internal\n */\n siblings(t) {\n const p = findPath(t, this._root);\n if (p.length < 2) return [];\n const c = p[p.length - 2].children.map(c => c.value);\n return c.filter(cc => cc !== t);\n }\n /**\n * @internal\n */\n pathFromRoot(t) {\n return findPath(t, this._root).map(s => s.value);\n }\n}\n// DFS for the node matching the value\nfunction findNode(value, node) {\n if (value === node.value) return node;\n for (const child of node.children) {\n const node = findNode(value, child);\n if (node) return node;\n }\n return null;\n}\n// Return the path to the node with the given value using DFS\nfunction findPath(value, node) {\n if (value === node.value) return [node];\n for (const child of node.children) {\n const path = findPath(value, child);\n if (path.length) {\n path.unshift(node);\n return path;\n }\n }\n return [];\n}\nclass TreeNode {\n value;\n children;\n constructor(value, children) {\n this.value = value;\n this.children = children;\n }\n toString() {\n return `TreeNode(${this.value})`;\n }\n}\n// Return the list of T indexed by outlet name\nfunction nodeChildrenAsMap(node) {\n const map = {};\n if (node) {\n node.children.forEach(child => map[child.value.outlet] = child);\n }\n return map;\n}\n\n/**\n * Represents the state of the router as a tree of activated routes.\n *\n * @usageNotes\n *\n * Every node in the route tree is an `ActivatedRoute` instance\n * that knows about the \"consumed\" URL segments, the extracted parameters,\n * and the resolved data.\n * Use the `ActivatedRoute` properties to traverse the tree from any node.\n *\n * The following fragment shows how a component gets the root node\n * of the current state to establish its own route tree:\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const state: RouterState = router.routerState;\n * const root: ActivatedRoute = state.root;\n * const child = root.firstChild;\n * const id: Observable = child.params.map(p => p.id);\n * //...\n * }\n * }\n * ```\n *\n * @see {@link ActivatedRoute}\n * @see [Getting route information](guide/routing/common-router-tasks#getting-route-information)\n *\n * @publicApi\n */\nclass RouterState extends Tree {\n snapshot;\n /** @internal */\n constructor(root, /** The current snapshot of the router state */\n snapshot) {\n super(root);\n this.snapshot = snapshot;\n setRouterState(this, root);\n }\n toString() {\n return this.snapshot.toString();\n }\n}\nfunction createEmptyState(rootComponent) {\n const snapshot = createEmptyStateSnapshot(rootComponent);\n const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);\n const emptyParams = new BehaviorSubject({});\n const emptyData = new BehaviorSubject({});\n const emptyQueryParams = new BehaviorSubject({});\n const fragment = new BehaviorSubject('');\n const activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);\n activated.snapshot = snapshot.root;\n return new RouterState(new TreeNode(activated, []), snapshot);\n}\nfunction createEmptyStateSnapshot(rootComponent) {\n const emptyParams = {};\n const emptyData = {};\n const emptyQueryParams = {};\n const fragment = '';\n const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, {});\n return new RouterStateSnapshot('', new TreeNode(activated, []));\n}\n/**\n * Provides access to information about a route associated with a component\n * that is loaded in an outlet.\n * Use to traverse the `RouterState` tree and extract information from nodes.\n *\n * The following example shows how to construct a component using information from a\n * currently activated route.\n *\n * Note: the observables in this class only emit when the current and previous values differ based\n * on shallow equality. For example, changing deeply nested properties in resolved `data` will not\n * cause the `ActivatedRoute.data` `Observable` to emit a new value.\n *\n * {@example router/activated-route/module.ts region=\"activated-route\"\n * header=\"activated-route.component.ts\"}\n *\n * @see [Getting route information](guide/routing/common-router-tasks#getting-route-information)\n *\n * @publicApi\n */\nclass ActivatedRoute {\n urlSubject;\n paramsSubject;\n queryParamsSubject;\n fragmentSubject;\n dataSubject;\n outlet;\n component;\n /** The current snapshot of this route */\n snapshot;\n /** @internal */\n _futureSnapshot;\n /** @internal */\n _routerState;\n /** @internal */\n _paramMap;\n /** @internal */\n _queryParamMap;\n /** An Observable of the resolved route title */\n title;\n /** An observable of the URL segments matched by this route. */\n url;\n /** An observable of the matrix parameters scoped to this route. */\n params;\n /** An observable of the query parameters shared by all the routes. */\n queryParams;\n /** An observable of the URL fragment shared by all the routes. */\n fragment;\n /** An observable of the static and resolved data of this route. */\n data;\n /** @internal */\n constructor(/** @internal */\n urlSubject, /** @internal */\n paramsSubject, /** @internal */\n queryParamsSubject, /** @internal */\n fragmentSubject, /** @internal */\n dataSubject, /** The outlet name of the route, a constant. */\n outlet, /** The component of the route, a constant. */\n component, futureSnapshot) {\n this.urlSubject = urlSubject;\n this.paramsSubject = paramsSubject;\n this.queryParamsSubject = queryParamsSubject;\n this.fragmentSubject = fragmentSubject;\n this.dataSubject = dataSubject;\n this.outlet = outlet;\n this.component = component;\n this._futureSnapshot = futureSnapshot;\n this.title = this.dataSubject?.pipe(map(d => d[RouteTitleKey])) ?? of(undefined);\n // TODO(atscott): Verify that these can be changed to `.asObservable()` with TGP.\n this.url = urlSubject;\n this.params = paramsSubject;\n this.queryParams = queryParamsSubject;\n this.fragment = fragmentSubject;\n this.data = dataSubject;\n }\n /** The configuration used to match this route. */\n get routeConfig() {\n return this._futureSnapshot.routeConfig;\n }\n /** The root of the router state. */\n get root() {\n return this._routerState.root;\n }\n /** The parent of this route in the router state tree. */\n get parent() {\n return this._routerState.parent(this);\n }\n /** The first child of this route in the router state tree. */\n get firstChild() {\n return this._routerState.firstChild(this);\n }\n /** The children of this route in the router state tree. */\n get children() {\n return this._routerState.children(this);\n }\n /** The path from the root of the router state tree to this route. */\n get pathFromRoot() {\n return this._routerState.pathFromRoot(this);\n }\n /**\n * An Observable that contains a map of the required and optional parameters\n * specific to the route.\n * The map supports retrieving single and multiple values from the same parameter.\n */\n get paramMap() {\n this._paramMap ??= this.params.pipe(map(p => convertToParamMap(p)));\n return this._paramMap;\n }\n /**\n * An Observable that contains a map of the query parameters available to all routes.\n * The map supports retrieving single and multiple values from the query parameter.\n */\n get queryParamMap() {\n this._queryParamMap ??= this.queryParams.pipe(map(p => convertToParamMap(p)));\n return this._queryParamMap;\n }\n toString() {\n return this.snapshot ? this.snapshot.toString() : `Future(${this._futureSnapshot})`;\n }\n}\n/**\n * Returns the inherited params, data, and resolve for a given route.\n *\n * By default, we do not inherit parent data unless the current route is path-less or the parent\n * route is component-less.\n */\nfunction getInherited(route, parent, paramsInheritanceStrategy = 'emptyOnly') {\n let inherited;\n const {\n routeConfig\n } = route;\n if (parent !== null && (paramsInheritanceStrategy === 'always' ||\n // inherit parent data if route is empty path\n routeConfig?.path === '' ||\n // inherit parent data if parent was componentless\n !parent.component && !parent.routeConfig?.loadComponent)) {\n inherited = {\n params: {\n ...parent.params,\n ...route.params\n },\n data: {\n ...parent.data,\n ...route.data\n },\n resolve: {\n // Snapshots are created with data inherited from parent and guards (i.e. canActivate) can\n // change data because it's not frozen...\n // This first line could be deleted chose to break/disallow mutating the `data` object in\n // guards.\n // Note that data from parents still override this mutated data so anyone relying on this\n // might be surprised that it doesn't work if parent data is inherited but otherwise does.\n ...route.data,\n // Ensure inherited resolved data overrides inherited static data\n ...parent.data,\n // static data from the current route overrides any inherited data\n ...routeConfig?.data,\n // resolved data from current route overrides everything\n ...route._resolvedData\n }\n };\n } else {\n inherited = {\n params: {\n ...route.params\n },\n data: {\n ...route.data\n },\n resolve: {\n ...route.data,\n ...(route._resolvedData ?? {})\n }\n };\n }\n if (routeConfig && hasStaticTitle(routeConfig)) {\n inherited.resolve[RouteTitleKey] = routeConfig.title;\n }\n return inherited;\n}\n/**\n * @description\n *\n * Contains the information about a route associated with a component loaded in an\n * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to\n * traverse the router state tree.\n *\n * The following example initializes a component with route information extracted\n * from the snapshot of the root node at the time of creation.\n *\n * ```ts\n * @Component({templateUrl:'./my-component.html'})\n * class MyComponent {\n * constructor(route: ActivatedRoute) {\n * const id: string = route.snapshot.params.id;\n * const url: string = route.snapshot.url.join('');\n * const user = route.snapshot.data.user;\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass ActivatedRouteSnapshot {\n url;\n params;\n queryParams;\n fragment;\n data;\n outlet;\n component;\n /** The configuration used to match this route **/\n routeConfig;\n /** @internal */\n _resolve;\n /** @internal */\n _resolvedData;\n /** @internal */\n _routerState;\n /** @internal */\n _paramMap;\n /** @internal */\n _queryParamMap;\n /** The resolved route title */\n get title() {\n // Note: This _must_ be a getter because the data is mutated in the resolvers. Title will not be\n // available at the time of class instantiation.\n return this.data?.[RouteTitleKey];\n }\n /** @internal */\n constructor(/** The URL segments matched by this route */\n url,\n /**\n * The matrix parameters scoped to this route.\n *\n * You can compute all params (or data) in the router state or to get params outside\n * of an activated component by traversing the `RouterState` tree as in the following\n * example:\n * ```\n * collectRouteParams(router: Router) {\n * let params = {};\n * let stack: ActivatedRouteSnapshot[] = [router.routerState.snapshot.root];\n * while (stack.length > 0) {\n * const route = stack.pop()!;\n * params = {...params, ...route.params};\n * stack.push(...route.children);\n * }\n * return params;\n * }\n * ```\n */\n params, /** The query parameters shared by all the routes */\n queryParams, /** The URL fragment shared by all the routes */\n fragment, /** The static and resolved data of this route */\n data, /** The outlet name of the route */\n outlet, /** The component of the route */\n component, routeConfig, resolve) {\n this.url = url;\n this.params = params;\n this.queryParams = queryParams;\n this.fragment = fragment;\n this.data = data;\n this.outlet = outlet;\n this.component = component;\n this.routeConfig = routeConfig;\n this._resolve = resolve;\n }\n /** The root of the router state */\n get root() {\n return this._routerState.root;\n }\n /** The parent of this route in the router state tree */\n get parent() {\n return this._routerState.parent(this);\n }\n /** The first child of this route in the router state tree */\n get firstChild() {\n return this._routerState.firstChild(this);\n }\n /** The children of this route in the router state tree */\n get children() {\n return this._routerState.children(this);\n }\n /** The path from the root of the router state tree to this route */\n get pathFromRoot() {\n return this._routerState.pathFromRoot(this);\n }\n get paramMap() {\n this._paramMap ??= convertToParamMap(this.params);\n return this._paramMap;\n }\n get queryParamMap() {\n this._queryParamMap ??= convertToParamMap(this.queryParams);\n return this._queryParamMap;\n }\n toString() {\n const url = this.url.map(segment => segment.toString()).join('/');\n const matched = this.routeConfig ? this.routeConfig.path : '';\n return `Route(url:'${url}', path:'${matched}')`;\n }\n}\n/**\n * @description\n *\n * Represents the state of the router at a moment in time.\n *\n * This is a tree of activated route snapshots. Every node in this tree knows about\n * the \"consumed\" URL segments, the extracted parameters, and the resolved data.\n *\n * The following example shows how a component is initialized with information\n * from the snapshot of the root node's state at the time of creation.\n *\n * ```ts\n * @Component({templateUrl:'template.html'})\n * class MyComponent {\n * constructor(router: Router) {\n * const state: RouterState = router.routerState;\n * const snapshot: RouterStateSnapshot = state.snapshot;\n * const root: ActivatedRouteSnapshot = snapshot.root;\n * const child = root.firstChild;\n * const id: Observable = child.params.map(p => p.id);\n * //...\n * }\n * }\n * ```\n *\n * @publicApi\n */\nclass RouterStateSnapshot extends Tree {\n url;\n /** @internal */\n constructor(/** The url from which this snapshot was created */\n url, root) {\n super(root);\n this.url = url;\n setRouterState(this, root);\n }\n toString() {\n return serializeNode(this._root);\n }\n}\nfunction setRouterState(state, node) {\n node.value._routerState = state;\n node.children.forEach(c => setRouterState(state, c));\n}\nfunction serializeNode(node) {\n const c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(', ')} } ` : '';\n return `${node.value}${c}`;\n}\n/**\n * The expectation is that the activate route is created with the right set of parameters.\n * So we push new values into the observables only when they are not the initial values.\n * And we detect that by checking if the snapshot field is set.\n */\nfunction advanceActivatedRoute(route) {\n if (route.snapshot) {\n const currentSnapshot = route.snapshot;\n const nextSnapshot = route._futureSnapshot;\n route.snapshot = nextSnapshot;\n if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {\n route.queryParamsSubject.next(nextSnapshot.queryParams);\n }\n if (currentSnapshot.fragment !== nextSnapshot.fragment) {\n route.fragmentSubject.next(nextSnapshot.fragment);\n }\n if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {\n route.paramsSubject.next(nextSnapshot.params);\n }\n if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {\n route.urlSubject.next(nextSnapshot.url);\n }\n if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {\n route.dataSubject.next(nextSnapshot.data);\n }\n } else {\n route.snapshot = route._futureSnapshot;\n // this is for resolved data\n route.dataSubject.next(route._futureSnapshot.data);\n }\n}\nfunction equalParamsAndUrlSegments(a, b) {\n const equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);\n const parentsMismatch = !a.parent !== !b.parent;\n return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));\n}\nfunction hasStaticTitle(config) {\n return typeof config.title === 'string' || config.title === null;\n}\n\n/**\n * An `InjectionToken` provided by the `RouterOutlet` and can be set using the `routerOutletData`\n * input.\n *\n * When unset, this value is `null` by default.\n *\n * @usageNotes\n *\n * To set the data from the template of the component with `router-outlet`:\n * ```html\n * \n * ```\n *\n * To read the data in the routed component:\n * ```ts\n * data = inject(ROUTER_OUTLET_DATA) as Signal<{name: string}>;\n * ```\n *\n * @publicApi\n */\nconst ROUTER_OUTLET_DATA = /*#__PURE__*/new InjectionToken(ngDevMode ? 'RouterOutlet data' : '');\n/**\n * @description\n *\n * Acts as a placeholder that Angular dynamically fills based on the current router state.\n *\n * Each outlet can have a unique name, determined by the optional `name` attribute.\n * The name cannot be set or changed dynamically. If not set, default value is \"primary\".\n *\n * ```html\n * \n * \n * \n * ```\n *\n * Named outlets can be the targets of secondary routes.\n * The `Route` object for a secondary route has an `outlet` property to identify the target outlet:\n *\n * `{path: , component: , outlet: }`\n *\n * Using named outlets and secondary routes, you can target multiple outlets in\n * the same `RouterLink` directive.\n *\n * The router keeps track of separate branches in a navigation tree for each named outlet and\n * generates a representation of that tree in the URL.\n * The URL for a secondary route uses the following syntax to specify both the primary and secondary\n * routes at the same time:\n *\n * `http://base-path/primary-route-path(outlet-name:route-path)`\n *\n * A router outlet emits an activate event when a new component is instantiated,\n * deactivate event when a component is destroyed.\n * An attached event emits when the `RouteReuseStrategy` instructs the outlet to reattach the\n * subtree, and the detached event emits when the `RouteReuseStrategy` instructs the outlet to\n * detach the subtree.\n *\n * ```html\n * \n * ```\n *\n * @see {@link RouterLink}\n * @see {@link Route}\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterOutlet = /*#__PURE__*/(() => {\n class RouterOutlet {\n activated = null;\n /** @internal */\n get activatedComponentRef() {\n return this.activated;\n }\n _activatedRoute = null;\n /**\n * The name of the outlet\n *\n */\n name = PRIMARY_OUTLET;\n activateEvents = new EventEmitter();\n deactivateEvents = new EventEmitter();\n /**\n * Emits an attached component instance when the `RouteReuseStrategy` instructs to re-attach a\n * previously detached subtree.\n **/\n attachEvents = new EventEmitter();\n /**\n * Emits a detached component instance when the `RouteReuseStrategy` instructs to detach the\n * subtree.\n */\n detachEvents = new EventEmitter();\n /**\n * Data that will be provided to the child injector through the `ROUTER_OUTLET_DATA` token.\n *\n * When unset, the value of the token is `undefined` by default.\n */\n routerOutletData = input(undefined);\n parentContexts = inject(ChildrenOutletContexts);\n location = inject(ViewContainerRef);\n changeDetector = inject(ChangeDetectorRef);\n inputBinder = inject(INPUT_BINDER, {\n optional: true\n });\n /** @nodoc */\n supportsBindingToComponentInputs = true;\n /** @nodoc */\n ngOnChanges(changes) {\n if (changes['name']) {\n const {\n firstChange,\n previousValue\n } = changes['name'];\n if (firstChange) {\n // The first change is handled by ngOnInit. Because ngOnChanges doesn't get called when no\n // input is set at all, we need to centrally handle the first change there.\n return;\n }\n // unregister with the old name\n if (this.isTrackedInParentContexts(previousValue)) {\n this.deactivate();\n this.parentContexts.onChildOutletDestroyed(previousValue);\n }\n // register the new name\n this.initializeOutletWithName();\n }\n }\n /** @nodoc */\n ngOnDestroy() {\n // Ensure that the registered outlet is this one before removing it on the context.\n if (this.isTrackedInParentContexts(this.name)) {\n this.parentContexts.onChildOutletDestroyed(this.name);\n }\n this.inputBinder?.unsubscribeFromRouteData(this);\n }\n isTrackedInParentContexts(outletName) {\n return this.parentContexts.getContext(outletName)?.outlet === this;\n }\n /** @nodoc */\n ngOnInit() {\n this.initializeOutletWithName();\n }\n initializeOutletWithName() {\n this.parentContexts.onChildOutletCreated(this.name, this);\n if (this.activated) {\n return;\n }\n // If the outlet was not instantiated at the time the route got activated we need to populate\n // the outlet when it is initialized (ie inside a NgIf)\n const context = this.parentContexts.getContext(this.name);\n if (context?.route) {\n if (context.attachRef) {\n // `attachRef` is populated when there is an existing component to mount\n this.attach(context.attachRef, context.route);\n } else {\n // otherwise the component defined in the configuration is created\n this.activateWith(context.route, context.injector);\n }\n }\n }\n get isActivated() {\n return !!this.activated;\n }\n /**\n * @returns The currently activated component instance.\n * @throws An error if the outlet is not activated.\n */\n get component() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n return this.activated.instance;\n }\n get activatedRoute() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n return this._activatedRoute;\n }\n get activatedRouteData() {\n if (this._activatedRoute) {\n return this._activatedRoute.snapshot.data;\n }\n return {};\n }\n /**\n * Called when the `RouteReuseStrategy` instructs to detach the subtree\n */\n detach() {\n if (!this.activated) throw new ɵRuntimeError(4012 /* RuntimeErrorCode.OUTLET_NOT_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Outlet is not activated');\n this.location.detach();\n const cmp = this.activated;\n this.activated = null;\n this._activatedRoute = null;\n this.detachEvents.emit(cmp.instance);\n return cmp;\n }\n /**\n * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree\n */\n attach(ref, activatedRoute) {\n this.activated = ref;\n this._activatedRoute = activatedRoute;\n this.location.insert(ref.hostView);\n this.inputBinder?.bindActivatedRouteToOutletComponent(this);\n this.attachEvents.emit(ref.instance);\n }\n deactivate() {\n if (this.activated) {\n const c = this.component;\n this.activated.destroy();\n this.activated = null;\n this._activatedRoute = null;\n this.deactivateEvents.emit(c);\n }\n }\n activateWith(activatedRoute, environmentInjector) {\n if (this.isActivated) {\n throw new ɵRuntimeError(4013 /* RuntimeErrorCode.OUTLET_ALREADY_ACTIVATED */, (typeof ngDevMode === 'undefined' || ngDevMode) && 'Cannot activate an already activated outlet');\n }\n this._activatedRoute = activatedRoute;\n const location = this.location;\n const snapshot = activatedRoute.snapshot;\n const component = snapshot.component;\n const childContexts = this.parentContexts.getOrCreateContext(this.name).children;\n const injector = new OutletInjector(activatedRoute, childContexts, location.injector, this.routerOutletData);\n this.activated = location.createComponent(component, {\n index: location.length,\n injector,\n environmentInjector: environmentInjector\n });\n // Calling `markForCheck` to make sure we will run the change detection when the\n // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.\n this.changeDetector.markForCheck();\n this.inputBinder?.bindActivatedRouteToOutletComponent(this);\n this.activateEvents.emit(this.activated.instance);\n }\n static ɵfac = function RouterOutlet_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterOutlet)();\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterOutlet,\n selectors: [[\"router-outlet\"]],\n inputs: {\n name: \"name\",\n routerOutletData: [1, \"routerOutletData\"]\n },\n outputs: {\n activateEvents: \"activate\",\n deactivateEvents: \"deactivate\",\n attachEvents: \"attach\",\n detachEvents: \"detach\"\n },\n exportAs: [\"outlet\"],\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n return RouterOutlet;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nclass OutletInjector {\n route;\n childContexts;\n parent;\n outletData;\n /**\n * This injector has a special handing for the `ActivatedRoute` and\n * `ChildrenOutletContexts` tokens: it returns corresponding values for those\n * tokens dynamically. This behavior is different from the regular injector logic,\n * when we initialize and store a value, which is later returned for all inject\n * requests.\n *\n * In some cases (e.g. when using `@defer`), this dynamic behavior requires special\n * handling. This function allows to identify an instance of the `OutletInjector` and\n * create an instance of it without referring to the class itself (so this logic can\n * be invoked from the `core` package). This helps to retain dynamic behavior for the\n * mentioned tokens.\n *\n * Note: it's a temporary solution and we should explore how to support this case better.\n */\n __ngOutletInjector(parentInjector) {\n return new OutletInjector(this.route, this.childContexts, parentInjector, this.outletData);\n }\n constructor(route, childContexts, parent, outletData) {\n this.route = route;\n this.childContexts = childContexts;\n this.parent = parent;\n this.outletData = outletData;\n }\n get(token, notFoundValue) {\n if (token === ActivatedRoute) {\n return this.route;\n }\n if (token === ChildrenOutletContexts) {\n return this.childContexts;\n }\n if (token === ROUTER_OUTLET_DATA) {\n return this.outletData;\n }\n return this.parent.get(token, notFoundValue);\n }\n}\nconst INPUT_BINDER = /*#__PURE__*/new InjectionToken('');\n/**\n * Injectable used as a tree-shakable provider for opting in to binding router data to component\n * inputs.\n *\n * The RouterOutlet registers itself with this service when an `ActivatedRoute` is attached or\n * activated. When this happens, the service subscribes to the `ActivatedRoute` observables (params,\n * queryParams, data) and sets the inputs of the component using `ComponentRef.setInput`.\n * Importantly, when an input does not have an item in the route data with a matching key, this\n * input is set to `undefined`. If it were not done this way, the previous information would be\n * retained if the data got removed from the route (i.e. if a query parameter is removed).\n *\n * The `RouterOutlet` should unregister itself when destroyed via `unsubscribeFromRouteData` so that\n * the subscriptions are cleaned up.\n */\nlet RoutedComponentInputBinder = /*#__PURE__*/(() => {\n class RoutedComponentInputBinder {\n outletDataSubscriptions = new Map();\n bindActivatedRouteToOutletComponent(outlet) {\n this.unsubscribeFromRouteData(outlet);\n this.subscribeToRouteData(outlet);\n }\n unsubscribeFromRouteData(outlet) {\n this.outletDataSubscriptions.get(outlet)?.unsubscribe();\n this.outletDataSubscriptions.delete(outlet);\n }\n subscribeToRouteData(outlet) {\n const {\n activatedRoute\n } = outlet;\n const dataSubscription = combineLatest([activatedRoute.queryParams, activatedRoute.params, activatedRoute.data]).pipe(switchMap(([queryParams, params, data], index) => {\n data = {\n ...queryParams,\n ...params,\n ...data\n };\n // Get the first result from the data subscription synchronously so it's available to\n // the component as soon as possible (and doesn't require a second change detection).\n if (index === 0) {\n return of(data);\n }\n // Promise.resolve is used to avoid synchronously writing the wrong data when\n // two of the Observables in the `combineLatest` stream emit one after\n // another.\n return Promise.resolve(data);\n })).subscribe(data => {\n // Outlet may have been deactivated or changed names to be associated with a different\n // route\n if (!outlet.isActivated || !outlet.activatedComponentRef || outlet.activatedRoute !== activatedRoute || activatedRoute.component === null) {\n this.unsubscribeFromRouteData(outlet);\n return;\n }\n const mirror = reflectComponentType(activatedRoute.component);\n if (!mirror) {\n this.unsubscribeFromRouteData(outlet);\n return;\n }\n for (const {\n templateName\n } of mirror.inputs) {\n outlet.activatedComponentRef.setInput(templateName, data[templateName]);\n }\n });\n this.outletDataSubscriptions.set(outlet, dataSubscription);\n }\n static ɵfac = function RoutedComponentInputBinder_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RoutedComponentInputBinder)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RoutedComponentInputBinder,\n factory: RoutedComponentInputBinder.ɵfac\n });\n }\n return RoutedComponentInputBinder;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction createRouterState(routeReuseStrategy, curr, prevState) {\n const root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined);\n return new RouterState(root, curr);\n}\nfunction createNode(routeReuseStrategy, curr, prevState) {\n // reuse an activated route that is currently displayed on the screen\n if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) {\n const value = prevState.value;\n value._futureSnapshot = curr.value;\n const children = createOrReuseChildren(routeReuseStrategy, curr, prevState);\n return new TreeNode(value, children);\n } else {\n if (routeReuseStrategy.shouldAttach(curr.value)) {\n // retrieve an activated route that is used to be displayed, but is not currently displayed\n const detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);\n if (detachedRouteHandle !== null) {\n const tree = detachedRouteHandle.route;\n tree.value._futureSnapshot = curr.value;\n tree.children = curr.children.map(c => createNode(routeReuseStrategy, c));\n return tree;\n }\n }\n const value = createActivatedRoute(curr.value);\n const children = curr.children.map(c => createNode(routeReuseStrategy, c));\n return new TreeNode(value, children);\n }\n}\nfunction createOrReuseChildren(routeReuseStrategy, curr, prevState) {\n return curr.children.map(child => {\n for (const p of prevState.children) {\n if (routeReuseStrategy.shouldReuseRoute(child.value, p.value.snapshot)) {\n return createNode(routeReuseStrategy, child, p);\n }\n }\n return createNode(routeReuseStrategy, child);\n });\n}\nfunction createActivatedRoute(c) {\n return new ActivatedRoute(new BehaviorSubject(c.url), new BehaviorSubject(c.params), new BehaviorSubject(c.queryParams), new BehaviorSubject(c.fragment), new BehaviorSubject(c.data), c.outlet, c.component, c);\n}\n\n/**\n * Can be returned by a `Router` guard to instruct the `Router` to redirect rather than continue\n * processing the path of the in-flight navigation. The `redirectTo` indicates _where_ the new\n * navigation should go to and the optional `navigationBehaviorOptions` can provide more information\n * about _how_ to perform the navigation.\n *\n * ```ts\n * const route: Route = {\n * path: \"user/:userId\",\n * component: User,\n * canActivate: [\n * () => {\n * const router = inject(Router);\n * const authService = inject(AuthenticationService);\n *\n * if (!authService.isLoggedIn()) {\n * const loginPath = router.parseUrl(\"/login\");\n * return new RedirectCommand(loginPath, {\n * skipLocationChange: \"true\",\n * });\n * }\n *\n * return true;\n * },\n * ],\n * };\n * ```\n * @see [Routing guide](guide/routing/common-router-tasks#preventing-unauthorized-access)\n *\n * @publicApi\n */\nclass RedirectCommand {\n redirectTo;\n navigationBehaviorOptions;\n constructor(redirectTo, navigationBehaviorOptions) {\n this.redirectTo = redirectTo;\n this.navigationBehaviorOptions = navigationBehaviorOptions;\n }\n}\nconst NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';\nfunction redirectingNavigationError(urlSerializer, redirect) {\n const {\n redirectTo,\n navigationBehaviorOptions\n } = isUrlTree(redirect) ? {\n redirectTo: redirect,\n navigationBehaviorOptions: undefined\n } : redirect;\n const error = navigationCancelingError(ngDevMode && `Redirecting to \"${urlSerializer.serialize(redirectTo)}\"`, NavigationCancellationCode.Redirect);\n error.url = redirectTo;\n error.navigationBehaviorOptions = navigationBehaviorOptions;\n return error;\n}\nfunction navigationCancelingError(message, code) {\n const error = new Error(`NavigationCancelingError: ${message || ''}`);\n error[NAVIGATION_CANCELING_ERROR] = true;\n error.cancellationCode = code;\n return error;\n}\nfunction isRedirectingNavigationCancelingError(error) {\n return isNavigationCancelingError(error) && isUrlTree(error.url);\n}\nfunction isNavigationCancelingError(error) {\n return !!error && error[NAVIGATION_CANCELING_ERROR];\n}\nlet warnedAboutUnsupportedInputBinding = false;\nconst activateRoutes = (rootContexts, routeReuseStrategy, forwardEvent, inputBindingEnabled) => map(t => {\n new ActivateRoutes(routeReuseStrategy, t.targetRouterState, t.currentRouterState, forwardEvent, inputBindingEnabled).activate(rootContexts);\n return t;\n});\nclass ActivateRoutes {\n routeReuseStrategy;\n futureState;\n currState;\n forwardEvent;\n inputBindingEnabled;\n constructor(routeReuseStrategy, futureState, currState, forwardEvent, inputBindingEnabled) {\n this.routeReuseStrategy = routeReuseStrategy;\n this.futureState = futureState;\n this.currState = currState;\n this.forwardEvent = forwardEvent;\n this.inputBindingEnabled = inputBindingEnabled;\n }\n activate(parentContexts) {\n const futureRoot = this.futureState._root;\n const currRoot = this.currState ? this.currState._root : null;\n this.deactivateChildRoutes(futureRoot, currRoot, parentContexts);\n advanceActivatedRoute(this.futureState.root);\n this.activateChildRoutes(futureRoot, currRoot, parentContexts);\n }\n // De-activate the child route that are not re-used for the future state\n deactivateChildRoutes(futureNode, currNode, contexts) {\n const children = nodeChildrenAsMap(currNode);\n // Recurse on the routes active in the future state to de-activate deeper children\n futureNode.children.forEach(futureChild => {\n const childOutletName = futureChild.value.outlet;\n this.deactivateRoutes(futureChild, children[childOutletName], contexts);\n delete children[childOutletName];\n });\n // De-activate the routes that will not be re-used\n Object.values(children).forEach(v => {\n this.deactivateRouteAndItsChildren(v, contexts);\n });\n }\n deactivateRoutes(futureNode, currNode, parentContext) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n if (future === curr) {\n // Reusing the node, check to see if the children need to be de-activated\n if (future.component) {\n // If we have a normal route, we need to go through an outlet.\n const context = parentContext.getContext(future.outlet);\n if (context) {\n this.deactivateChildRoutes(futureNode, currNode, context.children);\n }\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.deactivateChildRoutes(futureNode, currNode, parentContext);\n }\n } else {\n if (curr) {\n // Deactivate the current route which will not be re-used\n this.deactivateRouteAndItsChildren(currNode, parentContext);\n }\n }\n }\n deactivateRouteAndItsChildren(route, parentContexts) {\n // If there is no component, the Route is never attached to an outlet (because there is no\n // component to attach).\n if (route.value.component && this.routeReuseStrategy.shouldDetach(route.value.snapshot)) {\n this.detachAndStoreRouteSubtree(route, parentContexts);\n } else {\n this.deactivateRouteAndOutlet(route, parentContexts);\n }\n }\n detachAndStoreRouteSubtree(route, parentContexts) {\n const context = parentContexts.getContext(route.value.outlet);\n const contexts = context && route.value.component ? context.children : parentContexts;\n const children = nodeChildrenAsMap(route);\n for (const treeNode of Object.values(children)) {\n this.deactivateRouteAndItsChildren(treeNode, contexts);\n }\n if (context && context.outlet) {\n const componentRef = context.outlet.detach();\n const contexts = context.children.onOutletDeactivated();\n this.routeReuseStrategy.store(route.value.snapshot, {\n componentRef,\n route,\n contexts\n });\n }\n }\n deactivateRouteAndOutlet(route, parentContexts) {\n const context = parentContexts.getContext(route.value.outlet);\n // The context could be `null` if we are on a componentless route but there may still be\n // children that need deactivating.\n const contexts = context && route.value.component ? context.children : parentContexts;\n const children = nodeChildrenAsMap(route);\n for (const treeNode of Object.values(children)) {\n this.deactivateRouteAndItsChildren(treeNode, contexts);\n }\n if (context) {\n if (context.outlet) {\n // Destroy the component\n context.outlet.deactivate();\n // Destroy the contexts for all the outlets that were in the component\n context.children.onOutletDeactivated();\n }\n // Clear the information about the attached component on the context but keep the reference to\n // the outlet. Clear even if outlet was not yet activated to avoid activating later with old\n // info\n context.attachRef = null;\n context.route = null;\n }\n }\n activateChildRoutes(futureNode, currNode, contexts) {\n const children = nodeChildrenAsMap(currNode);\n futureNode.children.forEach(c => {\n this.activateRoutes(c, children[c.value.outlet], contexts);\n this.forwardEvent(new ActivationEnd(c.value.snapshot));\n });\n if (futureNode.children.length) {\n this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot));\n }\n }\n activateRoutes(futureNode, currNode, parentContexts) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n advanceActivatedRoute(future);\n // reusing the node\n if (future === curr) {\n if (future.component) {\n // If we have a normal route, we need to go through an outlet.\n const context = parentContexts.getOrCreateContext(future.outlet);\n this.activateChildRoutes(futureNode, currNode, context.children);\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.activateChildRoutes(futureNode, currNode, parentContexts);\n }\n } else {\n if (future.component) {\n // if we have a normal route, we need to place the component into the outlet and recurse.\n const context = parentContexts.getOrCreateContext(future.outlet);\n if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {\n const stored = this.routeReuseStrategy.retrieve(future.snapshot);\n this.routeReuseStrategy.store(future.snapshot, null);\n context.children.onOutletReAttached(stored.contexts);\n context.attachRef = stored.componentRef;\n context.route = stored.route.value;\n if (context.outlet) {\n // Attach right away when the outlet has already been instantiated\n // Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated\n context.outlet.attach(stored.componentRef, stored.route.value);\n }\n advanceActivatedRoute(stored.route.value);\n this.activateChildRoutes(futureNode, null, context.children);\n } else {\n context.attachRef = null;\n context.route = future;\n if (context.outlet) {\n // Activate the outlet when it has already been instantiated\n // Otherwise it will get activated from its `ngOnInit` when instantiated\n context.outlet.activateWith(future, context.injector);\n }\n this.activateChildRoutes(futureNode, null, context.children);\n }\n } else {\n // if we have a componentless route, we recurse but keep the same outlet map.\n this.activateChildRoutes(futureNode, null, parentContexts);\n }\n }\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n const context = parentContexts.getOrCreateContext(future.outlet);\n const outlet = context.outlet;\n if (outlet && this.inputBindingEnabled && !outlet.supportsBindingToComponentInputs && !warnedAboutUnsupportedInputBinding) {\n console.warn(`'withComponentInputBinding' feature is enabled but ` + `this application is using an outlet that may not support binding to component inputs.`);\n warnedAboutUnsupportedInputBinding = true;\n }\n }\n }\n}\nclass CanActivate {\n path;\n route;\n constructor(path) {\n this.path = path;\n this.route = this.path[this.path.length - 1];\n }\n}\nclass CanDeactivate {\n component;\n route;\n constructor(component, route) {\n this.component = component;\n this.route = route;\n }\n}\nfunction getAllRouteGuards(future, curr, parentContexts) {\n const futureRoot = future._root;\n const currRoot = curr ? curr._root : null;\n return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);\n}\nfunction getCanActivateChild(p) {\n const canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;\n if (!canActivateChild || canActivateChild.length === 0) return null;\n return {\n node: p,\n guards: canActivateChild\n };\n}\nfunction getTokenOrFunctionIdentity(tokenOrFunction, injector) {\n const NOT_FOUND = Symbol();\n const result = injector.get(tokenOrFunction, NOT_FOUND);\n if (result === NOT_FOUND) {\n if (typeof tokenOrFunction === 'function' && !ɵisInjectable(tokenOrFunction)) {\n // We think the token is just a function so return it as-is\n return tokenOrFunction;\n } else {\n // This will throw the not found error\n return injector.get(tokenOrFunction);\n }\n }\n return result;\n}\nfunction getChildRouteGuards(futureNode, currNode, contexts, futurePath, checks = {\n canDeactivateChecks: [],\n canActivateChecks: []\n}) {\n const prevChildren = nodeChildrenAsMap(currNode);\n // Process the children of the future route\n futureNode.children.forEach(c => {\n getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks);\n delete prevChildren[c.value.outlet];\n });\n // Process any children left from the current route (not active for the future route)\n Object.entries(prevChildren).forEach(([k, v]) => deactivateRouteAndItsChildren(v, contexts.getContext(k), checks));\n return checks;\n}\nfunction getRouteGuards(futureNode, currNode, parentContexts, futurePath, checks = {\n canDeactivateChecks: [],\n canActivateChecks: []\n}) {\n const future = futureNode.value;\n const curr = currNode ? currNode.value : null;\n const context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;\n // reusing the node\n if (curr && future.routeConfig === curr.routeConfig) {\n const shouldRun = shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);\n if (shouldRun) {\n checks.canActivateChecks.push(new CanActivate(futurePath));\n } else {\n // we need to set the data\n future.data = curr.data;\n future._resolvedData = curr._resolvedData;\n }\n // If we have a component, we need to go through an outlet.\n if (future.component) {\n getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks);\n // if we have a componentless route, we recurse but keep the same outlet map.\n } else {\n getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks);\n }\n if (shouldRun && context && context.outlet && context.outlet.isActivated) {\n checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, curr));\n }\n } else {\n if (curr) {\n deactivateRouteAndItsChildren(currNode, context, checks);\n }\n checks.canActivateChecks.push(new CanActivate(futurePath));\n // If we have a component, we need to go through an outlet.\n if (future.component) {\n getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks);\n // if we have a componentless route, we recurse but keep the same outlet map.\n } else {\n getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks);\n }\n }\n return checks;\n}\nfunction shouldRunGuardsAndResolvers(curr, future, mode) {\n if (typeof mode === 'function') {\n return mode(curr, future);\n }\n switch (mode) {\n case 'pathParamsChange':\n return !equalPath(curr.url, future.url);\n case 'pathParamsOrQueryParamsChange':\n return !equalPath(curr.url, future.url) || !shallowEqual(curr.queryParams, future.queryParams);\n case 'always':\n return true;\n case 'paramsOrQueryParamsChange':\n return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams);\n case 'paramsChange':\n default:\n return !equalParamsAndUrlSegments(curr, future);\n }\n}\nfunction deactivateRouteAndItsChildren(route, context, checks) {\n const children = nodeChildrenAsMap(route);\n const r = route.value;\n Object.entries(children).forEach(([childName, node]) => {\n if (!r.component) {\n deactivateRouteAndItsChildren(node, context, checks);\n } else if (context) {\n deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks);\n } else {\n deactivateRouteAndItsChildren(node, null, checks);\n }\n });\n if (!r.component) {\n checks.canDeactivateChecks.push(new CanDeactivate(null, r));\n } else if (context && context.outlet && context.outlet.isActivated) {\n checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));\n } else {\n checks.canDeactivateChecks.push(new CanDeactivate(null, r));\n }\n}\n\n/**\n * Simple function check, but generic so type inference will flow. Example:\n *\n * function product(a: number, b: number) {\n * return a * b;\n * }\n *\n * if (isFunction(fn)) {\n * return fn(1, 2);\n * } else {\n * throw \"Must provide the `product` function\";\n * }\n */\nfunction isFunction(v) {\n return typeof v === 'function';\n}\nfunction isBoolean(v) {\n return typeof v === 'boolean';\n}\nfunction isCanLoad(guard) {\n return guard && isFunction(guard.canLoad);\n}\nfunction isCanActivate(guard) {\n return guard && isFunction(guard.canActivate);\n}\nfunction isCanActivateChild(guard) {\n return guard && isFunction(guard.canActivateChild);\n}\nfunction isCanDeactivate(guard) {\n return guard && isFunction(guard.canDeactivate);\n}\nfunction isCanMatch(guard) {\n return guard && isFunction(guard.canMatch);\n}\nfunction isEmptyError(e) {\n return e instanceof EmptyError || e?.name === 'EmptyError';\n}\nconst INITIAL_VALUE = /* @__PURE__ */Symbol('INITIAL_VALUE');\nfunction prioritizedGuardValue() {\n return switchMap(obs => {\n return combineLatest(obs.map(o => o.pipe(take(1), startWith(INITIAL_VALUE)))).pipe(map(results => {\n for (const result of results) {\n if (result === true) {\n // If result is true, check the next one\n continue;\n } else if (result === INITIAL_VALUE) {\n // If guard has not finished, we need to stop processing.\n return INITIAL_VALUE;\n } else if (result === false || isRedirect(result)) {\n // Result finished and was not true. Return the result.\n // Note that we only allow false/UrlTree/RedirectCommand. Other values are considered invalid and\n // ignored.\n return result;\n }\n }\n // Everything resolved to true. Return true.\n return true;\n }), filter(item => item !== INITIAL_VALUE), take(1));\n });\n}\nfunction isRedirect(val) {\n return isUrlTree(val) || val instanceof RedirectCommand;\n}\nfunction checkGuards(injector, forwardEvent) {\n return mergeMap(t => {\n const {\n targetSnapshot,\n currentSnapshot,\n guards: {\n canActivateChecks,\n canDeactivateChecks\n }\n } = t;\n if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) {\n return of({\n ...t,\n guardsResult: true\n });\n }\n return runCanDeactivateChecks(canDeactivateChecks, targetSnapshot, currentSnapshot, injector).pipe(mergeMap(canDeactivate => {\n return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks(targetSnapshot, canActivateChecks, injector, forwardEvent) : of(canDeactivate);\n }), map(guardsResult => ({\n ...t,\n guardsResult\n })));\n });\n}\nfunction runCanDeactivateChecks(checks, futureRSS, currRSS, injector) {\n return from(checks).pipe(mergeMap(check => runCanDeactivate(check.component, check.route, currRSS, futureRSS, injector)), first(result => {\n return result !== true;\n }, true));\n}\nfunction runCanActivateChecks(futureSnapshot, checks, injector, forwardEvent) {\n return from(checks).pipe(concatMap(check => {\n return concat(fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, injector), runCanActivate(futureSnapshot, check.route, injector));\n }), first(result => {\n return result !== true;\n }, true));\n}\n/**\n * This should fire off `ActivationStart` events for each route being activated at this\n * level.\n * In other words, if you're activating `a` and `b` below, `path` will contain the\n * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always\n * return\n * `true` so checks continue to run.\n */\nfunction fireActivationStart(snapshot, forwardEvent) {\n if (snapshot !== null && forwardEvent) {\n forwardEvent(new ActivationStart(snapshot));\n }\n return of(true);\n}\n/**\n * This should fire off `ChildActivationStart` events for each route being activated at this\n * level.\n * In other words, if you're activating `a` and `b` below, `path` will contain the\n * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always\n * return\n * `true` so checks continue to run.\n */\nfunction fireChildActivationStart(snapshot, forwardEvent) {\n if (snapshot !== null && forwardEvent) {\n forwardEvent(new ChildActivationStart(snapshot));\n }\n return of(true);\n}\nfunction runCanActivate(futureRSS, futureARS, injector) {\n const canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null;\n if (!canActivate || canActivate.length === 0) return of(true);\n const canActivateObservables = canActivate.map(canActivate => {\n return defer(() => {\n const closestInjector = getClosestRouteInjector(futureARS) ?? injector;\n const guard = getTokenOrFunctionIdentity(canActivate, closestInjector);\n const guardVal = isCanActivate(guard) ? guard.canActivate(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n });\n return of(canActivateObservables).pipe(prioritizedGuardValue());\n}\nfunction runCanActivateChild(futureRSS, path, injector) {\n const futureARS = path[path.length - 1];\n const canActivateChildGuards = path.slice(0, path.length - 1).reverse().map(p => getCanActivateChild(p)).filter(_ => _ !== null);\n const canActivateChildGuardsMapped = canActivateChildGuards.map(d => {\n return defer(() => {\n const guardsMapped = d.guards.map(canActivateChild => {\n const closestInjector = getClosestRouteInjector(d.node) ?? injector;\n const guard = getTokenOrFunctionIdentity(canActivateChild, closestInjector);\n const guardVal = isCanActivateChild(guard) ? guard.canActivateChild(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => guard(futureARS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n return of(guardsMapped).pipe(prioritizedGuardValue());\n });\n });\n return of(canActivateChildGuardsMapped).pipe(prioritizedGuardValue());\n}\nfunction runCanDeactivate(component, currARS, currRSS, futureRSS, injector) {\n const canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null;\n if (!canDeactivate || canDeactivate.length === 0) return of(true);\n const canDeactivateObservables = canDeactivate.map(c => {\n const closestInjector = getClosestRouteInjector(currARS) ?? injector;\n const guard = getTokenOrFunctionIdentity(c, closestInjector);\n const guardVal = isCanDeactivate(guard) ? guard.canDeactivate(component, currARS, currRSS, futureRSS) : runInInjectionContext(closestInjector, () => guard(component, currARS, currRSS, futureRSS));\n return wrapIntoObservable(guardVal).pipe(first());\n });\n return of(canDeactivateObservables).pipe(prioritizedGuardValue());\n}\nfunction runCanLoadGuards(injector, route, segments, urlSerializer) {\n const canLoad = route.canLoad;\n if (canLoad === undefined || canLoad.length === 0) {\n return of(true);\n }\n const canLoadObservables = canLoad.map(injectionToken => {\n const guard = getTokenOrFunctionIdentity(injectionToken, injector);\n const guardVal = isCanLoad(guard) ? guard.canLoad(route, segments) : runInInjectionContext(injector, () => guard(route, segments));\n return wrapIntoObservable(guardVal);\n });\n return of(canLoadObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));\n}\nfunction redirectIfUrlTree(urlSerializer) {\n return pipe(tap(result => {\n if (typeof result === 'boolean') return;\n throw redirectingNavigationError(urlSerializer, result);\n }), map(result => result === true));\n}\nfunction runCanMatchGuards(injector, route, segments, urlSerializer) {\n const canMatch = route.canMatch;\n if (!canMatch || canMatch.length === 0) return of(true);\n const canMatchObservables = canMatch.map(injectionToken => {\n const guard = getTokenOrFunctionIdentity(injectionToken, injector);\n const guardVal = isCanMatch(guard) ? guard.canMatch(route, segments) : runInInjectionContext(injector, () => guard(route, segments));\n return wrapIntoObservable(guardVal);\n });\n return of(canMatchObservables).pipe(prioritizedGuardValue(), redirectIfUrlTree(urlSerializer));\n}\nclass NoMatch {\n segmentGroup;\n constructor(segmentGroup) {\n this.segmentGroup = segmentGroup || null;\n }\n}\nclass AbsoluteRedirect extends Error {\n urlTree;\n constructor(urlTree) {\n super();\n this.urlTree = urlTree;\n }\n}\nfunction noMatch$1(segmentGroup) {\n return throwError(new NoMatch(segmentGroup));\n}\nfunction absoluteRedirect(newTree) {\n return throwError(new AbsoluteRedirect(newTree));\n}\nfunction namedOutletsRedirect(redirectTo) {\n return throwError(new ɵRuntimeError(4000 /* RuntimeErrorCode.NAMED_OUTLET_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Only absolute redirects can have named outlets. redirectTo: '${redirectTo}'`));\n}\nfunction canLoadFails(route) {\n return throwError(navigationCancelingError((typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot load children because the guard of the route \"path: '${route.path}'\" returned false`, NavigationCancellationCode.GuardRejected));\n}\nclass ApplyRedirects {\n urlSerializer;\n urlTree;\n constructor(urlSerializer, urlTree) {\n this.urlSerializer = urlSerializer;\n this.urlTree = urlTree;\n }\n lineralizeSegments(route, urlTree) {\n let res = [];\n let c = urlTree.root;\n while (true) {\n res = res.concat(c.segments);\n if (c.numberOfChildren === 0) {\n return of(res);\n }\n if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {\n return namedOutletsRedirect(`${route.redirectTo}`);\n }\n c = c.children[PRIMARY_OUTLET];\n }\n }\n applyRedirectCommands(segments, redirectTo, posParams, currentSnapshot, injector) {\n if (typeof redirectTo !== 'string') {\n const redirectToFn = redirectTo;\n const {\n queryParams,\n fragment,\n routeConfig,\n url,\n outlet,\n params,\n data,\n title\n } = currentSnapshot;\n const newRedirect = runInInjectionContext(injector, () => redirectToFn({\n params,\n data,\n queryParams,\n fragment,\n routeConfig,\n url,\n outlet,\n title\n }));\n if (newRedirect instanceof UrlTree) {\n throw new AbsoluteRedirect(newRedirect);\n }\n redirectTo = newRedirect;\n }\n const newTree = this.applyRedirectCreateUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);\n if (redirectTo[0] === '/') {\n throw new AbsoluteRedirect(newTree);\n }\n return newTree;\n }\n applyRedirectCreateUrlTree(redirectTo, urlTree, segments, posParams) {\n const newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);\n return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);\n }\n createQueryParams(redirectToParams, actualParams) {\n const res = {};\n Object.entries(redirectToParams).forEach(([k, v]) => {\n const copySourceValue = typeof v === 'string' && v[0] === ':';\n if (copySourceValue) {\n const sourceName = v.substring(1);\n res[k] = actualParams[sourceName];\n } else {\n res[k] = v;\n }\n });\n return res;\n }\n createSegmentGroup(redirectTo, group, segments, posParams) {\n const updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);\n let children = {};\n Object.entries(group.children).forEach(([name, child]) => {\n children[name] = this.createSegmentGroup(redirectTo, child, segments, posParams);\n });\n return new UrlSegmentGroup(updatedSegments, children);\n }\n createSegments(redirectTo, redirectToSegments, actualSegments, posParams) {\n return redirectToSegments.map(s => s.path[0] === ':' ? this.findPosParam(redirectTo, s, posParams) : this.findOrReturn(s, actualSegments));\n }\n findPosParam(redirectTo, redirectToUrlSegment, posParams) {\n const pos = posParams[redirectToUrlSegment.path.substring(1)];\n if (!pos) throw new ɵRuntimeError(4001 /* RuntimeErrorCode.MISSING_REDIRECT */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Cannot redirect to '${redirectTo}'. Cannot find '${redirectToUrlSegment.path}'.`);\n return pos;\n }\n findOrReturn(redirectToUrlSegment, actualSegments) {\n let idx = 0;\n for (const s of actualSegments) {\n if (s.path === redirectToUrlSegment.path) {\n actualSegments.splice(idx);\n return s;\n }\n idx++;\n }\n return redirectToUrlSegment;\n }\n}\nconst noMatch = {\n matched: false,\n consumedSegments: [],\n remainingSegments: [],\n parameters: {},\n positionalParamSegments: {}\n};\nfunction matchWithChecks(segmentGroup, route, segments, injector, urlSerializer) {\n const result = match(segmentGroup, route, segments);\n if (!result.matched) {\n return of(result);\n }\n // Only create the Route's `EnvironmentInjector` if it matches the attempted\n // navigation\n injector = getOrCreateRouteInjectorIfNeeded(route, injector);\n return runCanMatchGuards(injector, route, segments, urlSerializer).pipe(map(v => v === true ? result : {\n ...noMatch\n }));\n}\nfunction match(segmentGroup, route, segments) {\n if (route.path === '**') {\n return createWildcardMatchResult(segments);\n }\n if (route.path === '') {\n if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {\n return {\n ...noMatch\n };\n }\n return {\n matched: true,\n consumedSegments: [],\n remainingSegments: segments,\n parameters: {},\n positionalParamSegments: {}\n };\n }\n const matcher = route.matcher || defaultUrlMatcher;\n const res = matcher(segments, segmentGroup, route);\n if (!res) return {\n ...noMatch\n };\n const posParams = {};\n Object.entries(res.posParams ?? {}).forEach(([k, v]) => {\n posParams[k] = v.path;\n });\n const parameters = res.consumed.length > 0 ? {\n ...posParams,\n ...res.consumed[res.consumed.length - 1].parameters\n } : posParams;\n return {\n matched: true,\n consumedSegments: res.consumed,\n remainingSegments: segments.slice(res.consumed.length),\n // TODO(atscott): investigate combining parameters and positionalParamSegments\n parameters,\n positionalParamSegments: res.posParams ?? {}\n };\n}\nfunction createWildcardMatchResult(segments) {\n return {\n matched: true,\n parameters: segments.length > 0 ? last(segments).parameters : {},\n consumedSegments: segments,\n remainingSegments: [],\n positionalParamSegments: {}\n };\n}\nfunction split(segmentGroup, consumedSegments, slicedSegments, config) {\n if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {\n const s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));\n return {\n segmentGroup: s,\n slicedSegments: []\n };\n }\n if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config)) {\n const s = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children));\n return {\n segmentGroup: s,\n slicedSegments\n };\n }\n const s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);\n return {\n segmentGroup: s,\n slicedSegments\n };\n}\nfunction addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) {\n const res = {};\n for (const r of routes) {\n if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {\n const s = new UrlSegmentGroup([], {});\n res[getOutlet(r)] = s;\n }\n }\n return {\n ...children,\n ...res\n };\n}\nfunction createChildrenForEmptyPaths(routes, primarySegment) {\n const res = {};\n res[PRIMARY_OUTLET] = primarySegment;\n for (const r of routes) {\n if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {\n const s = new UrlSegmentGroup([], {});\n res[getOutlet(r)] = s;\n }\n }\n return res;\n}\nfunction containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) {\n return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet(r) !== PRIMARY_OUTLET);\n}\nfunction containsEmptyPathMatches(segmentGroup, slicedSegments, routes) {\n return routes.some(r => emptyPathMatch(segmentGroup, slicedSegments, r));\n}\nfunction emptyPathMatch(segmentGroup, slicedSegments, r) {\n if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') {\n return false;\n }\n return r.path === '';\n}\nfunction noLeftoversInUrl(segmentGroup, segments, outlet) {\n return segments.length === 0 && !segmentGroup.children[outlet];\n}\n\n/**\n * Class used to indicate there were no additional route config matches but that all segments of\n * the URL were consumed during matching so the route was URL matched. When this happens, we still\n * try to match child configs in case there are empty path children.\n */\nclass NoLeftoversInUrl {}\nfunction recognize$1(injector, configLoader, rootComponentType, config, urlTree, urlSerializer, paramsInheritanceStrategy = 'emptyOnly') {\n return new Recognizer(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer).recognize();\n}\nconst MAX_ALLOWED_REDIRECTS = 31;\nclass Recognizer {\n injector;\n configLoader;\n rootComponentType;\n config;\n urlTree;\n paramsInheritanceStrategy;\n urlSerializer;\n applyRedirects;\n absoluteRedirectCount = 0;\n allowRedirects = true;\n constructor(injector, configLoader, rootComponentType, config, urlTree, paramsInheritanceStrategy, urlSerializer) {\n this.injector = injector;\n this.configLoader = configLoader;\n this.rootComponentType = rootComponentType;\n this.config = config;\n this.urlTree = urlTree;\n this.paramsInheritanceStrategy = paramsInheritanceStrategy;\n this.urlSerializer = urlSerializer;\n this.applyRedirects = new ApplyRedirects(this.urlSerializer, this.urlTree);\n }\n noMatchError(e) {\n return new ɵRuntimeError(4002 /* RuntimeErrorCode.NO_MATCH */, typeof ngDevMode === 'undefined' || ngDevMode ? `Cannot match any routes. URL Segment: '${e.segmentGroup}'` : `'${e.segmentGroup}'`);\n }\n recognize() {\n const rootSegmentGroup = split(this.urlTree.root, [], [], this.config).segmentGroup;\n return this.match(rootSegmentGroup).pipe(map(({\n children,\n rootSnapshot\n }) => {\n const rootNode = new TreeNode(rootSnapshot, children);\n const routeState = new RouterStateSnapshot('', rootNode);\n const tree = createUrlTreeFromSnapshot(rootSnapshot, [], this.urlTree.queryParams, this.urlTree.fragment);\n // https://github.com/angular/angular/issues/47307\n // Creating the tree stringifies the query params\n // We don't want to do this here so reassign them to the original.\n tree.queryParams = this.urlTree.queryParams;\n routeState.url = this.urlSerializer.serialize(tree);\n return {\n state: routeState,\n tree\n };\n }));\n }\n match(rootSegmentGroup) {\n // Use Object.freeze to prevent readers of the Router state from modifying it outside\n // of a navigation, resulting in the router being out of sync with the browser.\n const rootSnapshot = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, Object.freeze({}), PRIMARY_OUTLET, this.rootComponentType, null, {});\n return this.processSegmentGroup(this.injector, this.config, rootSegmentGroup, PRIMARY_OUTLET, rootSnapshot).pipe(map(children => {\n return {\n children,\n rootSnapshot\n };\n }), catchError(e => {\n if (e instanceof AbsoluteRedirect) {\n this.urlTree = e.urlTree;\n return this.match(e.urlTree.root);\n }\n if (e instanceof NoMatch) {\n throw this.noMatchError(e);\n }\n throw e;\n }));\n }\n processSegmentGroup(injector, config, segmentGroup, outlet, parentRoute) {\n if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {\n return this.processChildren(injector, config, segmentGroup, parentRoute);\n }\n return this.processSegment(injector, config, segmentGroup, segmentGroup.segments, outlet, true, parentRoute).pipe(map(child => child instanceof TreeNode ? [child] : []));\n }\n /**\n * Matches every child outlet in the `segmentGroup` to a `Route` in the config. Returns `null` if\n * we cannot find a match for _any_ of the children.\n *\n * @param config - The `Routes` to match against\n * @param segmentGroup - The `UrlSegmentGroup` whose children need to be matched against the\n * config.\n */\n processChildren(injector, config, segmentGroup, parentRoute) {\n // Expand outlets one at a time, starting with the primary outlet. We need to do it this way\n // because an absolute redirect from the primary outlet takes precedence.\n const childOutlets = [];\n for (const child of Object.keys(segmentGroup.children)) {\n if (child === 'primary') {\n childOutlets.unshift(child);\n } else {\n childOutlets.push(child);\n }\n }\n return from(childOutlets).pipe(concatMap(childOutlet => {\n const child = segmentGroup.children[childOutlet];\n // Sort the config so that routes with outlets that match the one being activated\n // appear first, followed by routes for other outlets, which might match if they have\n // an empty path.\n const sortedConfig = sortByMatchingOutlets(config, childOutlet);\n return this.processSegmentGroup(injector, sortedConfig, child, childOutlet, parentRoute);\n }), scan((children, outletChildren) => {\n children.push(...outletChildren);\n return children;\n }), defaultIfEmpty(null), last$1(), mergeMap(children => {\n if (children === null) return noMatch$1(segmentGroup);\n // Because we may have matched two outlets to the same empty path segment, we can have\n // multiple activated results for the same outlet. We should merge the children of\n // these results so the final return value is only one `TreeNode` per outlet.\n const mergedChildren = mergeEmptyPathMatches(children);\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n // This should really never happen - we are only taking the first match for each\n // outlet and merge the empty path matches.\n checkOutletNameUniqueness(mergedChildren);\n }\n sortActivatedRouteSnapshots(mergedChildren);\n return of(mergedChildren);\n }));\n }\n processSegment(injector, routes, segmentGroup, segments, outlet, allowRedirects, parentRoute) {\n return from(routes).pipe(concatMap(r => {\n return this.processSegmentAgainstRoute(r._injector ?? injector, routes, r, segmentGroup, segments, outlet, allowRedirects, parentRoute).pipe(catchError(e => {\n if (e instanceof NoMatch) {\n return of(null);\n }\n throw e;\n }));\n }), first(x => !!x), catchError(e => {\n if (isEmptyError(e)) {\n if (noLeftoversInUrl(segmentGroup, segments, outlet)) {\n return of(new NoLeftoversInUrl());\n }\n return noMatch$1(segmentGroup);\n }\n throw e;\n }));\n }\n processSegmentAgainstRoute(injector, routes, route, rawSegment, segments, outlet, allowRedirects, parentRoute) {\n // We allow matches to empty paths when the outlets differ so we can match a url like `/(b:b)` to\n // a config like\n // * `{path: '', children: [{path: 'b', outlet: 'b'}]}`\n // or even\n // * `{path: '', outlet: 'a', children: [{path: 'b', outlet: 'b'}]`\n //\n // The exception here is when the segment outlet is for the primary outlet. This would\n // result in a match inside the named outlet because all children there are written as primary\n // outlets. So we need to prevent child named outlet matches in a url like `/b` in a config like\n // * `{path: '', outlet: 'x' children: [{path: 'b'}]}`\n // This should only match if the url is `/(x:b)`.\n if (getOutlet(route) !== outlet && (outlet === PRIMARY_OUTLET || !emptyPathMatch(rawSegment, segments, route))) {\n return noMatch$1(rawSegment);\n }\n if (route.redirectTo === undefined) {\n return this.matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute);\n }\n if (this.allowRedirects && allowRedirects) {\n return this.expandSegmentAgainstRouteUsingRedirect(injector, rawSegment, routes, route, segments, outlet, parentRoute);\n }\n return noMatch$1(rawSegment);\n }\n expandSegmentAgainstRouteUsingRedirect(injector, segmentGroup, routes, route, segments, outlet, parentRoute) {\n const {\n matched,\n parameters,\n consumedSegments,\n positionalParamSegments,\n remainingSegments\n } = match(segmentGroup, route, segments);\n if (!matched) return noMatch$1(segmentGroup);\n // TODO(atscott): Move all of this under an if(ngDevMode) as a breaking change and allow stack\n // size exceeded in production\n if (typeof route.redirectTo === 'string' && route.redirectTo[0] === '/') {\n this.absoluteRedirectCount++;\n if (this.absoluteRedirectCount > MAX_ALLOWED_REDIRECTS) {\n if (ngDevMode) {\n throw new ɵRuntimeError(4016 /* RuntimeErrorCode.INFINITE_REDIRECT */, `Detected possible infinite redirect when redirecting from '${this.urlTree}' to '${route.redirectTo}'.\\n` + `This is currently a dev mode only error but will become a` + ` call stack size exceeded error in production in a future major version.`);\n }\n this.allowRedirects = false;\n }\n }\n const currentSnapshot = new ActivatedRouteSnapshot(segments, parameters, Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));\n const inherited = getInherited(currentSnapshot, parentRoute, this.paramsInheritanceStrategy);\n currentSnapshot.params = Object.freeze(inherited.params);\n currentSnapshot.data = Object.freeze(inherited.data);\n const newTree = this.applyRedirects.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments, currentSnapshot, injector);\n return this.applyRedirects.lineralizeSegments(route, newTree).pipe(mergeMap(newSegments => {\n return this.processSegment(injector, routes, segmentGroup, newSegments.concat(remainingSegments), outlet, false, parentRoute);\n }));\n }\n matchSegmentAgainstRoute(injector, rawSegment, route, segments, outlet, parentRoute) {\n const matchResult = matchWithChecks(rawSegment, route, segments, injector, this.urlSerializer);\n if (route.path === '**') {\n // Prior versions of the route matching algorithm would stop matching at the wildcard route.\n // We should investigate a better strategy for any existing children. Otherwise, these\n // child segments are silently dropped from the navigation.\n // https://github.com/angular/angular/issues/40089\n rawSegment.children = {};\n }\n return matchResult.pipe(switchMap(result => {\n if (!result.matched) {\n return noMatch$1(rawSegment);\n }\n // If the route has an injector created from providers, we should start using that.\n injector = route._injector ?? injector;\n return this.getChildConfig(injector, route, segments).pipe(switchMap(({\n routes: childConfig\n }) => {\n const childInjector = route._loadedInjector ?? injector;\n const {\n parameters,\n consumedSegments,\n remainingSegments\n } = result;\n const snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze({\n ...this.urlTree.queryParams\n }), this.urlTree.fragment, getData(route), getOutlet(route), route.component ?? route._loadedComponent ?? null, route, getResolve(route));\n const inherited = getInherited(snapshot, parentRoute, this.paramsInheritanceStrategy);\n snapshot.params = Object.freeze(inherited.params);\n snapshot.data = Object.freeze(inherited.data);\n const {\n segmentGroup,\n slicedSegments\n } = split(rawSegment, consumedSegments, remainingSegments, childConfig);\n if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {\n return this.processChildren(childInjector, childConfig, segmentGroup, snapshot).pipe(map(children => {\n return new TreeNode(snapshot, children);\n }));\n }\n if (childConfig.length === 0 && slicedSegments.length === 0) {\n return of(new TreeNode(snapshot, []));\n }\n const matchedOnOutlet = getOutlet(route) === outlet;\n // If we matched a config due to empty path match on a different outlet, we need to\n // continue passing the current outlet for the segment rather than switch to PRIMARY.\n // Note that we switch to primary when we have a match because outlet configs look like\n // this: {path: 'a', outlet: 'a', children: [\n // {path: 'b', component: B},\n // {path: 'c', component: C},\n // ]}\n // Notice that the children of the named outlet are configured with the primary outlet\n return this.processSegment(childInjector, childConfig, segmentGroup, slicedSegments, matchedOnOutlet ? PRIMARY_OUTLET : outlet, true, snapshot).pipe(map(child => {\n return new TreeNode(snapshot, child instanceof TreeNode ? [child] : []);\n }));\n }));\n }));\n }\n getChildConfig(injector, route, segments) {\n if (route.children) {\n // The children belong to the same module\n return of({\n routes: route.children,\n injector\n });\n }\n if (route.loadChildren) {\n // lazy children belong to the loaded module\n if (route._loadedRoutes !== undefined) {\n return of({\n routes: route._loadedRoutes,\n injector: route._loadedInjector\n });\n }\n return runCanLoadGuards(injector, route, segments, this.urlSerializer).pipe(mergeMap(shouldLoadResult => {\n if (shouldLoadResult) {\n return this.configLoader.loadChildren(injector, route).pipe(tap(cfg => {\n route._loadedRoutes = cfg.routes;\n route._loadedInjector = cfg.injector;\n }));\n }\n return canLoadFails(route);\n }));\n }\n return of({\n routes: [],\n injector\n });\n }\n}\nfunction sortActivatedRouteSnapshots(nodes) {\n nodes.sort((a, b) => {\n if (a.value.outlet === PRIMARY_OUTLET) return -1;\n if (b.value.outlet === PRIMARY_OUTLET) return 1;\n return a.value.outlet.localeCompare(b.value.outlet);\n });\n}\nfunction hasEmptyPathConfig(node) {\n const config = node.value.routeConfig;\n return config && config.path === '';\n}\n/**\n * Finds `TreeNode`s with matching empty path route configs and merges them into `TreeNode` with\n * the children from each duplicate. This is necessary because different outlets can match a\n * single empty path route config and the results need to then be merged.\n */\nfunction mergeEmptyPathMatches(nodes) {\n const result = [];\n // The set of nodes which contain children that were merged from two duplicate empty path nodes.\n const mergedNodes = new Set();\n for (const node of nodes) {\n if (!hasEmptyPathConfig(node)) {\n result.push(node);\n continue;\n }\n const duplicateEmptyPathNode = result.find(resultNode => node.value.routeConfig === resultNode.value.routeConfig);\n if (duplicateEmptyPathNode !== undefined) {\n duplicateEmptyPathNode.children.push(...node.children);\n mergedNodes.add(duplicateEmptyPathNode);\n } else {\n result.push(node);\n }\n }\n // For each node which has children from multiple sources, we need to recompute a new `TreeNode`\n // by also merging those children. This is necessary when there are multiple empty path configs\n // in a row. Put another way: whenever we combine children of two nodes, we need to also check\n // if any of those children can be combined into a single node as well.\n for (const mergedNode of mergedNodes) {\n const mergedChildren = mergeEmptyPathMatches(mergedNode.children);\n result.push(new TreeNode(mergedNode.value, mergedChildren));\n }\n return result.filter(n => !mergedNodes.has(n));\n}\nfunction checkOutletNameUniqueness(nodes) {\n const names = {};\n nodes.forEach(n => {\n const routeWithSameOutletName = names[n.value.outlet];\n if (routeWithSameOutletName) {\n const p = routeWithSameOutletName.url.map(s => s.toString()).join('/');\n const c = n.value.url.map(s => s.toString()).join('/');\n throw new ɵRuntimeError(4006 /* RuntimeErrorCode.TWO_SEGMENTS_WITH_SAME_OUTLET */, (typeof ngDevMode === 'undefined' || ngDevMode) && `Two segments cannot have the same outlet name: '${p}' and '${c}'.`);\n }\n names[n.value.outlet] = n.value;\n });\n}\nfunction getData(route) {\n return route.data || {};\n}\nfunction getResolve(route) {\n return route.resolve || {};\n}\nfunction recognize(injector, configLoader, rootComponentType, config, serializer, paramsInheritanceStrategy) {\n return mergeMap(t => recognize$1(injector, configLoader, rootComponentType, config, t.extractedUrl, serializer, paramsInheritanceStrategy).pipe(map(({\n state: targetSnapshot,\n tree: urlAfterRedirects\n }) => {\n return {\n ...t,\n targetSnapshot,\n urlAfterRedirects\n };\n })));\n}\nfunction resolveData(paramsInheritanceStrategy, injector) {\n return mergeMap(t => {\n const {\n targetSnapshot,\n guards: {\n canActivateChecks\n }\n } = t;\n if (!canActivateChecks.length) {\n return of(t);\n }\n // Iterating a Set in javascript happens in insertion order so it is safe to use a `Set` to\n // preserve the correct order that the resolvers should run in.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set#description\n const routesWithResolversToRun = new Set(canActivateChecks.map(check => check.route));\n const routesNeedingDataUpdates = new Set();\n for (const route of routesWithResolversToRun) {\n if (routesNeedingDataUpdates.has(route)) {\n continue;\n }\n // All children under the route with a resolver to run need to recompute inherited data.\n for (const newRoute of flattenRouteTree(route)) {\n routesNeedingDataUpdates.add(newRoute);\n }\n }\n let routesProcessed = 0;\n return from(routesNeedingDataUpdates).pipe(concatMap(route => {\n if (routesWithResolversToRun.has(route)) {\n return runResolve(route, targetSnapshot, paramsInheritanceStrategy, injector);\n } else {\n route.data = getInherited(route, route.parent, paramsInheritanceStrategy).resolve;\n return of(void 0);\n }\n }), tap(() => routesProcessed++), takeLast(1), mergeMap(_ => routesProcessed === routesNeedingDataUpdates.size ? of(t) : EMPTY));\n });\n}\n/**\n * Returns the `ActivatedRouteSnapshot` tree as an array, using DFS to traverse the route tree.\n */\nfunction flattenRouteTree(route) {\n const descendants = route.children.map(child => flattenRouteTree(child)).flat();\n return [route, ...descendants];\n}\nfunction runResolve(futureARS, futureRSS, paramsInheritanceStrategy, injector) {\n const config = futureARS.routeConfig;\n const resolve = futureARS._resolve;\n if (config?.title !== undefined && !hasStaticTitle(config)) {\n resolve[RouteTitleKey] = config.title;\n }\n return resolveNode(resolve, futureARS, futureRSS, injector).pipe(map(resolvedData => {\n futureARS._resolvedData = resolvedData;\n futureARS.data = getInherited(futureARS, futureARS.parent, paramsInheritanceStrategy).resolve;\n return null;\n }));\n}\nfunction resolveNode(resolve, futureARS, futureRSS, injector) {\n const keys = getDataKeys(resolve);\n if (keys.length === 0) {\n return of({});\n }\n const data = {};\n return from(keys).pipe(mergeMap(key => getResolver(resolve[key], futureARS, futureRSS, injector).pipe(first(), tap(value => {\n if (value instanceof RedirectCommand) {\n throw redirectingNavigationError(new DefaultUrlSerializer(), value);\n }\n data[key] = value;\n }))), takeLast(1), mapTo(data), catchError(e => isEmptyError(e) ? EMPTY : throwError(e)));\n}\nfunction getResolver(injectionToken, futureARS, futureRSS, injector) {\n const closestInjector = getClosestRouteInjector(futureARS) ?? injector;\n const resolver = getTokenOrFunctionIdentity(injectionToken, closestInjector);\n const resolverValue = resolver.resolve ? resolver.resolve(futureARS, futureRSS) : runInInjectionContext(closestInjector, () => resolver(futureARS, futureRSS));\n return wrapIntoObservable(resolverValue);\n}\n\n/**\n * Perform a side effect through a switchMap for every emission on the source Observable,\n * but return an Observable that is identical to the source. It's essentially the same as\n * the `tap` operator, but if the side effectful `next` function returns an ObservableInput,\n * it will wait before continuing with the original value.\n */\nfunction switchTap(next) {\n return switchMap(v => {\n const nextResult = next(v);\n if (nextResult) {\n return from(nextResult).pipe(map(() => v));\n }\n return of(v);\n });\n}\n\n/**\n * Provides a strategy for setting the page title after a router navigation.\n *\n * The built-in implementation traverses the router state snapshot and finds the deepest primary\n * outlet with `title` property. Given the `Routes` below, navigating to\n * `/base/child(popup:aux)` would result in the document title being set to \"child\".\n * ```ts\n * [\n * {path: 'base', title: 'base', children: [\n * {path: 'child', title: 'child'},\n * ],\n * {path: 'aux', outlet: 'popup', title: 'popupTitle'}\n * ]\n * ```\n *\n * This class can be used as a base class for custom title strategies. That is, you can create your\n * own class that extends the `TitleStrategy`. Note that in the above example, the `title`\n * from the named outlet is never used. However, a custom strategy might be implemented to\n * incorporate titles in named outlets.\n *\n * @publicApi\n * @see [Page title guide](guide/routing/common-router-tasks#setting-the-page-title)\n */\nlet TitleStrategy = /*#__PURE__*/(() => {\n class TitleStrategy {\n /**\n * @returns The `title` of the deepest primary route.\n */\n buildTitle(snapshot) {\n let pageTitle;\n let route = snapshot.root;\n while (route !== undefined) {\n pageTitle = this.getResolvedTitleForRoute(route) ?? pageTitle;\n route = route.children.find(child => child.outlet === PRIMARY_OUTLET);\n }\n return pageTitle;\n }\n /**\n * Given an `ActivatedRouteSnapshot`, returns the final value of the\n * `Route.title` property, which can either be a static string or a resolved value.\n */\n getResolvedTitleForRoute(snapshot) {\n return snapshot.data[RouteTitleKey];\n }\n static ɵfac = function TitleStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TitleStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TitleStrategy,\n factory: () => (() => inject(DefaultTitleStrategy))(),\n providedIn: 'root'\n });\n }\n return TitleStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * The default `TitleStrategy` used by the router that updates the title using the `Title` service.\n */\nlet DefaultTitleStrategy = /*#__PURE__*/(() => {\n class DefaultTitleStrategy extends TitleStrategy {\n title;\n constructor(title) {\n super();\n this.title = title;\n }\n /**\n * Sets the title of the browser to the given value.\n *\n * @param title The `pageTitle` from the deepest primary route.\n */\n updateTitle(snapshot) {\n const title = this.buildTitle(snapshot);\n if (title !== undefined) {\n this.title.setTitle(title);\n }\n }\n static ɵfac = function DefaultTitleStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultTitleStrategy)(i0.ɵɵinject(i1.Title));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultTitleStrategy,\n factory: DefaultTitleStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n return DefaultTitleStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * A DI token for the router service.\n *\n * @publicApi\n */\nconst ROUTER_CONFIGURATION = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router config' : '', {\n providedIn: 'root',\n factory: () => ({})\n});\n\n/**\n * This component is used internally within the router to be a placeholder when an empty\n * router-outlet is needed. For example, with a config such as:\n *\n * `{path: 'parent', outlet: 'nav', children: [...]}`\n *\n * In order to render, there needs to be a component on this config, which will default\n * to this `EmptyOutletComponent`.\n */\nlet ɵEmptyOutletComponent = /*#__PURE__*/(() => {\n class ɵEmptyOutletComponent {\n static ɵfac = function ɵEmptyOutletComponent_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ɵEmptyOutletComponent)();\n };\n static ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: ɵEmptyOutletComponent,\n selectors: [[\"ng-component\"]],\n decls: 1,\n vars: 0,\n template: function _EmptyOutletComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"router-outlet\");\n }\n },\n dependencies: [RouterOutlet],\n encapsulation: 2\n });\n }\n return ɵEmptyOutletComponent;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Makes a copy of the config and adds any default required properties.\n */\nfunction standardizeConfig(r) {\n const children = r.children && r.children.map(standardizeConfig);\n const c = children ? {\n ...r,\n children\n } : {\n ...r\n };\n if (!c.component && !c.loadComponent && (children || c.loadChildren) && c.outlet && c.outlet !== PRIMARY_OUTLET) {\n c.component = ɵEmptyOutletComponent;\n }\n return c;\n}\n\n/**\n * The DI token for a router configuration.\n *\n * `ROUTES` is a low level API for router configuration via dependency injection.\n *\n * We recommend that in almost all cases to use higher level APIs such as `RouterModule.forRoot()`,\n * `provideRouter`, or `Router.resetConfig()`.\n *\n * @publicApi\n */\nconst ROUTES = /*#__PURE__*/new InjectionToken(ngDevMode ? 'ROUTES' : '');\nlet RouterConfigLoader = /*#__PURE__*/(() => {\n class RouterConfigLoader {\n componentLoaders = new WeakMap();\n childrenLoaders = new WeakMap();\n onLoadStartListener;\n onLoadEndListener;\n compiler = inject(Compiler);\n loadComponent(route) {\n if (this.componentLoaders.get(route)) {\n return this.componentLoaders.get(route);\n } else if (route._loadedComponent) {\n return of(route._loadedComponent);\n }\n if (this.onLoadStartListener) {\n this.onLoadStartListener(route);\n }\n const loadRunner = wrapIntoObservable(route.loadComponent()).pipe(map(maybeUnwrapDefaultExport), tap(component => {\n if (this.onLoadEndListener) {\n this.onLoadEndListener(route);\n }\n (typeof ngDevMode === 'undefined' || ngDevMode) && assertStandalone(route.path ?? '', component);\n route._loadedComponent = component;\n }), finalize(() => {\n this.componentLoaders.delete(route);\n }));\n // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much\n const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());\n this.componentLoaders.set(route, loader);\n return loader;\n }\n loadChildren(parentInjector, route) {\n if (this.childrenLoaders.get(route)) {\n return this.childrenLoaders.get(route);\n } else if (route._loadedRoutes) {\n return of({\n routes: route._loadedRoutes,\n injector: route._loadedInjector\n });\n }\n if (this.onLoadStartListener) {\n this.onLoadStartListener(route);\n }\n const moduleFactoryOrRoutes$ = loadChildren(route, this.compiler, parentInjector, this.onLoadEndListener);\n const loadRunner = moduleFactoryOrRoutes$.pipe(finalize(() => {\n this.childrenLoaders.delete(route);\n }));\n // Use custom ConnectableObservable as share in runners pipe increasing the bundle size too much\n const loader = new ConnectableObservable(loadRunner, () => new Subject()).pipe(refCount());\n this.childrenLoaders.set(route, loader);\n return loader;\n }\n static ɵfac = function RouterConfigLoader_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterConfigLoader)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterConfigLoader,\n factory: RouterConfigLoader.ɵfac,\n providedIn: 'root'\n });\n }\n return RouterConfigLoader;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Executes a `route.loadChildren` callback and converts the result to an array of child routes and\n * an injector if that callback returned a module.\n *\n * This function is used for the route discovery during prerendering\n * in @angular-devkit/build-angular. If there are any updates to the contract here, it will require\n * an update to the extractor.\n */\nfunction loadChildren(route, compiler, parentInjector, onLoadEndListener) {\n return wrapIntoObservable(route.loadChildren()).pipe(map(maybeUnwrapDefaultExport), mergeMap(t => {\n if (t instanceof NgModuleFactory || Array.isArray(t)) {\n return of(t);\n } else {\n return from(compiler.compileModuleAsync(t));\n }\n }), map(factoryOrRoutes => {\n if (onLoadEndListener) {\n onLoadEndListener(route);\n }\n // This injector comes from the `NgModuleRef` when lazy loading an `NgModule`. There is\n // no injector associated with lazy loading a `Route` array.\n let injector;\n let rawRoutes;\n let requireStandaloneComponents = false;\n if (Array.isArray(factoryOrRoutes)) {\n rawRoutes = factoryOrRoutes;\n requireStandaloneComponents = true;\n } else {\n injector = factoryOrRoutes.create(parentInjector).injector;\n // When loading a module that doesn't provide `RouterModule.forChild()` preloader\n // will get stuck in an infinite loop. The child module's Injector will look to\n // its parent `Injector` when it doesn't find any ROUTES so it will return routes\n // for it's parent module instead.\n rawRoutes = injector.get(ROUTES, [], {\n optional: true,\n self: true\n }).flat();\n }\n const routes = rawRoutes.map(standardizeConfig);\n (typeof ngDevMode === 'undefined' || ngDevMode) && validateConfig(routes, route.path, requireStandaloneComponents);\n return {\n routes,\n injector\n };\n }));\n}\nfunction isWrappedDefaultExport(value) {\n // We use `in` here with a string key `'default'`, because we expect `DefaultExport` objects to be\n // dynamically imported ES modules with a spec-mandated `default` key. Thus we don't expect that\n // `default` will be a renamed property.\n return value && typeof value === 'object' && 'default' in value;\n}\nfunction maybeUnwrapDefaultExport(input) {\n // As per `isWrappedDefaultExport`, the `default` key here is generated by the browser and not\n // subject to property renaming, so we reference it with bracket access.\n return isWrappedDefaultExport(input) ? input['default'] : input;\n}\n\n/**\n * @description\n *\n * Provides a way to migrate AngularJS applications to Angular.\n *\n * @publicApi\n */\nlet UrlHandlingStrategy = /*#__PURE__*/(() => {\n class UrlHandlingStrategy {\n static ɵfac = function UrlHandlingStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || UrlHandlingStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: UrlHandlingStrategy,\n factory: () => (() => inject(DefaultUrlHandlingStrategy))(),\n providedIn: 'root'\n });\n }\n return UrlHandlingStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @publicApi\n */\nlet DefaultUrlHandlingStrategy = /*#__PURE__*/(() => {\n class DefaultUrlHandlingStrategy {\n shouldProcessUrl(url) {\n return true;\n }\n extract(url) {\n return url;\n }\n merge(newUrlPart, wholeUrl) {\n return newUrlPart;\n }\n static ɵfac = function DefaultUrlHandlingStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || DefaultUrlHandlingStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultUrlHandlingStrategy,\n factory: DefaultUrlHandlingStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n return DefaultUrlHandlingStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/// \nconst CREATE_VIEW_TRANSITION = /*#__PURE__*/new InjectionToken(ngDevMode ? 'view transition helper' : '');\nconst VIEW_TRANSITION_OPTIONS = /*#__PURE__*/new InjectionToken(ngDevMode ? 'view transition options' : '');\n/**\n * A helper function for using browser view transitions. This function skips the call to\n * `startViewTransition` if the browser does not support it.\n *\n * @returns A Promise that resolves when the view transition callback begins.\n */\nfunction createViewTransition(injector, from, to) {\n const transitionOptions = injector.get(VIEW_TRANSITION_OPTIONS);\n const document = injector.get(DOCUMENT);\n // Create promises outside the Angular zone to avoid causing extra change detections\n return injector.get(NgZone).runOutsideAngular(() => {\n if (!document.startViewTransition || transitionOptions.skipNextTransition) {\n transitionOptions.skipNextTransition = false;\n // The timing of `startViewTransition` is closer to a macrotask. It won't be called\n // until the current event loop exits so we use a promise resolved in a timeout instead\n // of Promise.resolve().\n return new Promise(resolve => setTimeout(resolve));\n }\n let resolveViewTransitionStarted;\n const viewTransitionStarted = new Promise(resolve => {\n resolveViewTransitionStarted = resolve;\n });\n const transition = document.startViewTransition(() => {\n resolveViewTransitionStarted();\n // We don't actually update dom within the transition callback. The resolving of the above\n // promise unblocks the Router navigation, which synchronously activates and deactivates\n // routes (the DOM update). This view transition waits for the next change detection to\n // complete (below), which includes the update phase of the routed components.\n return createRenderPromise(injector);\n });\n const {\n onViewTransitionCreated\n } = transitionOptions;\n if (onViewTransitionCreated) {\n runInInjectionContext(injector, () => onViewTransitionCreated({\n transition,\n from,\n to\n }));\n }\n return viewTransitionStarted;\n });\n}\n/**\n * Creates a promise that resolves after next render.\n */\nfunction createRenderPromise(injector) {\n return new Promise(resolve => {\n // Wait for the microtask queue to empty after the next render happens (by waiting a macrotask).\n // This ensures any follow-up renders in the microtask queue are completed before the\n // view transition starts animating.\n afterNextRender({\n read: () => setTimeout(resolve)\n }, {\n injector\n });\n });\n}\nconst NAVIGATION_ERROR_HANDLER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'navigation error handler' : '');\nlet NavigationTransitions = /*#__PURE__*/(() => {\n class NavigationTransitions {\n currentNavigation = null;\n currentTransition = null;\n lastSuccessfulNavigation = null;\n /**\n * These events are used to communicate back to the Router about the state of the transition. The\n * Router wants to respond to these events in various ways. Because the `NavigationTransition`\n * class is not public, this event subject is not publicly exposed.\n */\n events = new Subject();\n /**\n * Used to abort the current transition with an error.\n */\n transitionAbortSubject = new Subject();\n configLoader = inject(RouterConfigLoader);\n environmentInjector = inject(EnvironmentInjector);\n urlSerializer = inject(UrlSerializer);\n rootContexts = inject(ChildrenOutletContexts);\n location = inject(Location);\n inputBindingEnabled = inject(INPUT_BINDER, {\n optional: true\n }) !== null;\n titleStrategy = inject(TitleStrategy);\n options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n paramsInheritanceStrategy = this.options.paramsInheritanceStrategy || 'emptyOnly';\n urlHandlingStrategy = inject(UrlHandlingStrategy);\n createViewTransition = inject(CREATE_VIEW_TRANSITION, {\n optional: true\n });\n navigationErrorHandler = inject(NAVIGATION_ERROR_HANDLER, {\n optional: true\n });\n navigationId = 0;\n get hasRequestedNavigation() {\n return this.navigationId !== 0;\n }\n transitions;\n /**\n * Hook that enables you to pause navigation after the preactivation phase.\n * Used by `RouterModule`.\n *\n * @internal\n */\n afterPreactivation = () => of(void 0);\n /** @internal */\n rootComponentType = null;\n constructor() {\n const onLoadStart = r => this.events.next(new RouteConfigLoadStart(r));\n const onLoadEnd = r => this.events.next(new RouteConfigLoadEnd(r));\n this.configLoader.onLoadEndListener = onLoadEnd;\n this.configLoader.onLoadStartListener = onLoadStart;\n }\n complete() {\n this.transitions?.complete();\n }\n handleNavigationRequest(request) {\n const id = ++this.navigationId;\n this.transitions?.next({\n ...this.transitions.value,\n ...request,\n id\n });\n }\n setupNavigations(router, initialUrlTree, initialRouterState) {\n this.transitions = new BehaviorSubject({\n id: 0,\n currentUrlTree: initialUrlTree,\n currentRawUrl: initialUrlTree,\n extractedUrl: this.urlHandlingStrategy.extract(initialUrlTree),\n urlAfterRedirects: this.urlHandlingStrategy.extract(initialUrlTree),\n rawUrl: initialUrlTree,\n extras: {},\n resolve: () => {},\n reject: () => {},\n promise: Promise.resolve(true),\n source: IMPERATIVE_NAVIGATION,\n restoredState: null,\n currentSnapshot: initialRouterState.snapshot,\n targetSnapshot: null,\n currentRouterState: initialRouterState,\n targetRouterState: null,\n guards: {\n canActivateChecks: [],\n canDeactivateChecks: []\n },\n guardsResult: null\n });\n return this.transitions.pipe(filter(t => t.id !== 0),\n // Extract URL\n map(t => ({\n ...t,\n extractedUrl: this.urlHandlingStrategy.extract(t.rawUrl)\n })),\n // Using switchMap so we cancel executing navigations when a new one comes in\n switchMap(overallTransitionState => {\n let completed = false;\n let errored = false;\n return of(overallTransitionState).pipe(switchMap(t => {\n // It is possible that `switchMap` fails to cancel previous navigations if a new one happens synchronously while the operator\n // is processing the `next` notification of that previous navigation. This can happen when a new navigation (say 2) cancels a\n // previous one (1) and yet another navigation (3) happens synchronously in response to the `NavigationCancel` event for (1).\n // https://github.com/ReactiveX/rxjs/issues/7455\n if (this.navigationId > overallTransitionState.id) {\n const cancellationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';\n this.cancelNavigationTransition(overallTransitionState, cancellationReason, NavigationCancellationCode.SupersededByNewNavigation);\n return EMPTY;\n }\n this.currentTransition = overallTransitionState;\n // Store the Navigation object\n this.currentNavigation = {\n id: t.id,\n initialUrl: t.rawUrl,\n extractedUrl: t.extractedUrl,\n targetBrowserUrl: typeof t.extras.browserUrl === 'string' ? this.urlSerializer.parse(t.extras.browserUrl) : t.extras.browserUrl,\n trigger: t.source,\n extras: t.extras,\n previousNavigation: !this.lastSuccessfulNavigation ? null : {\n ...this.lastSuccessfulNavigation,\n previousNavigation: null\n }\n };\n const urlTransition = !router.navigated || this.isUpdatingInternalState() || this.isUpdatedBrowserUrl();\n const onSameUrlNavigation = t.extras.onSameUrlNavigation ?? router.onSameUrlNavigation;\n if (!urlTransition && onSameUrlNavigation !== 'reload') {\n const reason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation to ${t.rawUrl} was ignored because it is the same as the current Router URL.` : '';\n this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.rawUrl), reason, NavigationSkippedCode.IgnoredSameUrlNavigation));\n t.resolve(false);\n return EMPTY;\n }\n if (this.urlHandlingStrategy.shouldProcessUrl(t.rawUrl)) {\n return of(t).pipe(\n // Fire NavigationStart event\n switchMap(t => {\n const transition = this.transitions?.getValue();\n this.events.next(new NavigationStart(t.id, this.urlSerializer.serialize(t.extractedUrl), t.source, t.restoredState));\n if (transition !== this.transitions?.getValue()) {\n return EMPTY;\n }\n // This delay is required to match old behavior that forced\n // navigation to always be async\n return Promise.resolve(t);\n }),\n // Recognize\n recognize(this.environmentInjector, this.configLoader, this.rootComponentType, router.config, this.urlSerializer, this.paramsInheritanceStrategy),\n // Update URL if in `eager` update mode\n tap(t => {\n overallTransitionState.targetSnapshot = t.targetSnapshot;\n overallTransitionState.urlAfterRedirects = t.urlAfterRedirects;\n this.currentNavigation = {\n ...this.currentNavigation,\n finalUrl: t.urlAfterRedirects\n };\n // Fire RoutesRecognized\n const routesRecognized = new RoutesRecognized(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(routesRecognized);\n }));\n } else if (urlTransition && this.urlHandlingStrategy.shouldProcessUrl(t.currentRawUrl)) {\n /* When the current URL shouldn't be processed, but the previous one\n * was, we handle this \"error condition\" by navigating to the\n * previously successful URL, but leaving the URL intact.*/\n const {\n id,\n extractedUrl,\n source,\n restoredState,\n extras\n } = t;\n const navStart = new NavigationStart(id, this.urlSerializer.serialize(extractedUrl), source, restoredState);\n this.events.next(navStart);\n const targetSnapshot = createEmptyState(this.rootComponentType).snapshot;\n this.currentTransition = overallTransitionState = {\n ...t,\n targetSnapshot,\n urlAfterRedirects: extractedUrl,\n extras: {\n ...extras,\n skipLocationChange: false,\n replaceUrl: false\n }\n };\n this.currentNavigation.finalUrl = extractedUrl;\n return of(overallTransitionState);\n } else {\n /* When neither the current or previous URL can be processed, do\n * nothing other than update router's internal reference to the\n * current \"settled\" URL. This way the next navigation will be coming\n * from the current URL in the browser.\n */\n const reason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation was ignored because the UrlHandlingStrategy` + ` indicated neither the current URL ${t.currentRawUrl} nor target URL ${t.rawUrl} should be processed.` : '';\n this.events.next(new NavigationSkipped(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, NavigationSkippedCode.IgnoredByUrlHandlingStrategy));\n t.resolve(false);\n return EMPTY;\n }\n }),\n // --- GUARDS ---\n tap(t => {\n const guardsStart = new GuardsCheckStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(guardsStart);\n }), map(t => {\n this.currentTransition = overallTransitionState = {\n ...t,\n guards: getAllRouteGuards(t.targetSnapshot, t.currentSnapshot, this.rootContexts)\n };\n return overallTransitionState;\n }), checkGuards(this.environmentInjector, evt => this.events.next(evt)), tap(t => {\n overallTransitionState.guardsResult = t.guardsResult;\n if (t.guardsResult && typeof t.guardsResult !== 'boolean') {\n throw redirectingNavigationError(this.urlSerializer, t.guardsResult);\n }\n const guardsEnd = new GuardsCheckEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot, !!t.guardsResult);\n this.events.next(guardsEnd);\n }), filter(t => {\n if (!t.guardsResult) {\n this.cancelNavigationTransition(t, '', NavigationCancellationCode.GuardRejected);\n return false;\n }\n return true;\n }),\n // --- RESOLVE ---\n switchTap(t => {\n if (t.guards.canActivateChecks.length) {\n return of(t).pipe(tap(t => {\n const resolveStart = new ResolveStart(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(resolveStart);\n }), switchMap(t => {\n let dataResolved = false;\n return of(t).pipe(resolveData(this.paramsInheritanceStrategy, this.environmentInjector), tap({\n next: () => dataResolved = true,\n complete: () => {\n if (!dataResolved) {\n this.cancelNavigationTransition(t, typeof ngDevMode === 'undefined' || ngDevMode ? `At least one route resolver didn't emit any value.` : '', NavigationCancellationCode.NoDataFromResolver);\n }\n }\n }));\n }), tap(t => {\n const resolveEnd = new ResolveEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects), t.targetSnapshot);\n this.events.next(resolveEnd);\n }));\n }\n return undefined;\n }),\n // --- LOAD COMPONENTS ---\n switchTap(t => {\n const loadComponents = route => {\n const loaders = [];\n if (route.routeConfig?.loadComponent && !route.routeConfig._loadedComponent) {\n loaders.push(this.configLoader.loadComponent(route.routeConfig).pipe(tap(loadedComponent => {\n route.component = loadedComponent;\n }), map(() => void 0)));\n }\n for (const child of route.children) {\n loaders.push(...loadComponents(child));\n }\n return loaders;\n };\n return combineLatest(loadComponents(t.targetSnapshot.root)).pipe(defaultIfEmpty(null), take(1));\n }), switchTap(() => this.afterPreactivation()), switchMap(() => {\n const {\n currentSnapshot,\n targetSnapshot\n } = overallTransitionState;\n const viewTransitionStarted = this.createViewTransition?.(this.environmentInjector, currentSnapshot.root, targetSnapshot.root);\n // If view transitions are enabled, block the navigation until the view\n // transition callback starts. Otherwise, continue immediately.\n return viewTransitionStarted ? from(viewTransitionStarted).pipe(map(() => overallTransitionState)) : of(overallTransitionState);\n }), map(t => {\n const targetRouterState = createRouterState(router.routeReuseStrategy, t.targetSnapshot, t.currentRouterState);\n this.currentTransition = overallTransitionState = {\n ...t,\n targetRouterState\n };\n this.currentNavigation.targetRouterState = targetRouterState;\n return overallTransitionState;\n }), tap(() => {\n this.events.next(new BeforeActivateRoutes());\n }), activateRoutes(this.rootContexts, router.routeReuseStrategy, evt => this.events.next(evt), this.inputBindingEnabled),\n // Ensure that if some observable used to drive the transition doesn't\n // complete, the navigation still finalizes This should never happen, but\n // this is done as a safety measure to avoid surfacing this error (#49567).\n take(1), tap({\n next: t => {\n completed = true;\n this.lastSuccessfulNavigation = this.currentNavigation;\n this.events.next(new NavigationEnd(t.id, this.urlSerializer.serialize(t.extractedUrl), this.urlSerializer.serialize(t.urlAfterRedirects)));\n this.titleStrategy?.updateTitle(t.targetRouterState.snapshot);\n t.resolve(true);\n },\n complete: () => {\n completed = true;\n }\n }),\n // There used to be a lot more logic happening directly within the\n // transition Observable. Some of this logic has been refactored out to\n // other places but there may still be errors that happen there. This gives\n // us a way to cancel the transition from the outside. This may also be\n // required in the future to support something like the abort signal of the\n // Navigation API where the navigation gets aborted from outside the\n // transition.\n takeUntil(this.transitionAbortSubject.pipe(tap(err => {\n throw err;\n }))), finalize(() => {\n /* When the navigation stream finishes either through error or success,\n * we set the `completed` or `errored` flag. However, there are some\n * situations where we could get here without either of those being set.\n * For instance, a redirect during NavigationStart. Therefore, this is a\n * catch-all to make sure the NavigationCancel event is fired when a\n * navigation gets cancelled but not caught by other means. */\n if (!completed && !errored) {\n const cancelationReason = typeof ngDevMode === 'undefined' || ngDevMode ? `Navigation ID ${overallTransitionState.id} is not equal to the current navigation id ${this.navigationId}` : '';\n this.cancelNavigationTransition(overallTransitionState, cancelationReason, NavigationCancellationCode.SupersededByNewNavigation);\n }\n // Only clear current navigation if it is still set to the one that\n // finalized.\n if (this.currentTransition?.id === overallTransitionState.id) {\n this.currentNavigation = null;\n this.currentTransition = null;\n }\n }), catchError(e => {\n errored = true;\n /* This error type is issued during Redirect, and is handled as a\n * cancellation rather than an error. */\n if (isNavigationCancelingError(e)) {\n this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e.message, e.cancellationCode));\n // When redirecting, we need to delay resolving the navigation\n // promise and push it to the redirect navigation\n if (!isRedirectingNavigationCancelingError(e)) {\n overallTransitionState.resolve(false);\n } else {\n this.events.next(new RedirectRequest(e.url, e.navigationBehaviorOptions));\n }\n /* All other errors should reset to the router's internal URL reference\n * to the pre-error state. */\n } else {\n const navigationError = new NavigationError(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), e, overallTransitionState.targetSnapshot ?? undefined);\n try {\n const navigationErrorHandlerResult = runInInjectionContext(this.environmentInjector, () => this.navigationErrorHandler?.(navigationError));\n if (navigationErrorHandlerResult instanceof RedirectCommand) {\n const {\n message,\n cancellationCode\n } = redirectingNavigationError(this.urlSerializer, navigationErrorHandlerResult);\n this.events.next(new NavigationCancel(overallTransitionState.id, this.urlSerializer.serialize(overallTransitionState.extractedUrl), message, cancellationCode));\n this.events.next(new RedirectRequest(navigationErrorHandlerResult.redirectTo, navigationErrorHandlerResult.navigationBehaviorOptions));\n } else {\n this.events.next(navigationError);\n throw e;\n }\n } catch (ee) {\n // TODO(atscott): consider flipping the default behavior of\n // resolveNavigationPromiseOnError to be `resolve(false)` when\n // undefined. This is the most sane thing to do given that\n // applications very rarely handle the promise rejection and, as a\n // result, would get \"unhandled promise rejection\" console logs.\n // The vast majority of applications would not be affected by this\n // change so omitting a migration seems reasonable. Instead,\n // applications that rely on rejection can specifically opt-in to the\n // old behavior.\n if (this.options.resolveNavigationPromiseOnError) {\n overallTransitionState.resolve(false);\n } else {\n overallTransitionState.reject(ee);\n }\n }\n }\n return EMPTY;\n }));\n // casting because `pipe` returns observable({}) when called with 8+ arguments\n }));\n }\n cancelNavigationTransition(t, reason, code) {\n const navCancel = new NavigationCancel(t.id, this.urlSerializer.serialize(t.extractedUrl), reason, code);\n this.events.next(navCancel);\n t.resolve(false);\n }\n /**\n * @returns Whether we're navigating to somewhere that is not what the Router is\n * currently set to.\n */\n isUpdatingInternalState() {\n // TODO(atscott): The serializer should likely be used instead of\n // `UrlTree.toString()`. Custom serializers are often written to handle\n // things better than the default one (objects, for example will be\n // [Object object] with the custom serializer and be \"the same\" when they\n // aren't).\n // (Same for isUpdatedBrowserUrl)\n return this.currentTransition?.extractedUrl.toString() !== this.currentTransition?.currentUrlTree.toString();\n }\n /**\n * @returns Whether we're updating the browser URL to something new (navigation is going\n * to somewhere not displayed in the URL bar and we will update the URL\n * bar if navigation succeeds).\n */\n isUpdatedBrowserUrl() {\n // The extracted URL is the part of the URL that this application cares about. `extract` may\n // return only part of the browser URL and that part may have not changed even if some other\n // portion of the URL did.\n const currentBrowserUrl = this.urlHandlingStrategy.extract(this.urlSerializer.parse(this.location.path(true)));\n const targetBrowserUrl = this.currentNavigation?.targetBrowserUrl ?? this.currentNavigation?.extractedUrl;\n return currentBrowserUrl.toString() !== targetBrowserUrl?.toString() && !this.currentNavigation?.extras.skipLocationChange;\n }\n static ɵfac = function NavigationTransitions_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NavigationTransitions)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NavigationTransitions,\n factory: NavigationTransitions.ɵfac,\n providedIn: 'root'\n });\n }\n return NavigationTransitions;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction isBrowserTriggeredNavigation(source) {\n return source !== IMPERATIVE_NAVIGATION;\n}\n\n/**\n * @description\n *\n * Provides a way to customize when activated routes get reused.\n *\n * @publicApi\n */\nlet RouteReuseStrategy = /*#__PURE__*/(() => {\n class RouteReuseStrategy {\n static ɵfac = function RouteReuseStrategy_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouteReuseStrategy)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouteReuseStrategy,\n factory: () => (() => inject(DefaultRouteReuseStrategy))(),\n providedIn: 'root'\n });\n }\n return RouteReuseStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * This base route reuse strategy only reuses routes when the matched router configs are\n * identical. This prevents components from being destroyed and recreated\n * when just the route parameters, query parameters or fragment change\n * (that is, the existing component is _reused_).\n *\n * This strategy does not store any routes for later reuse.\n *\n * Angular uses this strategy by default.\n *\n *\n * It can be used as a base class for custom route reuse strategies, i.e. you can create your own\n * class that extends the `BaseRouteReuseStrategy` one.\n * @publicApi\n */\nclass BaseRouteReuseStrategy {\n /**\n * Whether the given route should detach for later reuse.\n * Always returns false for `BaseRouteReuseStrategy`.\n * */\n shouldDetach(route) {\n return false;\n }\n /**\n * A no-op; the route is never stored since this strategy never detaches routes for later re-use.\n */\n store(route, detachedTree) {}\n /** Returns `false`, meaning the route (and its subtree) is never reattached */\n shouldAttach(route) {\n return false;\n }\n /** Returns `null` because this strategy does not store routes for later re-use. */\n retrieve(route) {\n return null;\n }\n /**\n * Determines if a route should be reused.\n * This strategy returns `true` when the future route config and current route config are\n * identical.\n */\n shouldReuseRoute(future, curr) {\n return future.routeConfig === curr.routeConfig;\n }\n}\nlet DefaultRouteReuseStrategy = /*#__PURE__*/(() => {\n class DefaultRouteReuseStrategy extends BaseRouteReuseStrategy {\n static ɵfac = /* @__PURE__ */(() => {\n let ɵDefaultRouteReuseStrategy_BaseFactory;\n return function DefaultRouteReuseStrategy_Factory(__ngFactoryType__) {\n return (ɵDefaultRouteReuseStrategy_BaseFactory || (ɵDefaultRouteReuseStrategy_BaseFactory = i0.ɵɵgetInheritedFactory(DefaultRouteReuseStrategy)))(__ngFactoryType__ || DefaultRouteReuseStrategy);\n };\n })();\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: DefaultRouteReuseStrategy,\n factory: DefaultRouteReuseStrategy.ɵfac,\n providedIn: 'root'\n });\n }\n return DefaultRouteReuseStrategy;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet StateManager = /*#__PURE__*/(() => {\n class StateManager {\n static ɵfac = function StateManager_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || StateManager)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: StateManager,\n factory: () => (() => inject(HistoryStateManager))(),\n providedIn: 'root'\n });\n }\n return StateManager;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet HistoryStateManager = /*#__PURE__*/(() => {\n class HistoryStateManager extends StateManager {\n location = inject(Location);\n urlSerializer = inject(UrlSerializer);\n options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n canceledNavigationResolution = this.options.canceledNavigationResolution || 'replace';\n urlHandlingStrategy = inject(UrlHandlingStrategy);\n urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';\n currentUrlTree = new UrlTree();\n getCurrentUrlTree() {\n return this.currentUrlTree;\n }\n rawUrlTree = this.currentUrlTree;\n getRawUrlTree() {\n return this.rawUrlTree;\n }\n /**\n * The id of the currently active page in the router.\n * Updated to the transition's target id on a successful navigation.\n *\n * This is used to track what page the router last activated. When an attempted navigation fails,\n * the router can then use this to compute how to restore the state back to the previously active\n * page.\n */\n currentPageId = 0;\n lastSuccessfulId = -1;\n restoredState() {\n return this.location.getState();\n }\n /**\n * The ɵrouterPageId of whatever page is currently active in the browser history. This is\n * important for computing the target page id for new navigations because we need to ensure each\n * page id in the browser history is 1 more than the previous entry.\n */\n get browserPageId() {\n if (this.canceledNavigationResolution !== 'computed') {\n return this.currentPageId;\n }\n return this.restoredState()?.ɵrouterPageId ?? this.currentPageId;\n }\n routerState = createEmptyState(null);\n getRouterState() {\n return this.routerState;\n }\n stateMemento = this.createStateMemento();\n createStateMemento() {\n return {\n rawUrlTree: this.rawUrlTree,\n currentUrlTree: this.currentUrlTree,\n routerState: this.routerState\n };\n }\n registerNonRouterCurrentEntryChangeListener(listener) {\n return this.location.subscribe(event => {\n if (event['type'] === 'popstate') {\n listener(event['url'], event.state);\n }\n });\n }\n handleRouterEvent(e, currentTransition) {\n if (e instanceof NavigationStart) {\n this.stateMemento = this.createStateMemento();\n } else if (e instanceof NavigationSkipped) {\n this.rawUrlTree = currentTransition.initialUrl;\n } else if (e instanceof RoutesRecognized) {\n if (this.urlUpdateStrategy === 'eager') {\n if (!currentTransition.extras.skipLocationChange) {\n const rawUrl = this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);\n this.setBrowserUrl(currentTransition.targetBrowserUrl ?? rawUrl, currentTransition);\n }\n }\n } else if (e instanceof BeforeActivateRoutes) {\n this.currentUrlTree = currentTransition.finalUrl;\n this.rawUrlTree = this.urlHandlingStrategy.merge(currentTransition.finalUrl, currentTransition.initialUrl);\n this.routerState = currentTransition.targetRouterState;\n if (this.urlUpdateStrategy === 'deferred' && !currentTransition.extras.skipLocationChange) {\n this.setBrowserUrl(currentTransition.targetBrowserUrl ?? this.rawUrlTree, currentTransition);\n }\n } else if (e instanceof NavigationCancel && (e.code === NavigationCancellationCode.GuardRejected || e.code === NavigationCancellationCode.NoDataFromResolver)) {\n this.restoreHistory(currentTransition);\n } else if (e instanceof NavigationError) {\n this.restoreHistory(currentTransition, true);\n } else if (e instanceof NavigationEnd) {\n this.lastSuccessfulId = e.id;\n this.currentPageId = this.browserPageId;\n }\n }\n setBrowserUrl(url, transition) {\n const path = url instanceof UrlTree ? this.urlSerializer.serialize(url) : url;\n if (this.location.isCurrentPathEqualTo(path) || !!transition.extras.replaceUrl) {\n // replacements do not update the target page\n const currentBrowserPageId = this.browserPageId;\n const state = {\n ...transition.extras.state,\n ...this.generateNgRouterState(transition.id, currentBrowserPageId)\n };\n this.location.replaceState(path, '', state);\n } else {\n const state = {\n ...transition.extras.state,\n ...this.generateNgRouterState(transition.id, this.browserPageId + 1)\n };\n this.location.go(path, '', state);\n }\n }\n /**\n * Performs the necessary rollback action to restore the browser URL to the\n * state before the transition.\n */\n restoreHistory(navigation, restoringFromCaughtError = false) {\n if (this.canceledNavigationResolution === 'computed') {\n const currentBrowserPageId = this.browserPageId;\n const targetPagePosition = this.currentPageId - currentBrowserPageId;\n if (targetPagePosition !== 0) {\n this.location.historyGo(targetPagePosition);\n } else if (this.currentUrlTree === navigation.finalUrl && targetPagePosition === 0) {\n // We got to the activation stage (where currentUrlTree is set to the navigation's\n // finalUrl), but we weren't moving anywhere in history (skipLocationChange or replaceUrl).\n // We still need to reset the router state back to what it was when the navigation started.\n this.resetState(navigation);\n this.resetUrlToCurrentUrlTree();\n } else {\n // The browser URL and router state was not updated before the navigation cancelled so\n // there's no restoration needed.\n }\n } else if (this.canceledNavigationResolution === 'replace') {\n // TODO(atscott): It seems like we should _always_ reset the state here. It would be a no-op\n // for `deferred` navigations that haven't change the internal state yet because guards\n // reject. For 'eager' navigations, it seems like we also really should reset the state\n // because the navigation was cancelled. Investigate if this can be done by running TGP.\n if (restoringFromCaughtError) {\n this.resetState(navigation);\n }\n this.resetUrlToCurrentUrlTree();\n }\n }\n resetState(navigation) {\n this.routerState = this.stateMemento.routerState;\n this.currentUrlTree = this.stateMemento.currentUrlTree;\n // Note here that we use the urlHandlingStrategy to get the reset `rawUrlTree` because it may be\n // configured to handle only part of the navigation URL. This means we would only want to reset\n // the part of the navigation handled by the Angular router rather than the whole URL. In\n // addition, the URLHandlingStrategy may be configured to specifically preserve parts of the URL\n // when merging, such as the query params so they are not lost on a refresh.\n this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, navigation.finalUrl ?? this.rawUrlTree);\n }\n resetUrlToCurrentUrlTree() {\n this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', this.generateNgRouterState(this.lastSuccessfulId, this.currentPageId));\n }\n generateNgRouterState(navigationId, routerPageId) {\n if (this.canceledNavigationResolution === 'computed') {\n return {\n navigationId,\n ɵrouterPageId: routerPageId\n };\n }\n return {\n navigationId\n };\n }\n static ɵfac = /* @__PURE__ */(() => {\n let ɵHistoryStateManager_BaseFactory;\n return function HistoryStateManager_Factory(__ngFactoryType__) {\n return (ɵHistoryStateManager_BaseFactory || (ɵHistoryStateManager_BaseFactory = i0.ɵɵgetInheritedFactory(HistoryStateManager)))(__ngFactoryType__ || HistoryStateManager);\n };\n })();\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: HistoryStateManager,\n factory: HistoryStateManager.ɵfac,\n providedIn: 'root'\n });\n }\n return HistoryStateManager;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nvar NavigationResult = /*#__PURE__*/function (NavigationResult) {\n NavigationResult[NavigationResult[\"COMPLETE\"] = 0] = \"COMPLETE\";\n NavigationResult[NavigationResult[\"FAILED\"] = 1] = \"FAILED\";\n NavigationResult[NavigationResult[\"REDIRECTING\"] = 2] = \"REDIRECTING\";\n return NavigationResult;\n}(NavigationResult || {});\n/**\n * Performs the given action once the router finishes its next/current navigation.\n *\n * The navigation is considered complete under the following conditions:\n * - `NavigationCancel` event emits and the code is not `NavigationCancellationCode.Redirect` or\n * `NavigationCancellationCode.SupersededByNewNavigation`. In these cases, the\n * redirecting/superseding navigation must finish.\n * - `NavigationError`, `NavigationEnd`, or `NavigationSkipped` event emits\n */\nfunction afterNextNavigation(router, action) {\n router.events.pipe(filter(e => e instanceof NavigationEnd || e instanceof NavigationCancel || e instanceof NavigationError || e instanceof NavigationSkipped), map(e => {\n if (e instanceof NavigationEnd || e instanceof NavigationSkipped) {\n return NavigationResult.COMPLETE;\n }\n const redirecting = e instanceof NavigationCancel ? e.code === NavigationCancellationCode.Redirect || e.code === NavigationCancellationCode.SupersededByNewNavigation : false;\n return redirecting ? NavigationResult.REDIRECTING : NavigationResult.FAILED;\n }), filter(result => result !== NavigationResult.REDIRECTING), take(1)).subscribe(() => {\n action();\n });\n}\n\n/**\n * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `true`\n * (exact = true).\n */\nconst exactMatchOptions = {\n paths: 'exact',\n fragment: 'ignored',\n matrixParams: 'ignored',\n queryParams: 'exact'\n};\n/**\n * The equivalent `IsActiveMatchOptions` options for `Router.isActive` is called with `false`\n * (exact = false).\n */\nconst subsetMatchOptions = {\n paths: 'subset',\n fragment: 'ignored',\n matrixParams: 'ignored',\n queryParams: 'subset'\n};\n/**\n * @description\n *\n * A service that facilitates navigation among views and URL manipulation capabilities.\n * This service is provided in the root scope and configured with [provideRouter](api/router/provideRouter).\n *\n * @see {@link Route}\n * @see {@link provideRouter}\n * @see [Routing and Navigation Guide](guide/routing/common-router-tasks).\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet Router = /*#__PURE__*/(() => {\n class Router {\n get currentUrlTree() {\n return this.stateManager.getCurrentUrlTree();\n }\n get rawUrlTree() {\n return this.stateManager.getRawUrlTree();\n }\n disposed = false;\n nonRouterCurrentEntryChangeSubscription;\n console = inject(ɵConsole);\n stateManager = inject(StateManager);\n options = inject(ROUTER_CONFIGURATION, {\n optional: true\n }) || {};\n pendingTasks = inject(ɵPendingTasksInternal);\n urlUpdateStrategy = this.options.urlUpdateStrategy || 'deferred';\n navigationTransitions = inject(NavigationTransitions);\n urlSerializer = inject(UrlSerializer);\n location = inject(Location);\n urlHandlingStrategy = inject(UrlHandlingStrategy);\n /**\n * The private `Subject` type for the public events exposed in the getter. This is used internally\n * to push events to. The separate field allows us to expose separate types in the public API\n * (i.e., an Observable rather than the Subject).\n */\n _events = new Subject();\n /**\n * An event stream for routing events.\n */\n get events() {\n // TODO(atscott): This _should_ be events.asObservable(). However, this change requires internal\n // cleanup: tests are doing `(route.events as Subject).next(...)`. This isn't\n // allowed/supported but we still have to fix these or file bugs against the teams before making\n // the change.\n return this._events;\n }\n /**\n * The current state of routing in this NgModule.\n */\n get routerState() {\n return this.stateManager.getRouterState();\n }\n /**\n * True if at least one navigation event has occurred,\n * false otherwise.\n */\n navigated = false;\n /**\n * A strategy for re-using routes.\n *\n * @deprecated Configure using `providers` instead:\n * `{provide: RouteReuseStrategy, useClass: MyStrategy}`.\n */\n routeReuseStrategy = inject(RouteReuseStrategy);\n /**\n * How to handle a navigation request to the current URL.\n *\n *\n * @deprecated Configure this through `provideRouter` or `RouterModule.forRoot` instead.\n * @see {@link withRouterConfig}\n * @see {@link provideRouter}\n * @see {@link RouterModule}\n */\n onSameUrlNavigation = this.options.onSameUrlNavigation || 'ignore';\n config = inject(ROUTES, {\n optional: true\n })?.flat() ?? [];\n /**\n * Indicates whether the application has opted in to binding Router data to component inputs.\n *\n * This option is enabled by the `withComponentInputBinding` feature of `provideRouter` or\n * `bindToComponentInputs` in the `ExtraOptions` of `RouterModule.forRoot`.\n */\n componentInputBindingEnabled = !!inject(INPUT_BINDER, {\n optional: true\n });\n constructor() {\n this.resetConfig(this.config);\n this.navigationTransitions.setupNavigations(this, this.currentUrlTree, this.routerState).subscribe({\n error: e => {\n this.console.warn(ngDevMode ? `Unhandled Navigation Error: ${e}` : e);\n }\n });\n this.subscribeToNavigationEvents();\n }\n eventsSubscription = new Subscription();\n subscribeToNavigationEvents() {\n const subscription = this.navigationTransitions.events.subscribe(e => {\n try {\n const currentTransition = this.navigationTransitions.currentTransition;\n const currentNavigation = this.navigationTransitions.currentNavigation;\n if (currentTransition !== null && currentNavigation !== null) {\n this.stateManager.handleRouterEvent(e, currentNavigation);\n if (e instanceof NavigationCancel && e.code !== NavigationCancellationCode.Redirect && e.code !== NavigationCancellationCode.SupersededByNewNavigation) {\n // It seems weird that `navigated` is set to `true` when the navigation is rejected,\n // however it's how things were written initially. Investigation would need to be done\n // to determine if this can be removed.\n this.navigated = true;\n } else if (e instanceof NavigationEnd) {\n this.navigated = true;\n } else if (e instanceof RedirectRequest) {\n const opts = e.navigationBehaviorOptions;\n const mergedTree = this.urlHandlingStrategy.merge(e.url, currentTransition.currentRawUrl);\n const extras = {\n browserUrl: currentTransition.extras.browserUrl,\n info: currentTransition.extras.info,\n skipLocationChange: currentTransition.extras.skipLocationChange,\n // The URL is already updated at this point if we have 'eager' URL\n // updates or if the navigation was triggered by the browser (back\n // button, URL bar, etc). We want to replace that item in history\n // if the navigation is rejected.\n replaceUrl: currentTransition.extras.replaceUrl || this.urlUpdateStrategy === 'eager' || isBrowserTriggeredNavigation(currentTransition.source),\n // allow developer to override default options with RedirectCommand\n ...opts\n };\n this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras, {\n resolve: currentTransition.resolve,\n reject: currentTransition.reject,\n promise: currentTransition.promise\n });\n }\n }\n // Note that it's important to have the Router process the events _before_ the event is\n // pushed through the public observable. This ensures the correct router state is in place\n // before applications observe the events.\n if (isPublicRouterEvent(e)) {\n this._events.next(e);\n }\n } catch (e) {\n this.navigationTransitions.transitionAbortSubject.next(e);\n }\n });\n this.eventsSubscription.add(subscription);\n }\n /** @internal */\n resetRootComponentType(rootComponentType) {\n // TODO: vsavkin router 4.0 should make the root component set to null\n // this will simplify the lifecycle of the router.\n this.routerState.root.component = rootComponentType;\n this.navigationTransitions.rootComponentType = rootComponentType;\n }\n /**\n * Sets up the location change listener and performs the initial navigation.\n */\n initialNavigation() {\n this.setUpLocationChangeListener();\n if (!this.navigationTransitions.hasRequestedNavigation) {\n this.navigateToSyncWithBrowser(this.location.path(true), IMPERATIVE_NAVIGATION, this.stateManager.restoredState());\n }\n }\n /**\n * Sets up the location change listener. This listener detects navigations triggered from outside\n * the Router (the browser back/forward buttons, for example) and schedules a corresponding Router\n * navigation so that the correct events, guards, etc. are triggered.\n */\n setUpLocationChangeListener() {\n // Don't need to use Zone.wrap any more, because zone.js\n // already patch onPopState, so location change callback will\n // run into ngZone\n this.nonRouterCurrentEntryChangeSubscription ??= this.stateManager.registerNonRouterCurrentEntryChangeListener((url, state) => {\n // The `setTimeout` was added in #12160 and is likely to support Angular/AngularJS\n // hybrid apps.\n setTimeout(() => {\n this.navigateToSyncWithBrowser(url, 'popstate', state);\n }, 0);\n });\n }\n /**\n * Schedules a router navigation to synchronize Router state with the browser state.\n *\n * This is done as a response to a popstate event and the initial navigation. These\n * two scenarios represent times when the browser URL/state has been updated and\n * the Router needs to respond to ensure its internal state matches.\n */\n navigateToSyncWithBrowser(url, source, state) {\n const extras = {\n replaceUrl: true\n };\n // TODO: restoredState should always include the entire state, regardless\n // of navigationId. This requires a breaking change to update the type on\n // NavigationStart’s restoredState, which currently requires navigationId\n // to always be present. The Router used to only restore history state if\n // a navigationId was present.\n // The stored navigationId is used by the RouterScroller to retrieve the scroll\n // position for the page.\n const restoredState = state?.navigationId ? state : null;\n // Separate to NavigationStart.restoredState, we must also restore the state to\n // history.state and generate a new navigationId, since it will be overwritten\n if (state) {\n const stateCopy = {\n ...state\n };\n delete stateCopy.navigationId;\n delete stateCopy.ɵrouterPageId;\n if (Object.keys(stateCopy).length !== 0) {\n extras.state = stateCopy;\n }\n }\n const urlTree = this.parseUrl(url);\n this.scheduleNavigation(urlTree, source, restoredState, extras);\n }\n /** The current URL. */\n get url() {\n return this.serializeUrl(this.currentUrlTree);\n }\n /**\n * Returns the current `Navigation` object when the router is navigating,\n * and `null` when idle.\n */\n getCurrentNavigation() {\n return this.navigationTransitions.currentNavigation;\n }\n /**\n * The `Navigation` object of the most recent navigation to succeed and `null` if there\n * has not been a successful navigation yet.\n */\n get lastSuccessfulNavigation() {\n return this.navigationTransitions.lastSuccessfulNavigation;\n }\n /**\n * Resets the route configuration used for navigation and generating links.\n *\n * @param config The route array for the new configuration.\n *\n * @usageNotes\n *\n * ```\n * router.resetConfig([\n * { path: 'team/:id', component: TeamCmp, children: [\n * { path: 'simple', component: SimpleCmp },\n * { path: 'user/:name', component: UserCmp }\n * ]}\n * ]);\n * ```\n */\n resetConfig(config) {\n (typeof ngDevMode === 'undefined' || ngDevMode) && validateConfig(config);\n this.config = config.map(standardizeConfig);\n this.navigated = false;\n }\n /** @nodoc */\n ngOnDestroy() {\n this.dispose();\n }\n /** Disposes of the router. */\n dispose() {\n this.navigationTransitions.complete();\n if (this.nonRouterCurrentEntryChangeSubscription) {\n this.nonRouterCurrentEntryChangeSubscription.unsubscribe();\n this.nonRouterCurrentEntryChangeSubscription = undefined;\n }\n this.disposed = true;\n this.eventsSubscription.unsubscribe();\n }\n /**\n * Appends URL segments to the current URL tree to create a new URL tree.\n *\n * @param commands An array of URL fragments with which to construct the new URL tree.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the current URL tree or the one provided in the `relativeTo`\n * property of the options object, if supplied.\n * @param navigationExtras Options that control the navigation strategy.\n * @returns The new URL tree.\n *\n * @usageNotes\n *\n * ```\n * // create /team/33/user/11\n * router.createUrlTree(['/team', 33, 'user', 11]);\n *\n * // create /team/33;expand=true/user/11\n * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);\n *\n * // you can collapse static segments like this (this works only with the first passed-in value):\n * router.createUrlTree(['/team/33/user', userId]);\n *\n * // If the first segment can contain slashes, and you do not want the router to split it,\n * // you can do the following:\n * router.createUrlTree([{segmentPath: '/one/two'}]);\n *\n * // create /team/33/(user/11//right:chat)\n * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);\n *\n * // remove the right secondary node\n * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);\n *\n * // assuming the current url is `/team/33/user/11` and the route points to `user/11`\n *\n * // navigate to /team/33/user/11/details\n * router.createUrlTree(['details'], {relativeTo: route});\n *\n * // navigate to /team/33/user/22\n * router.createUrlTree(['../22'], {relativeTo: route});\n *\n * // navigate to /team/44/user/22\n * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});\n *\n * Note that a value of `null` or `undefined` for `relativeTo` indicates that the\n * tree should be created relative to the root.\n * ```\n */\n createUrlTree(commands, navigationExtras = {}) {\n const {\n relativeTo,\n queryParams,\n fragment,\n queryParamsHandling,\n preserveFragment\n } = navigationExtras;\n const f = preserveFragment ? this.currentUrlTree.fragment : fragment;\n let q = null;\n switch (queryParamsHandling ?? this.options.defaultQueryParamsHandling) {\n case 'merge':\n q = {\n ...this.currentUrlTree.queryParams,\n ...queryParams\n };\n break;\n case 'preserve':\n q = this.currentUrlTree.queryParams;\n break;\n default:\n q = queryParams || null;\n }\n if (q !== null) {\n q = this.removeEmptyProps(q);\n }\n let relativeToUrlSegmentGroup;\n try {\n const relativeToSnapshot = relativeTo ? relativeTo.snapshot : this.routerState.snapshot.root;\n relativeToUrlSegmentGroup = createSegmentGroupFromRoute(relativeToSnapshot);\n } catch (e) {\n // This is strictly for backwards compatibility with tests that create\n // invalid `ActivatedRoute` mocks.\n // Note: the difference between having this fallback for invalid `ActivatedRoute` setups and\n // just throwing is ~500 test failures. Fixing all of those tests by hand is not feasible at\n // the moment.\n if (typeof commands[0] !== 'string' || commands[0][0] !== '/') {\n // Navigations that were absolute in the old way of creating UrlTrees\n // would still work because they wouldn't attempt to match the\n // segments in the `ActivatedRoute` to the `currentUrlTree` but\n // instead just replace the root segment with the navigation result.\n // Non-absolute navigations would fail to apply the commands because\n // the logic could not find the segment to replace (so they'd act like there were no\n // commands).\n commands = [];\n }\n relativeToUrlSegmentGroup = this.currentUrlTree.root;\n }\n return createUrlTreeFromSegmentGroup(relativeToUrlSegmentGroup, commands, q, f ?? null);\n }\n /**\n * Navigates to a view using an absolute route path.\n *\n * @param url An absolute path for a defined route. The function does not apply any delta to the\n * current URL.\n * @param extras An object containing properties that modify the navigation strategy.\n *\n * @returns A Promise that resolves to 'true' when navigation succeeds,\n * to 'false' when navigation fails, or is rejected on error.\n *\n * @usageNotes\n *\n * The following calls request navigation to an absolute path.\n *\n * ```\n * router.navigateByUrl(\"/team/33/user/11\");\n *\n * // Navigate without updating the URL\n * router.navigateByUrl(\"/team/33/user/11\", { skipLocationChange: true });\n * ```\n *\n * @see [Routing and Navigation guide](guide/routing/common-router-tasks)\n *\n */\n navigateByUrl(url, extras = {\n skipLocationChange: false\n }) {\n const urlTree = isUrlTree(url) ? url : this.parseUrl(url);\n const mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);\n return this.scheduleNavigation(mergedTree, IMPERATIVE_NAVIGATION, null, extras);\n }\n /**\n * Navigate based on the provided array of commands and a starting point.\n * If no starting route is provided, the navigation is absolute.\n *\n * @param commands An array of URL fragments with which to construct the target URL.\n * If the path is static, can be the literal URL string. For a dynamic path, pass an array of path\n * segments, followed by the parameters for each segment.\n * The fragments are applied to the current URL or the one provided in the `relativeTo` property\n * of the options object, if supplied.\n * @param extras An options object that determines how the URL should be constructed or\n * interpreted.\n *\n * @returns A Promise that resolves to `true` when navigation succeeds, or `false` when navigation\n * fails. The Promise is rejected when an error occurs if `resolveNavigationPromiseOnError` is\n * not `true`.\n *\n * @usageNotes\n *\n * The following calls request navigation to a dynamic route path relative to the current URL.\n *\n * ```\n * router.navigate(['team', 33, 'user', 11], {relativeTo: route});\n *\n * // Navigate without updating the URL, overriding the default behavior\n * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});\n * ```\n *\n * @see [Routing and Navigation guide](guide/routing/common-router-tasks)\n *\n */\n navigate(commands, extras = {\n skipLocationChange: false\n }) {\n validateCommands(commands);\n return this.navigateByUrl(this.createUrlTree(commands, extras), extras);\n }\n /** Serializes a `UrlTree` into a string */\n serializeUrl(url) {\n return this.urlSerializer.serialize(url);\n }\n /** Parses a string into a `UrlTree` */\n parseUrl(url) {\n try {\n return this.urlSerializer.parse(url);\n } catch {\n return this.urlSerializer.parse('/');\n }\n }\n isActive(url, matchOptions) {\n let options;\n if (matchOptions === true) {\n options = {\n ...exactMatchOptions\n };\n } else if (matchOptions === false) {\n options = {\n ...subsetMatchOptions\n };\n } else {\n options = matchOptions;\n }\n if (isUrlTree(url)) {\n return containsTree(this.currentUrlTree, url, options);\n }\n const urlTree = this.parseUrl(url);\n return containsTree(this.currentUrlTree, urlTree, options);\n }\n removeEmptyProps(params) {\n return Object.entries(params).reduce((result, [key, value]) => {\n if (value !== null && value !== undefined) {\n result[key] = value;\n }\n return result;\n }, {});\n }\n scheduleNavigation(rawUrl, source, restoredState, extras, priorPromise) {\n if (this.disposed) {\n return Promise.resolve(false);\n }\n let resolve;\n let reject;\n let promise;\n if (priorPromise) {\n resolve = priorPromise.resolve;\n reject = priorPromise.reject;\n promise = priorPromise.promise;\n } else {\n promise = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n }\n // Indicate that the navigation is happening.\n const taskId = this.pendingTasks.add();\n afterNextNavigation(this, () => {\n // Remove pending task in a microtask to allow for cancelled\n // initial navigations and redirects within the same task.\n queueMicrotask(() => this.pendingTasks.remove(taskId));\n });\n this.navigationTransitions.handleNavigationRequest({\n source,\n restoredState,\n currentUrlTree: this.currentUrlTree,\n currentRawUrl: this.currentUrlTree,\n rawUrl,\n extras,\n resolve: resolve,\n reject: reject,\n promise,\n currentSnapshot: this.routerState.snapshot,\n currentRouterState: this.routerState\n });\n // Make sure that the error is propagated even though `processNavigations` catch\n // handler does not rethrow\n return promise.catch(e => {\n return Promise.reject(e);\n });\n }\n static ɵfac = function Router_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || Router)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: Router,\n factory: Router.ɵfac,\n providedIn: 'root'\n });\n }\n return Router;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction validateCommands(commands) {\n for (let i = 0; i < commands.length; i++) {\n const cmd = commands[i];\n if (cmd == null) {\n throw new ɵRuntimeError(4008 /* RuntimeErrorCode.NULLISH_COMMAND */, (typeof ngDevMode === 'undefined' || ngDevMode) && `The requested path contains ${cmd} segment at index ${i}`);\n }\n }\n}\nfunction isPublicRouterEvent(e) {\n return !(e instanceof BeforeActivateRoutes) && !(e instanceof RedirectRequest);\n}\n\n/**\n * @description\n *\n * When applied to an element in a template, makes that element a link\n * that initiates navigation to a route. Navigation opens one or more routed components\n * in one or more `` locations on the page.\n *\n * Given a route configuration `[{ path: 'user/:name', component: UserCmp }]`,\n * the following creates a static link to the route:\n * `link to user component`\n *\n * You can use dynamic values to generate the link.\n * For a dynamic link, pass an array of path segments,\n * followed by the params for each segment.\n * For example, `['/team', teamId, 'user', userName, {details: true}]`\n * generates a link to `/team/11/user/bob;details=true`.\n *\n * Multiple static segments can be merged into one term and combined with dynamic segments.\n * For example, `['/team/11/user', userName, {details: true}]`\n *\n * The input that you provide to the link is treated as a delta to the current URL.\n * For instance, suppose the current URL is `/user/(box//aux:team)`.\n * The link `Jim` creates the URL\n * `/user/(jim//aux:team)`.\n * See {@link Router#createUrlTree} for more information.\n *\n * @usageNotes\n *\n * You can use absolute or relative paths in a link, set query parameters,\n * control how parameters are handled, and keep a history of navigation states.\n *\n * ### Relative link paths\n *\n * The first segment name can be prepended with `/`, `./`, or `../`.\n * * If the first segment begins with `/`, the router looks up the route from the root of the\n * app.\n * * If the first segment begins with `./`, or doesn't begin with a slash, the router\n * looks in the children of the current activated route.\n * * If the first segment begins with `../`, the router goes up one level in the route tree.\n *\n * ### Setting and handling query params and fragments\n *\n * The following link adds a query parameter and a fragment to the generated URL:\n *\n * ```html\n * \n * link to user component\n * \n * ```\n * By default, the directive constructs the new URL using the given query parameters.\n * The example generates the link: `/user/bob?debug=true#education`.\n *\n * You can instruct the directive to handle query parameters differently\n * by specifying the `queryParamsHandling` option in the link.\n * Allowed values are:\n *\n * - `'merge'`: Merge the given `queryParams` into the current query params.\n * - `'preserve'`: Preserve the current query params.\n *\n * For example:\n *\n * ```html\n * \n * link to user component\n * \n * ```\n *\n * `queryParams`, `fragment`, `queryParamsHandling`, `preserveFragment`, and `relativeTo`\n * cannot be used when the `routerLink` input is a `UrlTree`.\n *\n * See {@link UrlCreationOptions#queryParamsHandling}.\n *\n * ### Preserving navigation history\n *\n * You can provide a `state` value to be persisted to the browser's\n * [`History.state` property](https://developer.mozilla.org/en-US/docs/Web/API/History#Properties).\n * For example:\n *\n * ```html\n * \n * link to user component\n * \n * ```\n *\n * Use {@link Router#getCurrentNavigation} to retrieve a saved\n * navigation-state value. For example, to capture the `tracingId` during the `NavigationStart`\n * event:\n *\n * ```ts\n * // Get NavigationStart events\n * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => {\n * const navigation = router.getCurrentNavigation();\n * tracingService.trace({id: navigation.extras.state.tracingId});\n * });\n * ```\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterLink = /*#__PURE__*/(() => {\n class RouterLink {\n router;\n route;\n tabIndexAttribute;\n renderer;\n el;\n locationStrategy;\n /**\n * Represents an `href` attribute value applied to a host element,\n * when a host element is ``. For other tags, the value is `null`.\n */\n href = null;\n /**\n * Represents the `target` attribute on a host element.\n * This is only used when the host element is an `` tag.\n */\n target;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#queryParams}\n * @see {@link Router#createUrlTree}\n */\n queryParams;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#fragment}\n * @see {@link Router#createUrlTree}\n */\n fragment;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#queryParamsHandling}\n * @see {@link Router#createUrlTree}\n */\n queryParamsHandling;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#state}\n * @see {@link Router#navigateByUrl}\n */\n state;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#info}\n * @see {@link Router#navigateByUrl}\n */\n info;\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * Specify a value here when you do not want to use the default value\n * for `routerLink`, which is the current activated route.\n * Note that a value of `undefined` here will use the `routerLink` default.\n * @see {@link UrlCreationOptions#relativeTo}\n * @see {@link Router#createUrlTree}\n */\n relativeTo;\n /** Whether a host element is an `` tag. */\n isAnchorElement;\n subscription;\n /** @internal */\n onChanges = new Subject();\n constructor(router, route, tabIndexAttribute, renderer, el, locationStrategy) {\n this.router = router;\n this.route = route;\n this.tabIndexAttribute = tabIndexAttribute;\n this.renderer = renderer;\n this.el = el;\n this.locationStrategy = locationStrategy;\n const tagName = el.nativeElement.tagName?.toLowerCase();\n this.isAnchorElement = tagName === 'a' || tagName === 'area';\n if (this.isAnchorElement) {\n this.subscription = router.events.subscribe(s => {\n if (s instanceof NavigationEnd) {\n this.updateHref();\n }\n });\n } else {\n this.setTabIndexIfNotOnNativeEl('0');\n }\n }\n /**\n * Passed to {@link Router#createUrlTree} as part of the\n * `UrlCreationOptions`.\n * @see {@link UrlCreationOptions#preserveFragment}\n * @see {@link Router#createUrlTree}\n */\n preserveFragment = false;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#skipLocationChange}\n * @see {@link Router#navigateByUrl}\n */\n skipLocationChange = false;\n /**\n * Passed to {@link Router#navigateByUrl} as part of the\n * `NavigationBehaviorOptions`.\n * @see {@link NavigationBehaviorOptions#replaceUrl}\n * @see {@link Router#navigateByUrl}\n */\n replaceUrl = false;\n /**\n * Modifies the tab index if there was not a tabindex attribute on the element during\n * instantiation.\n */\n setTabIndexIfNotOnNativeEl(newTabIndex) {\n if (this.tabIndexAttribute != null /* both `null` and `undefined` */ || this.isAnchorElement) {\n return;\n }\n this.applyAttributeValue('tabindex', newTabIndex);\n }\n /** @nodoc */\n // TODO(atscott): Remove changes parameter in major version as a breaking change.\n ngOnChanges(changes) {\n if (ngDevMode && isUrlTree(this.routerLinkInput) && (this.fragment !== undefined || this.queryParams || this.queryParamsHandling || this.preserveFragment || this.relativeTo)) {\n throw new ɵRuntimeError(4016 /* RuntimeErrorCode.INVALID_ROUTER_LINK_INPUTS */, 'Cannot configure queryParams or fragment when using a UrlTree as the routerLink input value.');\n }\n if (this.isAnchorElement) {\n this.updateHref();\n }\n // This is subscribed to by `RouterLinkActive` so that it knows to update when there are changes\n // to the RouterLinks it's tracking.\n this.onChanges.next(this);\n }\n routerLinkInput = null;\n /**\n * Commands to pass to {@link Router#createUrlTree} or a `UrlTree`.\n * - **array**: commands to pass to {@link Router#createUrlTree}.\n * - **string**: shorthand for array of commands with just the string, i.e. `['/route']`\n * - **UrlTree**: a `UrlTree` for this link rather than creating one from the commands\n * and other inputs that correspond to properties of `UrlCreationOptions`.\n * - **null|undefined**: effectively disables the `routerLink`\n * @see {@link Router#createUrlTree}\n */\n set routerLink(commandsOrUrlTree) {\n if (commandsOrUrlTree == null) {\n this.routerLinkInput = null;\n this.setTabIndexIfNotOnNativeEl(null);\n } else {\n if (isUrlTree(commandsOrUrlTree)) {\n this.routerLinkInput = commandsOrUrlTree;\n } else {\n this.routerLinkInput = Array.isArray(commandsOrUrlTree) ? commandsOrUrlTree : [commandsOrUrlTree];\n }\n this.setTabIndexIfNotOnNativeEl('0');\n }\n }\n /** @nodoc */\n onClick(button, ctrlKey, shiftKey, altKey, metaKey) {\n const urlTree = this.urlTree;\n if (urlTree === null) {\n return true;\n }\n if (this.isAnchorElement) {\n if (button !== 0 || ctrlKey || shiftKey || altKey || metaKey) {\n return true;\n }\n if (typeof this.target === 'string' && this.target != '_self') {\n return true;\n }\n }\n const extras = {\n skipLocationChange: this.skipLocationChange,\n replaceUrl: this.replaceUrl,\n state: this.state,\n info: this.info\n };\n this.router.navigateByUrl(urlTree, extras);\n // Return `false` for `` elements to prevent default action\n // and cancel the native behavior, since the navigation is handled\n // by the Router.\n return !this.isAnchorElement;\n }\n /** @nodoc */\n ngOnDestroy() {\n this.subscription?.unsubscribe();\n }\n updateHref() {\n const urlTree = this.urlTree;\n this.href = urlTree !== null && this.locationStrategy ? this.locationStrategy?.prepareExternalUrl(this.router.serializeUrl(urlTree)) : null;\n const sanitizedValue = this.href === null ? null :\n // This class represents a directive that can be added to both `` elements,\n // as well as other elements. As a result, we can't define security context at\n // compile time. So the security context is deferred to runtime.\n // The `ɵɵsanitizeUrlOrResourceUrl` selects the necessary sanitizer function\n // based on the tag and property names. The logic mimics the one from\n // `packages/compiler/src/schema/dom_security_schema.ts`, which is used at compile time.\n //\n // Note: we should investigate whether we can switch to using `@HostBinding('attr.href')`\n // instead of applying a value via a renderer, after a final merge of the\n // `RouterLinkWithHref` directive.\n ɵɵsanitizeUrlOrResourceUrl(this.href, this.el.nativeElement.tagName.toLowerCase(), 'href');\n this.applyAttributeValue('href', sanitizedValue);\n }\n applyAttributeValue(attrName, attrValue) {\n const renderer = this.renderer;\n const nativeElement = this.el.nativeElement;\n if (attrValue !== null) {\n renderer.setAttribute(nativeElement, attrName, attrValue);\n } else {\n renderer.removeAttribute(nativeElement, attrName);\n }\n }\n get urlTree() {\n if (this.routerLinkInput === null) {\n return null;\n } else if (isUrlTree(this.routerLinkInput)) {\n return this.routerLinkInput;\n }\n return this.router.createUrlTree(this.routerLinkInput, {\n // If the `relativeTo` input is not defined, we want to use `this.route` by default.\n // Otherwise, we should use the value provided by the user in the input.\n relativeTo: this.relativeTo !== undefined ? this.relativeTo : this.route,\n queryParams: this.queryParams,\n fragment: this.fragment,\n queryParamsHandling: this.queryParamsHandling,\n preserveFragment: this.preserveFragment\n });\n }\n static ɵfac = function RouterLink_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterLink)(i0.ɵɵdirectiveInject(Router), i0.ɵɵdirectiveInject(ActivatedRoute), i0.ɵɵinjectAttribute('tabindex'), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i3.LocationStrategy));\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterLink,\n selectors: [[\"\", \"routerLink\", \"\"]],\n hostVars: 1,\n hostBindings: function RouterLink_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"click\", function RouterLink_click_HostBindingHandler($event) {\n return ctx.onClick($event.button, $event.ctrlKey, $event.shiftKey, $event.altKey, $event.metaKey);\n });\n }\n if (rf & 2) {\n i0.ɵɵattribute(\"target\", ctx.target);\n }\n },\n inputs: {\n target: \"target\",\n queryParams: \"queryParams\",\n fragment: \"fragment\",\n queryParamsHandling: \"queryParamsHandling\",\n state: \"state\",\n info: \"info\",\n relativeTo: \"relativeTo\",\n preserveFragment: [2, \"preserveFragment\", \"preserveFragment\", booleanAttribute],\n skipLocationChange: [2, \"skipLocationChange\", \"skipLocationChange\", booleanAttribute],\n replaceUrl: [2, \"replaceUrl\", \"replaceUrl\", booleanAttribute],\n routerLink: \"routerLink\"\n },\n features: [i0.ɵɵInputTransformsFeature, i0.ɵɵNgOnChangesFeature]\n });\n }\n return RouterLink;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n *\n * @description\n *\n * Tracks whether the linked route of an element is currently active, and allows you\n * to specify one or more CSS classes to add to the element when the linked route\n * is active.\n *\n * Use this directive to create a visual distinction for elements associated with an active route.\n * For example, the following code highlights the word \"Bob\" when the router\n * activates the associated route:\n *\n * ```html\n * Bob\n * ```\n *\n * Whenever the URL is either '/user' or '/user/bob', the \"active-link\" class is\n * added to the anchor tag. If the URL changes, the class is removed.\n *\n * You can set more than one class using a space-separated string or an array.\n * For example:\n *\n * ```html\n * Bob\n * Bob\n * ```\n *\n * To add the classes only when the URL matches the link exactly, add the option `exact: true`:\n *\n * ```html\n * Bob\n * ```\n *\n * To directly check the `isActive` status of the link, assign the `RouterLinkActive`\n * instance to a template variable.\n * For example, the following checks the status without assigning any CSS classes:\n *\n * ```html\n * \n * Bob {{ rla.isActive ? '(already open)' : ''}}\n * \n * ```\n *\n * You can apply the `RouterLinkActive` directive to an ancestor of linked elements.\n * For example, the following sets the active-link class on the `
          ` parent tag\n * when the URL is either '/user/jim' or '/user/bob'.\n *\n * ```html\n *
          \n * Jim\n * Bob\n *
          \n * ```\n *\n * The `RouterLinkActive` directive can also be used to set the aria-current attribute\n * to provide an alternative distinction for active elements to visually impaired users.\n *\n * For example, the following code adds the 'active' class to the Home Page link when it is\n * indeed active and in such case also sets its aria-current attribute to 'page':\n *\n * ```html\n * Home Page\n * ```\n *\n * @ngModule RouterModule\n *\n * @publicApi\n */\nlet RouterLinkActive = /*#__PURE__*/(() => {\n class RouterLinkActive {\n router;\n element;\n renderer;\n cdr;\n link;\n links;\n classes = [];\n routerEventsSubscription;\n linkInputChangesSubscription;\n _isActive = false;\n get isActive() {\n return this._isActive;\n }\n /**\n * Options to configure how to determine if the router link is active.\n *\n * These options are passed to the `Router.isActive()` function.\n *\n * @see {@link Router#isActive}\n */\n routerLinkActiveOptions = {\n exact: false\n };\n /**\n * Aria-current attribute to apply when the router link is active.\n *\n * Possible values: `'page'` | `'step'` | `'location'` | `'date'` | `'time'` | `true` | `false`.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-current}\n */\n ariaCurrentWhenActive;\n /**\n *\n * You can use the output `isActiveChange` to get notified each time the link becomes\n * active or inactive.\n *\n * Emits:\n * true -> Route is active\n * false -> Route is inactive\n *\n * ```\n * Bob\n * ```\n */\n isActiveChange = new EventEmitter();\n constructor(router, element, renderer, cdr, link) {\n this.router = router;\n this.element = element;\n this.renderer = renderer;\n this.cdr = cdr;\n this.link = link;\n this.routerEventsSubscription = router.events.subscribe(s => {\n if (s instanceof NavigationEnd) {\n this.update();\n }\n });\n }\n /** @nodoc */\n ngAfterContentInit() {\n // `of(null)` is used to force subscribe body to execute once immediately (like `startWith`).\n of(this.links.changes, of(null)).pipe(mergeAll()).subscribe(_ => {\n this.update();\n this.subscribeToEachLinkOnChanges();\n });\n }\n subscribeToEachLinkOnChanges() {\n this.linkInputChangesSubscription?.unsubscribe();\n const allLinkChanges = [...this.links.toArray(), this.link].filter(link => !!link).map(link => link.onChanges);\n this.linkInputChangesSubscription = from(allLinkChanges).pipe(mergeAll()).subscribe(link => {\n if (this._isActive !== this.isLinkActive(this.router)(link)) {\n this.update();\n }\n });\n }\n set routerLinkActive(data) {\n const classes = Array.isArray(data) ? data : data.split(' ');\n this.classes = classes.filter(c => !!c);\n }\n /** @nodoc */\n ngOnChanges(changes) {\n this.update();\n }\n /** @nodoc */\n ngOnDestroy() {\n this.routerEventsSubscription.unsubscribe();\n this.linkInputChangesSubscription?.unsubscribe();\n }\n update() {\n if (!this.links || !this.router.navigated) return;\n queueMicrotask(() => {\n const hasActiveLinks = this.hasActiveLinks();\n this.classes.forEach(c => {\n if (hasActiveLinks) {\n this.renderer.addClass(this.element.nativeElement, c);\n } else {\n this.renderer.removeClass(this.element.nativeElement, c);\n }\n });\n if (hasActiveLinks && this.ariaCurrentWhenActive !== undefined) {\n this.renderer.setAttribute(this.element.nativeElement, 'aria-current', this.ariaCurrentWhenActive.toString());\n } else {\n this.renderer.removeAttribute(this.element.nativeElement, 'aria-current');\n }\n // Only emit change if the active state changed.\n if (this._isActive !== hasActiveLinks) {\n this._isActive = hasActiveLinks;\n this.cdr.markForCheck();\n // Emit on isActiveChange after classes are updated\n this.isActiveChange.emit(hasActiveLinks);\n }\n });\n }\n isLinkActive(router) {\n const options = isActiveMatchOptions(this.routerLinkActiveOptions) ? this.routerLinkActiveOptions :\n // While the types should disallow `undefined` here, it's possible without strict inputs\n this.routerLinkActiveOptions.exact || false;\n return link => {\n const urlTree = link.urlTree;\n return urlTree ? router.isActive(urlTree, options) : false;\n };\n }\n hasActiveLinks() {\n const isActiveCheckFn = this.isLinkActive(this.router);\n return this.link && isActiveCheckFn(this.link) || this.links.some(isActiveCheckFn);\n }\n static ɵfac = function RouterLinkActive_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterLinkActive)(i0.ɵɵdirectiveInject(Router), i0.ɵɵdirectiveInject(i0.ElementRef), i0.ɵɵdirectiveInject(i0.Renderer2), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(RouterLink, 8));\n };\n static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: RouterLinkActive,\n selectors: [[\"\", \"routerLinkActive\", \"\"]],\n contentQueries: function RouterLinkActive_ContentQueries(rf, ctx, dirIndex) {\n if (rf & 1) {\n i0.ɵɵcontentQuery(dirIndex, RouterLink, 5);\n }\n if (rf & 2) {\n let _t;\n i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.links = _t);\n }\n },\n inputs: {\n routerLinkActiveOptions: \"routerLinkActiveOptions\",\n ariaCurrentWhenActive: \"ariaCurrentWhenActive\",\n routerLinkActive: \"routerLinkActive\"\n },\n outputs: {\n isActiveChange: \"isActiveChange\"\n },\n exportAs: [\"routerLinkActive\"],\n features: [i0.ɵɵNgOnChangesFeature]\n });\n }\n return RouterLinkActive;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Use instead of `'paths' in options` to be compatible with property renaming\n */\nfunction isActiveMatchOptions(options) {\n return !!options.paths;\n}\n\n/**\n * @description\n *\n * Provides a preloading strategy.\n *\n * @publicApi\n */\nclass PreloadingStrategy {}\n/**\n * @description\n *\n * Provides a preloading strategy that preloads all modules as quickly as possible.\n *\n * ```ts\n * RouterModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules})\n * ```\n *\n * @publicApi\n */\nlet PreloadAllModules = /*#__PURE__*/(() => {\n class PreloadAllModules {\n preload(route, fn) {\n return fn().pipe(catchError(() => of(null)));\n }\n static ɵfac = function PreloadAllModules_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || PreloadAllModules)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: PreloadAllModules,\n factory: PreloadAllModules.ɵfac,\n providedIn: 'root'\n });\n }\n return PreloadAllModules;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * @description\n *\n * Provides a preloading strategy that does not preload any modules.\n *\n * This strategy is enabled by default.\n *\n * @publicApi\n */\nlet NoPreloading = /*#__PURE__*/(() => {\n class NoPreloading {\n preload(route, fn) {\n return of(null);\n }\n static ɵfac = function NoPreloading_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NoPreloading)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: NoPreloading,\n factory: NoPreloading.ɵfac,\n providedIn: 'root'\n });\n }\n return NoPreloading;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * The preloader optimistically loads all router configurations to\n * make navigations into lazily-loaded sections of the application faster.\n *\n * The preloader runs in the background. When the router bootstraps, the preloader\n * starts listening to all navigation events. After every such event, the preloader\n * will check if any configurations can be loaded lazily.\n *\n * If a route is protected by `canLoad` guards, the preloaded will not load it.\n *\n * @publicApi\n */\nlet RouterPreloader = /*#__PURE__*/(() => {\n class RouterPreloader {\n router;\n injector;\n preloadingStrategy;\n loader;\n subscription;\n constructor(router, compiler, injector, preloadingStrategy, loader) {\n this.router = router;\n this.injector = injector;\n this.preloadingStrategy = preloadingStrategy;\n this.loader = loader;\n }\n setUpPreloading() {\n this.subscription = this.router.events.pipe(filter(e => e instanceof NavigationEnd), concatMap(() => this.preload())).subscribe(() => {});\n }\n preload() {\n return this.processRoutes(this.injector, this.router.config);\n }\n /** @nodoc */\n ngOnDestroy() {\n if (this.subscription) {\n this.subscription.unsubscribe();\n }\n }\n processRoutes(injector, routes) {\n const res = [];\n for (const route of routes) {\n if (route.providers && !route._injector) {\n route._injector = createEnvironmentInjector(route.providers, injector, `Route: ${route.path}`);\n }\n const injectorForCurrentRoute = route._injector ?? injector;\n const injectorForChildren = route._loadedInjector ?? injectorForCurrentRoute;\n // Note that `canLoad` is only checked as a condition that prevents `loadChildren` and not\n // `loadComponent`. `canLoad` guards only block loading of child routes by design. This\n // happens as a consequence of needing to descend into children for route matching immediately\n // while component loading is deferred until route activation. Because `canLoad` guards can\n // have side effects, we cannot execute them here so we instead skip preloading altogether\n // when present. Lastly, it remains to be decided whether `canLoad` should behave this way\n // at all. Code splitting and lazy loading is separate from client-side authorization checks\n // and should not be used as a security measure to prevent loading of code.\n if (route.loadChildren && !route._loadedRoutes && route.canLoad === undefined || route.loadComponent && !route._loadedComponent) {\n res.push(this.preloadConfig(injectorForCurrentRoute, route));\n }\n if (route.children || route._loadedRoutes) {\n res.push(this.processRoutes(injectorForChildren, route.children ?? route._loadedRoutes));\n }\n }\n return from(res).pipe(mergeAll());\n }\n preloadConfig(injector, route) {\n return this.preloadingStrategy.preload(route, () => {\n let loadedChildren$;\n if (route.loadChildren && route.canLoad === undefined) {\n loadedChildren$ = this.loader.loadChildren(injector, route);\n } else {\n loadedChildren$ = of(null);\n }\n const recursiveLoadChildren$ = loadedChildren$.pipe(mergeMap(config => {\n if (config === null) {\n return of(void 0);\n }\n route._loadedRoutes = config.routes;\n route._loadedInjector = config.injector;\n // If the loaded config was a module, use that as the module/module injector going\n // forward. Otherwise, continue using the current module/module injector.\n return this.processRoutes(config.injector ?? injector, config.routes);\n }));\n if (route.loadComponent && !route._loadedComponent) {\n const loadComponent$ = this.loader.loadComponent(route);\n return from([recursiveLoadChildren$, loadComponent$]).pipe(mergeAll());\n } else {\n return recursiveLoadChildren$;\n }\n });\n }\n static ɵfac = function RouterPreloader_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterPreloader)(i0.ɵɵinject(Router), i0.ɵɵinject(i0.Compiler), i0.ɵɵinject(i0.EnvironmentInjector), i0.ɵɵinject(PreloadingStrategy), i0.ɵɵinject(RouterConfigLoader));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterPreloader,\n factory: RouterPreloader.ɵfac,\n providedIn: 'root'\n });\n }\n return RouterPreloader;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nconst ROUTER_SCROLLER = /*#__PURE__*/new InjectionToken('');\nlet RouterScroller = /*#__PURE__*/(() => {\n class RouterScroller {\n urlSerializer;\n transitions;\n viewportScroller;\n zone;\n options;\n routerEventsSubscription;\n scrollEventsSubscription;\n lastId = 0;\n lastSource = 'imperative';\n restoredId = 0;\n store = {};\n /** @nodoc */\n constructor(urlSerializer, transitions, viewportScroller, zone, options = {}) {\n this.urlSerializer = urlSerializer;\n this.transitions = transitions;\n this.viewportScroller = viewportScroller;\n this.zone = zone;\n this.options = options;\n // Default both options to 'disabled'\n options.scrollPositionRestoration ||= 'disabled';\n options.anchorScrolling ||= 'disabled';\n }\n init() {\n // we want to disable the automatic scrolling because having two places\n // responsible for scrolling results race conditions, especially given\n // that browser don't implement this behavior consistently\n if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.setHistoryScrollRestoration('manual');\n }\n this.routerEventsSubscription = this.createScrollEvents();\n this.scrollEventsSubscription = this.consumeScrollEvents();\n }\n createScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (e instanceof NavigationStart) {\n // store the scroll position of the current stable navigations.\n this.store[this.lastId] = this.viewportScroller.getScrollPosition();\n this.lastSource = e.navigationTrigger;\n this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;\n } else if (e instanceof NavigationEnd) {\n this.lastId = e.id;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.urlAfterRedirects).fragment);\n } else if (e instanceof NavigationSkipped && e.code === NavigationSkippedCode.IgnoredSameUrlNavigation) {\n this.lastSource = undefined;\n this.restoredId = 0;\n this.scheduleScrollEvent(e, this.urlSerializer.parse(e.url).fragment);\n }\n });\n }\n consumeScrollEvents() {\n return this.transitions.events.subscribe(e => {\n if (!(e instanceof Scroll)) return;\n // a popstate event. The pop state event will always ignore anchor scrolling.\n if (e.position) {\n if (this.options.scrollPositionRestoration === 'top') {\n this.viewportScroller.scrollToPosition([0, 0]);\n } else if (this.options.scrollPositionRestoration === 'enabled') {\n this.viewportScroller.scrollToPosition(e.position);\n }\n // imperative navigation \"forward\"\n } else {\n if (e.anchor && this.options.anchorScrolling === 'enabled') {\n this.viewportScroller.scrollToAnchor(e.anchor);\n } else if (this.options.scrollPositionRestoration !== 'disabled') {\n this.viewportScroller.scrollToPosition([0, 0]);\n }\n }\n });\n }\n scheduleScrollEvent(routerEvent, anchor) {\n this.zone.runOutsideAngular(() => {\n // The scroll event needs to be delayed until after change detection. Otherwise, we may\n // attempt to restore the scroll position before the router outlet has fully rendered the\n // component by executing its update block of the template function.\n setTimeout(() => {\n this.zone.run(() => {\n this.transitions.events.next(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));\n });\n }, 0);\n });\n }\n /** @nodoc */\n ngOnDestroy() {\n this.routerEventsSubscription?.unsubscribe();\n this.scrollEventsSubscription?.unsubscribe();\n }\n static ɵfac = function RouterScroller_Factory(__ngFactoryType__) {\n i0.ɵɵinvalidFactory();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: RouterScroller,\n factory: RouterScroller.ɵfac\n });\n }\n return RouterScroller;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Sets up providers necessary to enable `Router` functionality for the application.\n * Allows to configure a set of routes as well as extra features that should be enabled.\n *\n * @usageNotes\n *\n * Basic example of how you can add a Router to your application:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent, {\n * providers: [provideRouter(appRoutes)]\n * });\n * ```\n *\n * You can also enable optional features in the Router by adding functions from the `RouterFeatures`\n * type:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes,\n * withDebugTracing(),\n * withRouterConfig({paramsInheritanceStrategy: 'always'}))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link RouterFeatures}\n *\n * @publicApi\n * @param routes A set of `Route`s to use for the application routing table.\n * @param features Optional features to configure additional router behaviors.\n * @returns A set of providers to setup a Router.\n */\nfunction provideRouter(routes, ...features) {\n return makeEnvironmentProviders([{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, typeof ngDevMode === 'undefined' || ngDevMode ? {\n provide: ROUTER_IS_PROVIDED,\n useValue: true\n } : [], {\n provide: ActivatedRoute,\n useFactory: rootRoute,\n deps: [Router]\n }, {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useFactory: getBootstrapListener\n }, features.map(feature => feature.ɵproviders)]);\n}\nfunction rootRoute(router) {\n return router.routerState.root;\n}\n/**\n * Helper function to create an object that represents a Router feature.\n */\nfunction routerFeature(kind, providers) {\n return {\n ɵkind: kind,\n ɵproviders: providers\n };\n}\n/**\n * An Injection token used to indicate whether `provideRouter` or `RouterModule.forRoot` was ever\n * called.\n */\nconst ROUTER_IS_PROVIDED = /*#__PURE__*/new InjectionToken('', {\n providedIn: 'root',\n factory: () => false\n});\nconst routerIsProvidedDevModeCheck = {\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory() {\n return () => {\n if (!inject(ROUTER_IS_PROVIDED)) {\n console.warn('`provideRoutes` was called without `provideRouter` or `RouterModule.forRoot`. ' + 'This is likely a mistake.');\n }\n };\n }\n};\n/**\n * Registers a DI provider for a set of routes.\n * @param routes The route configuration to provide.\n *\n * @usageNotes\n *\n * ```ts\n * @NgModule({\n * providers: [provideRoutes(ROUTES)]\n * })\n * class LazyLoadedChildModule {}\n * ```\n *\n * @deprecated If necessary, provide routes using the `ROUTES` `InjectionToken`.\n * @see {@link ROUTES}\n * @publicApi\n */\nfunction provideRoutes(routes) {\n return [{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, typeof ngDevMode === 'undefined' || ngDevMode ? routerIsProvidedDevModeCheck : []];\n}\n/**\n * Enables customizable scrolling behavior for router navigations.\n *\n * @usageNotes\n *\n * Basic example of how you can enable scrolling feature:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withInMemoryScrolling())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n * @see {@link ViewportScroller}\n *\n * @publicApi\n * @param options Set of configuration parameters to customize scrolling behavior, see\n * `InMemoryScrollingOptions` for additional information.\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withInMemoryScrolling(options = {}) {\n const providers = [{\n provide: ROUTER_SCROLLER,\n useFactory: () => {\n const viewportScroller = inject(ViewportScroller);\n const zone = inject(NgZone);\n const transitions = inject(NavigationTransitions);\n const urlSerializer = inject(UrlSerializer);\n return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, options);\n }\n }];\n return routerFeature(4 /* RouterFeatureKind.InMemoryScrollingFeature */, providers);\n}\nfunction getBootstrapListener() {\n const injector = inject(Injector);\n return bootstrappedComponentRef => {\n const ref = injector.get(ApplicationRef);\n if (bootstrappedComponentRef !== ref.components[0]) {\n return;\n }\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n if (injector.get(INITIAL_NAVIGATION) === 1 /* InitialNavigation.EnabledNonBlocking */) {\n router.initialNavigation();\n }\n injector.get(ROUTER_PRELOADER, null, InjectFlags.Optional)?.setUpPreloading();\n injector.get(ROUTER_SCROLLER, null, InjectFlags.Optional)?.init();\n router.resetRootComponentType(ref.componentTypes[0]);\n if (!bootstrapDone.closed) {\n bootstrapDone.next();\n bootstrapDone.complete();\n bootstrapDone.unsubscribe();\n }\n };\n}\n/**\n * A subject used to indicate that the bootstrapping phase is done. When initial navigation is\n * `enabledBlocking`, the first navigation waits until bootstrapping is finished before continuing\n * to the activation phase.\n */\nconst BOOTSTRAP_DONE = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'bootstrap done indicator' : '', {\n factory: () => {\n return new Subject();\n }\n});\nconst INITIAL_NAVIGATION = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'initial navigation' : '', {\n providedIn: 'root',\n factory: () => 1 /* InitialNavigation.EnabledNonBlocking */\n});\n/**\n * Configures initial navigation to start before the root component is created.\n *\n * The bootstrap is blocked until the initial navigation is complete. This should be set in case\n * you use [server-side rendering](guide/ssr), but do not enable [hydration](guide/hydration) for\n * your application.\n *\n * @usageNotes\n *\n * Basic example of how you can enable this navigation behavior:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withEnabledBlockingInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @publicApi\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withEnabledBlockingInitialNavigation() {\n const providers = [{\n provide: INITIAL_NAVIGATION,\n useValue: 0 /* InitialNavigation.EnabledBlocking */\n }, {\n provide: APP_INITIALIZER,\n multi: true,\n deps: [Injector],\n useFactory: injector => {\n const locationInitialized = injector.get(LOCATION_INITIALIZED, Promise.resolve());\n return () => {\n return locationInitialized.then(() => {\n return new Promise(resolve => {\n const router = injector.get(Router);\n const bootstrapDone = injector.get(BOOTSTRAP_DONE);\n afterNextNavigation(router, () => {\n // Unblock APP_INITIALIZER in case the initial navigation was canceled or errored\n // without a redirect.\n resolve(true);\n });\n injector.get(NavigationTransitions).afterPreactivation = () => {\n // Unblock APP_INITIALIZER once we get to `afterPreactivation`. At this point, we\n // assume activation will complete successfully (even though this is not\n // guaranteed).\n resolve(true);\n return bootstrapDone.closed ? of(void 0) : bootstrapDone;\n };\n router.initialNavigation();\n });\n });\n };\n }\n }];\n return routerFeature(2 /* RouterFeatureKind.EnabledBlockingInitialNavigationFeature */, providers);\n}\n/**\n * Disables initial navigation.\n *\n * Use if there is a reason to have more control over when the router starts its initial navigation\n * due to some complex initialization logic.\n *\n * @usageNotes\n *\n * Basic example of how you can disable initial navigation:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withDisabledInitialNavigation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withDisabledInitialNavigation() {\n const providers = [{\n provide: APP_INITIALIZER,\n multi: true,\n useFactory: () => {\n const router = inject(Router);\n return () => {\n router.setUpLocationChangeListener();\n };\n }\n }, {\n provide: INITIAL_NAVIGATION,\n useValue: 2 /* InitialNavigation.Disabled */\n }];\n return routerFeature(3 /* RouterFeatureKind.DisabledInitialNavigationFeature */, providers);\n}\n/**\n * Enables logging of all internal navigation events to the console.\n * Extra logging might be useful for debugging purposes to inspect Router event sequence.\n *\n * @usageNotes\n *\n * Basic example of how you can enable debug tracing:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withDebugTracing())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withDebugTracing() {\n let providers = [];\n if (typeof ngDevMode === 'undefined' || ngDevMode) {\n providers = [{\n provide: ENVIRONMENT_INITIALIZER,\n multi: true,\n useFactory: () => {\n const router = inject(Router);\n return () => router.events.subscribe(e => {\n // tslint:disable:no-console\n console.group?.(`Router Event: ${e.constructor.name}`);\n console.log(stringifyEvent(e));\n console.log(e);\n console.groupEnd?.();\n // tslint:enable:no-console\n });\n }\n }];\n } else {\n providers = [];\n }\n return routerFeature(1 /* RouterFeatureKind.DebugTracingFeature */, providers);\n}\nconst ROUTER_PRELOADER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router preloader' : '');\n/**\n * Allows to configure a preloading strategy to use. The strategy is configured by providing a\n * reference to a class that implements a `PreloadingStrategy`.\n *\n * @usageNotes\n *\n * Basic example of how you can configure preloading:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withPreloading(PreloadAllModules))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @param preloadingStrategy A reference to a class that implements a `PreloadingStrategy` that\n * should be used.\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withPreloading(preloadingStrategy) {\n const providers = [{\n provide: ROUTER_PRELOADER,\n useExisting: RouterPreloader\n }, {\n provide: PreloadingStrategy,\n useExisting: preloadingStrategy\n }];\n return routerFeature(0 /* RouterFeatureKind.PreloadingFeature */, providers);\n}\n/**\n * Allows to provide extra parameters to configure Router.\n *\n * @usageNotes\n *\n * Basic example of how you can provide extra configuration options:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withRouterConfig({\n * onSameUrlNavigation: 'reload'\n * }))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n *\n * @param options A set of parameters to configure Router, see `RouterConfigOptions` for\n * additional information.\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withRouterConfig(options) {\n const providers = [{\n provide: ROUTER_CONFIGURATION,\n useValue: options\n }];\n return routerFeature(5 /* RouterFeatureKind.RouterConfigurationFeature */, providers);\n}\n/**\n * Provides the location strategy that uses the URL fragment instead of the history API.\n *\n * @usageNotes\n *\n * Basic example of how you can use the hash location option:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withHashLocation())\n * ]\n * }\n * );\n * ```\n *\n * @see {@link provideRouter}\n * @see {@link HashLocationStrategy}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withHashLocation() {\n const providers = [{\n provide: LocationStrategy,\n useClass: HashLocationStrategy\n }];\n return routerFeature(6 /* RouterFeatureKind.RouterHashLocationFeature */, providers);\n}\n/**\n * Provides a function which is called when a navigation error occurs.\n *\n * This function is run inside application's [injection context](guide/di/dependency-injection-context)\n * so you can use the [`inject`](api/core/inject) function.\n *\n * This function can return a `RedirectCommand` to convert the error to a redirect, similar to returning\n * a `UrlTree` or `RedirectCommand` from a guard. This will also prevent the `Router` from emitting\n * `NavigationError`; it will instead emit `NavigationCancel` with code NavigationCancellationCode.Redirect.\n * Return values other than `RedirectCommand` are ignored and do not change any behavior with respect to\n * how the `Router` handles the error.\n *\n * @usageNotes\n *\n * Basic example of how you can use the error handler option:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withNavigationErrorHandler((e: NavigationError) =>\n * inject(MyErrorTracker).trackError(e)))\n * ]\n * }\n * );\n * ```\n *\n * @see {@link NavigationError}\n * @see {@link core/inject}\n * @see {@link runInInjectionContext}\n *\n * @returns A set of providers for use with `provideRouter`.\n *\n * @publicApi\n */\nfunction withNavigationErrorHandler(handler) {\n const providers = [{\n provide: NAVIGATION_ERROR_HANDLER,\n useValue: handler\n }];\n return routerFeature(7 /* RouterFeatureKind.NavigationErrorHandlerFeature */, providers);\n}\n/**\n * Enables binding information from the `Router` state directly to the inputs of the component in\n * `Route` configurations.\n *\n * @usageNotes\n *\n * Basic example of how you can enable the feature:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withComponentInputBinding())\n * ]\n * }\n * );\n * ```\n *\n * The router bindings information from any of the following sources:\n *\n * - query parameters\n * - path and matrix parameters\n * - static route data\n * - data from resolvers\n *\n * Duplicate keys are resolved in the same order from above, from least to greatest,\n * meaning that resolvers have the highest precedence and override any of the other information\n * from the route.\n *\n * Importantly, when an input does not have an item in the route data with a matching key, this\n * input is set to `undefined`. This prevents previous information from being\n * retained if the data got removed from the route (i.e. if a query parameter is removed).\n * Default values can be provided with a resolver on the route to ensure the value is always present\n * or an input and use an input transform in the component.\n *\n * @see {@link guide/components/inputs#input-transforms input transforms}\n * @returns A set of providers for use with `provideRouter`.\n */\nfunction withComponentInputBinding() {\n const providers = [RoutedComponentInputBinder, {\n provide: INPUT_BINDER,\n useExisting: RoutedComponentInputBinder\n }];\n return routerFeature(8 /* RouterFeatureKind.ComponentInputBindingFeature */, providers);\n}\n/**\n * Enables view transitions in the Router by running the route activation and deactivation inside of\n * `document.startViewTransition`.\n *\n * Note: The View Transitions API is not available in all browsers. If the browser does not support\n * view transitions, the Router will not attempt to start a view transition and continue processing\n * the navigation as usual.\n *\n * @usageNotes\n *\n * Basic example of how you can enable the feature:\n * ```ts\n * const appRoutes: Routes = [];\n * bootstrapApplication(AppComponent,\n * {\n * providers: [\n * provideRouter(appRoutes, withViewTransitions())\n * ]\n * }\n * );\n * ```\n *\n * @returns A set of providers for use with `provideRouter`.\n * @see https://developer.chrome.com/docs/web-platform/view-transitions/\n * @see https://developer.mozilla.org/en-US/docs/Web/API/View_Transitions_API\n * @developerPreview\n */\nfunction withViewTransitions(options) {\n const providers = [{\n provide: CREATE_VIEW_TRANSITION,\n useValue: createViewTransition\n }, {\n provide: VIEW_TRANSITION_OPTIONS,\n useValue: {\n skipNextTransition: !!options?.skipInitialTransition,\n ...options\n }\n }];\n return routerFeature(9 /* RouterFeatureKind.ViewTransitionsFeature */, providers);\n}\n\n/**\n * The directives defined in the `RouterModule`.\n */\nconst ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkActive, ɵEmptyOutletComponent];\n/**\n * @docsNotRequired\n */\nconst ROUTER_FORROOT_GUARD = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'router duplicate forRoot guard' : 'ROUTER_FORROOT_GUARD');\n// TODO(atscott): All of these except `ActivatedRoute` are `providedIn: 'root'`. They are only kept\n// here to avoid a breaking change whereby the provider order matters based on where the\n// `RouterModule`/`RouterTestingModule` is imported. These can/should be removed as a \"breaking\"\n// change in a major version.\nconst ROUTER_PROVIDERS = [Location, {\n provide: UrlSerializer,\n useClass: DefaultUrlSerializer\n}, Router, ChildrenOutletContexts, {\n provide: ActivatedRoute,\n useFactory: rootRoute,\n deps: [Router]\n}, RouterConfigLoader,\n// Only used to warn when `provideRoutes` is used without `RouterModule` or `provideRouter`. Can\n// be removed when `provideRoutes` is removed.\ntypeof ngDevMode === 'undefined' || ngDevMode ? {\n provide: ROUTER_IS_PROVIDED,\n useValue: true\n} : []];\n/**\n * @description\n *\n * Adds directives and providers for in-app navigation among views defined in an application.\n * Use the Angular `Router` service to declaratively specify application states and manage state\n * transitions.\n *\n * You can import this NgModule multiple times, once for each lazy-loaded bundle.\n * However, only one `Router` service can be active.\n * To ensure this, there are two ways to register routes when importing this module:\n *\n * * The `forRoot()` method creates an `NgModule` that contains all the directives, the given\n * routes, and the `Router` service itself.\n * * The `forChild()` method creates an `NgModule` that contains all the directives and the given\n * routes, but does not include the `Router` service.\n *\n * @see [Routing and Navigation guide](guide/routing/common-router-tasks) for an\n * overview of how the `Router` service should be used.\n *\n * @publicApi\n */\nlet RouterModule = /*#__PURE__*/(() => {\n class RouterModule {\n constructor(guard) {}\n /**\n * Creates and configures a module with all the router providers and directives.\n * Optionally sets up an application listener to perform an initial navigation.\n *\n * When registering the NgModule at the root, import as follows:\n *\n * ```\n * @NgModule({\n * imports: [RouterModule.forRoot(ROUTES)]\n * })\n * class MyNgModule {}\n * ```\n *\n * @param routes An array of `Route` objects that define the navigation paths for the application.\n * @param config An `ExtraOptions` configuration object that controls how navigation is performed.\n * @return The new `NgModule`.\n *\n */\n static forRoot(routes, config) {\n return {\n ngModule: RouterModule,\n providers: [ROUTER_PROVIDERS, typeof ngDevMode === 'undefined' || ngDevMode ? config?.enableTracing ? withDebugTracing().ɵproviders : [] : [], {\n provide: ROUTES,\n multi: true,\n useValue: routes\n }, {\n provide: ROUTER_FORROOT_GUARD,\n useFactory: provideForRootGuard,\n deps: [[Router, new Optional(), new SkipSelf()]]\n }, config?.errorHandler ? {\n provide: NAVIGATION_ERROR_HANDLER,\n useValue: config.errorHandler\n } : [], {\n provide: ROUTER_CONFIGURATION,\n useValue: config ? config : {}\n }, config?.useHash ? provideHashLocationStrategy() : providePathLocationStrategy(), provideRouterScroller(), config?.preloadingStrategy ? withPreloading(config.preloadingStrategy).ɵproviders : [], config?.initialNavigation ? provideInitialNavigation(config) : [], config?.bindToComponentInputs ? withComponentInputBinding().ɵproviders : [], config?.enableViewTransitions ? withViewTransitions().ɵproviders : [], provideRouterInitializer()]\n };\n }\n /**\n * Creates a module with all the router directives and a provider registering routes,\n * without creating a new Router service.\n * When registering for submodules and lazy-loaded submodules, create the NgModule as follows:\n *\n * ```\n * @NgModule({\n * imports: [RouterModule.forChild(ROUTES)]\n * })\n * class MyNgModule {}\n * ```\n *\n * @param routes An array of `Route` objects that define the navigation paths for the submodule.\n * @return The new NgModule.\n *\n */\n static forChild(routes) {\n return {\n ngModule: RouterModule,\n providers: [{\n provide: ROUTES,\n multi: true,\n useValue: routes\n }]\n };\n }\n static ɵfac = function RouterModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || RouterModule)(i0.ɵɵinject(ROUTER_FORROOT_GUARD, 8));\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: RouterModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n }\n return RouterModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * For internal use by `RouterModule` only. Note that this differs from `withInMemoryRouterScroller`\n * because it reads from the `ExtraOptions` which should not be used in the standalone world.\n */\nfunction provideRouterScroller() {\n return {\n provide: ROUTER_SCROLLER,\n useFactory: () => {\n const viewportScroller = inject(ViewportScroller);\n const zone = inject(NgZone);\n const config = inject(ROUTER_CONFIGURATION);\n const transitions = inject(NavigationTransitions);\n const urlSerializer = inject(UrlSerializer);\n if (config.scrollOffset) {\n viewportScroller.setOffset(config.scrollOffset);\n }\n return new RouterScroller(urlSerializer, transitions, viewportScroller, zone, config);\n }\n };\n}\n// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` should\n// provide hash location directly via `{provide: LocationStrategy, useClass: HashLocationStrategy}`.\nfunction provideHashLocationStrategy() {\n return {\n provide: LocationStrategy,\n useClass: HashLocationStrategy\n };\n}\n// Note: For internal use only with `RouterModule`. Standalone setup via `provideRouter` does not\n// need this at all because `PathLocationStrategy` is the default factory for `LocationStrategy`.\nfunction providePathLocationStrategy() {\n return {\n provide: LocationStrategy,\n useClass: PathLocationStrategy\n };\n}\nfunction provideForRootGuard(router) {\n if ((typeof ngDevMode === 'undefined' || ngDevMode) && router) {\n throw new ɵRuntimeError(4007 /* RuntimeErrorCode.FOR_ROOT_CALLED_TWICE */, `The Router was provided more than once. This can happen if 'forRoot' is used outside of the root injector.` + ` Lazy loaded modules should use RouterModule.forChild() instead.`);\n }\n return 'guarded';\n}\n// Note: For internal use only with `RouterModule`. Standalone router setup with `provideRouter`\n// users call `withXInitialNavigation` directly.\nfunction provideInitialNavigation(config) {\n return [config.initialNavigation === 'disabled' ? withDisabledInitialNavigation().ɵproviders : [], config.initialNavigation === 'enabledBlocking' ? withEnabledBlockingInitialNavigation().ɵproviders : []];\n}\n// TODO(atscott): This should not be in the public API\n/**\n * A DI token for the router initializer that\n * is called after the app is bootstrapped.\n *\n * @publicApi\n */\nconst ROUTER_INITIALIZER = /*#__PURE__*/new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'Router Initializer' : '');\nfunction provideRouterInitializer() {\n return [\n // ROUTER_INITIALIZER token should be removed. It's public API but shouldn't be. We can just\n // have `getBootstrapListener` directly attached to APP_BOOTSTRAP_LISTENER.\n {\n provide: ROUTER_INITIALIZER,\n useFactory: getBootstrapListener\n }, {\n provide: APP_BOOTSTRAP_LISTENER,\n multi: true,\n useExisting: ROUTER_INITIALIZER\n }];\n}\n\n/**\n * Maps an array of injectable classes with canMatch functions to an array of equivalent\n * `CanMatchFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanMatch(providers) {\n return providers.map(provider => (...params) => inject(provider).canMatch(...params));\n}\n/**\n * Maps an array of injectable classes with canActivate functions to an array of equivalent\n * `CanActivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanActivate(providers) {\n return providers.map(provider => (...params) => inject(provider).canActivate(...params));\n}\n/**\n * Maps an array of injectable classes with canActivateChild functions to an array of equivalent\n * `CanActivateChildFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanActivateChild(providers) {\n return providers.map(provider => (...params) => inject(provider).canActivateChild(...params));\n}\n/**\n * Maps an array of injectable classes with canDeactivate functions to an array of equivalent\n * `CanDeactivateFn` for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='CanActivate'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToCanDeactivate(providers) {\n return providers.map(provider => (...params) => inject(provider).canDeactivate(...params));\n}\n/**\n * Maps an injectable class with a resolve function to an equivalent `ResolveFn`\n * for use in a `Route` definition.\n *\n * Usage {@example router/utils/functional_guards.ts region='Resolve'}\n *\n * @publicApi\n * @see {@link Route}\n */\nfunction mapToResolve(provider) {\n return (...params) => inject(provider).resolve(...params);\n}\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of the router package.\n */\n/**\n * @publicApi\n */\nconst VERSION = /*#__PURE__*/new Version('19.0.4');\nfunction getLoadedRoutes(route) {\n return route._loadedRoutes;\n}\n/*#__PURE__*/ɵpublishExternalGlobalUtil('ɵgetLoadedRoutes', getLoadedRoutes);\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n// This file only reexports content of the `src` folder. Keep it that way.\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ActivatedRoute, ActivatedRouteSnapshot, ActivationEnd, ActivationStart, BaseRouteReuseStrategy, ChildActivationEnd, ChildActivationStart, ChildrenOutletContexts, DefaultTitleStrategy, DefaultUrlSerializer, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationCancellationCode, NavigationEnd, NavigationError, NavigationSkipped, NavigationSkippedCode, NavigationStart, NoPreloading, OutletContext, PRIMARY_OUTLET, PreloadAllModules, PreloadingStrategy, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, ROUTER_OUTLET_DATA, ROUTES, RedirectCommand, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouteReuseStrategy, Router, RouterEvent, RouterLink, RouterLinkActive, RouterLink as RouterLinkWithHref, RouterModule, RouterOutlet, RouterPreloader, RouterState, RouterStateSnapshot, RoutesRecognized, Scroll, TitleStrategy, UrlHandlingStrategy, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, convertToParamMap, createUrlTreeFromSnapshot, defaultUrlMatcher, mapToCanActivate, mapToCanActivateChild, mapToCanDeactivate, mapToCanMatch, mapToResolve, provideRouter, provideRoutes, withComponentInputBinding, withDebugTracing, withDisabledInitialNavigation, withEnabledBlockingInitialNavigation, withHashLocation, withInMemoryScrolling, withNavigationErrorHandler, withPreloading, withRouterConfig, withViewTransitions, ɵEmptyOutletComponent, ROUTER_PROVIDERS as ɵROUTER_PROVIDERS, afterNextNavigation as ɵafterNextNavigation, loadChildren as ɵloadChildren };\n","import * as i0 from '@angular/core';\nimport { inject, Directive, Input } from '@angular/core';\nimport { TUI_PLATFORM } from '@taiga-ui/cdk/tokens';\nlet TuiPlatform = /*#__PURE__*/(() => {\n class TuiPlatform {\n constructor() {\n this.tuiPlatform = inject(TUI_PLATFORM, {\n skipSelf: true\n });\n }\n static {\n this.ɵfac = function TuiPlatform_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiPlatform)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TuiPlatform,\n selectors: [[\"\", \"tuiPlatform\", \"\"]],\n hostVars: 1,\n hostBindings: function TuiPlatform_HostBindings(rf, ctx) {\n if (rf & 2) {\n i0.ɵɵattribute(\"data-platform\", ctx.tuiPlatform);\n }\n },\n inputs: {\n tuiPlatform: \"tuiPlatform\"\n },\n features: [i0.ɵɵProvidersFeature([{\n provide: TUI_PLATFORM,\n useFactory: () => inject(TuiPlatform).tuiPlatform\n }])]\n });\n }\n }\n return TuiPlatform;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiPlatform };\n","import * as i0 from '@angular/core';\nimport { inject, Injectable } from '@angular/core';\nimport { WA_WINDOW, WINDOW } from '@ng-web-apis/common';\nimport { Observable, fromEvent, startWith, map, shareReplay, merge, filter, EMPTY } from 'rxjs';\nlet ScreenOrientationService = /*#__PURE__*/(() => {\n class ScreenOrientationService extends Observable {\n win = inject(WA_WINDOW);\n stream$ = (this.isModern ? fromEvent(this.win.screen.orientation, 'change').pipe(startWith(null), map(() =>\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Screen/orientation\n * The type read-only property of the ScreenOrientation interface returns the document's current orientation type,\n * one of \"portrait-primary\", \"portrait-secondary\", \"landscape-primary\", or \"landscape-secondary\".\n *\n * Browser compatibility:\n * Safari 16.4+, Chrome 38+, Firefox 43+\n */\n this.win.screen.orientation.type)) : fromEvent(this.win, 'orientationchange').pipe(startWith(null), map(() => {\n /**\n * https://developer.mozilla.org/en-US/docs/Web/API/Window/orientation\n * Its only possible values are -90, 0, 90, and 180.\n * Positive values are counterclockwise; negative values are clockwise.\n */\n const angle = parseInt(this.win.orientation, 10);\n switch (angle) {\n case -90:\n return 'landscape-secondary';\n case 180:\n return 'portrait-secondary';\n case 90:\n return 'landscape-primary';\n case 0:\n default:\n return 'portrait-primary';\n }\n }))).pipe(shareReplay({\n bufferSize: 1,\n refCount: true\n }));\n constructor() {\n super(subscriber => this.stream$.subscribe(subscriber));\n }\n get isModern() {\n return !!this.win?.screen?.orientation;\n }\n static ɵfac = function ScreenOrientationService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ScreenOrientationService)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ScreenOrientationService,\n factory: ScreenOrientationService.ɵfac,\n providedIn: 'root'\n });\n }\n return ScreenOrientationService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ViewportService = /*#__PURE__*/(() => {\n class ViewportService extends Observable {\n visualViewport = inject(WINDOW).visualViewport;\n stream$ = this.visualViewport ? merge(fromEvent(this.visualViewport, 'resize'), fromEvent(this.visualViewport, 'scroll'), fromEvent(this.visualViewport, 'scrollend')).pipe(startWith(null), map(() => this.visualViewport), filter(Boolean), shareReplay({\n bufferSize: 1,\n refCount: true\n })) : EMPTY;\n constructor() {\n super(subscriber => this.stream$.subscribe(subscriber));\n }\n static ɵfac = function ViewportService_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || ViewportService)();\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: ViewportService,\n factory: ViewportService.ɵfac,\n providedIn: 'root'\n });\n }\n return ViewportService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { ScreenOrientationService, ViewportService };\n","import * as i0 from '@angular/core';\nimport { inject, Directive } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { WA_WINDOW } from '@ng-web-apis/common';\nimport { ViewportService } from '@ng-web-apis/screen-orientation';\nimport { tuiInjectElement, tuiPx } from '@taiga-ui/cdk/utils';\nlet TuiVisualViewport = /*#__PURE__*/(() => {\n class TuiVisualViewport {\n constructor() {\n this.w = inject(WA_WINDOW);\n this.style = tuiInjectElement().style;\n this.$ = inject(ViewportService).pipe(takeUntilDestroyed()).subscribe(({\n offsetLeft,\n offsetTop,\n height,\n width,\n scale\n }) => {\n this.style.setProperty('--tui-viewport-x', tuiPx(offsetLeft));\n this.style.setProperty('--tui-viewport-y', tuiPx(offsetTop));\n this.style.setProperty('--tui-viewport-height', tuiPx(height));\n this.style.setProperty('--tui-viewport-width', tuiPx(width));\n this.style.setProperty('--tui-viewport-scale', String(scale));\n this.style.setProperty('--tui-viewport-vh', tuiPx(this.w.innerHeight / 100));\n this.style.setProperty('--tui-viewport-vw', tuiPx(this.w.innerWidth / 100));\n });\n }\n static {\n this.ɵfac = function TuiVisualViewport_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiVisualViewport)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TuiVisualViewport,\n selectors: [[\"\", \"tuiVisualViewport\", \"\"]]\n });\n }\n }\n return TuiVisualViewport;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiVisualViewport };\n","import * as i0 from '@angular/core';\nimport { Injectable, inject, TemplateRef, Directive, Input } from '@angular/core';\nimport { TuiPortalService } from '@taiga-ui/cdk/classes';\nlet TuiPopupService = /*#__PURE__*/(() => {\n class TuiPopupService extends TuiPortalService {\n static {\n this.ɵfac = /* @__PURE__ */(() => {\n let ɵTuiPopupService_BaseFactory;\n return function TuiPopupService_Factory(__ngFactoryType__) {\n return (ɵTuiPopupService_BaseFactory || (ɵTuiPopupService_BaseFactory = i0.ɵɵgetInheritedFactory(TuiPopupService)))(__ngFactoryType__ || TuiPopupService);\n };\n })();\n }\n static {\n this.ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: TuiPopupService,\n factory: TuiPopupService.ɵfac,\n providedIn: 'root'\n });\n }\n }\n return TuiPopupService;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet TuiPopup = /*#__PURE__*/(() => {\n class TuiPopup {\n constructor() {\n this.template = inject(TemplateRef);\n this.service = inject(TuiPopupService);\n }\n set tuiPopup(show) {\n this.viewRef?.destroy();\n if (show) {\n this.viewRef = this.service.addTemplate(this.template);\n }\n }\n ngOnDestroy() {\n this.viewRef?.destroy();\n }\n static {\n this.ɵfac = function TuiPopup_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiPopup)();\n };\n }\n static {\n this.ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n type: TuiPopup,\n selectors: [[\"ng-template\", \"tuiPopup\", \"\"]],\n inputs: {\n tuiPopup: \"tuiPopup\"\n }\n });\n }\n }\n return TuiPopup;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiPopup, TuiPopupService };\n","import { DOCUMENT, NgIf } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { inject, Component, ViewEncapsulation, ChangeDetectionStrategy } from '@angular/core';\nimport { toSignal } from '@angular/core/rxjs-interop';\nimport { EVENT_MANAGER_PLUGINS } from '@angular/platform-browser';\nimport { TuiPortals, tuiAsPortal } from '@taiga-ui/cdk/classes';\nimport { TUI_VERSION } from '@taiga-ui/cdk/constants';\nimport * as i1 from '@taiga-ui/cdk/directives/platform';\nimport { TuiPlatform } from '@taiga-ui/cdk/directives/platform';\nimport * as i2 from '@taiga-ui/cdk/directives/visual-viewport';\nimport { TuiVisualViewport } from '@taiga-ui/cdk/directives/visual-viewport';\nimport { tuiWatch } from '@taiga-ui/cdk/observables';\nimport { TUI_IS_MOBILE } from '@taiga-ui/cdk/tokens';\nimport { TuiAlerts } from '@taiga-ui/core/components/alert';\nimport { TuiDialogs } from '@taiga-ui/core/components/dialog';\nimport { TUI_SCROLLBAR_OPTIONS, TuiScrollControls } from '@taiga-ui/core/components/scrollbar';\nimport { TuiDropdowns } from '@taiga-ui/core/directives/dropdown';\nimport { TuiHints } from '@taiga-ui/core/directives/hint';\nimport { TuiPopupService } from '@taiga-ui/core/directives/popup';\nimport { TuiBreakpointService } from '@taiga-ui/core/services';\nimport { TUI_REDUCED_MOTION, TUI_ANIMATIONS_SPEED, TUI_THEME } from '@taiga-ui/core/tokens';\nimport { tuiGetDuration } from '@taiga-ui/core/utils';\nimport { PreventEventPlugin } from '@taiga-ui/event-plugins';\nimport { map } from 'rxjs';\n\n/// \n/// \nconst _c0 = [\"*\", [[\"tuiOverContent\"]], [[\"tuiOverDialogs\"]], [[\"tuiOverAlerts\"]], [[\"tuiOverDropdowns\"]], [[\"tuiOverHints\"]]];\nconst _c1 = [\"*\", \"tuiOverContent\", \"tuiOverDialogs\", \"tuiOverAlerts\", \"tuiOverDropdowns\", \"tuiOverHints\"];\nfunction TuiRoot_tui_scroll_controls_2_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"tui-scroll-controls\", 3);\n }\n}\nlet TuiRoot = /*#__PURE__*/(() => {\n class TuiRoot extends TuiPortals {\n constructor() {\n super();\n this.reducedMotion = inject(TUI_REDUCED_MOTION);\n this.duration = tuiGetDuration(inject(TUI_ANIMATIONS_SPEED));\n this.isMobileRes = toSignal(inject(TuiBreakpointService).pipe(map(breakpoint => breakpoint === 'mobile'), tuiWatch()), {\n initialValue: false\n });\n this.nativeScrollbar = inject(TUI_SCROLLBAR_OPTIONS).mode === 'native';\n this.scrollbars = !(this.nativeScrollbar || inject(TUI_IS_MOBILE));\n inject(DOCUMENT).documentElement.setAttribute('data-tui-theme', inject(TUI_THEME).toLowerCase());\n if (!this.nativeScrollbar) {\n inject(DOCUMENT).defaultView?.document.documentElement.classList.add('tui-zero-scrollbar');\n }\n ngDevMode && console.assert(!!inject(EVENT_MANAGER_PLUGINS).find(plugin => plugin instanceof PreventEventPlugin), 'NG_EVENT_PLUGINS is missing from global providers');\n }\n static {\n this.ɵfac = function TuiRoot_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || TuiRoot)();\n };\n }\n static {\n this.ɵcmp = /* @__PURE__ */i0.ɵɵdefineComponent({\n type: TuiRoot,\n selectors: [[\"tui-root\"]],\n hostAttrs: [\"data-tui-version\", \"4.18.0\"],\n hostVars: 6,\n hostBindings: function TuiRoot_HostBindings(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵlistener(\"touchstart.passive.silent\", function TuiRoot_touchstart_passive_silent_HostBindingHandler() {\n return 0;\n });\n }\n if (rf & 2) {\n i0.ɵɵstyleProp(\"--tui-duration\", ctx.duration, \"ms\")(\"--tui-scroll-behavior\", ctx.reducedMotion ? \"auto\" : \"smooth\");\n i0.ɵɵclassProp(\"_mobile\", ctx.isMobileRes());\n }\n },\n features: [i0.ɵɵProvidersFeature([], [tuiAsPortal(TuiPopupService)]), i0.ɵɵHostDirectivesFeature([i1.TuiPlatform, i2.TuiVisualViewport]), i0.ɵɵInheritDefinitionFeature],\n ngContentSelectors: _c1,\n decls: 14,\n vars: 1,\n consts: [[\"viewContainer\", \"\"], [1, \"t-root-content\"], [\"class\", \"t-root-scrollbar\", 4, \"ngIf\"], [1, \"t-root-scrollbar\"]],\n template: function TuiRoot_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵprojectionDef(_c0);\n i0.ɵɵelementStart(0, \"div\", 1);\n i0.ɵɵprojection(1);\n i0.ɵɵelementEnd();\n i0.ɵɵtemplate(2, TuiRoot_tui_scroll_controls_2_Template, 1, 0, \"tui-scroll-controls\", 2);\n i0.ɵɵelementContainer(3, null, 0);\n i0.ɵɵprojection(5, 1);\n i0.ɵɵelement(6, \"tui-dialogs\");\n i0.ɵɵprojection(7, 2);\n i0.ɵɵelement(8, \"tui-alerts\");\n i0.ɵɵprojection(9, 3);\n i0.ɵɵelement(10, \"tui-dropdowns\");\n i0.ɵɵprojection(11, 4);\n i0.ɵɵelement(12, \"tui-hints\");\n i0.ɵɵprojection(13, 5);\n }\n if (rf & 2) {\n i0.ɵɵadvance(2);\n i0.ɵɵproperty(\"ngIf\", ctx.scrollbars);\n }\n },\n dependencies: [NgIf, TuiAlerts, TuiDialogs, TuiDropdowns, TuiHints, TuiScrollControls],\n styles: [\"@keyframes tuiPresent{to{content:\\\"\\\"}}@keyframes tuiSkeletonVibe{to{opacity:.5}}.tui-zero-scrollbar{scrollbar-width:none;-ms-overflow-style:none}.tui-zero-scrollbar::-webkit-scrollbar,.tui-zero-scrollbar::-webkit-scrollbar-thumb{display:none}body,input{margin:0}tui-root{position:relative;display:block;font:var(--tui-font-text-s);color:var(--tui-text-primary);flex:1;border-image:conic-gradient(var(--tui-background-base) 0 0) fill 0/0/0 0 100vh 0;-webkit-tap-highlight-color:transparent}tui-root>.t-root-scrollbar{position:fixed;top:0;left:0;bottom:0;right:0;z-index:0;display:none;margin:0}[data-tui-theme] tui-root>.t-root-scrollbar{display:block}.t-root-content{position:relative;top:var(--t-root-top);block-size:100%;isolation:isolate}.t-root-content>*{--t-root-top: 0}[tuiDropdownButton][tuiDropdownButton]{display:none}\\n\"],\n encapsulation: 2\n });\n }\n }\n return TuiRoot;\n})();\n(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { TuiRoot };\n","import {ChangeDetectionStrategy, Component, ViewEncapsulation} from '@angular/core';\nimport {RouterOutlet} from '@angular/router';\nimport {TuiRoot} from '@taiga-ui/core';\n\n@Component({\n standalone: true,\n selector: 'app-root',\n imports: [RouterOutlet, TuiRoot],\n templateUrl: './app.component.html',\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class AppComponent {}\n","\n \n\n \n \n \n \n \n\n","/**\n * @license Angular v19.0.4\n * (c) 2010-2024 Google LLC. https://angular.io/\n * License: MIT\n */\n\nimport * as i0 from '@angular/core';\nimport { Injectable, Inject, RendererFactory2, NgZone, ANIMATION_MODULE_TYPE, NgModule, ɵperformanceMarkFeature } from '@angular/core';\nexport { ANIMATION_MODULE_TYPE } from '@angular/core';\nimport { ɵDomRendererFactory2, BrowserModule } from '@angular/platform-browser';\nimport * as i1 from '@angular/animations/browser';\nimport { ɵAnimationEngine, ɵWebAnimationsStyleNormalizer, ɵAnimationRendererFactory, ɵAnimationStyleNormalizer, AnimationDriver, ɵWebAnimationsDriver, NoopAnimationDriver } from '@angular/animations/browser';\nimport { DOCUMENT } from '@angular/common';\nlet InjectableAnimationEngine = /*#__PURE__*/(() => {\n class InjectableAnimationEngine extends ɵAnimationEngine {\n // The `ApplicationRef` is injected here explicitly to force the dependency ordering.\n // Since the `ApplicationRef` should be created earlier before the `AnimationEngine`, they\n // both have `ngOnDestroy` hooks and `flush()` must be called after all views are destroyed.\n constructor(doc, driver, normalizer) {\n super(doc, driver, normalizer);\n }\n ngOnDestroy() {\n this.flush();\n }\n static ɵfac = function InjectableAnimationEngine_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || InjectableAnimationEngine)(i0.ɵɵinject(DOCUMENT), i0.ɵɵinject(i1.AnimationDriver), i0.ɵɵinject(i1.ɵAnimationStyleNormalizer));\n };\n static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n token: InjectableAnimationEngine,\n factory: InjectableAnimationEngine.ɵfac\n });\n }\n return InjectableAnimationEngine;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nfunction instantiateDefaultStyleNormalizer() {\n return new ɵWebAnimationsStyleNormalizer();\n}\nfunction instantiateRendererFactory(renderer, engine, zone) {\n return new ɵAnimationRendererFactory(renderer, engine, zone);\n}\nconst SHARED_ANIMATION_PROVIDERS = [{\n provide: ɵAnimationStyleNormalizer,\n useFactory: instantiateDefaultStyleNormalizer\n}, {\n provide: ɵAnimationEngine,\n useClass: InjectableAnimationEngine\n}, {\n provide: RendererFactory2,\n useFactory: instantiateRendererFactory,\n deps: [ɵDomRendererFactory2, ɵAnimationEngine, NgZone]\n}];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserModule.\n */\nconst BROWSER_ANIMATIONS_PROVIDERS = [{\n provide: AnimationDriver,\n useFactory: () => new ɵWebAnimationsDriver()\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'BrowserAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserTestingModule.\n */\nconst BROWSER_NOOP_ANIMATIONS_PROVIDERS = [{\n provide: AnimationDriver,\n useClass: NoopAnimationDriver\n}, {\n provide: ANIMATION_MODULE_TYPE,\n useValue: 'NoopAnimations'\n}, ...SHARED_ANIMATION_PROVIDERS];\n\n/**\n * Exports `BrowserModule` with additional dependency-injection providers\n * for use with animations. See [Animations](guide/animations).\n * @publicApi\n */\nlet BrowserAnimationsModule = /*#__PURE__*/(() => {\n class BrowserAnimationsModule {\n /**\n * Configures the module based on the specified object.\n *\n * @param config Object used to configure the behavior of the `BrowserAnimationsModule`.\n * @see {@link BrowserAnimationsModuleConfig}\n *\n * @usageNotes\n * When registering the `BrowserAnimationsModule`, you can use the `withConfig`\n * function as follows:\n * ```\n * @NgModule({\n * imports: [BrowserAnimationsModule.withConfig(config)]\n * })\n * class MyNgModule {}\n * ```\n */\n static withConfig(config) {\n return {\n ngModule: BrowserAnimationsModule,\n providers: config.disableAnimations ? BROWSER_NOOP_ANIMATIONS_PROVIDERS : BROWSER_ANIMATIONS_PROVIDERS\n };\n }\n static ɵfac = function BrowserAnimationsModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || BrowserAnimationsModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: BrowserAnimationsModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n return BrowserAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of dependency-injection providers\n * to enable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to enable animations in an application\n * bootstrapped using the `bootstrapApplication` function. In this scenario there\n * is no need to import the `BrowserAnimationsModule` NgModule at all, just add\n * providers returned by this function to the `providers` list as show below.\n *\n * ```ts\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideAnimations() {\n ɵperformanceMarkFeature('NgEagerAnimations');\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideAnimations` call results in app code.\n return [...BROWSER_ANIMATIONS_PROVIDERS];\n}\n/**\n * A null player that must be imported to allow disabling of animations.\n * @publicApi\n */\nlet NoopAnimationsModule = /*#__PURE__*/(() => {\n class NoopAnimationsModule {\n static ɵfac = function NoopAnimationsModule_Factory(__ngFactoryType__) {\n return new (__ngFactoryType__ || NoopAnimationsModule)();\n };\n static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n type: NoopAnimationsModule\n });\n static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({\n providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,\n imports: [BrowserModule]\n });\n }\n return NoopAnimationsModule;\n})();\n/*#__PURE__*/(() => {\n (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n/**\n * Returns the set of dependency-injection providers\n * to disable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to bootstrap an application using\n * the `bootstrapApplication` function, but you need to disable animations\n * (for example, when running tests).\n *\n * ```ts\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideNoopAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n */\nfunction provideNoopAnimations() {\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideNoopAnimations` call results in app code.\n return [...BROWSER_NOOP_ANIMATIONS_PROVIDERS];\n}\n\n/**\n * @module\n * @description\n * Entry point for all animation APIs of the animation browser package.\n */\n\n/**\n * @module\n * @description\n * Entry point for all public APIs of this package.\n */\n\n// This file is not used to build this module. It is only used during editing\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { BrowserAnimationsModule, NoopAnimationsModule, provideAnimations, provideNoopAnimations, InjectableAnimationEngine as ɵInjectableAnimationEngine };\n","import type {ApplicationConfig, Injector} from '@angular/core';\nimport {\n importProvidersFrom,\n INJECTOR,\n provideExperimentalZonelessChangeDetection,\n} from '@angular/core';\nimport {provideClientHydration} from '@angular/platform-browser';\nimport {provideAnimations} from '@angular/platform-browser/animations';\nimport {provideRouter} from '@angular/router';\nimport {NgDompurifySanitizer} from '@taiga-ui/dompurify';\nimport {TUI_EDITOR_DEFAULT_EXTENSIONS, TUI_EDITOR_EXTENSIONS} from '@taiga-ui/editor';\nimport {NG_EVENT_PLUGINS} from '@taiga-ui/event-plugins';\nimport {TUI_SANITIZER} from '@taiga-ui/legacy';\n\nexport const appConfig: ApplicationConfig = {\n providers: [\n provideExperimentalZonelessChangeDetection(),\n provideClientHydration(),\n provideAnimations(),\n provideRouter([\n {\n path: '',\n pathMatch: 'full',\n loadComponent: async () => import('./home/home.component'),\n },\n ]),\n importProvidersFrom(),\n {\n provide: TUI_EDITOR_EXTENSIONS,\n deps: [INJECTOR],\n useFactory: (injector: Injector) => [\n ...TUI_EDITOR_DEFAULT_EXTENSIONS,\n import('@taiga-ui/editor').then(({tuiCreateImageEditorExtension}) =>\n tuiCreateImageEditorExtension({injector}),\n ),\n ],\n },\n {\n provide: TUI_SANITIZER,\n useClass: NgDompurifySanitizer,\n },\n NG_EVENT_PLUGINS,\n ],\n};\n","export const environment = {\n production: false,\n};\n","import {enableProdMode} from '@angular/core';\nimport {bootstrapApplication} from '@angular/platform-browser';\n\nimport {AppComponent} from './app/app.component';\nimport {appConfig} from './app/app.config';\nimport {environment} from './environments/environment';\n\nif (environment.production) {\n enableProdMode();\n}\n\nbootstrapApplication(AppComponent, appConfig).catch((err: unknown) => console.error(err));\n"],"mappings":"8qCAmBA,IAAMA,EAAiB,UAMjBC,GAA+B,OAAO,YAAY,EAClDC,GAAN,KAAkB,CAEhB,YAAYC,EAAQ,CADpBC,EAAA,eAEE,KAAK,OAASD,GAAU,CAAC,CAC3B,CACA,IAAIE,EAAM,CACR,OAAO,OAAO,UAAU,eAAe,KAAK,KAAK,OAAQA,CAAI,CAC/D,CACA,IAAIA,EAAM,CACR,GAAI,KAAK,IAAIA,CAAI,EAAG,CAClB,IAAMC,EAAI,KAAK,OAAOD,CAAI,EAC1B,OAAO,MAAM,QAAQC,CAAC,EAAIA,EAAE,CAAC,EAAIA,CACnC,CACA,OAAO,IACT,CACA,OAAOD,EAAM,CACX,GAAI,KAAK,IAAIA,CAAI,EAAG,CAClB,IAAMC,EAAI,KAAK,OAAOD,CAAI,EAC1B,OAAO,MAAM,QAAQC,CAAC,EAAIA,EAAI,CAACA,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iB,EACjBC,GAAc,CACV,CACIC,KAAM,GACNC,UAAW,OACXC,cAAe,SAAY,OAAO,qBAAuB,EAC5D,CACJ,EACDC,GAAmB,EACnB,CACIC,QAASC,GACTC,KAAM,CAACC,EAAQ,EACfC,WAAaC,GAAuB,CAChC,GAAGC,GACH,OAAO,qBAAkB,EAAEC,KAAK,CAAC,CAACC,8BAAAA,CAA6B,IAC3DA,EAA8B,CAACH,SAAAA,CAAQ,CAAC,CAAC,CAC5C,GAGT,CACIL,QAASS,GACTC,SAAUC,IAEdC,EAAgB,GCzCjB,IAAMC,GAAc,CACvBC,WAAY,ICMZC,GAAYC,YACZC,OAGJC,GAAqBC,GAAcC,EAAS,EAAEC,MAAOC,GAAiBC,QAAQC,MAAMF,CAAG,CAAC","names":["PRIMARY_OUTLET","RouteTitleKey","ParamsAsMap","params","__publicField","name","v","convertToParamMap","defaultUrlMatcher","segments","segmentGroup","route","parts","posParams","index","part","segment","shallowEqualArrays","a","b","shallowEqual","k1","getDataKeys","k2","key","i","equalArraysOrString","obj","aSorted","bSorted","val","last","wrapIntoObservable","value","isObservable","isPromise","from","of","pathCompareMap","equalSegmentGroups","containsSegmentGroup","paramCompareMap","equalParams","containsParams","containsTree","container","containee","options","matrixParams","equalPath","matrixParamsMatch","c","containsSegmentGroupHelper","containeePaths","current","next","containerPaths","containeeSegment","UrlTree","root","UrlSegmentGroup","queryParams","fragment","DEFAULT_SERIALIZER","children","serializePaths","UrlSegment","path","parameters","serializePath","equalSegments","as","bs","mapChildrenIntoArray","fn","res","childOutlet","child","UrlSerializer","_UrlSerializer","__ngFactoryType__","ɵɵdefineInjectable","DefaultUrlSerializer","url","p","UrlParser","tree","serializeSegment","query","serializeQueryParams","encodeUriFragment","primary","k","encodeUriString","s","encodeUriQuery","encodeUriSegment","decode","decodeQuery","serializeMatrixParams","strParams","SEGMENT_RE","matchSegments","str","match","MATRIX_PARAM_SEGMENT_RE","matchMatrixKeySegments","QUERY_PARAM_RE","matchQueryParams","QUERY_PARAM_VALUE_RE","matchUrlQueryParamValue","RuntimeError","valueMatch","decodedKey","decodedVal","currentVal","allowPrimary","outletName","createRoot","rootCandidate","squashSegmentGroup","newChildren","childCandidate","grandChildOutlet","grandChild","mergeTrivialChildren","isUrlTree","createUrlTreeFromSnapshot","relativeTo","commands","relativeToUrlSegmentGroup","createSegmentGroupFromRoute","createUrlTreeFromSegmentGroup","targetGroup","createSegmentGroupFromRouteRecursive","currentRoute","childOutlets","childSnapshot","rootSegmentGroup","nav","computeNavigation","position","findStartingPositionForTargetGroup","newSegmentGroup","updateSegmentGroupChildren","updateSegmentGroup","isMatrixParams","command","isCommandWithOutlets","oldRoot","oldSegmentGroup","qp","replaceSegment","newRoot","oldSegment","newSegment","Navigation","isAbsolute","numberOfDoubleDots","cmdWithOutlet","cmd","cmdIdx","outlets","urlPart","partIndex","Position","processChildren","target","modifier","createPositionApplyingDoubleDots","group","g","ci","dd","getOutlets","startIndex","m","prefixedWith","slicedCommands","createNewSegmentGroup","childrenOfEmptyChild","outlet","currentCommandIndex","currentPathIndex","noMatch","curr","compare","paths","createNewSegmentChildren","stringify","IMPERATIVE_NAVIGATION","EventType","RouterEvent","id","NavigationStart","navigationTrigger","restoredState","NavigationEnd","urlAfterRedirects","NavigationCancellationCode","NavigationSkippedCode","NavigationCancel","reason","code","NavigationSkipped","NavigationError","error","RoutesRecognized","state","GuardsCheckStart","GuardsCheckEnd","shouldActivate","ResolveStart","ResolveEnd","RouteConfigLoadStart","RouteConfigLoadEnd","ChildActivationStart","snapshot","ChildActivationEnd","ActivationStart","ActivationEnd","BeforeActivateRoutes","RedirectRequest","url","navigationBehaviorOptions","__publicField","getOrCreateRouteInjectorIfNeeded","route","currentInjector","createEnvironmentInjector","getOutlet","route","PRIMARY_OUTLET","sortByMatchingOutlets","routes","outletName","sortedConfig","r","getClosestRouteInjector","snapshot","_a","s","OutletContext","rootInjector","__publicField","ChildrenOutletContexts","_ChildrenOutletContexts","childName","outlet","context","contexts","__ngFactoryType__","ɵɵinject","EnvironmentInjector","ɵɵdefineInjectable","Tree","root","p","n","findNode","t","findPath","c","cc","value","node","child","path","TreeNode","children","nodeChildrenAsMap","map","RouterState","setRouterState","createEmptyState","rootComponent","createEmptyStateSnapshot","emptyUrl","BehaviorSubject","UrlSegment","emptyParams","emptyData","emptyQueryParams","fragment","activated","ActivatedRoute","ActivatedRouteSnapshot","RouterStateSnapshot","urlSubject","paramsSubject","queryParamsSubject","fragmentSubject","dataSubject","component","futureSnapshot","RouteTitleKey","of","convertToParamMap","getInherited","parent","paramsInheritanceStrategy","inherited","routeConfig","__spreadValues","hasStaticTitle","url","params","queryParams","data","resolve","segment","matched","serializeNode","state","advanceActivatedRoute","currentSnapshot","nextSnapshot","shallowEqual","shallowEqualArrays","equalParamsAndUrlSegments","a","b","equalUrlParams","equalSegments","parentsMismatch","config","ROUTER_OUTLET_DATA","InjectionToken","RouterOutlet","_RouterOutlet","EventEmitter","input","inject","ViewContainerRef","ChangeDetectorRef","INPUT_BINDER","changes","firstChange","previousValue","RuntimeError","cmp","ref","activatedRoute","environmentInjector","location","childContexts","injector","OutletInjector","ɵɵdefineDirective","ɵɵNgOnChangesFeature","_OutletInjector","outletData","parentInjector","token","notFoundValue","createRouterState","routeReuseStrategy","curr","prevState","root","createNode","RouterState","value","children","createOrReuseChildren","TreeNode","detachedRouteHandle","tree","c","createActivatedRoute","child","p","ActivatedRoute","BehaviorSubject","RedirectCommand","redirectTo","navigationBehaviorOptions","__publicField","NAVIGATION_CANCELING_ERROR","redirectingNavigationError","urlSerializer","redirect","isUrlTree","error","navigationCancelingError","NavigationCancellationCode","message","code","isRedirectingNavigationCancelingError","isNavigationCancelingError","activateRoutes","rootContexts","routeReuseStrategy","forwardEvent","inputBindingEnabled","map","t","ActivateRoutes","futureState","currState","__publicField","parentContexts","futureRoot","currRoot","advanceActivatedRoute","futureNode","currNode","contexts","children","nodeChildrenAsMap","futureChild","childOutletName","v","parentContext","future","curr","context","route","treeNode","componentRef","c","ActivationEnd","ChildActivationEnd","stored","CanActivate","path","CanDeactivate","component","getAllRouteGuards","getChildRouteGuards","getCanActivateChild","p","canActivateChild","getTokenOrFunctionIdentity","tokenOrFunction","injector","NOT_FOUND","result","isInjectable","futurePath","checks","prevChildren","getRouteGuards","k","deactivateRouteAndItsChildren","shouldRun","shouldRunGuardsAndResolvers","mode","equalPath","shallowEqual","equalParamsAndUrlSegments","childName","node","isFunction","isBoolean","isCanLoad","guard","isCanActivate","isCanActivateChild","isCanDeactivate","isCanMatch","isEmptyError","EmptyError","INITIAL_VALUE","prioritizedGuardValue","switchMap","obs","combineLatest","o","take","startWith","results","isRedirect","filter","item","val","isUrlTree","RedirectCommand","checkGuards","mergeMap","targetSnapshot","currentSnapshot","canActivateChecks","canDeactivateChecks","of","__spreadProps","__spreadValues","runCanDeactivateChecks","canDeactivate","runCanActivateChecks","guardsResult","futureRSS","currRSS","from","check","runCanDeactivate","first","futureSnapshot","concatMap","concat","fireChildActivationStart","fireActivationStart","runCanActivateChild","runCanActivate","snapshot","ActivationStart","ChildActivationStart","futureARS","canActivate","canActivateObservables","defer","closestInjector","getClosestRouteInjector","guardVal","runInInjectionContext","wrapIntoObservable","canActivateChildGuardsMapped","_","d","guardsMapped","currARS","canDeactivateObservables","runCanLoadGuards","segments","urlSerializer","canLoad","canLoadObservables","injectionToken","redirectIfUrlTree","pipe","tap","redirectingNavigationError","runCanMatchGuards","canMatch","canMatchObservables","NoMatch","segmentGroup","AbsoluteRedirect","urlTree","noMatch$1","throwError","namedOutletsRedirect","redirectTo","throwError","RuntimeError","canLoadFails","route","navigationCancelingError","NavigationCancellationCode","ApplyRedirects","urlSerializer","urlTree","__publicField","res","c","of","PRIMARY_OUTLET","segments","posParams","currentSnapshot","injector","redirectToFn","queryParams","fragment","routeConfig","url","outlet","params","data","title","newRedirect","runInInjectionContext","UrlTree","AbsoluteRedirect","newTree","newRoot","redirectToParams","actualParams","k","v","sourceName","group","updatedSegments","children","name","child","UrlSegmentGroup","redirectToSegments","actualSegments","s","redirectToUrlSegment","pos","idx","noMatch","matchWithChecks","segmentGroup","result","match","getOrCreateRouteInjectorIfNeeded","runCanMatchGuards","map","__spreadValues","createWildcardMatchResult","defaultUrlMatcher","parameters","last","split","consumedSegments","slicedSegments","config","containsEmptyPathMatchesWithNamedOutlets","createChildrenForEmptyPaths","containsEmptyPathMatches","addEmptyPathsToChildrenIfNeeded","routes","r","emptyPathMatch","getOutlet","primarySegment","noLeftoversInUrl","NoLeftoversInUrl","recognize$1","configLoader","rootComponentType","paramsInheritanceStrategy","Recognizer","MAX_ALLOWED_REDIRECTS","e","rootSegmentGroup","rootSnapshot","rootNode","TreeNode","routeState","RouterStateSnapshot","tree","createUrlTreeFromSnapshot","ActivatedRouteSnapshot","catchError","NoMatch","parentRoute","childOutlets","from","concatMap","childOutlet","sortedConfig","sortByMatchingOutlets","scan","outletChildren","defaultIfEmpty","mergeMap","noMatch$1","mergedChildren","mergeEmptyPathMatches","sortActivatedRouteSnapshots","allowRedirects","first","x","isEmptyError","rawSegment","matched","positionalParamSegments","remainingSegments","getData","getResolve","inherited","getInherited","newSegments","matchResult","switchMap","childConfig","childInjector","snapshot","matchedOnOutlet","runCanLoadGuards","shouldLoadResult","tap","cfg","nodes","a","b","hasEmptyPathConfig","node","mergedNodes","duplicateEmptyPathNode","resultNode","mergedNode","getData","route","getResolve","recognize","injector","configLoader","rootComponentType","config","serializer","paramsInheritanceStrategy","mergeMap","t","recognize$1","map","targetSnapshot","urlAfterRedirects","__spreadProps","__spreadValues","resolveData","canActivateChecks","of","routesWithResolversToRun","check","routesNeedingDataUpdates","newRoute","flattenRouteTree","routesProcessed","from","concatMap","runResolve","getInherited","tap","takeLast","_","EMPTY","descendants","child","futureARS","futureRSS","resolve","hasStaticTitle","RouteTitleKey","resolveNode","resolvedData","keys","getDataKeys","data","key","getResolver","first","value","RedirectCommand","redirectingNavigationError","DefaultUrlSerializer","mapTo","catchError","e","isEmptyError","throwError","injectionToken","closestInjector","getClosestRouteInjector","resolver","getTokenOrFunctionIdentity","resolverValue","runInInjectionContext","wrapIntoObservable","switchTap","next","switchMap","v","nextResult","TitleStrategy","_TitleStrategy","snapshot","pageTitle","PRIMARY_OUTLET","__publicField","__ngFactoryType__","ɵɵdefineInjectable","inject","DefaultTitleStrategy","_DefaultTitleStrategy","title","ɵɵinject","Title","ROUTER_CONFIGURATION","InjectionToken","ɵEmptyOutletComponent","_ɵEmptyOutletComponent","ɵɵdefineComponent","rf","ctx","ɵɵelement","RouterOutlet","standardizeConfig","r","children","c","ROUTES","RouterConfigLoader","_RouterConfigLoader","Compiler","loadRunner","maybeUnwrapDefaultExport","component","finalize","loader","ConnectableObservable","Subject","refCount","parentInjector","loadChildren","compiler","onLoadEndListener","NgModuleFactory$1","factoryOrRoutes","rawRoutes","requireStandaloneComponents","isWrappedDefaultExport","input","UrlHandlingStrategy","_UrlHandlingStrategy","DefaultUrlHandlingStrategy","_DefaultUrlHandlingStrategy","url","newUrlPart","wholeUrl","CREATE_VIEW_TRANSITION","NAVIGATION_ERROR_HANDLER","InjectionToken","NavigationTransitions","_NavigationTransitions","__publicField","Subject","inject","RouterConfigLoader","EnvironmentInjector","UrlSerializer","ChildrenOutletContexts","Location","INPUT_BINDER","TitleStrategy","ROUTER_CONFIGURATION","UrlHandlingStrategy","CREATE_VIEW_TRANSITION","of","onLoadStart","r","RouteConfigLoadStart","onLoadEnd","RouteConfigLoadEnd","_a","request","id","__spreadProps","__spreadValues","router","initialUrlTree","initialRouterState","BehaviorSubject","IMPERATIVE_NAVIGATION","filter","t","map","switchMap","overallTransitionState","completed","errored","NavigationCancellationCode","EMPTY","urlTransition","onSameUrlNavigation","reason","NavigationSkipped","NavigationSkippedCode","_b","transition","NavigationStart","recognize","tap","routesRecognized","RoutesRecognized","extractedUrl","source","restoredState","extras","navStart","targetSnapshot","createEmptyState","guardsStart","GuardsCheckStart","getAllRouteGuards","checkGuards","evt","redirectingNavigationError","guardsEnd","GuardsCheckEnd","switchTap","resolveStart","ResolveStart","dataResolved","resolveData","resolveEnd","ResolveEnd","loadComponents","route","loaders","loadedComponent","child","combineLatest","defaultIfEmpty","take","currentSnapshot","viewTransitionStarted","from","targetRouterState","createRouterState","BeforeActivateRoutes","activateRoutes","NavigationEnd","takeUntil","err","finalize","catchError","e","isNavigationCancelingError","NavigationCancel","isRedirectingNavigationCancelingError","RedirectRequest","navigationError","NavigationError","navigationErrorHandlerResult","runInInjectionContext","RedirectCommand","message","cancellationCode","ee","code","navCancel","_c","currentBrowserUrl","targetBrowserUrl","__ngFactoryType__","ɵɵdefineInjectable","isBrowserTriggeredNavigation","RouteReuseStrategy","_RouteReuseStrategy","DefaultRouteReuseStrategy","BaseRouteReuseStrategy","detachedTree","future","curr","_DefaultRouteReuseStrategy","ɵDefaultRouteReuseStrategy_BaseFactory","ɵɵgetInheritedFactory","StateManager","_StateManager","HistoryStateManager","_HistoryStateManager","UrlTree","listener","event","currentTransition","rawUrl","url","path","currentBrowserPageId","state","navigation","restoringFromCaughtError","targetPagePosition","navigationId","routerPageId","ɵHistoryStateManager_BaseFactory","NavigationResult","afterNextNavigation","action","result","exactMatchOptions","subsetMatchOptions","Router","_Router","Console","PendingTasksInternal","ROUTES","Subscription","subscription","currentNavigation","opts","mergedTree","isPublicRouterEvent","rootComponentType","stateCopy","urlTree","config","standardizeConfig","commands","navigationExtras","relativeTo","queryParams","fragment","queryParamsHandling","preserveFragment","f","q","relativeToUrlSegmentGroup","relativeToSnapshot","createSegmentGroupFromRoute","createUrlTreeFromSegmentGroup","isUrlTree","validateCommands","matchOptions","options","containsTree","params","key","value","priorPromise","resolve","reject","promise","res","rej","taskId","i","RuntimeError","ROUTER_SCROLLER","InjectionToken","provideRouter","routes","features","makeEnvironmentProviders","ROUTES","ActivatedRoute","rootRoute","Router","APP_BOOTSTRAP_LISTENER","getBootstrapListener","feature","router","getBootstrapListener","injector","inject","Injector","bootstrappedComponentRef","_a","_b","ref","ApplicationRef","router","Router","bootstrapDone","BOOTSTRAP_DONE","INITIAL_NAVIGATION","ROUTER_PRELOADER","InjectFlags","ROUTER_SCROLLER","InjectionToken","Subject","ROUTER_PRELOADER","InjectionToken","TuiPlatform","_TuiPlatform","inject","TUI_PLATFORM","__ngFactoryType__","ɵɵdefineDirective","rf","ctx","ɵɵattribute","ɵɵProvidersFeature","ViewportService","_ViewportService","Observable","subscriber","__publicField","inject","WINDOW","merge","fromEvent","startWith","map","filter","shareReplay","EMPTY","__ngFactoryType__","ɵɵdefineInjectable","TuiVisualViewport","_TuiVisualViewport","inject","WA_WINDOW","tuiInjectElement","ViewportService","takeUntilDestroyed","offsetLeft","offsetTop","height","width","scale","tuiPx","__ngFactoryType__","ɵɵdefineDirective","TuiPopupService","_TuiPopupService","TuiPortalService","ɵTuiPopupService_BaseFactory","__ngFactoryType__","ɵɵgetInheritedFactory","ɵɵdefineInjectable","_c0","_c1","TuiRoot_tui_scroll_controls_2_Template","rf","ctx","ɵɵelement","TuiRoot","_TuiRoot","TuiPortals","_a","inject","TUI_REDUCED_MOTION","tuiGetDuration","TUI_ANIMATIONS_SPEED","toSignal","TuiBreakpointService","map","breakpoint","tuiWatch","TUI_SCROLLBAR_OPTIONS","TUI_IS_MOBILE","DOCUMENT","TUI_THEME","__ngFactoryType__","ɵɵdefineComponent","ɵɵlistener","ɵɵstyleProp","ɵɵclassProp","ɵɵProvidersFeature","tuiAsPortal","TuiPopupService","ɵɵHostDirectivesFeature","TuiPlatform","TuiVisualViewport","ɵɵInheritDefinitionFeature","ɵɵprojectionDef","ɵɵelementStart","ɵɵprojection","ɵɵelementEnd","ɵɵtemplate","ɵɵelementContainer","ɵɵadvance","ɵɵproperty","NgIf","TuiAlerts","TuiDialogs","TuiDropdowns","TuiHints","TuiScrollControls","AppComponent","selectors","decls","vars","consts","template","rf","ctx","ɵɵelementStart","ɵɵelement","ɵɵelementContainer","ɵɵelementEnd","RouterOutlet","TuiRoot","encapsulation","changeDetection","_AppComponent","InjectableAnimationEngine","_InjectableAnimationEngine","AnimationEngine","doc","driver","normalizer","__publicField","__ngFactoryType__","ɵɵinject","DOCUMENT","AnimationDriver","AnimationStyleNormalizer","ɵɵdefineInjectable","instantiateDefaultStyleNormalizer","WebAnimationsStyleNormalizer","instantiateRendererFactory","renderer","engine","zone","AnimationRendererFactory","SHARED_ANIMATION_PROVIDERS","RendererFactory2","DomRendererFactory2","NgZone","BROWSER_ANIMATIONS_PROVIDERS","WebAnimationsDriver","ANIMATION_MODULE_TYPE","BROWSER_NOOP_ANIMATIONS_PROVIDERS","NoopAnimationDriver","provideAnimations","performanceMarkFeature","BROWSER_ANIMATIONS_PROVIDERS","appConfig","providers","provideExperimentalZonelessChangeDetection","provideClientHydration","provideAnimations","provideRouter","path","pathMatch","loadComponent","importProvidersFrom","provide","TUI_EDITOR_EXTENSIONS","deps","INJECTOR","useFactory","injector","TUI_EDITOR_DEFAULT_EXTENSIONS","then","tuiCreateImageEditorExtension","TUI_SANITIZER","useClass","NgDompurifySanitizer","NG_EVENT_PLUGINS","environment","production","environment","production","enableProdMode","bootstrapApplication","AppComponent","appConfig","catch","err","console","error"],"x_google_ignoreList":[0,1,2,3,4,5,8]} \ No newline at end of file