@rimori/playwright-testing 0.3.23 → 0.3.24-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js +8 -0
- package/dist/harness/{index3.js → __mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_react_mf_2_client__loadShare__.mjs.js} +42 -42
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs.js +1 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.mjs.js +9 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.mjs_commonjs-proxy.js +1 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_dev_mf_2_runtime__loadShare__.mjs.js +9 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs.js +9 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.mjs.js +9 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy.js +1 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs.js +25 -0
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__zod__loadShare__.mjs.js +1 -0
- package/dist/harness/hostInit.js +1 -1
- package/dist/harness/index.html +1 -12
- package/dist/harness/index.js +1 -25
- package/dist/harness/localSharedImportMap.js +1 -1
- package/dist/harness/mf-entry-bootstrap-0.js +13 -0
- package/dist/harness/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__rimori-scenario-host__remoteEntry-_hash_.js +5 -6
- package/package.json +5 -5
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.js.js +0 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_react_mf_2_client__loadShare__.js.js +0 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.js.js +0 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.js_commonjs-proxy.js +0 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js.js +0 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.js.js +0 -1
- package/dist/harness/__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.js_commonjs-proxy.js +0 -1
- package/dist/harness/html2canvas.esm.js +0 -22
- package/dist/harness/index2.js +0 -8
- package/dist/harness/index4.js +0 -1
- package/dist/harness/index5.js +0 -9
- package/dist/harness/index6.js +0 -9
- package/dist/harness/index7.js +0 -1
- package/dist/harness/jsx-dev-runtime.js +0 -9
- package/dist/harness/jsx-runtime.js +0 -9
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{a as Z,b as De,c as J,d as l0,e as Oc,R as oe,f as zt,g as c0,h as d0,i as Lb,j as Rc,k as h0}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.js.js";import{_ as A,a as Me,b as Ud}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js.js";import{_ as Kd,a as Bb,b as $b,c as zb,d as Hb,e as f0}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.js.js";function jb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}import{R as Vb}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.js.js";var E=typeof window<"u"?window:void 0,Te=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(Te.self=Te),typeof File>"u"&&(Te.File=function(){});var ft=Te?.navigator,N=Te?.document,ze=Te?.location,il=Te?.fetch,sl=Te!=null&&Te.XMLHttpRequest&&"withCredentials"in new Te.XMLHttpRequest?Te.XMLHttpRequest:void 0,Jd=Te?.AbortController,qb=Te?.CompressionStream,st=ft?.userAgent,$=E??{},Gd="1.372.1",et={DEBUG:!1,LIB_VERSION:Gd,LIB_NAME:"web",JS_SDK_VERSION:Gd};function Yd(t,e,n,r,i,s,o){try{var a=t[s](o),u=a.value}catch(l){return void n(l)}a.done?e(u):Promise.resolve(u).then(r,i)}function kt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function o(u){Yd(s,r,i,o,a,"next",u)}function a(u){Yd(s,r,i,o,a,"throw",u)}o(void 0)})}}function O(){return O=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},O.apply(null,arguments)}function p0(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function ol(){return ol=kt(function*(t,e,n){e===void 0&&(e=!0);try{var r=new CompressionStream("gzip"),i=r.writable.getWriter(),s=i.write(new TextEncoder().encode(t)).then(()=>i.close()).catch(function(){var u=kt(function*(l){try{yield i.abort(l)}catch{}throw l});return function(l){return u.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[a]=yield Promise.all([o,s]);return a}catch(u){if(n!=null&&n.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}}),ol.apply(this,arguments)}var Wb=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],Zd=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return Wb.concat(e).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},Ub=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function G(t,e){return t.indexOf(e)!==-1}var ka=function(t){return t.trim()},al=function(t){return t.replace(/^\$/,"")},m0=Object.prototype,g0=m0.hasOwnProperty,wa=m0.toString,Q=Array.isArray||function(t){return wa.call(t)==="[object Array]"},ln=t=>typeof t=="function",ke=t=>t===Object(t)&&!Q(t),Br=t=>{if(ke(t)){for(var e in t)if(g0.call(t,e))return!1;return!0}return!1},P=t=>t===void 0,me=t=>wa.call(t)=="[object String]",Js=t=>me(t)&&t.trim().length===0,gn=t=>t===null,Y=t=>P(t)||gn(t),Tt=t=>wa.call(t)=="[object Number]"&&t==t,Or=t=>Tt(t)&&t>0,jt=t=>wa.call(t)==="[object Boolean]",Kb=t=>t instanceof FormData,Jb=t=>G(Ub,t);function b0(t){return t===null||typeof t!="object"}function ao(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Nc(t){return typeof Event<"u"&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var Gb=[!0,"true",1,"1","yes"],Ga=t=>G(Gb,t),Yb=[!1,"false",0,"0","no"];function Vt(t,e,n,r,i){return e>n&&(r.warn("min cannot be greater than max."),e=n),Tt(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),Vt(i||n,e,n,r))}class Zb{constructor(e){this.$t={},this.zt=e.zt,this.Ut=Vt(e.bucketSize,0,100,e.Yt),this.Wt=Vt(e.refillRate,0,this.Ut,e.Yt),this.Gt=Vt(e.refillInterval,0,864e5,e.Yt)}Xt(e,n){var r=Math.floor((n-e.lastAccess)/this.Gt);r>0&&(e.tokens=Math.min(e.tokens+r*this.Wt,this.Ut),e.lastAccess=e.lastAccess+r*this.Gt)}consumeRateLimit(e){var n,r=Date.now(),i=String(e),s=this.$t[i];return s?this.Xt(s,r):this.$t[i]=s={tokens:this.Ut,lastAccess:r},s.tokens===0||(s.tokens--,s.tokens===0&&((n=this.zt)==null||n.call(this,e)),s.tokens===0)}stop(){this.$t={}}}var ws,Xd,Ya,pt="Mobile",uo="iOS",dn="Android",Jr="Tablet",v0=dn+" "+Jr,y0="iPad",_0="Apple",x0=_0+" Watch",Di="Safari",Gr="BlackBerry",k0="Samsung",w0=k0+"Browser",C0=k0+" Internet",ar="Chrome",Xb=ar+" OS",E0=ar+" "+uo,Fc="Internet Explorer",S0=Fc+" "+pt,Ic="Opera",Qb=Ic+" Mini",Pc="Edge",M0="Microsoft "+Pc,Vr="Firefox",A0=Vr+" "+uo,Wi="Nintendo",Ui="PlayStation",qr="Xbox",T0=dn+" "+pt,D0=pt+" "+Di,yi="Windows",ul=yi+" Phone",Qd="Nokia",ll="Ouya",O0="Generic",ev=O0+" "+pt.toLowerCase(),R0=O0+" "+Jr.toLowerCase(),cl="Konqueror",Qe="(\\d+(\\.\\d+)?)",Za=new RegExp("Version/"+Qe),tv=new RegExp(qr,"i"),nv=new RegExp(Ui+" \\w+","i"),rv=new RegExp(Wi+" \\w+","i"),Lc=new RegExp(Gr+"|PlayBook|BB10","i"),iv={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},N0=function(t,e){return e=e||"",G(t," OPR/")&&G(t,"Mini")?Qb:G(t," OPR/")?Ic:Lc.test(t)?Gr:G(t,"IE"+pt)||G(t,"WPDesktop")?S0:G(t,w0)?C0:G(t,Pc)||G(t,"Edg/")?M0:G(t,"FBIOS")?"Facebook "+pt:G(t,"UCWEB")||G(t,"UCBrowser")?"UC Browser":G(t,"CriOS")?E0:G(t,"CrMo")||G(t,ar)?ar:G(t,dn)&&G(t,Di)?T0:G(t,"FxiOS")?A0:G(t.toLowerCase(),cl.toLowerCase())?cl:((n,r)=>r&&G(r,_0)||function(i){return G(i,Di)&&!G(i,ar)&&!G(i,dn)}(n))(t,e)?G(t,pt)?D0:Di:G(t,Vr)?Vr:G(t,"MSIE")||G(t,"Trident/")?Fc:G(t,"Gecko")?Vr:""},sv={[S0]:[new RegExp("rv:"+Qe)],[M0]:[new RegExp(Pc+"?\\/"+Qe)],[ar]:[new RegExp("("+ar+"|CrMo)\\/"+Qe)],[E0]:[new RegExp("CriOS\\/"+Qe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Qe)],[Di]:[Za],[D0]:[Za],[Ic]:[new RegExp("(Opera|OPR)\\/"+Qe)],[Vr]:[new RegExp(Vr+"\\/"+Qe)],[A0]:[new RegExp("FxiOS\\/"+Qe)],[cl]:[new RegExp("Konqueror[:/]?"+Qe,"i")],[Gr]:[new RegExp(Gr+" "+Qe),Za],[T0]:[new RegExp("android\\s"+Qe,"i")],[C0]:[new RegExp(w0+"\\/"+Qe)],[Fc]:[new RegExp("(rv:|MSIE )"+Qe)],Mozilla:[new RegExp("rv:"+Qe)]},ov=function(t,e){var n=N0(t,e),r=sv[n];if(P(r))return null;for(var i=0;r.length>i;i++){var s=t.match(r[i]);if(s)return parseFloat(s[s.length-2])}return null},eh=[[new RegExp(qr+"; "+qr+" (.*?)[);]","i"),t=>[qr,t&&t[1]||""]],[new RegExp(Wi,"i"),[Wi,""]],[new RegExp(Ui,"i"),[Ui,""]],[Lc,[Gr,""]],[new RegExp(yi,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[ul,""];if(new RegExp(pt).test(e)&&!/IEMobile\b/.test(e))return[yi+" "+pt,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=iv[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[yi,r]}return[yi,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[uo,[t[3],t[4],t[5]||"0"].join(".")]:[uo,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=P(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+dn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+dn+")","i"),t=>t&&t[2]?[dn,[t[2],t[3],t[4]||"0"].join(".")]:[dn,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Xb,""]],[/Linux|debian/i,["Linux",""]]],th=function(t){return rv.test(t)?Wi:nv.test(t)?Ui:tv.test(t)?qr:new RegExp(ll,"i").test(t)?ll:new RegExp("("+ul+"|WPDesktop)","i").test(t)?ul:/iPad/.test(t)?y0:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?x0:Lc.test(t)?Gr:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Qd,"i").test(t)?Qd:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(pt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?dn:v0:new RegExp("(pda|"+pt+")","i").test(t)?ev:new RegExp(Jr,"i").test(t)&&!new RegExp(Jr+" pc","i").test(t)?R0:""},av=t=>t instanceof Error,F0={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},uv=F0.info;function I0(t){if(jt(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(Q(t))return{arrayValue:{values:t.map(e=>I0(e))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function nh(t){var e=[];for(var n in t){var r=t[n];gn(r)||P(r)||e.push({key:n,value:I0(r)})}return e}function lv(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Ya&&n.length===Xd||(Xd=n.length,Ya=n.reduce((r,i)=>{ws||(ws={});var s=ws[i];if(s)r[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var u=o[a],l=u?.filename,c=e[i];if(l&&c){r[l]=c,ws[i]=[l,c];break}}return r},{})),Ya}}class cv{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,n,0).apply(e),s=this.buildParsingContext(n),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return kt(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Q(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),O({},e,{cause:r,stack:i})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return kt(function*(){var r=e;for(var i of n.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,n){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(i=n.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,O({},n,{handled:!0}))),a}buildParsingContext(e){var n;return{chunkIdMap:lv(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var i=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(s,a)}};return O({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}}var Yr="?";function dl(t,e,n,r,i){var s={platform:t,filename:e,function:n==="<anonymous>"?Yr:n,in_app:!0};return P(r)||(s.lineno=r),P(i)||(s.colno=i),s}var P0=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Yr,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},dv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,hv=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,fv=/\((\S*)(?::(\d+))(?::(\d+))\)/,pv=(t,e)=>{var n=dv.exec(t);if(n){var[,r,i,s]=n;return dl(e,r,Yr,+i,+s)}var o=hv.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=fv.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[u,l]=P0(o[1]||Yr,o[2]);return dl(e,l,u,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},mv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,gv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,bv=(t,e)=>{var n=mv.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=gv.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var i=n[3],s=n[1]||Yr;return[s,i]=P0(s,i),dl(e,i,s,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},rh=/\(error: (.*)\)/;class vv{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=me(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return ao(e,"DOMException")}isDOMError(e){return ao(e,"DOMError")}}class yv{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class _v{constructor(){}match(e){return ao(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var xv=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class kv{match(e){return typeof e=="string"}coerce(e,n){var r,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,i=e.match(xv);return i&&(n=i[1],r=i[2]),[n,r]}}var wv=["fatal","error","warning","log","info","debug"];function L0(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(e>=i.length)return r===n.length?i:i.length>e?i.slice(0,e)+"...":i}return""}class Cv{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,i=this.getErrorPropertyFromObject(e);return i?n.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Nc(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+L0(e)}isSeverityLevel(e){return me(e)&&!Js(e)&&wv.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(av(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class Ev{match(e){return Nc(e)}coerce(e,n){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+L0(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Sv{match(e){return b0(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Mv{match(e){return ao(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Nc(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,i=this.getUnhandledRejectionReason(e);return b0(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var lo="$message",co="$timestamp",Av=new Set([lo,co]),Xa={enabled:!0,max_bytes:32768};function ho(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:Xa.enabled,max_bytes:Dv(t.max_bytes,Xa.max_bytes)}:O({},Xa)}class Tv{constructor(e){this.Jt=[],this.Kt=0,this.Lt=ho(e)}setConfig(e){this.Lt=ho(e),this.Qt()}add(e){var n=function(i){var s=function(c){var d=new WeakSet;try{return JSON.stringify(c,(h,f)=>{if(typeof f=="bigint")return f.toString();if(typeof f!="function"&&typeof f!="symbol"){if(f instanceof Date)return f.toISOString();if(f instanceof Error)return{name:f.name,message:f.message,stack:f.stack};if(f&&typeof f=="object"){if(d.has(f))return"[Circular]";d.add(f)}return f}})}catch{return}}(i);if(s)try{var o=JSON.parse(s);if(!ke(o))return;var a=o,u=a[lo],l=a[co];return!me(u)||u.trim().length===0||!me(l)&&!Tt(l)?void 0:{step:a,json:s}}catch{return}}(e);if(n){var r=function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var s=encodeURIComponent(i),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o}(n.json);r>this.Lt.max_bytes||(this.Jt.push({step:n.step,bytes:r}),this.Kt+=r,this.Qt())}}getAttachable(){return this.Jt.map(e=>e.step)}clear(){this.Jt=[],this.Kt=0}size(){return this.Jt.length}Qt(){for(;this.Kt>this.Lt.max_bytes&&this.Jt.length>0;){var e=this.Jt.shift();e&&(this.Kt-=e.bytes)}}}function Dv(t,e){if(!Tt(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var B0=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={C(i){if(E&&(et.DEBUG||$.POSTHOG_DEBUG||n)&&!P(E.console)&&E.console){for(var s=("__rrweb_original__"in E.console[i])?E.console[i].__rrweb_original__:E.console[i],o=arguments.length,a=new Array(o>1?o-1:0),u=1;o>u;u++)a[u-1]=arguments[u];s(t,...a)}},info(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("log",...s)},warn(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("warn",...s)},error(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("error",...s)},critical(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(i){r.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>B0(t+" "+i,s)};return r},I=B0("[PostHog.js]"),fe=I.createLogger,Ov=fe("[ExternalScriptsLoader]"),Qa=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return Ov.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=N?.querySelectorAll("script");if(r){for(var i,s=function(){if(r[o].src===e){var u=r[o];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",l=>{u.__posthog_loading_callback_fired=!0,n(void 0,l)}),u.onerror=l=>n(l),{v:void 0})}},o=0;r.length>o;o++)if(i=s())return i.v}var a=()=>{if(!N)return n("document not found");var u=N.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=d=>{u.__posthog_loading_callback_fired=!0,n(void 0,d)},u.onerror=d=>n(d),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")N.head.appendChild(u);else{var l,c=N.querySelectorAll("body > script");c.length>0?(l=c[0].parentNode)==null||l.insertBefore(u,c[0]):N.body.appendChild(u)}};N!=null&&N.body?a():N?.addEventListener("DOMContentLoaded",a)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var i="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}r=t.requestRouter.endpointFor("assets",i)}Qa(t,r,n)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");Qa(t,o,n)}},$.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);Qa(t,r,n)};var $0="$people_distinct_id",fo="$device_id",_i="__alias",xi="__timers",hl="$autocapture_disabled_server_side",fl="$heatmaps_enabled_server_side",pl="$exception_capture_enabled_server_side",ml="$error_tracking_suppression_rules",gl="$error_tracking_capture_extension_exceptions",bl="$web_vitals_enabled_server_side",Bc="$dead_clicks_enabled_server_side",vl="$product_tours_enabled_server_side",yl="$web_vitals_allowed_metrics",ki="$session_recording_remote_config",z0="$replay_override_sampling",H0="$replay_override_linked_flag",j0="$replay_override_url_trigger",V0="$replay_override_event_trigger",po="$sesid",$c="$session_is_sampled",$r="$enabled_feature_flags",Gs="$active_feature_flags",wi="$early_access_features",_l="$feature_flag_details",xl="$feature_flag_payloads",kl="$feature_flag_request_id",sn="$override_feature_flags",Rr="$override_feature_flag_payloads",Ci="$stored_person_properties",Qn="$stored_group_properties",wl="$surveys",Cl="$surveys_activated",Ys="ph_product_tours",Oi="$flag_call_reported",El="$flag_call_reported_session_id",Sl="$feature_flag_errors",mo="$feature_flag_evaluated_at",Rt="$user_state",Ml="$client_session_props",Al="$capture_rate_limit",Tl="$initial_campaign_params",Dl="$initial_referrer_info",go="$initial_person_info",bo="$epp",q0="__POSTHOG_TOOLBAR__",Cs="$posthog_cookieless",W0="$sdk_debug_extensions_init_method",U0="$sdk_debug_extensions_init_time_ms",K0="$sdk_debug_recording_script_not_loaded",zc="PostHog loadExternalDependency extension not found.",er="on_reject",cn="always",wr="anonymous",Cr="identified",Ol="identified_only",vo="visibilitychange",yo="beforeunload",Nr="$pageview",eu="$pageleave",tu="$identify",ih="$groupidentify";function Es(t,e){Q(t)&&t.forEach(e)}function ce(t,e){if(!Y(t))if(Q(t))t.forEach(e);else if(Kb(t))t.forEach((r,i)=>e(r,i));else for(var n in t)g0.call(t,n)&&e(t[n],n)}var ve=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var i of n)for(var s in i)i[s]!==void 0&&(t[s]=i[s]);return t};function Zs(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var sh=function(t){try{return t()}catch{return}},Rv=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(i){I.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),I.critical(i)}}},Hc=function(t){var e={};return ce(t,function(n,r){(me(n)&&n.length>0||Tt(n))&&(e[r]=n)}),e},Nv=["herokuapp.com","vercel.app","netlify.app"];function Fv(t){var e=t?.hostname;if(!me(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of Nv)if(n===r)return!1;return!0}function Ee(t,e,n,r){var{capture:i=!1,passive:s=!0}=r??{};t?.addEventListener(e,n,{capture:i,passive:s})}function J0(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Tt(t)&&isFinite(t)&&Math.floor(t)===t});class _o{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>n||0>r||0>i||e>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new _o(s)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new _o(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}let Iv=class{constructor(){this.I=0,this.S=0,this.k=new Pv}generate(){var e=this.generateOrAbort();if(P(e)){this.I=0;var n=this.generateOrAbort();if(P(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return _o.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}};var oh,G0=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};E&&!P(E.crypto)&&crypto.getRandomValues&&(G0=t=>crypto.getRandomValues(t));class Pv{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(G0(this.T),this.N=0),this.T[this.N++]}}var Tn=()=>Lv().toString(),Lv=()=>(oh||(oh=new Iv)).generate(),ui="",Bv=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ht={R:()=>!!N,B(t){I.error("cookieStore error: "+t)},O(t){if(N){try{for(var e=t+"=",n=N.cookie.split(";").filter(s=>s.length),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},Z(t){var e;try{e=JSON.parse(Ht.O(t))||{}}catch{}return e},M(t,e,n,r,i){if(N)try{var s="",o="",a=function(c,d){if(d){var h=function(p,m){if(m===void 0&&(m=N),ui)return ui;if(!m||["localhost","127.0.0.1"].includes(p))return"";for(var g=p.split("."),b=Math.min(g.length,8),v="dmn_chk_"+Tn();!ui&&b--;){var _=g.slice(b).join("."),x=v+"=1;domain=."+_+";path=/";m.cookie=x+";max-age=3",m.cookie.includes(v)&&(m.cookie=x+";max-age=0",ui=_)}return ui}(c);if(!h){var f=(p=>{var m=p.match(Bv);return m?m[0]:""})(c);f!==h&&I.info("Warning: cookie subdomain discovery mismatch",f,h),h=f}return h?"; domain=."+h:""}return""}(N.location.hostname,r);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}i&&(o="; secure");var l=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&I.warn("cookieStore warning: large cookie, len="+l.length),N.cookie=l,l}catch{return}},F(t,e){if(N!=null&&N.cookie)try{Ht.M(t,"",-1,e)}catch{return}}},nu=null,pe={R(){if(!gn(nu))return nu;var t=!0;if(P(E))t=!1;else try{var e="__mplssupport__";pe.M(e,"xyz"),pe.O(e)!=='"xyz"'&&(t=!1),pe.F(e)}catch{t=!1}return t||I.error("localStorage unsupported; falling back to cookie store"),nu=t,t},B(t){I.error("localStorage error: "+t)},O(t){try{return E?.localStorage.getItem(t)}catch(e){pe.B(e)}return null},Z(t){try{return JSON.parse(pe.O(t))||{}}catch{}return null},M(t,e){try{E?.localStorage.setItem(t,JSON.stringify(e))}catch(n){pe.B(n)}},F(t){try{E?.localStorage.removeItem(t)}catch(e){pe.B(e)}}},$v=[fo,"distinct_id",po,$c,bo,go,Rt],Ss={},zv={R:()=>!0,B(t){I.error("memoryStorage error: "+t)},O:t=>Ss[t]||null,Z:t=>Ss[t]||null,M(t,e){Ss[t]=e},F(t){delete Ss[t]}},Gn=null,He={R(){if(!gn(Gn))return Gn;if(Gn=!0,P(E))Gn=!1;else try{var t="__support__";He.M(t,"xyz"),He.O(t)!=='"xyz"'&&(Gn=!1),He.F(t)}catch{Gn=!1}return Gn},B(t){I.error("sessionStorage error: ",t)},O(t){try{return E?.sessionStorage.getItem(t)}catch(e){He.B(e)}return null},Z(t){try{return JSON.parse(He.O(t))||null}catch{}return null},M(t,e){try{E?.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){He.B(n)}},F(t){try{E?.sessionStorage.removeItem(t)}catch(e){He.B(e)}}};class Hv{constructor(e){this._instance=e}get Lt(){return this._instance.config}get consent(){return this.tr()?0:this.rr}isOptedOut(){return this.Lt.cookieless_mode===cn||this.isRejected()||this.consent===-1&&this.Lt.cookieless_mode===er}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Lt.opt_out_capturing_by_default}optInOut(e){this.ir.M(this.nr,e?1:0,this.Lt.cookie_expiration,this.Lt.cross_subdomain_cookie,this.Lt.secure_cookie)}reset(){this.ir.F(this.nr,this.Lt.cross_subdomain_cookie)}get nr(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get rr(){var e=this.ir.O(this.nr);return Ga(e)?1:G(Yb,e)?0:-1}get ir(){var e=this.Lt.opt_out_capturing_persistence_type,n=e==="localStorage"?pe:Ht;if(!this.sr||this.sr!==n){this.sr=n;var r=e==="localStorage"?Ht:pe;r.O(this.nr)&&(this.sr.O(this.nr)||this.optInOut(Ga(r.O(this.nr))),r.F(this.nr,this.Lt.cross_subdomain_cookie))}return this.sr}tr(){return!!this.Lt.respect_dnt&&[ft?.doNotTrack,ft?.msDoNotTrack,$.doNotTrack].some(e=>Ga(e))}}var Ms=fe("[Dead Clicks]"),jv=()=>!0,Vv=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(Bc)),r=t.instance.config.capture_dead_clicks;return jt(r)?r:!!ke(r)||n};class ah{get lazyLoadedDeadClicksAutocapture(){return this.ar}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[Bc]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr(()=>{this.ur()}):this.stop()}lr(e){var n,r;(n=$.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Ms.error("failed to load script",i):e()})}ur(){var e;if(N){if(!this.ar&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=ke(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.ar=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.ar.start(N),Ms.info("starting...")}}else Ms.error("`document` not found. Cannot start.")}stop(){this.ar&&(this.ar.stop(),this.ar=void 0,Ms.info("stopping..."))}}var ru=fe("[SegmentIntegration]"),Y0="posthog-js";function Z0(t,e){var{organization:n,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var u,l,c,d,h;if(s!=="*"&&!s.includes(a.level)||!t.__loaded)return a;a.tags||(a.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p,m=((u=a.exception)==null?void 0:u.values)||[],g=m.map(v=>O({},v,{stacktrace:v.stacktrace?O({},v.stacktrace,{type:"raw",frames:(v.stacktrace.frames||[]).map(_=>O({},_,{platform:"web:javascript"}))}):void 0})),b={$exception_message:((l=m[0])==null?void 0:l.value)||a.message,$exception_type:(c=m[0])==null?void 0:c.type,$exception_level:a.level,$exception_list:g,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=m[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(h=m[0])==null?void 0:h.type,$sentry_tags:a.tags};return n&&r&&(b.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&((p=t.exceptions)==null||p.sendExceptionEvent(b)),a}}class qv{constructor(e,n,r,i,s,o){this.name=Y0,this.setupOnce=function(a){a(Z0(e,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}class uh{constructor(e){this.hr=(n,r,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(I.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.cr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.dr()}dr(){var e;this.vr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.hr)}destroy(){var e;(e=this.vr)==null||e.call(this),this.vr=void 0}doPageView(e,n){var r,i=this.pr(e,n);return this.cr={pathname:(r=E?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.pr(e,(n=this.cr)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.cr)==null?void 0:e.pageViewId}}pr(e,n){var r=this.cr;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:u,maxContentHeight:l,lastContentY:c,maxContentY:d}=s;if(!(P(o)||P(a)||P(u)||P(l)||P(c)||P(d))){o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d);var h=o>1?Vt(a/o,0,1,I):1,f=o>1?Vt(u/o,0,1,I):1,p=l>1?Vt(c/l,0,1,I):1,m=l>1?Vt(d/l,0,1,I):1;i=ve(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:m})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var Wv={[$0]:{exposure:"hidden"},[_i]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[xi]:{exposure:"hidden"},[hl]:{exposure:"event"},[fl]:{exposure:"hidden"},[pl]:{exposure:"event"},[ml]:{exposure:"hidden"},[gl]:{exposure:"event"},[bl]:{exposure:"event"},[Bc]:{exposure:"event"},[vl]:{exposure:"hidden"},[yl]:{exposure:"event"},[ki]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[po]:{exposure:"hidden"},[$c]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[$r]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!ke(t))return{};for(var e={},n=Object.keys(t),r=0;n.length>r;r++)e["$feature/"+n[r]]=t[n[r]];return e}},[Gs]:{exposure:"event"},[wi]:{exposure:"hidden"},[_l]:{exposure:"hidden"},[xl]:{exposure:"event"},[kl]:{exposure:"event"},[sn]:{exposure:"event"},[Rr]:{exposure:"hidden"},[Ci]:{exposure:"hidden"},[Qn]:{exposure:"hidden"},[wl]:{exposure:"hidden"},[Cl]:{exposure:"event"},[Ys]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Oi]:{exposure:"hidden"},[El]:{exposure:"hidden"},[Sl]:{exposure:"hidden"},[mo]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Ml]:{exposure:"hidden"},[Al]:{exposure:"hidden"},[Tl]:{exposure:"hidden"},[Dl]:{exposure:"hidden"},[go]:{exposure:"hidden"},[bo]:{exposure:"hidden"},[z0]:{exposure:"event"},[H0]:{exposure:"event"},[j0]:{exposure:"event"},[V0]:{exposure:"event"},[W0]:{exposure:"event"},[U0]:{exposure:"event"},[K0]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Uv=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],xo=t=>{var e=N?.createElement("a");return P(e)?null:(e.href=t,e)},ko=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;r.length>i;i++){var s=r[i].split("=");if(s[0]===e){n=s;break}}if(!Q(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{I.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ki=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),i=r[1],s=(r[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var d=u[c].split("=");Q(d)&&(e.includes(d[0])?l.push(d[0]+"="+n):l.push(u[c]))}var h=a;return o!=null&&(h+="?"+l.join("&")),i!=null&&(h+="#"+i),h},wo=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},As="https?://(.*)",Zr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Kv=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Zr],Ji="<masked>",Jv=["li_fat_id"];function X0(t,e,n){if(!N)return{};var r,i=e?[...Zr,...n||[]]:[],s=Q0(Ki(N.URL,i,Ji),t),o=(r={},ce(Jv,function(a){var u=Ht.O(a);r[a]=u||null}),r);return ve(o,s)}function Q0(t,e){var n=Kv.concat(e||[]),r={};return ce(n,function(i){var s=ko(t,i);r[i]=s||null}),r}function em(t){var e=function(s){return s?s.search(As+"google.([^/?]*)")===0?"google":s.search(As+"bing.com")===0?"bing":s.search(As+"yahoo.com")===0?"yahoo":s.search(As+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!gn(e)){r.$search_engine=e;var i=N?ko(N.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function lh(){return navigator.language||navigator.userLanguage}var Co="$direct";function tm(){return N?.referrer||Co}function nm(t,e){var n=t?[...Zr,...e||[]]:[],r=ze?.href.substring(0,1e3);return{r:tm().substring(0,1e3),u:r?Ki(r,n,Ji):void 0}}function rm(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n==Co?Co:(e=xo(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=xo(r);i.$host=s?.host,i.$pathname=s?.pathname;var o=Q0(r);ve(i,o)}if(n){var a=em(n);ve(i,a)}return i}function im(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Gv(){try{return new Date().getTimezoneOffset()}catch{return}}var Yv=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class iu{constructor(e,n){this.Lt=e,this.props={},this.gr=!1,this.mr=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.ir=this.yr(e),this.load(),e.debug&&I.info("Persistence loaded",e.persistence,O({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.br}yr(e){Yv.indexOf(e.persistence.toLowerCase())===-1&&(I.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=function(i){i===void 0&&(i=[]);var s=[...$v,...i];return O({},pe,{Z(o){try{var a={};try{a=Ht.Z(o)||{}}catch{}var u=ve(a,JSON.parse(pe.O(o)||"{}"));return pe.M(o,u),u}catch{}return null},M(o,a,u,l,c,d){try{pe.M(o,a,void 0,void 0,d);var h={};s.forEach(f=>{a[f]&&(h[f]=a[f])}),Object.keys(h).length&&Ht.M(o,h,u,l,c,d)}catch(f){pe.B(f)}},F(o,a){try{E?.localStorage.removeItem(o),Ht.F(o,a)}catch(u){pe.B(u)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&pe.R()?pe:r==="localstorage+cookie"&&n.R()?n:r==="sessionstorage"&&He.R()?He:r==="memory"?zv:r==="cookie"?Ht:n.R()?n:Ht}_r(e){var n=e??this.Lt.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[mo];return!r||typeof r!="number"||Date.now()-r>n}properties(){var e={};return ce(this.props,(n,r)=>{var i=(s=>{var o=Wv[s];if(o)return o;for(var[a,u]of Uv)if(s.indexOf(a)===0)return u})(r);if(i?.exposure==="derived"){if(i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(n,r===$r?()=>this._r():()=>!1))return;i.transformToEventProperties&&ve(e,i.transformToEventProperties(n))}else i&&i.exposure!=="event"||(e[r]=n)}),e}load(){if(!this.br){var e=this.ir.Z(this.mr);e&&(this.props=ve({},e))}}save(){this.br||this.ir.M(this.mr,this.props,this.wr,this.Ir,this.Cr,this.Lt.debug)}remove(){this.ir.F(this.mr,!1),this.ir.F(this.mr,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(ke(e)){P(n)&&(n="None"),this.wr=P(r)?this.Sr:r;var i=!1;if(ce(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.kr(o,s),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(ke(e)){this.wr=P(n)?this.Sr:n;var r=!1;if(ce(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.kr(s,i),r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Tr(e),this.save())}update_campaign_params(){if(!this.gr){var e=X0(this.Lt.custom_campaign_params,this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties);Br(Hc(e))||this.register(e),this.gr=!0}}update_search_keyword(){var e;this.register((e=N?.referrer)?em(e):{})}update_referrer_info(){var e;this.register_once({$referrer:tm(),$referring_domain:N!=null&&N.referrer&&((e=xo(N.referrer))==null?void 0:e.host)||Co},void 0)}set_initial_person_info(){this.props[Tl]||this.props[Dl]||this.register_once({[go]:nm(this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ce([Dl,Tl],o=>{var a=this.props[o];a&&ce(a,function(u,l){e["$initial_"+al(l)]=u})});var n,r,i=this.props[go];if(i){var s=(n=rm(i),r={},ce(n,function(o,a){r["$initial_"+al(a)]=o}),r);ve(e,s)}return e}safe_merge(e){return ce(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.Sr=this.wr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var u=[...o].sort(),l=[...a].sort();return u.every((c,d)=>c===l[d])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var i=this.yr(e),s=this.props;this.clear(),this.ir=i,this.props=s,this.save()}}set_disabled(e){this.br=e,this.br?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ir&&(this.Ir=e,this.remove(),this.save())}set_secure(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[xi]||{};r[e]=n,this.kr(xi,r),this.save()}remove_event_timer(e){var n=this.props[xi]||{},r=n[e];return P(r)||(delete n[e],this.kr(xi,n),this.save()),r}get_property(e){return this.props[e]}set_property(e,n){this.kr(e,n),this.save()}kr(e,n){this.props[e]=n}Tr(e){delete this.props[e]}}var li={Activation:"events",Cancellation:"cancelEvents"},su={Popover:"popover",API:"api",Widget:"widget"},Ei={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},ou={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Rl={Popover:"popover",Inline:"inline"},Zv={SHOWN:"product tour shown"},ch={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},dh=fe("[RateLimiter]");class Xv{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(i=>{dh.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void dh.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),u=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Al))!==null&&n!==void 0?n:{tokens:s,last:a};u.tokens+=(a-u.last)/1e3*o,u.last=a,u.tokens>s&&(u.tokens=s);var l=1>u.tokens;return l||e||(u.tokens=Math.max(0,u.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(i=this.instance.persistence)==null||i.set_property(Al,u),{isRateLimited:l,remainingTokens:u.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var ci=fe("[RemoteConfig]");class sm{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ar(e){var n,r;(n=$.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Er(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return ci.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void ci.warn("Remote config is disabled. Falling back to local config.");this.Ar(e=>{if(!e)return ci.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er(n=>{this.Rr(n),this.Nr()});this.Rr(e),this.Nr()})}catch(e){ci.error("Error loading remote config",e)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||N?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}Nr(){var e;if(!this.Fr){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.Fr=setInterval(()=>{this.refresh()},n))}}Rr(e){var n;e||ci.error("Failed to fetch remote config from PostHog."),this._instance.Rr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var $t={GZipJS:"gzip-js",Base64:"base64"},St=Uint8Array,at=Uint16Array,Xr=Uint32Array,jc=new St([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vc=new St([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),hh=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),om=function(t,e){for(var n=new at(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var i=new Xr(n[30]);for(r=1;30>r;++r)for(var s=n[r];n[r+1]>s;++s)i[s]=s-n[r]<<5|r;return[n,i]},am=om(jc,2),Nl=am[1];am[0][28]=258,Nl[258]=28;for(var fh=om(Vc,0)[1],um=new at(32768),de=0;32768>de;++de){var Er=(43690&de)>>>1|(21845&de)<<1;um[de]=((65280&(Er=(61680&(Er=(52428&Er)>>>2|(13107&Er)<<2))>>>4|(3855&Er)<<4))>>>8|(255&Er)<<8)>>>1}var Ri=function(t,e,n){for(var r=t.length,i=0,s=new at(e);r>i;++i)++s[t[i]-1];var o,a=new at(e);for(i=0;e>i;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new at(r),i=0;r>i;++i)o[i]=um[a[t[i]-1]++]>>>15-t[i];return o},fr=new St(288);for(de=0;144>de;++de)fr[de]=8;for(de=144;256>de;++de)fr[de]=9;for(de=256;280>de;++de)fr[de]=7;for(de=280;288>de;++de)fr[de]=8;var Eo=new St(32);for(de=0;32>de;++de)Eo[de]=5;var Qv=Ri(fr,9),e2=Ri(Eo,5),lm=function(t){return(t/8>>0)+(7&t&&1)},cm=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof at?at:t instanceof Xr?Xr:St)(n-e);return r.set(t.subarray(e,n)),r},Qt=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},di=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},au=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[new St(0),0];if(i==1){var o=new St(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(y,w){return y.f-w.f}),n.push({s:-1,f:25001});var a=n[0],u=n[1],l=0,c=1,d=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=i-1;)a=n[n[d].f>n[l].f?l++:d++],u=n[l!=c&&n[d].f>n[l].f?l++:d++],n[c++]={s:-1,f:a.f+u.f,l:a,r:u};var h=s[0].s;for(r=1;i>r;++r)s[r].s>h&&(h=s[r].s);var f=new at(h+1),p=Fl(n[c-1],f,0);if(p>e){r=0;var m=0,g=p-e,b=1<<g;for(s.sort(function(y,w){return f[w.s]-f[y.s]||y.f-w.f});i>r;++r){var v=s[r].s;if(e>=f[v])break;m+=b-(1<<p-f[v]),f[v]=e}for(m>>>=g;m>0;){var _=s[r].s;e>f[_]?m-=1<<e-f[_]++-1:++r}for(;r>=0&&m;--r){var x=s[r].s;f[x]==e&&(--f[x],++m)}p=e}return[new St(f),p]},Fl=function(t,e,n){return t.s==-1?Math.max(Fl(t.l,e,n+1),Fl(t.r,e,n+1)):e[t.s]=n},ph=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new at(++e),r=0,i=t[0],s=1,o=function(u){n[r++]=u},a=1;e>=a;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},hi=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},Il=function(t,e,n){var r=n.length,i=lm(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;r>s;++s)t[i+s+4]=n[s];return 8*(i+4+r)},mh=function(t,e,n,r,i,s,o,a,u,l,c){Qt(e,c++,n),++i[256];for(var d=au(i,15),h=d[0],f=d[1],p=au(s,15),m=p[0],g=p[1],b=ph(h),v=b[0],_=b[1],x=ph(m),y=x[0],w=x[1],C=new at(19),k=0;v.length>k;++k)C[31&v[k]]++;for(k=0;y.length>k;++k)C[31&y[k]]++;for(var S=au(C,7),D=S[0],F=S[1],L=19;L>4&&!D[hh[L-1]];--L);var j,W,X,ne,se=l+5<<3,V=hi(i,fr)+hi(s,Eo)+o,he=hi(i,h)+hi(s,m)+o+14+3*L+hi(C,D)+(2*C[16]+3*C[17]+7*C[18]);if(V>=se&&he>=se)return Il(e,c,t.subarray(u,u+l));if(Qt(e,c,1+(V>he)),c+=2,V>he){j=Ri(h,f),W=h,X=Ri(m,g),ne=m;var Ce=Ri(D,F);for(Qt(e,c,_-257),Qt(e,c+5,w-1),Qt(e,c+10,L-4),c+=14,k=0;L>k;++k)Qt(e,c+3*k,D[hh[k]]);c+=3*L;for(var Ze=[v,y],bt=0;2>bt;++bt){var Oe=Ze[bt];for(k=0;Oe.length>k;++k)Qt(e,c,Ce[We=31&Oe[k]]),c+=D[We],We>15&&(Qt(e,c,Oe[k]>>>5&127),c+=Oe[k]>>>12)}}else j=Qv,W=fr,X=e2,ne=Eo;for(k=0;a>k;++k)if(r[k]>255){var We;di(e,c,j[257+(We=r[k]>>>18&31)]),c+=W[We+257],We>7&&(Qt(e,c,r[k]>>>23&31),c+=jc[We]);var Dt=31&r[k];di(e,c,X[Dt]),c+=ne[Dt],Dt>3&&(di(e,c,r[k]>>>5&8191),c+=Vc[Dt])}else di(e,c,j[r[k]]),c+=W[r[k]];return di(e,c,j[256]),c+W[256]},t2=new Xr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),n2=function(){for(var t=new Xr(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),uu=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function r2(t,e){e===void 0&&(e={});var n=function(){var d=4294967295;return{p(h){for(var f=d,p=0;h.length>p;++p)f=n2[255&f^h[p]]^f>>>8;d=f},d(){return 4294967295^d}}}(),r=t.length;n.p(t);var i,s,o,a,u,l=(a=10+((i=e).filename&&i.filename.length+1||0),u=8,function(d,h,f,p,m,g){var b=d.length,v=new St(p+b+5*(1+Math.floor(b/7e3))+m),_=v.subarray(p,v.length-m),x=0;if(!h||8>b)for(var y=0;b>=y;y+=65535){var w=y+65535;b>w?x=Il(_,x,d.subarray(y,w)):(_[y]=!0,x=Il(_,x,d.subarray(y,b)))}else{for(var C=t2[h-1],k=C>>>13,S=8191&C,D=(1<<f)-1,F=new at(32768),L=new at(D+1),j=Math.ceil(f/3),W=2*j,X=function(Ja){return(d[Ja]^d[Ja+1]<<j^d[Ja+2]<<W)&D},ne=new Xr(25e3),se=new at(288),V=new at(32),he=0,Ce=0,Ze=(y=0,0),bt=0,Oe=0;b>y;++y){var We=X(y),Dt=32767&y,kr=L[We];if(F[Dt]=kr,L[We]=Dt,y>=bt){var xs=b-y;if((he>7e3||Ze>24576)&&xs>423){x=mh(d,_,0,ne,se,V,Ce,Ze,Oe,y-Oe,x),Ze=he=Ce=0,Oe=y;for(var Ot=0;286>Ot;++Ot)se[Ot]=0;for(Ot=0;30>Ot;++Ot)V[Ot]=0}var Jn=2,ks=0,Rb=S,vn=Dt-kr&32767;if(xs>2&&We==X(y-vn))for(var Nb=Math.min(k,xs)-1,Fb=Math.min(32767,y),Ib=Math.min(258,xs);Fb>=vn&&--Rb&&Dt!=kr;){if(d[y+Jn]==d[y+Jn-vn]){for(var yn=0;Ib>yn&&d[y+yn]==d[y+yn-vn];++yn);if(yn>Jn){if(Jn=yn,ks=vn,yn>Nb)break;var Pb=Math.min(vn,yn-2),jd=0;for(Ot=0;Pb>Ot;++Ot){var Ka=y-vn+Ot+32768&32767,Vd=Ka-F[Ka]+32768&32767;Vd>jd&&(jd=Vd,kr=Ka)}}}vn+=(Dt=kr)-(kr=F[Dt])+32768&32767}if(ks){ne[Ze++]=268435456|Nl[Jn]<<18|fh[ks];var qd=31&Nl[Jn],Wd=31&fh[ks];Ce+=jc[qd]+Vc[Wd],++se[257+qd],++V[Wd],bt=y+Jn,++he}else ne[Ze++]=d[y],++se[d[y]]}}x=mh(d,_,!0,ne,se,V,Ce,Ze,Oe,y-Oe,x)}return cm(v,0,p+lm(x)+m)}(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,u)),c=l.length;return function(d,h){var f=h.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>h.level?4:h.level==9?2:0,d[9]=3,h.mtime!=0&&uu(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),f){d[3]=8;for(var p=0;f.length>=p;++p)d[p+10]=f.charCodeAt(p)}}(l,e),uu(l,c-8,n.d()),uu(l,c-4,r),l}var i2=!!sl||!!il,dm="text/plain",gh=!1,Ca=function(t,e,n){var r;n===void 0&&(n=!0);var[i,s]=t.split("?"),o=O({},e),a=(r=s?.split("&").map(l=>{var c,[d,h]=l.split("="),f=n&&(c=o[d])!==null&&c!==void 0?c:h;return delete o[d],d+"="+f}))!==null&&r!==void 0?r:[],u=function(l,c){var d,h;c===void 0&&(c="&");var f=[];return ce(l,function(p,m){P(p)||P(m)||m==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(p)?p.name:p.toString()),h=encodeURIComponent(m),f[f.length]=h+"="+d)}),f.join(c)}(o);return u&&a.push(u),i+"?"+a.join("&")},zr=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),lu=t=>{if(t.er)return t.er;var{data:e,compression:n}=t;if(e){if(n===$t.GZipJS){var r=r2(function(a,u){var l=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new St(a.length+(a.length>>>1)),d=0,h=function(g){c[d++]=g},f=0;l>f;++f){if(d+5>c.length){var p=new St(d+8+(l-f<<1));p.set(c),c=p}var m=a.charCodeAt(f);128>m?h(m):2048>m?(h(192|m>>>6),h(128|63&m)):m>55295&&57344>m?(h(240|(m=65536+(1047552&m)|1023&a.charCodeAt(++f))>>>18),h(128|m>>>12&63),h(128|m>>>6&63),h(128|63&m)):(h(224|m>>>12),h(128|m>>>6&63),h(128|63&m))}return cm(c,0,d)}(zr(e)),{mtime:0});return{contentType:dm,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===$t.Base64){var i=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(u,l)=>String.fromCharCode(parseInt(l,16))))}(zr(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:zr(a)))(i);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=zr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},s2=function(){var t=kt(function*(e){var n=zr(e.data),r=yield function(s,o,a){return ol.apply(this,arguments)}(n,et.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return O({},e,{er:{contentType:dm,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),bh=(t,e)=>Ca(t,{_:new Date().getTime().toString(),ver:et.JS_SDK_VERSION,compression:e}),Xs=[];il&&Xs.push({transport:"fetch",method(t){var e,n,{contentType:r,body:i,estimatedSize:s}=(e=lu(t))!==null&&e!==void 0?e:{},o=new Headers;ce(t.headers,function(c,d){o.append(d,c)}),r&&o.append("Content-Type",r);var a=t.url,u=null;if(Jd){var l=new Jd;u={signal:l.signal,timeout:setTimeout(()=>l.abort(),t.timeout)}}il(a,O({method:t?.method||"GET",headers:o,keepalive:t.method==="POST"&&52428.8>(s||0),body:i,signal:(n=u)==null?void 0:n.signal},t.fetchOptions)).then(c=>c.text().then(d=>{var h={statusCode:c.status,text:d};if(c.status===200)try{h.json=JSON.parse(d)}catch(f){I.error(f)}t.callback==null||t.callback(h)})).catch(c=>{I.error(c),t.callback==null||t.callback({statusCode:0,error:c})}).finally(()=>u?clearTimeout(u.timeout):null)}}),sl&&Xs.push({transport:"XHR",method(t){var e,n=new sl;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=lu(t))!==null&&e!==void 0?e:{};ce(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(s)}},n.send(i)}}),ft!=null&&ft.sendBeacon&&Xs.push({transport:"sendBeacon",method(t){var e=Ca(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=lu(t))!==null&&n!==void 0?n:{};if(!i)return;var s=i instanceof Blob?i:new Blob([i],{type:r});ft.sendBeacon(e,s)}catch{}}});var Pl=3e3;class o2{constructor(e,n){this.Or=!0,this.Pr=[],this.Lr=Vt(n?.flush_interval_ms||Pl,250,5e3,I.createLogger("flush interval"),Pl),this.Dr=e}enqueue(e){this.Pr.push(e),this.Br||this.jr()}unload(){this.$r();var e=this.Pr.length>0?this.qr():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Dr(O({},r,{transport:"sendBeacon"}))})}enable(){this.Or=!1,this.jr()}jr(){var e=this;this.Or||(this.Br=setTimeout(()=>{if(this.$r(),this.Pr.length>0){var n=this.qr(),r=function(){var s=n[i],o=new Date().getTime();s.data&&Q(s.data)&&ce(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Dr(s)};for(var i in n)r()}},this.Lr))}$r(){clearTimeout(this.Br),this.Br=void 0}qr(){var e={};return ce(this.Pr,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;P(e[s])&&(e[s]=O({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.Pr=[],e}}var a2=["retriesPerformedSoFar"];class u2{constructor(e){this.Zr=!1,this.Hr=3e3,this.Pr=[],this._instance=e,this.Pr=[],this.Vr=!0,!P(E)&&"onLine"in E.navigator&&(this.Vr=E.navigator.onLine,this.zr=()=>{this.Vr=!0,this.Ur()},this.Yr=()=>{this.Vr=!1},Ee(E,"online",this.zr),Ee(E,"offline",this.Yr))}get length(){return this.Pr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=p0(e,a2);Or(n)&&(r.url=Ca(r.url,{retry_count:n})),this._instance._send_request(O({},r,{callback:i=>{i.statusCode===200||i.statusCode>=400&&500>i.statusCode||(n??0)>=10?r.callback==null||r.callback(i):this.Wr(O({retriesPerformedSoFar:n},r))}}))}Wr(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),u=a/2,l=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(l+c*(l-u))}(n),i=Date.now()+r;this.Pr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),I.warn(s),this.Zr||(this.Zr=!0,this.Gr())}Gr(){if(this.Xr&&clearTimeout(this.Xr),this.Pr.length===0)return this.Zr=!1,void(this.Xr=void 0);this.Xr=setTimeout(()=>{this.Vr&&this.Pr.length>0&&this.Ur(),this.Gr()},this.Hr)}Ur(){var e=Date.now(),n=[],r=this.Pr.filter(s=>e>s.retryAt||(n.push(s),!1));if(this.Pr=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Xr&&(clearTimeout(this.Xr),this.Xr=void 0),this.Zr=!1,P(E)||(this.zr&&(E.removeEventListener("online",this.zr),this.zr=void 0),this.Yr&&(E.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.Pr))try{this._instance._send_request(O({},e,{transport:"sendBeacon"}))}catch(n){I.error(n)}this.Pr=[]}}class l2{constructor(e){this.Jr=()=>{var n,r,i,s;this.Kr||(this.Kr={});var o=this.scrollElement(),a=this.scrollY(),u=o?Math.max(0,o.scrollHeight-o.clientHeight):0,l=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.Kr.lastScrollY=Math.ceil(a),this.Kr.maxScrollY=Math.max(a,(n=this.Kr.maxScrollY)!==null&&n!==void 0?n:0),this.Kr.maxScrollHeight=Math.max(u,(r=this.Kr.maxScrollHeight)!==null&&r!==void 0?r:0),this.Kr.lastContentY=l,this.Kr.maxContentY=Math.max(l,(i=this.Kr.maxContentY)!==null&&i!==void 0?i:0),this.Kr.maxContentHeight=Math.max(c,(s=this.Kr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get Qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Kr}resetContext(){var e=this.Kr;return setTimeout(this.Jr,0),e}startMeasuringScrollPosition(){Ee(E,"scroll",this.Jr,{capture:!0}),Ee(E,"scrollend",this.Jr,{capture:!0}),Ee(E,"resize",this.Jr)}scrollElement(){if(!this.Qr)return E?.document.documentElement;var e=Q(this.Qr)?this.Qr:[this.Qr];for(var n of e){var r=E?.document.querySelector(n);if(r)return r}}scrollY(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}}var c2=t=>nm(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties);class vh{constructor(e,n,r,i){this.ei=s=>{var o=this.ti();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.ri(this._instance)};this.ii.register({[Ml]:a})}},this._instance=e,this.ni=n,this.ii=r,this.ri=i||c2,this.ni.onSessionId(this.ei)}ti(){return this.ii.props[Ml]}getSetOnceProps(){var e,n=(e=this.ti())==null?void 0:e.props;return n?"r"in n?rm(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return ce(Hc(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+al(r)]=n}),e}}class qc{constructor(){this.si={}}on(e,n){return this.si[e]||(this.si[e]=[]),this.si[e].push(n),()=>{this.si[e]=this.si[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.si[e]||[])r(n);for(var i of this.si["*"]||[])i(e,n)}}var cu=fe("[SessionId]");class yh{on(e,n){return this.oi.on(e,n)}constructor(e,n,r){var i;if(this.ai=[],this.li=void 0,this.oi=new qc,this.ui=(l,c)=>!(!Or(l)||!Or(c))&&Math.abs(l-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===cn)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Lt=e.config,this.ii=e.persistence,this.hi=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.di=n||Tn,this.vi=r||Tn;var s=this.Lt.persistence_name||this.Lt.token;if(this._sessionTimeoutMs=1e3*Vt(this.Lt.session_idle_timeout_seconds||1800,60,36e3,cu.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+s+"_window_id",this.gi="ph_"+s+"_primary_window_exists",this.mi()){var o=He.Z(this.pi),a=He.Z(this.gi);o&&!a?this.hi=o:He.F(this.pi),He.M(this.gi,!0)}if((i=this.Lt.bootstrap)!=null&&i.sessionID)try{var u=(l=>{var c=this.Lt.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.yi(this.Lt.bootstrap.sessionID,new Date().getTime(),u)}catch(l){cu.error("Invalid sessionID in bootstrap",l)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return P(this.ai)&&(this.ai=[]),this.ai.push(e),this.ci&&e(this.ci,this.hi),()=>{this.ai=this.ai.filter(n=>n!==e)}}mi(){return this.Lt.persistence!=="memory"&&!this.ii.br&&He.R()}wi(e){e!==this.hi&&(this.hi=e,this.mi()&&He.M(this.pi,e))}Ii(){return this.hi?this.hi:this.mi()?He.Z(this.pi):null}yi(e,n,r){e===this.ci&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.ci=e,this.ii.register({[po]:[n,e,r]}))}Ci(){var e=this.ii.props[po];return Q(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.yi(null,null,null)}destroy(){clearTimeout(this.Si),this.Si=void 0,this.li&&E&&(E.removeEventListener(yo,this.li,{capture:!1}),this.li=void 0),this.ai=[]}bi(){this.li=()=>{this.mi()&&He.F(this.gi)},Ee(E,yo,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.Lt.cookieless_mode===cn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[i,s,o]=this.Ci(),a=this.Ii(),u=Or(o)&&Math.abs(r-o)>864e5,l=!1,c=!s,d=!c&&!e&&this.ui(r,i);c||d||u?(s=this.di(),a=this.vi(),cu.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}}),o=r,l=!0):a||(a=this.vi(),l=!0);var h=Or(i)&&e&&!u?i:r,f=Or(o)?o:new Date().getTime();return this.wi(a),this.yi(s,h,f),e||this.fi(),l&&this.ai.forEach(p=>p(s,a,l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0,lastActivityTimestamp:i}}fi(){clearTimeout(this.Si),this.Si=setTimeout(()=>{var[e]=this.Ci();if(this.ui(new Date().getTime(),e)){var n=this.ci;this.resetSessionId(),this.oi.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var hm=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&Zd(n,e))return!0;try{var r=t?.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>Zd(i?.brand,e)))return!0}catch{}return!!t.webdriver},So=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function _h(t,e,n){return zr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var fm={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>So(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!So(n,r))),icontains:(t,e)=>e.map(Ts).some(n=>t.map(Ts).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Ts).every(n=>t.map(Ts).every(r=>!n.includes(r))),gt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>r>parseFloat(i))}),lt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>r<parseFloat(i))})},Ts=t=>t.toLowerCase();function pm(t,e){return!t||Object.entries(t).every(n=>{var[r,i]=n,s=e?.[r];if(P(s)||gn(s))return!1;var o=[String(s)],a=fm[i.operator];return!!a&&a(i.values,o)})}var Ll="custom",xh="i.posthog.com",d2=/^\/static\//;class h2{constructor(e){this.xi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+xh,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.xi[this.apiHost]||(this.xi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Ll),this.xi[this.apiHost]}ki(e){var n=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof n=="string"&&d2.test(e))return n.trim().replace(/\/$/,"")||void 0}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(e==="assets"){var r=this.ki(n);if(r)return""+r+n}if(this.region===Ll)return this.apiHost+n;var i=xh+n;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var ie=fe("[Surveys]"),Bl="seenSurvey_",f2=[su.Popover,su.Widget,su.API],p2={ignoreConditions:!1,ignoreDelay:!1,displayType:Rl.Popover},m2=fe("[PostHog ExternalIntegrations]"),g2={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class b2{constructor(e){this._instance=e}lr(e,n){var r;(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return m2.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,u,l;!i||(a=$.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.lr(g2[o],()=>{var c;(c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(u=$.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[o]&&((l=$.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[o])==null||l.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var Sr,Ni={},du=0,$l=()=>{},kh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',fi="Surveys module not available",wh="sanitize_properties is deprecated. Use before_send instead",mm="Invalid value for property_denylist config: ",Fr="posthog",gm=!i2&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,Ch=t=>{var e;return O({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:Fv(N?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:$l,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:ze&&me(ze?.search)&&ze.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){I.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Ol,before_send:void 0,request_queue_config:{flush_interval_ms:Pl},error_tracking:{},_onCapture:$l,__preview_eager_load_replay:!1},(n=>({rageclick:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},v2=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Eh=t=>{var e={};for(var[n,r]of v2)P(t[n])||(e[r]=t[n]);var i=ve({},e,t);return Q(t.property_blacklist)&&(P(t.property_denylist)?i.property_denylist=t.property_blacklist:Q(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:I.error(mm+t.property_denylist)),i};class y2{constructor(){this.__forceAllowLocalhost=!1}get Ti(){return this.__forceAllowLocalhost}set Ti(e){I.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Ct{Ai(e,n){if(e){var r=this.Ei.indexOf(e);r!==-1&&this.Ei.splice(r,1)}return this.Ei.push(n),n.initialize==null||n.initialize(),n}Ri(){return this.config.cookieless_mode===cn||this.config.cookieless_mode===er&&this.consent.isRejected()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new y2,this.Ni=!1,this.version=et.LIB_VERSION,this.Mi=new qc,this.Ei=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Ch(),this.SentryIntegration=qv,this.sentryIntegration=r=>function(i,s){var o=Z0(i,s);return{name:Y0,processEvent:a=>o(a)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Oi=null,this.Pi=null,this.Li=null,this.scrollManager=new l2(this),this.pageViewManager=new uh(this),this.rateLimiter=new Xv(this),this.requestRouter=new h2(this),this.consent=new Hv(this),this.externalIntegrations=new b2(this);var n=(e=Ct.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,i,s)=>{var o=me(r)?{[r]:i}:r;this.setPersonProperties(o),s?.({})},set_once:(r,i,s)=>{var o=me(r)?{[r]:i}:r;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",r=>I.info('send "'+r?.event+'"',r))}init(e,n,r){if(r&&r!==Fr){var i,s=(i=Ni[r])!==null&&i!==void 0?i:new Ct;return s._init(e,n,r),Ni[r]=s,Ni[Fr][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),P(e)||Js(e))return I.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Di(n.debug),this.Bi=n,this.ji=[],n.person_profiles?this.Pi=n.person_profiles:n.process_person&&(this.Pi=n.process_person),this.set_config(ve({},Ch(n.defaults),Eh(n),{name:r,token:e})),this.config.on_xhr_error&&I.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:$t.GZipJS;var o=this.$i();this.persistence=new iu(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new iu(O({},this.config,{persistence:"sessionStorage"}),o);var a=O({},this.persistence.props),u=O({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qi=new o2(g=>this.Zi(g),this.config.request_queue_config),this.Hi=new u2(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new yh(this),this.sessionPropsManager=new vh(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(I.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vi(l)},0)):(I.info("Initializing extensions synchronously"),this.Vi(l)),et.DEBUG=et.DEBUG||this.config.debug,et.DEBUG&&I.info("Starting in debug mode",{this:this,config:n,thisC:O({},this.config),p:a,s:u}),!this.config.identity_distinct_id||(i=n.bootstrap)!=null&&i.distinctID||(n.bootstrap=O({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c=n.bootstrap.distinctID,d=this.get_distinct_id(),h=this.persistence.get_property(Rt);if(n.bootstrap.isIdentifiedID&&d!=null&&d!==c&&h===wr)this.identify(c);else if(n.bootstrap.isIdentifiedID&&d!=null&&d!==c&&h===Cr)I.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var f=this.config.get_device_id(Tn()),p=n.bootstrap.isIdentifiedID?f:c;this.persistence.set_property(Rt,n.bootstrap.isIdentifiedID?Cr:wr),this.register({distinct_id:c,$device_id:p})}}if(l)this.register_once({distinct_id:Cs,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(Tn());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(Rt,wr)}return Ee(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?function(g,b){var v=g.config.segment;if(!v)return b();(function(_,x){var y=_.config.segment;if(!y)return x();var w=k=>{var S=()=>k.anonymousId()||Tn();_.config.get_device_id=S,k.id()&&(_.register({distinct_id:k.id(),$device_id:S()}),_.persistence.set_property(Rt,Cr)),x()},C=y.user();"then"in C&&ln(C.then)?C.then(w):w(C)})(g,()=>{v.register((_=>{Promise&&Promise.resolve||ru.warn("This browser does not have Promise support, and can not use the segment integration");var x=(y,w)=>{if(!w)return y;y.event.userId||y.event.anonymousId===_.get_distinct_id()||(ru.info("No userId set, resetting PostHog"),_.reset()),y.event.userId&&y.event.userId!==_.get_distinct_id()&&(ru.info("UserId set, identifying with PostHog"),_.identify(y.event.userId));var C=_.calculateEventProperties(w,y.event.properties);return y.event.properties=Object.assign({},C,y.event.properties),y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:y=>x(y,y.event.event),page:y=>x(y,Nr),identify:y=>x(y,tu),screen:y=>x(y,"$screen")}})(g)).then(()=>{b()})})}(this,()=>this.zi()):this.zi(),ln(this.config._onCapture)&&this.config._onCapture!==$l&&(I.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",g=>this.config._onCapture(g.event,g))),this.config.ip&&I.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Vi(e){var n,r,i,s,o,a,u,l=performance.now(),c=O({},Ct.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this.Ei.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new c.featureFlags(this)),c.exceptions&&this.Ei.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new c.exceptions(this)),c.historyAutocapture&&this.Ei.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ei.push(new c.tracingHeaders(this)),c.siteApps&&this.Ei.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Ei.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Ei.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ei.push(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new c.surveys(this)),c.logs&&this.Ei.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new c.logs(this)),c.conversations&&this.Ei.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.Ei.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ei.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ei.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ei.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ei.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Vv)),c.toolbar&&this.Ei.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new c.toolbar(this)),c.experiments&&this.Ei.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new c.experiments(this)),this.Ei.forEach(h=>{h.initialize&&d.push(()=>{h.initialize==null||h.initialize()})}),d.push(()=>{if(this.Ui){var h=this.Ui;this.Ui=void 0,this.Rr(h)}}),this.Yi(d,l)}Yi(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Yi(e,n)},0);var r=e.shift();if(r)try{r()}catch(s){I.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-n);this.register_for_session({[W0]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[U0]:i}),this.config.__preview_deferred_init_extensions&&I.info("PostHog extensions initialized ("+i+"ms)")}Rr(e){var n;if(!N||!N.body)return I.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Rr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Ui=e),this.Wi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=G(e.supportedCompression,$t.GZipJS)?$t.GZipJS:G(e.supportedCompression,$t.Base64)?$t.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:Ol}),this.Ei.forEach(r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e))}zi(){try{this.config.loaded(this)}catch(r){I.critical("`loaded` function failed",r)}if(this.Gi(),this.config.internal_or_test_user_hostname&&ze!=null&&ze.hostname){var e=ze.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ri())&&this.Xi()},1),this.Ji=new sm(this),this.Ji.load()}Gi(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Es(this.__request_queue,e=>this.Zi(e)),this.__request_queue=[],this.Gi()}_handle_unload(){var e,n,r,i;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Ki()&&this.capture(eu),(n=this.logs)==null||n.flushLogs("sendBeacon"),(r=this.qi)==null||r.unload(),(i=this.Hi)==null||i.unload()):this.Ki()&&this.capture(eu,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(gm?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ca(e.url,{ip:this.config.ip?1:0}),e.headers=O({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=O({},n);o.timeout=o.timeout||6e4,o.url=bh(o.url,o.compression);var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",u=Xs.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),l=(i=(s=function(c,d){for(var h=0;c.length>h;h++)if(c[h].transport===a)return c[h]}(u))==null?void 0:s.method)!==null&&i!==void 0?i:u[0].method;if(!l)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===$t.GZipJS&&qb&&!gh?s2(o).then(c=>{l(c)}).catch(c=>{if((d=>!(!d||typeof d!="object")&&("name"in d?String(d.name):"")==="NotReadableError")(c))return gh=!0,void l(O({},o,{compression:void 0,url:bh(n.url,void 0)}));l(o)}):l(o)})(O({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(i=this.config).on_request_error)==null||r.call(i,n),e.callback==null||e.callback(n)}}))))}Zi(e){this.Hi?this.Hi.retriableRequest(e):this._send_request(e)}_execute_array(e){du++;try{var n,r=[],i=[],s=[];Es(e,a=>{a&&(Q(n=a[0])?s.push(a):ln(a)?a.call(this):Q(a)&&n==="alias"?r.push(a):Q(a)&&n.indexOf("capture")!==-1&&ln(this[n])?s.push(a):i.push(a))});var o=function(a,u){Es(a,function(l){if(Q(l[0])){var c=u;ce(l,function(d){c=c[d[0]].apply(c,d.slice(1))})}else u[l[0]].apply(u,l.slice(1))})};o(r,this),o(i,this),o(s,this)}finally{du--}}push(e){if(du>0&&Q(e)&&me(e[0])){var n=Ct.prototype[e[0]];ln(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var i,s,o,a,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qi){if(this.is_capturing())if(!P(e)&&me(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var c=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){n!=null&&n.$current_url&&!me(n?.$current_url)&&(I.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||r!=null&&r.Qi||I.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,h=r?.timestamp||d,f=Tn(),p={uuid:f,event:e,properties:this.calculateEventProperties(e,n||{},h,f)};e===Nr&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),r?.$set&&(p.$set=r?.$set);var m,g,b,v=this.en(r?.$set_once,e!==ih,e===tu);if(v&&(p.$set_once=v),r!=null&&r._noTruncate||(s=this.config.properties_string_max_length,o=p,a=S=>me(S)?S.slice(0,s):S,u=new Set,p=function S(D,F){return D!==Object(D)?a?a(D):D:u.has(D)?void 0:(u.add(D),Q(D)?(L=[],Es(D,j=>{L.push(S(j))})):(L={},ce(D,(j,W)=>{u.has(j)||(L[W]=S(j))})),L);var L}(o)),p.timestamp=h,P(r?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===Ei.DISMISSED||e===Ei.SENT){var _=n?.[ou.SURVEY_ID],x=n?.[ou.SURVEY_ITERATION];(S=>{try{var D=(F=>((L,j)=>{var W=""+Bl+j.id;return j.current_iteration&&j.current_iteration>0&&(W=""+Bl+j.id+"_"+j.current_iteration),W})(0,F))(S);if(localStorage.getItem(D))return;localStorage.setItem(D,"true")}catch(F){ie.error("Failed to persist survey seen state",F)}})({id:_,current_iteration:x}),p.$set=O({},p.$set,{[(m={id:_,current_iteration:x},g=e===Ei.SENT?"responded":"dismissed",b="$survey_"+g+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(b="$survey_"+g+"/"+m.id+"/"+m.current_iteration),b)]:!0})}else e===Ei.SHOWN&&(p.$set=O({},p.$set,{[ou.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===Zv.SHOWN){var y=n?.[ch.TOUR_TYPE];y&&(p.$set=O({},p.$set,{[ch.TOUR_LAST_SEEN_DATE+"/"+y]:new Date().toISOString()}))}var w=O({},p.properties.$set,p.$set);if(Br(w)||this.setPersonPropertiesForFlags(w),!Y(this.config.before_send)){var C=this.tn(p);if(!C)return;p=C}this.Mi.emit("eventCaptured",p);var k={method:"POST",url:(i=r?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Zi(k):this.qi.enqueue(k),p}I.critical("This capture call is ignored due to client rate limiting.")}}else I.error("No event name provided to posthog.capture")}else I.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=s?void 0:this.persistence.remove_event_timer(e),a=O({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Ri()&&(a.$cookieless_mode=!0),e==="$snapshot"){var u=O({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!me(a.distinct_id)&&!Tt(a.distinct_id)||Js(a.distinct_id))&&I.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,c=function(b,v){var _,x,y,w;if(!st)return{};var C,k,S,D,F,L,j,W,X=b?[...Zr,...v||[]]:[],[ne,se]=function(V){for(var he=0;eh.length>he;he++){var[Ce,Ze]=eh[he],bt=Ce.exec(V),Oe=bt&&(ln(Ze)?Ze(bt,V):Ze);if(Oe)return Oe}return["",""]}(st);return ve(Hc({$os:ne,$os_version:se,$browser:N0(st,navigator.vendor),$device:th(st),$device_type:(k=st,S={userAgentDataPlatform:(_=navigator)==null||(_=_.userAgentData)==null?void 0:_.platform,maxTouchPoints:(x=navigator)==null?void 0:x.maxTouchPoints,screenWidth:E==null||(y=E.screen)==null?void 0:y.width,screenHeight:E==null||(w=E.screen)==null?void 0:w.height,devicePixelRatio:E?.devicePixelRatio},W=th(k),W===y0||W===v0||W==="Kobo"||W==="Kindle Fire"||W===R0?Jr:W===Wi||W===qr||W===Ui||W===ll?"Console":W===x0?"Wearable":W?pt:S?.userAgentDataPlatform==="Android"&&((D=S?.maxTouchPoints)!==null&&D!==void 0?D:0)>0?600>Math.min((F=S?.screenWidth)!==null&&F!==void 0?F:0,(L=S?.screenHeight)!==null&&L!==void 0?L:0)/((j=S?.devicePixelRatio)!==null&&j!==void 0?j:1)?pt:Jr:"Desktop"),$timezone:im(),$timezone_offset:Gv()}),{$current_url:Ki(ze?.href,X,Ji),$host:ze?.host,$pathname:ze?.pathname,$raw_user_agent:st.length>1e3?st.substring(0,997)+"...":st,$browser_version:ov(st,navigator.vendor),$browser_language:lh(),$browser_language_prefix:(C=lh(),typeof C=="string"?C.split("-")[0]:void 0),$screen_height:E?.screen.height,$screen_width:E?.screen.width,$viewport_height:E?.innerHeight,$viewport_width:E?.innerWidth,$lib:et.LIB_NAME,$lib_version:et.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&ve(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ve(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.Hi)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===Ll&&(a.$lib_custom_api_host=this.config.api_host),l=e!==Nr||s?e!==eu||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=ve(a,l),e===Nr&&N&&(a.title=N.title),!P(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}st&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=ve({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Q(this.config.property_denylist)?ce(this.config.property_denylist,function(b){delete a[b]}):I.error(mm+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(I.error(wh),a=m(a,e));var g=this.rn();return a.$process_person_profile=g,g&&!s&&this.nn("_calculate_event_properties"),a}en(e,n,r){var i;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.rn()||this.Ni&&!r)return e;var s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=ve({},s,o||{},e||{}),u=this.config.sanitize_properties;return u&&(I.error(wh),a=u(a,"$set_once")),n&&(this.Ni=!0),Br(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}sn(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}isFeatureEnabled(e,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var i;(i=this.featureFlags)==null||i.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var i;(i=this.featureFlags)==null||i.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var i;return n===void 0&&(n=!1),(i=this.featureFlags)==null?void 0:i.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Mi.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:fi}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:fi})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:fi})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=p2),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:fi}}canRenderSurveyAsync(e,n){var r,i;return n===void 0&&(n=!1),(r=(i=this.surveys)==null?void 0:i.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:fi})}an(e){return!e||Js(e)?(I.critical("Unique user id has not been set in posthog.identify"),!1):e===Cs?(I.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(I.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,r){if(!this.__loaded||!this.persistence)return I.uninitializedWarning("posthog.identify");if(Tt(e)&&(e=e.toString(),I.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.an(e)&&this.nn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(fo)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(_i)&&(this.unregister(_i),this.register({distinct_id:e}));var s,o=(this.persistence.get_property(Rt)||wr)===wr;e!==i&&o?(this.persistence.set_property(Rt,Cr),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(tu,{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Li=_h(e,n,r),(s=this.featureFlags)==null||s.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(Oi))}}setPersonProperties(e,n){if((e||n)&&this.nn("posthog.setPersonProperties")){var r=_h(this.get_distinct_id(),e,n);this.Li!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Li=r):I.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){var i=this.getGroups(),s=i[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:O({},i,{[e]:n})}),s||r){var o={$group_type:e,$group_key:n};r&&(o.$group_set=r),this.capture(ih,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),s&&!r&&this.reloadFeatureFlags()}else I.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.nn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s,o,a,u,l;if(I.info("reset"),!this.__loaded)return I.uninitializedWarning("posthog.reset");var c=this.get_property(fo);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),(i=this.surveys)==null||i.reset(),(s=this.Ji)==null||s.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(u=this.persistence)==null||u.set_property(Rt,wr),(l=this.sessionManager)==null||l.resetSessionId(),this.Li=null,this.config.cookieless_mode===cn)this.register_once({distinct_id:Cs,$device_id:null},"");else{var d=this.config.get_device_id(Tn());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,n){var r;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(r=this.conversations)==null||r.ln()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.un()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property($0)?(I.critical("Attempting to create alias for existing People user - aborting."),-2):this.nn("posthog.alias")?(P(n)&&(n=this.get_distinct_id()),e!==n?(this.sn(_i,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(I.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=O({},this.config);if(ke(e)){var r,i,s,o,a,u,l,c,d,h;ve(this.config,Eh(e));var f=this.$i();(r=this.persistence)==null||r.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new iu(O({},this.config,{persistence:"sessionStorage"}),f);var p=this.Di(this.config.debug);jt(p)&&(this.config.debug=p),jt(this.config.debug)&&(this.config.debug?(et.DEBUG=!0,pe.R()&&pe.M("ph_debug",!0),I.info("set_config",{config:e,oldConfig:n,newConfig:O({},this.config)})):(et.DEBUG=!1,pe.R()&&pe.F("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.hn(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){et.LIB_NAME=e,et.LIB_VERSION=n}startSessionRecording(e){var n,r,i,s,o,a=e===!0,u={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),u.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(O({},i,n))}}addExceptionStep(e,n){var r;(r=this.exceptions)==null||r.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:Ct.cn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Fr;return n!==Fr&&(n=Fr+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Rt))===Cr||((n=this.sessionPersistence)==null?void 0:n.get_property(Rt))===Cr}rn(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Ol&&!this._isIdentified()&&Br(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[_i])&&((n=this.persistence)==null||(n=n.props)==null||!n[bo]))}Ki(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.rn()||this.nn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.nn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}nn(e){return this.config.person_profiles==="never"?(I.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sn(bo,!0),!0)}$i(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==er)}hn(){var e,n,r,i,s=this.$i();return((e=this.persistence)==null?void 0:e.br)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.br)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==cn){if(this.Ri()){var r,i,s,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new yh(this),this.pageViewManager=new uh(this),this.persistence&&(this.sessionPropsManager=new vh(this,this.sessionManager,this.persistence));var u,l=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=Ct.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ai(this.sessionRecording,new l(this)),this.Wi&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.Wi)))}var c,d;this.consent.optInOut(!0),this.hn(),this.Gi(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==er&&((c=this.surveys)==null||c.loadIfEnabled()),(P(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e?.captureEventName)!==null&&d!==void 0?d:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Xi()}else I.warn(kh)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==cn?(this.config.cookieless_mode===er&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.hn(),this.config.cookieless_mode===er&&(this.register({distinct_id:Cs,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Xi())):I.warn(kh)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===cn||(this.config.cookieless_mode===er?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hn()}_is_bot(){return ft?hm(ft,this.config.custom_blocked_useragents):void 0}Xi(){N&&(N.visibilityState==="visible"?this.Fi||(this.Fi=!0,this.capture(Nr,{title:N.title},{send_instantly:!0}),this.Oi&&(N.removeEventListener(vo,this.Oi),this.Oi=null)):this.Oi||(this.Oi=this.Xi.bind(this),Ee(N,vo,this.Oi)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Mr(){var e,n,r,i,s,o,a=this.Bi||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(I.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=I,s=(n="advanced_disable_flags")in(e=a)&&!Y(e[n]),o=r in e&&!Y(e[r]),s?e[n]:!!o&&(i&&i.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]))}tn(e){if(Y(this.config.before_send))return e;var n=Q(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),Y(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return Jb(e.event)?I.warn(s+". This can cause unexpected behavior."):I.info(s),null}r.properties&&!Br(r.properties)||I.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.cr)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Di(e){var n=jt(e)&&!e,r=pe.R()&&pe.O("ph_debug")==="true";return!n&&(!!r||e)}}function Sh(t){return t instanceof Element&&(t.id===q0||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Ea(t){return!!t&&t.nodeType===1}function Bn(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function bm(t){return!!t&&t.nodeType===3}function vm(t){return!!t&&t.nodeType===11}function Wc(t){return t?ka(t).split(/\s+/):[]}function Mh(t){var e=E?.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function Mo(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Wc(e)}function ym(t){return Y(t)?null:ka(t).split(/(\s+)/).filter(e=>Fi(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Gi(t){var e="";return Hl(t)&&!xm(t)&&t.childNodes&&t.childNodes.length&&ce(t.childNodes,function(n){var r;bm(n)&&n.textContent&&(e+=(r=ym(n.textContent))!==null&&r!==void 0?r:"")}),ka(e)}function Ah(t){return P(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}Ct.__defaultExtensionClasses={},Ct.cn={trace:Sr=()=>{},debug:Sr,info:Sr,warn:Sr,error:Sr,fatal:Sr},function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=Rv(t.prototype[e[n]])}(Ct,["identify"]);var Uc=["a","button","form","input","select","textarea","label"];function Th(t,e){if(P(e))return!0;var n,r=function(s){if(e.some(o=>s.matches(o)))return{v:!0}};for(var i of t)if(n=r(i))return n.v;return!1}function _m(t){var e=t.parentNode;return!(!e||!Ea(e))&&e}var _2=["next","previous","prev",">","<"],Dh=[".ph-no-rageclick",".ph-no-capture"],zl=t=>!t||Bn(t,"html")||!Ea(t),Oh=(t,e)=>{if(!E||zl(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],i=t;i.parentNode&&!Bn(i,"body");)if(vm(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=_m(i);if(!s)break;if(e||Uc.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=E.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(s),i=s}return{parentIsUsefulElement:n,targetElementList:r}};function Hl(t){for(var e=t;e.parentNode&&!Bn(e,"body");e=e.parentNode){var n=Mo(e);if(G(n,"ph-sensitive")||G(n,"ph-no-capture"))return!1}if(G(Mo(t),"ph-include"))return!0;var r=t.type||"";if(me(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=t.name||t.id||"";return!me(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function xm(t){return!!(Bn(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Bn(t,"select")||Bn(t,"textarea")||t.getAttribute("contenteditable")==="true")}var km="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",x2=new RegExp("^(?:"+km+")$"),k2=new RegExp(km),wm="\\d{3}-?\\d{2}-?\\d{4}",w2=new RegExp("^("+wm+")$"),C2=new RegExp("("+wm+")");function Fi(t,e){return e===void 0&&(e=!0),!(Y(t)||me(t)&&(t=ka(t),(e?x2:k2).test((t||"").replace(/[- ]/g,""))||(e?w2:C2).test(t)))}function Rh(t){var e=Gi(t);return Fi(e=(e+" "+Cm(t)).trim())?e:""}function Cm(t){var e="";return t&&t.childNodes&&t.childNodes.length&&ce(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=Gi(n);e=(e+" "+i).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Cm(n)).trim())}catch(s){I.error("[AutoCapture]",s)}}),e}function Nh(t){return t.replace(/"|\\"/g,'\\"')}function E2(t){var e=t.attr__class;return e?Q(e)?e:Wc(e):void 0}class Fh{constructor(e){this.disabled=e===!1;var n=ke(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var hu="$copy_autocapture",Ih=fe("[AutoCapture]");function fu(t,e){return e.length>t?e.slice(0,t)+"...":e}function S2(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Ea(e));return e}function M2(t,e){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:u}=e,l=[t],c=t;c.parentNode&&!Bn(c,"body");)vm(c.parentNode)?(l.push(c.parentNode.host),c=c.parentNode.host):(l.push(c.parentNode),c=c.parentNode);var d,h,f=[],p={},m=!1,g=!1;if(ce(l,y=>{var w=Hl(y);y.tagName.toLowerCase()==="a"&&(m=y.getAttribute("href"),m=w&&m&&Fi(m)&&m),G(Mo(y),"ph-no-capture")&&(g=!0),f.push(function(k,S,D,F){var L=k.tagName.toLowerCase(),j={tag_name:L};Uc.indexOf(L)>-1&&!D&&(j.$el_text=L.toLowerCase()==="a"||L.toLowerCase()==="button"?fu(1024,Rh(k)):fu(1024,Gi(k)));var W=Mo(k);W.length>0&&(j.classes=W.filter(function(V){return V!==""})),ce(k.attributes,function(V){var he;if((!xm(k)||["name","id","class","aria-label"].indexOf(V.name)!==-1)&&(F==null||!F.includes(V.name))&&!S&&Fi(V.value)&&(!me(he=V.name)||he.substring(0,10)!=="_ngcontent"&&he.substring(0,7)!=="_nghost")){var Ce=V.value;V.name==="class"&&(Ce=Wc(Ce).join(" ")),j["attr__"+V.name]=fu(1024,Ce)}});for(var X=1,ne=1,se=k;se=S2(se);)X++,se.tagName===k.tagName&&ne++;return j.nth_child=X,j.nth_of_type=ne,j}(y,s,o,a));var C=function(k){if(!Hl(k))return{};var S={};return ce(k.attributes,function(D){if(D.name&&D.name.indexOf("data-ph-capture-attribute")===0){var F=D.name.replace("data-ph-capture-attribute-",""),L=D.value;F&&L&&Fi(L)&&(S[F]=L)}}),S}(y);ve(p,C)}),g)return{props:{},explicitNoCapture:g};if(o||(f[0].$el_text=t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?Rh(t):Gi(t)),m){var b,v;f[0].attr__href=m;var _=(b=xo(m))==null?void 0:b.host,x=E==null||(v=E.location)==null?void 0:v.host;_&&x&&_!==x&&(d=m)}return{props:ve({$event_type:i.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(h=f,function(y){return y.map(w=>{var C,k,S="";if(w.tag_name&&(S+=w.tag_name),w.attr_class)for(var D of(w.attr_class.sort(),w.attr_class))S+="."+D.replace(/"/g,"");var F=O({},w.text?{text:w.text}:{},{"nth-child":(C=w.nth_child)!==null&&C!==void 0?C:0,"nth-of-type":(k=w.nth_of_type)!==null&&k!==void 0?k:0},w.href?{href:w.href}:{},w.attr_id?{attr_id:w.attr_id}:{},w.attributes),L={};return Zs(F).sort((j,W)=>{var[X]=j,[ne]=W;return X.localeCompare(ne)}).forEach(j=>{var[W,X]=j;return L[Nh(W.toString())]=Nh(X.toString())}),(S+=":")+Zs(L).map(j=>{var[W,X]=j;return W+'="'+X+'"'}).join("")}).join(";")}(function(y){return y.map(w=>{var C,k,S={text:(C=w.$el_text)==null?void 0:C.slice(0,400),tag_name:w.tag_name,href:(k=w.attr__href)==null?void 0:k.slice(0,2048),attr_class:E2(w),attr_id:w.attr__id,nth_child:w.nth_child,nth_of_type:w.nth_of_type,attributes:{}};return Zs(w).filter(D=>{var[F]=D;return F.indexOf("attr__")===0}).forEach(D=>{var[F,L]=D;return S.attributes[F]=L}),S})}(h)))},(n=f[0])!=null&&n.$el_text?{$el_text:(r=f[0])==null?void 0:r.$el_text}:{},d&&i.type==="click"?{$external_click_url:d}:{},p)}}var pi=fe("[ExceptionAutocapture]");function Ph(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],i=n(r);return ln(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}var A2=fe("[TracingHeaders]"),_n=fe("[Web Vitals]"),Lh=9e5,Bh="disabled",$h="lazy_loading",mi="awaiting_config",Ds="missing_config";fe("[SessionRecording]"),fe("[SessionRecording]");var jl="[SessionRecording]",xn=fe(jl),T2=fe("[Heatmaps]");function zh(t){return ke(t)&&"clientX"in t&&"clientY"in t&&Tt(t.clientX)&&Tt(t.clientY)}var Hh=fe("[Product Tours]"),D2=["$set_once","$set"],kn=fe("[SiteApps]"),jh="Error while initializing PostHog app with config id ";function Mr(t,e,n){if(Y(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class O2{constructor(e){this.dn=new qc,this.vn=(n,r)=>this.fn(n,r)&&this.pn(n,r)&&this.gn(n,r)&&this.mn(n,r),this.fn=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=e,this.yn=new Set,this.bn=new Set}init(){var e,n;P((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook((r,i)=>{this.on(r,i)})}register(e){var n,r;if(!P((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach(o=>{var a,u;(a=this.bn)==null||a.add(o),(u=o.steps)==null||u.forEach(l=>{var c;(c=this.yn)==null||c.add(l?.event||"")})}),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(u=>{u!=null&&u.selector&&s.add(u?.selector)})}),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.yn.has(e)||this.yn.has(n?.event))&&this.bn&&((r=this.bn)==null?void 0:r.size)>0&&this.bn.forEach(i=>{this._n(n,i)&&this.dn.emit("actionCaptured",i.name)})}wn(e){this.onAction("actionCaptured",n=>e(n))}_n(e,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.vn(e,r))return!0;return!1}onAction(e,n){return this.dn.on(e,n)}pn(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Mr(i,n.url,n.url_matching||"contains"))return!1}return!0}gn(e,n){return!!this.In(e,n)&&!!this.Cn(e,n)&&!!this.Sn(e,n)}In(e,n){var r;if(n==null||!n.href)return!0;var i=this.xn(e);if(i.length>0)return i.some(a=>Mr(a.href,n.href,n.href_matching||"exact"));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Mr((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}Cn(e,n){var r;if(n==null||!n.text)return!0;var i=this.xn(e);if(i.length>0)return i.some(l=>Mr(l.text,n.text,n.text_matching||"exact")||Mr(l.$el_text,n.text,n.text_matching||"exact"));var s,o,a,u=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!u&&(s=function(l){for(var c,d=[],h=/(?::|")text="(.*?)"/g;!Y(c=h.exec(l));)d.includes(c[1])||d.push(c[1]);return d}(u),o=n.text,a=n.text_matching||"exact",s.some(l=>Mr(l,o,a)))}Sn(e,n){var r,i;if(n==null||!n.selector)return!0;var s=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}xn(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e?.properties.$elements}mn(e,n){return n==null||!n.properties||n.properties.length===0||pm(n.properties.reduce((r,i)=>{var s=Q(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return r[i.key]={values:s,operator:i.operator||"exact"},r},{}),e?.properties)}}class R2{constructor(e){this._instance=e,this.kn=new Map,this.Tn=new Map,this.An=new Map}En(e,n){return!!e&&pm(e.propertyFilters,n?.properties)}Rn(e,n){var r=new Map;return e.forEach(i=>{var s;(s=i.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(i.id),r.set(o.name,a)}})}),r}Nn(e,n,r){var i=(r===li.Activation?this.kn:this.Tn).get(e),s=[];return this.Mn(o=>{s=o.filter(a=>i?.includes(a.id))}),s.filter(o=>{var a,u=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(l=>l.name===e);return this.En(u,n)})}register(e){var n;P((n=this._instance)==null?void 0:n._addCaptureHook)||(this.Fn(e),this.On(e))}On(e){var n=e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.Pn==null&&(this.Pn=new O2(this._instance),this.Pn.init(),this.Pn.wn(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,u;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.Pn)==null||a.register(r.conditions.actions.values),(u=r.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach(l=>{if(l&&l.name){var c=this.An.get(l.name);c&&c.push(r.id),this.An.set(l.name,c||[r.id])}}))}))}Fn(e){var n,r=e.filter(s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}),i=e.filter(s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0});r.length===0&&i.length===0||((n=this._instance)==null||n._addCaptureHook((s,o)=>{this.onEvent(s,o)}),this.kn=this.Rn(e,li.Activation),this.Tn=this.Rn(e,li.Cancellation))}onEvent(e,n){var r,i=this.ue(),s=this.Ln(),o=this.Dn(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[s])||[];if(o===e&&n&&a.length>0){var u,l;i.info("event matched, removing item from activated items",{event:e,eventPayload:n,existingActivatedItems:a});var c=(n==null||(u=n.properties)==null?void 0:u.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(c){var d=a.indexOf(c);0>d||(a.splice(d,1),this.Bn(a))}}else{if(this.Tn.has(e)){var h=this.Nn(e,n,li.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(p=>p.id)}),h.forEach(p=>{var m=a.indexOf(p.id);0>m||a.splice(m,1),this.jn(p.id)}),this.Bn(a))}if(this.kn.has(e)){i.info("event name matched",{event:e,eventPayload:n,items:this.kn.get(e)});var f=this.Nn(e,n,li.Activation);this.Bn(a.concat(f.map(p=>p.id)||[]))}}}onAction(e){var n,r=this.Ln(),i=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[r])||[];this.An.has(e)&&this.Bn(i.concat(this.An.get(e)||[]))}Bn(e){var n=this.ue(),r=[...new Set(e)].filter(i=>!this.$n(i));n.info("updating activated items",{activatedItems:r}),this.qn(r)}getActivatedIds(){var e,n=this.Ln();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getEventToItemsMap(){return this.kn}Zn(){return this.Pn}}class N2 extends R2{constructor(e){super(e)}Ln(){return Cl}Dn(){return Ei.SHOWN}Mn(e){var n;(n=this._instance)==null||n.getSurveys(e)}jn(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}ue(){return ie}qn(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Cl]:e})}$n(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var pu="SDK is not enabled or survey functionality is not yet loaded",Vh="Disabled. Not loading surveys.",F2=E!=null&&E.location?wo(E.location.hash,"__posthog")||wo(location.hash,"state"):null,qh="_postHogToolbarParams",Wh=fe("[Toolbar]"),Xe=fe("[FeatureFlags]"),Yn=fe("[FeatureFlags]",{debugEnabled:!0}),mu=`" failed. Feature flags didn't load in time.`,Uh=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},Kh=t=>{var e={};for(var[n,r]of Zs(t||{}))r&&(e[n]=r);return e},en=fe("[Error tracking]"),Jh="Refusing to render web experiment since the viewer is a likely bot",I2={icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!E&&So(e.href,t),not_regex:(t,e)=>!!E&&!So(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Ue{get Lt(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{Ue.Hn("retrieved web experiments from the server"),n.Vn=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n.Vn&&(Ue.Hn("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n.Vn)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);me(a)&&s.variants[a]&&n.zn(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var u in s.variants){var l=s.variants[u];Ue.Un(l)&&n.zn(s.name,u,l.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())Ue.Hn(Jh);else if(!this.Lt.disable_web_experiments){if(Y(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ue.Hn("applying feature flags",e),e.forEach(n=>{var r;if(this.Vn&&(r=this.Vn)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this.Vn)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.zn(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=Ue.getWindowLocation();if(e!=null&&e.search){var n=ko(e?.search,"__experiment_id"),r=ko(e?.search,"__experiment_variant");n&&r&&(Ue.Hn("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.Yn(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.Lt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.Lt.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Lt.token),method:"GET",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Yn(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(Ue.Hn("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.zn(i[0].name,n,i[0].variants[n].transforms))}static Un(e){return!Y(e.conditions)&&Ue.Wn(e)&&Ue.Gn(e)}static Wn(e){var n;if(Y(e.conditions)||Y((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=Ue.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||I2[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Gn(e){var n;if(Y(e.conditions)||Y((n=e.conditions)==null?void 0:n.utm))return!0;var r=X0();if(r.utm_source){var i,s,o,a,u,l,c,d,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_medium)==r.utm_medium,m=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return h&&p&&m&&f}return!1}static Hn(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];I.info("[WebExperiments] "+e,r)}zn(e,n,r){this._is_bot()?Ue.Hn(Jh):n!=="control"?r.forEach(i=>{if(i.selector){var s;Ue.Hn("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach(a=>{var u=a;i.html&&(u.innerHTML=i.html),i.css&&u.setAttribute("style",i.css)})}}):Ue.Hn("Control variants leave the page unmodified.")}_is_bot(){return ft&&this._instance?hm(ft,this.Lt.custom_blocked_useragents):void 0}}var vt=fe("[Conversations]"),Zn="Conversations not available yet.",Sa={featureFlags:class{constructor(t){this.Xn=!1,this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Lt(){return this._instance.config}get ii(){return this._instance.persistence}ss(t){return this._instance.get_property(t)}os(){var t,e;return(t=(e=this.ii)==null?void 0:e._r(this.Lt.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,Xe.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var t,e=(t=this.Lt.evaluation_contexts)!==null&&t!==void 0?t:this.Lt.evaluation_environments;return!this.Lt.evaluation_environments||this.Lt.evaluation_contexts||this.rs||(Xe.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Xe.error("Invalid evaluation context found:",n,"Expected non-empty string"),r}):[]}hs(){return this.us().length>0}initialize(){var t,e,{config:n}=this._instance,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var i,s,o=(i=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(r).filter(l=>!!r[l]).reduce((l,c)=>(l[c]=r[c]||!1,l),{}),u=Object.keys(o).filter(l=>a[l]).reduce((l,c)=>(o[c]&&(l[c]=o[c]),l),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:u})}}updateFlags(t,e,n){var r=n!=null&&n.merge?this.getFlagVariants():{},i=n!=null&&n.merge?this.getFlagPayloads():{},s=O({},r,t),o=O({},i,e),a={};for(var[u,l]of Object.entries(s)){var c=typeof l=="string";a[u]={key:u,enabled:!!c||!!l,variant:c?l:void 0,reason:void 0,metadata:P(o?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:o[u]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ss(_l),e=this.ss(sn),n=this.ss(Rr);if(!n&&!e)return t||{};var r=ve({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var s of i){var o,a,u=r[s],l=e?.[s],c=P(l)?(o=u?.enabled)!==null&&o!==void 0&&o:!!l,d=P(l)?u.variant:typeof l=="string"?l:void 0,h=n?.[s],f=O({},u,{enabled:c,variant:c?d??u?.variant:void 0});c!==u?.enabled&&(f.original_enabled=u?.enabled),d!==u?.variant&&(f.original_variant=u?.variant),h&&(f.metadata=O({},u?.metadata,{payload:h,original_payload:u==null||(a=u.metadata)==null?void 0:a.payload})),r[s]=f}return this.Xn||(Xe.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.Xn=!0),r}getFlagVariants(){var t=this.ss($r),e=this.ss(sn);if(!e)return t||{};for(var n=ve({},t),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.Xn||(Xe.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Xn=!0),n}getFlagPayloads(){var t=this.ss(xl),e=this.ss(Rr);if(!e)return t||{};for(var n=ve({},t||{}),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.Xn||(Xe.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Xn=!0),n}reloadFeatureFlags(){this.Qn||this.Lt.advanced_disable_feature_flags||this.cs||(this._instance.Mi.emit("featureFlagsReloading",!0),this.cs=setTimeout(()=>{this.ds()},5))}vs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Jn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qn=t}ds(t){var e;if(this.vs(),!this._instance.Mr())if(this.Kn)this.es=!0;else{var n=this.Lt.token,r=this.ss(fo),i={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:O({},((e=this.ii)==null?void 0:e.get_initial_props())||{},this.ss(Ci)||{}),group_properties:this.ss(Qn),timezone:im()};gn(r)||P(r)||(i.$device_id=r),(t!=null&&t.disableFlags||this.Lt.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.hs()&&(i.evaluation_contexts=this.us());var s=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Lt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:s,data:i,compression:this.Lt.disable_compression?void 0:$t.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback:o=>{var a,u,l,c=!0;if(o.statusCode===200&&(this.es||(this.$anon_distinct_id=void 0),c=!1),this.Kn=!1,!i.disable_flags||this.es){this.ts=!c;var d=[];o.error?o.error instanceof Error?d.push(o.error.name==="AbortError"?"timeout":"connection_error"):d.push("unknown_error"):o.statusCode!==200&&d.push("api_error_"+o.statusCode),(a=o.json)!=null&&a.errorsWhileComputingFlags&&d.push("errors_while_computing_flags");var h,f=!((u=o.json)==null||(u=u.quotaLimited)==null||!u.includes("feature_flags"));f&&d.push("quota_limited"),(l=this.ii)==null||l.register({[Sl]:d}),f?Xe.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(i.disable_flags||this.receivedFeatureFlags((h=o.json)!==null&&h!==void 0?h:{},c,{partialResponse:!!this.Lt.advanced_only_evaluate_survey_feature_flags}),this.es&&(this.es=!1,this.ds()))}}})}}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(t,e);return(n=r?.variant)!==null&&n!==void 0?n:r?.enabled}}else Xe.warn('getFeatureFlag for key "'+t+mu)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var n=this.getFlagVariants(),r=t in n,i=n[t],s=this.getFlagPayloads()[t],o=String(i),a=this.ss(kl)||void 0,u=this.ss(mo)||void 0,l=this.ss(Oi)||{};if(this.Lt.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this.ss(El);d&&d!==h&&(l={},(c=this.ii)==null||c.register({[Oi]:l,[El]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in l)||!l[t].includes(o))){var f,p,m,g,b,v,_,x,y,w;Q(l[t])?l[t].push(o):l[t]=[o],(f=this.ii)==null||f.register({[Oi]:l});var C=this.getFeatureFlagDetails(t),k=[...(p=this.ss(Sl))!==null&&p!==void 0?p:[]];P(i)&&k.push("flag_missing");var S={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((m=this.Lt.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[t])||null,$feature_flag_bootstrapped_payload:((g=this.Lt.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[t])||null,$used_bootstrap_value:!this.ts};P(C==null||(b=C.metadata)==null?void 0:b.version)||(S.$feature_flag_version=C.metadata.version);var D,F=(v=C==null||(_=C.reason)==null?void 0:_.description)!==null&&v!==void 0?v:C==null||(x=C.reason)==null?void 0:x.code;F&&(S.$feature_flag_reason=F),C!=null&&(y=C.metadata)!=null&&y.id&&(S.$feature_flag_id=C.metadata.id),P(C?.original_variant)&&P(C?.original_enabled)||(S.$feature_flag_original_response=P(C.original_variant)?C.original_enabled:C.original_variant),C!=null&&(w=C.metadata)!=null&&w.original_payload&&(S.$feature_flag_original_payload=C==null||(D=C.metadata)==null?void 0:D.original_payload),k.length&&(S.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",S)}if(r){var L=s;if(!P(s))try{L=JSON.parse(s)}catch{}return{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:L}}}}else Xe.warn('getFeatureFlagResult for key "'+t+mu)}getRemoteConfigPayload(t,e){var n=this.Lt.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.hs()&&(r.evaluation_contexts=this.us()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Lt.disable_compression?void 0:$t.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback(i){var s,o=(s=i.json)==null?void 0:s.featureFlagPayloads;e(o?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.ts){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return P(n)?void 0:!!n}Xe.warn('isFeatureEnabled for key "'+t+mu)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){if(this.ii){this.Jn=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,u,l,c,d){u===void 0&&(u={}),l===void 0&&(l={}),c===void 0&&(c={});var h=(k=>{var S=k.flags;return S?(k.featureFlags=Object.fromEntries(Object.keys(S).map(D=>{var F;return[D,(F=S[D].variant)!==null&&F!==void 0?F:S[D].enabled]})),k.featureFlagPayloads=Object.fromEntries(Object.keys(S).filter(D=>S[D].enabled).filter(D=>{var F;return(F=S[D].metadata)==null?void 0:F.payload}).map(D=>{var F;return[D,(F=S[D].metadata)==null?void 0:F.payload]}))):Xe.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),k})(o),f=h.flags,p=h.featureFlags,m=h.featureFlagPayloads;if(p){var g=o.requestId,b=o.evaluatedAt;if(Q(p)){Xe.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(p)for(var _=0;p.length>_;_++)v[p[_]]=!0;a&&a.register({[Gs]:p,[$r]:v})}else{var x=p,y=m,w=f;if(d!=null&&d.partialResponse)x=O({},u,x),y=O({},l,y),w=O({},c,w);else if(o.errorsWhileComputingFlags)if(f){var C=new Set(Object.keys(f).filter(k=>{var S;return!((S=f[k])!=null&&S.failed)}));x=O({},u,Object.fromEntries(Object.entries(x).filter(k=>{var[S]=k;return C.has(S)}))),y=O({},l,Object.fromEntries(Object.entries(y||{}).filter(k=>{var[S]=k;return C.has(S)}))),w=O({},c,Object.fromEntries(Object.entries(w||{}).filter(k=>{var[S]=k;return C.has(S)})))}else x=O({},u,x),y=O({},l,y),w=O({},c,w);a&&a.register(O({[Gs]:Object.keys(Kh(x)),[$r]:x||{},[xl]:y||{},[_l]:w||{}},g?{[kl]:g}:{},b?{[mo]:b}:{}))}}})(t,this.ii,r,i,s,n),e||(this.ns=!1),this.fs(e)}}override(t,e){e===void 0&&(e=!1),Xe.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ii)return Xe.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.ii.unregister(sn),this.ii.unregister(Rr),this.fs(),Yn.info("All overrides cleared");if(Q(t)){var e=Uh(t);return this.ii.register({[sn]:e}),this.fs(),Yn.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.Xn=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.ii.unregister(sn),Yn.info("Flag overrides cleared");else if(r.flags){if(Q(r.flags)){var i=Uh(r.flags);this.ii.register({[sn]:i})}else this.ii.register({[sn]:r.flags});Yn.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.ii.unregister(Rr),Yn.info("Payload overrides cleared")):r.payloads&&(this.ii.register({[Rr]:r.payloads}),Yn.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&typeof t=="object")return this.ii.register({[sn]:t}),this.fs(),Yn.info("Flag overrides set",{flags:t});Xe.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:n}=this.ps();t(e,n)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r,i=(this.ss(wi)||[]).find(u=>u.flagKey===t),s={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:s};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=O({},this.getFlagVariants(),{[t]:e});(r=this.ii)==null||r.register({[Gs]:Object.keys(Kh(a)),[$r]:a}),this.fs()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.ss(wi),i=n?"&"+n.map(s=>"stage="+s).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Lt.token+i),method:"GET",callback:s=>{var o,a;if(s.json){var u=s.json.earlyAccessFeatures;return(o=this.ii)==null||o.unregister(wi),(a=this.ii)==null||a.register({[wi]:u}),t(u)}}})}ps(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,r)=>(n[r]=e[r],n),{})}}fs(t){var{flags:e,flagVariants:n}=this.ps();this.featureFlagEventHandlers.forEach(r=>r(e,n,{errorsLoading:t}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ss(Ci)||{},r=t?.$set||(t!=null&&t.$set_once?{}:t),i=t?.$set_once,s={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(s[o]=i[o]));this._instance.register({[Ci]:O({},n,s,r)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Ci)}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ss(Qn)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=O({},n[r],t[r]),delete t[r]}),this._instance.register({[Qn]:O({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ss(Qn)||{};this._instance.register({[Qn]:O({},e,{[t]:{}})})}else this._instance.unregister(Qn)}reset(){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.vs(),this.Xn=!1}}},P2={sessionRecording:class{get Lt(){return this._instance.config}get ii(){return this._instance.persistence}get started(){var t;return!((t=this.gs)==null||!t.isStarted)}get status(){var t,e;return this.ys===mi||this.ys===Ds?this.ys:(t=(e=this.gs)==null?void 0:e.status)!==null&&t!==void 0?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=Bh,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw xn.error("started without valid sessionManager"),new Error(jl+" started without valid sessionManager. This is a bug.");if(this.Lt.cookieless_mode===cn)throw new Error(jl+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!((t=this._instance.get_property(ki))==null||!t.enabled),n=!this.Lt.disable_session_recording,r=this.Lt.disable_session_recording||this._instance.consent.isOptedOut();return E&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this._s||(e=this.gs)==null||!e.isStarted){var n=!P(Object.assign)&&!P(Array.from);this._s&&n?(this.ws(t),xn.info("starting")):(this.ys=Bh,this.stopRecording())}}ws(t){var e,n,r;this._s&&(this.ys!==mi&&this.ys!==Ds&&(this.ys=$h),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=$.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Is(t):(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Cs,i=>{if(i)return xn.error("could not load recorder",i);this.Is(t)}))}stopRecording(){var t,e;(t=this.bs)==null||t.call(this),this.bs=void 0,(e=this.gs)==null||e.stop()}Ss(){var t,e;(t=this.bs)==null||t.call(this),this.bs=void 0,(e=this.gs)==null||e.discard()}xs(){var t;(t=this.ii)==null||t.unregister($c)}ks(t,e){if(Y(t))return null;var n,r=Tt(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(xn.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.ii){var e,n,r=this.ii,i=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.ks((s=this.Lt.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.ks(o?.sampleRate,"remote config sampleRate"),l=a??u;Y(l)&&this.xs();var c=o?.minimumDurationMilliseconds;r.register({[ki]:O({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:O({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:P(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};i(),(e=this.bs)==null||e.call(this),this.bs=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(i)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===mi&&(this.ys=Ds,xn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.gs)!=null&&n.log?this.gs.log(t,e):xn.warn("log called before recorder was ready")}get Cs(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(ki);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}As(){var t,e=this._instance.get_property(ki);if(!e)return!1;var n=(t=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}Is(t){var e,n;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return xn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[K0]:!0});if(this.gs||(this.gs=(n=$.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.As())return this.ys===Ds||this.ys===mi?void 0:(this.ys=mi,xn.info("persisted remote config is stale, requesting fresh config before starting"),void new sm(this._instance).load());this.ys=$h,this.gs.start(t)}onRRwebEmit(t){var e;(e=this.gs)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||(e=this.ii)==null||e.register({[H0]:!0}),(t=this.gs)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||(e=this.ii)==null||e.register({[z0]:!0}),(t=this.gs)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.gs||(n=this.ii)==null||n.register({[t==="url"?j0:V0]:!0}),(e=this.gs)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.gs)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.gs)==null||!n.tryAddCustomEvent(t,e))}}},L2={autocapture:class{constructor(t){this.Es=!1,this.Rs=null,this.Ns=!1,this.instance=t,this.rageclicks=new Fh(t.config.rageclick),this.Ms=null}initialize(){this.startIfEnabled()}get Lt(){var t,e,n=ke(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map(r=>new RegExp(r)),n}Fs(){if(this.isBrowserSupported()){if(E&&N){var t=n=>{n=n||E?.event;try{this.Os(n)}catch(r){Ih.error("Failed to capture event",r)}};if(Ee(N,"submit",t,{capture:!0}),Ee(N,"change",t,{capture:!0}),Ee(N,"click",t,{capture:!0}),this.Lt.capture_copied_text){var e=n=>{this.Os(n=n||E?.event,hu)};Ee(N,"copy",e,{capture:!0}),Ee(N,"cut",e,{capture:!0})}}}else Ih.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Es&&(this.Fs(),this.Es=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ns=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[hl]:!!t.autocapture_opt_out}),this.Rs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ms=t}getElementSelectors(t){var e,n=[];return(e=this.Ms)==null||e.forEach(r=>{var i=N?.querySelectorAll(r);i?.forEach(s=>{t===s&&n.push(r)})}),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[hl];if(gn(this.Rs)&&!jt(n)&&!this.instance.Mr())return!1;var r=(e=this.Rs)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}Os(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=Ah(t);bm(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&function(d,h){if(!E||zl(d))return!1;var f,p,m;if(jt(h)?(f=!!h&&Dh,p=void 0):(f=(m=h?.css_selector_ignorelist)!==null&&m!==void 0?m:Dh,p=h?.content_ignorelist),f===!1)return!1;var{targetElementList:g}=Oh(d,!1);return!function(b,v){if(b===!1||P(b))return!1;var _;if(b===!0)_=_2;else{if(!Q(b))return!1;if(b.length>10)return I.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;_=b.map(x=>x.toLowerCase())}return v.some(x=>{var{safeText:y,ariaLabel:w}=x;return _.some(C=>y.includes(C)||w.includes(C))})}(p,g.map(b=>{var v;return{safeText:Gi(b).toLowerCase(),ariaLabel:((v=b.getAttribute("aria-label"))==null?void 0:v.toLowerCase().trim())||""}}))&&!Th(g,f)}(r,this.instance.config.rageclick)&&this.Os(t,"$rageclick");var i=e===hu;if(r&&function(d,h,f,p,m){var g,b,v,_;if(f===void 0&&(f=void 0),!E||zl(d)||(g=f)!=null&&g.url_allowlist&&!Mh(f.url_allowlist)||(b=f)!=null&&b.url_ignorelist&&Mh(f.url_ignorelist))return!1;if((v=f)!=null&&v.dom_event_allowlist){var x=f.dom_event_allowlist;if(x&&!x.some(S=>h.type===S))return!1}var{parentIsUsefulElement:y,targetElementList:w}=Oh(d,p);if(!function(S,D){var F=D?.element_allowlist;if(P(F))return!0;var L,j=function(X){if(F.some(ne=>X.tagName.toLowerCase()===ne))return{v:!0}};for(var W of S)if(L=j(W))return L.v;return!1}(w,f)||!Th(w,(_=f)==null?void 0:_.css_selector_allowlist))return!1;var C=E.getComputedStyle(d);if(C&&C.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0;var k=d.tagName.toLowerCase();switch(k){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return y?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Uc.indexOf(k)>-1||d.getAttribute("contenteditable")==="true")}}(r,t,this.Lt,i,i?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:o}=M2(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Lt.element_attribute_ignorelist,elementsChainAsString:this.Ns});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(s.$element_selectors=a),e===hu){var u,l=ym(E==null||(u=E.getSelection())==null?void 0:u.toString()),c=t.type||"clipboard";if(!l)return!1;s.$selected_content=l,s.$copy_type=c}return this.instance.capture(e,s),!0}}}isBrowserSupported(){return ln(N?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ps=(E==null||(e=E.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(I.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ls&&this.Ls(),this.Ls=void 0,I.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(E&&E.history){var n=this;(t=E.history.pushState)!=null&&t.__posthog_wrapped__||Ph(E.history,"pushState",r=>function(i,s,o){r.call(this,i,s,o),n.Ds("pushState")}),(e=E.history.replaceState)!=null&&e.__posthog_wrapped__||Ph(E.history,"replaceState",r=>function(i,s,o){r.call(this,i,s,o),n.Ds("replaceState")}),this.Bs()}}Ds(t){try{var e,n=E==null||(e=E.location)==null?void 0:e.pathname;if(!n)return;n!==this.Ps&&this.isEnabled&&this._instance.capture(Nr,{navigation_type:t}),this.Ps=n}catch(r){I.error("Error capturing "+t+" pageview",r)}}Bs(){if(!this.Ls){var t=()=>{this.Ds("popstate")};Ee(E,"popstate",t),this.Ls=()=>{E&&E.removeEventListener("popstate",t)}}}},heatmaps:class{get Lt(){return this.instance.config}constructor(t){var e;this.js=!1,this.Es=!1,this.$s=null,this.instance=t,this.js=!((e=this.instance.persistence)==null||!e.props[fl]),this.rageclicks=new Fh(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return ke(this.Lt.capture_heatmaps)&&this.Lt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Lt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Y(this.Lt.capture_heatmaps)?Y(this.Lt.enable_heatmaps)?this.js:this.Lt.enable_heatmaps:this.Lt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Es)return;T2.info("starting..."),this.qs(),this.Ot()}else{var t;clearInterval((t=this.$s)!==null&&t!==void 0?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[fl]:e}),this.js=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.At(t.originalEvent,"deadclick")}Ot(){this.$s&&clearInterval(this.$s),this.$s=N?.visibilityState==="visible"?setInterval(this.Ur.bind(this),this.flushIntervalMilliseconds):null}qs(){E&&N&&(this.Vs=this.Ur.bind(this),Ee(E,yo,this.Vs),this.zs=t=>this.At(t||E?.event),Ee(N,"click",this.zs,{capture:!0}),this.Us=t=>this.Ys(t||E?.event),Ee(N,"mousemove",this.Us,{capture:!0}),this.Ws=new ah(this.instance,jv,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Gs=this.Ot.bind(this),Ee(N,vo,this.Gs),this.Es=!0)}Zs(){var t;E&&N&&(this.Vs&&E.removeEventListener(yo,this.Vs),this.zs&&N.removeEventListener("click",this.zs,{capture:!0}),this.Us&&N.removeEventListener("mousemove",this.Us,{capture:!0}),this.Gs&&N.removeEventListener(vo,this.Gs),clearTimeout(this.Xs),(t=this.Ws)==null||t.stop(),this.Es=!1)}Js(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=function(o,a,u){for(var l=o;l&&Ea(l)&&!Bn(l,"body");){if(l===u)return!1;if(G(a,E?.getComputedStyle(l).position))return!0;l=_m(l)}return!1}(Ah(t),["fixed","sticky"],i);return{x:t.clientX+(s?0:r),y:t.clientY+(s?0:n),target_fixed:s,type:e}}At(t,e){var n;if(e===void 0&&(e="click"),!Sh(t.target)&&zh(t)){var r=this.Js(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Ks(O({},r,{type:"rageclick"})),this.Ks(r)}}Ys(t){!Sh(t.target)&&zh(t)&&(clearTimeout(this.Xs),this.Xs=setTimeout(()=>{this.Ks(this.Js(t,"mousemove"))},500))}Ks(t){if(E){var e=E.location.href,n=this.Lt.custom_personal_data_properties,r=this.Lt.mask_personal_data_properties?[...Zr,...n||[]]:[],i=Ki(e,r,Ji);this.T=this.T||{},this.T[i]||(this.T[i]=[]),this.T[i].push(t)}}Ur(){this.T&&!Br(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ah,webVitalsAutocapture:class{constructor(t){var e;this.js=!1,this.Es=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Qs=()=>{clearTimeout(this.eo),this.T.metrics.length!==0&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((n,r)=>O({},n,{["$web_vitals_"+r.name+"_event"]:O({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=n=>{var r,i=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(P(i))_n.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.ro();P(s)||(Y(n?.name)||Y(n?.value)?_n.error("Invalid metric received",n):!this.io||this.io>n.value?(this.T.url!==s&&(this.Qs(),this.eo=setTimeout(this.Qs,this.flushToCaptureTimeoutMs)),P(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=P(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.T.metrics.push(O({},n,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Qs()):_n.error("Ignoring metric with value >= "+this.io,n))}},this.no=()=>{if(!this.Es){var n,r,i,s,o=$.__PosthogExtensions__;P(o)||P(o.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:i,onINP:s}=o.postHogWebVitalsCallbacks),n&&r&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.dt.bind(this)),this.Es=!0):_n.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.js=!((e=this._instance.persistence)==null||!e.props[bl]),this.startIfEnabled()}get so(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=ke(this.so)?(t=this.so)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Y(n)?((e=this._instance.persistence)==null?void 0:e.props[yl])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(ke(this.so)?this.so.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=ke(this.so)?this.so.web_vitals_attribution:void 0;return t!=null&&t}get io(){var t=ke(this.so)&&Tt(this.so.__web_vitals_max_value)?this.so.__web_vitals_max_value:Lh;return t>0&&6e4>=t?Lh:t}get isEnabled(){var t=ze?.protocol;if(t!=="http:"&&t!=="https:")return _n.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=ke(this.so)?this.so.web_vitals:jt(this.so)?this.so:void 0;return jt(e)?e:this.js}startIfEnabled(){this.isEnabled&&!this.Es&&(_n.info("enabled, starting..."),this.lr(this.no))}onRemoteConfig(t){if("capturePerformance"in t){var e=ke(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=ke(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[bl]:e}),this._instance.persistence.register({[yl]:n})),this.js=e,this.startIfEnabled()}}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",r=>{r?_n.error("failed to load script",r):t()})}ro(){var t=E?E.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Zr,...e||[]]:[];return Ki(t,n,Ji)}_n.error("Could not determine current URL")}}},B2={exceptionObserver:class{constructor(t){var e,n,r;this.no=()=>{var i;if(E&&this.isEnabled&&(i=$.__PosthogExtensions__)!=null&&i.errorWrappingFunctions){var s=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.oo&&this.Lt.capture_unhandled_errors&&(this.oo=s(this.captureException.bind(this))),!this.ao&&this.Lt.capture_unhandled_rejections&&(this.ao=o(this.captureException.bind(this))),!this.lo&&this.Lt.capture_console_errors&&(this.lo=a(this.captureException.bind(this)))}catch(u){pi.error("failed to start",u),this.uo()}}},this._instance=t,this.ho=!((e=this._instance.persistence)==null||!e.props[pl]),this.co=new Zb({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Yt:pi}),this.Lt=this.do(),this.startIfEnabledOrStop()}do(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ke(t)?e=O({},e,t):(P(t)?this.ho:t)&&(e=O({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Lt.capture_console_errors||this.Lt.capture_unhandled_errors||this.Lt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(pi.info("enabled"),this.uo(),this.lr(this.no)):this.uo()}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&t(),(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return pi.error("failed to load script",r);t()})}uo(){var t,e,n;(t=this.oo)==null||t.call(this),this.oo=void 0,(e=this.ao)==null||e.call(this),this.ao=void 0,(n=this.lo)==null||n.call(this),this.lo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ho=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[pl]:this.ho}),this.Lt=this.do(),this.startIfEnabledOrStop())}onConfigChange(){this.Lt=this.do()}captureException(t){var e,n,r,i=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.co.consumeRateLimit(i)?pi.info("Skipping exception capture because of client rate limiting.",{exception:i}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.vo=[],this.fo=new cv([new vv,new Mv,new _v,new yv,new Ev,new Cv,new kv,new Sv],function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;i>o;o++)s[o-1]=arguments[o];return function(a,u){u===void 0&&(u=0);for(var l=[],c=a.split(`
|
|
2
|
-
`),d=u;c.length>d;d++){var h=c[d];if(1024>=h.length){var f=rh.test(h)?h.replace(rh,"$1"):h;if(!f.match(/\S*Error: /)){for(var p of s){var m=p(f,r);if(m){l.push(m);break}}if(l.length>=50)break}}}return function(g){if(!g.length)return[];var b=Array.from(g);return b.reverse(),b.slice(0,50).map(v=>{return O({},v,{filename:v.filename||(_=b,_[_.length-1]||{}).filename,function:v.function||Yr});var _})}(l)}}("web:javascript",pv,bv)),this._instance=t,this.vo=(e=(n=this._instance.persistence)==null?void 0:n.get_property(ml))!==null&&e!==void 0?e:[],this.po=ho(this.mo()),this.yo=new Tv(this.po)}onConfigChange(){this.po=ho(this.mo()),this.yo.setConfig(this.po)}onRemoteConfig(t){var e,n,r;if("errorTracking"in t){var i=(e=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],s=(r=t.errorTracking)==null?void 0:r.captureExtensionExceptions;this.vo=i,this._instance.persistence&&this._instance.persistence.register({[ml]:this.vo,[gl]:s})}}get bo(){var t,e=!!this._instance.get_property(gl),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.fo.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.po.enabled)try{if(!me(t)||t.trim().length===0)return void en.warn("Ignoring exception step because message must be a non-empty string");var n=this._o(e),{sanitizedProperties:r,droppedKeys:i}=function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce((a,u)=>Av.has(u)?(o.push(u),a):(a[u]=s[u],a),{}),droppedKeys:o}}(n);i.length>0&&en.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.yo.add(O({[lo]:t,[co]:new Date().toISOString()},r))}catch(s){en.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.wo(e)){if(this.Io(e))return this.Co("Exception dropped: matched a suppression rule"),void en.info("Skipping exception capture because a suppression rule matched");if(!this.bo&&this.So(e))return this.Co("Exception dropped: thrown by a browser extension"),void en.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.xo(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void en.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.po.enabled&&Y(t.$exception_steps)?this.ko(t):t;try{var r=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Qi:!0});return r&&this.yo.clear(),r}catch(i){return en.error("Failed to capture exception event. Dropping this exception.",i),void this.yo.clear()}}catch(i){return void en.error("Failed to process exception event. Ignoring this exception.",i)}}ko(t){try{var e=this.yo.getAttachable();return e.length===0?t:O({},t,{$exception_steps:e})}catch(n){return en.error("Failed to read buffered exception steps. Capturing exception without steps.",n),t}}Co(t){this.po.enabled&&this.yo.add({[lo]:t,[co]:new Date().toISOString()})}_o(t){return ke(t)?O({},t):{}}mo(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}Io(t){if(t.length===0)return!1;var e=t.reduce((n,r)=>{var{type:i,value:s}=r;return me(i)&&i.length>0&&n.$exception_types.push(i),me(s)&&s.length>0&&n.$exception_values.push(s),n},{$exception_types:[],$exception_values:[]});return this.vo.some(n=>{var r=n.values.map(i=>{var s,o=fm[i.operator],a=Q(i.value)?i.value:[i.value],u=(s=e[i.key])!==null&&s!==void 0?s:[];return a.length>0&&o(a,u)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}So(t){return t.flatMap(e=>{var n,r;return(n=(r=e.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}xo(t){if(t.length>0){var e,n,r,i,s=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(r=o==null||(i=o.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}wo(t){return!Y(t)&&Q(t)}}},$2=O({productTours:class{get ii(){return this._instance.persistence}constructor(t){this.To=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ii&&this.ii.register({[vl]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.To||(t=this._instance).config.disable_product_tours||(e=t.persistence)==null||!e.get_property(vl)||this.lr(()=>this.Eo())}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?Hh.error("Could not load product tours script",r):t()})}Eo(){var t;!this.To&&(t=$.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.To=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!Q(this.Ao)||e){var n=this.ii;if(n){var r=n.props[Ys];if(Q(r)&&!e)return this.Ao=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var s=i.statusCode;if(s!==200||!i.json){var o="Product Tours API could not be loaded, status: "+s;return Hh.error(o),void t([],{isLoaded:!1,error:o})}var a=Q(i.json.product_tours)?i.json.product_tours:[];this.Ao=a,n&&n.register({[Ys]:a}),t(a,{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){Y(this.To)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.To.getActiveProductTours(t)}showProductTour(t){var e;(e=this.To)==null||e.showTourById(t)}previewTour(t){this.To?this.To.previewTour(t):this.lr(()=>{var e;this.Eo(),(e=this.To)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.To)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.To)==null||t.nextStep()}previousStep(){var t;(t=this.To)==null||t.previousStep()}clearCache(){var t;this.Ao=null,(t=this.ii)==null||t.unregister(Ys)}resetTour(t){var e;(e=this.To)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.To)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.To)==null||e.cancelPendingTour(t)}}},Sa),z2={siteApps:class{constructor(t){this._instance=t,this.Ro=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}No(t,e){if(e){var n=this.globalsForEvent(e);this.Ro.push(n),this.Ro.length>1e3&&(this.Ro=this.Ro.slice(10))}}get siteAppLoaders(){var t;return(t=$._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.No.bind(this));this.Mo=()=>{t(),this.Ro=[],this.Mo=void 0}}}globalsForEvent(t){var e,n,r,i,s,o,a;if(!t)throw new Error("Event payload is required");var u={},l=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(c))u[d]={id:l[d],type:d,properties:h};var{$set_once:f,$set:p}=t;return{event:O({},p0(t,D2),{properties:O({},t.properties,p?{$set:O({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:O({},(r=(i=t.properties)==null?void 0:i.$set_once)!==null&&r!==void 0?r:{},f)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var o;!e.errored&&this.Ro.length&&(kn.info("Processing "+this.Ro.length+" events for site app with id "+t.id),this.Ro.forEach(a=>e.processEvent==null?void 0:e.processEvent(a)),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.Mo)==null||o.call(this))},r=!1,i=o=>{e.errored=!o,e.loaded=!0,kn.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),r&&n()};try{var{processEvent:s}=t.init({posthog:this._instance,callback(o){i(o)}});s&&(e.processEvent=s),r=!0}catch(o){kn.error(jh+t.id,o),i(!1)}if(r&&e.loaded)try{n()}catch(o){kn.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}Fo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}Oo(t){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(e)}catch(r){kn.error("Error while processing event "+t.event+" for site app "+n.id,r)}}}onRemoteConfig(t){var e,n,r,i=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Fo(),void this._instance.on("eventCaptured",u=>this.Oo(u))):void kn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Mo)==null||n.call(this),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var s=function(u){var l;$["__$$ph_site_app_"+u]=i._instance,(l=$.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(i._instance,a,c=>{if(c)return kn.error(jh+u,c)})};for(var{id:o,url:a}of t.siteApps)s(o)}else kn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},H2={tracingHeaders:class{constructor(t){this.Po=void 0,this.Lo=void 0,this.no=()=>{var e,n,r=this.Do()||[];P(this.Po)&&((e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(r,this._instance.get_distinct_id(),this._instance.sessionManager)),P(this.Lo)&&((n=$.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(r,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&t(),(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return A2.error("failed to load script",r);t()})}Do(){var t;return(t=this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Do()?this.lr(this.no):((t=this.Po)==null||t.call(this),(e=this.Lo)==null||e.call(this),this.Po=void 0,this.Lo=void 0)}}},j2=O({surveys:class{get Lt(){return this._instance.config}constructor(t){this.Bo=void 0,this._surveyManager=null,this.jo=!1,this.$o=[],this.qo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Lt.disable_surveys){var e=t.surveys;if(Y(e))return ie.warn("Flags not loaded yet. Not loading surveys.");var n=Q(e);this.Bo=n?e.length>0:e,ie.info("flags response received, isSurveysEnabled: "+this.Bo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var n=localStorage.key(e);(n!=null&&n.startsWith(Bl)||n!=null&&n.startsWith("inProgressSurvey_"))&&t.push(n)}t.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this._surveyManager)if(this.jo)ie.info("Already initializing surveys, skipping...");else if(this.Lt.disable_surveys)ie.info(Vh);else if(this.Lt.cookieless_mode&&this._instance.consent.isOptedOut())ie.info("Not loading surveys in cookieless mode without consent.");else{var t=$?.__PosthogExtensions__;if(t){if(!P(this.Bo)||this.Lt.advanced_enable_surveys){var e=this.Bo||this.Lt.advanced_enable_surveys;this.jo=!0;try{var n=t.generateSurveys;if(n)return void this.Zo(n,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(zc);r(this._instance,"surveys",i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Zo(t.generateSurveys,e)})}catch(i){throw this.Ho("Error initializing surveys",i),i}finally{this.jo=!1}}}else ie.error("PostHog Extensions not found.")}}Zo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new N2(this._instance),ie.info("Surveys loaded successfully"),this.Vo({isLoaded:!0})}Ho(t,e){ie.error(t,e),this.Vo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$o.push(t),this._surveyManager&&this.Vo({isLoaded:!0}),()=>{this.$o=this.$o.filter(e=>e!==t)}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Lt.disable_surveys)return ie.info(Vh),t([]);var n,r=this._instance.get_property(wl);if(r&&!e)return t(r,{isLoaded:!0});typeof Promise<"u"&&this.qo?this.qo.then(i=>{var{surveys:s,context:o}=i;return t(s,o)}):(typeof Promise<"u"&&(this.qo=new Promise(i=>{n=i})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Lt.token),method:"GET",timeout:this.Lt.surveys_request_timeout_ms,callback:i=>{var s;this.qo=null;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;ie.error(a);var u={isLoaded:!1,error:a};return t([],u),void(n==null||n({surveys:[],context:u}))}var l,c=i.json.surveys||[],d=c.filter(f=>function(p){return!(!p.start_date||p.end_date)}(f)&&(function(p){var m;return!((m=p.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)}(f)||function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)}(f)));d.length>0&&((l=this._surveyEventReceiver)==null||l.register(d)),(s=this._instance.persistence)==null||s.register({[wl]:c});var h={isLoaded:!0};t(c,h),n?.({surveys:c,context:h})}}))}Vo(t){for(var e of this.$o)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(n){ie.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!Y(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);ie.warn("init was not called")}zo(t){var e=null;return this.getSurveys(n=>{var r;e=(r=n.find(i=>i.id===t))!==null&&r!==void 0?r:null}),e}Uo(t){if(Y(this._surveyManager))return{eligible:!1,reason:pu};var e=typeof t=="string"?this.zo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Y(this._surveyManager))return ie.warn("init was not called"),{visible:!1,disabledReason:pu};var e=this.Uo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Y(this._surveyManager)?(ie.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:pu})):new Promise(n=>{this.getSurveys(r=>{var i,s=(i=r.find(a=>a.id===t))!==null&&i!==void 0?i:null;if(s){var o=this.Uo(s);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,n){var r;if(Y(this._surveyManager))ie.warn("init was not called");else{var i=typeof t=="string"?this.zo(t):t;if(i!=null&&i.id)if(f2.includes(i.type)){var s=N?.querySelector(e);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(ie.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;ie.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s,n),ie.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s,n);ie.warn("Survey element not found")}else ie.warn("Surveys of type "+i.type+" cannot be rendered in the app");else ie.warn("Survey not found")}}displaySurvey(t,e){var n;if(Y(this._surveyManager))ie.warn("init was not called");else{var r=this.zo(t);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&e.ignoreDelay&&(i=O({},r,{appearance:O({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Rl.Popover&&e.initialResponses&&ie.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.canRenderSurvey(r);if(!s.visible)return void ie.warn("Survey is not eligible to be displayed: ",s.disabledReason)}e.displayType!==Rl.Inline?this._surveyManager.handlePopoverSurvey(i,e):this.renderSurvey(i,e.selector,e.properties)}else ie.warn("Survey not found")}}cancelPendingSurvey(t){Y(this._surveyManager)?ie.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload()}}},Sa),V2={toolbar:class{constructor(t){this.instance=t}Yo(t){$.ph_toolbar_state=t}Wo(){var t;return(t=$.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),J0(this.instance.config)||!E||!N)return!1;t=t??E.location,n=n??E.history;try{if(!e){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}e=E?.localStorage}var r,i=F2||wo(t.hash,"__posthog")||wo(t.hash,"state"),s=i?sh(()=>JSON.parse(atob(decodeURIComponent(i))))||sh(()=>JSON.parse(decodeURIComponent(i))):null;return s&&s.action==="ph_authorize"?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?t.hash=s.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(qh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Go(t){var e=$.ph_load_toolbar||$.ph_load_editor;!Y(e)&&ln(e)?e(t,this.instance):Wh.warn("No toolbar load function found")}loadToolbar(t){var e=!(N==null||!N.getElementById(q0));if(!E||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=O({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(qh,JSON.stringify(O({},r,{source:void 0}))),this.Wo()===2)this.Go(r);else if(this.Wo()===0){var i;this.Yo(1),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",s=>{if(s)return Wh.error("[Toolbar] Failed to load",s),void this.Yo(0);this.Yo(2),this.Go(r)}),Ee(E,"turbolinks:load",()=>{this.Yo(0),this.loadToolbar(r)})}return!0}Xo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},q2=O({experiments:Ue},Sa),W2={conversations:class{constructor(t){this.Jo=void 0,this._conversationsManager=null,this.Ko=!1,this.Qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;Y(e)||(jt(e)?this.Jo=e:(this.Jo=e.enabled,this.Qo=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Jo=void 0,this.Qo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ko||this._instance.config.disable_conversations||J0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=$?.__PosthogExtensions__;if(t&&!P(this.Jo)&&this.Jo)if(this.Qo&&this.Qo.token){this.Ko=!0;try{var e=t.initConversations;if(e)return this.ea(e),void(this.Ko=!1);var n=t.loadExternalDependency;if(!n)return void this.ta(zc);n(this._instance,"conversations",r=>{r||!t.initConversations?this.ta("Could not load conversations script",r):this.ea(t.initConversations),this.Ko=!1})}catch(r){this.ta("Error initializing conversations",r),this.Ko=!1}}else vt.error("Conversations enabled but missing token in remote config.")}}ea(t){if(this.Qo)try{this._conversationsManager=t(this.Qo,this._instance),vt.info("Conversations loaded successfully")}catch(e){this.ta("Error completing conversations initialization",e)}else vt.error("Cannot complete initialization: remote config is null")}ta(t,e){vt.error(t,e),this._conversationsManager=null,this.Ko=!1}show(){this._conversationsManager?this._conversationsManager.show():vt.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Jo===!0&&!gn(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var r=this;return kt(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,n):(vt.warn(Zn),null)})()}getMessages(t,e){var n=this;return kt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(vt.warn(Zn),null)})()}markAsRead(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(vt.warn(Zn),null)})()}getTickets(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(vt.warn(Zn),null)})()}requestRestoreLink(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(vt.warn(Zn),null)})()}restoreFromToken(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(vt.warn(Zn),null)})()}restoreFromUrlToken(){var t=this;return kt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(vt.warn(Zn),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}ln(){var t;(t=this._conversationsManager)==null||t.setIdentity()}un(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},U2={logs:class{constructor(t){var e;this.ra=!1,this.ia=!1,this.Yt=fe("[logs]"),this.na=[],this.sa=0,this.oa=0,this.aa=!1,this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.ra=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,n=(e=t.logs)==null?void 0:e.captureConsoleLogs;!Y(n)&&n&&(this.ra=!0,this.loadIfEnabled())}reset(){this.na=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.sa=0,this.oa=0,this.aa=!1}loadIfEnabled(){if(this.ra&&!this.ia){var t=$?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?this.Yt.error("Could not load logs script",n):(t.logs.initializeLogs(this._instance),this.ia=!0)}):this.Yt.error(zc)}else this.Yt.error("PostHog Extensions not found.")}}captureLog(t){var e,n,r,i,s,o;if(this._instance.is_capturing())if(t&&t.body){var a=(e=(n=this._instance.config.logs)==null?void 0:n.flushIntervalMs)!==null&&e!==void 0?e:3e3,u=(r=(i=this._instance.config.logs)==null?void 0:i.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,l=Date.now();if(a>l-this.oa||(this.oa=l,this.sa=0,this.aa=!1),u>this.sa){this.sa++;var c=function(d,h){var f=d.level||"info",{text:p,number:m}=F0[f]||uv,g=String(Date.now())+"000000",b={};h.distinctId&&(b.posthogDistinctId=h.distinctId),h.sessionId&&(b.sessionId=h.sessionId),h.currentUrl&&(b["url.full"]=h.currentUrl),h.screenName&&(b["screen.name"]=h.screenName),h.appState&&(b["app.state"]=h.appState),h.activeFeatureFlags&&h.activeFeatureFlags.length>0&&(b.feature_flags=h.activeFeatureFlags);var v=O({},b,d.attributes||{}),_={timeUnixNano:g,observedTimeUnixNano:g,severityNumber:m,severityText:p,body:{stringValue:d.body},attributes:nh(v)};return d.trace_id&&(_.traceId=d.trace_id),d.span_id&&(_.spanId=d.span_id),P(d.trace_flags)||(_.flags=d.trace_flags),_}(t,this.la());this.na.push({record:c}),((s=(o=this._instance.config.logs)==null?void 0:o.maxBufferSize)!==null&&s!==void 0?s:100)>this.na.length?this.ua():this.flushLogs()}else this.aa||(this.Yt.warn("captureLog dropping logs: exceeded "+u+" logs per "+a+"ms"),this.aa=!0)}else this.Yt.warn("captureLog requires a body")}get logger(){return this.ha||(this.ha={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ha}flushLogs(t){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.na.length!==0){var e=this.na;this.na=[];var n=this._instance.config.logs,r=O({"service.name":n?.serviceName||"unknown_service"},n?.environment&&{"deployment.environment":n.environment},n?.serviceVersion&&{"service.version":n.serviceVersion},n?.resourceAttributes),i=function(o,a,u,l){return{resourceLogs:[{resource:{attributes:nh(a)},scopeLogs:[{scope:{name:u,version:l},logRecords:o}]}]}}(e.map(o=>o.record),r,et.LIB_NAME,et.LIB_VERSION),s=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Zi({method:"POST",url:s,data:i,compression:"best-available",batchKey:"logs",transport:t})}}ua(){var t,e;this.Br||(this.Br=setTimeout(()=>{this.Br=void 0,this.flushLogs()},(t=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&t!==void 0?t:3e3))}la(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n}if($!=null&&(t=$.location)!=null&&t.href&&(e.currentUrl=$.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},K2=O({},Sa,P2,L2,B2,$2,z2,j2,H2,V2,q2,W2,U2);Ct.__defaultExtensionClasses=O({},K2);var Gh,gu=(Gh=Ni[Fr]=new Ct,function(){function t(){t.done||(t.done=!0,gm=!1,ce(Ni,function(e){e._dom_loaded()}))}N!=null&&N.addEventListener?N.readyState==="complete"?t():Ee(N,"DOMContentLoaded",t,{capture:!1}):E&&I.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Gh);const J2=({client:t})=>{const[e,n]=Z(!1),[r,i]=Z({x:0,y:0}),[s,o]=Z(0),a=De(null),u=window.innerWidth<768,l=t.plugin.getUserInfo().context_menu_on_select,c=t.plugin.getPluginInfo().installedPlugins.flatMap(h=>h.context_menu_actions).filter(Boolean),d=(h,f=0)=>{const p=window.getSelection();if(!p||!h)return{x:0,y:0,text:h};const g=p.getRangeAt(0).getBoundingClientRect(),b=g.left+g.width/2-f/2,v=g.bottom+12;return{x:b,y:v,text:h}};return J(()=>{t.event.on("global.contextMenu.createActions",({data:h})=>{c.push(...h.actions)})},[]),J(()=>{e&&a.current&&o(a.current.offsetWidth)},[e]),J(()=>{const h=m=>{var g;const b=(g=window.getSelection())===null||g===void 0?void 0:g.toString().trim();e&&b===r.text||i(u&&b?d(b,s):{x:m.clientX,y:m.clientY,text:b})},f=m=>{var g,b;const v=(g=window.getSelection())===null||g===void 0?void 0:g.toString().trim();if(a.current&&a.current.contains(m.target))return;const _=m.target;if(_&&(_.tagName==="TEXTAREA"||_.tagName==="INPUT"&&_.type==="text")){n(!1);return}m.button===0&&e?(n(!1),(b=window.getSelection())===null||b===void 0||b.removeAllRanges()):v&&(l||m.button===2)?(m.button===2&&m.preventDefault(),i(u?d(v,s):{x:m.clientX,y:m.clientY,text:v}),n(!0)):n(!1)},p=()=>{var m;const g=(m=window.getSelection())===null||m===void 0?void 0:m.toString().trim();!g&&e?n(!1):g&&e&&u&&i(d(g,s))};return document.addEventListener("mouseup",f),window.addEventListener("mousemove",h),document.addEventListener("contextmenu",f),document.addEventListener("selectionchange",p),()=>{document.removeEventListener("mouseup",f),window.removeEventListener("mousemove",h),document.removeEventListener("contextmenu",f),document.removeEventListener("selectionchange",p)}},[l,e,r.text]),e?A("div",{ref:a,className:"fixed bg-gray-400 dark:bg-gray-700 shadow-lg border border-gray-400 rounded-md overflow-hidden dark:text-white z-50",style:{top:r.y,left:r.x},children:c.map((h,f)=>A(G2,{iconUrl:h.iconUrl,text:h.text,onClick:()=>{var p;n(!1),(p=window.getSelection())===null||p===void 0||p.removeAllRanges(),t.event.emitSidebarAction(h.plugin_id,h.action_key,r.text)}},f))}):null};function G2(t){return Me("button",{onClick:t.onClick,className:"px-2 md:px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row",children:[t.iconUrl&&A("span",{className:"flex-grow",children:A("img",{src:t.iconUrl,alt:t.text,className:"w-4 h-4 mr-2"})}),A("span",{className:"flex-grow",children:t.text})]})}function Kc(t="system",e=!1){const n=t==="system"?Y2():t==="dark";if(e)return{isDark:n,theme:t,isDisabled:e};const r=document.documentElement;return r.dataset.theme=n?"dark":"light",r.style.colorScheme=n?"dark":"light",r.classList[n?"add":"remove"]("dark"),document.querySelector("#root").classList.add("dark:bg-gradient-to-br","dark:from-gray-900","dark:to-gray-800","dark:text-white","min-h-screen","bg-fixed"),{isDark:n,theme:t,isDisabled:e}}function Y2(){return window.matchMedia("(prefers-color-scheme: dark)").matches}var Z2=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Em=Oc(null),hM=({children:t,pluginId:e,client:n,userInfo:r,settings:i})=>{const s=!!n,[o,a]=Z(n??null),[u,l]=Z(!1),[c,d]=Z(null),[h,f]=Z(void 0),[p,m]=Z(r??null);J(()=>{s&&(n&&a(n),r&&m(r))},[n,r,s]),Kc(h,s),J(()=>{gu.__loaded||gu.init("phc_l4vPVZxtjlcQUDivoh5TaUL6oDe8K2lig89405cGnsv",{cookieless_mode:"always",api_host:"https://c.rimori.se",defaults:"2026-01-30",loaded:v=>{v.register({application:"frontend",pluginId:e})}})},[]);const g=c==="sidebar",b=c==="settings";return J(()=>{if(s)return;Q2(e);const v=window===window.parent;v&&!u&&Kd.getInstance().then(_=>{_.needsLogin().then(x=>l(x?_:!0))}),(!v&&!o||v&&u===!0)&&Bb.getInstance(e).then(_=>{a(_),m(_.plugin.getUserInfo()),v||(f(_.plugin.theme),d(_.plugin.applicationMode),_.event.emit("self.rimori.triggerInitFinished"))})},[e,u,o,s]),J(()=>{p?.user_id&&gu.identify(p.user_id)},[p?.user_id]),J(()=>{if(!o)return;const v=o.plugin.onRimoriInfoUpdate(_=>{m(_.profile)});return()=>v()},[o]),J(()=>{if(!o||g||s)return;const v=history.pushState;history.pushState=(..._)=>{const x=v.apply(history,_);return o.event.emit("session.triggerUrlChange",{url:location.hash}),x}},[o,g,s]),J(()=>{if(!o||s)return;const v=()=>{const x=document.documentElement.scrollHeight>window.innerHeight;o.event.emit("session.triggerScrollbarChange",{hasScrollbar:x})};v(),window.addEventListener("resize",v);const _=new ResizeObserver(()=>v());return _.observe(document.body),()=>{window.removeEventListener("resize",v),_.disconnect()}},[o,s]),u instanceof Kd?A(ey,{onLogin:(v,_)=>Z2(void 0,void 0,void 0,function*(){(yield u.login(v,_))&&l(!0)})}):!o||!p?"":Me(Em.Provider,{value:{client:o,userInfo:p},children:[!i?.disableContextMenu&&!g&&!b&&A(J2,{client:o}),t]})},bn=()=>{const t=l0(Em);if(t===null)throw new Error("useRimori must be used within an PluginProvider");return Object.assign(t.client,{userInfo:t.userInfo})};function X2(t){const e=window.location.hash.split("?");if(e.length>1){const i=new URLSearchParams(e[1]).get(t);if(i)return i}return new URL(window.location.href).searchParams.get(t)}function Q2(t){const e=X2("applicationMode")==="sidebar";$b.getInstance("Plugin EventBus "+t+" "+(e?"sidebar":"main"))}function ey({onLogin:t}){const[e,n]=Z(""),[r,i]=Z("");return A("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)"},children:Me("div",{style:{backgroundColor:"#343534",padding:"1rem",borderRadius:"0.5rem",width:"500px",flexDirection:"column",display:"flex",alignItems:"center",justifyContent:"center"},children:[A("p",{style:{fontSize:"2rem",fontWeight:"bold",marginBottom:"1rem",textAlign:"center"},children:"Rimori Login Required"}),A("p",{style:{marginBottom:"1rem",textAlign:"center"},children:"Please login with your Rimori developer account for this plugin to be able to access the Rimori platform the same way it would when being deployed."}),A("input",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#444444"},type:"email",placeholder:"Email",onChange:s=>n(s.target.value)}),A("input",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#444444"},type:"password",placeholder:"Password",onChange:s=>i(s.target.value)}),A("button",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#928358"},onClick:()=>{t(e,r)},children:"Login"})]})})}function ty(t,e){const[n,r]=oe.useState([]),[i,s]=oe.useState(!1),{ai:o}=bn(),a=oe.useRef({prompt:e?.prompt,promptVariables:e?.promptVariables}),u=oe.useCallback(c=>{a.current=Object.assign(Object.assign({},a.current),c)},[]);return{messages:n,append:c=>{var d,h;const f=[...n,...c];r(f),s(!0);const p=(d=a.current.promptVariables)!==null&&d!==void 0?d:e?.promptVariables,m=(h=a.current.prompt)!==null&&h!==void 0?h:e?.prompt;o.getStreamedText({messages:f,onMessage:(g,b,v,_)=>{s(!v),r(x=>{const y=x[x.length-1];return y?.id===g?[...x.slice(0,-1),Object.assign(Object.assign({},y),{content:b,toolCalls:_})]:[...x,{id:g,role:"assistant",content:b,toolCalls:_}]})},tools:t,prompt:m,variables:p})},init:u,isLoading:i,setMessages:r,lastMessage:n[n.length-1]}}var ny=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};function fM(t){const e=bn(),[n,r]=Z(t),[i,s]=Z(!0);J(()=>{let a=!1;return e.plugin.getSettings(t).then(u=>{a||(r(u),s(!1))}),()=>{a=!0}},[]);const o=zt(a=>ny(this,void 0,void 0,function*(){const u=Object.assign(Object.assign({},n),a);r(u),yield e.plugin.setSettings(u)}),[n,e]);return{settings:n,isLoading:i,setSettings:o}}var Yh=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},ry=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function pM(t){const{actionKey:e,skillCategory:n,initialData:r,onAction:i}=t,s=bn(),{event:o,exercise:a}=s,[u,l]=Z(!1),[c,d]=Z(null),h=De(r??{}),f=De(null),p=De(!1);J(()=>{r&&(h.current=Object.assign({},r))},[]),J(()=>{const x=o.onMainPanelAction(y=>Yh(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${e}] Dashboard action received:`,y);const w=y,{achievement_topic:C}=w,k=ry(w,["achievement_topic"]);p.current=!0,f.current=Date.now(),l(!0),d(k),h.current=r??{},i&&(yield i(k)),console.log(`[useExerciseTracker:${e}] onAction complete, exercise active`)}),e);return()=>x.off()},[e]);const m=zt(x=>Yh(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${e}] start() called (self-initiated)`,x),p.current=!1,yield a.start({actionKey:e,knowledgeId:x?.knowledgeId}),f.current=Date.now(),h.current=r??{},l(!0),console.log(`[useExerciseTracker:${e}] start() complete, session token acquired`)}),[e,a,r]),g=zt(()=>{f.current=Date.now()},[]),b=zt(x=>{const y={type:"micro",skillCategory:n,accomplishmentKeyword:x.accomplishmentKeyword,description:x.description,meta:x.meta};o.emitAccomplishment(y)},[o,n]),v=zt(x=>{h.current=Object.assign(Object.assign({},h.current),x)},[]),_=zt(x=>{var y;const w=f.current?Date.now()-f.current:0,C=Math.max(1,Math.round(w/6e4));console.log(`[useExerciseTracker:${e}] end() — keyword=${x.accomplishmentKeyword}, errorRatio=${x.errorRatio}, duration=${C}min, trackedData=`,h.current);const S=[...Object.entries(h.current).map(([F,L])=>({key:F,value:L,description:F})),...(y=x.meta)!==null&&y!==void 0?y:[]],D={type:"macro",skillCategory:n,accomplishmentKeyword:x.accomplishmentKeyword,description:x.description,errorRatio:x.errorRatio,durationMinutes:C,meta:S.length>0?S:void 0};o.emitAccomplishment(D),console.log(`[useExerciseTracker:${e}] Macro accomplishment emitted`),l(!1),d(null),f.current=null},[e,o,n]);return{isActive:u,actionParams:c,start:m,ready:g,micro:b,track:v,end:_}}var Sm={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Zh=oe.createContext&&oe.createContext(Sm),iy=["attr","size","title"];function sy(t,e){if(t==null)return{};var n=oy(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function oy(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Ao(){return Ao=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ao.apply(this,arguments)}function Xh(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function To(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Xh(Object(n),!0).forEach(function(r){ay(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Xh(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ay(t,e,n){return e=uy(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function uy(t){var e=ly(t,"string");return typeof e=="symbol"?e:e+""}function ly(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Mm(t){return t&&t.map((e,n)=>oe.createElement(e.tag,To({key:n},e.attr),Mm(e.child)))}function ee(t){return e=>oe.createElement(cy,Ao({attr:To({},t.attr)},e),Mm(t.child))}function cy(t){var e=n=>{var{attr:r,size:i,title:s}=t,o=sy(t,iy),a=i||n.size||"1em",u;return n.className&&(u=n.className),t.className&&(u=(u?u+" ":"")+t.className),oe.createElement("svg",Ao({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:u,style:To(To({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&oe.createElement("title",null,s),t.children)};return Zh!==void 0?oe.createElement(Zh.Consumer,null,n=>e(n)):e(Sm)}function dy(t){return ee({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(t)}function hy(t){return ee({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"},child:[]}]})(t)}function fy(t){return ee({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(t)}function py(t){return ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 48v32a16 16 0 0 1-16 16h-48v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V96h-32v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V352h-32a160 160 0 0 1 0-320h240a16 16 0 0 1 16 16z"},child:[]}]})(t)}function my(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"},child:[]}]})(t)}function gy(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"},child:[]}]})(t)}function by(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 224H293.9l-87.17-26.83A43.55 43.55 0 0 1 219.55 112h66.79A49.89 49.89 0 0 1 331 139.58a16 16 0 0 0 21.46 7.15l42.94-21.47a16 16 0 0 0 7.16-21.46l-.53-1A128 128 0 0 0 287.51 32h-68a123.68 123.68 0 0 0-123 135.64c2 20.89 10.1 39.83 21.78 56.36H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h480a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-180.24 96A43 43 0 0 1 336 356.45 43.59 43.59 0 0 1 292.45 400h-66.79A49.89 49.89 0 0 1 181 372.42a16 16 0 0 0-21.46-7.15l-42.94 21.47a16 16 0 0 0-7.16 21.46l.53 1A128 128 0 0 0 224.49 480h68a123.68 123.68 0 0 0 123-135.64 114.25 114.25 0 0 0-5.34-24.36z"},child:[]}]})(t)}var vy=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const yy=[.8,.9,1,1.1,1.2,1.5];let bu=!1;const mM=({text:t,voice:e,language:n,hide:r,playListenerEvent:i,initialSpeed:s=1,playOnMount:o=!1,enableSpeedAdjustment:a=!1,cache:u=!0,size:l="25px",ttsInstructions:c,disableDialect:d=!1})=>{const[h,f]=Z(null),[p,m]=Z(s),[g,b]=Z(!1),[v,_]=Z(!1),{ai:x,userInfo:y}=bn(),w=De(null),C=De(null);J(()=>(h&&f(null),()=>{h&&URL.revokeObjectURL(h)}),[t]);const k=()=>vy(void 0,void 0,void 0,function*(){_(!0);const F=c??(!d&&y?.dialect?`Speak with a ${y.dialect} accent and pronunciation.`:void 0),L=yield x.getVoice(t,e||(n?"aws_default":"openai_alloy"),1,n,u,F);f(URL.createObjectURL(L)),_(!1)});J(()=>{if(!h||!g){w.current&&(w.current.pause(),w.current.currentTime=0,w.current=null);return}w.current&&(w.current.pause(),w.current.currentTime=0);const F=new Audio(h);return w.current=F,F.playbackRate=p,F.play().then(()=>{F.onended=()=>{b(!1),bu=!1,w.current=null}}).catch(L=>{console.warn("Error playing audio:",L),b(!1),w.current=null}),()=>{w.current&&(w.current.pause(),w.current.currentTime=0,w.current=null)}},[h,g,p]),J(()=>()=>{w.current&&(w.current.pause(),w.current.currentTime=0,w.current=null),b(!1)},[]),J(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const S=()=>{!g&&!h?k().then(()=>b(!0)):b(F=>!F)},D=De(S);return c0(()=>{D.current=S}),J(()=>{if(!i)return;const F=()=>D.current(),L=zb.on(i,F);return C.current=L,()=>{C.current&&(C.current.off(),C.current=null)}},[i]),J(()=>{!o||bu||(bu=!0,S())},[o]),A("div",{className:"group relative",children:Me("div",{className:"flex flex-row items-end",children:[!r&&A("button",{className:"text-gray-400",onClick:S,disabled:v,children:v?A(_y,{size:l}):g?A(gy,{size:l}):A(my,{size:l})}),a&&Me("div",{className:"ml-1 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-row text-sm text-gray-500",children:[A("span",{className:"pr-1",children:"Speed: "}),A("select",{value:p,className:"appearance-none cursor-pointer pr-0 p-0 rounded shadow leading-tight focus:outline-none focus:bg-gray-800 focus:ring bg-transparent border-0",onChange:F=>m(parseFloat(F.target.value)),disabled:v,children:yy.map(F=>A("option",{value:F,children:F},F))})]})]})})},_y=({text:t,className:e,size:n="30px"})=>Me("div",{className:"flex items-center space-x-2 pl-1 "+e,children:[Me("svg",{style:{width:n,height:n},className:"animate-spin -ml-1 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[A("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),A("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t&&A("span",{className:"",children:t})]});function xy(t){return ee({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M192 0C139 0 96 43 96 96l0 160c0 53 43 96 96 96s96-43 96-96l0-160c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 89.1 66.2 162.7 152 174.4l0 33.6-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l72 0 72 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-48 0 0-33.6c85.8-11.7 152-85.3 152-174.4l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 70.7-57.3 128-128 128s-128-57.3-128-128l0-40z"},child:[]}]})(t)}function ky(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z"},child:[]}]})(t)}var vu=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Am=d0(({onVoiceRecorded:t,iconSize:e,className:n,disabled:r,loading:i,onRecordingStatusChange:s,enablePushToTalk:o=!1},a)=>{const[u,l]=Z(!1),[c,d]=Z(!1),h=De(null),{ai:f,plugin:p}=bn(),m=De(t);J(()=>{m.current=t},[t]);const g=()=>vu(void 0,void 0,void 0,function*(){try{h.current||(h.current=new Hb(p.pluginId)),yield h.current.startRecording(),l(!0),s(!0)}catch(_){console.error("Failed to start recording:",_)}}),b=()=>vu(void 0,void 0,void 0,function*(){try{if(h.current&&u){const _=yield h.current.stopRecording();d(!0);const x=yield f.getTextFromVoice(_.recording);d(!1),m.current(x)}}catch(_){console.error("Failed to stop recording:",_)}finally{l(!1),s(!1)}});Lb(a,()=>({startRecording:g,stopRecording:b}));const v=De(!1);return J(()=>{if(!o)return;const _=y=>vu(void 0,void 0,void 0,function*(){y.code==="Space"&&!v.current&&(v.current=!0,yield g())}),x=y=>{y.code==="Space"&&v.current&&(v.current=!1,b())};return window.addEventListener("keydown",_),window.addEventListener("keyup",x),()=>{window.removeEventListener("keydown",_),window.removeEventListener("keyup",x)}},[o]),A("button",{className:"flex flex-row justify-center items-center rounded-full mx-auto disabled:opacity-50 "+n,onClick:u?b:g,disabled:r||i||c,children:i||c?A(ky,{className:"animate-spin"}):A(xy,{size:e,className:u?"text-red-600":""})})});function Tm({imageUrl:t,className:e,isDarkTheme:n=!1,width:r="150px",loudnessRef:i}){const s=De(null),o=De(0),a=De(null),u=(l,c,d,h)=>{if(c&&l){l.clearRect(0,0,c.width,c.height);const f=Math.min(c.width,c.height)/3,p=c.width/2,m=c.height/2,g=f+h/2.5;l.beginPath(),l.arc(p,m,g,0,Math.PI*2,!0),l.strokeStyle=n?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.5)",l.lineWidth=5,l.stroke(),l.save(),l.beginPath(),l.arc(p,m,f,0,Math.PI*2,!0),l.closePath(),l.clip(),l.drawImage(d,p-f,m-f,f*2,f*2),l.restore(),l.beginPath(),l.arc(p,m,f,0,Math.PI*2,!0),l.strokeStyle=n?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.9)",l.lineWidth=5,l.stroke()}};return J(()=>{const l=s.current;if(l){const c=l.getContext("2d");if(c){const d=new Image;d.src=t;let h=!0;return d.onload=()=>{if(!h)return;u(c,l,d,0);const f=()=>{var p;const m=(p=i?.current)!==null&&p!==void 0?p:0,g=.06;o.current>m?o.current=Math.max(m,o.current-g*o.current):o.current=m,u(c,l,d,o.current),a.current=requestAnimationFrame(f)};a.current=requestAnimationFrame(f)},()=>{h=!1,a.current&&cancelAnimationFrame(a.current)}}}},[t]),A("canvas",{ref:s,className:e,width:500,height:500,style:{width:r}})}function wy(t){const e=[];return t.userMessage&&e.push({id:"1",role:"user",content:t.userMessage}),t.assistantMessage&&e.push({id:"2",role:"assistant",content:t.assistantMessage}),e}function gM({avatarImageUrl:t,voiceId:e,agentTools:n,autoStartConversation:r,children:i,circleSize:s="300px",className:o,cache:a=!1,prompt:u,promptVariables:l}){const{ai:c,plugin:d,userInfo:h}=bn(),{isDark:f}=Kc(d.theme,!0),[p,m]=Z(!1),[g,b]=Z(!1),v=De(0),_=h?.dialect?`Speak with a ${h.dialect} accent and pronunciation.`:void 0,x=Rc(()=>new f0((...D)=>c.getVoice(...D),e,a),[e,c,a]);J(()=>{x.setInstructions(_)},[x,_]);const{messages:y,append:w,isLoading:C,lastMessage:k,setMessages:S}=ty(n,{prompt:u,promptVariables:l});return J(()=>{console.log("messages",y)},[y]),J(()=>{C||b(!1)},[C]),J(()=>{e&&(x.setOnLoudnessChange(D=>{v.current=D}),x.setOnEndOfSpeech(()=>m(!1)),r&&(S(wy(r)),r.assistantMessage?x.handleNewText(r.assistantMessage,C):r.userMessage&&w([{role:"user",content:r.userMessage,id:y.length.toString()}])))},[r,e]),J(()=>()=>{x.cleanup()},[x]),J(()=>{k?.role==="assistant"&&(x.handleNewText(k.content,C),k.toolCalls&&(m(!1),b(!1)))},[k,C]),Me("div",{className:`md:pb-8 ${o||""}`,children:[A(Tm,{width:s,className:"mx-auto",imageUrl:t,isDarkTheme:f,loudnessRef:v}),i,A(Am,{iconSize:"30",className:"w-16 h-16 shadow-lg rounded-full bg-gray-400 dark:bg-gray-800",disabled:p,loading:g,enablePushToTalk:!0,onVoiceRecorded:D=>{m(!0),w([{role:"user",content:"Message("+Math.floor((y.length+1)/2)+"): "+D,id:y.length.toString()}])},onRecordingStatusChange:D=>!D&&b(!0)})]})}function bM(){const{plugin:t}=bn(),[e,n]=Z(null),[r,i]=Z(0);return J(()=>{t.getTranslator().then(o=>{n(o),o.onLanguageChanged(()=>{i(a=>a+1)})})},[t]),{t:zt((o,a)=>{if(!e)return"";const u=e.t(o,a);return u||""},[e,r]),ready:e!==null}}function Cy(t){return ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A1 1 0 0 0 5 3v18a1 1 0 0 0 .536.886z"},child:[]}]})(t)}let Ey=0;const Sy=()=>`ba-${++Ey}`;function vM({prompt:t,promptVariables:e,autoStartConversation:n,circleSize:r="160px",chatPlaceholder:i,bottomAction:s,className:o,voiceSpeed:a=1,tools:u,showName:l=!1}){const{ai:c,plugin:d,userInfo:h}=bn(),f=d.ttsEnabled,{isDark:p}=Kc(d.theme,!0),m=h.study_buddy,g=h?.dialect,b=g?`Speak with a ${g} accent and pronunciation.`:void 0,[v,_]=Z(""),[x,y]=Z([]),[w,C]=Z(!1),[k,S]=Z(!1),D=De(0),F=De(f);J(()=>{F.current=f,!f&&k&&(L.stop(),S(!1))},[f]);const L=Rc(()=>{var V;return new f0((...he)=>c.getVoice(...he),(V=m?.voiceId)!==null&&V!==void 0?V:"")},[m?.voiceId,c]);J(()=>{L.setInstructions(b)},[L,b]),J(()=>(L.setVoiceSpeed(a),L.setOnLoudnessChange(V=>{D.current=V}),L.setOnEndOfSpeech(()=>S(!1)),()=>L.cleanup()),[L]);const j=V=>V.map(he=>({role:he.role,content:he.content})),W=V=>{C(!0),c.getStreamedText({messages:j(V),onMessage:(he,Ce,Ze)=>{C(!Ze);const bt=`ai-${he}`;y(Oe=>{const We=Oe[Oe.length-1];return We?.id===bt?[...Oe.slice(0,-1),Object.assign(Object.assign({},We),{content:Ce})]:[...Oe,{id:bt,role:"assistant",content:Ce}]}),F.current&&(L.handleNewText(Ce,!Ze),Ce&&S(!0))},tools:u,prompt:t,variables:e})},X=De(!1);if(J(()=>{if(!X.current){if(X.current=!0,n?.assistantMessage){const V={id:"init",role:"assistant",content:n.assistantMessage};y([V]),F.current&&(L.handleNewText(n.assistantMessage,!1),S(!0))}else if(n?.userMessage){const V={id:"auto-start",role:"user",content:n.userMessage};y([V]),W([V])}}},[]),!m)return A("div",{});const ne=V=>{if(!V.trim()||w)return;const he={id:Sy(),role:"user",content:V},Ce=[...x,he];y(Ce),W(Ce)},se=[...x].filter(V=>V.role==="assistant").pop();return Me("div",{className:`flex flex-col items-center ${o||""}`,children:[A(Tm,{width:r,imageUrl:m.avatarUrl,isDarkTheme:p,loudnessRef:D,className:"mx-auto"}),l&&A("div",{className:"flex items-center gap-2",children:A("span",{className:"text-3xl font-semibold",children:m.name})}),!d.ttsEnabled&&x.length>1?A("div",{className:"w-full rounded-xl bg-gray-200/70 dark:bg-gray-800/70 px-4 py-3 text-sm text-gray-800 dark:text-gray-200 leading-relaxed border border-gray-300/40 dark:border-gray-700/40 mt-4",children:!se?.content&&w?Me("span",{className:"inline-flex gap-1 py-0.5",children:[A("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce"}),A("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.15s"}}),A("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.3s"}})]}):A("span",{className:"whitespace-pre-wrap",children:se?.content})}):null,Me("div",{className:"w-full relative mt-4 "+(f?"max-w-md":""),children:[A("input",{value:v,onChange:V=>_(V.target.value),onKeyDown:V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),ne(v),_(""))},placeholder:i??`Ask ${m.name} a question…`,disabled:w,className:"w-full bg-gray-800/50 border border-gray-700 rounded-lg px-3 py-2 pr-16 text-sm text-gray-200 placeholder:text-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-60"}),Me("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[A(Am,{iconSize:"14",className:"p-1 text-gray-400 hover:text-white transition-colors",disabled:w,onVoiceRecorded:V=>ne(V),onRecordingStatusChange:()=>{}}),A("button",{type:"button",onClick:()=>{ne(v),_("")},disabled:w||!v.trim(),className:"p-1 text-gray-400 hover:text-white disabled:opacity-40 transition-colors",children:A(Cy,{className:"w-4 h-4"})})]})]}),s&&A("div",{className:"w-full max-w-md border-t border-gray-700/60 pt-3",children:s})]})}function My(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6 9 17l-5-5"},child:[]}]})(t)}function Ay(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z"},child:[]},{tag:"path",attr:{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10"},child:[]},{tag:"path",attr:{d:"m17 10 4 4-4 4"},child:[]}]})(t)}function Ty(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},child:[]}]})(t)}function Dy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"m17 12 3-2v8"},child:[]}]})(t)}function Oy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"},child:[]}]})(t)}function Ry(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2"},child:[]},{tag:"path",attr:{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2"},child:[]}]})(t)}function Ny(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},child:[]},{tag:"path",attr:{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},child:[]}]})(t)}function Fy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 2v4"},child:[]},{tag:"path",attr:{d:"m16.2 7.8 2.9-2.9"},child:[]},{tag:"path",attr:{d:"M18 12h4"},child:[]},{tag:"path",attr:{d:"m16.2 16.2 2.9 2.9"},child:[]},{tag:"path",attr:{d:"M12 18v4"},child:[]},{tag:"path",attr:{d:"m4.9 19.1 2.9-2.9"},child:[]},{tag:"path",attr:{d:"M2 12h4"},child:[]},{tag:"path",attr:{d:"m4.9 4.9 2.9 2.9"},child:[]}]})(t)}function Iy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 3 21 3 21 9"},child:[]},{tag:"polyline",attr:{points:"9 21 3 21 3 15"},child:[]},{tag:"line",attr:{x1:"21",x2:"14",y1:"3",y2:"10"},child:[]},{tag:"line",attr:{x1:"3",x2:"10",y1:"21",y2:"14"},child:[]}]})(t)}function Py(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"4 14 10 14 10 20"},child:[]},{tag:"polyline",attr:{points:"20 10 14 10 14 4"},child:[]},{tag:"line",attr:{x1:"14",x2:"21",y1:"10",y2:"3"},child:[]},{tag:"line",attr:{x1:"3",x2:"10",y1:"21",y2:"14"},child:[]}]})(t)}function Ly(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"},child:[]},{tag:"path",attr:{d:"M20 3v4"},child:[]},{tag:"path",attr:{d:"M22 5h-4"},child:[]},{tag:"path",attr:{d:"M4 17v2"},child:[]},{tag:"path",attr:{d:"M5 18H3"},child:[]}]})(t)}function $e(t){this.content=t}$e.prototype={constructor:$e,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new $e(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new $e(n)},addToStart:function(t,e){return new $e([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new $e(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new $e(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=$e.from(t),t.size?new $e(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=$e.from(t),t.size?new $e(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=$e.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};$e.from=function(t){if(t instanceof $e)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new $e(e)};function Dm(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Dm(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Om(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),u=o.nodeSize;if(o==a){n-=u,r-=u;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let l=0,c=Math.min(o.text.length,a.text.length);for(;l<c&&o.text[o.text.length-l-1]==a.text[a.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let l=Om(o.content,a.content,n-1,r-1);if(l)return l}n-=u,r-=u}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let u=this.content[o],l=a+u.nodeSize;if(l>e&&r(u,i+a,s||null,o)!==!1&&u.content.size){let c=a+1;u.nodesBetween(Math.max(0,e-c),Math.min(u.content.size,n-c),r,i+c)}a=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,u)=>{let l=a.isText?a.text.slice(Math.max(e,u)-u,n-u):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=l},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],u=o+a.nodeSize;u>e&&((o<e||u>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=u}return new M(r,i)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Dm(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Om(this,e,n,r)}findIndex(e){if(e==0)return Os(0,e);if(e==this.size)return Os(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Os(n+1,s):Os(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const yu={index:0,offset:0};function Os(t,e){return yu.index=t,yu.offset=e,yu}function Do(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Do(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Do(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let re=class Vl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Do(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Vl.none;if(e instanceof Vl)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};re.none=[];class Oo extends Error{}class R{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Nm(this.content,e+this.openStart,n);return r&&new R(r,this.openStart,this.openEnd)}removeBetween(e,n){return new R(Rm(this.content,e+this.openStart,n+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,n){if(!n)return R.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(M.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new R(e,r,i)}}R.empty=new R(M.empty,0,0);function Rm(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Rm(s.content,e-i-1,n-i-1)))}function Nm(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Nm(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function By(t,e,n){if(n.openStart>t.depth)throw new Oo("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Oo("Inconsistent open depths");return Fm(t,e,n,0)}function Fm(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=Fm(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return lr(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=$y(n,t);return lr(s,Pm(t,o,a,e,r))}else return lr(s,Ro(t,e,r))}function Im(t,e){if(!e.type.compatibleContent(t.type))throw new Oo("Cannot join "+e.type.name+" onto "+t.type.name)}function ql(t,e,n){let r=t.node(n);return Im(r,e.node(n)),r}function ur(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Ii(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(ur(t.nodeAfter,r),s++));for(let a=s;a<o;a++)ur(i.child(a),r);e&&e.depth==n&&e.textOffset&&ur(e.nodeBefore,r)}function lr(t,e){return t.type.checkContent(e),t.copy(e)}function Pm(t,e,n,r,i){let s=t.depth>i&&ql(t,e,i+1),o=r.depth>i&&ql(n,r,i+1),a=[];return Ii(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(Im(s,o),ur(lr(s,Pm(t,e,n,r,i+1)),a)):(s&&ur(lr(s,Ro(t,e,i+1)),a),Ii(e,n,i,a),o&&ur(lr(o,Ro(n,r,i+1)),a)),Ii(r,null,i,a),new M(a)}function Ro(t,e,n){let r=[];if(Ii(null,t,n,r),t.depth>n){let i=ql(t,e,n+1);ur(lr(i,Ro(t,e,n+1)),r)}return Ii(e,null,n,r),new M(r)}function $y(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Yi{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return re.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new No(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<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:u}=o.content.findIndex(s),l=s-u;if(r.push(o,a,i+u),!l||(o=o.child(a),o.isText))break;s=l-1,i+=u+1}return new Yi(n,r,s)}static resolveCached(e,n){let r=Qh.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else Qh.set(e,r=new zy);let i=r.elts[r.i]=Yi.resolve(e,n);return r.i=(r.i+1)%Hy,i}}class zy{constructor(){this.elts=[],this.i=0}}const Hy=12,Qh=new WeakMap;class No{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const jy=Object.create(null);let $n=class Wl{constructor(e,n,r,i=re.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Do(this.attrs,n||e.defaultAttrs||jy)&&re.sameSet(this.marks,r||re.none)}copy(e=null){return e==this.content?this:new Wl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Wl(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return R.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),l=i.node(o).content.cut(i.pos-a,s.pos-a);return new R(l,i.depth-o,s.depth-o)}replace(e,n,r){return By(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Yi.resolveCached(this,e)}resolveNoCache(e){return Yi.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,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()+")"),Lm(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=re.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!re.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=M.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};$n.prototype.text=void 0;class Fo extends $n{constructor(e,n,r,i){if(super(e,n,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):Lm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Fo(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fo(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Lm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class pr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Vy(e,n);if(r.next==null)return pr.empty;let i=Bm(r);r.next&&r.err("Unexpected trailing text");let s=Yy(Gy(i));return Zy(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let u=o.matchFragment(e,r);if(u&&(!n||u.validEnd))return M.from(a.map(l=>l.createAndFill()));for(let l=0;l<o.next.length;l++){let{type:c,next:d}=o.next[l];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(c));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:u}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||u.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
3
|
-
`)}}pr.empty=new pr(!0);class Vy{constructor(e,n){this.string=e,this.nodeTypes=n,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 Bm(t){let e=[];do e.push(qy(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function qy(t){let e=[];do e.push(Wy(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Wy(t){let e=Jy(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=Uy(t,e);else break;return e}function ef(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function Uy(t,e){let n=ef(t),r=n;return t.eat(",")&&(t.next!="}"?r=ef(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function Ky(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function Jy(t){if(t.eat("(")){let e=Bm(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=Ky(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Gy(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,u){let l={term:u,to:a};return e[o].push(l),l}function i(o,a){o.forEach(u=>u.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((u,l)=>u.concat(s(l,a)),[]);if(o.type=="seq")for(let u=0;;u++){let l=s(o.exprs[u],a);if(u==o.exprs.length-1)return l;i(l,a=n())}else if(o.type=="star"){let u=n();return r(a,u),i(s(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(s(o.expr,a),u),i(s(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let u=a;for(let l=0;l<o.min;l++){let c=n();i(s(o.expr,u),c),u=c}if(o.max==-1)i(s(o.expr,u),u);else for(let l=o.min;l<o.max;l++){let c=n();r(u,c),i(s(o.expr,u),c),u=c}return[r(u)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function $m(t,e){return e-t}function tf(t,e){let n=[];return r(e),n.sort($m);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:u}=s[o];!a&&n.indexOf(u)==-1&&r(u)}}}function Yy(t){let e=Object.create(null);return n(tf(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:u})=>{if(!a)return;let l;for(let c=0;c<i.length;c++)i[c][0]==a&&(l=i[c][1]);tf(t,u).forEach(c=>{l||i.push([a,l=[]]),l.indexOf(c)==-1&&l.push(c)})})});let s=e[r.join(",")]=new pr(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort($m);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function Zy(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:u,next:l}=i.next[a];o.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(l)==-1&&r.push(l)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function zm(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Hm(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function jm(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function Vm(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Qy(t,r,e[r]);return n}let nf=class qm{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Vm(e,r.attrs),this.defaultAttrs=zm(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==pr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-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:Hm(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new $n(this,this.computeAttrs(e),M.from(n),re.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new $n(this,this.computeAttrs(e),n,re.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(M.empty,!0);return s?new $n(this,e,n.append(s),re.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){jm(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:re.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new qm(s,n,o));let i=n.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 Xy(t,e,n){let r=n.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 ${t}, got ${s}`)}}class Qy{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?Xy(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Ma{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Vm(e,i.attrs),this.excluded=null;let s=zm(this.attrs);this.instance=s?new re(this,s):null}create(e=null){return!e&&this.instance?this.instance:new re(this,Hm(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Ma(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){jm(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Jc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=$e.from(e.nodes),n.marks=$e.from(e.marks||{}),this.nodes=nf.compile(this.spec.nodes,this),this.marks=Ma.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||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=pr.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=a=="_"?null:a?rf(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:rf(this,o.split(" "))}this.nodeFromJSON=i=>$n.fromJSON(this,i),this.markFromJSON=i=>re.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof nf){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(n,r,i)}text(e,n){let r=this.nodes.text;return new Fo(r,r.defaultAttrs,e,re.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function rf(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let u=t.marks[a];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function e_(t){return t.tag!=null}function t_(t){return t.style!=null}class fn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(e_(i))this.tags.push(i);else if(t_(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,n={}){let r=new of(this,n,!1);return r.addAll(e,re.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new of(this,n,!0);return r.addAll(e,re.none,n.from,n.to),R.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(i_(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=af(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=af(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new fn(e,fn.schemaRules(e)))}}const Wm={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},n_={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Um={ol:!0,ul:!0},Zi=1,Ul=2,Pi=4;function sf(t,e,n){return e!=null?(e?Zi:0)|(e==="full"?Ul:0):t&&t.whitespace=="pre"?Zi|Ul:n&~Pi}class Rs{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=re.none,this.match=s||(o&Pi?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);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&Zi)){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 n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Wm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class of{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=sf(null,n.preserveWhitespace,0)|(r?Pi:0);i?s=new Rs(i.type,i.attrs,re.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Rs(null,null,re.none,!0,null,o):s=new Rs(e.schema.topNodeType,null,re.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Ul?"full":this.localPreserveWS||(i.options&Zi)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
4
|
-
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let u=0;u<a.length;u++)u&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[u]&&this.insertNode(o.text(a[u]),n,!/\S/.test(a[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],u=e.previousSibling;(!a||u&&u.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,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(),a;
|
|
5
|
-
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let u=this.parser.matchStyle(s,o,this,a);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(l=>!u.clearMark(l)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)a=u;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let u=this.nodes[o],l=u.findWrapping(e);if(l&&(!i||i.length>l.length+a)&&(i=l,s=u,!l.length))break;if(u.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=re.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):uf(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=sf(e,s,o.options);o.options&Pi&&o.content.length==0&&(a|=Pi);let u=re.none;return r=r.filter(l=>(o.type?o.type.allowsMarkType(l.type):uf(l.type,e))?(u=l.addToSet(u),!1):!0),this.nodes.push(new Rs(e,n,u,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Zi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=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=(a,u)=>{for(;a>=0;a--){let l=n[a];if(l==""){if(a==n.length-1||a==0)continue;for(;u>=s;u--)if(o(a-1,u))return!0;return!1}else{let c=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function r_(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Um.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function i_(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function af(t){let e={};for(let n in t)e[n]=t[n];return e}function uf(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let u=0;u<a.edgeCount;u++){let{type:l,next:c}=a.edge(u);if(l==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class xr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=_u(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,u=0;for(;a<s.length&&u<o.marks.length;){let l=o.marks[u];if(!this.marks[l.type.name]){u++;continue}if(!l.eq(s[a][0])||l.type.spec.spanning===!1)break;a++,u++}for(;a<s.length;)i=s.pop()[1];for(;u<o.marks.length;){let l=o.marks[u++],c=this.serializeMark(l,o.isInline,n);c&&(s.push([l,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Qs(_u(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Qs(_u(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Qs(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=lf(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return lf(e.marks)}}function lf(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function _u(t){return t.document||window.document}const cf=new WeakMap;function s_(t){let e=cf.get(t);return e===void 0&&cf.set(t,e=o_(t)),e}function o_(t){let e=null;function n(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<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Qs(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=s_(r))&&s.indexOf(e)>-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&&(n=i.slice(0,o),i=i.slice(o+1));let a,u=n?t.createElementNS(n,i):t.createElement(i),l=e[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let d in l)if(l[d]!=null){let h=d.indexOf(" ");h>0?u.setAttributeNS(d.slice(0,h),d.slice(h+1),l[d]):d=="style"&&u.style?u.style.cssText=l[d]:u.setAttribute(d,l[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:f,contentDOM:p}=Qs(t,h,n,r);if(u.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:u,contentDOM:a}}const Km=65535,Jm=Math.pow(2,16);function a_(t,e){return t+e*Jm}function df(t){return t&Km}function u_(t){return(t-(t&Km))/Jm}const Gm=1,Ym=2,eo=4,Zm=8;class Kl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&Zm)>0}get deletedBefore(){return(this.delInfo&(Gm|eo))>0}get deletedAfter(){return(this.delInfo&(Ym|eo))>0}get deletedAcross(){return(this.delInfo&eo)>0}}class dt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&dt.empty)return dt.empty}recover(e){let n=0,r=df(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+u_(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?i:0);if(u>e)break;let l=this.ranges[a+s],c=this.ranges[a+o],d=u+l;if(e<=d){let h=l?e==u?-1:e==d?1:n:n,f=u+i+(h<0?0:c);if(r)return f;let p=e==(n<0?u:d)?null:a_(a/3,e-u),m=e==u?Ym:e==d?Gm:eo;return(n<0?e!=u:e!=d)&&(m|=Zm),new Kl(f,m,p)}i+=c-l}return r?e+i:new Kl(e+i,0,null)}touches(e,n){let r=0,i=df(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?r:0);if(u>e)break;let l=this.ranges[a+s],c=u+l;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-l}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),u=o+(this.inverted?0:s),l=this.ranges[i+n],c=this.ranges[i+r];e(a,a+l,u,u+c),s+=c-l}}invert(){return new dt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?dt.empty:new dt(e<0?[0,-e,0]:[0,0,e])}}dt.empty=new dt([]);class Xi{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Xi(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Xi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Kl(e,i,null)}}const xu=Object.create(null);class Ye{getMap(){return dt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=xu[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in xu)throw new RangeError("Duplicate use of step JSON ID "+e);return xu[e]=n,n.prototype.jsonID=e,n}}class Ae{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ae(e,null)}static fail(e){return new Ae(null,e)}static fromReplace(e,n,r,i){try{return Ae.ok(e.replace(n,r,i))}catch(s){if(s instanceof Oo)return Ae.fail(s.message);throw s}}}function Gc(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Gc(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return M.fromArray(r)}class Fn extends Ye{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new R(Gc(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,s)}invert(){return new qt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Fn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Fn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Fn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Fn(n.from,n.to,e.markFromJSON(n.mark))}}Ye.jsonID("addMark",Fn);class qt extends Ye{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new R(Gc(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,r)}invert(){return new Fn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qt(n.pos,r.pos,this.mark)}merge(e){return e instanceof qt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qt(n.from,n.to,e.markFromJSON(n.mark))}}Ye.jsonID("removeMark",qt);class In extends Ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ae.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ae.fromReplace(e,this.pos,this.pos+1,new R(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new In(this.pos,n.marks[i]);return new In(this.pos,this.mark)}}return new mr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new In(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new In(n.pos,e.markFromJSON(n.mark))}}Ye.jsonID("addNodeMark",In);class mr extends Ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ae.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ae.fromReplace(e,this.pos,this.pos+1,new R(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new In(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new mr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new mr(n.pos,e.markFromJSON(n.mark))}}Ye.jsonID("removeNodeMark",mr);class Se extends Ye{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Jl(e,this.from,this.to)?Ae.fail("Structure replace would overwrite content"):Ae.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Se.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Se(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Se)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?R.empty:new R(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?R.empty:new R(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Se(n.from,n.to,R.fromJSON(e,n.slice),!!n.structure)}}Se.MAP_BIAS=1;Ye.jsonID("replace",Se);class Fe extends Ye{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Jl(e,this.from,this.gapFrom)||Jl(e,this.gapTo,this.to)))return Ae.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ae.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ae.fromReplace(e,this.from,this.to,r):Ae.fail("Content does not fit in gap")}getMap(){return new dt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Fe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Fe(n.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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Fe(n.from,n.to,n.gapFrom,n.gapTo,R.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ye.jsonID("replaceAround",Fe);function Jl(t,e,n){let r=t.resolve(e),i=n-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 l_(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(u,l,c)=>{if(!u.isInline)return;let d=u.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(l,e),f=Math.min(l+u.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:i.push(o=new qt(h,f,d[m])));a&&a.to==h?a.to=f:s.push(a=new Fn(h,f,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function c_(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let u=null;if(r instanceof Ma){let l=o.marks,c;for(;c=r.isInSet(l);)(u||(u=[])).push(c),l=c.removeFromSet(l)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let l=Math.min(a+o.nodeSize,n);for(let c=0;c<u.length;c++){let d=u[c],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=l,h.step=s):i.push({style:d,from:Math.max(a,e),to:l,step:s})}}}),i.forEach(o=>t.step(new qt(o.from,o.to,o.style)))}function Yc(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let u=0;u<s.childCount;u++){let l=s.child(u),c=a+l.nodeSize,d=r.matchType(l.type);if(!d)o.push(new Se(a,c,R.empty));else{r=d;for(let h=0;h<l.marks.length;h++)n.allowsMarkType(l.marks[h].type)||t.step(new qt(a,c,l.marks[h]));if(i&&l.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(l.text);)p||(p=new R(M.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),o.push(new Se(a+h.index,a+h.index+h[0].length,p))}}a=c}if(!r.validEnd){let u=r.fillBefore(M.empty,!0);t.replace(a,a,new R(u,0,0))}for(let u=o.length-1;u>=0;u--)t.step(o[u])}function d_(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function oi(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,u,n))return r;if(r==0||o.type.spec.isolating||!d_(o,a,u))break;a&&(i=1),u<o.childCount&&(s=1)}return null}function h_(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),u=o,l=a,c=M.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=M.from(r.node(p).copy(c)),d++):u--;let h=M.empty,f=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=M.from(i.node(p).copy(h)),f++):l++;t.step(new Fe(u,l,o,a,new R(c.append(h),d,f),c.size-d,!0))}function Zc(t,e,n=null,r=t){let i=f_(t,e),s=i&&p_(r,e);return s?i.map(hf).concat({type:e,attrs:n}).concat(s.map(hf)):null}function hf(t){return{type:t,attrs:null}}function f_(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function p_(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let u=(o.length?o[o.length-1]:e).contentMatch;for(let l=r;u&&l<i;l++)u=u.matchType(n.child(l).type);return!u||!u.validEnd?null:o}function m_(t,e,n){let r=M.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Fe(i,s,i,s,new R(r,0,0),n.length,!0))}function g_(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let u=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&b_(t.doc,t.mapping.slice(s).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?l=!1:!f&&p&&(l=!0)}l===!1&&Qm(t,o,a,s),Yc(t,t.mapping.slice(s).map(a,1),r,void 0,l===null);let c=t.mapping.slice(s),d=c.map(a,1),h=c.map(a+o.nodeSize,1);return t.step(new Fe(d,h,d+1,h-1,new R(M.from(r.create(u,null,o.marks)),0,0),1,!0)),l===!0&&Xm(t,o,a,s),!1}})}function Xm(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function Qm(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
6
|
-
`))}})}function b_(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function v_(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Fe(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new R(M.from(o),0,0),1,!0))}function pn(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,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 l=i.depth-1,c=n-2;l>s;l--,c--){let d=i.node(l),h=i.index(l);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[c+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(a,a,u?u.type:i.node(s+1).type)}function y_(t,e,n=1,r){let i=t.doc.resolve(e),s=M.empty,o=M.empty;for(let a=i.depth,u=i.depth-n,l=n-1;a>u;a--,l--){s=M.from(i.node(a).copy(s));let c=r&&r[l];o=M.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}t.step(new Se(e,e,new R(s.append(o),n,n),!0))}function Wn(t,e){let n=t.resolve(e),r=n.index();return eg(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function __(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function eg(t,e){return!!(t&&e&&!t.isLeaf&&__(t,e))}function Aa(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&eg(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function x_(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);Qm(t,c.node(),c.before(),a)}o.inlineContent&&Yc(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(a),l=u.map(e-n);if(t.step(new Se(l,u.map(e+n,-1),R.empty,!0)),r===!0){let c=t.doc.resolve(l);Xm(t,c.node(),c.before(),t.steps.length)}return t}function k_(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))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,n))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,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function tg(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(a>0?1:0),l=r.node(o),c=!1;if(s==1)c=l.canReplace(u,u,i);else{let d=l.contentMatchAt(u).findWrapping(i.firstChild.type);c=d&&l.canReplaceWith(u,u,d[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Ta(t,e,n=e,r=R.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return ng(i,s,r)?new Se(e,n,r):new w_(i,s,r).fit()}function ng(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class w_{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.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=M.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=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,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let u=new R(s,o,a);return e>-1?new Fe(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=ku(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:u,match:l}=this.frontier[a],c,d=null;if(n==1&&(o?l.matchType(o.type)||(d=l.fillBefore(M.from(o),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(c=l.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&l.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=ku(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new R(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=ku(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new R(Si(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new R(Si(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,u=o.openStart-e,l=0,c=[],{match:d,type:h}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;l<a.childCount;){let m=a.child(l),g=d.matchType(m.type);if(!g)break;l++,(l>1||u==0||m.content.size)&&(d=g,c.push(rg(m.mark(h.allowedMarks(m.marks)),l==1?u:0,l==a.childCount?f:-1)))}let p=l==a.childCount;p||(f=-1),this.placed=Mi(this.placed,n,M.from(c)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?R.empty:new R(Si(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new R(Si(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!wu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=wu(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:u,type:l}=this.frontier[a],c=wu(e,a,l,u,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Mi(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.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,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Mi(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=Mi(this.placed,this.frontier.length,n))}}function Si(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Si(t.firstChild.content,e-1,n)))}function Mi(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Mi(t.lastChild.content,e-1,n)))}function ku(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function rg(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,rg(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),t.copy(r)}function wu(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!C_(n,s.content,o)?a:null}function C_(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function E_(t){return t.spec.defining||t.spec.definingForContent}function S_(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(ng(i,s,r))return t.step(new Se(e,n,r));let o=sg(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let u=o.indexOf(a),l=[],c=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(l.push(p),f==r.openStart)break;h=p.content}for(let h=c-1;h>=0;h--){let f=l[h],p=E_(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),p=l[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+u)%o.length],b=!0;g<0&&(b=!1,g=-g);let v=i.node(g-1),_=i.index(g-1);if(v.canReplaceWith(_,_,p.type,p.marks))return t.replace(i.before(g),b?s.after(g):n,new R(ig(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),n=s.after(f))}}function ig(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(ig(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(M.empty,!0))}return t}function M_(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=k_(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new R(M.from(r),0,0))}function A_(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let u=r.depth;u>o;u--)r.node(u).type.spec.isolating&&(a=!0);for(let u=i.depth;u>o;u--)i.node(u).type.spec.isolating&&(a=!0);if(!a){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=i.depth;u>0&&n==i.start(u);u--)n=i.before(u);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=sg(r,i);for(let o=0;o<s.length;o++){let a=s[o],u=o==s.length-1;if(u&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(u||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=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 t.delete(r.before(o),n);t.delete(e,n)}function sg(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Wr extends Ye{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ae.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Ae.fromReplace(e,this.pos,this.pos+1,new R(M.from(i),0,n.isLeaf?0:1))}getMap(){return dt.empty}invert(e){return new Wr(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Wr(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Wr(n.pos,n.attr,n.value)}}Ye.jsonID("attr",Wr);class Qi extends Ye{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Ae.ok(r)}getMap(){return dt.empty}invert(e){return new Qi(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Qi(n.attr,n.value)}}Ye.jsonID("docAttr",Qi);let Qr=class extends Error{};Qr=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};Qr.prototype=Object.create(Error.prototype);Qr.prototype.constructor=Qr;Qr.prototype.name="TransformError";class Xc{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Xi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Qr(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,u)=>{e=Math.min(e,a),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=R.empty){let i=Ta(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new R(M.from(r),0,0))}delete(e,n){return this.replace(e,n,R.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return S_(this,e,n,r),this}replaceRangeWith(e,n,r){return M_(this,e,n,r),this}deleteRange(e,n){return A_(this,e,n),this}lift(e,n){return h_(this,e,n),this}join(e,n=1){return x_(this,e,n),this}wrap(e,n){return m_(this,e,n),this}setBlockType(e,n=e,r,i=null){return g_(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return v_(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Wr(e,n,r)),this}setDocAttribute(e,n){return this.step(new Qi(e,n)),this}addNodeMark(e,n){return this.step(new In(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof re)n.isInSet(r.marks)&&this.step(new mr(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new mr(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return y_(this,e,n,r),this}addMark(e,n,r){return l_(this,e,n,r),this}removeMark(e,n,r){return c_(this,e,n,r),this}clearIncompatible(e,n,r){return Yc(this,e,n,r),this}}const Cu=Object.create(null);class q{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new og(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=R.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:u,$to:l}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(u.pos),c.map(l.pos),a?R.empty:n),a==0&&mf(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],u=e.mapping.slice(r),l=u.map(o.pos),c=u.map(a.pos);s?e.deleteRange(l,c):(e.replaceRangeWith(l,c,n),mf(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new H(e):Ir(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Ir(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Ir(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new mt(e.node(0))}static atStart(e){return Ir(e,e,0,0,1)||new mt(e)}static atEnd(e){return Ir(e,e,e.content.size,e.childCount,-1)||new mt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Cu[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Cu)throw new RangeError("Duplicate use of selection JSON ID "+e);return Cu[e]=n,n.prototype.jsonID=e,n}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}q.prototype.visible=!0;class og{constructor(e,n){this.$from=e,this.$to=n}}let ff=!1;function pf(t){!ff&&!t.parent.inlineContent&&(ff=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class H extends q{constructor(e,n=e){pf(e),pf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return q.near(r);let i=e.resolve(n.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,n=R.empty){if(super.replace(e,n),n==R.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Da(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new H(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(s)n=s.$head;else return q.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new H(e,n)}}q.jsonID("text",H);class Da{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Da(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class z extends q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?q.near(s):new z(s)}content(){return new R(M.from(this.node),0,0)}eq(e){return e instanceof z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Qc(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new z(e.resolve(n.anchor))}static create(e,n){return new z(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}z.prototype.visible=!1;q.jsonID("node",z);class Qc{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Da(r,r):new Qc(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&z.isSelectable(r)?new z(n):q.near(n)}}class mt extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=R.empty){if(n==R.empty){e.delete(0,e.doc.content.size);let r=q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new mt(e)}map(e){return new mt(e)}eq(e){return e instanceof mt}getBookmark(){return T_}}q.jsonID("all",mt);const T_={map(){return this},resolve(t){return new mt(t)}};function Ir(t,e,n,r,i,s=!1){if(e.inlineContent)return H.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&z.isSelectable(a))return z.create(t,n-(i<0?a.nodeSize:0))}else{let u=Ir(t,a,n+i,i<0?a.childCount:0,i,s);if(u)return u}n+=a.nodeSize*i}return null}function mf(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Se||i instanceof Fe))return;let s=t.mapping.maps[r],o;s.forEach((a,u,l,c)=>{o==null&&(o=c)}),t.setSelection(q.near(t.doc.resolve(o),n))}const gf=1,Ns=2,bf=4;class D_ extends Xc{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.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|gf)&~Ns,this.storedMarks=null,this}get selectionSet(){return(this.updated&gf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ns,this}ensureMarks(e){return re.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&Ns)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Ns,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||re.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=bf,this}get scrolledIntoView(){return(this.updated&bf)>0}}function vf(t,e){return!e||!t?t:t.bind(e)}class Ai{constructor(e,n,r){this.name=e,this.init=vf(n.init,r),this.apply=vf(n.apply,r)}}const O_=[new Ai("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ai("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new Ai("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ai("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Eu{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=O_.slice(),n&&n.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 Ai(r.key,r.spec.state,r))})}}class Hr{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let u=i?i[o].n:0,l=i?i[o].state:this,c=u<n.length&&a.spec.appendTransaction.call(a,u?n.slice(u):n,l,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Hr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new D_(this)}static create(e){let n=new Eu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Hr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Eu(this.schema,e.plugins),r=n.fields,i=new Hr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.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&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Eu(e.schema,e.plugins),s=new Hr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=$n.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=q.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let u=r[a],l=u.spec.state;if(u.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=l.fromJSON.call(u,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function ag(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=ag(i,e,{})),n[r]=i}return n}class we{constructor(e){this.spec=e,this.props={},e.props&&ag(e.props,this,this.props),this.key=e.key?e.key.key:ug("plugin")}getState(e){return e[this.key]}}const Su=Object.create(null);function ug(t){return t in Su?t+"$"+ ++Su[t]:(Su[t]=0,t+"$")}class Be{constructor(e="key"){this.key=ug(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const je=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ei=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Gl=null;const un=function(t,e,n){let r=Gl||(Gl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},R_=function(){Gl=null},gr=function(t,e,n,r){return n&&(yf(t,e,n,r,-1)||yf(t,e,n,r,1))},N_=/^(img|br|input|textarea|hr)$/i;function yf(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Et(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ps(t)||N_.test(t.nodeName)||t.contentEditable=="false")return!1;e=je(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Et(t):0}else return!1}}function Et(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function F_(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Et(t)}else if(t.parentNode&&!ps(t))e=je(t),t=t.parentNode;else return null}}function I_(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ps(t))e=je(t)+1,t=t.parentNode;else return null}}function P_(t,e,n){for(let r=e==0,i=e==Et(t);r||i;){if(t==n)return!0;let s=je(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Et(t)}}function ps(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Oa=function(t){return t.focusNode&&gr(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function tr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function L_(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function B_(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Et(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Et(r.startContainer),r.startOffset)}}}const Kt=typeof navigator<"u"?navigator:null,_f=typeof document<"u"?document:null,Un=Kt&&Kt.userAgent||"",Yl=/Edge\/(\d+)/.exec(Un),lg=/MSIE \d/.exec(Un),Zl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Un),ut=!!(lg||Zl||Yl),zn=lg?document.documentMode:Zl?+Zl[1]:Yl?+Yl[1]:0,Mt=!ut&&/gecko\/(\d+)/i.test(Un);Mt&&+(/Firefox\/(\d+)/.exec(Un)||[0,0])[1];const Xl=!ut&&/Chrome\/(\d+)/.exec(Un),qe=!!Xl,cg=Xl?+Xl[1]:0,Je=!ut&&!!Kt&&/Apple Computer/.test(Kt.vendor),ti=Je&&(/Mobile\/\w+/.test(Un)||!!Kt&&Kt.maxTouchPoints>2),wt=ti||(Kt?/Mac/.test(Kt.platform):!1),dg=Kt?/Win/.test(Kt.platform):!1,hn=/Android \d/.test(Un),ms=!!_f&&"webkitFontSmoothing"in _f.documentElement.style,$_=ms?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function z_(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function tn(t,e){return typeof t=="number"?t:t[e]}function H_(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function xf(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=ei(o);continue}let a=o,u=a==s.body,l=u?z_(s):H_(a),c=0,d=0;if(e.top<l.top+tn(r,"top")?d=-(l.top-e.top+tn(i,"top")):e.bottom>l.bottom-tn(r,"bottom")&&(d=e.bottom-e.top>l.bottom-l.top?e.top+tn(i,"top")-l.top:e.bottom-l.bottom+tn(i,"bottom")),e.left<l.left+tn(r,"left")?c=-(l.left-e.left+tn(i,"left")):e.right>l.right-tn(r,"right")&&(c=e.right-l.right+tn(i,"right")),c||d)if(u)s.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:ei(o)}}function j_(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let u=a.getBoundingClientRect();if(u.top>=n-20){r=a,i=u.top;break}}return{refDOM:r,refTop:i,stack:hg(t.dom)}}function hg(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ei(r));return e}function V_({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;fg(n,r==0?0:r-e)}function fg(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Ar=null;function q_(t){if(t.setActive)return t.setActive();if(Ar)return t.focus(Ar);let e=hg(t);t.focus(Ar==null?{get preventScroll(){return Ar={preventScroll:!0},!0}}:void 0),Ar||(Ar=!1,fg(e,0))}function pg(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,u,l;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=un(c).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!u&&p.left<=e.left&&p.right>=e.left&&(u=c,l={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&u&&(n=u,i=l,r=0),n&&n.nodeType==3?W_(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:pg(n,i)}function W_(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Cn(r,1);if(o.top!=o.bottom&&ed(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function ed(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function U_(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function K_(t,e,n){let{node:r,offset:i}=pg(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function J_(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),u;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((u=a.dom.getBoundingClientRect()).width||u.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?i=a.posBefore:(!o&&u.right<r.left||u.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function mg(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let u=0;u<a.length;u++){let l=a[u];if(ed(e,l))return mg(o,e,l)}}if((s=(s+1)%r)==i)break}return t}function G_(t,e){let n=t.dom.ownerDocument,r,i=0,s=B_(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let l=t.dom.getBoundingClientRect();if(!ed(e,l)||(o=mg(t.dom,e,l),!o))return null}if(Je)for(let l=o;r&&l;l=ei(l))l.draggable&&(r=void 0);if(o=U_(o,e),r){if(Mt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let l;ms&&i&&r.nodeType==1&&(l=r.childNodes[i-1]).nodeType==1&&l.contentEditable=="false"&&l.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=J_(t,r,i,e))}a==null&&(a=K_(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:a,inside:u?u.posAtStart-u.border:-1}}function kf(t){return t.top<t.bottom||t.left<t.right}function Cn(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(kf(r))return r}return Array.prototype.find.call(n,kf)||t.getBoundingClientRect()}const Y_=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function gg(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=ms||Mt;if(r.nodeType==3)if(o&&(Y_.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=Cn(un(r,i,i),n);if(Mt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=Cn(un(r,i-1,i-1),-1);if(l.top==u.top){let c=Cn(un(r,i,i+1),-1);if(c.top!=u.top)return gi(c,c.left<l.left)}}return u}else{let u=i,l=i,c=n<0?1:-1;return n<0&&!i?(l++,c=-1):n>=0&&i==r.nodeValue.length?(u--,c=1):n<0?u--:l++,gi(Cn(un(r,u,l),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Et(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Mu(u.getBoundingClientRect(),!1)}if(s==null&&i<Et(r)){let u=r.childNodes[i];if(u.nodeType==1)return Mu(u.getBoundingClientRect(),!0)}return Mu(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Et(r))){let u=r.childNodes[i-1],l=u.nodeType==3?un(u,Et(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(l)return gi(Cn(l,1),!1)}if(s==null&&i<Et(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let l=u?u.nodeType==3?un(u,0,o?0:1):u.nodeType==1?u:null:null;if(l)return gi(Cn(l,-1),!0)}return gi(Cn(r.nodeType==3?un(r):r,-n),n>=0)}function gi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Mu(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function bg(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Z_(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return bg(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=gg(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let u;if(a.nodeType==1)u=a.getClientRects();else if(a.nodeType==3)u=un(a,0,a.nodeValue.length).getClientRects();else continue;for(let l=0;l<u.length;l++){let c=u[l];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const X_=/[\u0590-\u08ac]/;function Q_(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!X_.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:bg(t,e,()=>{let{focusNode:u,focusOffset:l,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||u==p&&l==m;try{a.collapse(c,d),u&&(u!=c||l!=d)&&a.extend&&a.extend(u,l)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let wf=null,Cf=null,Ef=!1;function ex(t,e,n){return wf==e&&Cf==n?Ef:(wf=e,Cf=n,Ef=n=="up"||n=="down"?Z_(t,e,n):Q_(t,e,n))}const At=0,Sf=1,rr=2,Jt=3;class gs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=At,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>je(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(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==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,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||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 n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof yg){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof vg&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?je(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?je(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let u=this.children[a],l=o+u.size;if(i==-1&&e<=l){let c=o+u.border;if(e>=c&&n<=l-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,c);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=je(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(l>n||a==this.children.length-1)){n=l;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=je(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),u=n==e?a:this.domFromPos(n,n?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Mt||Je)&&e==n){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
|
|
7
|
-
`),d&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=u={node:g.parentNode,offset:je(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Mt&&c.focusNode&&c.focusNode!=u.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&Je)&&gr(a.node,a.offset,c.anchorNode,c.anchorOffset)&&gr(u.node,u.offset,c.focusNode,c.focusOffset))return;let h=!1;if((l.extend||e==n)&&!(d&&Mt)){l.collapse(a.node,a.offset);try{e!=n&&l.extend(u.node,u.offset),h=!0}catch{}}if(!h){if(e>n){let p=a;a=u,u=p}let f=document.createRange();f.setEnd(u.node,u.offset),f.setStart(a.node,a.offset),l.removeAllRanges(),l.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,u=o-s.border;if(e>=a&&n<=u){this.dirty=e==r||n==o?rr:Sf,e==a&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Jt:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?rr:Jt}r=o}this.dirty=rr}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?rr:Sf;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class vg extends gs{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==At&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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 ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class tx extends gs{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class br extends gs{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=xr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new br(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Jt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=At){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=At}}slice(e,n,r){let i=br.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=ec(s,n,o,r)),e>0&&(s=ec(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Hn extends gs{constructor(e,n,r,i,s,o,a,u,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],u,l=a&&a(n,s,()=>{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),c=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=xr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let h=c;return c=kg(c,r,n),l?u=new nx(e,n,r,i,c,d||null,h,l,s,o+1):n.isText?new Ra(e,n,r,i,c,h,s):new Hn(e,n,r,i,c,d||null,h,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 n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,n,r){return this.dirty==At&&e.eq(this.node)&&Io(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,u=new ix(this,o&&o.node,e);ax(this.node,this.innerDeco,(l,c,d)=>{l.spec.marks?u.syncToMarks(l.spec.marks,r,e,c):l.type.side>=0&&!d&&u.syncToMarks(c==this.node.childCount?re.none:this.node.child(c).marks,r,e,c),u.placeWidget(l,e,i)},(l,c,d,h)=>{u.syncToMarks(l.marks,r,e,h);let f;u.findNodeMatch(l,c,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+l.nodeSize&&(f=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(l,c,d,f,e)||u.updateNextNode(l,c,d,e,h,i)||u.addNode(l,c,d,e,i),i+=l.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==rr)&&(o&&this.protectLocalComposition(e,o),_g(this.contentDOM,this.children,e),ti&&ux(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<n||i>n+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,a=lx(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;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 tx(this,s,n,i);e.input.compositionNodes.push(o),this.children=ec(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=At}updateOuterDeco(e){if(Io(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=xg(this.dom,this.nodeDOM,Ql(this.outerDeco,this.node,n),Ql(e,this.node,n)),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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Mf(t,e,n,r,i){kg(r,e,t);let s=new Hn(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Ra extends Hn{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Jt||this.dirty!=At&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=At||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=At,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Ra(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Jt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class yg extends gs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==At&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class nx extends Hn{constructor(e,n,r,i,s,o,a,u,l,c){super(e,n,r,i,s,o,a,l,c),this.spec=u}update(e,n,r,i){if(this.dirty==Jt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,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 _g(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Af(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof br){let u=r?r.previousSibling:t.lastChild;_g(o.contentDOM,o.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=Af(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Li=function(t){t&&(this.nodeName=t)};Li.prototype=Object.create(null);const ir=[new Li];function Ql(t,e,n){if(t.length==0)return ir;let r=n?ir[0]:new Li,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Li(o.nodeName));for(let a in o){let u=o[a];u!=null&&(n&&i.length==1&&i.push(r=new Li(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+u:a=="style"?r.style=(r.style?r.style+";":"")+u:a!="nodeName"&&(r[a]=u))}}}return i}function xg(t,e,n,r){if(n==ir&&r==ir)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let u;a&&a.nodeName==o.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==o.nodeName||(u=document.createElement(o.nodeName),u.pmIsDeco=!0,u.appendChild(i),a=ir[0]),i=u}rx(i,a||ir[0],o)}return i}function rx(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function kg(t,e,n){return xg(t,t,ir,Ql(e,n,t.nodeType!=1))}function Io(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Af(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class ix{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=sx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=At,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let u=-1,l=this.top.children.length;i<this.preMatch.index&&(l=Math.min(this.index+3,l));for(let c=this.index;c<l;c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){u=c;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let c=br.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,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,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,u=Math.min(this.top.children.length,a+5);a<u;a++){let l=this.top.children[a];if(l.matchesNode(e,n,r)&&!this.preMatch.matched.has(l)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Jt&&o.dom==o.contentDOM&&(o.dirty=rr),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let u=this.top.children[a];if(u instanceof Hn){let l=this.preMatch.matched.get(u);if(l!=null&&l!=s)return!1;let c=u.dom,d,h=this.isLocked(c)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Jt&&Io(n,u.outerDeco));if(!h&&u.update(e,n,r,i))return this.destroyBetween(this.index,a),u.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(u,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=rr,d.updateChildren(i,o+1),d.dirty=At),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Io(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=Hn.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let u of a.children)u.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=Hn.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new vg(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof br;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ra)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Je||qe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new yg(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function sx(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let l=n.children[r-1];if(l instanceof br)n=l,r=l.children.length;else{a=l,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=a.node;if(u){if(u!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function ox(t,e){return t.type.side-e.type.side}function ax(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let l=0;l<t.childCount;l++){let c=t.child(l);r(c,i,e.forChild(s,c),l),s+=c.nodeSize}return}let o=0,a=[],u=null;for(let l=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(c?(d||(d=[c])).push(g):c=g)}if(c)if(d){d.sort(ox);for(let g=0;g<d.length;g++)n(d[g],l,!!u)}else n(c,l,!!u);let h,f;if(u)f=-1,h=u,u=null;else if(l<t.childCount)f=l,h=t.child(l++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(u=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(s,h),f),s=p}}function ux(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function lx(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<t.childCount;){let l=t.child(i++);if(s+=l.nodeSize,!l.isText)break;u+=l.text}if(s>=n){if(s>=r&&u.slice(r-e.length-a,r-a)==e)return r-e.length;let l=a<r?u.lastIndexOf(e,r-a-1):-1;if(l>=0&&l+e.length+a>=n)return a+l;if(n==r&&u.length>=r+e.length-a&&u.slice(r-a,r-a+e.length)==e)return r}}return-1}function ec(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let u=t[o],l=a,c=a+=u.size;l>=n||c<=e?s.push(u):(l<e&&s.push(u.slice(0,e-l,r)),i&&(s.push(i),i=void 0),c>n&&s.push(u.slice(n-l,u.size,r)))}return s}function td(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),u,l;if(Oa(n)){for(u=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&z.isSelectable(d)&&i.parent&&!(d.isInline&&P_(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;l=new z(o==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[u,o]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(o)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let c=r.resolve(u);if(!l){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;l=nd(t,c,a,d)}return l}function wg(t){return t.editable?t.hasFocus():Eg(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function mn(t,e=!1){let n=t.state.selection;if(Cg(t,n),!!wg(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&qe){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&gr(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)dx(t);else{let{anchor:r,head:i}=n,s,o;Tf&&!(n instanceof H)&&(n.$from.parent.inlineContent||(s=Df(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Df(t,n.to))),t.docView.setSelection(r,i,t,e),Tf&&(s&&Of(s),o&&Of(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&cx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Tf=Je||qe&&cg<63;function Df(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Je&&i&&i.contentEditable=="false")return Au(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Au(i);if(s)return Au(s)}}function Au(t){return t.contentEditable="true",Je&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Of(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function cx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!wg(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function dx(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,je(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ut&&zn<=11&&(n.disabled=!0,n.disabled=!1)}function Cg(t,e){if(e instanceof z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Rf(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Rf(t)}function Rf(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function nd(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||H.between(e,n,r)}function Nf(t){return t.editable&&!t.hasFocus()?!1:Eg(t)}function Eg(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function hx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return gr(e.node,e.offset,n.anchorNode,n.anchorOffset)}function tc(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&q.findFrom(s,e)}function En(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Ff(t,e,n){let r=t.state.selection;if(r instanceof H)if(n.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=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return En(t,new H(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=tc(t.state,e);return i&&i instanceof z?En(t,i):!1}else if(!(wt&&n.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 a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?z.isSelectable(s)?En(t,new z(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):ms?En(t,new H(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof z&&r.node.isInline)return En(t,new H(e>0?r.$to:r.$from));{let i=tc(t.state,e);return i?En(t,i):!1}}}function Po(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Bi(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Tr(t,e){return e<0?fx(t):px(t)}function fx(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Mt&&n.nodeType==1&&r<Po(n)&&Bi(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Bi(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Sg(n))break;{let a=n.previousSibling;for(;a&&Bi(a,-1);)i=n.parentNode,s=je(a),a=a.previousSibling;if(a)n=a,r=Po(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?nc(t,n,r):i&&nc(t,i,s)}function px(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Po(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(Bi(a,1))s=n,o=++r;else break}else{if(Sg(n))break;{let a=n.nextSibling;for(;a&&Bi(a,1);)s=a.parentNode,o=je(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Po(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&nc(t,s,o)}function Sg(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function mx(t,e){for(;t&&e==t.childNodes.length&&!ps(t);)e=je(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function gx(t,e){for(;t&&!e&&!ps(t);)e=je(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function nc(t,e,n){if(e.nodeType!=3){let s,o;(o=mx(e,n))?(e=o,n=0):(s=gx(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Oa(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&mn(t)},50)}function If(t,e){let n=t.state.doc.resolve(e);if(!(qe||dg)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Pf(t,e,n){let r=t.state.selection;if(r instanceof H&&!r.empty||n.indexOf("s")>-1||wt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=tc(t.state,e);if(o&&o instanceof z)return En(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof mt?q.near(o,e):q.findFrom(o,e);return a?En(t,a):!1}return!1}function Lf(t,e){if(!(t.state.selection instanceof H))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Bf(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function bx(t){if(!Je||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Bf(t,r,"true"),setTimeout(()=>Bf(t,r,"false"),20)}return!1}function vx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function yx(t,e){let n=e.keyCode,r=vx(e);if(n==8||wt&&n==72&&r=="c")return Lf(t,-1)||Tr(t,-1);if(n==46&&!e.shiftKey||wt&&n==68&&r=="c")return Lf(t,1)||Tr(t,1);if(n==13||n==27)return!0;if(n==37||wt&&n==66&&r=="c"){let i=n==37?If(t,t.state.selection.from)=="ltr"?-1:1:-1;return Ff(t,i,r)||Tr(t,i)}else if(n==39||wt&&n==70&&r=="c"){let i=n==39?If(t,t.state.selection.from)=="ltr"?1:-1:1;return Ff(t,i,r)||Tr(t,i)}else{if(n==38||wt&&n==80&&r=="c")return Pf(t,-1,r)||Tr(t,-1);if(n==40||wt&&n==78&&r=="c")return bx(t)||Pf(t,1,r)||Tr(t,1);if(r==(wt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function rd(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||xr.fromSchema(t.state.schema),a=Rg(),u=a.createElement("div");u.appendChild(o.serializeFragment(r,{document:a}));let l=u.firstChild,c,d=0;for(;l&&l.nodeType==1&&(c=Og[l.nodeName.toLowerCase()]);){for(let f=c.length-1;f>=0;f--){let p=a.createElement(c[f]);for(;u.firstChild;)p.appendChild(u.firstChild);u.appendChild(p),d++}l=u.firstChild}l&&l.nodeType==1&&l.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
|
8
|
-
|
|
9
|
-
`);return{dom:u,text:h,slice:e}}function
|
|
10
|
-
`))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:f}=t.state,p=xr.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=wx(n),ms&&Cx(o);let l=o&&o.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||fn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||c),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!_x.test(h.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Ex($f(a,+c[1],+c[2]),c[4]);else if(a=R.maxOpen(xx(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=$f(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t,u)}),a}const _x=/^(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 xx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let u=i.findWrapping(a.type),l;if(!u)return o=null;if(l=o.length&&s.length&&Tg(u,s,a,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=Dg(o[o.length-1],s.length));let c=Ag(a,u);o.push(c),i=i.matchType(c.type),s=u}}),o)return M.from(o)}return t}function Ag(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function Tg(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Tg(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(M.from(Ag(n,t,i+1))))}}function Dg(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Dg(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}function rc(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=rc(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function $f(t,e,n){return e<t.openStart&&(t=new R(rc(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new R(rc(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Og={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let zf=null;function Rg(){return zf||(zf=document.implementation.createHTMLDocument("title"))}let Tu=null;function kx(t){let e=window.trustedTypes;return e?(Tu||(Tu=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Tu.createHTML(t)):t}function wx(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Rg().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Og[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=kx(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function Cx(t){let e=t.querySelectorAll(qe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Ex(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let u=n.nodes[r[a]];if(!u||u.hasRequiredAttrs())break;i=M.from(u.create(r[a+1],i)),s++,o++}return new R(i,s,o)}const nt={},rt={},Sx={touchstart:!0,touchmove:!0};class Mx{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Ax(t){for(let e in nt){let n=nt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Dx(t,r)&&!id(t,r)&&(t.editable||!(r.type in rt))&&n(t,r)},Sx[e]?{passive:!0}:void 0)}Je&&t.dom.addEventListener("input",()=>null),ic(t)}function Pn(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Tx(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function ic(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>id(t,r))})}function id(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Dx(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Ox(t,e){!id(t,e)&&nt[e.type]&&(t.editable||!(e.type in rt))&&nt[e.type](t,e)}rt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Fg(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(hn&&qe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ti&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,tr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||yx(t,n)?n.preventDefault():Pn(t,"key")};rt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};rt.keypress=(t,e)=>{let n=e;if(Fg(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||wt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Na(t){return{left:t.clientX,top:t.clientY}}function Rx(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function sd(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Ur(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function Nx(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(Ur(t,new z(n)),!0):!1}function Fx(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof z&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(z.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Ur(t,z.create(t.state.doc,i)),!0):!1}function Ix(t,e,n,r,i){return sd(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Fx(t,n):Nx(t,n))}function Px(t,e,n,r){return sd(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Lx(t,e,n,r){return sd(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Bx(t,n,r)}function Bx(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Ur(t,H.create(r,0,r.content.size)),!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),a=i.before(s);if(o.inlineContent)Ur(t,H.create(r,a+1,a+1+o.content.size));else if(z.isSelectable(o))Ur(t,z.create(r,a));else continue;return!0}}function od(t){return Lo(t)}const Ng=wt?"metaKey":"ctrlKey";nt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=od(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Rx(n,t.input.lastClick)&&!n[Ng]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Na(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new $x(t,o,n,!!r)):(s=="doubleClick"?Px:Lx)(t,o.pos,o.inside,n)?n.preventDefault():Pn(t,"pointer"))};class $x{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ng],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,u=a?e.docView.nearestDesc(a,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:l}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||l instanceof z&&l.from<=o&&l.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Mt&&!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)),Pn(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(()=>mn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Na(e))),this.updateAllowDefault(e),this.allowDefault||!n?Pn(this.view,"pointer"):Ix(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Je&&this.mightDrag&&!this.mightDrag.node.isAtom||qe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ur(this.view,q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Pn(this.view,"pointer")}move(e){this.updateAllowDefault(e),Pn(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)}}nt.touchstart=t=>{t.input.lastTouch=Date.now(),od(t),Pn(t,"pointer")};nt.touchmove=t=>{t.input.lastTouch=Date.now(),Pn(t,"pointer")};nt.contextmenu=t=>od(t);function Fg(t,e){return t.composing?!0:Je&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const zx=hn?5e3:-1;rt.compositionstart=rt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||qe&&dg&&Hx(t)))t.markCursor=t.state.storedMarks||n.marks(),Lo(t,!0),t.markCursor=null;else if(Lo(t,!e.selection.empty),Mt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.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 a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}Ig(t,zx)};function Hx(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}rt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Ig(t,20))};function Ig(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Lo(t),e))}function Pg(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Vx());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function jx(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=F_(e.focusNode,e.focusOffset),r=I_(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Vx(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Lo(t,e=!1){if(!(hn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Pg(t),e||t.docView&&t.docView.dirty){let n=td(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function qx(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const es=ut&&zn<15||ti&&$_<604;nt.copy=rt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=es?null:n.clipboardData,o=r.content(),{dom:a,text:u}=rd(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",u)):qx(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Wx(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Ux(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ts(t,r.value,null,i,e):ts(t,r.textContent,r.innerHTML,i,e)},50)}function ts(t,e,n,r,i){let s=Mg(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||R.empty)))return!0;if(!s)return!1;let o=Wx(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Lg(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}rt.paste=(t,e)=>{let n=e;if(t.composing&&!hn)return;let r=es?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ts(t,Lg(r),r.getData("text/html"),i,n)?n.preventDefault():Ux(t,n)};class Bg{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const Kx=wt?"altKey":"ctrlKey";function $g(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[Kx]}nt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Na(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)o=z.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=z.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:u,text:l,slice:c}=rd(t,a);(!n.dataTransfer.files.length||!qe||cg>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(es?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",es||n.dataTransfer.setData("text/plain",l),t.dragging=new Bg(c,$g(t,n),o)};nt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};rt.dragover=rt.dragenter=(t,e)=>e.preventDefault();rt.drop=(t,e)=>{try{Jx(t,e,t.dragging)}finally{t.dragging=null}};function Jx(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Na(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=Mg(t,Lg(e.dataTransfer),es?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&$g(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||R.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?tg(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let u=t.state.tr;if(o){let{node:f}=n;f?f.replace(u):u.deleteSelection()}let l=u.mapping.map(a),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=u.doc;if(c?u.replaceRangeWith(l,l,s.content.firstChild):u.replaceRange(l,l,s),u.doc.eq(d))return;let h=u.doc.resolve(l);if(c&&z.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new z(h));else{let f=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((p,m,g,b)=>f=b),u.setSelection(nd(t,h,u.doc.resolve(f)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}nt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&mn(t)},20))};nt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};nt.beforeinput=(t,e)=>{if(qe&&hn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,tr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in rt)nt[t]=rt[t];function ns(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Bo{constructor(e,n){this.toDOM=e,this.spec=n||cr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new tt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Bo&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ns(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class jn{constructor(e,n){this.attrs=e,this.spec=n||cr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new tt(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof jn&&ns(this.attrs,e.attrs)&&ns(this.spec,e.spec)}static is(e){return e.type instanceof jn}destroy(){}}class ad{constructor(e,n){this.attrs=e,this.spec=n||cr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new tt(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof ad&&ns(this.attrs,e.attrs)&&ns(this.spec,e.spec)}destroy(){}}class tt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new tt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new tt(e,e,new Bo(n,r))}static inline(e,n,r,i){return new tt(e,n,new jn(r,i))}static node(e,n,r,i){return new tt(e,n,new ad(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof jn}get widget(){return this.type instanceof Bo}}const Pr=[],cr={};class ye{constructor(e,n){this.local=e.length?e:Pr,this.children=n.length?n:Pr}static create(e,n){return n.length?$o(n,e,0,cr):Ke}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==Ke||e.maps.length==0?this:this.mapInner(e,n,0,0,r||cr)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let u=this.local[a].map(e,r,i);u&&u.type.valid(n,u)?(o||(o=[])).push(u):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?Gx(this.children,o||[],e,n,r,i,s):o?new ye(o.sort(dr),Pr):Ke}add(e,n){return n.length?this==Ke?ye.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,u)=>{let l=u+r,c;if(c=Hg(n,a,l)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(a,c,l+1):i.splice(s,0,u,u+a.nodeSize,$o(c,a,l+1,cr)),s+=3}});let o=zg(s?jg(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ye(o.length?this.local.concat(o).sort(dr):this.local,i||this.children)}remove(e){return e.length==0||this==Ke?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,u=r[s+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<u&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let l=r[s+2].removeInner(o,a+1);l!=Ke?r[s+2]=l:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ye(i,r):Ke}forChild(e,n){if(this==Ke)return this;if(n.isLeaf)return ye.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let u=this.local[a];if(u.from<o&&u.to>s&&u.type instanceof jn){let l=Math.max(s,u.from)-s,c=Math.min(o,u.to)-s;l<c&&(i||(i=[])).push(u.copy(l,c))}}if(i){let a=new ye(i.sort(dr),Pr);return r?new Dn([a,r]):a}return r||Ke}eq(e){if(this==e)return!0;if(!(e instanceof ye)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return ud(this.localsInner(e))}localsInner(e){if(this==Ke)return Pr;if(e.inlineContent||!this.local.some(jn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof jn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ye.empty=new ye([],[]);ye.removeOverlap=ud;const Ke=ye.empty;class Dn{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,cr));return Dn.from(r)}forChild(e,n){if(n.isLeaf)return ye.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Ke&&(s instanceof Dn?r=r.concat(s.members):r.push(s))}return Dn.from(r)}eq(e){if(!(e instanceof Dn)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?ud(r?n:n.sort(dr)):Pr}static from(e){switch(e.length){case 0:return Ke;case 1:return e[0];default:return new Dn(e.every(n=>n instanceof ye)?e:e.reduce((n,r)=>n.concat(r instanceof ye?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function Gx(t,e,n,r,i,s,o){let a=t.slice();for(let l=0,c=s;l<n.maps.length;l++){let d=0;n.maps[l].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<a.length;b+=3){let v=a[b+1];if(v<0||h>v+c-d)continue;let _=a[b]+c-d;f>=_?a[b+1]=h<=_?-2:-1:h>=c&&g&&(a[b]+=g,a[b+1]+=g)}d+=g}),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(a[l+1]==-2){u=!0,a[l+1]=-1;continue}let c=n.map(t[l]+s),d=c-i;if(d<0||d>=r.content.size){u=!0;continue}let h=n.map(t[l+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==f){let b=a[l+2].mapInner(n,g,c+1,t[l]+s+1,o);b!=Ke?(a[l]=d,a[l+1]=f,a[l+2]=b):(a[l+1]=-2,u=!0)}else u=!0}if(u){let l=Yx(a,t,e,n,i,s,o),c=$o(l,r,0,o);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let f=c.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new ye(e.sort(dr),a)}function zg(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new tt(i.from+e,i.to+e,i.type))}return n}function Yx(t,e,n,r,i,s,o){function a(u,l){for(let c=0;c<u.local.length;c++){let d=u.local[c].map(r,i,l);d?n.push(d):o.onRemove&&o.onRemove(u.local[c].spec)}for(let c=0;c<u.children.length;c+=3)a(u.children[c+2],u.children[c]+l+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&a(t[u+2],e[u]+s+1);return n}function Hg(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function jg(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function $o(t,e,n,r){let i=[],s=!1;e.forEach((a,u)=>{let l=Hg(t,a,u+n);if(l){s=!0;let c=$o(l,a,n+u+1,r);c!=Ke&&i.push(u,u+a.nodeSize,c)}});let o=zg(s?jg(t):t,-n).sort(dr);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ye(o,i):Ke}function dr(t,e){return t.from-e.from||t.to-e.to}function ud(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Hf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Hf(e,i,r.copy(s.from,r.to)));break}}}return e}function Hf(t,e,n){for(;e<t.length&&dr(n,t[e])>0;)e++;t.splice(e,0,n)}function Du(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ke&&e.push(r)}),t.cursorWrapper&&e.push(ye.create(t.state.doc,[t.cursorWrapper.deco])),Dn.from(e)}const Zx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Xx=ut&&zn<=11;class Qx{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}}class ek{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qx,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ut&&zn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Je&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),Xx&&(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,Zx)),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 n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.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(Nf(this.view)){if(this.suppressingSelectionUpdates)return mn(this.view);if(ut&&zn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&gr(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 n=new Set,r;for(let s=e.focusNode;s;s=ei(s))n.add(s);for(let s=e.anchorNode;s;s=ei(s))if(n.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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Nf(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,u=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],u);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(u.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of u)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){c.parentNode.removeChild(c);break}d=d.firstChild}}}else if(Mt&&u.length){let c=u.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||rk(e,d)!=f)&&h.remove()}}}let l=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Oa(r)&&(l=td(e))&&l.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,mn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),tk(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,ik(e,u)),this.handleDOMChange(s,o,a,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||mn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.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 c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ut&&zn<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?je(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),u=s&&s.parentNode==e.target?je(s):e.target.childNodes.length,l=r.localPosFromDOM(e.target,u,1);return{from:a,to:l}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let jf=new WeakMap,Vf=!1;function tk(t){if(!jf.has(t)&&(jf.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Mt,Vf)return;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."),Vf=!0}}function qf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return gr(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function nk(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return qf(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?qf(t,n):null}function rk(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function ik(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let u=a.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;a=u}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function sk(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),u=t.domSelectionRange(),l,c=u.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(l=[{node:c,offset:u.anchorOffset}],Oa(u)||l.push({node:u.focusNode,offset:u.focusOffset})),qe&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=r.childNodes[g-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){s=g;break}if(!v||v.size)break}let d=t.state.doc,h=t.someProp("domParser")||fn.fromSchema(t.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:ok,context:f});if(l&&l[0].pos!=null){let g=l[0].pos,b=l[1]&&l[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:a}}function ok(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Je&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Je&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const ak=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function uk(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,k=td(t,C);if(k&&!t.state.selection.eq(k)){if(qe&&hn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,tr(13,"Enter"))))return;let S=t.state.tr.setSelection(k);C=="pointer"?S.setMeta("pointer",!0):C=="key"&&S.scrollIntoView(),s&&S.setMeta("composition",s),t.dispatch(S)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let u=t.state.selection,l=sk(t,e,n),c=t.state.doc,d=c.slice(l.from,l.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=dk(d.content,l.doc.content,l.from,h,f);if(p&&t.input.domChangeCount++,(ti&&t.input.lastIOSEnter>Date.now()-225||hn)&&i.some(C=>C.nodeType==1&&!ak.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,tr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&u instanceof H&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))p={start:u.from,endA:u.to,endB:u.to};else{if(l.sel){let C=Wf(t,t.state.doc,l.sel);if(C&&!C.eq(t.state.selection)){let k=t.state.tr.setSelection(C);s&&k.setMeta("composition",s),t.dispatch(k)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof H&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=l.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=l.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ut&&zn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>l.from&&l.doc.textBetween(p.start-l.from-1,p.start-l.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=l.doc.resolveNoCache(p.start-l.from),g=l.doc.resolveNoCache(p.endB-l.from),b=c.resolve(p.start),v=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((ti&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!v&&m.pos<l.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(l.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,tr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&ck(c,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",C=>C(t,tr(8,"Backspace")))){hn&&qe&&t.domObserver.suppressSelectionUpdates();return}qe&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),hn&&!v&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==p.endA&&(p.endB-=2,g=l.doc.resolveNoCache(p.endB-l.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,tr(13,"Enter"))})},20));let _=p.start,x=p.endA,y=C=>{let k=C||t.state.tr.replace(_,x,l.doc.slice(p.start-l.from,p.endB-l.from));if(l.sel){let S=Wf(t,k.doc,l.sel);S&&!(qe&&t.composing&&S.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==_||S.head==k.mapping.map(x)-1)||ut&&S.empty&&S.head==_)&&k.setSelection(S)}return s&&k.setMeta("composition",s),k.scrollIntoView()},w;if(v)if(m.pos==g.pos){ut&&zn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>mn(t),20));let C=y(t.state.tr.delete(_,x)),k=c.resolve(p.start).marksAcross(c.resolve(p.endA));k&&C.ensureMarks(k),t.dispatch(C)}else if(p.endA==p.endB&&(w=lk(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let C=y(t.state.tr);w.type=="add"?C.addMark(_,x,w.mark):C.removeMark(_,x,w.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,g.parentOffset),k=()=>y(t.state.tr.insertText(C,_,x));t.someProp("handleTextInput",S=>S(t,_,x,C,k))||t.dispatch(k())}else t.dispatch(y());else t.dispatch(y())}function Wf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:nd(t,e.resolve(n.anchor),e.resolve(n.head))}function lk(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,u;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)s=n[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",u=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",u=c=>c.mark(a.removeFromSet(c.marks));else return null;let l=[];for(let c=0;c<e.childCount;c++)l.push(u(e.child(c)));if(M.from(l).eq(t))return{mark:a,type:o}}function ck(t,e,n,r,i){if(n-e<=i.pos-r.pos||Ou(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Ou(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Ou(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ou(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function dk(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let u=Math.max(0,s-Math.min(o,a));r-=o+u-s}if(o<s&&t.size<e.size){let u=r<=s&&r>=o?s-r:0;s-=u,s&&s<e.size&&Uf(e.textBetween(s-1,s+1))&&(s+=u?1:-1),a=s+(a-o),o=s}else if(a<s){let u=r<=s&&r>=a?s-r:0;s-=u,s&&s<t.size&&Uf(t.textBetween(s-1,s+1))&&(s+=u?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Uf(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Vg{constructor(e,n){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 Mx,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Zf),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=Gf(this),Jf(this),this.nodeViews=Yf(this),this.docView=Mf(this.state.doc,Kf(this),Du(this),this.dom,this),this.domObserver=new ek(this,(r,i,s,o)=>uk(this,r,i,s,o)),this.domObserver.start(),Ax(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&ic(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Zf),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(Pg(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Yf(this);fk(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ic(this),this.editable=Gf(this),Jf(this);let u=Du(this),l=Kf(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,l,u);(d||!e.selection.eq(i.selection))&&(o=!0);let h=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&j_(this);if(o){this.domObserver.stop();let f=d&&(ut||qe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&hk(i.selection,e.selection);if(d){let p=qe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=jx(this)),(s||!this.docView.update(e.doc,l,u,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Mf(e.doc,l,u,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&hx(this))?mn(this,f):(Cg(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),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&V_(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&xf(this,n.getBoundingClientRect(),e)}else xf(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 n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new Bg(e.slice,e.move,i<0?void 0:z.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(ut){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&q_(this.dom),mn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return G_(this,e)}coordsAtPos(e,n=1){return gg(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return ex(this,n||this.state,e)}pasteHTML(e,n){return ts(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ts(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return rd(this,e)}destroy(){this.docView&&(Tx(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Du(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,R_())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Ox(this,e)}domSelectionRange(){let e=this.domSelection();return e?Je&&this.root.nodeType===11&&L_(this.dom.ownerDocument)==this.dom&&nk(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Vg.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Kf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[tt.node(0,t.state.doc.content.size,e)]}function Jf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:tt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Gf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function hk(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Yf(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function fk(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Zf(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Vn={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:"'"},zo={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},pk=typeof navigator<"u"&&/Mac/.test(navigator.platform),mk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ve=0;Ve<10;Ve++)Vn[48+Ve]=Vn[96+Ve]=String(Ve);for(var Ve=1;Ve<=24;Ve++)Vn[Ve+111]="F"+Ve;for(var Ve=65;Ve<=90;Ve++)Vn[Ve]=String.fromCharCode(Ve+32),zo[Ve]=String.fromCharCode(Ve);for(var Ru in Vn)zo.hasOwnProperty(Ru)||(zo[Ru]=Vn[Ru]);function gk(t){var e=pk&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||mk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?zo:Vn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const bk=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),vk=typeof navigator<"u"&&/Win/.test(navigator.platform);function yk(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let u=e[a];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))bk?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function _k(t){let e=Object.create(null);for(let n in t)e[yk(n)]=t[n];return e}function Nu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function xk(t){return new we({props:{handleKeyDown:ld(t)}})}function ld(t){let e=_k(t);return function(n,r){let i=gk(r),s,o=e[Nu(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Nu(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(vk&&r.ctrlKey&&r.altKey)&&(s=Vn[r.keyCode])&&s!=i){let a=e[Nu(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const cd=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function qg(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Wg=(t,e,n)=>{let r=qg(t,n);if(!r)return!1;let i=dd(r);if(!i){let o=r.blockRange(),a=o&&oi(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(e1(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ni(s,"end")||z.isSelectable(s)))for(let o=r.depth;;o--){let a=Ta(t.doc,r.before(o),r.after(o),R.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=t.tr.step(a);u.setSelection(ni(s,"end")?q.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):z.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},kk=(t,e,n)=>{let r=qg(t,n);if(!r)return!1;let i=dd(r);return i?Ug(t,i,e):!1},wk=(t,e,n)=>{let r=Jg(t,n);if(!r)return!1;let i=hd(r);return i?Ug(t,i,e):!1};function Ug(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,u=e.pos+1;for(;!a.isTextblock;u++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let l=Ta(t.doc,s,u,R.empty);if(!l||l.from!=s||l instanceof Se&&l.slice.size>=u-s)return!1;if(n){let c=t.tr.step(l);c.setSelection(H.create(c.doc,s)),n(c.scrollIntoView())}return!0}function ni(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Kg=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=dd(r)}let o=s&&s.nodeBefore;return!o||!z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function dd(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Jg(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Gg=(t,e,n)=>{let r=Jg(t,n);if(!r)return!1;let i=hd(r);if(!i)return!1;let s=i.nodeAfter;if(e1(t,i,e,1))return!0;if(r.parent.content.size==0&&(ni(s,"start")||z.isSelectable(s))){let o=Ta(t.doc,r.before(),r.after(),R.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(ni(s,"start")?q.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):z.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},Yg=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=hd(r)}let o=s&&s.nodeAfter;return!o||!z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,s.pos)).scrollIntoView()),!0)};function hd(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Ck=(t,e)=>{let n=t.selection,r=n instanceof z,i;if(r){if(n.node.isTextblock||!Wn(t.doc,n.from))return!1;i=n.from}else if(i=Aa(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(z.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Ek=(t,e)=>{let n=t.selection,r;if(n instanceof z){if(n.node.isTextblock||!Wn(t.doc,n.to))return!1;r=n.to}else if(r=Aa(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Sk=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&oi(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},Zg=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
11
|
-
`).scrollIntoView()),!0)};function fd(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Mk=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=fd(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),u=t.tr.replaceWith(a,a,o.createAndFill());u.setSelection(q.near(u.doc.resolve(a),1)),e(u.scrollIntoView())}return!0},Xg=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof mt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=fd(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(H.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},Qg=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(pn(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&oi(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function Ak(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof z&&e.selection.node.isBlock)return!r.parentOffset||!pn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,u=!1,l=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){u=r.end(f)==r.pos+(r.depth-f),l=r.start(f)==r.pos-(r.depth-f),a=fd(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(u&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof H||e.selection instanceof mt)&&c.deleteSelection();let d=c.mapping.map(r.pos),h=pn(c.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=pn(c.doc,d,s.length,s)),!h)return!1;if(c.split(d,s.length,s),!u&&l&&r.node(o).type!=a){let f=c.mapping.map(r.before(o)),p=c.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&c.setNodeMarkup(c.mapping.map(r.before(o)),a)}return n&&n(c.scrollIntoView()),!0}}const Tk=Ak(),Dk=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(z.create(t.doc,i))),!0)};function Ok(t,e,n){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)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Wn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function e1(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&Ok(t,e,n))return!0;let l=!u&&e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,p=M.empty;for(let b=o.length-1;b>=0;b--)p=M.from(o[b].create(null,p));p=M.from(i.copy(p));let m=t.tr.step(new Fe(e.pos-1,f,e.pos,f,new R(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Wn(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&u?null:q.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&oi(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(l&&ni(s,"start",!0)&&ni(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let b=M.empty;for(let _=p.length-1;_>=0;_--)b=M.from(p[_].copy(b));let v=t.tr.step(new Fe(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new R(b,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function t1(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(H.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const Rk=t1(-1),Nk=t1(1);function Fk(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&Zc(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function Xf(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(u,l)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let c=n.doc.resolve(l),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[o];s.setBlockType(a,u,t,e)}r(s.scrollIntoView())}return!0}}function pd(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}pd(cd,Wg,Kg);pd(cd,Gg,Yg);pd(Zg,Xg,Qg,Tk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Ik(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return Pk(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Pk(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);s=new No(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new No(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=Zc(s,n,r,e);return a?(t&&Lk(t,e,a,i,n),!0):!1}function Lk(t,e,n,r,i){let s=M.empty;for(let c=n.length-1;c>=0;c--)s=M.from(n[c].type.create(n[c].attrs,s));t.step(new Fe(e.start-(r?2:0),e.end,e.start,e.end,new R(s,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==i&&(o=c+1);let a=n.length-o,u=e.start+n.length-(r?2:0),l=e.parent;for(let c=e.startIndex,d=e.endIndex,h=!0;c<d;c++,h=!1)!h&&pn(t.doc,u,a)&&(t.split(u,a),u+=2*a),u+=l.child(c).nodeSize;return t}function Bk(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?$k(e,n,t,s):zk(e,n,s):!0:!1}}function $k(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Fe(s-1,o,s,o,new R(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new No(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=oi(r);if(a==null)return!1;i.lift(r,a);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Wn(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function zk(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,u=n.endIndex==i.childCount,l=s.node(-1),c=s.index(-1);if(!l.canReplace(c+(a?0:1),c+1,o.content.append(u?M.empty:M.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return r.step(new Fe(d-(a?1:0),h+(u?1:0),d+1,h-1,new R((a?M.empty:M.from(i.copy(M.empty))).append(u?M.empty:M.from(i.copy(M.empty))),a?0:1,u?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Hk(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,u=a.child(o-1);if(u.type!=t)return!1;if(n){let l=u.lastChild&&u.lastChild.type==a.type,c=M.from(l?t.create():null),d=new R(M.from(t.create(null,M.from(a.type.create(null,c)))),l?3:1,0),h=s.start,f=s.end;n(e.tr.step(new Fe(h-(l?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}function Fa(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...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=n.selection,i=n.doc,s=n.storedMarks,n}}}class Ia{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(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,u])=>[a,(...c)=>{const d=u(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],u=!!e,l=e||s.tr,c=()=>(!u&&n&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),a.every(h=>h===!0)),d={...Object.fromEntries(Object.entries(r).map(([h,f])=>[h,(...m)=>{const g=this.buildProps(l,n),b=f(...m)(g);return a.push(b),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([u,l])=>[u,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Fa({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,l])=>[u,(...c)=>l(...c)(a)]))}};return a}}class jk{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function B(t,e,n){return t.config[e]===void 0&&t.parent?B(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?B(t.parent,e,n):null}):t.config[e]}function Pa(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function n1(t){const e=[],{nodeExtensions:n,markExtensions:r}=Pa(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},u=B(o,"addGlobalAttributes",a);if(!u)return;u().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([h,f])=>{e.push({type:d,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},u=B(o,"addAttributes",a);if(!u)return;const l=u();Object.entries(l).forEach(([c,d])=>{const h={...s,...d};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:c,attribute:h})})}),e}function Pe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function ge(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],l=a.filter(c=>!u.includes(c));r[i]=[...u,...l].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;u.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());l.set(d,h)}),a.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());l.set(d,h)}),r[i]=Array.from(l.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=s}),r},{})}function sc(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>ge(n,r),{})}function r1(t){return typeof t=="function"}function U(t,e=void 0,...n){return r1(t)?e?t.bind(e)(...n):t(...n):t}function Vk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function qk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Qf(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):qk(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function ep(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Vk(n)?!1:n!=null))}function Wk(t,e){var n;const r=n1(t),{nodeExtensions:i,markExtensions:s}=Pa(t),o=(n=i.find(l=>B(l,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(l=>{const c=r.filter(b=>b.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=t.reduce((b,v)=>{const _=B(v,"extendNodeSchema",d);return{...b,..._?_(l):{}}},{}),f=ep({...h,content:U(B(l,"content",d)),marks:U(B(l,"marks",d)),group:U(B(l,"group",d)),inline:U(B(l,"inline",d)),atom:U(B(l,"atom",d)),selectable:U(B(l,"selectable",d)),draggable:U(B(l,"draggable",d)),code:U(B(l,"code",d)),whitespace:U(B(l,"whitespace",d)),linebreakReplacement:U(B(l,"linebreakReplacement",d)),defining:U(B(l,"defining",d)),isolating:U(B(l,"isolating",d)),attrs:Object.fromEntries(c.map(b=>{var v;return[b.name,{default:(v=b?.attribute)===null||v===void 0?void 0:v.default}]}))}),p=U(B(l,"parseHTML",d));p&&(f.parseDOM=p.map(b=>Qf(b,c)));const m=B(l,"renderHTML",d);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:sc(b,c)}));const g=B(l,"renderText",d);return g&&(f.toText=g),[l.name,f]})),u=Object.fromEntries(s.map(l=>{const c=r.filter(g=>g.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=t.reduce((g,b)=>{const v=B(b,"extendMarkSchema",d);return{...g,...v?v(l):{}}},{}),f=ep({...h,inclusive:U(B(l,"inclusive",d)),excludes:U(B(l,"excludes",d)),group:U(B(l,"group",d)),spanning:U(B(l,"spanning",d)),code:U(B(l,"code",d)),attrs:Object.fromEntries(c.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),p=U(B(l,"parseHTML",d));p&&(f.parseDOM=p.map(g=>Qf(g,c)));const m=B(l,"renderHTML",d);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:sc(g,c)})),[l.name,f]}));return new Jc({topNode:o,nodes:a,marks:u})}function Fu(t,e){return e.nodes[t]||e.marks[t]||null}function tp(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function bs(t,e){const n=xr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const Uk=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var u,l;const c=((l=(u=i.type.spec).toText)===null||l===void 0?void 0:l.call(u,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function md(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class La{constructor(e){this.find=e.find,this.handler=e.handler}}const Kk=(t,e)=>{if(md(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Fs(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:u}=n;if(u.composing)return!1;const l=u.state.doc.resolve(r);if(l.parent.type.spec.code||!((e=l.nodeBefore||l.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=Uk(l)+s;return o.forEach(h=>{if(c)return;const f=Kk(d,h.find);if(!f)return;const p=u.state.tr,m=Fa({state:u.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:b,chain:v,can:_}=new Ia({editor:n,state:m});h.handler({state:m,range:g,match:f,commands:b,chain:v,can:_})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),u.dispatch(p),c=!0)}),c}function Jk(t){const{editor:e,rules:n}=t,r=new we({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:c}=u;typeof c=="string"?c=c:c=bs(M.from(c),o.schema);const{from:d}=u,h=d+c.length;Fs({editor:e,from:d,to:h,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Fs({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Fs({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Fs({editor:e,from:o.pos,to:o.pos,text:`
|
|
12
|
-
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function
|
|
13
|
-
|
|
14
|
-
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(u,l,c,d)=>{var h;u.isBlock&&l>r&&(a+=s);const f=o?.[u.type.name];if(f)return c&&(a+=f({node:u,pos:l,parent:c,index:d,range:e})),!1;u.isText&&(a+=(h=u?.text)===null||h===void 0?void 0:h.slice(Math.max(r,l)-l,i-l))}),a}function o1(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const a1=Le.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new we({key:new Be("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),u=o1(n);return s1(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),n3=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),r3=(t=!1)=>({commands:e})=>e.setContent("",t),i3=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,u)=>{if(a.type.isText)return;const{doc:l,mapping:c}=e,d=l.resolve(c.map(u)),h=l.resolve(c.map(u+a.nodeSize)),f=d.blockRange(h);if(!f)return;const p=oi(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},s3=t=>e=>t(e),o3=()=>({state:t,dispatch:e})=>Xg(t,e),a3=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new H(r.doc.resolve(Math.max(o-1,0)))),!0},u3=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),u=i.after(s);t.delete(a,u).scrollIntoView()}return!0}return!1},l3=t=>({tr:e,state:n,dispatch:r})=>{const i=Pe(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const u=s.before(o),l=s.after(o);e.delete(u,l).scrollIntoView()}return!0}return!1},c3=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},d3=()=>({state:t,dispatch:e})=>cd(t,e),h3=()=>({commands:t})=>t.keyboardShortcut("Enter"),f3=()=>({state:t,dispatch:e})=>Mk(t,e);function Ho(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:md(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function u1(t,e,n={}){return t.find(r=>r.type===e&&Ho(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function np(t,e,n={}){return!!u1(t,e,n)}function gd(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!u1([...i.node.marks],e,n)))return;let o=i.index,a=t.start()+i.offset,u=o+1,l=a+i.node.nodeSize;for(;o>0&&np([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;u<t.parent.childCount&&np([...t.parent.child(u).marks],e,n);)l+=t.parent.child(u).nodeSize,u+=1;return{from:a,to:l}}function Kn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const p3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Kn(t,r.schema),{doc:o,selection:a}=n,{$from:u,from:l,to:c}=a;if(i){const d=gd(u,s,e);if(d&&d.from<=l&&d.to>=c){const h=H.create(o,d.from,d.to);n.setSelection(h)}}return!0},m3=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function l1(t){return t instanceof H}function sr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function c1(t,e=null){if(!e)return null;const n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?H.create(t,sr(0,i,s),sr(t.content.size,i,s)):H.create(t,sr(e,i,s),sr(e,i,s))}function rp(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function jo(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function g3(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const b3=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(jo()||rp())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),g3()&&!jo()&&!rp()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!l1(n.state.selection))return o(),!0;const a=c1(i.doc,t)||n.state.selection,u=n.state.selection.eq(a);return s&&(u||i.setSelection(a),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},v3=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),y3=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),d1=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&d1(r)}return t};function Ls(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return d1(n)}function rs(t,e,n){if(t instanceof $n||t instanceof M)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),rs("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const u=new Jc({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:l=>(o=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?fn.fromSchema(u).parseSlice(Ls(t),n.parseOptions):fn.fromSchema(u).parse(Ls(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=fn.fromSchema(e);return n.slice?s.parseSlice(Ls(t),n.parseOptions).content:s.parse(Ls(t),n.parseOptions)}return rs("",e,n)}function _3(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Se||i instanceof Fe))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,u,l,c)=>{o===0&&(o=c)}),t.setSelection(q.near(t.doc.resolve(o),n))}const x3=t=>!("type"in t),k3=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const u=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{rs(e,s.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(g){u(g)}try{a=rs(e,s.schema,{parseOptions:l,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(g){return u(g),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((x3(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),c===d&&f){const{parent:g}=r.doc.resolve(c);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(c-=1,d+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof M){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else m=a,r.replaceWith(c,d,m);n.updateSelection&&_3(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},w3=()=>({state:t,dispatch:e})=>Ck(t,e),C3=()=>({state:t,dispatch:e})=>Ek(t,e),E3=()=>({state:t,dispatch:e})=>Wg(t,e),S3=()=>({state:t,dispatch:e})=>Gg(t,e),M3=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Aa(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},A3=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Aa(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},T3=()=>({state:t,dispatch:e})=>kk(t,e),D3=()=>({state:t,dispatch:e})=>wk(t,e);function h1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function O3(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const u=e[a];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))jo()||h1()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const R3=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=O3(t).split(/-(?!$)/),o=s.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=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}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return u?.steps.forEach(l=>{const c=l.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function is(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Pe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const u=i-r,l=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Ho(d.node.attrs,n,{strict:!1}));return s?!!l.length:l.reduce((d,h)=>d+h.to-h.from,0)>=u}const N3=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return is(n,i,e)?Sk(n,r):!1},F3=()=>({state:t,dispatch:e})=>Qg(t,e),I3=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return Bk(r)(e,n)},P3=()=>({state:t,dispatch:e})=>Zg(t,e);function $a(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ip(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const L3=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=$a(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Kn(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(l,c)=>{s&&s===l.type&&n.setNodeMarkup(c,void 0,ip(l.attrs,e)),o&&l.marks.length&&l.marks.forEach(d=>{o===d.type&&n.addMark(c,c+l.nodeSize,o.create(ip(d.attrs,e)))})})}),!0):!1},B3=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),$3=()=>({tr:t,dispatch:e})=>{if(e){const n=new mt(t.doc);t.setSelection(n)}return!0},z3=()=>({state:t,dispatch:e})=>Kg(t,e),H3=()=>({state:t,dispatch:e})=>Yg(t,e),j3=()=>({state:t,dispatch:e})=>Dk(t,e),V3=()=>({state:t,dispatch:e})=>Nk(t,e),q3=()=>({state:t,dispatch:e})=>Rk(t,e);function oc(t,e,n={},r={}){return rs(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const W3=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var u,l;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const d=oc(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck})};function f1(t,e){const n=Kn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{o.push(...u.marks)});const a=o.find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function U3(t,e){const n=new Xc(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function K3(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function J3(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function p1(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function bd(t){return e=>p1(e.$from,t)}function G3(t,e){const n={from:0,to:t.content.size};return s1(t,n,e)}function Y3(t,e){const n=Pe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function m1(t,e){const n=$a(typeof e=="string"?e:e.name,t.schema);return n==="node"?Y3(t,e):n==="mark"?f1(t,e):{}}function Z3(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function X3(t){const e=Z3(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function Q3(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,u)=>{o.push({from:a,to:u})});else{const{from:a,to:u}=n[s];if(a===void 0||u===void 0)return;o.push({from:a,to:u})}o.forEach(({from:a,to:u})=>{const l=e.slice(s).map(a,-1),c=e.slice(s).map(u),d=e.invert().map(l,-1),h=e.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:l,to:c}})})}),X3(r)}function vd(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=gd(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function to(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function ac(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Kn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>Ho(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(f,g),v=Math.min(p,g+m.nodeSize),_=v-b;o+=_,a.push(...m.marks.map(x=>({mark:x,from:b,to:v})))})}),o===0)return!1;const u=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>Ho(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),l=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(u>0?u+l:u)>=o}function ew(t,e,n={}){if(!e)return is(t,null,n)||ac(t,null,n);const r=$a(e,t.schema);return r==="node"?is(t,e,n):r==="mark"?ac(t,e,n):!1}function sp(t,e){const{nodeExtensions:n}=Pa(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=U(B(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function yd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(yd(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function tw(t){return t instanceof z}function nw(t,e,n){var r;const{selection:i}=e;let s=null;if(l1(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(u=>u.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:u})=>{let l=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,u.pos,(c,d,h)=>{if(l)return!1;if(c.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));l=f&&p}return!l}),l})}const rw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,u=Kn(t,r.schema);if(i)if(o){const l=f1(r,u);n.addStoredMark(u.create({...l,...e}))}else a.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(c,d,(h,f)=>{const p=Math.max(f,c),m=Math.min(f+h.nodeSize,d);h.marks.find(b=>b.type===u)?h.marks.forEach(b=>{u===b.type&&n.addMark(p,m,u.create({...b.attrs,...e}))}):n.addMark(p,m,u.create(e))})});return nw(r,n,u)},iw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),sw=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Pe(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>Xf(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>Xf(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},ow=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=sr(t,0,r.content.size),s=z.create(r,i);e.setSelection(s)}return!0},aw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=H.atStart(r).from,a=H.atEnd(r).to,u=sr(i,o,a),l=sr(s,o,a),c=H.create(r,u,l);e.setSelection(c)}return!0},uw=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return Hk(r)(e,n)};function op(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const lw=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:u}=s,l=i.extensionManager.attributes,c=to(l,a.node().type.name,a.node().attrs);if(s instanceof z&&s.node.isBlock)return!a.parentOffset||!pn(o,a.pos)?!1:(r&&(t&&op(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=u.parentOffset===u.parent.content.size,h=a.depth===0?void 0:K3(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:c}]:void 0,p=pn(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&pn(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:c}]:void 0),r){if(p&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&op(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},cw=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=Pe(t,r.schema),{$from:u,$to:l}=r.selection,c=r.selection.node;if(c&&c.isBlock||u.depth<2||!u.sameParent(l))return!1;const d=u.node(-1);if(d.type!==a)return!1;const h=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let b=M.empty;const v=u.index(-1)?1:u.index(-2)?2:3;for(let k=u.depth-v;k>=u.depth-3;k-=1)b=M.from(u.node(k).copy(b));const _=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,x={...to(h,u.node().type.name,u.node().attrs),...e},y=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(x))||void 0;b=b.append(M.from(a.createAndFill(null,y)||void 0));const w=u.before(u.depth-(v-1));n.replace(w,u.after(-_),new R(b,4-v,0));let C=-1;n.doc.nodesBetween(w,n.doc.content.size,(k,S)=>{if(C>-1)return!1;k.isTextblock&&k.content.size===0&&(C=S+1)}),C>-1&&n.setSelection(H.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const f=l.pos===u.end()?d.contentMatchAt(0).defaultType:null,p={...to(h,d.type.name,d.attrs),...e},m={...to(h,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,l.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!pn(n.doc,u.pos,2))return!1;if(i){const{selection:b,storedMarks:v}=r,{splittableMarks:_}=s.extensionManager,x=v||b.$to.parentOffset&&b.$from.marks();if(n.split(u.pos,2,g).scrollIntoView(),!x||!i)return!0;const y=x.filter(w=>_.includes(w.type.name));n.ensureMarks(y)}return!0},Iu=(t,e)=>{const n=bd(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Wn(t.doc,n.pos)&&t.join(n.pos),!0},Pu=(t,e)=>{const n=bd(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Wn(t.doc,r)&&t.join(r),!0},dw=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:u,commands:l,can:c})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=Pe(t,o.schema),p=Pe(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:v}=m,_=b.blockRange(v),x=g||m.$to.parentOffset&&m.$from.marks();if(!_)return!1;const y=bd(w=>sp(w.type.name,d))(m);if(_.depth>=1&&y&&_.depth-y.depth<=1){if(y.node.type===f)return l.liftListItem(p);if(sp(y.node.type.name,d)&&f.validContent(y.node.content)&&a)return u().command(()=>(s.setNodeMarkup(y.pos,f),!0)).command(()=>Iu(s,f)).command(()=>Pu(s,f)).run()}return!n||!x||!a?u().command(()=>c().wrapInList(f,r)?!0:l.clearNodes()).wrapInList(f,r).command(()=>Iu(s,f)).command(()=>Pu(s,f)).run():u().command(()=>{const w=c().wrapInList(f,r),C=x.filter(k=>h.includes(k.type.name));return s.ensureMarks(C),w?!0:l.clearNodes()}).wrapInList(f,r).command(()=>Iu(s,f)).command(()=>Pu(s,f)).run()},hw=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Kn(t,r.schema);return ac(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},fw=(t,e,n={})=>({state:r,commands:i})=>{const s=Pe(t,r.schema),o=Pe(e,r.schema),a=is(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),a?i.setNode(o,u):i.setNode(s,{...u,...n})},pw=(t,e={})=>({state:n,commands:r})=>{const i=Pe(t,n.schema);return is(n,i,e)?r.lift(i):r.wrapIn(i,e)},mw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let u=a.steps.length-1;u>=0;u-=1)o.step(a.steps[u].invert(a.docs[u]));if(s.text){const u=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else o.delete(s.from,s.to)}return!0}}return!1},gw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},bw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,u=Kn(t,r.schema),{$from:l,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:h,to:f}=a;const p=(s=l.marks().find(g=>g.type===u))===null||s===void 0?void 0:s.attrs,m=gd(l,u,p);m&&(h=m.from,f=m.to),n.removeMark(h,f,u)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,u)});return n.removeStoredMark(u),!0},vw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=$a(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Kn(t,r.schema)),i&&n.selection.ranges.forEach(u=>{const l=u.$from.pos,c=u.$to.pos;let d,h,f,p;n.selection.empty?r.doc.nodesBetween(l,c,(m,g)=>{s&&s===m.type&&(f=Math.max(g,l),p=Math.min(g+m.nodeSize,c),d=g,h=m)}):r.doc.nodesBetween(l,c,(m,g)=>{g<l&&s&&s===m.type&&(f=Math.max(g,l),p=Math.min(g+m.nodeSize,c),d=g,h=m),g>=l&&g<=c&&(s&&s===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type){const v=Math.max(g,l),_=Math.min(g+m.nodeSize,c);n.addMark(v,_,o.create({...b.attrs,...e}))}}))}),h&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&n.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},yw=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return Fk(i,e)(n,r)},_w=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return Ik(i,e)(n,r)};var xw=Object.freeze({__proto__:null,blur:n3,clearContent:r3,clearNodes:i3,command:s3,createParagraphNear:o3,cut:a3,deleteCurrentNode:u3,deleteNode:l3,deleteRange:c3,deleteSelection:d3,enter:h3,exitCode:f3,extendMarkRange:p3,first:m3,focus:b3,forEach:v3,insertContent:y3,insertContentAt:k3,joinBackward:E3,joinDown:C3,joinForward:S3,joinItemBackward:M3,joinItemForward:A3,joinTextblockBackward:T3,joinTextblockForward:D3,joinUp:w3,keyboardShortcut:R3,lift:N3,liftEmptyBlock:F3,liftListItem:I3,newlineInCode:P3,resetAttributes:L3,scrollIntoView:B3,selectAll:$3,selectNodeBackward:z3,selectNodeForward:H3,selectParentNode:j3,selectTextblockEnd:V3,selectTextblockStart:q3,setContent:W3,setMark:rw,setMeta:iw,setNode:sw,setNodeSelection:ow,setTextSelection:aw,sinkListItem:uw,splitBlock:lw,splitListItem:cw,toggleList:dw,toggleMark:hw,toggleNode:fw,toggleWrap:pw,undoInputRule:mw,unsetAllMarks:gw,unsetMark:bw,updateAttributes:vw,wrapIn:yw,wrapInList:_w});const g1=Le.create({name:"commands",addCommands(){return{...xw}}}),b1=Le.create({name:"drop",addProseMirrorPlugins(){return[new we({key:new Be("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),v1=Le.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new Be("editable"),props:{editable:()=>this.editor.options.editable}})]}}),y1=new Be("focusEvents"),_1=Le.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new we({key:y1,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),x1=Le.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:u,doc:l}=a,{empty:c,$anchor:d}=u,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?g===d.pos:q.atStart(l).from===h;return!c||!f.type.isTextblock||f.textContent.length||!b||b&&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:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"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 jo()||h1()?s:i},addProseMirrorPlugins(){return[new we({key:new Be("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,u=q.atStart(e.doc).from,l=q.atEnd(e.doc).to;if(s||!(o===u&&a===l)||!yd(n.doc))return;const h=n.tr,f=Fa({state:n,transaction:h}),{commands:p}=new Ia({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),k1=Le.create({name:"paste",addProseMirrorPlugins(){return[new we({key:new Be("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),w1=Le.create({name:"tabindex",addProseMirrorPlugins(){return[new we({key:new Be("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var kw=Object.freeze({__proto__:null,ClipboardTextSerializer:a1,Commands:g1,Drop:b1,Editable:v1,FocusEvents:_1,Keymap:x1,Paste:k1,Tabindex:w1,focusEventsPluginKey:y1});class nr{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,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 n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new nr(n,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 nr(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 nr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const u=new nr(a,this.editor,i,i?n:null);i&&(u.actualDepth=this.depth+1),e.push(new nr(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const u=o[a];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(u=>n[u]===o.node.attrs[u])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const ww=`.ProseMirror {
|
|
1
|
+
import{b as Z,c as De,d as J,e as Nc,f as h0,R as oe,g as zt,h as f0,i as p0,j as jb,k as Fc,l as m0}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react__loadShare__.mjs.js";import{c as A,d as Me,g as Vb,e as Gd}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs.js";import{a as Yd,b as qb,c as Wb,d as Ub,e as Kb,f as g0}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare___mf_0_rimori_mf_1_client__loadShare__.mjs.js";import{R as Jb}from"./__mfe_internal__rimori_mf_2_scenario_mf_2_host__loadShare__react_mf_2_dom__loadShare__.mjs.js";function Gb(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in t)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var E=typeof window<"u"?window:void 0,Te=typeof globalThis<"u"?globalThis:E;typeof self>"u"&&(Te.self=Te),typeof File>"u"&&(Te.File=function(){});var ft=Te?.navigator,N=Te?.document,ze=Te?.location,ol=Te?.fetch,al=Te!=null&&Te.XMLHttpRequest&&"withCredentials"in new Te.XMLHttpRequest?Te.XMLHttpRequest:void 0,Zd=Te?.AbortController,Yb=Te?.CompressionStream,st=ft?.userAgent,$=E??{},Xd="1.372.1",et={DEBUG:!1,LIB_VERSION:Xd,LIB_NAME:"web",JS_SDK_VERSION:Xd};function Qd(t,e,n,r,i,s,o){try{var a=t[s](o),u=a.value}catch(l){return void n(l)}a.done?e(u):Promise.resolve(u).then(r,i)}function kt(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function o(u){Qd(s,r,i,o,a,"next",u)}function a(u){Qd(s,r,i,o,a,"throw",u)}o(void 0)})}}function O(){return O=Object.assign?Object.assign.bind():function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},O.apply(null,arguments)}function b0(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function ul(){return ul=kt(function*(t,e,n){e===void 0&&(e=!0);try{var r=new CompressionStream("gzip"),i=r.writable.getWriter(),s=i.write(new TextEncoder().encode(t)).then(()=>i.close()).catch(function(){var u=kt(function*(l){try{yield i.abort(l)}catch{}throw l});return function(l){return u.apply(this,arguments)}}()),o=new Response(r.readable).blob(),[a]=yield Promise.all([o,s]);return a}catch(u){if(n!=null&&n.rethrow)throw u;return e&&console.error("Failed to gzip compress data",u),null}}),ul.apply(this,arguments)}var Zb=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],eh=function(t,e){if(e===void 0&&(e=[]),!t)return!1;var n=t.toLowerCase();return Zb.concat(e).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},Xb=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function G(t,e){return t.indexOf(e)!==-1}var wa=function(t){return t.trim()},ll=function(t){return t.replace(/^\$/,"")},v0=Object.prototype,y0=v0.hasOwnProperty,Ca=v0.toString,Q=Array.isArray||function(t){return Ca.call(t)==="[object Array]"},cn=t=>typeof t=="function",ke=t=>t===Object(t)&&!Q(t),$r=t=>{if(ke(t)){for(var e in t)if(y0.call(t,e))return!1;return!0}return!1},P=t=>t===void 0,me=t=>Ca.call(t)=="[object String]",Gs=t=>me(t)&&t.trim().length===0,vn=t=>t===null,Y=t=>P(t)||vn(t),Tt=t=>Ca.call(t)=="[object Number]"&&t==t,Rr=t=>Tt(t)&&t>0,jt=t=>Ca.call(t)==="[object Boolean]",Qb=t=>t instanceof FormData,ev=t=>G(Xb,t);function _0(t){return t===null||typeof t!="object"}function uo(t,e){return{}.toString.call(t)==="[object "+e+"]"}function Ic(t){return typeof Event<"u"&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var tv=[!0,"true",1,"1","yes"],Za=t=>G(tv,t),nv=[!1,"false",0,"0","no"];function Vt(t,e,n,r,i){return e>n&&(r.warn("min cannot be greater than max."),e=n),Tt(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):e>t?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),Vt(i||n,e,n,r))}class rv{constructor(e){this.$t={},this.zt=e.zt,this.Ut=Vt(e.bucketSize,0,100,e.Yt),this.Wt=Vt(e.refillRate,0,this.Ut,e.Yt),this.Gt=Vt(e.refillInterval,0,864e5,e.Yt)}Xt(e,n){var r=Math.floor((n-e.lastAccess)/this.Gt);r>0&&(e.tokens=Math.min(e.tokens+r*this.Wt,this.Ut),e.lastAccess=e.lastAccess+r*this.Gt)}consumeRateLimit(e){var n,r=Date.now(),i=String(e),s=this.$t[i];return s?this.Xt(s,r):this.$t[i]=s={tokens:this.Ut,lastAccess:r},s.tokens===0||(s.tokens--,s.tokens===0&&((n=this.zt)==null||n.call(this,e)),s.tokens===0)}stop(){this.$t={}}}var Cs,th,Xa,pt="Mobile",lo="iOS",hn="Android",Gr="Tablet",x0=hn+" "+Gr,k0="iPad",w0="Apple",C0=w0+" Watch",Oi="Safari",Yr="BlackBerry",E0="Samsung",S0=E0+"Browser",M0=E0+" Internet",ur="Chrome",iv=ur+" OS",A0=ur+" "+lo,Pc="Internet Explorer",T0=Pc+" "+pt,Lc="Opera",sv=Lc+" Mini",Bc="Edge",D0="Microsoft "+Bc,qr="Firefox",O0=qr+" "+lo,Ui="Nintendo",Ki="PlayStation",Wr="Xbox",R0=hn+" "+pt,N0=pt+" "+Oi,_i="Windows",cl=_i+" Phone",nh="Nokia",dl="Ouya",F0="Generic",ov=F0+" "+pt.toLowerCase(),I0=F0+" "+Gr.toLowerCase(),hl="Konqueror",Qe="(\\d+(\\.\\d+)?)",Qa=new RegExp("Version/"+Qe),av=new RegExp(Wr,"i"),uv=new RegExp(Ki+" \\w+","i"),lv=new RegExp(Ui+" \\w+","i"),$c=new RegExp(Yr+"|PlayBook|BB10","i"),cv={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},P0=function(t,e){return e=e||"",G(t," OPR/")&&G(t,"Mini")?sv:G(t," OPR/")?Lc:$c.test(t)?Yr:G(t,"IE"+pt)||G(t,"WPDesktop")?T0:G(t,S0)?M0:G(t,Bc)||G(t,"Edg/")?D0:G(t,"FBIOS")?"Facebook "+pt:G(t,"UCWEB")||G(t,"UCBrowser")?"UC Browser":G(t,"CriOS")?A0:G(t,"CrMo")||G(t,ur)?ur:G(t,hn)&&G(t,Oi)?R0:G(t,"FxiOS")?O0:G(t.toLowerCase(),hl.toLowerCase())?hl:((n,r)=>r&&G(r,w0)||function(i){return G(i,Oi)&&!G(i,ur)&&!G(i,hn)}(n))(t,e)?G(t,pt)?N0:Oi:G(t,qr)?qr:G(t,"MSIE")||G(t,"Trident/")?Pc:G(t,"Gecko")?qr:""},dv={[T0]:[new RegExp("rv:"+Qe)],[D0]:[new RegExp(Bc+"?\\/"+Qe)],[ur]:[new RegExp("("+ur+"|CrMo)\\/"+Qe)],[A0]:[new RegExp("CriOS\\/"+Qe)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Qe)],[Oi]:[Qa],[N0]:[Qa],[Lc]:[new RegExp("(Opera|OPR)\\/"+Qe)],[qr]:[new RegExp(qr+"\\/"+Qe)],[O0]:[new RegExp("FxiOS\\/"+Qe)],[hl]:[new RegExp("Konqueror[:/]?"+Qe,"i")],[Yr]:[new RegExp(Yr+" "+Qe),Qa],[R0]:[new RegExp("android\\s"+Qe,"i")],[M0]:[new RegExp(S0+"\\/"+Qe)],[Pc]:[new RegExp("(rv:|MSIE )"+Qe)],Mozilla:[new RegExp("rv:"+Qe)]},hv=function(t,e){var n=P0(t,e),r=dv[n];if(P(r))return null;for(var i=0;r.length>i;i++){var s=t.match(r[i]);if(s)return parseFloat(s[s.length-2])}return null},rh=[[new RegExp(Wr+"; "+Wr+" (.*?)[);]","i"),t=>[Wr,t&&t[1]||""]],[new RegExp(Ui,"i"),[Ui,""]],[new RegExp(Ki,"i"),[Ki,""]],[$c,[Yr,""]],[new RegExp(_i,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[cl,""];if(new RegExp(pt).test(e)&&!/IEMobile\b/.test(e))return[_i+" "+pt,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=cv[n[1]]||"";return/arm/i.test(e)&&(r="RT"),[_i,r]}return[_i,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>t&&t[3]?[lo,[t[3],t[4],t[5]||"0"].join(".")]:[lo,""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=P(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+hn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+hn+")","i"),t=>t&&t[2]?[hn,[t[2],t[3],t[4]||"0"].join(".")]:[hn,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];return t&&t[1]&&(e[1]=[t[1],t[2],t[3]||"0"].join(".")),e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[iv,""]],[/Linux|debian/i,["Linux",""]]],ih=function(t){return lv.test(t)?Ui:uv.test(t)?Ki:av.test(t)?Wr:new RegExp(dl,"i").test(t)?dl:new RegExp("("+cl+"|WPDesktop)","i").test(t)?cl:/iPad/.test(t)?k0:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?C0:$c.test(t)?Yr:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(nh,"i").test(t)?nh:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?new RegExp(pt).test(t)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)||/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?hn:x0:new RegExp("(pda|"+pt+")","i").test(t)?ov:new RegExp(Gr,"i").test(t)&&!new RegExp(Gr+" pc","i").test(t)?I0:""},fv=t=>t instanceof Error,L0={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},pv=L0.info;function B0(t){if(jt(t))return{boolValue:t};if(typeof t=="number")return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if(typeof t=="string")return{stringValue:t};if(Q(t))return{arrayValue:{values:t.map(e=>B0(e))}};try{return{stringValue:JSON.stringify(t)}}catch{return{stringValue:String(t)}}}function sh(t){var e=[];for(var n in t){var r=t[n];vn(r)||P(r)||e.push({key:n,value:B0(r)})}return e}function mv(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Xa&&n.length===th||(th=n.length,Xa=n.reduce((r,i)=>{Cs||(Cs={});var s=Cs[i];if(s)r[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var u=o[a],l=u?.filename,c=e[i];if(l&&c){r[l]=c,Cs[i]=[l,c];break}}return r},{})),Xa}}class gv{constructor(e,n,r){r===void 0&&(r=[]),this.coercers=e,this.stackParser=n,this.modifiers=r}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,n,0).apply(e),s=this.buildParsingContext(n),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return kt(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Q(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?n.skipFirstLines:0),n.chunkIdMap)),O({},e,{cause:r,stack:i})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return kt(function*(){var r=e;for(var i of n.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,n){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(i=n.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,O({},n,{handled:!0}))),a}buildParsingContext(e){var n;return{chunkIdMap:mv(this.stackParser),skipFirstLines:(n=e.skipFirstLines)!==null&&n!==void 0?n:1}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var i=(s,o)=>{if(4>=o){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(s,a)}};return O({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}}var Zr="?";function fl(t,e,n,r,i){var s={platform:t,filename:e,function:n==="<anonymous>"?Zr:n,in_app:!0};return P(r)||(s.lineno=r),P(i)||(s.colno=i),s}var $0=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Zr,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},bv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,vv=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,yv=/\((\S*)(?::(\d+))(?::(\d+))\)/,_v=(t,e)=>{var n=bv.exec(t);if(n){var[,r,i,s]=n;return fl(e,r,Zr,+i,+s)}var o=vv.exec(t);if(o){if(o[2]&&o[2].indexOf("eval")===0){var a=yv.exec(o[2]);a&&(o[2]=a[1],o[3]=a[2],o[4]=a[3])}var[u,l]=$0(o[1]||Zr,o[2]);return fl(e,l,u,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}},xv=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kv=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,wv=(t,e)=>{var n=xv.exec(t);if(n){if(n[3]&&n[3].indexOf(" > eval")>-1){var r=kv.exec(n[3]);r&&(n[1]=n[1]||"eval",n[3]=r[1],n[4]=r[2],n[5]="")}var i=n[3],s=n[1]||Zr;return[s,i]=$0(s,i),fl(e,i,s,n[4]?+n[4]:void 0,n[5]?+n[5]:void 0)}},oh=/\(error: (.*)\)/;class Cv{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=me(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return uo(e,"DOMException")}isDOMError(e){return uo(e,"DOMError")}}class Ev{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class Sv{constructor(){}match(e){return uo(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r;return n.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var Mv=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class Av{match(e){return typeof e=="string"}coerce(e,n){var r,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,i=e.match(Mv);return i&&(n=i[1],r=i[2]),[n,r]}}var Tv=["fatal","error","warning","log","info","debug"];function z0(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(e>=i.length)return r===n.length?i:i.length>e?i.slice(0,e)+"...":i}return""}class Dv{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,i=this.getErrorPropertyFromObject(e);return i?n.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Ic(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+z0(e)}isSeverityLevel(e){return me(e)&&!Gs(e)&&Tv.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if({}.hasOwnProperty.call(e,n)){var r=e[n];if(fv(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class Ov{match(e){return Ic(e)}coerce(e,n){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+z0(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Rv{match(e){return _0(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class Nv{match(e){return uo(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!Ic(e))return!1;try{var n=e.detail;return n!=null&&typeof n=="object"&&"reason"in n}catch{return!1}}coerce(e,n){var r,i=this.getUnhandledRejectionReason(e);return _0(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var co="$message",ho="$timestamp",Fv=new Set([co,ho]),eu={enabled:!0,max_bytes:32768};function fo(t){var e;return t?{enabled:(e=t.enabled)!==null&&e!==void 0?e:eu.enabled,max_bytes:Pv(t.max_bytes,eu.max_bytes)}:O({},eu)}class Iv{constructor(e){this.Jt=[],this.Kt=0,this.Lt=fo(e)}setConfig(e){this.Lt=fo(e),this.Qt()}add(e){var n=function(i){var s=function(c){var d=new WeakSet;try{return JSON.stringify(c,(h,f)=>{if(typeof f=="bigint")return f.toString();if(typeof f!="function"&&typeof f!="symbol"){if(f instanceof Date)return f.toISOString();if(f instanceof Error)return{name:f.name,message:f.message,stack:f.stack};if(f&&typeof f=="object"){if(d.has(f))return"[Circular]";d.add(f)}return f}})}catch{return}}(i);if(s)try{var o=JSON.parse(s);if(!ke(o))return;var a=o,u=a[co],l=a[ho];return!me(u)||u.trim().length===0||!me(l)&&!Tt(l)?void 0:{step:a,json:s}}catch{return}}(e);if(n){var r=function(i){if(typeof TextEncoder<"u")return new TextEncoder().encode(i).length;for(var s=encodeURIComponent(i),o=0,a=0;s.length>a;a++)s[a]==="%"?(o+=1,a+=2):o+=1;return o}(n.json);r>this.Lt.max_bytes||(this.Jt.push({step:n.step,bytes:r}),this.Kt+=r,this.Qt())}}getAttachable(){return this.Jt.map(e=>e.step)}clear(){this.Jt=[],this.Kt=0}size(){return this.Jt.length}Qt(){for(;this.Kt>this.Lt.max_bytes&&this.Jt.length>0;){var e=this.Jt.shift();e&&(this.Kt-=e.bytes)}}}function Pv(t,e){if(!Tt(t)||t===1/0||t===-1/0)return e;var n=Math.floor(t);return 0>n?e:n}var H0=function(t,e){var{debugEnabled:n}=e===void 0?{}:e,r={C(i){if(E&&(et.DEBUG||$.POSTHOG_DEBUG||n)&&!P(E.console)&&E.console){for(var s=("__rrweb_original__"in E.console[i])?E.console[i].__rrweb_original__:E.console[i],o=arguments.length,a=new Array(o>1?o-1:0),u=1;o>u;u++)a[u-1]=arguments[u];s(t,...a)}},info(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("log",...s)},warn(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("warn",...s)},error(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];r.C("error",...s)},critical(){for(var i=arguments.length,s=new Array(i),o=0;i>o;o++)s[o]=arguments[o];console.error(t,...s)},uninitializedWarning(i){r.error("You must initialize PostHog before calling "+i)},createLogger:(i,s)=>H0(t+" "+i,s)};return r},I=H0("[PostHog.js]"),fe=I.createLogger,Lv=fe("[ExternalScriptsLoader]"),tu=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return Lv.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=N?.querySelectorAll("script");if(r){for(var i,s=function(){if(r[o].src===e){var u=r[o];return u.__posthog_loading_callback_fired?{v:n()}:(u.addEventListener("load",l=>{u.__posthog_loading_callback_fired=!0,n(void 0,l)}),u.onerror=l=>n(l),{v:void 0})}},o=0;r.length>o;o++)if(i=s())return i.v}var a=()=>{if(!N)return n("document not found");var u=N.createElement("script");if(u.type="text/javascript",u.crossOrigin="anonymous",u.src=e,u.onload=d=>{u.__posthog_loading_callback_fired=!0,n(void 0,d)},u.onerror=d=>n(d),t.config.prepare_external_dependency_script&&(u=t.config.prepare_external_dependency_script(u)),!u)return n("prepare_external_dependency_script returned null");if(t.config.external_scripts_inject_target==="head")N.head.appendChild(u);else{var l,c=N.querySelectorAll("body > script");c.length>0?(l=c[0].parentNode)==null||l.insertBefore(u,c[0]):N.body.appendChild(u)}};N!=null&&N.body?a():N?.addEventListener("DOMContentLoaded",a)};$.__PosthogExtensions__=$.__PosthogExtensions__||{},$.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{if(e!=="remote-config"){var r;if(t.config.__preview_external_dependency_versioned_paths)r=t.requestRouter.endpointFor("assets","/static/"+t.version+"/"+e+".js");else{var i="/static/"+e+".js?v="+t.version;if(e==="toolbar"){var s=3e5;i=i+"&t="+Math.floor(Date.now()/s)*s}r=t.requestRouter.endpointFor("assets",i)}tu(t,r,n)}else{var o=t.requestRouter.endpointFor("assets","/array/"+t.config.token+"/config.js");tu(t,o,n)}},$.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);tu(t,r,n)};var j0="$people_distinct_id",po="$device_id",xi="__alias",ki="__timers",pl="$autocapture_disabled_server_side",ml="$heatmaps_enabled_server_side",gl="$exception_capture_enabled_server_side",bl="$error_tracking_suppression_rules",vl="$error_tracking_capture_extension_exceptions",yl="$web_vitals_enabled_server_side",zc="$dead_clicks_enabled_server_side",_l="$product_tours_enabled_server_side",xl="$web_vitals_allowed_metrics",wi="$session_recording_remote_config",V0="$replay_override_sampling",q0="$replay_override_linked_flag",W0="$replay_override_url_trigger",U0="$replay_override_event_trigger",mo="$sesid",Hc="$session_is_sampled",zr="$enabled_feature_flags",Ys="$active_feature_flags",Ci="$early_access_features",kl="$feature_flag_details",wl="$feature_flag_payloads",Cl="$feature_flag_request_id",on="$override_feature_flags",Nr="$override_feature_flag_payloads",Ei="$stored_person_properties",er="$stored_group_properties",El="$surveys",Sl="$surveys_activated",Zs="ph_product_tours",Ri="$flag_call_reported",Ml="$flag_call_reported_session_id",Al="$feature_flag_errors",go="$feature_flag_evaluated_at",Rt="$user_state",Tl="$client_session_props",Dl="$capture_rate_limit",Ol="$initial_campaign_params",Rl="$initial_referrer_info",bo="$initial_person_info",vo="$epp",K0="__POSTHOG_TOOLBAR__",Es="$posthog_cookieless",J0="$sdk_debug_extensions_init_method",G0="$sdk_debug_extensions_init_time_ms",Y0="$sdk_debug_recording_script_not_loaded",jc="PostHog loadExternalDependency extension not found.",tr="on_reject",dn="always",Cr="anonymous",Er="identified",Nl="identified_only",yo="visibilitychange",_o="beforeunload",Fr="$pageview",nu="$pageleave",ru="$identify",ah="$groupidentify";function Ss(t,e){Q(t)&&t.forEach(e)}function ce(t,e){if(!Y(t))if(Q(t))t.forEach(e);else if(Qb(t))t.forEach((r,i)=>e(r,i));else for(var n in t)y0.call(t,n)&&e(t[n],n)}var ve=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;e>r;r++)n[r-1]=arguments[r];for(var i of n)for(var s in i)i[s]!==void 0&&(t[s]=i[s]);return t};function Xs(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var uh=function(t){try{return t()}catch{return}},Bv=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;e>r;r++)n[r]=arguments[r];return t.apply(this,n)}catch(i){I.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),I.critical(i)}}},Vc=function(t){var e={};return ce(t,function(n,r){(me(n)&&n.length>0||Tt(n))&&(e[r]=n)}),e},$v=["herokuapp.com","vercel.app","netlify.app"];function zv(t){var e=t?.hostname;if(!me(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of $v)if(n===r)return!1;return!0}function Ee(t,e,n,r){var{capture:i=!1,passive:s=!0}=r??{};t?.addEventListener(e,n,{capture:i,passive:s})}function Z0(t){return t.name==="ph_toolbar_internal"}Math.trunc||(Math.trunc=function(t){return 0>t?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return Tt(t)&&isFinite(t)&&Math.floor(t)===t});class xo{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||0>e||0>n||0>r||0>i||e>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new xo(s)}toString(){for(var e="",n=0;this.bytes.length>n;n++)e=e+(this.bytes[n]>>>4).toString(16)+(15&this.bytes[n]).toString(16),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new xo(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;16>n;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}let Hv=class{constructor(){this.I=0,this.S=0,this.k=new jv}generate(){var e=this.generateOrAbort();if(P(e)){this.I=0;var n=this.generateOrAbort();if(P(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.I)this.I=e,this.A();else{if(this.I>=e+1e4)return;this.S++,this.S>4398046511103&&(this.I++,this.A())}return xo.fromFieldsV7(this.I,Math.trunc(this.S/Math.pow(2,30)),this.S&Math.pow(2,30)-1,this.k.nextUint32())}A(){this.S=1024*this.k.nextUint32()+(1023&this.k.nextUint32())}};var lh,X0=t=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;t.length>e;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};E&&!P(E.crypto)&&crypto.getRandomValues&&(X0=t=>crypto.getRandomValues(t));class jv{constructor(){this.T=new Uint32Array(8),this.N=1/0}nextUint32(){return this.T.length>this.N||(X0(this.T),this.N=0),this.T[this.N++]}}var Dn=()=>Vv().toString(),Vv=()=>(lh||(lh=new Hv)).generate(),li="",qv=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Ht={R:()=>!!N,B(t){I.error("cookieStore error: "+t)},O(t){if(N){try{for(var e=t+"=",n=N.cookie.split(";").filter(s=>s.length),r=0;n.length>r;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},Z(t){var e;try{e=JSON.parse(Ht.O(t))||{}}catch{}return e},M(t,e,n,r,i){if(N)try{var s="",o="",a=function(c,d){if(d){var h=function(p,m){if(m===void 0&&(m=N),li)return li;if(!m||["localhost","127.0.0.1"].includes(p))return"";for(var g=p.split("."),b=Math.min(g.length,8),v="dmn_chk_"+Dn();!li&&b--;){var _=g.slice(b).join("."),x=v+"=1;domain=."+_+";path=/";m.cookie=x+";max-age=3",m.cookie.includes(v)&&(m.cookie=x+";max-age=0",li=_)}return li}(c);if(!h){var f=(p=>{var m=p.match(qv);return m?m[0]:""})(c);f!==h&&I.info("Warning: cookie subdomain discovery mismatch",f,h),h=f}return h?"; domain=."+h:""}return""}(N.location.hostname,r);if(n){var u=new Date;u.setTime(u.getTime()+864e5*n),s="; expires="+u.toUTCString()}i&&(o="; secure");var l=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return l.length>3686.4&&I.warn("cookieStore warning: large cookie, len="+l.length),N.cookie=l,l}catch{return}},F(t,e){if(N!=null&&N.cookie)try{Ht.M(t,"",-1,e)}catch{return}}},iu=null,pe={R(){if(!vn(iu))return iu;var t=!0;if(P(E))t=!1;else try{var e="__mplssupport__";pe.M(e,"xyz"),pe.O(e)!=='"xyz"'&&(t=!1),pe.F(e)}catch{t=!1}return t||I.error("localStorage unsupported; falling back to cookie store"),iu=t,t},B(t){I.error("localStorage error: "+t)},O(t){try{return E?.localStorage.getItem(t)}catch(e){pe.B(e)}return null},Z(t){try{return JSON.parse(pe.O(t))||{}}catch{}return null},M(t,e){try{E?.localStorage.setItem(t,JSON.stringify(e))}catch(n){pe.B(n)}},F(t){try{E?.localStorage.removeItem(t)}catch(e){pe.B(e)}}},Wv=[po,"distinct_id",mo,Hc,vo,bo,Rt],Ms={},Uv={R:()=>!0,B(t){I.error("memoryStorage error: "+t)},O:t=>Ms[t]||null,Z:t=>Ms[t]||null,M(t,e){Ms[t]=e},F(t){delete Ms[t]}},Yn=null,He={R(){if(!vn(Yn))return Yn;if(Yn=!0,P(E))Yn=!1;else try{var t="__support__";He.M(t,"xyz"),He.O(t)!=='"xyz"'&&(Yn=!1),He.F(t)}catch{Yn=!1}return Yn},B(t){I.error("sessionStorage error: ",t)},O(t){try{return E?.sessionStorage.getItem(t)}catch(e){He.B(e)}return null},Z(t){try{return JSON.parse(He.O(t))||null}catch{}return null},M(t,e){try{E?.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){He.B(n)}},F(t){try{E?.sessionStorage.removeItem(t)}catch(e){He.B(e)}}};class Kv{constructor(e){this._instance=e}get Lt(){return this._instance.config}get consent(){return this.tr()?0:this.rr}isOptedOut(){return this.Lt.cookieless_mode===dn||this.isRejected()||this.consent===-1&&this.Lt.cookieless_mode===tr}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Lt.opt_out_capturing_by_default}optInOut(e){this.ir.M(this.nr,e?1:0,this.Lt.cookie_expiration,this.Lt.cross_subdomain_cookie,this.Lt.secure_cookie)}reset(){this.ir.F(this.nr,this.Lt.cross_subdomain_cookie)}get nr(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get rr(){var e=this.ir.O(this.nr);return Za(e)?1:G(nv,e)?0:-1}get ir(){var e=this.Lt.opt_out_capturing_persistence_type,n=e==="localStorage"?pe:Ht;if(!this.sr||this.sr!==n){this.sr=n;var r=e==="localStorage"?Ht:pe;r.O(this.nr)&&(this.sr.O(this.nr)||this.optInOut(Za(r.O(this.nr))),r.F(this.nr,this.Lt.cross_subdomain_cookie))}return this.sr}tr(){return!!this.Lt.respect_dnt&&[ft?.doNotTrack,ft?.msDoNotTrack,$.doNotTrack].some(e=>Za(e))}}var As=fe("[Dead Clicks]"),Jv=()=>!0,Gv=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property(zc)),r=t.instance.config.capture_dead_clicks;return jt(r)?r:!!ke(r)||n};class ch{get lazyLoadedDeadClicksAutocapture(){return this.ar}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[zc]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.lr(()=>{this.ur()}):this.stop()}lr(e){var n,r;(n=$.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?As.error("failed to load script",i):e()})}ur(){var e;if(N){if(!this.ar&&(e=$.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=ke(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.ar=$.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.ar.start(N),As.info("starting...")}}else As.error("`document` not found. Cannot start.")}stop(){this.ar&&(this.ar.stop(),this.ar=void 0,As.info("stopping..."))}}var su=fe("[SegmentIntegration]"),Q0="posthog-js";function em(t,e){var{organization:n,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var u,l,c,d,h;if(s!=="*"&&!s.includes(a.level)||!t.__loaded)return a;a.tags||(a.tags={});var f=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=f,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p,m=((u=a.exception)==null?void 0:u.values)||[],g=m.map(v=>O({},v,{stacktrace:v.stacktrace?O({},v.stacktrace,{type:"raw",frames:(v.stacktrace.frames||[]).map(_=>O({},_,{platform:"web:javascript"}))}):void 0})),b={$exception_message:((l=m[0])==null?void 0:l.value)||a.message,$exception_type:(c=m[0])==null?void 0:c.type,$exception_level:a.level,$exception_list:g,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((d=m[0])==null?void 0:d.value)||a.message,$sentry_exception_type:(h=m[0])==null?void 0:h.type,$sentry_tags:a.tags};return n&&r&&(b.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&((p=t.exceptions)==null||p.sendExceptionEvent(b)),a}}class Yv{constructor(e,n,r,i,s,o){this.name=Q0,this.setupOnce=function(a){a(em(e,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}class dh{constructor(e){this.hr=(n,r,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength)&&(I.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:n,changeReason:i}),this.cr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.dr()}dr(){var e;this.vr=(e=this._instance.sessionManager)==null?void 0:e.onSessionId(this.hr)}destroy(){var e;(e=this.vr)==null||e.call(this),this.vr=void 0}doPageView(e,n){var r,i=this.pr(e,n);return this.cr={pathname:(r=E?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.pr(e,(n=this.cr)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.cr)==null?void 0:e.pageViewId}}pr(e,n){var r=this.cr;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:u,maxContentHeight:l,lastContentY:c,maxContentY:d}=s;if(!(P(o)||P(a)||P(u)||P(l)||P(c)||P(d))){o=Math.ceil(o),a=Math.ceil(a),u=Math.ceil(u),l=Math.ceil(l),c=Math.ceil(c),d=Math.ceil(d);var h=o>1?Vt(a/o,0,1,I):1,f=o>1?Vt(u/o,0,1,I):1,p=l>1?Vt(c/l,0,1,I):1,m=l>1?Vt(d/l,0,1,I):1;i=ve(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:u,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:m})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var Zv={[j0]:{exposure:"hidden"},[xi]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[ki]:{exposure:"hidden"},[pl]:{exposure:"event"},[ml]:{exposure:"hidden"},[gl]:{exposure:"event"},[bl]:{exposure:"hidden"},[vl]:{exposure:"event"},[yl]:{exposure:"event"},[zc]:{exposure:"event"},[_l]:{exposure:"hidden"},[xl]:{exposure:"event"},[wi]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[mo]:{exposure:"hidden"},[Hc]:{exposure:"event"},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},[zr]:{exposure:"derived",shouldSkipFromEventProperties:(t,e)=>e(),transformToEventProperties(t){if(!ke(t))return{};for(var e={},n=Object.keys(t),r=0;n.length>r;r++)e["$feature/"+n[r]]=t[n[r]];return e}},[Ys]:{exposure:"event"},[Ci]:{exposure:"hidden"},[kl]:{exposure:"hidden"},[wl]:{exposure:"event"},[Cl]:{exposure:"event"},[on]:{exposure:"event"},[Nr]:{exposure:"hidden"},[Ei]:{exposure:"hidden"},[er]:{exposure:"hidden"},[El]:{exposure:"hidden"},[Sl]:{exposure:"event"},[Zs]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[Ri]:{exposure:"hidden"},[Ml]:{exposure:"hidden"},[Al]:{exposure:"hidden"},[go]:{exposure:"hidden"},[Rt]:{exposure:"hidden"},[Tl]:{exposure:"hidden"},[Dl]:{exposure:"hidden"},[Ol]:{exposure:"hidden"},[Rl]:{exposure:"hidden"},[bo]:{exposure:"hidden"},[vo]:{exposure:"hidden"},[V0]:{exposure:"event"},[q0]:{exposure:"event"},[W0]:{exposure:"event"},[U0]:{exposure:"event"},[J0]:{exposure:"event"},[G0]:{exposure:"event"},[Y0]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},Xv=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ko=t=>{var e=N?.createElement("a");return P(e)?null:(e.href=t,e)},wo=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;r.length>i;i++){var s=r[i].split("=");if(s[0]===e){n=s;break}}if(!Q(n)||2>n.length)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{I.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Ji=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),i=r[1],s=(r[0]||"").split("?"),o=s[1],a=s[0],u=(o||"").split("&"),l=[],c=0;u.length>c;c++){var d=u[c].split("=");Q(d)&&(e.includes(d[0])?l.push(d[0]+"="+n):l.push(u[c]))}var h=a;return o!=null&&(h+="?"+l.join("&")),i!=null&&(h+="#"+i),h},Co=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},Ts="https?://(.*)",Xr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Qv=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Xr],Gi="<masked>",e2=["li_fat_id"];function tm(t,e,n){if(!N)return{};var r,i=e?[...Xr,...n||[]]:[],s=nm(Ji(N.URL,i,Gi),t),o=(r={},ce(e2,function(a){var u=Ht.O(a);r[a]=u||null}),r);return ve(o,s)}function nm(t,e){var n=Qv.concat(e||[]),r={};return ce(n,function(i){var s=wo(t,i);r[i]=s||null}),r}function rm(t){var e=function(s){return s?s.search(Ts+"google.([^/?]*)")===0?"google":s.search(Ts+"bing.com")===0?"bing":s.search(Ts+"yahoo.com")===0?"yahoo":s.search(Ts+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!vn(e)){r.$search_engine=e;var i=N?wo(N.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function hh(){return navigator.language||navigator.userLanguage}var Eo="$direct";function im(){return N?.referrer||Eo}function sm(t,e){var n=t?[...Xr,...e||[]]:[],r=ze?.href.substring(0,1e3);return{r:im().substring(0,1e3),u:r?Ji(r,n,Gi):void 0}}function om(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n==Eo?Eo:(e=ko(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=ko(r);i.$host=s?.host,i.$pathname=s?.pathname;var o=nm(r);ve(i,o)}if(n){var a=rm(n);ve(i,a)}return i}function am(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function t2(){try{return new Date().getTimezoneOffset()}catch{return}}var n2=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class ou{constructor(e,n){this.Lt=e,this.props={},this.gr=!1,this.mr=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.ir=this.yr(e),this.load(),e.debug&&I.info("Persistence loaded",e.persistence,O({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.br}yr(e){n2.indexOf(e.persistence.toLowerCase())===-1&&(I.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=function(i){i===void 0&&(i=[]);var s=[...Wv,...i];return O({},pe,{Z(o){try{var a={};try{a=Ht.Z(o)||{}}catch{}var u=ve(a,JSON.parse(pe.O(o)||"{}"));return pe.M(o,u),u}catch{}return null},M(o,a,u,l,c,d){try{pe.M(o,a,void 0,void 0,d);var h={};s.forEach(f=>{a[f]&&(h[f]=a[f])}),Object.keys(h).length&&Ht.M(o,h,u,l,c,d)}catch(f){pe.B(f)}},F(o,a){try{E?.localStorage.removeItem(o),Ht.F(o,a)}catch(u){pe.B(u)}}})}(e.cookie_persisted_properties||[]),r=e.persistence.toLowerCase();return r==="localstorage"&&pe.R()?pe:r==="localstorage+cookie"&&n.R()?n:r==="sessionstorage"&&He.R()?He:r==="memory"?Uv:r==="cookie"?Ht:n.R()?n:Ht}_r(e){var n=e??this.Lt.feature_flag_cache_ttl_ms;if(!n||0>=n)return!1;var r=this.props[go];return!r||typeof r!="number"||Date.now()-r>n}properties(){var e={};return ce(this.props,(n,r)=>{var i=(s=>{var o=Zv[s];if(o)return o;for(var[a,u]of Xv)if(s.indexOf(a)===0)return u})(r);if(i?.exposure==="derived"){if(i.shouldSkipFromEventProperties!=null&&i.shouldSkipFromEventProperties(n,r===zr?()=>this._r():()=>!1))return;i.transformToEventProperties&&ve(e,i.transformToEventProperties(n))}else i&&i.exposure!=="event"||(e[r]=n)}),e}load(){if(!this.br){var e=this.ir.Z(this.mr);e&&(this.props=ve({},e))}}save(){this.br||this.ir.M(this.mr,this.props,this.wr,this.Ir,this.Cr,this.Lt.debug)}remove(){this.ir.F(this.mr,!1),this.ir.F(this.mr,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(ke(e)){P(n)&&(n="None"),this.wr=P(r)?this.Sr:r;var i=!1;if(ce(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.kr(o,s),i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(ke(e)){this.wr=P(n)?this.Sr:n;var r=!1;if(ce(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.kr(s,i),r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Tr(e),this.save())}update_campaign_params(){if(!this.gr){var e=tm(this.Lt.custom_campaign_params,this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties);$r(Vc(e))||this.register(e),this.gr=!0}}update_search_keyword(){var e;this.register((e=N?.referrer)?rm(e):{})}update_referrer_info(){var e;this.register_once({$referrer:im(),$referring_domain:N!=null&&N.referrer&&((e=ko(N.referrer))==null?void 0:e.host)||Eo},void 0)}set_initial_person_info(){this.props[Ol]||this.props[Rl]||this.register_once({[bo]:sm(this.Lt.mask_personal_data_properties,this.Lt.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};ce([Rl,Ol],o=>{var a=this.props[o];a&&ce(a,function(u,l){e["$initial_"+ll(l)]=u})});var n,r,i=this.props[bo];if(i){var s=(n=om(i),r={},ce(n,function(o,a){r["$initial_"+ll(a)]=o}),r);ve(e,s)}return e}safe_merge(e){return ce(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.Sr=this.wr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence||!((o,a)=>{if(o.length!==a.length)return!1;var u=[...o].sort(),l=[...a].sort();return u.every((c,d)=>c===l[d])})(e.cookie_persisted_properties||[],n.cookie_persisted_properties||[])){var i=this.yr(e),s=this.props;this.clear(),this.ir=i,this.props=s,this.save()}}set_disabled(e){this.br=e,this.br?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ir&&(this.Ir=e,this.remove(),this.save())}set_secure(e){e!==this.Cr&&(this.Cr=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[ki]||{};r[e]=n,this.kr(ki,r),this.save()}remove_event_timer(e){var n=this.props[ki]||{},r=n[e];return P(r)||(delete n[e],this.kr(ki,n),this.save()),r}get_property(e){return this.props[e]}set_property(e,n){this.kr(e,n),this.save()}kr(e,n){this.props[e]=n}Tr(e){delete this.props[e]}}var ci={Activation:"events",Cancellation:"cancelEvents"},au={Popover:"popover",API:"api",Widget:"widget"},Si={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent"},uu={SURVEY_ID:"$survey_id",SURVEY_ITERATION:"$survey_iteration",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date"},Fl={Popover:"popover",Inline:"inline"},r2={SHOWN:"product tour shown"},fh={TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},ph=fe("[RateLimiter]");class i2{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=n=>{var r=n.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(i=>{ph.info((i||"events")+" is quota limited."),this.serverLimits[i]=new Date().getTime()+6e4})}catch(i){return void ph.warn('could not rate limit - continuing. Error: "'+i?.message+'"',{text:r})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)==null?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)==null?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var{captureEventsBurstLimit:s,captureEventsPerSecond:o}=this,a=new Date().getTime(),u=(n=(r=this.instance.persistence)==null?void 0:r.get_property(Dl))!==null&&n!==void 0?n:{tokens:s,last:a};u.tokens+=(a-u.last)/1e3*o,u.last=a,u.tokens>s&&(u.tokens=s);var l=1>u.tokens;return l||e||(u.tokens=Math.max(0,u.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+o+" events per second and "+s+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(i=this.instance.persistence)==null||i.set_property(Dl,u),{isRateLimited:l,remainingTokens:u.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var di=fe("[RemoteConfig]");class um{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=$._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}Ar(e){var n,r;(n=$.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}Er(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(n){e(n.json)}})}load(){try{if(this.remoteConfig)return di.info("Using preloaded remote config",this.remoteConfig),this.Rr(this.remoteConfig),void this.Nr();if(this._instance.Mr())return void di.warn("Remote config is disabled. Falling back to local config.");this.Ar(e=>{if(!e)return di.info("No config found after loading remote JS config. Falling back to JSON."),void this.Er(n=>{this.Rr(n),this.Nr()});this.Rr(e),this.Nr()})}catch(e){di.error("Error loading remote config",e)}}stop(){this.Fr&&(clearInterval(this.Fr),this.Fr=void 0)}refresh(){this._instance.Mr()||N?.visibilityState==="hidden"||this._instance.reloadFeatureFlags()}Nr(){var e;if(!this.Fr){var n=(e=this._instance.config.remote_config_refresh_interval_ms)!==null&&e!==void 0?e:3e5;n!==0&&(this.Fr=setInterval(()=>{this.refresh()},n))}}Rr(e){var n;e||di.error("Failed to fetch remote config from PostHog."),this._instance.Rr(e??{}),e?.hasFeatureFlags!==!1&&(this._instance.config.advanced_disable_feature_flags_on_first_load||(n=this._instance.featureFlags)==null||n.ensureFlagsLoaded())}}var $t={GZipJS:"gzip-js",Base64:"base64"},St=Uint8Array,at=Uint16Array,Qr=Uint32Array,qc=new St([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Wc=new St([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),mh=new St([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lm=function(t,e){for(var n=new at(31),r=0;31>r;++r)n[r]=e+=1<<t[r-1];var i=new Qr(n[30]);for(r=1;30>r;++r)for(var s=n[r];n[r+1]>s;++s)i[s]=s-n[r]<<5|r;return[n,i]},cm=lm(qc,2),Il=cm[1];cm[0][28]=258,Il[258]=28;for(var gh=lm(Wc,0)[1],dm=new at(32768),de=0;32768>de;++de){var Sr=(43690&de)>>>1|(21845&de)<<1;dm[de]=((65280&(Sr=(61680&(Sr=(52428&Sr)>>>2|(13107&Sr)<<2))>>>4|(3855&Sr)<<4))>>>8|(255&Sr)<<8)>>>1}var Ni=function(t,e,n){for(var r=t.length,i=0,s=new at(e);r>i;++i)++s[t[i]-1];var o,a=new at(e);for(i=0;e>i;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new at(r),i=0;r>i;++i)o[i]=dm[a[t[i]-1]++]>>>15-t[i];return o},pr=new St(288);for(de=0;144>de;++de)pr[de]=8;for(de=144;256>de;++de)pr[de]=9;for(de=256;280>de;++de)pr[de]=7;for(de=280;288>de;++de)pr[de]=8;var So=new St(32);for(de=0;32>de;++de)So[de]=5;var s2=Ni(pr,9),o2=Ni(So,5),hm=function(t){return(t/8>>0)+(7&t&&1)},fm=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof at?at:t instanceof Qr?Qr:St)(n-e);return r.set(t.subarray(e,n)),r},en=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8},hi=function(t,e,n){var r=e/8>>0;t[r]|=n<<=7&e,t[r+1]|=n>>>8,t[r+2]|=n>>>16},lu=function(t,e){for(var n=[],r=0;t.length>r;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[new St(0),0];if(i==1){var o=new St(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(y,w){return y.f-w.f}),n.push({s:-1,f:25001});var a=n[0],u=n[1],l=0,c=1,d=2;for(n[0]={s:-1,f:a.f+u.f,l:a,r:u};c!=i-1;)a=n[n[d].f>n[l].f?l++:d++],u=n[l!=c&&n[d].f>n[l].f?l++:d++],n[c++]={s:-1,f:a.f+u.f,l:a,r:u};var h=s[0].s;for(r=1;i>r;++r)s[r].s>h&&(h=s[r].s);var f=new at(h+1),p=Pl(n[c-1],f,0);if(p>e){r=0;var m=0,g=p-e,b=1<<g;for(s.sort(function(y,w){return f[w.s]-f[y.s]||y.f-w.f});i>r;++r){var v=s[r].s;if(e>=f[v])break;m+=b-(1<<p-f[v]),f[v]=e}for(m>>>=g;m>0;){var _=s[r].s;e>f[_]?m-=1<<e-f[_]++-1:++r}for(;r>=0&&m;--r){var x=s[r].s;f[x]==e&&(--f[x],++m)}p=e}return[new St(f),p]},Pl=function(t,e,n){return t.s==-1?Math.max(Pl(t.l,e,n+1),Pl(t.r,e,n+1)):e[t.s]=n},bh=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new at(++e),r=0,i=t[0],s=1,o=function(u){n[r++]=u},a=1;e>=a;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},fi=function(t,e){for(var n=0,r=0;e.length>r;++r)n+=t[r]*e[r];return n},Ll=function(t,e,n){var r=n.length,i=hm(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;r>s;++s)t[i+s+4]=n[s];return 8*(i+4+r)},vh=function(t,e,n,r,i,s,o,a,u,l,c){en(e,c++,n),++i[256];for(var d=lu(i,15),h=d[0],f=d[1],p=lu(s,15),m=p[0],g=p[1],b=bh(h),v=b[0],_=b[1],x=bh(m),y=x[0],w=x[1],C=new at(19),k=0;v.length>k;++k)C[31&v[k]]++;for(k=0;y.length>k;++k)C[31&y[k]]++;for(var S=lu(C,7),D=S[0],F=S[1],L=19;L>4&&!D[mh[L-1]];--L);var j,W,X,ne,se=l+5<<3,V=fi(i,pr)+fi(s,So)+o,he=fi(i,h)+fi(s,m)+o+14+3*L+fi(C,D)+(2*C[16]+3*C[17]+7*C[18]);if(V>=se&&he>=se)return Ll(e,c,t.subarray(u,u+l));if(en(e,c,1+(V>he)),c+=2,V>he){j=Ni(h,f),W=h,X=Ni(m,g),ne=m;var Ce=Ni(D,F);for(en(e,c,_-257),en(e,c+5,w-1),en(e,c+10,L-4),c+=14,k=0;L>k;++k)en(e,c+3*k,D[mh[k]]);c+=3*L;for(var Ze=[v,y],bt=0;2>bt;++bt){var Oe=Ze[bt];for(k=0;Oe.length>k;++k)en(e,c,Ce[We=31&Oe[k]]),c+=D[We],We>15&&(en(e,c,Oe[k]>>>5&127),c+=Oe[k]>>>12)}}else j=s2,W=pr,X=o2,ne=So;for(k=0;a>k;++k)if(r[k]>255){var We;hi(e,c,j[257+(We=r[k]>>>18&31)]),c+=W[We+257],We>7&&(en(e,c,r[k]>>>23&31),c+=qc[We]);var Dt=31&r[k];hi(e,c,X[Dt]),c+=ne[Dt],Dt>3&&(hi(e,c,r[k]>>>5&8191),c+=Wc[Dt])}else hi(e,c,j[r[k]]),c+=W[r[k]];return hi(e,c,j[256]),c+W[256]},a2=new Qr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),u2=function(){for(var t=new Qr(256),e=0;256>e;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),cu=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8};function l2(t,e){e===void 0&&(e={});var n=function(){var d=4294967295;return{p(h){for(var f=d,p=0;h.length>p;++p)f=u2[255&f^h[p]]^f>>>8;d=f},d(){return 4294967295^d}}}(),r=t.length;n.p(t);var i,s,o,a,u,l=(a=10+((i=e).filename&&i.filename.length+1||0),u=8,function(d,h,f,p,m,g){var b=d.length,v=new St(p+b+5*(1+Math.floor(b/7e3))+m),_=v.subarray(p,v.length-m),x=0;if(!h||8>b)for(var y=0;b>=y;y+=65535){var w=y+65535;b>w?x=Ll(_,x,d.subarray(y,w)):(_[y]=!0,x=Ll(_,x,d.subarray(y,b)))}else{for(var C=a2[h-1],k=C>>>13,S=8191&C,D=(1<<f)-1,F=new at(32768),L=new at(D+1),j=Math.ceil(f/3),W=2*j,X=function(Ya){return(d[Ya]^d[Ya+1]<<j^d[Ya+2]<<W)&D},ne=new Qr(25e3),se=new at(288),V=new at(32),he=0,Ce=0,Ze=(y=0,0),bt=0,Oe=0;b>y;++y){var We=X(y),Dt=32767&y,wr=L[We];if(F[Dt]=wr,L[We]=Dt,y>=bt){var ks=b-y;if((he>7e3||Ze>24576)&&ks>423){x=vh(d,_,0,ne,se,V,Ce,Ze,Oe,y-Oe,x),Ze=he=Ce=0,Oe=y;for(var Ot=0;286>Ot;++Ot)se[Ot]=0;for(Ot=0;30>Ot;++Ot)V[Ot]=0}var Gn=2,ws=0,Lb=S,yn=Dt-wr&32767;if(ks>2&&We==X(y-yn))for(var Bb=Math.min(k,ks)-1,$b=Math.min(32767,y),zb=Math.min(258,ks);$b>=yn&&--Lb&&Dt!=wr;){if(d[y+Gn]==d[y+Gn-yn]){for(var _n=0;zb>_n&&d[y+_n]==d[y+_n-yn];++_n);if(_n>Gn){if(Gn=_n,ws=yn,_n>Bb)break;var Hb=Math.min(yn,_n-2),Wd=0;for(Ot=0;Hb>Ot;++Ot){var Ga=y-yn+Ot+32768&32767,Ud=Ga-F[Ga]+32768&32767;Ud>Wd&&(Wd=Ud,wr=Ga)}}}yn+=(Dt=wr)-(wr=F[Dt])+32768&32767}if(ws){ne[Ze++]=268435456|Il[Gn]<<18|gh[ws];var Kd=31&Il[Gn],Jd=31&gh[ws];Ce+=qc[Kd]+Wc[Jd],++se[257+Kd],++V[Jd],bt=y+Gn,++he}else ne[Ze++]=d[y],++se[d[y]]}}x=vh(d,_,!0,ne,se,V,Ce,Ze,Oe,y-Oe,x)}return fm(v,0,p+hm(x)+m)}(s=t,(o=e).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,u)),c=l.length;return function(d,h){var f=h.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>h.level?4:h.level==9?2:0,d[9]=3,h.mtime!=0&&cu(d,4,Math.floor(new Date(h.mtime||Date.now())/1e3)),f){d[3]=8;for(var p=0;f.length>=p;++p)d[p+10]=f.charCodeAt(p)}}(l,e),cu(l,c-8,n.d()),cu(l,c-4,r),l}var c2=!!al||!!ol,pm="text/plain",yh=!1,Ea=function(t,e,n){var r;n===void 0&&(n=!0);var[i,s]=t.split("?"),o=O({},e),a=(r=s?.split("&").map(l=>{var c,[d,h]=l.split("="),f=n&&(c=o[d])!==null&&c!==void 0?c:h;return delete o[d],d+"="+f}))!==null&&r!==void 0?r:[],u=function(l,c){var d,h;c===void 0&&(c="&");var f=[];return ce(l,function(p,m){P(p)||P(m)||m==="undefined"||(d=encodeURIComponent((g=>g instanceof File)(p)?p.name:p.toString()),h=encodeURIComponent(m),f[f.length]=h+"="+d)}),f.join(c)}(o);return u&&a.push(u),i+"?"+a.join("&")},Hr=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),du=t=>{if(t.er)return t.er;var{data:e,compression:n}=t;if(e){if(n===$t.GZipJS){var r=l2(function(a,u){var l=a.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(a);for(var c=new St(a.length+(a.length>>>1)),d=0,h=function(g){c[d++]=g},f=0;l>f;++f){if(d+5>c.length){var p=new St(d+8+(l-f<<1));p.set(c),c=p}var m=a.charCodeAt(f);128>m?h(m):2048>m?(h(192|m>>>6),h(128|63&m)):m>55295&&57344>m?(h(240|(m=65536+(1047552&m)|1023&a.charCodeAt(++f))>>>18),h(128|m>>>12&63),h(128|m>>>6&63),h(128|63&m)):(h(224|m>>>12),h(128|m>>>6&63),h(128|63&m))}return fm(c,0,d)}(Hr(e)),{mtime:0});return{contentType:pm,body:r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),estimatedSize:r.byteLength}}if(n===$t.Base64){var i=function(a){return a&&btoa(encodeURIComponent(a).replace(/%([0-9A-F]{2})/g,(u,l)=>String.fromCharCode(parseInt(l,16))))}(Hr(e)),s=(a=>"data="+encodeURIComponent(typeof a=="string"?a:Hr(a)))(i);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var o=Hr(e);return{contentType:"application/json",body:o,estimatedSize:new Blob([o]).size}}},d2=function(){var t=kt(function*(e){var n=Hr(e.data),r=yield function(s,o,a){return ul.apply(this,arguments)}(n,et.DEBUG,{rethrow:!0});if(!r)return e;var i=yield r.arrayBuffer();return O({},e,{er:{contentType:pm,body:i,estimatedSize:i.byteLength}})});return function(e){return t.apply(this,arguments)}}(),_h=(t,e)=>Ea(t,{_:new Date().getTime().toString(),ver:et.JS_SDK_VERSION,compression:e}),Qs=[];ol&&Qs.push({transport:"fetch",method(t){var e,n,{contentType:r,body:i,estimatedSize:s}=(e=du(t))!==null&&e!==void 0?e:{},o=new Headers;ce(t.headers,function(c,d){o.append(d,c)}),r&&o.append("Content-Type",r);var a=t.url,u=null;if(Zd){var l=new Zd;u={signal:l.signal,timeout:setTimeout(()=>l.abort(),t.timeout)}}ol(a,O({method:t?.method||"GET",headers:o,keepalive:t.method==="POST"&&52428.8>(s||0),body:i,signal:(n=u)==null?void 0:n.signal},t.fetchOptions)).then(c=>c.text().then(d=>{var h={statusCode:c.status,text:d};if(c.status===200)try{h.json=JSON.parse(d)}catch(f){I.error(f)}t.callback==null||t.callback(h)})).catch(c=>{I.error(c),t.callback==null||t.callback({statusCode:0,error:c})}).finally(()=>u?clearTimeout(u.timeout):null)}}),al&&Qs.push({transport:"XHR",method(t){var e,n=new al;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=du(t))!==null&&e!==void 0?e:{};ce(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(s)}},n.send(i)}}),ft!=null&&ft.sendBeacon&&Qs.push({transport:"sendBeacon",method(t){var e=Ea(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=du(t))!==null&&n!==void 0?n:{};if(!i)return;var s=i instanceof Blob?i:new Blob([i],{type:r});ft.sendBeacon(e,s)}catch{}}});var Bl=3e3;class h2{constructor(e,n){this.Or=!0,this.Pr=[],this.Lr=Vt(n?.flush_interval_ms||Bl,250,5e3,I.createLogger("flush interval"),Bl),this.Dr=e}enqueue(e){this.Pr.push(e),this.Br||this.jr()}unload(){this.$r();var e=this.Pr.length>0?this.qr():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Dr(O({},r,{transport:"sendBeacon"}))})}enable(){this.Or=!1,this.jr()}jr(){var e=this;this.Or||(this.Br=setTimeout(()=>{if(this.$r(),this.Pr.length>0){var n=this.qr(),r=function(){var s=n[i],o=new Date().getTime();s.data&&Q(s.data)&&ce(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Dr(s)};for(var i in n)r()}},this.Lr))}$r(){clearTimeout(this.Br),this.Br=void 0}qr(){var e={};return ce(this.Pr,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;P(e[s])&&(e[s]=O({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.Pr=[],e}}var f2=["retriesPerformedSoFar"];class p2{constructor(e){this.Zr=!1,this.Hr=3e3,this.Pr=[],this._instance=e,this.Pr=[],this.Vr=!0,!P(E)&&"onLine"in E.navigator&&(this.Vr=E.navigator.onLine,this.zr=()=>{this.Vr=!0,this.Ur()},this.Yr=()=>{this.Vr=!1},Ee(E,"online",this.zr),Ee(E,"offline",this.Yr))}get length(){return this.Pr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=b0(e,f2);Rr(n)&&(r.url=Ea(r.url,{retry_count:n})),this._instance._send_request(O({},r,{callback:i=>{i.statusCode===200||i.statusCode>=400&&500>i.statusCode||(n??0)>=10?r.callback==null||r.callback(i):this.Wr(O({retriesPerformedSoFar:n},r))}}))}Wr(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),u=a/2,l=Math.min(18e5,a),c=Math.random()-.5;return Math.ceil(l+c*(l-u))}(n),i=Date.now()+r;this.Pr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),I.warn(s),this.Zr||(this.Zr=!0,this.Gr())}Gr(){if(this.Xr&&clearTimeout(this.Xr),this.Pr.length===0)return this.Zr=!1,void(this.Xr=void 0);this.Xr=setTimeout(()=>{this.Vr&&this.Pr.length>0&&this.Ur(),this.Gr()},this.Hr)}Ur(){var e=Date.now(),n=[],r=this.Pr.filter(s=>e>s.retryAt||(n.push(s),!1));if(this.Pr=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Xr&&(clearTimeout(this.Xr),this.Xr=void 0),this.Zr=!1,P(E)||(this.zr&&(E.removeEventListener("online",this.zr),this.zr=void 0),this.Yr&&(E.removeEventListener("offline",this.Yr),this.Yr=void 0)),this.Pr))try{this._instance._send_request(O({},e,{transport:"sendBeacon"}))}catch(n){I.error(n)}this.Pr=[]}}class m2{constructor(e){this.Jr=()=>{var n,r,i,s;this.Kr||(this.Kr={});var o=this.scrollElement(),a=this.scrollY(),u=o?Math.max(0,o.scrollHeight-o.clientHeight):0,l=a+(o?.clientHeight||0),c=o?.scrollHeight||0;this.Kr.lastScrollY=Math.ceil(a),this.Kr.maxScrollY=Math.max(a,(n=this.Kr.maxScrollY)!==null&&n!==void 0?n:0),this.Kr.maxScrollHeight=Math.max(u,(r=this.Kr.maxScrollHeight)!==null&&r!==void 0?r:0),this.Kr.lastContentY=l,this.Kr.maxContentY=Math.max(l,(i=this.Kr.maxContentY)!==null&&i!==void 0?i:0),this.Kr.maxContentHeight=Math.max(c,(s=this.Kr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}get Qr(){return this._instance.config.scroll_root_selector}getContext(){return this.Kr}resetContext(){var e=this.Kr;return setTimeout(this.Jr,0),e}startMeasuringScrollPosition(){Ee(E,"scroll",this.Jr,{capture:!0}),Ee(E,"scrollend",this.Jr,{capture:!0}),Ee(E,"resize",this.Jr)}scrollElement(){if(!this.Qr)return E?.document.documentElement;var e=Q(this.Qr)?this.Qr:[this.Qr];for(var n of e){var r=E?.document.querySelector(n);if(r)return r}}scrollY(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this.Qr){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}}var g2=t=>sm(t?.config.mask_personal_data_properties,t?.config.custom_personal_data_properties);class xh{constructor(e,n,r,i){this.ei=s=>{var o=this.ti();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.ri(this._instance)};this.ii.register({[Tl]:a})}},this._instance=e,this.ni=n,this.ii=r,this.ri=i||g2,this.ni.onSessionId(this.ei)}ti(){return this.ii.props[Tl]}getSetOnceProps(){var e,n=(e=this.ti())==null?void 0:e.props;return n?"r"in n?om(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return ce(Vc(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+ll(r)]=n}),e}}class Uc{constructor(){this.si={}}on(e,n){return this.si[e]||(this.si[e]=[]),this.si[e].push(n),()=>{this.si[e]=this.si[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.si[e]||[])r(n);for(var i of this.si["*"]||[])i(e,n)}}var hu=fe("[SessionId]");class kh{on(e,n){return this.oi.on(e,n)}constructor(e,n,r){var i;if(this.ai=[],this.li=void 0,this.oi=new Uc,this.ui=(l,c)=>!(!Rr(l)||!Rr(c))&&Math.abs(l-c)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===dn)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Lt=e.config,this.ii=e.persistence,this.hi=void 0,this.ci=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.di=n||Dn,this.vi=r||Dn;var s=this.Lt.persistence_name||this.Lt.token;if(this._sessionTimeoutMs=1e3*Vt(this.Lt.session_idle_timeout_seconds||1800,60,36e3,hu.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.fi(),this.pi="ph_"+s+"_window_id",this.gi="ph_"+s+"_primary_window_exists",this.mi()){var o=He.Z(this.pi),a=He.Z(this.gi);o&&!a?this.hi=o:He.F(this.pi),He.M(this.gi,!0)}if((i=this.Lt.bootstrap)!=null&&i.sessionID)try{var u=(l=>{var c=this.Lt.bootstrap.sessionID.replace(/-/g,"");if(c.length!==32)throw new Error("Not a valid UUID");if(c[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(c.substring(0,12),16)})();this.yi(this.Lt.bootstrap.sessionID,new Date().getTime(),u)}catch(l){hu.error("Invalid sessionID in bootstrap",l)}this.bi()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return P(this.ai)&&(this.ai=[]),this.ai.push(e),this.ci&&e(this.ci,this.hi),()=>{this.ai=this.ai.filter(n=>n!==e)}}mi(){return this.Lt.persistence!=="memory"&&!this.ii.br&&He.R()}wi(e){e!==this.hi&&(this.hi=e,this.mi()&&He.M(this.pi,e))}Ii(){return this.hi?this.hi:this.mi()?He.Z(this.pi):null}yi(e,n,r){e===this.ci&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.ci=e,this.ii.register({[mo]:[n,e,r]}))}Ci(){var e=this.ii.props[mo];return Q(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.yi(null,null,null)}destroy(){clearTimeout(this.Si),this.Si=void 0,this.li&&E&&(E.removeEventListener(_o,this.li,{capture:!1}),this.li=void 0),this.ai=[]}bi(){this.li=()=>{this.mi()&&He.F(this.gi)},Ee(E,_o,this.li,{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.Lt.cookieless_mode===dn)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[i,s,o]=this.Ci(),a=this.Ii(),u=Rr(o)&&Math.abs(r-o)>864e5,l=!1,c=!s,d=!c&&!e&&this.ui(r,i);c||d||u?(s=this.di(),a=this.vi(),hu.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}}),o=r,l=!0):a||(a=this.vi(),l=!0);var h=Rr(i)&&e&&!u?i:r,f=Rr(o)?o:new Date().getTime();return this.wi(a),this.yi(s,h,f),e||this.fi(),l&&this.ai.forEach(p=>p(s,a,l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:f,changeReason:l?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:u}:void 0,lastActivityTimestamp:i}}fi(){clearTimeout(this.Si),this.Si=setTimeout(()=>{var[e]=this.Ci();if(this.ui(new Date().getTime(),e)){var n=this.ci;this.resetSessionId(),this.oi.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var mm=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&eh(n,e))return!0;try{var r=t?.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>eh(i?.brand,e)))return!0}catch{}return!!t.webdriver},Mo=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function wh(t,e,n){return Hr({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var gm={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>Mo(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!Mo(n,r))),icontains:(t,e)=>e.map(Ds).some(n=>t.map(Ds).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Ds).every(n=>t.map(Ds).every(r=>!n.includes(r))),gt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>r>parseFloat(i))}),lt:(t,e)=>e.some(n=>{var r=parseFloat(n);return!isNaN(r)&&t.some(i=>r<parseFloat(i))})},Ds=t=>t.toLowerCase();function bm(t,e){return!t||Object.entries(t).every(n=>{var[r,i]=n,s=e?.[r];if(P(s)||vn(s))return!1;var o=[String(s)],a=gm[i.operator];return!!a&&a(i.values,o)})}var $l="custom",Ch="i.posthog.com",b2=/^\/static\//;class v2{constructor(e){this.xi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+Ch,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.xi[this.apiHost]||(this.xi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":$l),this.xi[this.apiHost]}ki(e){var n=this.instance.config.__preview_external_dependency_versioned_paths;if(typeof n=="string"&&b2.test(e))return n.trim().replace(/\/$/,"")||void 0}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(e==="flags")return this.flagsApiHost+n;if(e==="assets"){var r=this.ki(n);if(r)return""+r+n}if(this.region===$l)return this.apiHost+n;var i=Ch+n;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var ie=fe("[Surveys]"),zl="seenSurvey_",y2=[au.Popover,au.Widget,au.API],_2={ignoreConditions:!1,ignoreDelay:!1,displayType:Fl.Popover},x2=fe("[PostHog ExternalIntegrations]"),k2={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class w2{constructor(e){this._instance=e}lr(e,n){var r;(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return x2.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,u,l;!i||(a=$.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.lr(k2[o],()=>{var c;(c=$.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(u=$.__PosthogExtensions__)!=null&&(u=u.integrations)!=null&&u[o]&&((l=$.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[o])==null||l.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var Mr,Fi={},fu=0,Hl=()=>{},Eh='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',pi="Surveys module not available",Sh="sanitize_properties is deprecated. Use before_send instead",vm="Invalid value for property_denylist config: ",Ir="posthog",ym=!c2&&st?.indexOf("MSIE")===-1&&st?.indexOf("Mozilla")===-1,Mh=t=>{var e;return O({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,token:"",autocapture:!0,cross_subdomain_cookie:zv(N?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:Hl,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:t??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,debug:ze&&me(ze?.search)&&ze.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(n){I.error("Bad HTTP status: "+n.statusCode+" "+n.text)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Nl,before_send:void 0,request_queue_config:{flush_interval_ms:Bl},error_tracking:{},_onCapture:Hl,__preview_eager_load_replay:!1},(n=>({rageclick:!n||"2025-11-30">n||{content_ignorelist:!0},capture_pageview:!n||"2025-05-24">n||"history_change",session_recording:n&&n>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:n&&n>="2026-01-30"?"head":"body",internal_or_test_user_hostname:n&&n>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0}))(t))},C2=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["store_google","save_campaign_params"],["verbose","debug"]],Ah=t=>{var e={};for(var[n,r]of C2)P(t[n])||(e[r]=t[n]);var i=ve({},e,t);return Q(t.property_blacklist)&&(P(t.property_denylist)?i.property_denylist=t.property_blacklist:Q(t.property_denylist)?i.property_denylist=[...t.property_blacklist,...t.property_denylist]:I.error(vm+t.property_denylist)),i};class E2{constructor(){this.__forceAllowLocalhost=!1}get Ti(){return this.__forceAllowLocalhost}set Ti(e){I.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class Ct{Ai(e,n){if(e){var r=this.Ei.indexOf(e);r!==-1&&this.Ei.splice(r,1)}return this.Ei.push(n),n.initialize==null||n.initialize(),n}Ri(){return this.config.cookieless_mode===dn||this.config.cookieless_mode===tr&&this.consent.isRejected()}get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){var e;this.webPerformance=new E2,this.Ni=!1,this.version=et.LIB_VERSION,this.Mi=new Uc,this.Ei=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=Mh(),this.SentryIntegration=Yv,this.sentryIntegration=r=>function(i,s){var o=em(i,s);return{name:Q0,processEvent:a=>o(a)}}(this,r),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Fi=!1,this.Oi=null,this.Pi=null,this.Li=null,this.scrollManager=new m2(this),this.pageViewManager=new dh(this),this.rateLimiter=new i2(this),this.requestRouter=new v2(this),this.consent=new Kv(this),this.externalIntegrations=new w2(this);var n=(e=Ct.__defaultExtensionClasses)!==null&&e!==void 0?e:{};this.featureFlags=n.featureFlags&&new n.featureFlags(this),this.toolbar=n.toolbar&&new n.toolbar(this),this.surveys=n.surveys&&new n.surveys(this),this.conversations=n.conversations&&new n.conversations(this),this.logs=n.logs&&new n.logs(this),this.experiments=n.experiments&&new n.experiments(this),this.exceptions=n.exceptions&&new n.exceptions(this),this.people={set:(r,i,s)=>{var o=me(r)?{[r]:i}:r;this.setPersonProperties(o),s?.({})},set_once:(r,i,s)=>{var o=me(r)?{[r]:i}:r;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",r=>I.info('send "'+r?.event+'"',r))}init(e,n,r){if(r&&r!==Ir){var i,s=(i=Fi[r])!==null&&i!==void 0?i:new Ct;return s._init(e,n,r),Fi[r]=s,Fi[Ir][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),P(e)||Gs(e))return I.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},n.debug=this.Di(n.debug),this.Bi=n,this.ji=[],n.person_profiles?this.Pi=n.person_profiles:n.process_person&&(this.Pi=n.process_person),this.set_config(ve({},Mh(n.defaults),Ah(n),{name:r,token:e})),this.config.on_xhr_error&&I.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:$t.GZipJS;var o=this.$i();this.persistence=new ou(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ou(O({},this.config,{persistence:"sessionStorage"}),o);var a=O({},this.persistence.props),u=O({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qi=new h2(g=>this.Zi(g),this.config.request_queue_config),this.Hi=new p2(this),this.__request_queue=[];var l=this.Ri();if(l||(this.sessionManager=new kh(this),this.sessionPropsManager=new xh(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(I.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Vi(l)},0)):(I.info("Initializing extensions synchronously"),this.Vi(l)),et.DEBUG=et.DEBUG||this.config.debug,et.DEBUG&&I.info("Starting in debug mode",{this:this,config:n,thisC:O({},this.config),p:a,s:u}),!this.config.identity_distinct_id||(i=n.bootstrap)!=null&&i.distinctID||(n.bootstrap=O({},n.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0})),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c=n.bootstrap.distinctID,d=this.get_distinct_id(),h=this.persistence.get_property(Rt);if(n.bootstrap.isIdentifiedID&&d!=null&&d!==c&&h===Cr)this.identify(c);else if(n.bootstrap.isIdentifiedID&&d!=null&&d!==c&&h===Er)I.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var f=this.config.get_device_id(Dn()),p=n.bootstrap.isIdentifiedID?f:c;this.persistence.set_property(Rt,n.bootstrap.isIdentifiedID?Er:Cr),this.register({distinct_id:c,$device_id:p})}}if(l)this.register_once({distinct_id:Es,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(Dn());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(Rt,Cr)}return Ee(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),n.segment?function(g,b){var v=g.config.segment;if(!v)return b();(function(_,x){var y=_.config.segment;if(!y)return x();var w=k=>{var S=()=>k.anonymousId()||Dn();_.config.get_device_id=S,k.id()&&(_.register({distinct_id:k.id(),$device_id:S()}),_.persistence.set_property(Rt,Er)),x()},C=y.user();"then"in C&&cn(C.then)?C.then(w):w(C)})(g,()=>{v.register((_=>{Promise&&Promise.resolve||su.warn("This browser does not have Promise support, and can not use the segment integration");var x=(y,w)=>{if(!w)return y;y.event.userId||y.event.anonymousId===_.get_distinct_id()||(su.info("No userId set, resetting PostHog"),_.reset()),y.event.userId&&y.event.userId!==_.get_distinct_id()&&(su.info("UserId set, identifying with PostHog"),_.identify(y.event.userId));var C=_.calculateEventProperties(w,y.event.properties);return y.event.properties=Object.assign({},C,y.event.properties),y};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:y=>x(y,y.event.event),page:y=>x(y,Fr),identify:y=>x(y,ru),screen:y=>x(y,"$screen")}})(g)).then(()=>{b()})})}(this,()=>this.zi()):this.zi(),cn(this.config._onCapture)&&this.config._onCapture!==Hl&&(I.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",g=>this.config._onCapture(g.event,g))),this.config.ip&&I.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Vi(e){var n,r,i,s,o,a,u,l=performance.now(),c=O({},Ct.__defaultExtensionClasses,this.config.__extensionClasses),d=[];c.featureFlags&&this.Ei.push(this.featureFlags=(n=this.featureFlags)!==null&&n!==void 0?n:new c.featureFlags(this)),c.exceptions&&this.Ei.push(this.exceptions=(r=this.exceptions)!==null&&r!==void 0?r:new c.exceptions(this)),c.historyAutocapture&&this.Ei.push(this.historyAutocapture=new c.historyAutocapture(this)),c.tracingHeaders&&this.Ei.push(new c.tracingHeaders(this)),c.siteApps&&this.Ei.push(this.siteApps=new c.siteApps(this)),c.sessionRecording&&!e&&this.Ei.push(this.sessionRecording=new c.sessionRecording(this)),this.config.disable_scroll_properties||d.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),c.autocapture&&this.Ei.push(this.autocapture=new c.autocapture(this)),c.surveys&&this.Ei.push(this.surveys=(i=this.surveys)!==null&&i!==void 0?i:new c.surveys(this)),c.logs&&this.Ei.push(this.logs=(s=this.logs)!==null&&s!==void 0?s:new c.logs(this)),c.conversations&&this.Ei.push(this.conversations=(o=this.conversations)!==null&&o!==void 0?o:new c.conversations(this)),c.productTours&&this.Ei.push(this.productTours=new c.productTours(this)),c.heatmaps&&this.Ei.push(this.heatmaps=new c.heatmaps(this)),c.webVitalsAutocapture&&this.Ei.push(this.webVitalsAutocapture=new c.webVitalsAutocapture(this)),c.exceptionObserver&&this.Ei.push(this.exceptionObserver=new c.exceptionObserver(this)),c.deadClicksAutocapture&&this.Ei.push(this.deadClicksAutocapture=new c.deadClicksAutocapture(this,Gv)),c.toolbar&&this.Ei.push(this.toolbar=(a=this.toolbar)!==null&&a!==void 0?a:new c.toolbar(this)),c.experiments&&this.Ei.push(this.experiments=(u=this.experiments)!==null&&u!==void 0?u:new c.experiments(this)),this.Ei.forEach(h=>{h.initialize&&d.push(()=>{h.initialize==null||h.initialize()})}),d.push(()=>{if(this.Ui){var h=this.Ui;this.Ui=void 0,this.Rr(h)}}),this.Yi(d,l)}Yi(e,n){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-n>=30&&e.length>0)return void setTimeout(()=>{this.Yi(e,n)},0);var r=e.shift();if(r)try{r()}catch(s){I.error("Error initializing extension:",s)}}var i=Math.round(performance.now()-n);this.register_for_session({[J0]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[G0]:i}),this.config.__preview_deferred_init_extensions&&I.info("PostHog extensions initialized ("+i+"ms)")}Rr(e){var n;if(!N||!N.body)return I.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Rr(e)},500);this.config.__preview_deferred_init_extensions&&(this.Ui=e),this.Wi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=G(e.supportedCompression,$t.GZipJS)?$t.GZipJS:G(e.supportedCompression,$t.Base64)?$t.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Pi?this.Pi:Nl}),this.Ei.forEach(r=>r.onRemoteConfig==null?void 0:r.onRemoteConfig(e))}zi(){try{this.config.loaded(this)}catch(r){I.critical("`loaded` function failed",r)}if(this.Gi(),this.config.internal_or_test_user_hostname&&ze!=null&&ze.hostname){var e=ze.hostname,n=this.config.internal_or_test_user_hostname;(typeof n=="string"?e===n:n.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Ri())&&this.Xi()},1),this.Ji=new um(this),this.Ji.load()}Gi(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.qi)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Ss(this.__request_queue,e=>this.Zi(e)),this.__request_queue=[],this.Gi()}_handle_unload(){var e,n,r,i;(e=this.surveys)==null||e.handlePageUnload(),this.config.request_batching?(this.Ki()&&this.capture(nu),(n=this.logs)==null||n.flushLogs("sendBeacon"),(r=this.qi)==null||r.unload(),(i=this.Hi)==null||i.unload()):this.Ki()&&this.capture(nu,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(ym?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ea(e.url,{ip:this.config.ip?1:0}),e.headers=O({},this.config.request_headers,e.headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=O({},n);o.timeout=o.timeout||6e4,o.url=_h(o.url,o.compression);var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",u=Qs.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),l=(i=(s=function(c,d){for(var h=0;c.length>h;h++)if(c[h].transport===a)return c[h]}(u))==null?void 0:s.method)!==null&&i!==void 0?i:u[0].method;if(!l)throw new Error("No available transport method");a!=="sendBeacon"&&o.data&&o.compression===$t.GZipJS&&Yb&&!yh?d2(o).then(c=>{l(c)}).catch(c=>{if((d=>!(!d||typeof d!="object")&&("name"in d?String(d.name):"")==="NotReadableError")(c))return yh=!0,void l(O({},o,{compression:void 0,url:_h(n.url,void 0)}));l(o)}):l(o)})(O({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),400>n.statusCode||(r=(i=this.config).on_request_error)==null||r.call(i,n),e.callback==null||e.callback(n)}}))))}Zi(e){this.Hi?this.Hi.retriableRequest(e):this._send_request(e)}_execute_array(e){fu++;try{var n,r=[],i=[],s=[];Ss(e,a=>{a&&(Q(n=a[0])?s.push(a):cn(a)?a.call(this):Q(a)&&n==="alias"?r.push(a):Q(a)&&n.indexOf("capture")!==-1&&cn(this[n])?s.push(a):i.push(a))});var o=function(a,u){Ss(a,function(l){if(Q(l[0])){var c=u;ce(l,function(d){c=c[d[0]].apply(c,d.slice(1))})}else u[l[0]].apply(u,l.slice(1))})};o(r,this),o(i,this),o(s,this)}finally{fu--}}push(e){if(fu>0&&Q(e)&&me(e[0])){var n=Ct.prototype[e[0]];cn(n)&&n.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,n,r){var i,s,o,a,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qi){if(this.is_capturing())if(!P(e)&&me(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var c=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(c==null||!c.isRateLimited){n!=null&&n.$current_url&&!me(n?.$current_url)&&(I.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),e!=="$exception"||r!=null&&r.Qi||I.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var d=new Date,h=r?.timestamp||d,f=Dn(),p={uuid:f,event:e,properties:this.calculateEventProperties(e,n||{},h,f)};e===Fr&&this.config.__preview_capture_bot_pageviews&&l&&(p.event="$bot_pageview",p.properties.$browser_type="bot"),c&&(p.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens),r?.$set&&(p.$set=r?.$set);var m,g,b,v=this.en(r?.$set_once,e!==ah,e===ru);if(v&&(p.$set_once=v),r!=null&&r._noTruncate||(s=this.config.properties_string_max_length,o=p,a=S=>me(S)?S.slice(0,s):S,u=new Set,p=function S(D,F){return D!==Object(D)?a?a(D):D:u.has(D)?void 0:(u.add(D),Q(D)?(L=[],Ss(D,j=>{L.push(S(j))})):(L={},ce(D,(j,W)=>{u.has(j)||(L[W]=S(j))})),L);var L}(o)),p.timestamp=h,P(r?.timestamp)||(p.properties.$event_time_override_provided=!0,p.properties.$event_time_override_system_time=d),e===Si.DISMISSED||e===Si.SENT){var _=n?.[uu.SURVEY_ID],x=n?.[uu.SURVEY_ITERATION];(S=>{try{var D=(F=>((L,j)=>{var W=""+zl+j.id;return j.current_iteration&&j.current_iteration>0&&(W=""+zl+j.id+"_"+j.current_iteration),W})(0,F))(S);if(localStorage.getItem(D))return;localStorage.setItem(D,"true")}catch(F){ie.error("Failed to persist survey seen state",F)}})({id:_,current_iteration:x}),p.$set=O({},p.$set,{[(m={id:_,current_iteration:x},g=e===Si.SENT?"responded":"dismissed",b="$survey_"+g+"/"+m.id,m.current_iteration&&m.current_iteration>0&&(b="$survey_"+g+"/"+m.id+"/"+m.current_iteration),b)]:!0})}else e===Si.SHOWN&&(p.$set=O({},p.$set,{[uu.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));if(e===r2.SHOWN){var y=n?.[fh.TOUR_TYPE];y&&(p.$set=O({},p.$set,{[fh.TOUR_LAST_SEEN_DATE+"/"+y]:new Date().toISOString()}))}var w=O({},p.properties.$set,p.$set);if($r(w)||this.setPersonPropertiesForFlags(w),!Y(this.config.before_send)){var C=this.tn(p);if(!C)return;p=C}this.Mi.emit("eventCaptured",p);var k={method:"POST",url:(i=r?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:p,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.Zi(k):this.qi.enqueue(k),p}I.critical("This capture call is ignored due to client rate limiting.")}}else I.error("No event name provided to posthog.capture")}else I.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=s?void 0:this.persistence.remove_event_timer(e),a=O({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.Ri()&&(a.$cookieless_mode=!0),e==="$snapshot"){var u=O({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=u.distinct_id,(!me(a.distinct_id)&&!Tt(a.distinct_id)||Gs(a.distinct_id))&&I.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,c=function(b,v){var _,x,y,w;if(!st)return{};var C,k,S,D,F,L,j,W,X=b?[...Xr,...v||[]]:[],[ne,se]=function(V){for(var he=0;rh.length>he;he++){var[Ce,Ze]=rh[he],bt=Ce.exec(V),Oe=bt&&(cn(Ze)?Ze(bt,V):Ze);if(Oe)return Oe}return["",""]}(st);return ve(Vc({$os:ne,$os_version:se,$browser:P0(st,navigator.vendor),$device:ih(st),$device_type:(k=st,S={userAgentDataPlatform:(_=navigator)==null||(_=_.userAgentData)==null?void 0:_.platform,maxTouchPoints:(x=navigator)==null?void 0:x.maxTouchPoints,screenWidth:E==null||(y=E.screen)==null?void 0:y.width,screenHeight:E==null||(w=E.screen)==null?void 0:w.height,devicePixelRatio:E?.devicePixelRatio},W=ih(k),W===k0||W===x0||W==="Kobo"||W==="Kindle Fire"||W===I0?Gr:W===Ui||W===Wr||W===Ki||W===dl?"Console":W===C0?"Wearable":W?pt:S?.userAgentDataPlatform==="Android"&&((D=S?.maxTouchPoints)!==null&&D!==void 0?D:0)>0?600>Math.min((F=S?.screenWidth)!==null&&F!==void 0?F:0,(L=S?.screenHeight)!==null&&L!==void 0?L:0)/((j=S?.devicePixelRatio)!==null&&j!==void 0?j:1)?pt:Gr:"Desktop"),$timezone:am(),$timezone_offset:t2()}),{$current_url:Ji(ze?.href,X,Gi),$host:ze?.host,$pathname:ze?.pathname,$raw_user_agent:st.length>1e3?st.substring(0,997)+"...":st,$browser_version:hv(st,navigator.vendor),$browser_language:hh(),$browser_language_prefix:(C=hh(),typeof C=="string"?C.split("-")[0]:void 0),$screen_height:E?.screen.height,$screen_width:E?.screen.width,$viewport_height:E?.innerHeight,$viewport_width:E?.innerWidth,$lib:et.LIB_NAME,$lib_version:et.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&ve(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&ve(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.Hi)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===$l&&(a.$lib_custom_api_host=this.config.api_host),l=e!==Fr||s?e!==nu||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=ve(a,l),e===Fr&&N&&(a.title=N.title),!P(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}st&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=ve({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Q(this.config.property_denylist)?ce(this.config.property_denylist,function(b){delete a[b]}):I.error(vm+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&(I.error(Sh),a=m(a,e));var g=this.rn();return a.$process_person_profile=g,g&&!s&&this.nn("_calculate_event_properties"),a}en(e,n,r){var i;if(n===void 0&&(n=!0),r===void 0&&(r=!1),!this.persistence||!this.rn()||this.Ni&&!r)return e;var s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)==null?void 0:i.getSetOnceProps(),a=ve({},s,o||{},e||{}),u=this.config.sanitize_properties;return u&&(I.error(Sh),a=u(a,"$set_once")),n&&(this.Ni=!0),$r(a)?void 0:a}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}sn(e,n){this.register({[e]:n})}getFeatureFlag(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n;return(n=this.featureFlags)==null?void 0:n.getFeatureFlagPayload(e)}getFeatureFlagResult(e,n){var r;return(r=this.featureFlags)==null?void 0:r.getFeatureFlagResult(e,n)}isFeatureEnabled(e,n){var r;return(r=this.featureFlags)==null?void 0:r.isFeatureEnabled(e,n)}reloadFeatureFlags(){var e;(e=this.featureFlags)==null||e.reloadFeatureFlags()}updateFlags(e,n,r){var i;(i=this.featureFlags)==null||i.updateFlags(e,n,r)}updateEarlyAccessFeatureEnrollment(e,n,r){var i;(i=this.featureFlags)==null||i.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){var i;return n===void 0&&(n=!1),(i=this.featureFlags)==null?void 0:i.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Mi.on(e,n)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:pi}),()=>{})}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getSurveys(e,n):e([],{isLoaded:!1,error:pi})}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,n):e([],{isLoaded:!1,error:pi})}renderSurvey(e,n){var r;(r=this.surveys)==null||r.renderSurvey(e,n)}displaySurvey(e,n){var r;n===void 0&&(n=_2),(r=this.surveys)==null||r.displaySurvey(e,n)}cancelPendingSurvey(e){var n;(n=this.surveys)==null||n.cancelPendingSurvey(e)}canRenderSurvey(e){var n,r;return(n=(r=this.surveys)==null?void 0:r.canRenderSurvey(e))!==null&&n!==void 0?n:{visible:!1,disabledReason:pi}}canRenderSurveyAsync(e,n){var r,i;return n===void 0&&(n=!1),(r=(i=this.surveys)==null?void 0:i.canRenderSurveyAsync(e,n))!==null&&r!==void 0?r:Promise.resolve({visible:!1,disabledReason:pi})}an(e){return!e||Gs(e)?(I.critical("Unique user id has not been set in posthog.identify"),!1):e===Es?(I.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(I.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'),!1)}identify(e,n,r){if(!this.__loaded||!this.persistence)return I.uninitializedWarning("posthog.identify");if(Tt(e)&&(e=e.toString(),I.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.an(e)&&this.nn("posthog.identify")){var i=this.get_distinct_id();this.register({$user_id:e}),this.get_property(po)||this.register_once({$had_persisted_distinct_id:!0,$device_id:i},""),e!==i&&e!==this.get_property(xi)&&(this.unregister(xi),this.register({distinct_id:e}));var s,o=(this.persistence.get_property(Rt)||Cr)===Cr;e!==i&&o?(this.persistence.set_property(Rt,Er),this.setPersonPropertiesForFlags({$set:n||{},$set_once:r||{}},!1),this.capture(ru,{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Li=wh(e,n,r),(s=this.featureFlags)==null||s.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(Ri))}}setPersonProperties(e,n){if((e||n)&&this.nn("posthog.setPersonProperties")){var r=wh(this.get_distinct_id(),e,n);this.Li!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:n||{}},!0),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Li=r):I.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){var i=this.getGroups(),s=i[e]!==n;if(s&&this.resetGroupPropertiesForFlags(e),this.register({$groups:O({},i,{[e]:n})}),s||r){var o={$group_type:e,$group_key:n};r&&(o.$group_set=r),this.capture(ah,o)}r&&this.setGroupPropertiesForFlags({[e]:r}),s&&!r&&this.reloadFeatureFlags()}else I.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),(r=this.featureFlags)==null||r.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){var e;(e=this.featureFlags)==null||e.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){var r;n===void 0&&(n=!0),this.nn("posthog.setGroupPropertiesForFlags")&&((r=this.featureFlags)==null||r.setGroupPropertiesForFlags(e,n))}resetGroupPropertiesForFlags(e){var n;(n=this.featureFlags)==null||n.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s,o,a,u,l;if(I.info("reset"),!this.__loaded)return I.uninitializedWarning("posthog.reset");var c=this.get_property(po);if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),(i=this.surveys)==null||i.reset(),(s=this.Ji)==null||s.stop(),(o=this.featureFlags)==null||o.reset(),(a=this.conversations)==null||a.reset(),(u=this.persistence)==null||u.set_property(Rt,Cr),(l=this.sessionManager)==null||l.resetSessionId(),this.Li=null,this.config.cookieless_mode===dn)this.register_once({distinct_id:Es,$device_id:null},"");else{var d=this.config.get_device_id(Dn());this.register_once({distinct_id:d,$device_id:e?d:c},"")}this.register({$last_posthog_reset:new Date().toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,n){var r;this.config.identity_distinct_id=e,this.config.identity_hash=n,this.alias(e),(r=this.conversations)==null||r.ln()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,(e=this.conversations)==null||e.un()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property(j0)?(I.critical("Attempting to create alias for existing People user - aborting."),-2):this.nn("posthog.alias")?(P(n)&&(n=this.get_distinct_id()),e!==n?(this.sn(xi,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(I.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=O({},this.config);if(ke(e)){var r,i,s,o,a,u,l,c,d,h;ve(this.config,Ah(e));var f=this.$i();(r=this.persistence)==null||r.update_config(this.config,n,f),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new ou(O({},this.config,{persistence:"sessionStorage"}),f);var p=this.Di(this.config.debug);jt(p)&&(this.config.debug=p),jt(this.config.debug)&&(this.config.debug?(et.DEBUG=!0,pe.R()&&pe.M("ph_debug",!0),I.info("set_config",{config:e,oldConfig:n,newConfig:O({},this.config)})):(et.DEBUG=!1,pe.R()&&pe.F("ph_debug"))),(i=this.exceptionObserver)==null||i.onConfigChange(),(s=this.exceptions)==null||s.onConfigChange(),(o=this.sessionRecording)==null||o.startIfEnabledOrStop(),(a=this.autocapture)==null||a.startIfEnabled(),(u=this.heatmaps)==null||u.startIfEnabled(),(l=this.exceptionObserver)==null||l.startIfEnabledOrStop(),(c=this.deadClicksAutocapture)==null||c.startIfEnabledOrStop(),(d=this.surveys)==null||d.loadIfEnabled(),this.hn(),(h=this.externalIntegrations)==null||h.startIfEnabledOrStop()}}_overrideSDKInfo(e,n){et.LIB_NAME=e,et.LIB_VERSION=n}startSessionRecording(e){var n,r,i,s,o,a=e===!0,u={sampling:a||!(e==null||!e.sampling),linked_flag:a||!(e==null||!e.linked_flag),url_trigger:a||!(e==null||!e.url_trigger),event_trigger:a||!(e==null||!e.event_trigger)};Object.values(u).some(Boolean)&&((n=this.sessionManager)==null||n.checkAndGetSessionAndWindowId(),u.sampling&&((r=this.sessionRecording)==null||r.overrideSampling()),u.linked_flag&&((i=this.sessionRecording)==null||i.overrideLinkedFlag()),u.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),u.event_trigger&&((o=this.sessionRecording)==null||o.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){if(this.exceptions){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(O({},i,n))}}addExceptionStep(e,n){var r;(r=this.exceptions)==null||r.addExceptionStep(e,n)}captureLog(e){var n;(n=this.logs)==null||n.captureLog(e)}get logger(){var e,n;return(e=(n=this.logs)==null?void 0:n.logger)!==null&&e!==void 0?e:Ct.cn}startExceptionAutocapture(e){this.set_config({capture_exceptions:e==null||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var n,r;return(n=(r=this.toolbar)==null?void 0:r.loadToolbar(e))!==null&&n!==void 0&&n}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Ir;return n!==Ir&&(n=Ir+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(Rt))===Er||((n=this.sessionPersistence)==null?void 0:n.get_property(Rt))===Er}rn(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles===Nl&&!this._isIdentified()&&$r(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[xi])&&((n=this.persistence)==null||(n=n.props)==null||!n[vo]))}Ki(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.rn()||this.nn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.nn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}nn(e){return this.config.person_profiles==="never"?(I.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.sn(vo,!0),!0)}$i(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==tr)}hn(){var e,n,r,i,s=this.$i();return((e=this.persistence)==null?void 0:e.br)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.br)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){var n;if(this.config.cookieless_mode!==dn){if(this.Ri()){var r,i,s,o,a;this.reset(!0),(r=this.sessionManager)==null||r.destroy(),(i=this.pageViewManager)==null||i.destroy(),this.sessionManager=new kh(this),this.pageViewManager=new dh(this),this.persistence&&(this.sessionPropsManager=new xh(this,this.sessionManager,this.persistence));var u,l=(s=(o=this.config.__extensionClasses)==null?void 0:o.sessionRecording)!==null&&s!==void 0?s:(a=Ct.__defaultExtensionClasses)==null?void 0:a.sessionRecording;l&&(this.sessionRecording=this.Ai(this.sessionRecording,new l(this)),this.Wi&&((u=this.sessionRecording)==null||u.onRemoteConfig==null||u.onRemoteConfig(this.Wi)))}var c,d;this.consent.optInOut(!0),this.hn(),this.Gi(),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),this.config.cookieless_mode==tr&&((c=this.surveys)==null||c.loadIfEnabled()),(P(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((d=e?.captureEventName)!==null&&d!==void 0?d:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Xi()}else I.warn(Eh)}opt_out_capturing(){var e,n,r;this.config.cookieless_mode!==dn?(this.config.cookieless_mode===tr&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.hn(),this.config.cookieless_mode===tr&&(this.register({distinct_id:Es,$device_id:null}),(e=this.sessionManager)==null||e.destroy(),(n=this.pageViewManager)==null||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,(r=this.sessionRecording)==null||r.stopRecording(),this.sessionRecording=void 0,this.Xi())):I.warn(Eh)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===1?"granted":e===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===dn||(this.config.cookieless_mode===tr?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.hn()}_is_bot(){return ft?mm(ft,this.config.custom_blocked_useragents):void 0}Xi(){N&&(N.visibilityState==="visible"?this.Fi||(this.Fi=!0,this.capture(Fr,{title:N.title},{send_instantly:!0}),this.Oi&&(N.removeEventListener(yo,this.Oi),this.Oi=null)):this.Oi||(this.Oi=this.Xi.bind(this),Ee(N,yo,this.Oi)))}debug(e){e===!1?(E?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(E?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}Mr(){var e,n,r,i,s,o,a=this.Bi||{};return"advanced_disable_flags"in a?!!a.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(I.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=I,s=(n="advanced_disable_flags")in(e=a)&&!Y(e[n]),o=r in e&&!Y(e[r]),s?e[n]:!!o&&(i&&i.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]))}tn(e){if(Y(this.config.before_send))return e;var n=Q(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),Y(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return ev(e.event)?I.warn(s+". This can cause unexpected behavior."):I.info(s),null}r.properties&&!$r(r.properties)||I.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.cr)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}Di(e){var n=jt(e)&&!e,r=pe.R()&&pe.O("ph_debug")==="true";return!n&&(!!r||e)}}function Th(t){return t instanceof Element&&(t.id===K0||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function Sa(t){return!!t&&t.nodeType===1}function $n(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function _m(t){return!!t&&t.nodeType===3}function xm(t){return!!t&&t.nodeType===11}function Kc(t){return t?wa(t).split(/\s+/):[]}function Dh(t){var e=E?.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function Ao(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return Kc(e)}function km(t){return Y(t)?null:wa(t).split(/(\s+)/).filter(e=>Ii(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Yi(t){var e="";return Vl(t)&&!Cm(t)&&t.childNodes&&t.childNodes.length&&ce(t.childNodes,function(n){var r;_m(n)&&n.textContent&&(e+=(r=km(n.textContent))!==null&&r!==void 0?r:"")}),wa(e)}function Oh(t){return P(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}Ct.__defaultExtensionClasses={},Ct.cn={trace:Mr=()=>{},debug:Mr,info:Mr,warn:Mr,error:Mr,fatal:Mr},function(t,e){for(var n=0;e.length>n;n++)t.prototype[e[n]]=Bv(t.prototype[e[n]])}(Ct,["identify"]);var Jc=["a","button","form","input","select","textarea","label"];function Rh(t,e){if(P(e))return!0;var n,r=function(s){if(e.some(o=>s.matches(o)))return{v:!0}};for(var i of t)if(n=r(i))return n.v;return!1}function wm(t){var e=t.parentNode;return!(!e||!Sa(e))&&e}var S2=["next","previous","prev",">","<"],Nh=[".ph-no-rageclick",".ph-no-capture"],jl=t=>!t||$n(t,"html")||!Sa(t),Fh=(t,e)=>{if(!E||jl(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],i=t;i.parentNode&&!$n(i,"body");)if(xm(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=wm(i);if(!s)break;if(e||Jc.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=E.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(s),i=s}return{parentIsUsefulElement:n,targetElementList:r}};function Vl(t){for(var e=t;e.parentNode&&!$n(e,"body");e=e.parentNode){var n=Ao(e);if(G(n,"ph-sensitive")||G(n,"ph-no-capture"))return!1}if(G(Ao(t),"ph-include"))return!0;var r=t.type||"";if(me(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=t.name||t.id||"";return!me(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function Cm(t){return!!($n(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||$n(t,"select")||$n(t,"textarea")||t.getAttribute("contenteditable")==="true")}var Em="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",M2=new RegExp("^(?:"+Em+")$"),A2=new RegExp(Em),Sm="\\d{3}-?\\d{2}-?\\d{4}",T2=new RegExp("^("+Sm+")$"),D2=new RegExp("("+Sm+")");function Ii(t,e){return e===void 0&&(e=!0),!(Y(t)||me(t)&&(t=wa(t),(e?M2:A2).test((t||"").replace(/[- ]/g,""))||(e?T2:D2).test(t)))}function Ih(t){var e=Yi(t);return Ii(e=(e+" "+Mm(t)).trim())?e:""}function Mm(t){var e="";return t&&t.childNodes&&t.childNodes.length&&ce(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=Yi(n);e=(e+" "+i).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Mm(n)).trim())}catch(s){I.error("[AutoCapture]",s)}}),e}function Ph(t){return t.replace(/"|\\"/g,'\\"')}function O2(t){var e=t.attr__class;return e?Q(e)?e:Kc(e):void 0}class Lh{constructor(e){this.disabled=e===!1;var n=ke(e)?e:{};this.thresholdPx=n.threshold_px||30,this.timeoutMs=n.timeout_ms||1e3,this.clickCount=n.click_count||3,this.clicks=[]}isRageClick(e,n,r){if(this.disabled)return!1;var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<this.thresholdPx&&this.timeoutMs>r-i.timestamp){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var pu="$copy_autocapture",Bh=fe("[AutoCapture]");function mu(t,e){return e.length>t?e.slice(0,t)+"...":e}function R2(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!Sa(e));return e}function N2(t,e){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:u}=e,l=[t],c=t;c.parentNode&&!$n(c,"body");)xm(c.parentNode)?(l.push(c.parentNode.host),c=c.parentNode.host):(l.push(c.parentNode),c=c.parentNode);var d,h,f=[],p={},m=!1,g=!1;if(ce(l,y=>{var w=Vl(y);y.tagName.toLowerCase()==="a"&&(m=y.getAttribute("href"),m=w&&m&&Ii(m)&&m),G(Ao(y),"ph-no-capture")&&(g=!0),f.push(function(k,S,D,F){var L=k.tagName.toLowerCase(),j={tag_name:L};Jc.indexOf(L)>-1&&!D&&(j.$el_text=L.toLowerCase()==="a"||L.toLowerCase()==="button"?mu(1024,Ih(k)):mu(1024,Yi(k)));var W=Ao(k);W.length>0&&(j.classes=W.filter(function(V){return V!==""})),ce(k.attributes,function(V){var he;if((!Cm(k)||["name","id","class","aria-label"].indexOf(V.name)!==-1)&&(F==null||!F.includes(V.name))&&!S&&Ii(V.value)&&(!me(he=V.name)||he.substring(0,10)!=="_ngcontent"&&he.substring(0,7)!=="_nghost")){var Ce=V.value;V.name==="class"&&(Ce=Kc(Ce).join(" ")),j["attr__"+V.name]=mu(1024,Ce)}});for(var X=1,ne=1,se=k;se=R2(se);)X++,se.tagName===k.tagName&&ne++;return j.nth_child=X,j.nth_of_type=ne,j}(y,s,o,a));var C=function(k){if(!Vl(k))return{};var S={};return ce(k.attributes,function(D){if(D.name&&D.name.indexOf("data-ph-capture-attribute")===0){var F=D.name.replace("data-ph-capture-attribute-",""),L=D.value;F&&L&&Ii(L)&&(S[F]=L)}}),S}(y);ve(p,C)}),g)return{props:{},explicitNoCapture:g};if(o||(f[0].$el_text=t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?Ih(t):Yi(t)),m){var b,v;f[0].attr__href=m;var _=(b=ko(m))==null?void 0:b.host,x=E==null||(v=E.location)==null?void 0:v.host;_&&x&&_!==x&&(d=m)}return{props:ve({$event_type:i.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:(h=f,function(y){return y.map(w=>{var C,k,S="";if(w.tag_name&&(S+=w.tag_name),w.attr_class)for(var D of(w.attr_class.sort(),w.attr_class))S+="."+D.replace(/"/g,"");var F=O({},w.text?{text:w.text}:{},{"nth-child":(C=w.nth_child)!==null&&C!==void 0?C:0,"nth-of-type":(k=w.nth_of_type)!==null&&k!==void 0?k:0},w.href?{href:w.href}:{},w.attr_id?{attr_id:w.attr_id}:{},w.attributes),L={};return Xs(F).sort((j,W)=>{var[X]=j,[ne]=W;return X.localeCompare(ne)}).forEach(j=>{var[W,X]=j;return L[Ph(W.toString())]=Ph(X.toString())}),(S+=":")+Xs(L).map(j=>{var[W,X]=j;return W+'="'+X+'"'}).join("")}).join(";")}(function(y){return y.map(w=>{var C,k,S={text:(C=w.$el_text)==null?void 0:C.slice(0,400),tag_name:w.tag_name,href:(k=w.attr__href)==null?void 0:k.slice(0,2048),attr_class:O2(w),attr_id:w.attr__id,nth_child:w.nth_child,nth_of_type:w.nth_of_type,attributes:{}};return Xs(w).filter(D=>{var[F]=D;return F.indexOf("attr__")===0}).forEach(D=>{var[F,L]=D;return S.attributes[F]=L}),S})}(h)))},(n=f[0])!=null&&n.$el_text?{$el_text:(r=f[0])==null?void 0:r.$el_text}:{},d&&i.type==="click"?{$external_click_url:d}:{},p)}}var mi=fe("[ExceptionAutocapture]");function $h(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],i=n(r);return cn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}var F2=fe("[TracingHeaders]"),xn=fe("[Web Vitals]"),zh=9e5,Hh="disabled",jh="lazy_loading",gi="awaiting_config",Os="missing_config";fe("[SessionRecording]"),fe("[SessionRecording]");var ql="[SessionRecording]",kn=fe(ql),I2=fe("[Heatmaps]");function Vh(t){return ke(t)&&"clientX"in t&&"clientY"in t&&Tt(t.clientX)&&Tt(t.clientY)}var qh=fe("[Product Tours]"),P2=["$set_once","$set"],wn=fe("[SiteApps]"),Wh="Error while initializing PostHog app with config id ";function Ar(t,e,n){if(Y(t))return!1;switch(n){case"exact":return t===e;case"contains":var r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(r,"i").test(t);case"regex":try{return new RegExp(e).test(t)}catch{return!1}default:return!1}}class L2{constructor(e){this.dn=new Uc,this.vn=(n,r)=>this.fn(n,r)&&this.pn(n,r)&&this.gn(n,r)&&this.mn(n,r),this.fn=(n,r)=>r==null||!r.event||n?.event===r?.event,this._instance=e,this.yn=new Set,this.bn=new Set}init(){var e,n;P((e=this._instance)==null?void 0:e._addCaptureHook)||(n=this._instance)==null||n._addCaptureHook((r,i)=>{this.on(r,i)})}register(e){var n,r;if(!P((n=this._instance)==null?void 0:n._addCaptureHook)&&(e.forEach(o=>{var a,u;(a=this.bn)==null||a.add(o),(u=o.steps)==null||u.forEach(l=>{var c;(c=this.yn)==null||c.add(l?.event||"")})}),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(u=>{u!=null&&u.selector&&s.add(u?.selector)})}),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.yn.has(e)||this.yn.has(n?.event))&&this.bn&&((r=this.bn)==null?void 0:r.size)>0&&this.bn.forEach(i=>{this._n(n,i)&&this.dn.emit("actionCaptured",i.name)})}wn(e){this.onAction("actionCaptured",n=>e(n))}_n(e,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.vn(e,r))return!0;return!1}onAction(e,n){return this.dn.on(e,n)}pn(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Ar(i,n.url,n.url_matching||"contains"))return!1}return!0}gn(e,n){return!!this.In(e,n)&&!!this.Cn(e,n)&&!!this.Sn(e,n)}In(e,n){var r;if(n==null||!n.href)return!0;var i=this.xn(e);if(i.length>0)return i.some(a=>Ar(a.href,n.href,n.href_matching||"exact"));var s,o=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!o&&Ar((s=o.match(/(?::|")href="(.*?)"/))?s[1]:"",n.href,n.href_matching||"exact")}Cn(e,n){var r;if(n==null||!n.text)return!0;var i=this.xn(e);if(i.length>0)return i.some(l=>Ar(l.text,n.text,n.text_matching||"exact")||Ar(l.$el_text,n.text,n.text_matching||"exact"));var s,o,a,u=(e==null||(r=e.properties)==null?void 0:r.$elements_chain)||"";return!!u&&(s=function(l){for(var c,d=[],h=/(?::|")text="(.*?)"/g;!Y(c=h.exec(l));)d.includes(c[1])||d.push(c[1]);return d}(u),o=n.text,a=n.text_matching||"exact",s.some(l=>Ar(l,o,a)))}Sn(e,n){var r,i;if(n==null||!n.selector)return!0;var s=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(s!=null&&s.includes(n.selector))return!0;var o=(e==null||(i=e.properties)==null?void 0:i.$elements_chain)||"";if(n.selector_regex&&o)try{return new RegExp(n.selector_regex).test(o)}catch{return!1}return!1}xn(e){var n;return(e==null||(n=e.properties)==null?void 0:n.$elements)==null?[]:e?.properties.$elements}mn(e,n){return n==null||!n.properties||n.properties.length===0||bm(n.properties.reduce((r,i)=>{var s=Q(i.value)?i.value.map(String):i.value!=null?[String(i.value)]:[];return r[i.key]={values:s,operator:i.operator||"exact"},r},{}),e?.properties)}}class B2{constructor(e){this._instance=e,this.kn=new Map,this.Tn=new Map,this.An=new Map}En(e,n){return!!e&&bm(e.propertyFilters,n?.properties)}Rn(e,n){var r=new Map;return e.forEach(i=>{var s;(s=i.conditions)==null||(s=s[n])==null||(s=s.values)==null||s.forEach(o=>{if(o!=null&&o.name){var a=r.get(o.name)||[];a.push(i.id),r.set(o.name,a)}})}),r}Nn(e,n,r){var i=(r===ci.Activation?this.kn:this.Tn).get(e),s=[];return this.Mn(o=>{s=o.filter(a=>i?.includes(a.id))}),s.filter(o=>{var a,u=(a=o.conditions)==null||(a=a[r])==null||(a=a.values)==null?void 0:a.find(l=>l.name===e);return this.En(u,n)})}register(e){var n;P((n=this._instance)==null?void 0:n._addCaptureHook)||(this.Fn(e),this.On(e))}On(e){var n=e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.Pn==null&&(this.Pn=new L2(this._instance),this.Pn.init(),this.Pn.wn(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,u;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.Pn)==null||a.register(r.conditions.actions.values),(u=r.conditions)==null||(u=u.actions)==null||(u=u.values)==null||u.forEach(l=>{if(l&&l.name){var c=this.An.get(l.name);c&&c.push(r.id),this.An.set(l.name,c||[r.id])}}))}))}Fn(e){var n,r=e.filter(s=>{var o,a;return((o=s.conditions)==null?void 0:o.events)&&((a=s.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}),i=e.filter(s=>{var o,a;return((o=s.conditions)==null?void 0:o.cancelEvents)&&((a=s.conditions)==null||(a=a.cancelEvents)==null||(a=a.values)==null?void 0:a.length)>0});r.length===0&&i.length===0||((n=this._instance)==null||n._addCaptureHook((s,o)=>{this.onEvent(s,o)}),this.kn=this.Rn(e,ci.Activation),this.Tn=this.Rn(e,ci.Cancellation))}onEvent(e,n){var r,i=this.ue(),s=this.Ln(),o=this.Dn(),a=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[s])||[];if(o===e&&n&&a.length>0){var u,l;i.info("event matched, removing item from activated items",{event:e,eventPayload:n,existingActivatedItems:a});var c=(n==null||(u=n.properties)==null?void 0:u.$survey_id)||(n==null||(l=n.properties)==null?void 0:l.$product_tour_id);if(c){var d=a.indexOf(c);0>d||(a.splice(d,1),this.Bn(a))}}else{if(this.Tn.has(e)){var h=this.Nn(e,n,ci.Cancellation);h.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:h.map(p=>p.id)}),h.forEach(p=>{var m=a.indexOf(p.id);0>m||a.splice(m,1),this.jn(p.id)}),this.Bn(a))}if(this.kn.has(e)){i.info("event name matched",{event:e,eventPayload:n,items:this.kn.get(e)});var f=this.Nn(e,n,ci.Activation);this.Bn(a.concat(f.map(p=>p.id)||[]))}}}onAction(e){var n,r=this.Ln(),i=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[r])||[];this.An.has(e)&&this.Bn(i.concat(this.An.get(e)||[]))}Bn(e){var n=this.ue(),r=[...new Set(e)].filter(i=>!this.$n(i));n.info("updating activated items",{activatedItems:r}),this.qn(r)}getActivatedIds(){var e,n=this.Ln();return((e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[n])||[]}getEventToItemsMap(){return this.kn}Zn(){return this.Pn}}class $2 extends B2{constructor(e){super(e)}Ln(){return Sl}Dn(){return Si.SHOWN}Mn(e){var n;(n=this._instance)==null||n.getSurveys(e)}jn(e){var n;(n=this._instance)==null||n.cancelPendingSurvey(e)}ue(){return ie}qn(e){var n;(n=this._instance)==null||(n=n.persistence)==null||n.register({[Sl]:e})}$n(){return!1}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var gu="SDK is not enabled or survey functionality is not yet loaded",Uh="Disabled. Not loading surveys.",z2=E!=null&&E.location?Co(E.location.hash,"__posthog")||Co(location.hash,"state"):null,Kh="_postHogToolbarParams",Jh=fe("[Toolbar]"),Xe=fe("[FeatureFlags]"),Zn=fe("[FeatureFlags]",{debugEnabled:!0}),bu=`" failed. Feature flags didn't load in time.`,Gh=t=>{for(var e={},n=0;t.length>n;n++)e[t[n]]=!0;return e},Yh=t=>{var e={};for(var[n,r]of Xs(t||{}))r&&(e[n]=r);return e},tn=fe("[Error tracking]"),Zh="Refusing to render web experiment since the viewer is a likely bot",H2={icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!E&&Mo(e.href,t),not_regex:(t,e)=>!!E&&!Mo(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class Ue{get Lt(){return this._instance.config}constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{Ue.Hn("retrieved web experiments from the server"),n.Vn=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n.Vn&&(Ue.Hn("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n.Vn)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);me(a)&&s.variants[a]&&n.zn(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var u in s.variants){var l=s.variants[u];Ue.Un(l)&&n.zn(s.name,u,l.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(e){if(this._is_bot())Ue.Hn(Zh);else if(!this.Lt.disable_web_experiments){if(Y(this.Vn))return this.Vn=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ue.Hn("applying feature flags",e),e.forEach(n=>{var r;if(this.Vn&&(r=this.Vn)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this.Vn)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.zn(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=Ue.getWindowLocation();if(e!=null&&e.search){var n=wo(e?.search,"__experiment_id"),r=wo(e?.search,"__experiment_variant");n&&r&&(Ue.Hn("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.Yn(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.Lt.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this.Lt.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Lt.token),method:"GET",callback:s=>e(s.statusCode===200&&s.json&&s.json.experiments||[])})}Yn(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(Ue.Hn("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.zn(i[0].name,n,i[0].variants[n].transforms))}static Un(e){return!Y(e.conditions)&&Ue.Wn(e)&&Ue.Gn(e)}static Wn(e){var n;if(Y(e.conditions)||Y((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=Ue.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||H2[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E?.location}static Gn(e){var n;if(Y(e.conditions)||Y((n=e.conditions)==null?void 0:n.utm))return!0;var r=tm();if(r.utm_source){var i,s,o,a,u,l,c,d,h=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,f=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_medium||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_medium)==r.utm_medium,m=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==r.utm_term;return h&&p&&m&&f}return!1}static Hn(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;n>i;i++)r[i-1]=arguments[i];I.info("[WebExperiments] "+e,r)}zn(e,n,r){this._is_bot()?Ue.Hn(Zh):n!=="control"?r.forEach(i=>{if(i.selector){var s;Ue.Hn("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o?.forEach(a=>{var u=a;i.html&&(u.innerHTML=i.html),i.css&&u.setAttribute("style",i.css)})}}):Ue.Hn("Control variants leave the page unmodified.")}_is_bot(){return ft&&this._instance?mm(ft,this.Lt.custom_blocked_useragents):void 0}}var vt=fe("[Conversations]"),Xn="Conversations not available yet.",Ma={featureFlags:class{constructor(t){this.Xn=!1,this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.rs=!1,this.ns=!1,this._instance=t,this.featureFlagEventHandlers=[]}get Lt(){return this._instance.config}get ii(){return this._instance.persistence}ss(t){return this._instance.get_property(t)}os(){var t,e;return(t=(e=this.ii)==null?void 0:e._r(this.Lt.feature_flag_cache_ttl_ms))!==null&&t!==void 0&&t}ls(){return!!this.os()&&(this.ns||this.Kn||(this.ns=!0,Xe.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}us(){var t,e=(t=this.Lt.evaluation_contexts)!==null&&t!==void 0?t:this.Lt.evaluation_environments;return!this.Lt.evaluation_environments||this.Lt.evaluation_contexts||this.rs||(Xe.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.rs=!0),e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Xe.error("Invalid evaluation context found:",n,"Expected non-empty string"),r}):[]}hs(){return this.us().length>0}initialize(){var t,e,{config:n}=this._instance,r=(t=(e=n.bootstrap)==null?void 0:e.featureFlags)!==null&&t!==void 0?t:{};if(Object.keys(r).length){var i,s,o=(i=(s=n.bootstrap)==null?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(r).filter(l=>!!r[l]).reduce((l,c)=>(l[c]=r[c]||!1,l),{}),u=Object.keys(o).filter(l=>a[l]).reduce((l,c)=>(o[c]&&(l[c]=o[c]),l),{});this.receivedFeatureFlags({featureFlags:a,featureFlagPayloads:u})}}updateFlags(t,e,n){var r=n!=null&&n.merge?this.getFlagVariants():{},i=n!=null&&n.merge?this.getFlagPayloads():{},s=O({},r,t),o=O({},i,e),a={};for(var[u,l]of Object.entries(s)){var c=typeof l=="string";a[u]={key:u,enabled:!!c||!!l,variant:c?l:void 0,reason:void 0,metadata:P(o?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:o[u]}}}this.receivedFeatureFlags({flags:a})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.ss(kl),e=this.ss(on),n=this.ss(Nr);if(!n&&!e)return t||{};var r=ve({},t||{}),i=[...new Set([...Object.keys(n||{}),...Object.keys(e||{})])];for(var s of i){var o,a,u=r[s],l=e?.[s],c=P(l)?(o=u?.enabled)!==null&&o!==void 0&&o:!!l,d=P(l)?u.variant:typeof l=="string"?l:void 0,h=n?.[s],f=O({},u,{enabled:c,variant:c?d??u?.variant:void 0});c!==u?.enabled&&(f.original_enabled=u?.enabled),d!==u?.variant&&(f.original_variant=u?.variant),h&&(f.metadata=O({},u?.metadata,{payload:h,original_payload:u==null||(a=u.metadata)==null?void 0:a.payload})),r[s]=f}return this.Xn||(Xe.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:n,finalDetails:r}),this.Xn=!0),r}getFlagVariants(){var t=this.ss(zr),e=this.ss(on);if(!e)return t||{};for(var n=ve({},t),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.Xn||(Xe.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:e,finalFlags:n}),this.Xn=!0),n}getFlagPayloads(){var t=this.ss(wl),e=this.ss(Nr);if(!e)return t||{};for(var n=ve({},t||{}),r=Object.keys(e),i=0;r.length>i;i++)n[r[i]]=e[r[i]];return this.Xn||(Xe.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:e,finalPayloads:n}),this.Xn=!0),n}reloadFeatureFlags(){this.Qn||this.Lt.advanced_disable_feature_flags||this.cs||(this._instance.Mi.emit("featureFlagsReloading",!0),this.cs=setTimeout(()=>{this.ds()},5))}vs(){clearTimeout(this.cs),this.cs=void 0}ensureFlagsLoaded(){this.Jn||this.Kn||this.cs||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this.Qn=t}ds(t){var e;if(this.vs(),!this._instance.Mr())if(this.Kn)this.es=!0;else{var n=this.Lt.token,r=this.ss(po),i={token:n,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:O({},((e=this.ii)==null?void 0:e.get_initial_props())||{},this.ss(Ei)||{}),group_properties:this.ss(er),timezone:am()};vn(r)||P(r)||(i.$device_id=r),(t!=null&&t.disableFlags||this.Lt.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.hs()&&(i.evaluation_contexts=this.us());var s=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Lt.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Kn=!0,this._instance._send_request({method:"POST",url:s,data:i,compression:this.Lt.disable_compression?void 0:$t.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback:o=>{var a,u,l,c=!0;if(o.statusCode===200&&(this.es||(this.$anon_distinct_id=void 0),c=!1),this.Kn=!1,!i.disable_flags||this.es){this.ts=!c;var d=[];o.error?o.error instanceof Error?d.push(o.error.name==="AbortError"?"timeout":"connection_error"):d.push("unknown_error"):o.statusCode!==200&&d.push("api_error_"+o.statusCode),(a=o.json)!=null&&a.errorsWhileComputingFlags&&d.push("errors_while_computing_flags");var h,f=!((u=o.json)==null||(u=u.quotaLimited)==null||!u.includes("feature_flags"));f&&d.push("quota_limited"),(l=this.ii)==null||l.register({[Al]:d}),f?Xe.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(i.disable_flags||this.receivedFeatureFlags((h=o.json)!==null&&h!==void 0?h:{},c,{partialResponse:!!this.Lt.advanced_only_evaluate_survey_feature_flags}),this.es&&(this.es=!1,this.ds()))}}})}}getFeatureFlag(t,e){var n;if(e===void 0&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var r=this.getFeatureFlagResult(t,e);return(n=r?.variant)!==null&&n!==void 0?n:r?.enabled}}else Xe.warn('getFeatureFlag for key "'+t+bu)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){var e=this.getFeatureFlagResult(t,{send_event:!1});return e?.payload}getFeatureFlagResult(t,e){if(e===void 0&&(e={}),!e.fresh||this.ts)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.ls()){var n=this.getFlagVariants(),r=t in n,i=n[t],s=this.getFlagPayloads()[t],o=String(i),a=this.ss(Cl)||void 0,u=this.ss(go)||void 0,l=this.ss(Ri)||{};if(this.Lt.advanced_feature_flags_dedup_per_session){var c,d=this._instance.get_session_id(),h=this.ss(Ml);d&&d!==h&&(l={},(c=this.ii)==null||c.register({[Ri]:l,[Ml]:d}))}if((e.send_event||!("send_event"in e))&&(!(t in l)||!l[t].includes(o))){var f,p,m,g,b,v,_,x,y,w;Q(l[t])?l[t].push(o):l[t]=[o],(f=this.ii)==null||f.register({[Ri]:l});var C=this.getFeatureFlagDetails(t),k=[...(p=this.ss(Al))!==null&&p!==void 0?p:[]];P(i)&&k.push("flag_missing");var S={$feature_flag:t,$feature_flag_response:i,$feature_flag_payload:s||null,$feature_flag_request_id:a,$feature_flag_evaluated_at:u,$feature_flag_bootstrapped_response:((m=this.Lt.bootstrap)==null||(m=m.featureFlags)==null?void 0:m[t])||null,$feature_flag_bootstrapped_payload:((g=this.Lt.bootstrap)==null||(g=g.featureFlagPayloads)==null?void 0:g[t])||null,$used_bootstrap_value:!this.ts};P(C==null||(b=C.metadata)==null?void 0:b.version)||(S.$feature_flag_version=C.metadata.version);var D,F=(v=C==null||(_=C.reason)==null?void 0:_.description)!==null&&v!==void 0?v:C==null||(x=C.reason)==null?void 0:x.code;F&&(S.$feature_flag_reason=F),C!=null&&(y=C.metadata)!=null&&y.id&&(S.$feature_flag_id=C.metadata.id),P(C?.original_variant)&&P(C?.original_enabled)||(S.$feature_flag_original_response=P(C.original_variant)?C.original_enabled:C.original_variant),C!=null&&(w=C.metadata)!=null&&w.original_payload&&(S.$feature_flag_original_payload=C==null||(D=C.metadata)==null?void 0:D.original_payload),k.length&&(S.$feature_flag_error=k.join(",")),this._instance.capture("$feature_flag_called",S)}if(r){var L=s;if(!P(s))try{L=JSON.parse(s)}catch{}return{key:t,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:L}}}}else Xe.warn('getFeatureFlagResult for key "'+t+bu)}getRemoteConfigPayload(t,e){var n=this.Lt.token,r={distinct_id:this._instance.get_distinct_id(),token:n};this.hs()&&(r.evaluation_contexts=this.us()),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:r,compression:this.Lt.disable_compression?void 0:$t.Base64,timeout:this.Lt.feature_flag_request_timeout_ms,callback(i){var s,o=(s=i.json)==null?void 0:s.featureFlagPayloads;e(o?.[t]||void 0)}})}isFeatureEnabled(t,e){if(e===void 0&&(e={}),!e.fresh||this.ts){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var n=this.getFeatureFlag(t,e);return P(n)?void 0:!!n}Xe.warn('isFeatureEnabled for key "'+t+bu)}}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(e=>e!==t)}receivedFeatureFlags(t,e,n){if(this.ii){this.Jn=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,u,l,c,d){u===void 0&&(u={}),l===void 0&&(l={}),c===void 0&&(c={});var h=(k=>{var S=k.flags;return S?(k.featureFlags=Object.fromEntries(Object.keys(S).map(D=>{var F;return[D,(F=S[D].variant)!==null&&F!==void 0?F:S[D].enabled]})),k.featureFlagPayloads=Object.fromEntries(Object.keys(S).filter(D=>S[D].enabled).filter(D=>{var F;return(F=S[D].metadata)==null?void 0:F.payload}).map(D=>{var F;return[D,(F=S[D].metadata)==null?void 0:F.payload]}))):Xe.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),k})(o),f=h.flags,p=h.featureFlags,m=h.featureFlagPayloads;if(p){var g=o.requestId,b=o.evaluatedAt;if(Q(p)){Xe.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var v={};if(p)for(var _=0;p.length>_;_++)v[p[_]]=!0;a&&a.register({[Ys]:p,[zr]:v})}else{var x=p,y=m,w=f;if(d!=null&&d.partialResponse)x=O({},u,x),y=O({},l,y),w=O({},c,w);else if(o.errorsWhileComputingFlags)if(f){var C=new Set(Object.keys(f).filter(k=>{var S;return!((S=f[k])!=null&&S.failed)}));x=O({},u,Object.fromEntries(Object.entries(x).filter(k=>{var[S]=k;return C.has(S)}))),y=O({},l,Object.fromEntries(Object.entries(y||{}).filter(k=>{var[S]=k;return C.has(S)}))),w=O({},c,Object.fromEntries(Object.entries(w||{}).filter(k=>{var[S]=k;return C.has(S)})))}else x=O({},u,x),y=O({},l,y),w=O({},c,w);a&&a.register(O({[Ys]:Object.keys(Yh(x)),[zr]:x||{},[wl]:y||{},[kl]:w||{}},g?{[Cl]:g}:{},b?{[go]:b}:{}))}}})(t,this.ii,r,i,s,n),e||(this.ns=!1),this.fs(e)}}override(t,e){e===void 0&&(e=!1),Xe.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:e})}overrideFeatureFlags(t){if(!this._instance.__loaded||!this.ii)return Xe.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.ii.unregister(on),this.ii.unregister(Nr),this.fs(),Zn.info("All overrides cleared");if(Q(t)){var e=Gh(t);return this.ii.register({[on]:e}),this.fs(),Zn.info("Flag overrides set",{flags:t})}if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this.Xn=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.ii.unregister(on),Zn.info("Flag overrides cleared");else if(r.flags){if(Q(r.flags)){var i=Gh(r.flags);this.ii.register({[on]:i})}else this.ii.register({[on]:r.flags});Zn.info("Flag overrides set",{flags:r.flags})}}return"payloads"in r&&(r.payloads===!1?(this.ii.unregister(Nr),Zn.info("Payload overrides cleared")):r.payloads&&(this.ii.register({[Nr]:r.payloads}),Zn.info("Payload overrides set",{payloads:r.payloads}))),void this.fs()}if(t&&typeof t=="object")return this.ii.register({[on]:t}),this.fs(),Zn.info("Flag overrides set",{flags:t});Xe.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:t})}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this.Jn){var{flags:e,flagVariants:n}=this.ps();t(e,n)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,e,n){var r,i=(this.ss(Ci)||[]).find(u=>u.flagKey===t),s={["$feature_enrollment/"+t]:e},o={$feature_flag:t,$feature_enrollment:e,$set:s};i&&(o.$early_access_feature_name=i.name),n&&(o.$feature_enrollment_stage=n),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(s,!1);var a=O({},this.getFlagVariants(),{[t]:e});(r=this.ii)==null||r.register({[Ys]:Object.keys(Yh(a)),[zr]:a}),this.fs()}getEarlyAccessFeatures(t,e,n){e===void 0&&(e=!1);var r=this.ss(Ci),i=n?"&"+n.map(s=>"stage="+s).join("&"):"";if(r&&!e)return t(r);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Lt.token+i),method:"GET",callback:s=>{var o,a;if(s.json){var u=s.json.earlyAccessFeatures;return(o=this.ii)==null||o.unregister(Ci),(a=this.ii)==null||a.register({[Ci]:u}),t(u)}}})}ps(){var t=this.getFlags(),e=this.getFlagVariants();return{flags:t.filter(n=>e[n]),flagVariants:Object.keys(e).filter(n=>e[n]).reduce((n,r)=>(n[r]=e[r],n),{})}}fs(t){var{flags:e,flagVariants:n}=this.ps();this.featureFlagEventHandlers.forEach(r=>r(e,n,{errorsLoading:t}))}setPersonPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ss(Ei)||{},r=t?.$set||(t!=null&&t.$set_once?{}:t),i=t?.$set_once,s={};if(i)for(var o in i)({}).hasOwnProperty.call(i,o)&&(o in n||(s[o]=i[o]));this._instance.register({[Ei]:O({},n,s,r)}),e&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Ei)}setGroupPropertiesForFlags(t,e){e===void 0&&(e=!0);var n=this.ss(er)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=O({},n[r],t[r]),delete t[r]}),this._instance.register({[er]:O({},n,t)}),e&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var e=this.ss(er)||{};this._instance.register({[er]:O({},e,{[t]:{}})})}else this._instance.unregister(er)}reset(){this.Jn=!1,this.Kn=!1,this.Qn=!1,this.es=!1,this.ts=!1,this.$anon_distinct_id=void 0,this.vs(),this.Xn=!1}}},j2={sessionRecording:class{get Lt(){return this._instance.config}get ii(){return this._instance.persistence}get started(){var t;return!((t=this.gs)==null||!t.isStarted)}get status(){var t,e;return this.ys===gi||this.ys===Os?this.ys:(t=(e=this.gs)==null?void 0:e.status)!==null&&t!==void 0?t:this.ys}constructor(t){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=Hh,this.bs=void 0,this._instance=t,!this._instance.sessionManager)throw kn.error("started without valid sessionManager"),new Error(ql+" started without valid sessionManager. This is a bug.");if(this.Lt.cookieless_mode===dn)throw new Error(ql+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var t,e=!((t=this._instance.get_property(wi))==null||!t.enabled),n=!this.Lt.disable_session_recording,r=this.Lt.disable_session_recording||this._instance.consent.isOptedOut();return E&&e&&n&&!r}startIfEnabledOrStop(t){var e;if(!this._s||(e=this.gs)==null||!e.isStarted){var n=!P(Object.assign)&&!P(Array.from);this._s&&n?(this.ws(t),kn.info("starting")):(this.ys=Hh,this.stopRecording())}}ws(t){var e,n,r;this._s&&(this.ys!==gi&&this.ys!==Os&&(this.ys=jh),$!=null&&(e=$.__PosthogExtensions__)!=null&&(e=e.rrweb)!=null&&e.record&&(n=$.__PosthogExtensions__)!=null&&n.initSessionRecording?this.Is(t):(r=$.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Cs,i=>{if(i)return kn.error("could not load recorder",i);this.Is(t)}))}stopRecording(){var t,e;(t=this.bs)==null||t.call(this),this.bs=void 0,(e=this.gs)==null||e.stop()}Ss(){var t,e;(t=this.bs)==null||t.call(this),this.bs=void 0,(e=this.gs)==null||e.discard()}xs(){var t;(t=this.ii)==null||t.unregister(Hc)}ks(t,e){if(Y(t))return null;var n,r=Tt(t)?t:parseFloat(t);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(kn.warn(e+" must be between 0 and 1. Ignoring invalid value:",t),null):r}Ts(t){if(this.ii){var e,n,r=this.ii,i=()=>{var s,o=t.sessionRecording===!1?void 0:t.sessionRecording,a=this.ks((s=this.Lt.session_recording)==null?void 0:s.sampleRate,"session_recording.sampleRate"),u=this.ks(o?.sampleRate,"remote config sampleRate"),l=a??u;Y(l)&&this.xs();var c=o?.minimumDurationMilliseconds;r.register({[wi]:O({cache_timestamp:Date.now(),enabled:!!o},o,{networkPayloadCapture:O({capturePerformance:t.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:P(c)?null:c,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};i(),(e=this.bs)==null||e.call(this),this.bs=(n=this._instance.sessionManager)==null?void 0:n.onSessionId(i)}}onRemoteConfig(t){return"sessionRecording"in t?t.sessionRecording===!1?(this.Ts(t),void this.Ss()):(this.Ts(t),void this.startIfEnabledOrStop()):(this.ys===gi&&(this.ys=Os,kn.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(t,e){var n;e===void 0&&(e="log"),(n=this.gs)!=null&&n.log?this.gs.log(t,e):kn.warn("log called before recorder was ready")}get Cs(){var t,e,n=(t=this._instance)==null||(t=t.persistence)==null?void 0:t.get_property(wi);return(n==null||(e=n.scriptConfig)==null?void 0:e.script)||"lazy-recorder"}As(){var t,e=this._instance.get_property(wi);if(!e)return!1;var n=(t=(typeof e=="object"?e:JSON.parse(e)).cache_timestamp)!==null&&t!==void 0?t:Date.now();return 36e5>=Date.now()-n}Is(t){var e,n;if((e=$.__PosthogExtensions__)==null||!e.initSessionRecording)return kn.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Y0]:!0});if(this.gs||(this.gs=(n=$.__PosthogExtensions__)==null?void 0:n.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.As())return this.ys===Os||this.ys===gi?void 0:(this.ys=gi,kn.info("persisted remote config is stale, requesting fresh config before starting"),void new um(this._instance).load());this.ys=jh,this.gs.start(t)}onRRwebEmit(t){var e;(e=this.gs)==null||e.onRRwebEmit==null||e.onRRwebEmit(t)}overrideLinkedFlag(){var t,e;this.gs||(e=this.ii)==null||e.register({[q0]:!0}),(t=this.gs)==null||t.overrideLinkedFlag()}overrideSampling(){var t,e;this.gs||(e=this.ii)==null||e.register({[V0]:!0}),(t=this.gs)==null||t.overrideSampling()}overrideTrigger(t){var e,n;this.gs||(n=this.ii)==null||n.register({[t==="url"?W0:U0]:!0}),(e=this.gs)==null||e.overrideTrigger(t)}get sdkDebugProperties(){var t;return((t=this.gs)==null?void 0:t.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(t,e){var n;return!((n=this.gs)==null||!n.tryAddCustomEvent(t,e))}}},V2={autocapture:class{constructor(t){this.Es=!1,this.Rs=null,this.Ns=!1,this.instance=t,this.rageclicks=new Lh(t.config.rageclick),this.Ms=null}initialize(){this.startIfEnabled()}get Lt(){var t,e,n=ke(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(t=n.url_allowlist)==null?void 0:t.map(r=>new RegExp(r)),n.url_ignorelist=(e=n.url_ignorelist)==null?void 0:e.map(r=>new RegExp(r)),n}Fs(){if(this.isBrowserSupported()){if(E&&N){var t=n=>{n=n||E?.event;try{this.Os(n)}catch(r){Bh.error("Failed to capture event",r)}};if(Ee(N,"submit",t,{capture:!0}),Ee(N,"change",t,{capture:!0}),Ee(N,"click",t,{capture:!0}),this.Lt.capture_copied_text){var e=n=>{this.Os(n=n||E?.event,pu)};Ee(N,"copy",e,{capture:!0}),Ee(N,"cut",e,{capture:!0})}}}else Bh.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Es&&(this.Fs(),this.Es=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this.Ns=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[pl]:!!t.autocapture_opt_out}),this.Rs=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this.Ms=t}getElementSelectors(t){var e,n=[];return(e=this.Ms)==null||e.forEach(r=>{var i=N?.querySelectorAll(r);i?.forEach(s=>{t===s&&n.push(r)})}),n}get isEnabled(){var t,e,n=(t=this.instance.persistence)==null?void 0:t.props[pl];if(vn(this.Rs)&&!jt(n)&&!this.instance.Mr())return!1;var r=(e=this.Rs)!==null&&e!==void 0?e:!!n;return!!this.instance.config.autocapture&&!r}Os(t,e){if(e===void 0&&(e="$autocapture"),this.isEnabled){var n,r=Oh(t);_m(r)&&(r=r.parentNode||null),e==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,t.timeStamp||new Date().getTime())&&function(d,h){if(!E||jl(d))return!1;var f,p,m;if(jt(h)?(f=!!h&&Nh,p=void 0):(f=(m=h?.css_selector_ignorelist)!==null&&m!==void 0?m:Nh,p=h?.content_ignorelist),f===!1)return!1;var{targetElementList:g}=Fh(d,!1);return!function(b,v){if(b===!1||P(b))return!1;var _;if(b===!0)_=S2;else{if(!Q(b))return!1;if(b.length>10)return I.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;_=b.map(x=>x.toLowerCase())}return v.some(x=>{var{safeText:y,ariaLabel:w}=x;return _.some(C=>y.includes(C)||w.includes(C))})}(p,g.map(b=>{var v;return{safeText:Yi(b).toLowerCase(),ariaLabel:((v=b.getAttribute("aria-label"))==null?void 0:v.toLowerCase().trim())||""}}))&&!Rh(g,f)}(r,this.instance.config.rageclick)&&this.Os(t,"$rageclick");var i=e===pu;if(r&&function(d,h,f,p,m){var g,b,v,_;if(f===void 0&&(f=void 0),!E||jl(d)||(g=f)!=null&&g.url_allowlist&&!Dh(f.url_allowlist)||(b=f)!=null&&b.url_ignorelist&&Dh(f.url_ignorelist))return!1;if((v=f)!=null&&v.dom_event_allowlist){var x=f.dom_event_allowlist;if(x&&!x.some(S=>h.type===S))return!1}var{parentIsUsefulElement:y,targetElementList:w}=Fh(d,p);if(!function(S,D){var F=D?.element_allowlist;if(P(F))return!0;var L,j=function(X){if(F.some(ne=>X.tagName.toLowerCase()===ne))return{v:!0}};for(var W of S)if(L=j(W))return L.v;return!1}(w,f)||!Rh(w,(_=f)==null?void 0:_.css_selector_allowlist))return!1;var C=E.getComputedStyle(d);if(C&&C.getPropertyValue("cursor")==="pointer"&&h.type==="click")return!0;var k=d.tagName.toLowerCase();switch(k){case"html":return!1;case"form":return(m||["submit"]).indexOf(h.type)>=0;case"input":case"select":case"textarea":return(m||["change","click"]).indexOf(h.type)>=0;default:return y?(m||["click"]).indexOf(h.type)>=0:(m||["click"]).indexOf(h.type)>=0&&(Jc.indexOf(k)>-1||d.getAttribute("contenteditable")==="true")}}(r,t,this.Lt,i,i?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:o}=N2(r,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Lt.element_attribute_ignorelist,elementsChainAsString:this.Ns});if(o)return!1;var a=this.getElementSelectors(r);if(a&&a.length>0&&(s.$element_selectors=a),e===pu){var u,l=km(E==null||(u=E.getSelection())==null?void 0:u.toString()),c=t.type||"clipboard";if(!l)return!1;s.$selected_content=l,s.$copy_type=c}return this.instance.capture(e,s),!0}}}isBrowserSupported(){return cn(N?.querySelectorAll)}},historyAutocapture:class{constructor(t){var e;this._instance=t,this.Ps=(E==null||(e=E.location)==null?void 0:e.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(I.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.Ls&&this.Ls(),this.Ls=void 0,I.info("History API monitoring stopped")}monitorHistoryChanges(){var t,e;if(E&&E.history){var n=this;(t=E.history.pushState)!=null&&t.__posthog_wrapped__||$h(E.history,"pushState",r=>function(i,s,o){r.call(this,i,s,o),n.Ds("pushState")}),(e=E.history.replaceState)!=null&&e.__posthog_wrapped__||$h(E.history,"replaceState",r=>function(i,s,o){r.call(this,i,s,o),n.Ds("replaceState")}),this.Bs()}}Ds(t){try{var e,n=E==null||(e=E.location)==null?void 0:e.pathname;if(!n)return;n!==this.Ps&&this.isEnabled&&this._instance.capture(Fr,{navigation_type:t}),this.Ps=n}catch(r){I.error("Error capturing "+t+" pageview",r)}}Bs(){if(!this.Ls){var t=()=>{this.Ds("popstate")};Ee(E,"popstate",t),this.Ls=()=>{E&&E.removeEventListener("popstate",t)}}}},heatmaps:class{get Lt(){return this.instance.config}constructor(t){var e;this.js=!1,this.Es=!1,this.$s=null,this.instance=t,this.js=!((e=this.instance.persistence)==null||!e.props[ml]),this.rageclicks=new Lh(t.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var t=5e3;return ke(this.Lt.capture_heatmaps)&&this.Lt.capture_heatmaps.flush_interval_milliseconds&&(t=this.Lt.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Y(this.Lt.capture_heatmaps)?Y(this.Lt.enable_heatmaps)?this.js:this.Lt.enable_heatmaps:this.Lt.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.Es)return;I2.info("starting..."),this.qs(),this.Ot()}else{var t;clearInterval((t=this.$s)!==null&&t!==void 0?t:void 0),this.Zs(),this.getAndClearBuffer()}}onRemoteConfig(t){if("heatmaps"in t){var e=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ml]:e}),this.js=e,this.startIfEnabled()}}getAndClearBuffer(){var t=this.T;return this.T=void 0,t}Hs(t){this.At(t.originalEvent,"deadclick")}Ot(){this.$s&&clearInterval(this.$s),this.$s=N?.visibilityState==="visible"?setInterval(this.Ur.bind(this),this.flushIntervalMilliseconds):null}qs(){E&&N&&(this.Vs=this.Ur.bind(this),Ee(E,_o,this.Vs),this.zs=t=>this.At(t||E?.event),Ee(N,"click",this.zs,{capture:!0}),this.Us=t=>this.Ys(t||E?.event),Ee(N,"mousemove",this.Us,{capture:!0}),this.Ws=new ch(this.instance,Jv,this.Hs.bind(this)),this.Ws.startIfEnabledOrStop(),this.Gs=this.Ot.bind(this),Ee(N,yo,this.Gs),this.Es=!0)}Zs(){var t;E&&N&&(this.Vs&&E.removeEventListener(_o,this.Vs),this.zs&&N.removeEventListener("click",this.zs,{capture:!0}),this.Us&&N.removeEventListener("mousemove",this.Us,{capture:!0}),this.Gs&&N.removeEventListener(yo,this.Gs),clearTimeout(this.Xs),(t=this.Ws)==null||t.stop(),this.Es=!1)}Js(t,e){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=function(o,a,u){for(var l=o;l&&Sa(l)&&!$n(l,"body");){if(l===u)return!1;if(G(a,E?.getComputedStyle(l).position))return!0;l=wm(l)}return!1}(Oh(t),["fixed","sticky"],i);return{x:t.clientX+(s?0:r),y:t.clientY+(s?0:n),target_fixed:s,type:e}}At(t,e){var n;if(e===void 0&&(e="click"),!Th(t.target)&&Vh(t)){var r=this.Js(t,e);(n=this.rageclicks)!=null&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this.Ks(O({},r,{type:"rageclick"})),this.Ks(r)}}Ys(t){!Th(t.target)&&Vh(t)&&(clearTimeout(this.Xs),this.Xs=setTimeout(()=>{this.Ks(this.Js(t,"mousemove"))},500))}Ks(t){if(E){var e=E.location.href,n=this.Lt.custom_personal_data_properties,r=this.Lt.mask_personal_data_properties?[...Xr,...n||[]]:[],i=Ji(e,r,Gi);this.T=this.T||{},this.T[i]||(this.T[i]=[]),this.T[i].push(t)}}Ur(){this.T&&!$r(this.T)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:ch,webVitalsAutocapture:class{constructor(t){var e;this.js=!1,this.Es=!1,this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Qs=()=>{clearTimeout(this.eo),this.T.metrics.length!==0&&(this._instance.capture("$web_vitals",this.T.metrics.reduce((n,r)=>O({},n,{["$web_vitals_"+r.name+"_event"]:O({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.T={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.dt=n=>{var r,i=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(P(i))xn.error("Could not read session ID. Dropping metrics!");else{this.T=this.T||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.ro();P(s)||(Y(n?.name)||Y(n?.value)?xn.error("Invalid metric received",n):!this.io||this.io>n.value?(this.T.url!==s&&(this.Qs(),this.eo=setTimeout(this.Qs,this.flushToCaptureTimeoutMs)),P(this.T.url)&&(this.T.url=s),this.T.firstMetricTimestamp=P(this.T.firstMetricTimestamp)?Date.now():this.T.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.T.metrics.push(O({},n,{$current_url:s,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.T.metrics.length===this.allowedMetrics.length&&this.Qs()):xn.error("Ignoring metric with value >= "+this.io,n))}},this.no=()=>{if(!this.Es){var n,r,i,s,o=$.__PosthogExtensions__;P(o)||P(o.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:i,onINP:s}=o.postHogWebVitalsCallbacks),n&&r&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.dt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.dt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.dt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.dt.bind(this)),this.Es=!0):xn.error("web vitals callbacks not loaded - not starting")}},this._instance=t,this.js=!((e=this._instance.persistence)==null||!e.props[yl]),this.startIfEnabled()}get so(){return this._instance.config.capture_performance}get allowedMetrics(){var t,e,n=ke(this.so)?(t=this.so)==null?void 0:t.web_vitals_allowed_metrics:void 0;return Y(n)?((e=this._instance.persistence)==null?void 0:e.props[xl])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(ke(this.so)?this.so.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var t=ke(this.so)?this.so.web_vitals_attribution:void 0;return t!=null&&t}get io(){var t=ke(this.so)&&Tt(this.so.__web_vitals_max_value)?this.so.__web_vitals_max_value:zh;return t>0&&6e4>=t?zh:t}get isEnabled(){var t=ze?.protocol;if(t!=="http:"&&t!=="https:")return xn.info("Web Vitals are disabled on non-http/https protocols"),!1;var e=ke(this.so)?this.so.web_vitals:jt(this.so)?this.so:void 0;return jt(e)?e:this.js}startIfEnabled(){this.isEnabled&&!this.Es&&(xn.info("enabled, starting..."),this.lr(this.no))}onRemoteConfig(t){if("capturePerformance"in t){var e=ke(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=ke(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[yl]:e}),this._instance.persistence.register({[xl]:n})),this.js=e,this.startIfEnabled()}}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.postHogWebVitalsCallbacks?t():(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",r=>{r?xn.error("failed to load script",r):t()})}ro(){var t=E?E.location.href:void 0;if(t){var e=this._instance.config.custom_personal_data_properties,n=this._instance.config.mask_personal_data_properties?[...Xr,...e||[]]:[];return Ji(t,n,Gi)}xn.error("Could not determine current URL")}}},q2={exceptionObserver:class{constructor(t){var e,n,r;this.no=()=>{var i;if(E&&this.isEnabled&&(i=$.__PosthogExtensions__)!=null&&i.errorWrappingFunctions){var s=$.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=$.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=$.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.oo&&this.Lt.capture_unhandled_errors&&(this.oo=s(this.captureException.bind(this))),!this.ao&&this.Lt.capture_unhandled_rejections&&(this.ao=o(this.captureException.bind(this))),!this.lo&&this.Lt.capture_console_errors&&(this.lo=a(this.captureException.bind(this)))}catch(u){mi.error("failed to start",u),this.uo()}}},this._instance=t,this.ho=!((e=this._instance.persistence)==null||!e.props[gl]),this.co=new rv({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,Yt:mi}),this.Lt=this.do(),this.startIfEnabledOrStop()}do(){var t=this._instance.config.capture_exceptions,e={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ke(t)?e=O({},e,t):(P(t)?this.ho:t)&&(e=O({},e,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),e}get isEnabled(){return this.Lt.capture_console_errors||this.Lt.capture_unhandled_errors||this.Lt.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(mi.info("enabled"),this.uo(),this.lr(this.no)):this.uo()}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.errorWrappingFunctions&&t(),(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return mi.error("failed to load script",r);t()})}uo(){var t,e,n;(t=this.oo)==null||t.call(this),this.oo=void 0,(e=this.ao)==null||e.call(this),this.ao=void 0,(n=this.lo)==null||n.call(this),this.lo=void 0}onRemoteConfig(t){"autocaptureExceptions"in t&&(this.ho=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[gl]:this.ho}),this.Lt=this.do(),this.startIfEnabledOrStop())}onConfigChange(){this.Lt=this.do()}captureException(t){var e,n,r,i=(e=t==null||(n=t.$exception_list)==null||(n=n[0])==null?void 0:n.type)!==null&&e!==void 0?e:"Exception";this.co.consumeRateLimit(i)?mi.info("Skipping exception capture because of client rate limiting.",{exception:i}):(r=this._instance.exceptions)==null||r.sendExceptionEvent(t)}},exceptions:class{constructor(t){var e,n;this.vo=[],this.fo=new gv([new Cv,new Nv,new Sv,new Ev,new Ov,new Dv,new Av,new Rv],function(r){for(var i=arguments.length,s=new Array(i>1?i-1:0),o=1;i>o;o++)s[o-1]=arguments[o];return function(a,u){u===void 0&&(u=0);for(var l=[],c=a.split(`
|
|
2
|
+
`),d=u;c.length>d;d++){var h=c[d];if(1024>=h.length){var f=oh.test(h)?h.replace(oh,"$1"):h;if(!f.match(/\S*Error: /)){for(var p of s){var m=p(f,r);if(m){l.push(m);break}}if(l.length>=50)break}}}return function(g){if(!g.length)return[];var b=Array.from(g);return b.reverse(),b.slice(0,50).map(v=>{return O({},v,{filename:v.filename||(_=b,_[_.length-1]||{}).filename,function:v.function||Zr});var _})}(l)}}("web:javascript",_v,wv)),this._instance=t,this.vo=(e=(n=this._instance.persistence)==null?void 0:n.get_property(bl))!==null&&e!==void 0?e:[],this.po=fo(this.mo()),this.yo=new Iv(this.po)}onConfigChange(){this.po=fo(this.mo()),this.yo.setConfig(this.po)}onRemoteConfig(t){var e,n,r;if("errorTracking"in t){var i=(e=(n=t.errorTracking)==null?void 0:n.suppressionRules)!==null&&e!==void 0?e:[],s=(r=t.errorTracking)==null?void 0:r.captureExtensionExceptions;this.vo=i,this._instance.persistence&&this._instance.persistence.register({[bl]:this.vo,[vl]:s})}}get bo(){var t,e=!!this._instance.get_property(vl),n=this._instance.config.error_tracking.captureExtensionExceptions;return(t=n??e)!==null&&t!==void 0&&t}buildProperties(t,e){return this.fo.buildFromUnknown(t,{syntheticException:e?.syntheticException,mechanism:{handled:e?.handled}})}addExceptionStep(t,e){if(this.po.enabled)try{if(!me(t)||t.trim().length===0)return void tn.warn("Ignoring exception step because message must be a non-empty string");var n=this._o(e),{sanitizedProperties:r,droppedKeys:i}=function(s){if(!s)return{sanitizedProperties:{},droppedKeys:[]};var o=[];return{sanitizedProperties:Object.keys(s).reduce((a,u)=>Fv.has(u)?(o.push(u),a):(a[u]=s[u],a),{}),droppedKeys:o}}(n);i.length>0&&tn.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this.yo.add(O({[co]:t,[ho]:new Date().toISOString()},r))}catch(s){tn.error("Failed to add exception step. Ignoring breadcrumb.",s)}}sendExceptionEvent(t){try{var e=t.$exception_list;if(this.wo(e)){if(this.Io(e))return this.Co("Exception dropped: matched a suppression rule"),void tn.info("Skipping exception capture because a suppression rule matched");if(!this.bo&&this.So(e))return this.Co("Exception dropped: thrown by a browser extension"),void tn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.xo(e))return this.Co("Exception dropped: thrown by the PostHog SDK"),void tn.info("Skipping exception capture because it was thrown by the PostHog SDK")}var n=this.po.enabled&&Y(t.$exception_steps)?this.ko(t):t;try{var r=this._instance.capture("$exception",n,{_noTruncate:!0,_batchKey:"exceptionEvent",Qi:!0});return r&&this.yo.clear(),r}catch(i){return tn.error("Failed to capture exception event. Dropping this exception.",i),void this.yo.clear()}}catch(i){return void tn.error("Failed to process exception event. Ignoring this exception.",i)}}ko(t){try{var e=this.yo.getAttachable();return e.length===0?t:O({},t,{$exception_steps:e})}catch(n){return tn.error("Failed to read buffered exception steps. Capturing exception without steps.",n),t}}Co(t){this.po.enabled&&this.yo.add({[co]:t,[ho]:new Date().toISOString()})}_o(t){return ke(t)?O({},t):{}}mo(){var t,e;return(t=(e=this._instance.config.error_tracking)==null?void 0:e.exception_steps)!==null&&t!==void 0?t:{}}Io(t){if(t.length===0)return!1;var e=t.reduce((n,r)=>{var{type:i,value:s}=r;return me(i)&&i.length>0&&n.$exception_types.push(i),me(s)&&s.length>0&&n.$exception_values.push(s),n},{$exception_types:[],$exception_values:[]});return this.vo.some(n=>{var r=n.values.map(i=>{var s,o=gm[i.operator],a=Q(i.value)?i.value:[i.value],u=(s=e[i.key])!==null&&s!==void 0?s:[];return a.length>0&&o(a,u)});return n.type==="OR"?r.some(Boolean):r.every(Boolean)})}So(t){return t.flatMap(e=>{var n,r;return(n=(r=e.stacktrace)==null?void 0:r.frames)!==null&&n!==void 0?n:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}xo(t){if(t.length>0){var e,n,r,i,s=(e=(n=t[0].stacktrace)==null?void 0:n.frames)!==null&&e!==void 0?e:[],o=s[s.length-1];return(r=o==null||(i=o.filename)==null?void 0:i.includes("posthog.com/static"))!==null&&r!==void 0&&r}return!1}wo(t){return!Y(t)&&Q(t)}}},W2=O({productTours:class{get ii(){return this._instance.persistence}constructor(t){this.To=null,this.Ao=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){"productTours"in t&&(this.ii&&this.ii.register({[_l]:!!t.productTours}),this.loadIfEnabled())}loadIfEnabled(){var t,e;this.To||(t=this._instance).config.disable_product_tours||(e=t.persistence)==null||!e.get_property(_l)||this.lr(()=>this.Eo())}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.generateProductTours?t():(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"product-tours",r=>{r?qh.error("Could not load product tours script",r):t()})}Eo(){var t;!this.To&&(t=$.__PosthogExtensions__)!=null&&t.generateProductTours&&(this.To=$.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(t,e){if(e===void 0&&(e=!1),!Q(this.Ao)||e){var n=this.ii;if(n){var r=n.props[Zs];if(Q(r)&&!e)return this.Ao=r,void t(r,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:i=>{var s=i.statusCode;if(s!==200||!i.json){var o="Product Tours API could not be loaded, status: "+s;return qh.error(o),void t([],{isLoaded:!1,error:o})}var a=Q(i.json.product_tours)?i.json.product_tours:[];this.Ao=a,n&&n.register({[Zs]:a}),t(a,{isLoaded:!0})}})}else t(this.Ao,{isLoaded:!0})}getActiveProductTours(t){Y(this.To)?t([],{isLoaded:!1,error:"Product tours not loaded"}):this.To.getActiveProductTours(t)}showProductTour(t){var e;(e=this.To)==null||e.showTourById(t)}previewTour(t){this.To?this.To.previewTour(t):this.lr(()=>{var e;this.Eo(),(e=this.To)==null||e.previewTour(t)})}dismissProductTour(){var t;(t=this.To)==null||t.dismissTour("user_clicked_skip")}nextStep(){var t;(t=this.To)==null||t.nextStep()}previousStep(){var t;(t=this.To)==null||t.previousStep()}clearCache(){var t;this.Ao=null,(t=this.ii)==null||t.unregister(Zs)}resetTour(t){var e;(e=this.To)==null||e.resetTour(t)}resetAllTours(){var t;(t=this.To)==null||t.resetAllTours()}cancelPendingTour(t){var e;(e=this.To)==null||e.cancelPendingTour(t)}}},Ma),U2={siteApps:class{constructor(t){this._instance=t,this.Ro=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}No(t,e){if(e){var n=this.globalsForEvent(e);this.Ro.push(n),this.Ro.length>1e3&&(this.Ro=this.Ro.slice(10))}}get siteAppLoaders(){var t;return(t=$._POSTHOG_REMOTE_CONFIG)==null||(t=t[this._instance.config.token])==null?void 0:t.siteApps}initialize(){if(this.isEnabled){var t=this._instance._addCaptureHook(this.No.bind(this));this.Mo=()=>{t(),this.Ro=[],this.Mo=void 0}}}globalsForEvent(t){var e,n,r,i,s,o,a;if(!t)throw new Error("Event payload is required");var u={},l=this._instance.get_property("$groups")||[],c=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(c))u[d]={id:l[d],type:d,properties:h};var{$set_once:f,$set:p}=t;return{event:O({},b0(t,P2),{properties:O({},t.properties,p?{$set:O({},(e=(n=t.properties)==null?void 0:n.$set)!==null&&e!==void 0?e:{},p)}:{},f?{$set_once:O({},(r=(i=t.properties)==null?void 0:i.$set_once)!==null&&r!==void 0?r:{},f)}:{}),elements_chain:(s=(o=t.properties)==null?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=t.properties)==null?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(t){var e=this.apps[t.id],n=()=>{var o;!e.errored&&this.Ro.length&&(wn.info("Processing "+this.Ro.length+" events for site app with id "+t.id),this.Ro.forEach(a=>e.processEvent==null?void 0:e.processEvent(a)),e.processedBuffer=!0),Object.values(this.apps).every(a=>a.processedBuffer||a.errored)&&((o=this.Mo)==null||o.call(this))},r=!1,i=o=>{e.errored=!o,e.loaded=!0,wn.info("Site app with id "+t.id+" "+(o?"loaded":"errored")),r&&n()};try{var{processEvent:s}=t.init({posthog:this._instance,callback(o){i(o)}});s&&(e.processEvent=s),r=!0}catch(o){wn.error(Wh+t.id,o),i(!1)}if(r&&e.loaded)try{n()}catch(o){wn.error("Error while processing buffered events PostHog app with config id "+t.id,o),e.errored=!0}}Fo(){var t=this.siteAppLoaders||[];for(var e of t)this.apps[e.id]={id:e.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of t)this.setupSiteApp(n)}Oo(t){if(Object.keys(this.apps).length!==0){var e=this.globalsForEvent(t);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(e)}catch(r){wn.error("Error while processing event "+t.event+" for site app "+n.id,r)}}}onRemoteConfig(t){var e,n,r,i=this;if((e=this.siteAppLoaders)!=null&&e.length)return this.isEnabled?(this.Fo(),void this._instance.on("eventCaptured",u=>this.Oo(u))):void wn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.Mo)==null||n.call(this),(r=t.siteApps)!=null&&r.length)if(this.isEnabled){var s=function(u){var l;$["__$$ph_site_app_"+u]=i._instance,(l=$.__PosthogExtensions__)==null||l.loadSiteApp==null||l.loadSiteApp(i._instance,a,c=>{if(c)return wn.error(Wh+u,c)})};for(var{id:o,url:a}of t.siteApps)s(o)}else wn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},K2={tracingHeaders:class{constructor(t){this.Po=void 0,this.Lo=void 0,this.no=()=>{var e,n,r=this.Do()||[];P(this.Po)&&((e=$.__PosthogExtensions__)==null||(e=e.tracingHeadersPatchFns)==null||e._patchXHR(r,this._instance.get_distinct_id(),this._instance.sessionManager)),P(this.Lo)&&((n=$.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(r,this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=t}initialize(){this.startIfEnabledOrStop()}lr(t){var e,n;(e=$.__PosthogExtensions__)!=null&&e.tracingHeadersPatchFns&&t(),(n=$.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return F2.error("failed to load script",r);t()})}Do(){var t;return(t=this._instance.config.addTracingHeaders)!==null&&t!==void 0?t:this._instance.config.__add_tracing_headers}startIfEnabledOrStop(){var t,e;this.Do()?this.lr(this.no):((t=this.Po)==null||t.call(this),(e=this.Lo)==null||e.call(this),this.Po=void 0,this.Lo=void 0)}}},J2=O({surveys:class{get Lt(){return this._instance.config}constructor(t){this.Bo=void 0,this._surveyManager=null,this.jo=!1,this.$o=[],this.qo=null,this._instance=t,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this.Lt.disable_surveys){var e=t.surveys;if(Y(e))return ie.warn("Flags not loaded yet. Not loading surveys.");var n=Q(e);this.Bo=n?e.length>0:e,ie.info("flags response received, isSurveysEnabled: "+this.Bo),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var t=[],e=0;e<localStorage.length;e++){var n=localStorage.key(e);(n!=null&&n.startsWith(zl)||n!=null&&n.startsWith("inProgressSurvey_"))&&t.push(n)}t.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this._surveyManager)if(this.jo)ie.info("Already initializing surveys, skipping...");else if(this.Lt.disable_surveys)ie.info(Uh);else if(this.Lt.cookieless_mode&&this._instance.consent.isOptedOut())ie.info("Not loading surveys in cookieless mode without consent.");else{var t=$?.__PosthogExtensions__;if(t){if(!P(this.Bo)||this.Lt.advanced_enable_surveys){var e=this.Bo||this.Lt.advanced_enable_surveys;this.jo=!0;try{var n=t.generateSurveys;if(n)return void this.Zo(n,e);var r=t.loadExternalDependency;if(!r)return void this.Ho(jc);r(this._instance,"surveys",i=>{i||!t.generateSurveys?this.Ho("Could not load surveys script",i):this.Zo(t.generateSurveys,e)})}catch(i){throw this.Ho("Error initializing surveys",i),i}finally{this.jo=!1}}}else ie.error("PostHog Extensions not found.")}}Zo(t,e){this._surveyManager=t(this._instance,e),this._surveyEventReceiver=new $2(this._instance),ie.info("Surveys loaded successfully"),this.Vo({isLoaded:!0})}Ho(t,e){ie.error(t,e),this.Vo({isLoaded:!1,error:t})}onSurveysLoaded(t){return this.$o.push(t),this._surveyManager&&this.Vo({isLoaded:!0}),()=>{this.$o=this.$o.filter(e=>e!==t)}}getSurveys(t,e){if(e===void 0&&(e=!1),this.Lt.disable_surveys)return ie.info(Uh),t([]);var n,r=this._instance.get_property(El);if(r&&!e)return t(r,{isLoaded:!0});typeof Promise<"u"&&this.qo?this.qo.then(i=>{var{surveys:s,context:o}=i;return t(s,o)}):(typeof Promise<"u"&&(this.qo=new Promise(i=>{n=i})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Lt.token),method:"GET",timeout:this.Lt.surveys_request_timeout_ms,callback:i=>{var s;this.qo=null;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;ie.error(a);var u={isLoaded:!1,error:a};return t([],u),void(n==null||n({surveys:[],context:u}))}var l,c=i.json.surveys||[],d=c.filter(f=>function(p){return!(!p.start_date||p.end_date)}(f)&&(function(p){var m;return!((m=p.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)}(f)||function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)}(f)));d.length>0&&((l=this._surveyEventReceiver)==null||l.register(d)),(s=this._instance.persistence)==null||s.register({[El]:c});var h={isLoaded:!0};t(c,h),n?.({surveys:c,context:h})}}))}Vo(t){for(var e of this.$o)try{if(!t.isLoaded)return e([],t);this.getSurveys(e)}catch(n){ie.error("Error in survey callback",n)}}getActiveMatchingSurveys(t,e){if(e===void 0&&(e=!1),!Y(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(t,e);ie.warn("init was not called")}zo(t){var e=null;return this.getSurveys(n=>{var r;e=(r=n.find(i=>i.id===t))!==null&&r!==void 0?r:null}),e}Uo(t){if(Y(this._surveyManager))return{eligible:!1,reason:gu};var e=typeof t=="string"?this.zo(t):t;return e?this._surveyManager.checkSurveyEligibility(e):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(t){if(Y(this._surveyManager))return ie.warn("init was not called"),{visible:!1,disabledReason:gu};var e=this.Uo(t);return{visible:e.eligible,disabledReason:e.reason}}canRenderSurveyAsync(t,e){return Y(this._surveyManager)?(ie.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:gu})):new Promise(n=>{this.getSurveys(r=>{var i,s=(i=r.find(a=>a.id===t))!==null&&i!==void 0?i:null;if(s){var o=this.Uo(s);n({visible:o.eligible,disabledReason:o.reason})}else n({visible:!1,disabledReason:"Survey not found"})},e)})}renderSurvey(t,e,n){var r;if(Y(this._surveyManager))ie.warn("init was not called");else{var i=typeof t=="string"?this.zo(t):t;if(i!=null&&i.id)if(y2.includes(i.type)){var s=N?.querySelector(e);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(ie.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;ie.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s,n),ie.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s,n);ie.warn("Survey element not found")}else ie.warn("Surveys of type "+i.type+" cannot be rendered in the app");else ie.warn("Survey not found")}}displaySurvey(t,e){var n;if(Y(this._surveyManager))ie.warn("init was not called");else{var r=this.zo(t);if(r){var i=r;if((n=r.appearance)!=null&&n.surveyPopupDelaySeconds&&e.ignoreDelay&&(i=O({},r,{appearance:O({},r.appearance,{surveyPopupDelaySeconds:0})})),e.displayType!==Fl.Popover&&e.initialResponses&&ie.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),e.ignoreConditions===!1){var s=this.canRenderSurvey(r);if(!s.visible)return void ie.warn("Survey is not eligible to be displayed: ",s.disabledReason)}e.displayType!==Fl.Inline?this._surveyManager.handlePopoverSurvey(i,e):this.renderSurvey(i,e.selector,e.properties)}else ie.warn("Survey not found")}}cancelPendingSurvey(t){Y(this._surveyManager)?ie.warn("init was not called"):this._surveyManager.cancelSurvey(t)}handlePageUnload(){var t;(t=this._surveyManager)==null||t.handlePageUnload()}}},Ma),G2={toolbar:class{constructor(t){this.instance=t}Yo(t){$.ph_toolbar_state=t}Wo(){var t;return(t=$.ph_toolbar_state)!==null&&t!==void 0?t:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(t,e,n){if(t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),Z0(this.instance.config)||!E||!N)return!1;t=t??E.location,n=n??E.history;try{if(!e){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}e=E?.localStorage}var r,i=z2||Co(t.hash,"__posthog")||Co(t.hash,"state"),s=i?uh(()=>JSON.parse(atob(decodeURIComponent(i))))||uh(()=>JSON.parse(decodeURIComponent(i))):null;return s&&s.action==="ph_authorize"?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?t.hash=s.desiredHash:n?n.replaceState(n.state,"",t.pathname+t.search):t.hash="")):((r=JSON.parse(e.getItem(Kh)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch{return!1}}Go(t){var e=$.ph_load_toolbar||$.ph_load_editor;!Y(e)&&cn(e)?e(t,this.instance):Jh.warn("No toolbar load function found")}loadToolbar(t){var e=!(N==null||!N.getElementById(K0));if(!E||e)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=O({token:this.instance.config.token},t,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(E.localStorage.setItem(Kh,JSON.stringify(O({},r,{source:void 0}))),this.Wo()===2)this.Go(r);else if(this.Wo()===0){var i;this.Yo(1),(i=$.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"toolbar",s=>{if(s)return Jh.error("[Toolbar] Failed to load",s),void this.Yo(0);this.Yo(2),this.Go(r)}),Ee(E,"turbolinks:load",()=>{this.Yo(0),this.loadToolbar(r)})}return!0}Xo(t){return this.loadToolbar(t)}maybeLoadEditor(t,e,n){return t===void 0&&(t=void 0),e===void 0&&(e=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(t,e,n)}}},Y2=O({experiments:Ue},Ma),Z2={conversations:class{constructor(t){this.Jo=void 0,this._conversationsManager=null,this.Ko=!1,this.Qo=null,this._instance=t}initialize(){this.loadIfEnabled()}onRemoteConfig(t){if(!this._instance.config.disable_conversations){var e=t.conversations;Y(e)||(jt(e)?this.Jo=e:(this.Jo=e.enabled,this.Qo=e),this.loadIfEnabled())}}reset(){var t;(t=this._conversationsManager)==null||t.reset(),this._conversationsManager=null,this.Jo=void 0,this.Qo=null}loadIfEnabled(){if(!(this._conversationsManager||this.Ko||this._instance.config.disable_conversations||Z0(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var t=$?.__PosthogExtensions__;if(t&&!P(this.Jo)&&this.Jo)if(this.Qo&&this.Qo.token){this.Ko=!0;try{var e=t.initConversations;if(e)return this.ea(e),void(this.Ko=!1);var n=t.loadExternalDependency;if(!n)return void this.ta(jc);n(this._instance,"conversations",r=>{r||!t.initConversations?this.ta("Could not load conversations script",r):this.ea(t.initConversations),this.Ko=!1})}catch(r){this.ta("Error initializing conversations",r),this.Ko=!1}}else vt.error("Conversations enabled but missing token in remote config.")}}ea(t){if(this.Qo)try{this._conversationsManager=t(this.Qo,this._instance),vt.info("Conversations loaded successfully")}catch(e){this.ta("Error completing conversations initialization",e)}else vt.error("Cannot complete initialization: remote config is null")}ta(t,e){vt.error(t,e),this._conversationsManager=null,this.Ko=!1}show(){this._conversationsManager?this._conversationsManager.show():vt.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Jo===!0&&!vn(this._conversationsManager)}isVisible(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.isVisible())!==null&&t!==void 0&&t}sendMessage(t,e,n){var r=this;return kt(function*(){return r._conversationsManager?r._conversationsManager.sendMessage(t,e,n):(vt.warn(Xn),null)})()}getMessages(t,e){var n=this;return kt(function*(){return n._conversationsManager?n._conversationsManager.getMessages(t,e):(vt.warn(Xn),null)})()}markAsRead(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.markAsRead(t):(vt.warn(Xn),null)})()}getTickets(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.getTickets(t):(vt.warn(Xn),null)})()}requestRestoreLink(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.requestRestoreLink(t):(vt.warn(Xn),null)})()}restoreFromToken(t){var e=this;return kt(function*(){return e._conversationsManager?e._conversationsManager.restoreFromToken(t):(vt.warn(Xn),null)})()}restoreFromUrlToken(){var t=this;return kt(function*(){return t._conversationsManager?t._conversationsManager.restoreFromUrlToken():(vt.warn(Xn),null)})()}getCurrentTicketId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getCurrentTicketId())!==null&&t!==void 0?t:null}getWidgetSessionId(){var t,e;return(t=(e=this._conversationsManager)==null?void 0:e.getWidgetSessionId())!==null&&t!==void 0?t:null}ln(){var t;(t=this._conversationsManager)==null||t.setIdentity()}un(){var t;(t=this._conversationsManager)==null||t.clearIdentity()}}},X2={logs:class{constructor(t){var e;this.ra=!1,this.ia=!1,this.Yt=fe("[logs]"),this.na=[],this.sa=0,this.oa=0,this.aa=!1,this._instance=t,this._instance&&(e=this._instance.config.logs)!=null&&e.captureConsoleLogs&&(this.ra=!0)}initialize(){this.loadIfEnabled()}onRemoteConfig(t){var e,n=(e=t.logs)==null?void 0:e.captureConsoleLogs;!Y(n)&&n&&(this.ra=!0,this.loadIfEnabled())}reset(){this.na=[],this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.sa=0,this.oa=0,this.aa=!1}loadIfEnabled(){if(this.ra&&!this.ia){var t=$?.__PosthogExtensions__;if(t){var e=t.loadExternalDependency;e?e(this._instance,"logs",n=>{var r;n||(r=t.logs)==null||!r.initializeLogs?this.Yt.error("Could not load logs script",n):(t.logs.initializeLogs(this._instance),this.ia=!0)}):this.Yt.error(jc)}else this.Yt.error("PostHog Extensions not found.")}}captureLog(t){var e,n,r,i,s,o;if(this._instance.is_capturing())if(t&&t.body){var a=(e=(n=this._instance.config.logs)==null?void 0:n.flushIntervalMs)!==null&&e!==void 0?e:3e3,u=(r=(i=this._instance.config.logs)==null?void 0:i.maxLogsPerInterval)!==null&&r!==void 0?r:1e3,l=Date.now();if(a>l-this.oa||(this.oa=l,this.sa=0,this.aa=!1),u>this.sa){this.sa++;var c=function(d,h){var f=d.level||"info",{text:p,number:m}=L0[f]||pv,g=String(Date.now())+"000000",b={};h.distinctId&&(b.posthogDistinctId=h.distinctId),h.sessionId&&(b.sessionId=h.sessionId),h.currentUrl&&(b["url.full"]=h.currentUrl),h.screenName&&(b["screen.name"]=h.screenName),h.appState&&(b["app.state"]=h.appState),h.activeFeatureFlags&&h.activeFeatureFlags.length>0&&(b.feature_flags=h.activeFeatureFlags);var v=O({},b,d.attributes||{}),_={timeUnixNano:g,observedTimeUnixNano:g,severityNumber:m,severityText:p,body:{stringValue:d.body},attributes:sh(v)};return d.trace_id&&(_.traceId=d.trace_id),d.span_id&&(_.spanId=d.span_id),P(d.trace_flags)||(_.flags=d.trace_flags),_}(t,this.la());this.na.push({record:c}),((s=(o=this._instance.config.logs)==null?void 0:o.maxBufferSize)!==null&&s!==void 0?s:100)>this.na.length?this.ua():this.flushLogs()}else this.aa||(this.Yt.warn("captureLog dropping logs: exceeded "+u+" logs per "+a+"ms"),this.aa=!0)}else this.Yt.warn("captureLog requires a body")}get logger(){return this.ha||(this.ha={trace:(t,e)=>this.captureLog({body:t,level:"trace",attributes:e}),debug:(t,e)=>this.captureLog({body:t,level:"debug",attributes:e}),info:(t,e)=>this.captureLog({body:t,level:"info",attributes:e}),warn:(t,e)=>this.captureLog({body:t,level:"warn",attributes:e}),error:(t,e)=>this.captureLog({body:t,level:"error",attributes:e}),fatal:(t,e)=>this.captureLog({body:t,level:"fatal",attributes:e})}),this.ha}flushLogs(t){if(this.Br&&(clearTimeout(this.Br),this.Br=void 0),this.na.length!==0){var e=this.na;this.na=[];var n=this._instance.config.logs,r=O({"service.name":n?.serviceName||"unknown_service"},n?.environment&&{"deployment.environment":n.environment},n?.serviceVersion&&{"service.version":n.serviceVersion},n?.resourceAttributes),i=function(o,a,u,l){return{resourceLogs:[{resource:{attributes:sh(a)},scopeLogs:[{scope:{name:u,version:l},logRecords:o}]}]}}(e.map(o=>o.record),r,et.LIB_NAME,et.LIB_VERSION),s=this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token);this._instance.Zi({method:"POST",url:s,data:i,compression:"best-available",batchKey:"logs",transport:t})}}ua(){var t,e;this.Br||(this.Br=setTimeout(()=>{this.Br=void 0,this.flushLogs()},(t=(e=this._instance.config.logs)==null?void 0:e.flushIntervalMs)!==null&&t!==void 0?t:3e3))}la(){var t,e={};if(e.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:n}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);e.sessionId=n}if($!=null&&(t=$.location)!=null&&t.href&&(e.currentUrl=$.location.href),this._instance.featureFlags){var r=this._instance.featureFlags.getFlags();r&&r.length>0&&(e.activeFeatureFlags=r)}return e}}},Q2=O({},Ma,j2,V2,q2,W2,U2,J2,K2,G2,Y2,Z2,X2);Ct.__defaultExtensionClasses=O({},Q2);var Xh,vu=(Xh=Fi[Ir]=new Ct,function(){function t(){t.done||(t.done=!0,ym=!1,ce(Fi,function(e){e._dom_loaded()}))}N!=null&&N.addEventListener?N.readyState==="complete"?t():Ee(N,"DOMContentLoaded",t,{capture:!1}):E&&I.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),Xh);const ey=({client:t})=>{const[e,n]=Z(!1),[r,i]=Z({x:0,y:0}),[s,o]=Z(0),a=De(null),u=window.innerWidth<768,l=t.plugin.getUserInfo().context_menu_on_select,c=t.plugin.getPluginInfo().installedPlugins.flatMap(h=>h.context_menu_actions).filter(Boolean),d=(h,f=0)=>{const p=window.getSelection();if(!p||!h)return{x:0,y:0,text:h};const g=p.getRangeAt(0).getBoundingClientRect(),b=g.left+g.width/2-f/2,v=g.bottom+12;return{x:b,y:v,text:h}};return J(()=>{t.event.on("global.contextMenu.createActions",({data:h})=>{c.push(...h.actions)})},[]),J(()=>{e&&a.current&&o(a.current.offsetWidth)},[e]),J(()=>{const h=m=>{var g;const b=(g=window.getSelection())===null||g===void 0?void 0:g.toString().trim();e&&b===r.text||i(u&&b?d(b,s):{x:m.clientX,y:m.clientY,text:b})},f=m=>{var g,b;const v=(g=window.getSelection())===null||g===void 0?void 0:g.toString().trim();if(a.current&&a.current.contains(m.target))return;const _=m.target;if(_&&(_.tagName==="TEXTAREA"||_.tagName==="INPUT"&&_.type==="text")){n(!1);return}m.button===0&&e?(n(!1),(b=window.getSelection())===null||b===void 0||b.removeAllRanges()):v&&(l||m.button===2)?(m.button===2&&m.preventDefault(),i(u?d(v,s):{x:m.clientX,y:m.clientY,text:v}),n(!0)):n(!1)},p=()=>{var m;const g=(m=window.getSelection())===null||m===void 0?void 0:m.toString().trim();!g&&e?n(!1):g&&e&&u&&i(d(g,s))};return document.addEventListener("mouseup",f),window.addEventListener("mousemove",h),document.addEventListener("contextmenu",f),document.addEventListener("selectionchange",p),()=>{document.removeEventListener("mouseup",f),window.removeEventListener("mousemove",h),document.removeEventListener("contextmenu",f),document.removeEventListener("selectionchange",p)}},[l,e,r.text]),e?A("div",{ref:a,className:"fixed bg-gray-400 dark:bg-gray-700 shadow-lg border border-gray-400 rounded-md overflow-hidden dark:text-white z-50",style:{top:r.y,left:r.x},children:c.map((h,f)=>A(ty,{iconUrl:h.iconUrl,text:h.text,onClick:()=>{var p;n(!1),(p=window.getSelection())===null||p===void 0||p.removeAllRanges(),t.event.emitSidebarAction(h.plugin_id,h.action_key,r.text)}},f))}):null};function ty(t){return Me("button",{onClick:t.onClick,className:"px-2 md:px-4 py-2 text-left hover:bg-gray-500 dark:hover:bg-gray-600 w-full flex flex-row",children:[t.iconUrl&&A("span",{className:"flex-grow",children:A("img",{src:t.iconUrl,alt:t.text,className:"w-4 h-4 mr-2"})}),A("span",{className:"flex-grow",children:t.text})]})}function Gc(t="system",e=!1){const n=t==="system"?ny():t==="dark";if(e)return{isDark:n,theme:t,isDisabled:e};const r=document.documentElement;return r.dataset.theme=n?"dark":"light",r.style.colorScheme=n?"dark":"light",r.classList[n?"add":"remove"]("dark"),document.querySelector("#root").classList.add("dark:bg-gradient-to-br","dark:from-gray-900","dark:to-gray-800","dark:text-white","min-h-screen","bg-fixed"),{isDark:n,theme:t,isDisabled:e}}function ny(){return window.matchMedia("(prefers-color-scheme: dark)").matches}var ry=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Am=Nc(null),iy=({children:t,pluginId:e,client:n,userInfo:r,settings:i})=>{const s=!!n,[o,a]=Z(n??null),[u,l]=Z(!1),[c,d]=Z(null),[h,f]=Z(void 0),[p,m]=Z(r??null);J(()=>{s&&(n&&a(n),r&&m(r))},[n,r,s]),Gc(h,s),J(()=>{vu.__loaded||vu.init("phc_l4vPVZxtjlcQUDivoh5TaUL6oDe8K2lig89405cGnsv",{cookieless_mode:"always",api_host:"https://c.rimori.se",defaults:"2026-01-30",loaded:v=>{v.register({application:"frontend",pluginId:e})}})},[]);const g=c==="sidebar",b=c==="settings";return J(()=>{if(s)return;oy(e);const v=window===window.parent;v&&!u&&Yd.getInstance().then(_=>{_.needsLogin().then(x=>l(x?_:!0))}),(!v&&!o||v&&u===!0)&&qb.getInstance(e).then(_=>{a(_),m(_.plugin.getUserInfo()),v||(f(_.plugin.theme),d(_.plugin.applicationMode),_.event.emit("self.rimori.triggerInitFinished"))})},[e,u,o,s]),J(()=>{p?.user_id&&vu.identify(p.user_id)},[p?.user_id]),J(()=>{if(!o)return;const v=o.plugin.onRimoriInfoUpdate(_=>{m(_.profile)});return()=>v()},[o]),J(()=>{if(!o||g||s)return;const v=history.pushState;history.pushState=(..._)=>{const x=v.apply(history,_);return o.event.emit("session.triggerUrlChange",{url:location.hash}),x}},[o,g,s]),J(()=>{if(!o||s)return;const v=()=>{const x=document.documentElement.scrollHeight>window.innerHeight;o.event.emit("session.triggerScrollbarChange",{hasScrollbar:x})};v(),window.addEventListener("resize",v);const _=new ResizeObserver(()=>v());return _.observe(document.body),()=>{window.removeEventListener("resize",v),_.disconnect()}},[o,s]),u instanceof Yd?A(ay,{onLogin:(v,_)=>ry(void 0,void 0,void 0,function*(){(yield u.login(v,_))&&l(!0)})}):!o||!p?"":Me(Am.Provider,{value:{client:o,userInfo:p},children:[!i?.disableContextMenu&&!g&&!b&&A(ey,{client:o}),t]})},Gt=()=>{const t=h0(Am);if(t===null)throw new Error("useRimori must be used within an PluginProvider");return Object.assign(t.client,{userInfo:t.userInfo})};function sy(t){const e=window.location.hash.split("?");if(e.length>1){const i=new URLSearchParams(e[1]).get(t);if(i)return i}return new URL(window.location.href).searchParams.get(t)}function oy(t){const e=sy("applicationMode")==="sidebar";Wb.getInstance("Plugin EventBus "+t+" "+(e?"sidebar":"main"))}function ay({onLogin:t}){const[e,n]=Z(""),[r,i]=Z("");return A("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)"},children:Me("div",{style:{backgroundColor:"#343534",padding:"1rem",borderRadius:"0.5rem",width:"500px",flexDirection:"column",display:"flex",alignItems:"center",justifyContent:"center"},children:[A("p",{style:{fontSize:"2rem",fontWeight:"bold",marginBottom:"1rem",textAlign:"center"},children:"Rimori Login Required"}),A("p",{style:{marginBottom:"1rem",textAlign:"center"},children:"Please login with your Rimori developer account for this plugin to be able to access the Rimori platform the same way it would when being deployed."}),A("input",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#444444"},type:"email",placeholder:"Email",onChange:s=>n(s.target.value)}),A("input",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#444444"},type:"password",placeholder:"Password",onChange:s=>i(s.target.value)}),A("button",{style:{marginBottom:"1rem",width:"100%",padding:"0.5rem",borderRadius:"0.5rem",border:"none",backgroundColor:"#928358"},onClick:()=>{t(e,r)},children:"Login"})]})})}function Tm(t,e){const[n,r]=oe.useState([]),[i,s]=oe.useState(!1),{ai:o}=Gt(),a=oe.useRef({prompt:e?.prompt,promptVariables:e?.promptVariables}),u=oe.useCallback(c=>{a.current=Object.assign(Object.assign({},a.current),c)},[]);return{messages:n,append:c=>{var d,h;const f=[...n,...c];r(f),s(!0);const p=(d=a.current.promptVariables)!==null&&d!==void 0?d:e?.promptVariables,m=(h=a.current.prompt)!==null&&h!==void 0?h:e?.prompt;o.getStreamedText({messages:f,onMessage:(g,b,v,_)=>{s(!v),r(x=>{const y=x[x.length-1];return y?.id===g?[...x.slice(0,-1),Object.assign(Object.assign({},y),{content:b,toolCalls:_})]:[...x,{id:g,role:"assistant",content:b,toolCalls:_}]})},tools:t,prompt:m,variables:p})},init:u,isLoading:i,setMessages:r,lastMessage:n[n.length-1]}}var uy=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};function ly(t){const e=Gt(),[n,r]=Z(t),[i,s]=Z(!0);J(()=>{let a=!1;return e.plugin.getSettings(t).then(u=>{a||(r(u),s(!1))}),()=>{a=!0}},[]);const o=zt(a=>uy(this,void 0,void 0,function*(){const u=Object.assign(Object.assign({},n),a);r(u),yield e.plugin.setSettings(u)}),[n,e]);return{settings:n,isLoading:i,setSettings:o}}var Qh=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})},cy=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function dy(t){const{actionKey:e,skillCategory:n,initialData:r,onAction:i}=t,s=Gt(),{event:o,exercise:a}=s,[u,l]=Z(!1),[c,d]=Z(null),h=De(r??{}),f=De(null),p=De(!1);J(()=>{r&&(h.current=Object.assign({},r))},[]),J(()=>{const x=o.onMainPanelAction(y=>Qh(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${e}] Dashboard action received:`,y);const w=y,{achievement_topic:C}=w,k=cy(w,["achievement_topic"]);p.current=!0,f.current=Date.now(),l(!0),d(k),h.current=r??{},i&&(yield i(k)),console.log(`[useExerciseTracker:${e}] onAction complete, exercise active`)}),e);return()=>x.off()},[e]);const m=zt(x=>Qh(this,void 0,void 0,function*(){console.log(`[useExerciseTracker:${e}] start() called (self-initiated)`,x),p.current=!1,yield a.start({actionKey:e,knowledgeId:x?.knowledgeId}),f.current=Date.now(),h.current=r??{},l(!0),console.log(`[useExerciseTracker:${e}] start() complete, session token acquired`)}),[e,a,r]),g=zt(()=>{f.current=Date.now()},[]),b=zt(x=>{const y={type:"micro",skillCategory:n,accomplishmentKeyword:x.accomplishmentKeyword,description:x.description,meta:x.meta};o.emitAccomplishment(y)},[o,n]),v=zt(x=>{h.current=Object.assign(Object.assign({},h.current),x)},[]),_=zt(x=>{var y;const w=f.current?Date.now()-f.current:0,C=Math.max(1,Math.round(w/6e4));console.log(`[useExerciseTracker:${e}] end() — keyword=${x.accomplishmentKeyword}, errorRatio=${x.errorRatio}, duration=${C}min, trackedData=`,h.current);const S=[...Object.entries(h.current).map(([F,L])=>({key:F,value:L,description:F})),...(y=x.meta)!==null&&y!==void 0?y:[]],D={type:"macro",skillCategory:n,accomplishmentKeyword:x.accomplishmentKeyword,description:x.description,errorRatio:x.errorRatio,durationMinutes:C,meta:S.length>0?S:void 0};o.emitAccomplishment(D),console.log(`[useExerciseTracker:${e}] Macro accomplishment emitted`),l(!1),d(null),f.current=null},[e,o,n]);return{isActive:u,actionParams:c,start:m,ready:g,micro:b,track:v,end:_}}var Dm={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ef=oe.createContext&&oe.createContext(Dm),hy=["attr","size","title"];function fy(t,e){if(t==null)return{};var n=py(t,e),r,i;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(i=0;i<s.length;i++)r=s[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function py(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function To(){return To=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},To.apply(this,arguments)}function tf(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Do(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tf(Object(n),!0).forEach(function(r){my(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tf(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function my(t,e,n){return e=gy(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function gy(t){var e=by(t,"string");return typeof e=="symbol"?e:e+""}function by(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Om(t){return t&&t.map((e,n)=>oe.createElement(e.tag,Do({key:n},e.attr),Om(e.child)))}function ee(t){return e=>oe.createElement(vy,To({attr:Do({},t.attr)},e),Om(t.child))}function vy(t){var e=n=>{var{attr:r,size:i,title:s}=t,o=fy(t,hy),a=i||n.size||"1em",u;return n.className&&(u=n.className),t.className&&(u=(u?u+" ":"")+t.className),oe.createElement("svg",To({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:u,style:Do(Do({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&oe.createElement("title",null,s),t.children)};return ef!==void 0?oe.createElement(ef.Consumer,null,n=>e(n)):e(Dm)}function yy(t){return ee({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M333.49 238a122 122 0 0 0 27-65.21C367.87 96.49 308 32 233.42 32H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h31.87v288H34a16 16 0 0 0-16 16v48a16 16 0 0 0 16 16h209.32c70.8 0 134.14-51.75 141-122.4 4.74-48.45-16.39-92.06-50.83-119.6zM145.66 112h87.76a48 48 0 0 1 0 96h-87.76zm87.76 288h-87.76V288h87.76a56 56 0 0 1 0 112z"},child:[]}]})(t)}function _y(t){return ee({attr:{viewBox:"0 0 640 512"},child:[{tag:"path",attr:{d:"M278.9 511.5l-61-17.7c-6.4-1.8-10-8.5-8.2-14.9L346.2 8.7c1.8-6.4 8.5-10 14.9-8.2l61 17.7c6.4 1.8 10 8.5 8.2 14.9L293.8 503.3c-1.9 6.4-8.5 10.1-14.9 8.2zm-114-112.2l43.5-46.4c4.6-4.9 4.3-12.7-.8-17.2L117 256l90.6-79.7c5.1-4.5 5.5-12.3.8-17.2l-43.5-46.4c-4.5-4.8-12.1-5.1-17-.5L3.8 247.2c-5.1 4.7-5.1 12.8 0 17.5l144.1 135.1c4.9 4.6 12.5 4.4 17-.5zm327.2.6l144.1-135.1c5.1-4.7 5.1-12.8 0-17.5L492.1 112.1c-4.8-4.5-12.4-4.3-17 .5L431.6 159c-4.6 4.9-4.3 12.7.8 17.2L523 256l-90.6 79.7c-5.1 4.5-5.5 12.3-.8 17.2l43.5 46.4c4.5 4.9 12.1 5.1 17 .6z"},child:[]}]})(t)}function xy(t){return ee({attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M320 48v32a16 16 0 0 1-16 16h-62.76l-80 320H208a16 16 0 0 1 16 16v32a16 16 0 0 1-16 16H16a16 16 0 0 1-16-16v-32a16 16 0 0 1 16-16h62.76l80-320H112a16 16 0 0 1-16-16V48a16 16 0 0 1 16-16h192a16 16 0 0 1 16 16z"},child:[]}]})(t)}function ky(t){return ee({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M448 48v32a16 16 0 0 1-16 16h-48v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V96h-32v368a16 16 0 0 1-16 16h-32a16 16 0 0 1-16-16V352h-32a160 160 0 0 1 0-320h240a16 16 0 0 1 16 16z"},child:[]}]})(t)}function wy(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z"},child:[]}]})(t)}function Cy(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z"},child:[]}]})(t)}function Ey(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M496 224H293.9l-87.17-26.83A43.55 43.55 0 0 1 219.55 112h66.79A49.89 49.89 0 0 1 331 139.58a16 16 0 0 0 21.46 7.15l42.94-21.47a16 16 0 0 0 7.16-21.46l-.53-1A128 128 0 0 0 287.51 32h-68a123.68 123.68 0 0 0-123 135.64c2 20.89 10.1 39.83 21.78 56.36H16a16 16 0 0 0-16 16v32a16 16 0 0 0 16 16h480a16 16 0 0 0 16-16v-32a16 16 0 0 0-16-16zm-180.24 96A43 43 0 0 1 336 356.45 43.59 43.59 0 0 1 292.45 400h-66.79A49.89 49.89 0 0 1 181 372.42a16 16 0 0 0-21.46-7.15l-42.94 21.47a16 16 0 0 0-7.16 21.46l.53 1A128 128 0 0 0 224.49 480h68a123.68 123.68 0 0 0 123-135.64 114.25 114.25 0 0 0-5.34-24.36z"},child:[]}]})(t)}var Sy=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Rm=[.8,.9,1,1.1,1.2,1.5];let yu=!1;const My=({text:t,voice:e,language:n,hide:r,playListenerEvent:i,initialSpeed:s=1,playOnMount:o=!1,enableSpeedAdjustment:a=!1,cache:u=!0,size:l="25px",ttsInstructions:c,disableDialect:d=!1})=>{const[h,f]=Z(null),[p,m]=Z(s),[g,b]=Z(!1),[v,_]=Z(!1),{ai:x,userInfo:y}=Gt(),w=De(null),C=De(null);J(()=>(h&&f(null),()=>{h&&URL.revokeObjectURL(h)}),[t]);const k=()=>Sy(void 0,void 0,void 0,function*(){_(!0);const F=c??(!d&&y?.dialect?`Speak with a ${y.dialect} accent and pronunciation.`:void 0),L=yield x.getVoice(t,e||(n?"aws_default":"openai_alloy"),1,n,u,F);f(URL.createObjectURL(L)),_(!1)});J(()=>{if(!h||!g){w.current&&(w.current.pause(),w.current.currentTime=0,w.current=null);return}w.current&&(w.current.pause(),w.current.currentTime=0);const F=new Audio(h);return w.current=F,F.playbackRate=p,F.play().then(()=>{F.onended=()=>{b(!1),yu=!1,w.current=null}}).catch(L=>{console.warn("Error playing audio:",L),b(!1),w.current=null}),()=>{w.current&&(w.current.pause(),w.current.currentTime=0,w.current=null)}},[h,g,p]),J(()=>()=>{w.current&&(w.current.pause(),w.current.currentTime=0,w.current=null),b(!1)},[]),J(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const S=()=>{!g&&!h?k().then(()=>b(!0)):b(F=>!F)},D=De(S);return f0(()=>{D.current=S}),J(()=>{if(!i)return;const F=()=>D.current(),L=Ub.on(i,F);return C.current=L,()=>{C.current&&(C.current.off(),C.current=null)}},[i]),J(()=>{!o||yu||(yu=!0,S())},[o]),A("div",{className:"group relative",children:Me("div",{className:"flex flex-row items-end",children:[!r&&A("button",{className:"text-gray-400",onClick:S,disabled:v,children:v?A(Ay,{size:l}):g?A(Cy,{size:l}):A(wy,{size:l})}),a&&Me("div",{className:"ml-1 opacity-0 group-hover:opacity-100 transition-opacity duration-300 flex flex-row text-sm text-gray-500",children:[A("span",{className:"pr-1",children:"Speed: "}),A("select",{value:p,className:"appearance-none cursor-pointer pr-0 p-0 rounded shadow leading-tight focus:outline-none focus:bg-gray-800 focus:ring bg-transparent border-0",onChange:F=>m(parseFloat(F.target.value)),disabled:v,children:Rm.map(F=>A("option",{value:F,children:F},F))})]})]})})},Ay=({text:t,className:e,size:n="30px"})=>Me("div",{className:"flex items-center space-x-2 pl-1 "+e,children:[Me("svg",{style:{width:n,height:n},className:"animate-spin -ml-1 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[A("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),A("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),t&&A("span",{className:"",children:t})]});function Ty(t){return ee({attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M192 0C139 0 96 43 96 96l0 160c0 53 43 96 96 96s96-43 96-96l0-160c0-53-43-96-96-96zM64 216c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 89.1 66.2 162.7 152 174.4l0 33.6-48 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l72 0 72 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-48 0 0-33.6c85.8-11.7 152-85.3 152-174.4l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c0 70.7-57.3 128-128 128s-128-57.3-128-128l0-40z"},child:[]}]})(t)}function Dy(t){return ee({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M304 48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zm0 416a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM48 304a48 48 0 1 0 0-96 48 48 0 1 0 0 96zm464-48a48 48 0 1 0 -96 0 48 48 0 1 0 96 0zM142.9 437A48 48 0 1 0 75 369.1 48 48 0 1 0 142.9 437zm0-294.2A48 48 0 1 0 75 75a48 48 0 1 0 67.9 67.9zM369.1 437A48 48 0 1 0 437 369.1 48 48 0 1 0 369.1 437z"},child:[]}]})(t)}var _u=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Yc=p0(({onVoiceRecorded:t,iconSize:e,className:n,disabled:r,loading:i,onRecordingStatusChange:s,enablePushToTalk:o=!1},a)=>{const[u,l]=Z(!1),[c,d]=Z(!1),h=De(null),{ai:f,plugin:p}=Gt(),m=De(t);J(()=>{m.current=t},[t]);const g=()=>_u(void 0,void 0,void 0,function*(){try{h.current||(h.current=new Kb(p.pluginId)),yield h.current.startRecording(),l(!0),s(!0)}catch(_){console.error("Failed to start recording:",_)}}),b=()=>_u(void 0,void 0,void 0,function*(){try{if(h.current&&u){const _=yield h.current.stopRecording();d(!0);const x=yield f.getTextFromVoice(_.recording);d(!1),m.current(x)}}catch(_){console.error("Failed to stop recording:",_)}finally{l(!1),s(!1)}});jb(a,()=>({startRecording:g,stopRecording:b}));const v=De(!1);return J(()=>{if(!o)return;const _=y=>_u(void 0,void 0,void 0,function*(){y.code==="Space"&&!v.current&&(v.current=!0,yield g())}),x=y=>{y.code==="Space"&&v.current&&(v.current=!1,b())};return window.addEventListener("keydown",_),window.addEventListener("keyup",x),()=>{window.removeEventListener("keydown",_),window.removeEventListener("keyup",x)}},[o]),A("button",{className:"flex flex-row justify-center items-center rounded-full mx-auto disabled:opacity-50 "+n,onClick:u?b:g,disabled:r||i||c,children:i||c?A(Dy,{className:"animate-spin"}):A(Ty,{size:e,className:u?"text-red-600":""})})});function Nm({imageUrl:t,className:e,isDarkTheme:n=!1,width:r="150px",loudnessRef:i}){const s=De(null),o=De(0),a=De(null),u=(l,c,d,h)=>{if(c&&l){l.clearRect(0,0,c.width,c.height);const f=Math.min(c.width,c.height)/3,p=c.width/2,m=c.height/2,g=f+h/2.5;l.beginPath(),l.arc(p,m,g,0,Math.PI*2,!0),l.strokeStyle=n?"rgba(255, 255, 255, 0.5)":"rgba(0, 0, 0, 0.5)",l.lineWidth=5,l.stroke(),l.save(),l.beginPath(),l.arc(p,m,f,0,Math.PI*2,!0),l.closePath(),l.clip(),l.drawImage(d,p-f,m-f,f*2,f*2),l.restore(),l.beginPath(),l.arc(p,m,f,0,Math.PI*2,!0),l.strokeStyle=n?"rgba(255, 255, 255, 0.9)":"rgba(0, 0, 0, 0.9)",l.lineWidth=5,l.stroke()}};return J(()=>{const l=s.current;if(l){const c=l.getContext("2d");if(c){const d=new Image;d.src=t;let h=!0;return d.onload=()=>{if(!h)return;u(c,l,d,0);const f=()=>{var p;const m=(p=i?.current)!==null&&p!==void 0?p:0,g=.06;o.current>m?o.current=Math.max(m,o.current-g*o.current):o.current=m,u(c,l,d,o.current),a.current=requestAnimationFrame(f)};a.current=requestAnimationFrame(f)},()=>{h=!1,a.current&&cancelAnimationFrame(a.current)}}}},[t]),A("canvas",{ref:s,className:e,width:500,height:500,style:{width:r}})}function Oy(t){const e=[];return t.userMessage&&e.push({id:"1",role:"user",content:t.userMessage}),t.assistantMessage&&e.push({id:"2",role:"assistant",content:t.assistantMessage}),e}function Ry({avatarImageUrl:t,voiceId:e,agentTools:n,autoStartConversation:r,children:i,circleSize:s="300px",className:o,cache:a=!1,prompt:u,promptVariables:l}){const{ai:c,plugin:d,userInfo:h}=Gt(),{isDark:f}=Gc(d.theme,!0),[p,m]=Z(!1),[g,b]=Z(!1),v=De(0),_=h?.dialect?`Speak with a ${h.dialect} accent and pronunciation.`:void 0,x=Fc(()=>new g0((...D)=>c.getVoice(...D),e,a),[e,c,a]);J(()=>{x.setInstructions(_)},[x,_]);const{messages:y,append:w,isLoading:C,lastMessage:k,setMessages:S}=Tm(n,{prompt:u,promptVariables:l});return J(()=>{console.log("messages",y)},[y]),J(()=>{C||b(!1)},[C]),J(()=>{e&&(x.setOnLoudnessChange(D=>{v.current=D}),x.setOnEndOfSpeech(()=>m(!1)),r&&(S(Oy(r)),r.assistantMessage?x.handleNewText(r.assistantMessage,C):r.userMessage&&w([{role:"user",content:r.userMessage,id:y.length.toString()}])))},[r,e]),J(()=>()=>{x.cleanup()},[x]),J(()=>{k?.role==="assistant"&&(x.handleNewText(k.content,C),k.toolCalls&&(m(!1),b(!1)))},[k,C]),Me("div",{className:`md:pb-8 ${o||""}`,children:[A(Nm,{width:s,className:"mx-auto",imageUrl:t,isDarkTheme:f,loudnessRef:v}),i,A(Yc,{iconSize:"30",className:"w-16 h-16 shadow-lg rounded-full bg-gray-400 dark:bg-gray-800",disabled:p,loading:g,enablePushToTalk:!0,onVoiceRecorded:D=>{m(!0),w([{role:"user",content:"Message("+Math.floor((y.length+1)/2)+"): "+D,id:y.length.toString()}])},onRecordingStatusChange:D=>!D&&b(!0)})]})}function Ny(){const{plugin:t}=Gt(),[e,n]=Z(null),[r,i]=Z(0);return J(()=>{t.getTranslator().then(o=>{n(o),o.onLanguageChanged(()=>{i(a=>a+1)})})},[t]),{t:zt((o,a)=>{if(!e)return"";const u=e.t(o,a);return u||""},[e,r]),ready:e!==null}}function Fy(t){return ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A1 1 0 0 0 5 3v18a1 1 0 0 0 .536.886z"},child:[]}]})(t)}let Iy=0;const Py=()=>`ba-${++Iy}`;function Ly({prompt:t,promptVariables:e,autoStartConversation:n,circleSize:r="160px",chatPlaceholder:i,bottomAction:s,className:o,voiceSpeed:a=1,tools:u,showName:l=!1}){const{ai:c,plugin:d,userInfo:h}=Gt(),f=d.ttsEnabled,{isDark:p}=Gc(d.theme,!0),m=h.study_buddy,g=h?.dialect,b=g?`Speak with a ${g} accent and pronunciation.`:void 0,[v,_]=Z(""),[x,y]=Z([]),[w,C]=Z(!1),[k,S]=Z(!1),D=De(0),F=De(f);J(()=>{F.current=f,!f&&k&&(L.stop(),S(!1))},[f]);const L=Fc(()=>{var V;return new g0((...he)=>c.getVoice(...he),(V=m?.voiceId)!==null&&V!==void 0?V:"")},[m?.voiceId,c]);J(()=>{L.setInstructions(b)},[L,b]),J(()=>(L.setVoiceSpeed(a),L.setOnLoudnessChange(V=>{D.current=V}),L.setOnEndOfSpeech(()=>S(!1)),()=>L.cleanup()),[L]);const j=V=>V.map(he=>({role:he.role,content:he.content})),W=V=>{C(!0),c.getStreamedText({messages:j(V),onMessage:(he,Ce,Ze)=>{C(!Ze);const bt=`ai-${he}`;y(Oe=>{const We=Oe[Oe.length-1];return We?.id===bt?[...Oe.slice(0,-1),Object.assign(Object.assign({},We),{content:Ce})]:[...Oe,{id:bt,role:"assistant",content:Ce}]}),F.current&&(L.handleNewText(Ce,!Ze),Ce&&S(!0))},tools:u,prompt:t,variables:e})},X=De(!1);if(J(()=>{if(!X.current){if(X.current=!0,n?.assistantMessage){const V={id:"init",role:"assistant",content:n.assistantMessage};y([V]),F.current&&(L.handleNewText(n.assistantMessage,!1),S(!0))}else if(n?.userMessage){const V={id:"auto-start",role:"user",content:n.userMessage};y([V]),W([V])}}},[]),!m)return A("div",{});const ne=V=>{if(!V.trim()||w)return;const he={id:Py(),role:"user",content:V},Ce=[...x,he];y(Ce),W(Ce)},se=[...x].filter(V=>V.role==="assistant").pop();return Me("div",{className:`flex flex-col items-center ${o||""}`,children:[A(Nm,{width:r,imageUrl:m.avatarUrl,isDarkTheme:p,loudnessRef:D,className:"mx-auto"}),l&&A("div",{className:"flex items-center gap-2",children:A("span",{className:"text-3xl font-semibold",children:m.name})}),!d.ttsEnabled&&x.length>1?A("div",{className:"w-full rounded-xl bg-gray-200/70 dark:bg-gray-800/70 px-4 py-3 text-sm text-gray-800 dark:text-gray-200 leading-relaxed border border-gray-300/40 dark:border-gray-700/40 mt-4",children:!se?.content&&w?Me("span",{className:"inline-flex gap-1 py-0.5",children:[A("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce"}),A("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.15s"}}),A("span",{className:"w-1.5 h-1.5 rounded-full bg-gray-400 animate-bounce",style:{animationDelay:"0.3s"}})]}):A("span",{className:"whitespace-pre-wrap",children:se?.content})}):null,Me("div",{className:"w-full relative mt-4 "+(f?"max-w-md":""),children:[A("input",{value:v,onChange:V=>_(V.target.value),onKeyDown:V=>{V.key==="Enter"&&!V.shiftKey&&(V.preventDefault(),ne(v),_(""))},placeholder:i??`Ask ${m.name} a question…`,disabled:w,className:"w-full bg-gray-800/50 border border-gray-700 rounded-lg px-3 py-2 pr-16 text-sm text-gray-200 placeholder:text-gray-500 focus:outline-none focus:ring-1 focus:ring-blue-500 disabled:opacity-60"}),Me("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:[A(Yc,{iconSize:"14",className:"p-1 text-gray-400 hover:text-white transition-colors",disabled:w,onVoiceRecorded:V=>ne(V),onRecordingStatusChange:()=>{}}),A("button",{type:"button",onClick:()=>{ne(v),_("")},disabled:w||!v.trim(),className:"p-1 text-gray-400 hover:text-white disabled:opacity-40 transition-colors",children:A(Fy,{className:"w-4 h-4"})})]})]}),s&&A("div",{className:"w-full max-w-md border-t border-gray-700/60 pt-3",children:s})]})}function By(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6 9 17l-5-5"},child:[]}]})(t)}function $y(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z"},child:[]},{tag:"path",attr:{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10"},child:[]},{tag:"path",attr:{d:"m17 10 4 4-4 4"},child:[]}]})(t)}function zy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},child:[]}]})(t)}function Hy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"m17 12 3-2v8"},child:[]}]})(t)}function jy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1"},child:[]}]})(t)}function Vy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 12h8"},child:[]},{tag:"path",attr:{d:"M4 18V6"},child:[]},{tag:"path",attr:{d:"M12 18V6"},child:[]},{tag:"path",attr:{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2"},child:[]},{tag:"path",attr:{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2"},child:[]}]})(t)}function qy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},child:[]},{tag:"path",attr:{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},child:[]}]})(t)}function Wy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 2v4"},child:[]},{tag:"path",attr:{d:"m16.2 7.8 2.9-2.9"},child:[]},{tag:"path",attr:{d:"M18 12h4"},child:[]},{tag:"path",attr:{d:"m16.2 16.2 2.9 2.9"},child:[]},{tag:"path",attr:{d:"M12 18v4"},child:[]},{tag:"path",attr:{d:"m4.9 19.1 2.9-2.9"},child:[]},{tag:"path",attr:{d:"M2 12h4"},child:[]},{tag:"path",attr:{d:"m4.9 4.9 2.9 2.9"},child:[]}]})(t)}function Uy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 3 21 3 21 9"},child:[]},{tag:"polyline",attr:{points:"9 21 3 21 3 15"},child:[]},{tag:"line",attr:{x1:"21",x2:"14",y1:"3",y2:"10"},child:[]},{tag:"line",attr:{x1:"3",x2:"10",y1:"21",y2:"14"},child:[]}]})(t)}function Ky(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"4 14 10 14 10 20"},child:[]},{tag:"polyline",attr:{points:"20 10 14 10 14 4"},child:[]},{tag:"line",attr:{x1:"14",x2:"21",y1:"10",y2:"3"},child:[]},{tag:"line",attr:{x1:"3",x2:"10",y1:"21",y2:"14"},child:[]}]})(t)}function Jy(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"},child:[]},{tag:"path",attr:{d:"M20 3v4"},child:[]},{tag:"path",attr:{d:"M22 5h-4"},child:[]},{tag:"path",attr:{d:"M4 17v2"},child:[]},{tag:"path",attr:{d:"M5 18H3"},child:[]}]})(t)}function $e(t){this.content=t}$e.prototype={constructor:$e,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new $e(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new $e(n)},addToStart:function(t,e){return new $e([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new $e(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new $e(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=$e.from(t),t.size?new $e(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=$e.from(t),t.size?new $e(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=$e.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};$e.from=function(t){if(t instanceof $e)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new $e(e)};function Fm(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let o=0;i.text[o]==s.text[o];o++)n++;return n}if(i.content.size||s.content.size){let o=Fm(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function Im(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),u=o.nodeSize;if(o==a){n-=u,r-=u;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let l=0,c=Math.min(o.text.length,a.text.length);for(;l<c&&o.text[o.text.length-l-1]==a.text[a.text.length-l-1];)l++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let l=Im(o.content,a.content,n-1,r-1);if(l)return l}n-=u,r-=u}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let u=this.content[o],l=a+u.nodeSize;if(l>e&&r(u,i+a,s||null,o)!==!1&&u.content.size){let c=a+1;u.nodesBetween(Math.max(0,e-c),Math.min(u.content.size,n-c),r,i+c)}a=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,u)=>{let l=a.isText?a.text.slice(Math.max(e,u)-u,n-u):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&l||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=l},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new M(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],u=o+a.nodeSize;u>e&&((o<e||u>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=u}return new M(r,i)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new M(i,s)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Fm(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Im(this,e,n,r)}findIndex(e){if(e==0)return Rs(0,e);if(e==this.size)return Rs(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Rs(n+1,s):Rs(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const xu={index:0,offset:0};function Rs(t,e){return xu.index=t,xu.offset=e,xu}function Oo(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!Oo(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!Oo(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let re=class Wl{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Oo(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Wl.none;if(e instanceof Wl)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};re.none=[];class Ro extends Error{}class R{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Lm(this.content,e+this.openStart,n);return r&&new R(r,this.openStart,this.openEnd)}removeBetween(e,n){return new R(Pm(this.content,e+this.openStart,n+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,n){if(!n)return R.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new R(M.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new R(e,r,i)}}R.empty=new R(M.empty,0,0);function Pm(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(Pm(s.content,e-i-1,n-i-1)))}function Lm(t,e,n,r){let{index:i,offset:s}=t.findIndex(e),o=t.maybeChild(i);if(s==e||o.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Lm(o.content,e-s-1,n,o);return a&&t.replaceChild(i,o.copy(a))}function Gy(t,e,n){if(n.openStart>t.depth)throw new Ro("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Ro("Inconsistent open depths");return Bm(t,e,n,0)}function Bm(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=Bm(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return cr(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=Yy(n,t);return cr(s,zm(t,o,a,e,r))}else return cr(s,No(t,e,r))}function $m(t,e){if(!e.type.compatibleContent(t.type))throw new Ro("Cannot join "+e.type.name+" onto "+t.type.name)}function Ul(t,e,n){let r=t.node(n);return $m(r,e.node(n)),r}function lr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Pi(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(lr(t.nodeAfter,r),s++));for(let a=s;a<o;a++)lr(i.child(a),r);e&&e.depth==n&&e.textOffset&&lr(e.nodeBefore,r)}function cr(t,e){return t.type.checkContent(e),t.copy(e)}function zm(t,e,n,r,i){let s=t.depth>i&&Ul(t,e,i+1),o=r.depth>i&&Ul(n,r,i+1),a=[];return Pi(null,t,i,a),s&&o&&e.index(i)==n.index(i)?($m(s,o),lr(cr(s,zm(t,e,n,r,i+1)),a)):(s&&lr(cr(s,No(t,e,i+1)),a),Pi(e,n,i,a),o&&lr(cr(o,No(n,r,i+1)),a)),Pi(r,null,i,a),new M(a)}function No(t,e,n){let r=[];if(Pi(null,t,n,r),t.depth>n){let i=Ul(t,e,n+1);lr(cr(i,No(t,e,n+1)),r)}return Pi(e,null,n,r),new M(r)}function Yy(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(M.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class Zi{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.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,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return re.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Fo(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<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:u}=o.content.findIndex(s),l=s-u;if(r.push(o,a,i+u),!l||(o=o.child(a),o.isText))break;s=l-1,i+=u+1}return new Zi(n,r,s)}static resolveCached(e,n){let r=nf.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else nf.set(e,r=new Zy);let i=r.elts[r.i]=Zi.resolve(e,n);return r.i=(r.i+1)%Xy,i}}class Zy{constructor(){this.elts=[],this.i=0}}const Xy=12,nf=new WeakMap;class Fo{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Qy=Object.create(null);let zn=class Kl{constructor(e,n,r,i=re.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&Oo(this.attrs,n||e.defaultAttrs||Qy)&&re.sameSet(this.marks,r||re.none)}copy(e=null){return e==this.content?this:new Kl(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Kl(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return R.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),l=i.node(o).content.cut(i.pos-a,s.pos-a);return new R(l,i.depth-o,s.depth-o)}replace(e,n,r){return Gy(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return Zi.resolveCached(this,e)}resolveNoCache(e){return Zi.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,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()+")"),Hm(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let u=i;u<s;u++)if(!this.type.allowsMarks(r.child(u).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=re.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!re.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=M.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};zn.prototype.text=void 0;class Io extends zn{constructor(e,n,r,i){if(super(e,n,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):Hm(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Io(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Io(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Hm(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class mr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new e_(e,n);if(r.next==null)return mr.empty;let i=jm(r);r.next&&r.err("Unexpected trailing text");let s=a_(o_(i));return u_(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let u=o.matchFragment(e,r);if(u&&(!n||u.validEnd))return M.from(a.map(l=>l.createAndFill()));for(let l=0;l<o.next.length;l++){let{type:c,next:d}=o.next[l];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=s(d,a.concat(c));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:u}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||u.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
|
|
3
|
+
`)}}mr.empty=new mr(!0);class e_{constructor(e,n){this.string=e,this.nodeTypes=n,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 jm(t){let e=[];do e.push(t_(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function t_(t){let e=[];do e.push(n_(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function n_(t){let e=s_(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=r_(t,e);else break;return e}function rf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function r_(t,e){let n=rf(t),r=n;return t.eat(",")&&(t.next!="}"?r=rf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function i_(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function s_(t){if(t.eat("(")){let e=jm(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=i_(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function o_(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,u){let l={term:u,to:a};return e[o].push(l),l}function i(o,a){o.forEach(u=>u.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((u,l)=>u.concat(s(l,a)),[]);if(o.type=="seq")for(let u=0;;u++){let l=s(o.exprs[u],a);if(u==o.exprs.length-1)return l;i(l,a=n())}else if(o.type=="star"){let u=n();return r(a,u),i(s(o.expr,u),u),[r(u)]}else if(o.type=="plus"){let u=n();return i(s(o.expr,a),u),i(s(o.expr,u),u),[r(u)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let u=a;for(let l=0;l<o.min;l++){let c=n();i(s(o.expr,u),c),u=c}if(o.max==-1)i(s(o.expr,u),u);else for(let l=o.min;l<o.max;l++){let c=n();r(u,c),i(s(o.expr,u),c),u=c}return[r(u)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function Vm(t,e){return e-t}function sf(t,e){let n=[];return r(e),n.sort(Vm);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:u}=s[o];!a&&n.indexOf(u)==-1&&r(u)}}}function a_(t){let e=Object.create(null);return n(sf(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:u})=>{if(!a)return;let l;for(let c=0;c<i.length;c++)i[c][0]==a&&(l=i[c][1]);sf(t,u).forEach(c=>{l||i.push([a,l=[]]),l.indexOf(c)==-1&&l.push(c)})})});let s=e[r.join(",")]=new mr(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(Vm);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function u_(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:u,next:l}=i.next[a];o.push(u.name),s&&!(u.isText||u.hasRequiredAttrs())&&(s=!1),r.indexOf(l)==-1&&r.push(l)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qm(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function Wm(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Um(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let s=t[i];s.validate&&s.validate(e[i])}}function Km(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new c_(t,r,e[r]);return n}let of=class Jm{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Km(e,r.attrs),this.defaultAttrs=qm(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==mr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-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:Wm(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new zn(this,this.computeAttrs(e),M.from(n),re.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new zn(this,this.computeAttrs(e),n,re.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(M.empty,!0);return s?new zn(this,e,n.append(s),re.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Um(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:re.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new Jm(s,n,o));let i=n.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 l_(t,e,n){let r=n.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 ${t}, got ${s}`)}}class c_{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?l_(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Aa{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=Km(e,i.attrs),this.excluded=null;let s=qm(this.attrs);this.instance=s?new re(this,s):null}create(e=null){return!e&&this.instance?this.instance:new re(this,Wm(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new Aa(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Um(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Zc{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=$e.from(e.nodes),n.marks=$e.from(e.marks||{}),this.nodes=of.compile(this.spec.nodes,this),this.marks=Aa.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||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=mr.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=a=="_"?null:a?af(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:af(this,o.split(" "))}this.nodeFromJSON=i=>zn.fromJSON(this,i),this.markFromJSON=i=>re.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof of){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(n,r,i)}text(e,n){let r=this.nodes.text;return new Io(r,r.defaultAttrs,e,re.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function af(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let u=t.marks[a];(i=="_"||u.spec.group&&u.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=u)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function d_(t){return t.tag!=null}function h_(t){return t.style!=null}class mn{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(d_(i))this.tags.push(i);else if(h_(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,n={}){let r=new lf(this,n,!1);return r.addAll(e,re.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new lf(this,n,!0);return r.addAll(e,re.none,n.from,n.to),R.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(m_(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let u=o.getAttrs(n);if(u===!1)continue;o.attrs=u||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=cf(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=cf(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new mn(e,mn.schemaRules(e)))}}const Gm={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},f_={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Ym={ol:!0,ul:!0},Xi=1,Jl=2,Li=4;function uf(t,e,n){return e!=null?(e?Xi:0)|(e==="full"?Jl:0):t&&t.whitespace=="pre"?Xi|Jl:n&~Li}class Ns{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=re.none,this.match=s||(o&Li?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);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&Xi)){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 n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Gm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class lf{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=uf(null,n.preserveWhitespace,0)|(r?Li:0);i?s=new Ns(i.type,i.attrs,re.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new Ns(null,null,re.none,!0,null,o):s=new Ns(e.schema.topNodeType,null,re.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&Jl?"full":this.localPreserveWS||(i.options&Xi)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
|
|
4
|
+
`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let u=0;u<a.length;u++)u&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[u]&&this.insertNode(o.text(a[u]),n,!/\S/.test(a[u]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],u=e.previousSibling;(!a||u&&u.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,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(),a;Ym.hasOwnProperty(o)&&this.parser.normalizeLists&&p_(e);let u=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(u?u.ignore:f_.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!u||u.skip||u.closeParent){u&&u.closeParent?this.open=Math.max(0,this.open-1):u&&u.skip.nodeType&&(e=u.skip);let l,c=this.needsBlock;if(Gm.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),l=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=u&&u.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),l&&this.sync(s),this.needsBlock=c}else{let l=this.readStyles(e,n);l&&this.addElementByRule(e,u,l,u.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
5
|
+
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let u=this.parser.matchStyle(s,o,this,a);if(!u)break;if(u.ignore)return null;if(u.clearMark?n=n.filter(l=>!u.clearMark(l)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)a=u;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let u=this.enter(o,n.attrs||null,r,n.preserveWhitespace);u&&(s=!0,r=u)}else{let u=this.parser.schema.marks[n.mark];r=r.concat(u.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(u=>this.insertNode(u,r,!1));else{let u=e;typeof n.contentElement=="string"?u=e.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(e):n.contentElement&&(u=n.contentElement),this.findAround(e,u,!0),this.addAll(u,r),this.findAround(e,u,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let u=this.nodes[o],l=u.findWrapping(e);if(l&&(!i||i.length>l.length+a)&&(i=l,s=u,!l.length))break;if(u.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=re.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):df(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=uf(e,s,o.options);o.options&Li&&o.content.length==0&&(a|=Li);let u=re.none;return r=r.filter(l=>(o.type?o.type.allowsMarkType(l.type):df(l.type,e))?(u=l.addToSet(u),!1):!0),this.nodes.push(new Ns(e,n,u,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Xi)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=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=(a,u)=>{for(;a>=0;a--){let l=n[a];if(l==""){if(a==n.length-1||a==0)continue;for(;u>=s;u--)if(o(a-1,u))return!0;return!1}else{let c=u>0||u==0&&i?this.nodes[u].type:r&&u>=s?r.node(u-s).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;u--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function p_(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&Ym.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function m_(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function cf(t){let e={};for(let n in t)e[n]=t[n];return e}function df(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let u=0;u<a.edgeCount;u++){let{type:l,next:c}=a.edge(u);if(l==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class kr{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=ku(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,u=0;for(;a<s.length&&u<o.marks.length;){let l=o.marks[u];if(!this.marks[l.type.name]){u++;continue}if(!l.eq(s[a][0])||l.type.spec.spanning===!1)break;a++,u++}for(;a<s.length;)i=s.pop()[1];for(;u<o.marks.length;){let l=o.marks[u++],c=this.serializeMark(l,o.isInline,n);c&&(s.push([l,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=eo(ku(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&eo(ku(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return eo(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new kr(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=hf(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return hf(e.marks)}}function hf(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function ku(t){return t.document||window.document}const ff=new WeakMap;function g_(t){let e=ff.get(t);return e===void 0&&ff.set(t,e=b_(t)),e}function b_(t){let e=null;function n(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<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function eo(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=g_(r))&&s.indexOf(e)>-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&&(n=i.slice(0,o),i=i.slice(o+1));let a,u=n?t.createElementNS(n,i):t.createElement(i),l=e[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let d in l)if(l[d]!=null){let h=d.indexOf(" ");h>0?u.setAttributeNS(d.slice(0,h),d.slice(h+1),l[d]):d=="style"&&u.style?u.style.cssText=l[d]:u.setAttribute(d,l[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:f,contentDOM:p}=eo(t,h,n,r);if(u.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:u,contentDOM:a}}const Zm=65535,Xm=Math.pow(2,16);function v_(t,e){return t+e*Xm}function pf(t){return t&Zm}function y_(t){return(t-(t&Zm))/Xm}const Qm=1,eg=2,to=4,tg=8;class Gl{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&tg)>0}get deletedBefore(){return(this.delInfo&(Qm|to))>0}get deletedAfter(){return(this.delInfo&(eg|to))>0}get deletedAcross(){return(this.delInfo&to)>0}}class dt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&dt.empty)return dt.empty}recover(e){let n=0,r=pf(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+y_(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?i:0);if(u>e)break;let l=this.ranges[a+s],c=this.ranges[a+o],d=u+l;if(e<=d){let h=l?e==u?-1:e==d?1:n:n,f=u+i+(h<0?0:c);if(r)return f;let p=e==(n<0?u:d)?null:v_(a/3,e-u),m=e==u?eg:e==d?Qm:to;return(n<0?e!=u:e!=d)&&(m|=tg),new Gl(f,m,p)}i+=c-l}return r?e+i:new Gl(e+i,0,null)}touches(e,n){let r=0,i=pf(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let u=this.ranges[a]-(this.inverted?r:0);if(u>e)break;let l=this.ranges[a+s],c=u+l;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-l}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),u=o+(this.inverted?0:s),l=this.ranges[i+n],c=this.ranges[i+r];e(a,a+l,u,u+c),s+=c-l}}invert(){return new dt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?dt.empty:new dt(e<0?[0,-e,0]:[0,0,e])}}dt.empty=new dt([]);class Qi{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Qi(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Qi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let u=this.getMirror(s);if(u!=null&&u>s&&u<this.to){s=u,e=this._maps[u].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new Gl(e,i,null)}}const wu=Object.create(null);class Ye{getMap(){return dt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=wu[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in wu)throw new RangeError("Duplicate use of step JSON ID "+e);return wu[e]=n,n.prototype.jsonID=e,n}}class Ae{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Ae(e,null)}static fail(e){return new Ae(null,e)}static fromReplace(e,n,r,i){try{return Ae.ok(e.replace(n,r,i))}catch(s){if(s instanceof Ro)return Ae.fail(s.message);throw s}}}function Xc(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(Xc(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return M.fromArray(r)}class In extends Ye{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new R(Xc(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,s)}invert(){return new qt(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new In(n.pos,r.pos,this.mark)}merge(e){return e instanceof In&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new In(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new In(n.from,n.to,e.markFromJSON(n.mark))}}Ye.jsonID("addMark",In);class qt extends Ye{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new R(Xc(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Ae.fromReplace(e,this.from,this.to,r)}invert(){return new In(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new qt(n.pos,r.pos,this.mark)}merge(e){return e instanceof qt&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qt(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qt(n.from,n.to,e.markFromJSON(n.mark))}}Ye.jsonID("removeMark",qt);class Pn extends Ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ae.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ae.fromReplace(e,this.pos,this.pos+1,new R(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Pn(this.pos,n.marks[i]);return new Pn(this.pos,this.mark)}}return new gr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Pn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Pn(n.pos,e.markFromJSON(n.mark))}}Ye.jsonID("addNodeMark",Pn);class gr extends Ye{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ae.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ae.fromReplace(e,this.pos,this.pos+1,new R(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Pn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new gr(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new gr(n.pos,e.markFromJSON(n.mark))}}Ye.jsonID("removeNodeMark",gr);class Se extends Ye{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Yl(e,this.from,this.to)?Ae.fail("Structure replace would overwrite content"):Ae.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new dt([this.from,this.to-this.from,this.slice.size])}invert(e){return new Se(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&Se.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new Se(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Se)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?R.empty:new R(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Se(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?R.empty:new R(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Se(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Se(n.from,n.to,R.fromJSON(e,n.slice),!!n.structure)}}Se.MAP_BIAS=1;Ye.jsonID("replace",Se);class Fe extends Ye{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(Yl(e,this.from,this.gapFrom)||Yl(e,this.gapTo,this.to)))return Ae.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ae.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ae.fromReplace(e,this.from,this.to,r):Ae.fail("Content does not fit in gap")}getMap(){return new dt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new Fe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new Fe(n.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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Fe(n.from,n.to,n.gapFrom,n.gapTo,R.fromJSON(e,n.slice),n.insert,!!n.structure)}}Ye.jsonID("replaceAround",Fe);function Yl(t,e,n){let r=t.resolve(e),i=n-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 __(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(u,l,c)=>{if(!u.isInline)return;let d=u.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(l,e),f=Math.min(l+u.nodeSize,n),p=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(d[m])?o.to=f:i.push(o=new qt(h,f,d[m])));a&&a.to==h?a.to=f:s.push(a=new In(h,f,r))}}),i.forEach(u=>t.step(u)),s.forEach(u=>t.step(u))}function x_(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let u=null;if(r instanceof Aa){let l=o.marks,c;for(;c=r.isInSet(l);)(u||(u=[])).push(c),l=c.removeFromSet(l)}else r?r.isInSet(o.marks)&&(u=[r]):u=o.marks;if(u&&u.length){let l=Math.min(a+o.nodeSize,n);for(let c=0;c<u.length;c++){let d=u[c],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==s-1&&d.eq(i[f].style)&&(h=p)}h?(h.to=l,h.step=s):i.push({style:d,from:Math.max(a,e),to:l,step:s})}}}),i.forEach(o=>t.step(new qt(o.from,o.to,o.style)))}function Qc(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let u=0;u<s.childCount;u++){let l=s.child(u),c=a+l.nodeSize,d=r.matchType(l.type);if(!d)o.push(new Se(a,c,R.empty));else{r=d;for(let h=0;h<l.marks.length;h++)n.allowsMarkType(l.marks[h].type)||t.step(new qt(a,c,l.marks[h]));if(i&&l.isText&&n.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(l.text);)p||(p=new R(M.from(n.schema.text(" ",n.allowedMarks(l.marks))),0,0)),o.push(new Se(a+h.index,a+h.index+h[0].length,p))}}a=c}if(!r.validEnd){let u=r.fillBefore(M.empty,!0);t.replace(a,a,new R(u,0,0))}for(let u=o.length-1;u>=0;u--)t.step(o[u])}function k_(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ai(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,u=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,u,n))return r;if(r==0||o.type.spec.isolating||!k_(o,a,u))break;a&&(i=1),u<o.childCount&&(s=1)}return null}function w_(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),u=o,l=a,c=M.empty,d=0;for(let p=s,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,c=M.from(r.node(p).copy(c)),d++):u--;let h=M.empty,f=0;for(let p=s,m=!1;p>n;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=M.from(i.node(p).copy(h)),f++):l++;t.step(new Fe(u,l,o,a,new R(c.append(h),d,f),c.size-d,!0))}function ed(t,e,n=null,r=t){let i=C_(t,e),s=i&&E_(r,e);return s?i.map(mf).concat({type:e,attrs:n}).concat(s.map(mf)):null}function mf(t){return{type:t,attrs:null}}function C_(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function E_(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let u=(o.length?o[o.length-1]:e).contentMatch;for(let l=r;u&&l<i;l++)u=u.matchType(n.child(l).type);return!u||!u.validEnd?null:o}function S_(t,e,n){let r=M.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new Fe(i,s,i,s,new R(r,0,0),n.length,!0))}function M_(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let u=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,u)&&A_(t.doc,t.mapping.slice(s).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?l=!1:!f&&p&&(l=!0)}l===!1&&rg(t,o,a,s),Qc(t,t.mapping.slice(s).map(a,1),r,void 0,l===null);let c=t.mapping.slice(s),d=c.map(a,1),h=c.map(a+o.nodeSize,1);return t.step(new Fe(d,h,d+1,h-1,new R(M.from(r.create(u,null,o.marks)),0,0),1,!0)),l===!0&&ng(t,o,a,s),!1}})}function ng(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let u=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(u,u+1,e.type.schema.linebreakReplacement.create())}}})}function rg(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
|
|
6
|
+
`))}})}function A_(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function T_(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new Fe(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new R(M.from(o),0,0),1,!0))}function gn(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,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 l=i.depth-1,c=n-2;l>s;l--,c--){let d=i.node(l),h=i.index(l);if(d.type.spec.isolating)return!1;let f=d.content.cutByIndex(h,d.childCount),p=r&&r[c+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[c]||d;if(!d.canReplace(h+1,d.childCount)||!m.type.validContent(f))return!1}let a=i.indexAfter(s),u=r&&r[0];return i.node(s).canReplaceWith(a,a,u?u.type:i.node(s+1).type)}function D_(t,e,n=1,r){let i=t.doc.resolve(e),s=M.empty,o=M.empty;for(let a=i.depth,u=i.depth-n,l=n-1;a>u;a--,l--){s=M.from(i.node(a).copy(s));let c=r&&r[l];o=M.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}t.step(new Se(e,e,new R(s.append(o),n,n),!0))}function Un(t,e){let n=t.resolve(e),r=n.index();return ig(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function O_(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function ig(t,e){return!!(t&&e&&!t.isLeaf&&O_(t,e))}function Ta(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&ig(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function R_(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);rg(t,c.node(),c.before(),a)}o.inlineContent&&Qc(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let u=t.mapping.slice(a),l=u.map(e-n);if(t.step(new Se(l,u.map(e+n,-1),R.empty,!0)),r===!0){let c=t.doc.resolve(l);ng(t,c.node(),c.before(),t.steps.length)}return t}function N_(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))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,n))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,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function sg(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,u=r.index(o)+(a>0?1:0),l=r.node(o),c=!1;if(s==1)c=l.canReplace(u,u,i);else{let d=l.contentMatchAt(u).findWrapping(i.firstChild.type);c=d&&l.canReplaceWith(u,u,d[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function Da(t,e,n=e,r=R.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return og(i,s,r)?new Se(e,n,r):new F_(i,s,r).fit()}function og(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class F_{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.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=M.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let l=this.findFittable();l?this.placeNodes(l):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=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,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let u=new R(s,o,a);return e>-1?new Fe(r.pos,e,this.$to.pos,this.$to.end(),u,n):u.size||r.pos!=this.$to.pos?new Se(r.pos,i.pos,u):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=Cu(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:u,match:l}=this.frontier[a],c,d=null;if(n==1&&(o?l.matchType(o.type)||(d=l.fillBefore(M.from(o),!1)):s&&u.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(c=l.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&l.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Cu(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new R(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Cu(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new R(Mi(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new R(Mi(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,a=r?r.content:o.content,u=o.openStart-e,l=0,c=[],{match:d,type:h}=this.frontier[n];if(i){for(let m=0;m<i.childCount;m++)c.push(i.child(m));d=d.matchFragment(i)}let f=a.size+e-(o.content.size-o.openEnd);for(;l<a.childCount;){let m=a.child(l),g=d.matchType(m.type);if(!g)break;l++,(l>1||u==0||m.content.size)&&(d=g,c.push(ag(m.mark(h.allowedMarks(m.marks)),l==1?u:0,l==a.childCount?f:-1)))}let p=l==a.childCount;p||(f=-1),this.placed=Ai(this.placed,n,M.from(c)),this.frontier[n].match=d,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=a;m<f;m++){let b=g.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),g=b.content}this.unplaced=p?e==0?R.empty:new R(Mi(o.content,e-1,1),e-1,f<0?o.openEnd:e-1):new R(Mi(o.content,e,l),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Eu(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Eu(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:u,type:l}=this.frontier[a],c=Eu(e,a,l,u,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ai(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.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,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ai(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=Ai(this.placed,this.frontier.length,n))}}function Mi(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Mi(t.firstChild.content,e-1,n)))}function Ai(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ai(t.lastChild.content,e-1,n)))}function Cu(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function ag(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,ag(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(M.empty,!0)))),t.copy(r)}function Eu(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!I_(n,s.content,o)?a:null}function I_(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function P_(t){return t.spec.defining||t.spec.definingForContent}function L_(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(og(i,s,r))return t.step(new Se(e,n,r));let o=lg(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?a=h:i.before(h)==f&&o.splice(1,0,-h)}let u=o.indexOf(a),l=[],c=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(l.push(p),f==r.openStart)break;h=p.content}for(let h=c-1;h>=0;h--){let f=l[h],p=P_(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))c=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+c+1)%(r.openStart+1),p=l[f];if(p)for(let m=0;m<o.length;m++){let g=o[(m+u)%o.length],b=!0;g<0&&(b=!1,g=-g);let v=i.node(g-1),_=i.index(g-1);if(v.canReplaceWith(_,_,p.type,p.marks))return t.replace(i.before(g),b?s.after(g):n,new R(ug(r.content,0,r.openStart,f),f,r.openEnd))}}let d=t.steps.length;for(let h=o.length-1;h>=0&&(t.replace(e,n,r),!(t.steps.length>d));h--){let f=o[h];f<0||(e=i.before(f),n=s.after(f))}}function ug(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(ug(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(M.empty,!0))}return t}function B_(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=N_(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new R(M.from(r),0,0))}function $_(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let u=r.depth;u>o;u--)r.node(u).type.spec.isolating&&(a=!0);for(let u=i.depth;u>o;u--)i.node(u).type.spec.isolating&&(a=!0);if(!a){for(let u=r.depth;u>0&&e==r.start(u);u--)e=r.before(u);for(let u=i.depth;u>0&&n==i.start(u);u--)n=i.before(u);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=lg(r,i);for(let o=0;o<s.length;o++){let a=s[o],u=o==s.length-1;if(u&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(u||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=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 t.delete(r.before(o),n);t.delete(e,n)}function lg(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class Ur extends Ye{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Ae.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Ae.fromReplace(e,this.pos,this.pos+1,new R(M.from(i),0,n.isLeaf?0:1))}getMap(){return dt.empty}invert(e){return new Ur(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ur(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ur(n.pos,n.attr,n.value)}}Ye.jsonID("attr",Ur);class es extends Ye{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Ae.ok(r)}getMap(){return dt.empty}invert(e){return new es(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new es(n.attr,n.value)}}Ye.jsonID("docAttr",es);let ei=class extends Error{};ei=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ei.prototype=Object.create(Error.prototype);ei.prototype.constructor=ei;ei.prototype.name="TransformError";class td{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Qi}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ei(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,u)=>{e=Math.min(e,a),n=Math.max(n,u)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=R.empty){let i=Da(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new R(M.from(r),0,0))}delete(e,n){return this.replace(e,n,R.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return L_(this,e,n,r),this}replaceRangeWith(e,n,r){return B_(this,e,n,r),this}deleteRange(e,n){return $_(this,e,n),this}lift(e,n){return w_(this,e,n),this}join(e,n=1){return R_(this,e,n),this}wrap(e,n){return S_(this,e,n),this}setBlockType(e,n=e,r,i=null){return M_(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return T_(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new Ur(e,n,r)),this}setDocAttribute(e,n){return this.step(new es(e,n)),this}addNodeMark(e,n){return this.step(new Pn(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof re)n.isInSet(r.marks)&&this.step(new gr(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new gr(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return D_(this,e,n,r),this}addMark(e,n,r){return __(this,e,n,r),this}removeMark(e,n,r){return x_(this,e,n,r),this}clearIncompatible(e,n,r){return Qc(this,e,n,r),this}}const Su=Object.create(null);class q{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new cg(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=R.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:u,$to:l}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(u.pos),c.map(l.pos),a?R.empty:n),a==0&&vf(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],u=e.mapping.slice(r),l=u.map(o.pos),c=u.map(a.pos);s?e.deleteRange(l,c):(e.replaceRangeWith(l,c,n),vf(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new H(e):Pr(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?Pr(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):Pr(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new mt(e.node(0))}static atStart(e){return Pr(e,e,0,0,1)||new mt(e)}static atEnd(e){return Pr(e,e,e.content.size,e.childCount,-1)||new mt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Su[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Su)throw new RangeError("Duplicate use of selection JSON ID "+e);return Su[e]=n,n.prototype.jsonID=e,n}getBookmark(){return H.between(this.$anchor,this.$head).getBookmark()}}q.prototype.visible=!0;class cg{constructor(e,n){this.$from=e,this.$to=n}}let gf=!1;function bf(t){!gf&&!t.parent.inlineContent&&(gf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class H extends q{constructor(e,n=e){bf(e),bf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return q.near(r);let i=e.resolve(n.map(this.anchor));return new H(i.parent.inlineContent?i:r,r)}replace(e,n=R.empty){if(super.replace(e,n),n==R.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof H&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Oa(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new H(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=q.findFrom(n,r,!0)||q.findFrom(n,-r,!0);if(s)n=s.$head;else return q.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(q.findFrom(e,-r,!0)||q.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new H(e,n)}}q.jsonID("text",H);class Oa{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Oa(e.map(this.anchor),e.map(this.head))}resolve(e){return H.between(e.resolve(this.anchor),e.resolve(this.head))}}class z extends q{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?q.near(s):new z(s)}content(){return new R(M.from(this.node),0,0)}eq(e){return e instanceof z&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new nd(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new z(e.resolve(n.anchor))}static create(e,n){return new z(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}z.prototype.visible=!1;q.jsonID("node",z);class nd{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Oa(r,r):new nd(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&z.isSelectable(r)?new z(n):q.near(n)}}class mt extends q{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=R.empty){if(n==R.empty){e.delete(0,e.doc.content.size);let r=q.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new mt(e)}map(e){return new mt(e)}eq(e){return e instanceof mt}getBookmark(){return z_}}q.jsonID("all",mt);const z_={map(){return this},resolve(t){return new mt(t)}};function Pr(t,e,n,r,i,s=!1){if(e.inlineContent)return H.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&z.isSelectable(a))return z.create(t,n-(i<0?a.nodeSize:0))}else{let u=Pr(t,a,n+i,i<0?a.childCount:0,i,s);if(u)return u}n+=a.nodeSize*i}return null}function vf(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Se||i instanceof Fe))return;let s=t.mapping.maps[r],o;s.forEach((a,u,l,c)=>{o==null&&(o=c)}),t.setSelection(q.near(t.doc.resolve(o),n))}const yf=1,Fs=2,_f=4;class H_ extends td{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.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|yf)&~Fs,this.storedMarks=null,this}get selectionSet(){return(this.updated&yf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fs,this}ensureMarks(e){return re.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&Fs)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fs,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||re.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(q.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,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|=_f,this}get scrolledIntoView(){return(this.updated&_f)>0}}function xf(t,e){return!e||!t?t:t.bind(e)}class Ti{constructor(e,n,r){this.name=e,this.init=xf(n.init,r),this.apply=xf(n.apply,r)}}const j_=[new Ti("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ti("selection",{init(t,e){return t.selection||q.atStart(e.doc)},apply(t){return t.selection}}),new Ti("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ti("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Mu{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=j_.slice(),n&&n.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 Ti(r.key,r.spec.state,r))})}}class jr{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let u=i?i[o].n:0,l=i?i[o].state:this,c=u<n.length&&a.spec.appendTransaction.call(a,u?n.slice(u):n,l,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new jr(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new H_(this)}static create(e){let n=new Mu(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new jr(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Mu(this.schema,e.plugins),r=n.fields,i=new jr(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.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&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Mu(e.schema,e.plugins),s=new jr(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=zn.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=q.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let u=r[a],l=u.spec.state;if(u.key==o.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=l.fromJSON.call(u,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function dg(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=dg(i,e,{})),n[r]=i}return n}class we{constructor(e){this.spec=e,this.props={},e.props&&dg(e.props,this,this.props),this.key=e.key?e.key.key:hg("plugin")}getState(e){return e[this.key]}}const Au=Object.create(null);function hg(t){return t in Au?t+"$"+ ++Au[t]:(Au[t]=0,t+"$")}class Be{constructor(e="key"){this.key=hg(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const je=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ti=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Zl=null;const ln=function(t,e,n){let r=Zl||(Zl=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},V_=function(){Zl=null},br=function(t,e,n,r){return n&&(kf(t,e,n,r,-1)||kf(t,e,n,r,1))},q_=/^(img|br|input|textarea|hr)$/i;function kf(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:Et(t))){let o=t.parentNode;if(!o||o.nodeType!=1||ms(t)||q_.test(t.nodeName)||t.contentEditable=="false")return!1;e=je(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?Et(t):0}else return!1}}function Et(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function W_(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Et(t)}else if(t.parentNode&&!ms(t))e=je(t),t=t.parentNode;else return null}}function U_(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!ms(t))e=je(t)+1,t=t.parentNode;else return null}}function K_(t,e,n){for(let r=e==0,i=e==Et(t);r||i;){if(t==n)return!0;let s=je(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==Et(t)}}function ms(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ra=function(t){return t.focusNode&&br(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function nr(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function J_(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function G_(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Et(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Et(r.startContainer),r.startOffset)}}}const Kt=typeof navigator<"u"?navigator:null,wf=typeof document<"u"?document:null,Kn=Kt&&Kt.userAgent||"",Xl=/Edge\/(\d+)/.exec(Kn),fg=/MSIE \d/.exec(Kn),Ql=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kn),ut=!!(fg||Ql||Xl),Hn=fg?document.documentMode:Ql?+Ql[1]:Xl?+Xl[1]:0,Mt=!ut&&/gecko\/(\d+)/i.test(Kn);Mt&&+(/Firefox\/(\d+)/.exec(Kn)||[0,0])[1];const ec=!ut&&/Chrome\/(\d+)/.exec(Kn),qe=!!ec,pg=ec?+ec[1]:0,Je=!ut&&!!Kt&&/Apple Computer/.test(Kt.vendor),ni=Je&&(/Mobile\/\w+/.test(Kn)||!!Kt&&Kt.maxTouchPoints>2),wt=ni||(Kt?/Mac/.test(Kt.platform):!1),mg=Kt?/Win/.test(Kt.platform):!1,fn=/Android \d/.test(Kn),gs=!!wf&&"webkitFontSmoothing"in wf.documentElement.style,Y_=gs?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Z_(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function nn(t,e){return typeof t=="number"?t:t[e]}function X_(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Cf(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=ti(o);continue}let a=o,u=a==s.body,l=u?Z_(s):X_(a),c=0,d=0;if(e.top<l.top+nn(r,"top")?d=-(l.top-e.top+nn(i,"top")):e.bottom>l.bottom-nn(r,"bottom")&&(d=e.bottom-e.top>l.bottom-l.top?e.top+nn(i,"top")-l.top:e.bottom-l.bottom+nn(i,"bottom")),e.left<l.left+nn(r,"left")?c=-(l.left-e.left+nn(i,"left")):e.right>l.right-nn(r,"right")&&(c=e.right-l.right+nn(i,"right")),c||d)if(u)s.defaultView.scrollBy(c,d);else{let f=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let m=a.scrollLeft-f,g=a.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}let h=u?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(h))break;o=h=="absolute"?o.offsetParent:ti(o)}}function Q_(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let u=a.getBoundingClientRect();if(u.top>=n-20){r=a,i=u.top;break}}return{refDOM:r,refTop:i,stack:gg(t.dom)}}function gg(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ti(r));return e}function ex({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;bg(n,r==0?0:r-e)}function bg(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let Tr=null;function tx(t){if(t.setActive)return t.setActive();if(Tr)return t.focus(Tr);let e=gg(t);t.focus(Tr==null?{get preventScroll(){return Tr={preventScroll:!0},!0}}:void 0),Tr||(Tr=!1,bg(e,0))}function vg(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,u,l;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let h;if(c.nodeType==1)h=c.getClientRects();else if(c.nodeType==3)h=ln(c).getClientRects();else continue;for(let f=0;f<h.length;f++){let p=h[f];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=c,r=m,i=m&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&m&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!u&&p.left<=e.left&&p.right>=e.left&&(u=c,l={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&u&&(n=u,i=l,r=0),n&&n.nodeType==3?nx(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:vg(n,i)}function nx(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=En(r,1);if(o.top!=o.bottom&&rd(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function rd(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function rx(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function ix(t,e,n){let{node:r,offset:i}=vg(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function sx(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),u;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((u=a.dom.getBoundingClientRect()).width||u.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&u.left>r.left||u.top>r.top?i=a.posBefore:(!o&&u.right<r.left||u.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(u.top+u.bottom)/2:r.left<(u.left+u.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function yg(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let u=0;u<a.length;u++){let l=a[u];if(rd(e,l))return yg(o,e,l)}}if((s=(s+1)%r)==i)break}return t}function ox(t,e){let n=t.dom.ownerDocument,r,i=0,s=G_(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let l=t.dom.getBoundingClientRect();if(!rd(e,l)||(o=yg(t.dom,e,l),!o))return null}if(Je)for(let l=o;r&&l;l=ti(l))l.draggable&&(r=void 0);if(o=rx(o,e),r){if(Mt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let l;gs&&i&&r.nodeType==1&&(l=r.childNodes[i-1]).nodeType==1&&l.contentEditable=="false"&&l.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=sx(t,r,i,e))}a==null&&(a=ix(t,o,e));let u=t.docView.nearestDesc(o,!0);return{pos:a,inside:u?u.posAtStart-u.border:-1}}function Ef(t){return t.top<t.bottom||t.left<t.right}function En(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(Ef(r))return r}return Array.prototype.find.call(n,Ef)||t.getBoundingClientRect()}const ax=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function _g(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=gs||Mt;if(r.nodeType==3)if(o&&(ax.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let u=En(ln(r,i,i),n);if(Mt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let l=En(ln(r,i-1,i-1),-1);if(l.top==u.top){let c=En(ln(r,i,i+1),-1);if(c.top!=u.top)return bi(c,c.left<l.left)}}return u}else{let u=i,l=i,c=n<0?1:-1;return n<0&&!i?(l++,c=-1):n>=0&&i==r.nodeValue.length?(u--,c=1):n<0?u--:l++,bi(En(ln(r,u,l),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==Et(r))){let u=r.childNodes[i-1];if(u.nodeType==1)return Tu(u.getBoundingClientRect(),!1)}if(s==null&&i<Et(r)){let u=r.childNodes[i];if(u.nodeType==1)return Tu(u.getBoundingClientRect(),!0)}return Tu(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==Et(r))){let u=r.childNodes[i-1],l=u.nodeType==3?ln(u,Et(u)-(o?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(l)return bi(En(l,1),!1)}if(s==null&&i<Et(r)){let u=r.childNodes[i];for(;u.pmViewDesc&&u.pmViewDesc.ignoreForCoords;)u=u.nextSibling;let l=u?u.nodeType==3?ln(u,0,o?0:1):u.nodeType==1?u:null:null;if(l)return bi(En(l,-1),!0)}return bi(En(r.nodeType==3?ln(r):r,-n),n>=0)}function bi(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Tu(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function xg(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function ux(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return xg(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=_g(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let u;if(a.nodeType==1)u=a.getClientRects();else if(a.nodeType==3)u=ln(a,0,a.nodeValue.length).getClientRects();else continue;for(let l=0;l<u.length;l++){let c=u[l];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const lx=/[\u0590-\u08ac]/;function cx(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!lx.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:xg(t,e,()=>{let{focusNode:u,focusOffset:l,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",n,"character");let f=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),g=p&&!f.contains(p.nodeType==1?p:p.parentNode)||u==p&&l==m;try{a.collapse(c,d),u&&(u!=c||l!=d)&&a.extend&&a.extend(u,l)}catch{}return h!=null&&(a.caretBidiLevel=h),g}):r.pos==r.start()||r.pos==r.end()}let Sf=null,Mf=null,Af=!1;function dx(t,e,n){return Sf==e&&Mf==n?Af:(Sf=e,Mf=n,Af=n=="up"||n=="down"?ux(t,e,n):cx(t,e,n))}const At=0,Tf=1,ir=2,Jt=3;class bs{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=At,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>je(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(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==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,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||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 n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof wg){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof kg&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?je(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?je(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let u=this.children[a],l=o+u.size;if(i==-1&&e<=l){let c=o+u.border;if(e>=c&&n<=l-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(e,n,c);e=o;for(let d=a;d>0;d--){let h=this.children[d-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=je(h.dom)+1;break}e-=h.size}i==-1&&(i=0)}if(i>-1&&(l>n||a==this.children.length-1)){n=l;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=je(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let f=0,p=0;f<this.children.length;f++){let m=this.children[f],g=p+m.size;if(s>p&&o<g)return m.setSelection(e-p-m.border,n-p-m.border,r,i);p=g}let a=this.domFromPos(e,e?-1:1),u=n==e?a:this.domFromPos(n,n?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Mt||Je)&&e==n){let{node:f,offset:p}=a;if(f.nodeType==3){if(d=!!(p&&f.nodeValue[p-1]==`
|
|
7
|
+
`),d&&p==f.nodeValue.length)for(let m=f,g;m;m=m.parentNode){if(g=m.nextSibling){g.nodeName=="BR"&&(a=u={node:g.parentNode,offset:je(g)+1});break}let b=m.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let m=f.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Mt&&c.focusNode&&c.focusNode!=u.node&&c.focusNode.nodeType==1){let f=c.focusNode.childNodes[c.focusOffset];f&&f.contentEditable=="false"&&(i=!0)}if(!(i||d&&Je)&&br(a.node,a.offset,c.anchorNode,c.anchorOffset)&&br(u.node,u.offset,c.focusNode,c.focusOffset))return;let h=!1;if((l.extend||e==n)&&!(d&&Mt)){l.collapse(a.node,a.offset);try{e!=n&&l.extend(u.node,u.offset),h=!0}catch{}}if(!h){if(e>n){let p=a;a=u,u=p}let f=document.createRange();f.setEnd(u.node,u.offset),f.setStart(a.node,a.offset),l.removeAllRanges(),l.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,u=o-s.border;if(e>=a&&n<=u){this.dirty=e==r||n==o?ir:Tf,e==a&&n==u&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=Jt:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?ir:Jt}r=o}this.dirty=ir}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ir:Tf;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class kg extends bs{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==At&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(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 ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class hx extends bs{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class vr extends bs{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=kr.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new vr(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Jt||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Jt&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=At){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=At}}slice(e,n,r){let i=vr.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=nc(s,n,o,r)),e>0&&(s=nc(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class jn extends bs{constructor(e,n,r,i,s,o,a,u,l){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],u,l=a&&a(n,s,()=>{if(!u)return o;if(u.parent)return u.parent.posBeforeChild(u)},r,i),c=l&&l.dom,d=l&&l.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=kr.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let h=c;return c=Sg(c,r,n),l?u=new fx(e,n,r,i,c,d||null,h,l,s,o+1):n.isText?new Na(e,n,r,i,c,h,s):new jn(e,n,r,i,c,d||null,h,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 n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>M.empty)}return e}matchesNode(e,n,r){return this.dirty==At&&e.eq(this.node)&&Po(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,u=new mx(this,o&&o.node,e);vx(this.node,this.innerDeco,(l,c,d)=>{l.spec.marks?u.syncToMarks(l.spec.marks,r,e,c):l.type.side>=0&&!d&&u.syncToMarks(c==this.node.childCount?re.none:this.node.child(c).marks,r,e,c),u.placeWidget(l,e,i)},(l,c,d,h)=>{u.syncToMarks(l.marks,r,e,h);let f;u.findNodeMatch(l,c,d,h)||a&&e.state.selection.from>i&&e.state.selection.to<i+l.nodeSize&&(f=u.findIndexWithChild(s.node))>-1&&u.updateNodeAt(l,c,d,f,e)||u.updateNextNode(l,c,d,e,h,i)||u.addNode(l,c,d,e,i),i+=l.nodeSize}),u.syncToMarks([],r,e,0),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==ir)&&(o&&this.protectLocalComposition(e,o),Cg(this.contentDOM,this.children,e),ni&&yx(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof H)||r<n||i>n+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,a=_x(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;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 hx(this,s,n,i);e.input.compositionNodes.push(o),this.children=nc(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==Jt||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=At}updateOuterDeco(e){if(Po(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=Eg(this.dom,this.nodeDOM,tc(this.outerDeco,this.node,n),tc(e,this.node,n)),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.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Df(t,e,n,r,i){Sg(r,e,t);let s=new jn(void 0,t,e,n,r,r,r,i,0);return s.contentDOM&&s.updateChildren(i,0),s}class Na extends jn{constructor(e,n,r,i,s,o,a){super(e,n,r,i,s,null,o,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Jt||this.dirty!=At&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=At||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=At,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new Na(this.parent,i,this.outerDeco,this.innerDeco,s,s,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Jt)}get domAtom(){return!1}isText(e){return this.node.text==e}}class wg extends bs{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==At&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class fx extends jn{constructor(e,n,r,i,s,o,a,u,l,c){super(e,n,r,i,s,o,a,l,c),this.spec=u}update(e,n,r,i){if(this.dirty==Jt)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,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 Cg(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=Of(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof vr){let u=r?r.previousSibling:t.lastChild;Cg(o.contentDOM,o.children,n),r=u?u.nextSibling:t.firstChild}}for(;r;)r=Of(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const Bi=function(t){t&&(this.nodeName=t)};Bi.prototype=Object.create(null);const sr=[new Bi];function tc(t,e,n){if(t.length==0)return sr;let r=n?sr[0]:new Bi,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new Bi(o.nodeName));for(let a in o){let u=o[a];u!=null&&(n&&i.length==1&&i.push(r=new Bi(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+u:a=="style"?r.style=(r.style?r.style+";":"")+u:a!="nodeName"&&(r[a]=u))}}}return i}function Eg(t,e,n,r){if(n==sr&&r==sr)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let u;a&&a.nodeName==o.nodeName&&i!=t&&(u=i.parentNode)&&u.nodeName.toLowerCase()==o.nodeName||(u=document.createElement(o.nodeName),u.pmIsDeco=!0,u.appendChild(i),a=sr[0]),i=u}px(i,a||sr[0],o)}return i}function px(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Sg(t,e,n){return Eg(t,t,sr,tc(e,n,t.nodeType!=1))}function Po(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function Of(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class mx{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=gx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=At,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let u=-1,l=this.top.children.length;i<this.preMatch.index&&(l=Math.min(this.index+3,l));for(let c=this.index;c<l;c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){u=c;break}}if(u>-1)u>this.index&&(this.changed=!0,this.destroyBetween(this.index,u)),this.top=this.top.children[this.index];else{let c=vr.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,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,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,u=Math.min(this.top.children.length,a+5);a<u;a++){let l=this.top.children[a];if(l.matchesNode(e,n,r)&&!this.preMatch.matched.has(l)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==Jt&&o.dom==o.contentDOM&&(o.dirty=ir),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let u=this.top.children[a];if(u instanceof jn){let l=this.preMatch.matched.get(u);if(l!=null&&l!=s)return!1;let c=u.dom,d,h=this.isLocked(c)&&!(e.isText&&u.node&&u.node.isText&&u.nodeDOM.nodeValue==e.text&&u.dirty!=Jt&&Po(n,u.outerDeco));if(!h&&u.update(e,n,r,i))return this.destroyBetween(this.index,a),u.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(u,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=ir,d.updateChildren(i,o+1),d.dirty=At),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Po(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=jn.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let u of a.children)u.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=jn.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new kg(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof vr;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Na)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Je||qe)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new wg(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function gx(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let l=n.children[r-1];if(l instanceof vr)n=l,r=l.children.length;else{a=l,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let u=a.node;if(u){if(u!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function bx(t,e){return t.type.side-e.type.side}function vx(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let l=0;l<t.childCount;l++){let c=t.child(l);r(c,i,e.forChild(s,c),l),s+=c.nodeSize}return}let o=0,a=[],u=null;for(let l=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let g=i[o++];g.widget&&(c?(d||(d=[c])).push(g):c=g)}if(c)if(d){d.sort(bx);for(let g=0;g<d.length;g++)n(d[g],l,!!u)}else n(c,l,!!u);let h,f;if(u)f=-1,h=u,u=null;else if(l<t.childCount)f=l,h=t.child(l++);else break;for(let g=0;g<a.length;g++)a[g].to<=s&&a.splice(g--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+h.nodeSize;if(h.isText){let g=p;o<i.length&&i[o].from<g&&(g=i[o].from);for(let b=0;b<a.length;b++)a[b].to<g&&(g=a[b].to);g<p&&(u=h.cut(g-s),h=h.cut(0,g-s),p=g,f=-1)}else for(;o<i.length&&i[o].to<p;)o++;let m=h.isInline&&!h.isLeaf?a.filter(g=>!g.inline):a.slice();r(h,m,e.forChild(s,h),f),s=p}}function yx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function _x(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let u=o.text;for(;i<t.childCount;){let l=t.child(i++);if(s+=l.nodeSize,!l.isText)break;u+=l.text}if(s>=n){if(s>=r&&u.slice(r-e.length-a,r-a)==e)return r-e.length;let l=a<r?u.lastIndexOf(e,r-a-1):-1;if(l>=0&&l+e.length+a>=n)return a+l;if(n==r&&u.length>=r+e.length-a&&u.slice(r-a,r-a+e.length)==e)return r}}return-1}function nc(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let u=t[o],l=a,c=a+=u.size;l>=n||c<=e?s.push(u):(l<e&&s.push(u.slice(0,e-l,r)),i&&(s.push(i),i=void 0),c>n&&s.push(u.slice(n-l,u.size,r)))}return s}function id(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),u,l;if(Ra(n)){for(u=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&z.isSelectable(d)&&i.parent&&!(d.isInline&&K_(n.focusNode,n.focusOffset,i.dom))){let h=i.posBefore;l=new z(o==h?a:r.resolve(h))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,h=o;for(let f=0;f<n.rangeCount;f++){let p=n.getRangeAt(f);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),h=Math.max(h,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[u,o]=h==t.state.selection.anchor?[h,d]:[d,h],a=r.resolve(o)}else u=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(u<0)return null}let c=r.resolve(u);if(!l){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;l=sd(t,c,a,d)}return l}function Mg(t){return t.editable?t.hasFocus():Tg(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function bn(t,e=!1){let n=t.state.selection;if(Ag(t,n),!!Mg(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&qe){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&br(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)kx(t);else{let{anchor:r,head:i}=n,s,o;Rf&&!(n instanceof H)&&(n.$from.parent.inlineContent||(s=Nf(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Nf(t,n.to))),t.docView.setSelection(r,i,t,e),Rf&&(s&&Ff(s),o&&Ff(o)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&xx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Rf=Je||qe&&pg<63;function Nf(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(Je&&i&&i.contentEditable=="false")return Du(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Du(i);if(s)return Du(s)}}function Du(t){return t.contentEditable="true",Je&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ff(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function xx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Mg(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function kx(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,je(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&ut&&Hn<=11&&(n.disabled=!0,n.disabled=!1)}function Ag(t,e){if(e instanceof z){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(If(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else If(t)}function If(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function sd(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||H.between(e,n,r)}function Pf(t){return t.editable&&!t.hasFocus()?!1:Tg(t)}function Tg(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function wx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return br(e.node,e.offset,n.anchorNode,n.anchorOffset)}function rc(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&q.findFrom(s,e)}function Sn(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Lf(t,e,n){let r=t.state.selection;if(r instanceof H)if(n.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=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Sn(t,new H(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=rc(t.state,e);return i&&i instanceof z?Sn(t,i):!1}else if(!(wt&&n.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 a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?z.isSelectable(s)?Sn(t,new z(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):gs?Sn(t,new H(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof z&&r.node.isInline)return Sn(t,new H(e>0?r.$to:r.$from));{let i=rc(t.state,e);return i?Sn(t,i):!1}}}function Lo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function $i(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Dr(t,e){return e<0?Cx(t):Ex(t)}function Cx(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(Mt&&n.nodeType==1&&r<Lo(n)&&$i(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if($i(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(Dg(n))break;{let a=n.previousSibling;for(;a&&$i(a,-1);)i=n.parentNode,s=je(a),a=a.previousSibling;if(a)n=a,r=Lo(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?ic(t,n,r):i&&ic(t,i,s)}function Ex(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Lo(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if($i(a,1))s=n,o=++r;else break}else{if(Dg(n))break;{let a=n.nextSibling;for(;a&&$i(a,1);)s=a.parentNode,o=je(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=Lo(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&ic(t,s,o)}function Dg(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function Sx(t,e){for(;t&&e==t.childNodes.length&&!ms(t);)e=je(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Mx(t,e){for(;t&&!e&&!ms(t);)e=je(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function ic(t,e,n){if(e.nodeType!=3){let s,o;(o=Sx(e,n))?(e=o,n=0):(s=Mx(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ra(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&bn(t)},50)}function Bf(t,e){let n=t.state.doc.resolve(e);if(!(qe||mg)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function $f(t,e,n){let r=t.state.selection;if(r instanceof H&&!r.empty||n.indexOf("s")>-1||wt&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=rc(t.state,e);if(o&&o instanceof z)return Sn(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof mt?q.near(o,e):q.findFrom(o,e);return a?Sn(t,a):!1}return!1}function zf(t,e){if(!(t.state.selection instanceof H))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Hf(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Ax(t){if(!Je||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Hf(t,r,"true"),setTimeout(()=>Hf(t,r,"false"),20)}return!1}function Tx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Dx(t,e){let n=e.keyCode,r=Tx(e);if(n==8||wt&&n==72&&r=="c")return zf(t,-1)||Dr(t,-1);if(n==46&&!e.shiftKey||wt&&n==68&&r=="c")return zf(t,1)||Dr(t,1);if(n==13||n==27)return!0;if(n==37||wt&&n==66&&r=="c"){let i=n==37?Bf(t,t.state.selection.from)=="ltr"?-1:1:-1;return Lf(t,i,r)||Dr(t,i)}else if(n==39||wt&&n==70&&r=="c"){let i=n==39?Bf(t,t.state.selection.from)=="ltr"?1:-1:1;return Lf(t,i,r)||Dr(t,i)}else{if(n==38||wt&&n==80&&r=="c")return $f(t,-1,r)||Dr(t,-1);if(n==40||wt&&n==78&&r=="c")return Ax(t)||$f(t,1,r)||Dr(t,1);if(r==(wt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function od(t,e){t.someProp("transformCopied",f=>{e=f(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let f=r.firstChild;n.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let o=t.someProp("clipboardSerializer")||kr.fromSchema(t.state.schema),a=Pg(),u=a.createElement("div");u.appendChild(o.serializeFragment(r,{document:a}));let l=u.firstChild,c,d=0;for(;l&&l.nodeType==1&&(c=Ig[l.nodeName.toLowerCase()]);){for(let f=c.length-1;f>=0;f--){let p=a.createElement(c[f]);for(;u.firstChild;)p.appendChild(u.firstChild);u.appendChild(p),d++}l=u.firstChild}l&&l.nodeType==1&&l.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let h=t.someProp("clipboardTextSerializer",f=>f(e,t))||e.content.textBetween(0,e.content.size,`
|
|
8
|
+
|
|
9
|
+
`);return{dom:u,text:h,slice:e}}function Og(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let u=!!e&&(r||s||!n);if(u){if(t.someProp("transformPastedText",h=>{e=h(e,s||r,t)}),s)return a=new R(M.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
10
|
+
`))),0,0),t.someProp("transformPasted",h=>{a=h(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",h=>h(e,i,r,t));if(d)a=d;else{let h=i.marks(),{schema:f}=t.state,p=kr.fromSchema(f);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let g=o.appendChild(document.createElement("p"));m&&g.appendChild(p.serializeNode(f.text(m,h)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=Fx(n),gs&&Ix(o);let l=o&&o.querySelector("[data-pm-slice]"),c=l&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(l.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let h=o.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;o=h}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||mn.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(u||c),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Ox.test(h.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Px(jf(a,+c[1],+c[2]),c[4]);else if(a=R.maxOpen(Rx(a.content,i),!0),a.openStart||a.openEnd){let d=0,h=0;for(let f=a.content.firstChild;d<a.openStart&&!f.type.spec.isolating;d++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=jf(a,d,h)}return t.someProp("transformPasted",d=>{a=d(a,t,u)}),a}const Ox=/^(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 Rx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let u=i.findWrapping(a.type),l;if(!u)return o=null;if(l=o.length&&s.length&&Ng(u,s,a,o[o.length-1],0))o[o.length-1]=l;else{o.length&&(o[o.length-1]=Fg(o[o.length-1],s.length));let c=Rg(a,u);o.push(c),i=i.matchType(c.type),s=u}}),o)return M.from(o)}return t}function Rg(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function Ng(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=Ng(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(M.from(Rg(n,t,i+1))))}}function Fg(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Fg(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}function sc(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=sc(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function jf(t,e,n){return e<t.openStart&&(t=new R(sc(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new R(sc(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Ig={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Vf=null;function Pg(){return Vf||(Vf=document.implementation.createHTMLDocument("title"))}let Ou=null;function Nx(t){let e=window.trustedTypes;return e?(Ou||(Ou=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Ou.createHTML(t)):t}function Fx(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Pg().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&Ig[r[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),n.innerHTML=Nx(t),i)for(let s=0;s<i.length;s++)n=n.querySelector(i[s])||n;return n}function Ix(t){let e=t.querySelectorAll(qe?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function Px(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let u=n.nodes[r[a]];if(!u||u.hasRequiredAttrs())break;i=M.from(u.create(r[a+1],i)),s++,o++}return new R(i,s,o)}const nt={},rt={},Lx={touchstart:!0,touchmove:!0};class Bx{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function $x(t){for(let e in nt){let n=nt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Hx(t,r)&&!ad(t,r)&&(t.editable||!(r.type in rt))&&n(t,r)},Lx[e]?{passive:!0}:void 0)}Je&&t.dom.addEventListener("input",()=>null),oc(t)}function Ln(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function zx(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function oc(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>ad(t,r))})}function ad(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Hx(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function jx(t,e){!ad(t,e)&&nt[e.type]&&(t.editable||!(e.type in rt))&&nt[e.type](t,e)}rt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!Bg(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(fn&&qe&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),ni&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,nr(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Dx(t,n)?n.preventDefault():Ln(t,"key")};rt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};rt.keypress=(t,e)=>{let n=e;if(Bg(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||wt&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof H)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Fa(t){return{left:t.clientX,top:t.clientY}}function Vx(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function ud(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Kr(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function qx(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&z.isSelectable(r)?(Kr(t,new z(n)),!0):!1}function Wx(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof z&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(z.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Kr(t,z.create(t.state.doc,i)),!0):!1}function Ux(t,e,n,r,i){return ud(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?Wx(t,n):qx(t,n))}function Kx(t,e,n,r){return ud(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function Jx(t,e,n,r){return ud(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||Gx(t,n,r)}function Gx(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Kr(t,H.create(r,0,r.content.size)),!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),a=i.before(s);if(o.inlineContent)Kr(t,H.create(r,a+1,a+1+o.content.size));else if(z.isSelectable(o))Kr(t,z.create(r,a));else continue;return!0}}function ld(t){return Bo(t)}const Lg=wt?"metaKey":"ctrlKey";nt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=ld(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&Vx(n,t.input.lastClick)&&!n[Lg]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button};let o=t.posAtCoords(Fa(n));o&&(s=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new Yx(t,o,n,!!r)):(s=="doubleClick"?Kx:Jx)(t,o.pos,o.inside,n)?n.preventDefault():Ln(t,"pointer"))};class Yx{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Lg],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,u=a?e.docView.nearestDesc(a,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:l}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||l instanceof z&&l.from<=o&&l.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Mt&&!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)),Ln(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(()=>bn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Fa(e))),this.updateAllowDefault(e),this.allowDefault||!n?Ln(this.view,"pointer"):Ux(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Je&&this.mightDrag&&!this.mightDrag.node.isAtom||qe&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Kr(this.view,q.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Ln(this.view,"pointer")}move(e){this.updateAllowDefault(e),Ln(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)}}nt.touchstart=t=>{t.input.lastTouch=Date.now(),ld(t),Ln(t,"pointer")};nt.touchmove=t=>{t.input.lastTouch=Date.now(),Ln(t,"pointer")};nt.contextmenu=t=>ld(t);function Bg(t,e){return t.composing?!0:Je&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const Zx=fn?5e3:-1;rt.compositionstart=rt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof H&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||qe&&mg&&Xx(t)))t.markCursor=t.state.storedMarks||n.marks(),Bo(t,!0),t.markCursor=null;else if(Bo(t,!e.selection.empty),Mt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.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 a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}$g(t,Zx)};function Xx(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}rt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,$g(t,20))};function $g(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Bo(t),e))}function zg(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=ek());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Qx(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=W_(e.focusNode,e.focusOffset),r=U_(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function ek(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Bo(t,e=!1){if(!(fn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),zg(t),e||t.docView&&t.docView.dirty){let n=id(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function tk(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const ts=ut&&Hn<15||ni&&Y_<604;nt.copy=rt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=ts?null:n.clipboardData,o=r.content(),{dom:a,text:u}=od(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",u)):tk(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function nk(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function rk(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?ns(t,r.value,null,i,e):ns(t,r.textContent,r.innerHTML,i,e)},50)}function ns(t,e,n,r,i){let s=Og(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",u=>u(t,i,s||R.empty)))return!0;if(!s)return!1;let o=nk(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hg(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}rt.paste=(t,e)=>{let n=e;if(t.composing&&!fn)return;let r=ts?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&ns(t,Hg(r),r.getData("text/html"),i,n)?n.preventDefault():rk(t,n)};class jg{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const ik=wt?"altKey":"ctrlKey";function Vg(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[ik]}nt.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Fa(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof z?i.to-1:i.to))){if(r&&r.mightDrag)o=z.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=z.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:u,text:l,slice:c}=od(t,a);(!n.dataTransfer.files.length||!qe||pg>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(ts?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",ts||n.dataTransfer.setData("text/plain",l),t.dragging=new jg(c,Vg(t,n),o)};nt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};rt.dragover=rt.dragenter=(t,e)=>e.preventDefault();rt.drop=(t,e)=>{try{sk(t,e,t.dragging)}finally{t.dragging=null}};function sk(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Fa(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",f=>{s=f(s,t,!1)}):s=Og(t,Hg(e.dataTransfer),ts?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&Vg(t,e));if(t.someProp("handleDrop",f=>f(t,e,s||R.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?sg(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let u=t.state.tr;if(o){let{node:f}=n;f?f.replace(u):u.deleteSelection()}let l=u.mapping.map(a),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=u.doc;if(c?u.replaceRangeWith(l,l,s.content.firstChild):u.replaceRange(l,l,s),u.doc.eq(d))return;let h=u.doc.resolve(l);if(c&&z.isSelectable(s.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new z(h));else{let f=u.mapping.map(a);u.mapping.maps[u.mapping.maps.length-1].forEach((p,m,g,b)=>f=b),u.setSelection(sd(t,h,u.doc.resolve(f)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))}nt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&bn(t)},20))};nt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};nt.beforeinput=(t,e)=>{if(qe&&fn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,nr(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in rt)nt[t]=rt[t];function rs(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class $o{constructor(e,n){this.toDOM=e,this.spec=n||dr,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new tt(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof $o&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&rs(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Vn{constructor(e,n){this.attrs=e,this.spec=n||dr}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new tt(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof Vn&&rs(this.attrs,e.attrs)&&rs(this.spec,e.spec)}static is(e){return e.type instanceof Vn}destroy(){}}class cd{constructor(e,n){this.attrs=e,this.spec=n||dr}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new tt(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof cd&&rs(this.attrs,e.attrs)&&rs(this.spec,e.spec)}destroy(){}}class tt{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new tt(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new tt(e,e,new $o(n,r))}static inline(e,n,r,i){return new tt(e,n,new Vn(r,i))}static node(e,n,r,i){return new tt(e,n,new cd(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof Vn}get widget(){return this.type instanceof $o}}const Lr=[],dr={};class ye{constructor(e,n){this.local=e.length?e:Lr,this.children=n.length?n:Lr}static create(e,n){return n.length?zo(n,e,0,dr):Ke}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==Ke||e.maps.length==0?this:this.mapInner(e,n,0,0,r||dr)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let u=this.local[a].map(e,r,i);u&&u.type.valid(n,u)?(o||(o=[])).push(u):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?ok(this.children,o||[],e,n,r,i,s):o?new ye(o.sort(hr),Lr):Ke}add(e,n){return n.length?this==Ke?ye.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,u)=>{let l=u+r,c;if(c=Wg(n,a,l)){for(i||(i=this.children.slice());s<i.length&&i[s]<u;)s+=3;i[s]==u?i[s+2]=i[s+2].addInner(a,c,l+1):i.splice(s,0,u,u+a.nodeSize,zo(c,a,l+1,dr)),s+=3}});let o=qg(s?Ug(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new ye(o.length?this.local.concat(o).sort(hr):this.local,i||this.children)}remove(e){return e.length==0||this==Ke?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,u=r[s+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<u&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let l=r[s+2].removeInner(o,a+1);l!=Ke?r[s+2]=l:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new ye(i,r):Ke}forChild(e,n){if(this==Ke)return this;if(n.isLeaf)return ye.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let u=this.local[a];if(u.from<o&&u.to>s&&u.type instanceof Vn){let l=Math.max(s,u.from)-s,c=Math.min(o,u.to)-s;l<c&&(i||(i=[])).push(u.copy(l,c))}}if(i){let a=new ye(i.sort(hr),Lr);return r?new On([a,r]):a}return r||Ke}eq(e){if(this==e)return!0;if(!(e instanceof ye)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return dd(this.localsInner(e))}localsInner(e){if(this==Ke)return Lr;if(e.inlineContent||!this.local.some(Vn.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Vn||n.push(this.local[r]);return n}forEachSet(e){e(this)}}ye.empty=new ye([],[]);ye.removeOverlap=dd;const Ke=ye.empty;class On{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,dr));return On.from(r)}forChild(e,n){if(n.isLeaf)return ye.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=Ke&&(s instanceof On?r=r.concat(s.members):r.push(s))}return On.from(r)}eq(e){if(!(e instanceof On)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?dd(r?n:n.sort(hr)):Lr}static from(e){switch(e.length){case 0:return Ke;case 1:return e[0];default:return new On(e.every(n=>n instanceof ye)?e:e.reduce((n,r)=>n.concat(r instanceof ye?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function ok(t,e,n,r,i,s,o){let a=t.slice();for(let l=0,c=s;l<n.maps.length;l++){let d=0;n.maps[l].forEach((h,f,p,m)=>{let g=m-p-(f-h);for(let b=0;b<a.length;b+=3){let v=a[b+1];if(v<0||h>v+c-d)continue;let _=a[b]+c-d;f>=_?a[b+1]=h<=_?-2:-1:h>=c&&g&&(a[b]+=g,a[b+1]+=g)}d+=g}),c=n.maps[l].map(c,-1)}let u=!1;for(let l=0;l<a.length;l+=3)if(a[l+1]<0){if(a[l+1]==-2){u=!0,a[l+1]=-1;continue}let c=n.map(t[l]+s),d=c-i;if(d<0||d>=r.content.size){u=!0;continue}let h=n.map(t[l+1]+s,-1),f=h-i,{index:p,offset:m}=r.content.findIndex(d),g=r.maybeChild(p);if(g&&m==d&&m+g.nodeSize==f){let b=a[l+2].mapInner(n,g,c+1,t[l]+s+1,o);b!=Ke?(a[l]=d,a[l+1]=f,a[l+2]=b):(a[l+1]=-2,u=!0)}else u=!0}if(u){let l=ak(a,t,e,n,i,s,o),c=zo(l,r,0,o);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,h=0;d<c.children.length;d+=3){let f=c.children[d];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,c.children[d],c.children[d+1],c.children[d+2])}}return new ye(e.sort(hr),a)}function qg(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new tt(i.from+e,i.to+e,i.type))}return n}function ak(t,e,n,r,i,s,o){function a(u,l){for(let c=0;c<u.local.length;c++){let d=u.local[c].map(r,i,l);d?n.push(d):o.onRemove&&o.onRemove(u.local[c].spec)}for(let c=0;c<u.children.length;c+=3)a(u.children[c+2],u.children[c]+l+1)}for(let u=0;u<t.length;u+=3)t[u+1]==-1&&a(t[u+2],e[u]+s+1);return n}function Wg(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function Ug(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function zo(t,e,n,r){let i=[],s=!1;e.forEach((a,u)=>{let l=Wg(t,a,u+n);if(l){s=!0;let c=zo(l,a,n+u+1,r);c!=Ke&&i.push(u,u+a.nodeSize,c)}});let o=qg(s?Ug(t):t,-n).sort(hr);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new ye(o,i):Ke}function hr(t,e){return t.from-e.from||t.to-e.to}function dd(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),qf(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),qf(e,i,r.copy(s.from,r.to)));break}}}return e}function qf(t,e,n){for(;e<t.length&&hr(n,t[e])>0;)e++;t.splice(e,0,n)}function Ru(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Ke&&e.push(r)}),t.cursorWrapper&&e.push(ye.create(t.state.doc,[t.cursorWrapper.deco])),On.from(e)}const uk={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},lk=ut&&Hn<=11;class ck{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}}class dk{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ck,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);ut&&Hn<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():Je&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),lk&&(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,uk)),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 n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.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(Pf(this.view)){if(this.suppressingSelectionUpdates)return bn(this.view);if(ut&&Hn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&br(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 n=new Set,r;for(let s=e.focusNode;s;s=ti(s))n.add(s);for(let s=e.anchorNode;s;s=ti(s))if(n.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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Pf(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,u=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],u);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(u.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let c of u)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){c.parentNode.removeChild(c);break}d=d.firstChild}}}else if(Mt&&u.length){let c=u.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,h]=c;d.parentNode&&d.parentNode.parentNode==h.parentNode?h.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let h of c){let f=h.parentNode;f&&f.nodeName=="LI"&&(!d||pk(e,d)!=f)&&h.remove()}}}let l=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ra(r)&&(l=id(e))&&l.eq(q.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,bn(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),hk(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,mk(e,u)),this.handleDOMChange(s,o,a,u),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||bn(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.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 c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(ut&&Hn<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:h}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(s=h)}let o=i&&i.parentNode==e.target?je(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),u=s&&s.parentNode==e.target?je(s):e.target.childNodes.length,l=r.localPosFromDOM(e.target,u,1);return{from:a,to:l}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Wf=new WeakMap,Uf=!1;function hk(t){if(!Wf.has(t)&&(Wf.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Mt,Uf)return;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."),Uf=!0}}function Kf(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return br(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function fk(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Kf(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Kf(t,n):null}function pk(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function mk(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let u=a.firstChild;if(!u||u.nodeType!=1||u.contentEditable=="false"||/^(BR|IMG)$/.test(u.nodeName))break;a=u}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function gk(t,e,n){let{node:r,fromOffset:i,toOffset:s,from:o,to:a}=t.docView.parseRange(e,n),u=t.domSelectionRange(),l,c=u.anchorNode;if(c&&t.dom.contains(c.nodeType==1?c:c.parentNode)&&(l=[{node:c,offset:u.anchorOffset}],Ra(u)||l.push({node:u.focusNode,offset:u.focusOffset})),qe&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let b=r.childNodes[g-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){s=g;break}if(!v||v.size)break}let d=t.state.doc,h=t.someProp("domParser")||mn.fromSchema(t.state.schema),f=d.resolve(o),p=null,m=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:s,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:l,ruleFromNode:bk,context:f});if(l&&l[0].pos!=null){let g=l[0].pos,b=l[1]&&l[1].pos;b==null&&(b=g),p={anchor:g+o,head:b+o}}return{doc:m,sel:p,from:o,to:a}}function bk(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Je&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Je&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const vk=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function yk(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let C=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,k=id(t,C);if(k&&!t.state.selection.eq(k)){if(qe&&fn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,nr(13,"Enter"))))return;let S=t.state.tr.setSelection(k);C=="pointer"?S.setMeta("pointer",!0):C=="key"&&S.scrollIntoView(),s&&S.setMeta("composition",s),t.dispatch(S)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let u=t.state.selection,l=gk(t,e,n),c=t.state.doc,d=c.slice(l.from,l.to),h,f;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(h=t.state.selection.to,f="end"):(h=t.state.selection.from,f="start"),t.input.lastKeyCode=null;let p=kk(d.content,l.doc.content,l.from,h,f);if(p&&t.input.domChangeCount++,(ni&&t.input.lastIOSEnter>Date.now()-225||fn)&&i.some(C=>C.nodeType==1&&!vk.test(C.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",C=>C(t,nr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&u instanceof H&&!u.empty&&u.$head.sameParent(u.$anchor)&&!t.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))p={start:u.from,endA:u.to,endB:u.to};else{if(l.sel){let C=Jf(t,t.state.doc,l.sel);if(C&&!C.eq(t.state.selection)){let k=t.state.tr.setSelection(C);s&&k.setMeta("composition",s),t.dispatch(k)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof H&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=l.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=l.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),ut&&Hn<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>l.from&&l.doc.textBetween(p.start-l.from-1,p.start-l.from+1)==" "&&(p.start--,p.endA--,p.endB--);let m=l.doc.resolveNoCache(p.start-l.from),g=l.doc.resolveNoCache(p.endB-l.from),b=c.resolve(p.start),v=m.sameParent(g)&&m.parent.inlineContent&&b.end()>=p.endA;if((ni&&t.input.lastIOSEnter>Date.now()-225&&(!v||i.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!v&&m.pos<l.doc.content.size&&(!m.sameParent(g)||!m.parent.inlineContent)&&m.pos<g.pos&&!/\S/.test(l.doc.textBetween(m.pos,g.pos,"","")))&&t.someProp("handleKeyDown",C=>C(t,nr(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&xk(c,p.start,p.endA,m,g)&&t.someProp("handleKeyDown",C=>C(t,nr(8,"Backspace")))){fn&&qe&&t.domObserver.suppressSelectionUpdates();return}qe&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),fn&&!v&&m.start()!=g.start()&&g.parentOffset==0&&m.depth==g.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==p.endA&&(p.endB-=2,g=l.doc.resolveNoCache(p.endB-l.from),setTimeout(()=>{t.someProp("handleKeyDown",function(C){return C(t,nr(13,"Enter"))})},20));let _=p.start,x=p.endA,y=C=>{let k=C||t.state.tr.replace(_,x,l.doc.slice(p.start-l.from,p.endB-l.from));if(l.sel){let S=Jf(t,k.doc,l.sel);S&&!(qe&&t.composing&&S.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==_||S.head==k.mapping.map(x)-1)||ut&&S.empty&&S.head==_)&&k.setSelection(S)}return s&&k.setMeta("composition",s),k.scrollIntoView()},w;if(v)if(m.pos==g.pos){ut&&Hn<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>bn(t),20));let C=y(t.state.tr.delete(_,x)),k=c.resolve(p.start).marksAcross(c.resolve(p.endA));k&&C.ensureMarks(k),t.dispatch(C)}else if(p.endA==p.endB&&(w=_k(m.parent.content.cut(m.parentOffset,g.parentOffset),b.parent.content.cut(b.parentOffset,p.endA-b.start())))){let C=y(t.state.tr);w.type=="add"?C.addMark(_,x,w.mark):C.removeMark(_,x,w.mark),t.dispatch(C)}else if(m.parent.child(m.index()).isText&&m.index()==g.index()-(g.textOffset?0:1)){let C=m.parent.textBetween(m.parentOffset,g.parentOffset),k=()=>y(t.state.tr.insertText(C,_,x));t.someProp("handleTextInput",S=>S(t,_,x,C,k))||t.dispatch(k())}else t.dispatch(y());else t.dispatch(y())}function Jf(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:sd(t,e.resolve(n.anchor),e.resolve(n.head))}function _k(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,u;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)s=n[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",u=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",u=c=>c.mark(a.removeFromSet(c.marks));else return null;let l=[];for(let c=0;c<e.childCount;c++)l.push(u(e.child(c)));if(M.from(l).eq(t))return{mark:a,type:o}}function xk(t,e,n,r,i){if(n-e<=i.pos-r.pos||Nu(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Nu(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Nu(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Nu(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function kk(t,e,n,r,i){let s=t.findDiffStart(e,n);if(s==null)return null;let{a:o,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let u=Math.max(0,s-Math.min(o,a));r-=o+u-s}if(o<s&&t.size<e.size){let u=r<=s&&r>=o?s-r:0;s-=u,s&&s<e.size&&Gf(e.textBetween(s-1,s+1))&&(s+=u?1:-1),a=s+(a-o),o=s}else if(a<s){let u=r<=s&&r>=a?s-r:0;s-=u,s&&s<t.size&&Gf(t.textBetween(s-1,s+1))&&(s+=u?1:-1),o=s+(o-a),a=s}return{start:s,endA:o,endB:a}}function Gf(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Kg{constructor(e,n){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 Bx,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(ep),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=Xf(this),Zf(this),this.nodeViews=Qf(this),this.docView=Df(this.state.doc,Yf(this),Ru(this),this.dom,this),this.domObserver=new dk(this,(r,i,s,o)=>yk(this,r,i,s,o)),this.domObserver.start(),$x(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&oc(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(ep),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(zg(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let f=Qf(this);Ck(f,this.nodeViews)&&(this.nodeViews=f,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&oc(this),this.editable=Xf(this),Zf(this);let u=Ru(this),l=Yf(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,l,u);(d||!e.selection.eq(i.selection))&&(o=!0);let h=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Q_(this);if(o){this.domObserver.stop();let f=d&&(ut||qe)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&wk(i.selection,e.selection);if(d){let p=qe?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Qx(this)),(s||!this.docView.update(e.doc,l,u,this))&&(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Df(e.doc,l,u,this.dom,this)),p&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&wx(this))?bn(this,f):(Ag(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),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():h&&ex(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof z){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Cf(this,n.getBoundingClientRect(),e)}else Cf(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 n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new jg(e.slice,e.move,i<0?void 0:z.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(ut){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&tx(this.dom),bn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return ox(this,e)}coordsAtPos(e,n=1){return _g(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return dx(this,n||this.state,e)}pasteHTML(e,n){return ns(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return ns(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return od(this,e)}destroy(){this.docView&&(zx(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ru(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,V_())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return jx(this,e)}domSelectionRange(){let e=this.domSelection();return e?Je&&this.root.nodeType===11&&J_(this.dom.ownerDocument)==this.dom&&fk(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Kg.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Yf(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[tt.node(0,t.state.doc.content.size,e)]}function Zf(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:tt.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function Xf(t){return!t.someProp("editable",e=>e(t.state)===!1)}function wk(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Qf(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function Ck(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function ep(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var qn={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:"'"},Ho={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ek=typeof navigator<"u"&&/Mac/.test(navigator.platform),Sk=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ve=0;Ve<10;Ve++)qn[48+Ve]=qn[96+Ve]=String(Ve);for(var Ve=1;Ve<=24;Ve++)qn[Ve+111]="F"+Ve;for(var Ve=65;Ve<=90;Ve++)qn[Ve]=String.fromCharCode(Ve+32),Ho[Ve]=String.fromCharCode(Ve);for(var Fu in qn)Ho.hasOwnProperty(Fu)||(Ho[Fu]=qn[Fu]);function Mk(t){var e=Ek&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||Sk&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ho:qn)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Ak=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Tk=typeof navigator<"u"&&/Win/.test(navigator.platform);function Dk(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let u=e[a];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))Ak?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function Ok(t){let e=Object.create(null);for(let n in t)e[Dk(n)]=t[n];return e}function Iu(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Rk(t){return new we({props:{handleKeyDown:hd(t)}})}function hd(t){let e=Ok(t);return function(n,r){let i=Mk(r),s,o=e[Iu(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[Iu(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Tk&&r.ctrlKey&&r.altKey)&&(s=qn[r.keyCode])&&s!=i){let a=e[Iu(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}const fd=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function Jg(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Gg=(t,e,n)=>{let r=Jg(t,n);if(!r)return!1;let i=pd(r);if(!i){let o=r.blockRange(),a=o&&ai(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(i1(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ri(s,"end")||z.isSelectable(s)))for(let o=r.depth;;o--){let a=Da(t.doc,r.before(o),r.after(o),R.empty);if(a&&a.slice.size<a.to-a.from){if(e){let u=t.tr.step(a);u.setSelection(ri(s,"end")?q.findFrom(u.doc.resolve(u.mapping.map(i.pos,-1)),-1):z.create(u.doc,i.pos-s.nodeSize)),e(u.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},Nk=(t,e,n)=>{let r=Jg(t,n);if(!r)return!1;let i=pd(r);return i?Yg(t,i,e):!1},Fk=(t,e,n)=>{let r=Xg(t,n);if(!r)return!1;let i=md(r);return i?Yg(t,i,e):!1};function Yg(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,u=e.pos+1;for(;!a.isTextblock;u++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let l=Da(t.doc,s,u,R.empty);if(!l||l.from!=s||l instanceof Se&&l.slice.size>=u-s)return!1;if(n){let c=t.tr.step(l);c.setSelection(H.create(c.doc,s)),n(c.scrollIntoView())}return!0}function ri(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const Zg=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=pd(r)}let o=s&&s.nodeBefore;return!o||!z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function pd(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Xg(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Qg=(t,e,n)=>{let r=Xg(t,n);if(!r)return!1;let i=md(r);if(!i)return!1;let s=i.nodeAfter;if(i1(t,i,e,1))return!0;if(r.parent.content.size==0&&(ri(s,"start")||z.isSelectable(s))){let o=Da(t.doc,r.before(),r.after(),R.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(ri(s,"start")?q.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):z.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},e1=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=md(r)}let o=s&&s.nodeAfter;return!o||!z.isSelectable(o)?!1:(e&&e(t.tr.setSelection(z.create(t.doc,s.pos)).scrollIntoView()),!0)};function md(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const Ik=(t,e)=>{let n=t.selection,r=n instanceof z,i;if(r){if(n.node.isTextblock||!Un(t.doc,n.from))return!1;i=n.from}else if(i=Ta(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(z.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},Pk=(t,e)=>{let n=t.selection,r;if(n instanceof z){if(n.node.isTextblock||!Un(t.doc,n.to))return!1;r=n.to}else if(r=Ta(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},Lk=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&ai(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},t1=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
11
|
+
`).scrollIntoView()),!0)};function gd(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const Bk=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=gd(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),u=t.tr.replaceWith(a,a,o.createAndFill());u.setSelection(q.near(u.doc.resolve(a),1)),e(u.scrollIntoView())}return!0},n1=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof mt||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=gd(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(H.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},r1=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(gn(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&ai(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function $k(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof z&&e.selection.node.isBlock)return!r.parentOffset||!gn(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let s=[],o,a,u=!1,l=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){u=r.end(f)==r.pos+(r.depth-f),l=r.start(f)==r.pos-(r.depth-f),a=gd(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),s.unshift(u&&a?{type:a}:null),o=f;break}else{if(f==1)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof H||e.selection instanceof mt)&&c.deleteSelection();let d=c.mapping.map(r.pos),h=gn(c.doc,d,s.length,s);if(h||(s[0]=a?{type:a}:null,h=gn(c.doc,d,s.length,s)),!h)return!1;if(c.split(d,s.length,s),!u&&l&&r.node(o).type!=a){let f=c.mapping.map(r.before(o)),p=c.doc.resolve(f);a&&r.node(o-1).canReplaceWith(p.index(),p.index()+1,a)&&c.setNodeMarkup(c.mapping.map(r.before(o)),a)}return n&&n(c.scrollIntoView()),!0}}const zk=$k(),Hk=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(z.create(t.doc,i))),!0)};function jk(t,e,n){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)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Un(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function i1(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,u=i.type.spec.isolating||s.type.spec.isolating;if(!u&&jk(t,e,n))return!0;let l=!u&&e.parent.canReplace(e.index(),e.index()+1);if(l&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let f=e.pos+s.nodeSize,p=M.empty;for(let b=o.length-1;b>=0;b--)p=M.from(o[b].create(null,p));p=M.from(i.copy(p));let m=t.tr.step(new Fe(e.pos-1,f,e.pos,f,new R(p,1,0),o.length,!0)),g=m.doc.resolve(f+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&Un(m.doc,g.pos)&&m.join(g.pos),n(m.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&u?null:q.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),h=d&&ai(d);if(h!=null&&h>=e.depth)return n&&n(t.tr.lift(d,h).scrollIntoView()),!0;if(l&&ri(s,"start",!0)&&ri(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;if(f.canReplace(f.childCount,f.childCount,m.content)){if(n){let b=M.empty;for(let _=p.length-1;_>=0;_--)b=M.from(p[_].copy(b));let v=t.tr.step(new Fe(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new R(b,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function s1(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(H.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const Vk=s1(-1),qk=s1(1);function Wk(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&ed(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function tp(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(u,l)=>{if(i)return!1;if(!(!u.isTextblock||u.hasMarkup(t,e)))if(u.type==t)i=!0;else{let c=n.doc.resolve(l),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:u}}=n.selection.ranges[o];s.setBlockType(a,u,t,e)}r(s.scrollIntoView())}return!0}}function bd(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}bd(fd,Gg,Zg);bd(fd,Qg,e1);bd(t1,n1,r1,zk);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function Uk(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return Kk(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function Kk(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let u=o.resolve(e.start-2);s=new Fo(u,u,e.depth),e.endIndex<e.parent.childCount&&(e=new Fo(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=ed(s,n,r,e);return a?(t&&Jk(t,e,a,i,n),!0):!1}function Jk(t,e,n,r,i){let s=M.empty;for(let c=n.length-1;c>=0;c--)s=M.from(n[c].type.create(n[c].attrs,s));t.step(new Fe(e.start-(r?2:0),e.end,e.start,e.end,new R(s,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==i&&(o=c+1);let a=n.length-o,u=e.start+n.length-(r?2:0),l=e.parent;for(let c=e.startIndex,d=e.endIndex,h=!0;c<d;c++,h=!1)!h&&gn(t.doc,u,a)&&(t.split(u,a),u+=2*a),u+=l.child(c).nodeSize;return t}function Gk(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?Yk(e,n,t,s):Zk(e,n,s):!0:!1}}function Yk(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new Fe(s-1,o,s,o,new R(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Fo(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=ai(r);if(a==null)return!1;i.lift(r,a);let u=i.doc.resolve(i.mapping.map(s,-1)-1);return Un(i.doc,u.pos)&&u.nodeBefore.type==u.nodeAfter.type&&i.join(u.pos),e(i.scrollIntoView()),!0}function Zk(t,e,n){let r=t.tr,i=n.parent;for(let f=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,u=n.endIndex==i.childCount,l=s.node(-1),c=s.index(-1);if(!l.canReplace(c+(a?0:1),c+1,o.content.append(u?M.empty:M.from(i))))return!1;let d=s.pos,h=d+o.nodeSize;return r.step(new Fe(d-(a?1:0),h+(u?1:0),d+1,h-1,new R((a?M.empty:M.from(i.copy(M.empty))).append(u?M.empty:M.from(i.copy(M.empty))),a?0:1,u?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Xk(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,u=a.child(o-1);if(u.type!=t)return!1;if(n){let l=u.lastChild&&u.lastChild.type==a.type,c=M.from(l?t.create():null),d=new R(M.from(t.create(null,M.from(a.type.create(null,c)))),l?3:1,0),h=s.start,f=s.end;n(e.tr.step(new Fe(h-(l?3:1),f,h,f,d,1,!0)).scrollIntoView())}return!0}}function Ia(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...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=n.selection,i=n.doc,s=n.storedMarks,n}}}class Pa{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(){const{rawCommands:e,editor:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,u])=>[a,(...c)=>{const d=u(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],u=!!e,l=e||s.tr,c=()=>(!u&&n&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(l),a.every(h=>h===!0)),d={...Object.fromEntries(Object.entries(r).map(([h,f])=>[h,(...m)=>{const g=this.buildProps(l,n),b=f(...m)(g);return a.push(b),d}])),run:c};return d}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([u,l])=>[u,(...c)=>l(...c)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Ia({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([u,l])=>[u,(...c)=>l(...c)(a)]))}};return a}}class Qk{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const r=this.callbacks[e];return r&&r.forEach(i=>i.apply(this,n)),this}off(e,n){const r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(i=>i!==n):delete this.callbacks[e]),this}once(e,n){const r=(...i)=>{this.off(e,r),n.apply(this,i)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function B(t,e,n){return t.config[e]===void 0&&t.parent?B(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?B(t.parent,e,n):null}):t.config[e]}function La(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function o1(t){const e=[],{nodeExtensions:n,markExtensions:r}=La(t),i=[...n,...r],s={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:i},u=B(o,"addGlobalAttributes",a);if(!u)return;u().forEach(c=>{c.types.forEach(d=>{Object.entries(c.attributes).forEach(([h,f])=>{e.push({type:d,name:h,attribute:{...s,...f}})})})})}),i.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},u=B(o,"addAttributes",a);if(!u)return;const l=u();Object.entries(l).forEach(([c,d])=>{const h={...s,...d};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:o.name,name:c,attribute:h})})}),e}function Pe(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function ge(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(!r[i]){r[i]=s;return}if(i==="class"){const a=s?String(s).split(" "):[],u=r[i]?r[i].split(" "):[],l=a.filter(c=>!u.includes(c));r[i]=[...u,...l].join(" ")}else if(i==="style"){const a=s?s.split(";").map(c=>c.trim()).filter(Boolean):[],u=r[i]?r[i].split(";").map(c=>c.trim()).filter(Boolean):[],l=new Map;u.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());l.set(d,h)}),a.forEach(c=>{const[d,h]=c.split(":").map(f=>f.trim());l.set(d,h)}),r[i]=Array.from(l.entries()).map(([c,d])=>`${c}: ${d}`).join("; ")}else r[i]=s}),r},{})}function ac(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>ge(n,r),{})}function a1(t){return typeof t=="function"}function U(t,e=void 0,...n){return a1(t)?e?t.bind(e)(...n):t(...n):t}function e3(t={}){return Object.keys(t).length===0&&t.constructor===Object}function t3(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function np(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):t3(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function rp(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&e3(n)?!1:n!=null))}function n3(t,e){var n;const r=o1(t),{nodeExtensions:i,markExtensions:s}=La(t),o=(n=i.find(l=>B(l,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(l=>{const c=r.filter(b=>b.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=t.reduce((b,v)=>{const _=B(v,"extendNodeSchema",d);return{...b,..._?_(l):{}}},{}),f=rp({...h,content:U(B(l,"content",d)),marks:U(B(l,"marks",d)),group:U(B(l,"group",d)),inline:U(B(l,"inline",d)),atom:U(B(l,"atom",d)),selectable:U(B(l,"selectable",d)),draggable:U(B(l,"draggable",d)),code:U(B(l,"code",d)),whitespace:U(B(l,"whitespace",d)),linebreakReplacement:U(B(l,"linebreakReplacement",d)),defining:U(B(l,"defining",d)),isolating:U(B(l,"isolating",d)),attrs:Object.fromEntries(c.map(b=>{var v;return[b.name,{default:(v=b?.attribute)===null||v===void 0?void 0:v.default}]}))}),p=U(B(l,"parseHTML",d));p&&(f.parseDOM=p.map(b=>np(b,c)));const m=B(l,"renderHTML",d);m&&(f.toDOM=b=>m({node:b,HTMLAttributes:ac(b,c)}));const g=B(l,"renderText",d);return g&&(f.toText=g),[l.name,f]})),u=Object.fromEntries(s.map(l=>{const c=r.filter(g=>g.type===l.name),d={name:l.name,options:l.options,storage:l.storage,editor:e},h=t.reduce((g,b)=>{const v=B(b,"extendMarkSchema",d);return{...g,...v?v(l):{}}},{}),f=rp({...h,inclusive:U(B(l,"inclusive",d)),excludes:U(B(l,"excludes",d)),group:U(B(l,"group",d)),spanning:U(B(l,"spanning",d)),code:U(B(l,"code",d)),attrs:Object.fromEntries(c.map(g=>{var b;return[g.name,{default:(b=g?.attribute)===null||b===void 0?void 0:b.default}]}))}),p=U(B(l,"parseHTML",d));p&&(f.parseDOM=p.map(g=>np(g,c)));const m=B(l,"renderHTML",d);return m&&(f.toDOM=g=>m({mark:g,HTMLAttributes:ac(g,c)})),[l.name,f]}));return new Zc({topNode:o,nodes:a,marks:u})}function Pu(t,e){return e.nodes[t]||e.marks[t]||null}function ip(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function vs(t,e){const n=kr.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}const r3=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var u,l;const c=((l=(u=i.type.spec).toText)===null||l===void 0?void 0:l.call(u,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function vd(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class Ba{constructor(e){this.find=e.find,this.handler=e.handler}}const i3=(t,e)=>{if(vd(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Is(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:u}=n;if(u.composing)return!1;const l=u.state.doc.resolve(r);if(l.parent.type.spec.code||!((e=l.nodeBefore||l.nodeAfter)===null||e===void 0)&&e.marks.find(h=>h.type.spec.code))return!1;let c=!1;const d=r3(l)+s;return o.forEach(h=>{if(c)return;const f=i3(d,h.find);if(!f)return;const p=u.state.tr,m=Ia({state:u.state,transaction:p}),g={from:r-(f[0].length-s.length),to:i},{commands:b,chain:v,can:_}=new Pa({editor:n,state:m});h.handler({state:m,range:g,match:f,commands:b,chain:v,can:_})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:s}),u.dispatch(p),c=!0)}),c}function s3(t){const{editor:e,rules:n}=t,r=new we({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const u=i.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:c}=u;typeof c=="string"?c=c:c=vs(M.from(c),o.schema);const{from:d}=u,h=d+c.length;Is({editor:e,from:d,to:h,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return Is({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&Is({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?Is({editor:e,from:o.pos,to:o.pos,text:`
|
|
12
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function o3(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ps(t){return o3(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function $a(t,e){const n={...t};return Ps(t)&&Ps(e)&&Object.keys(e).forEach(r=>{Ps(e[r])&&Ps(t[r])?n[r]=$a(t[r],e[r]):n[r]=e[r]}),n}class it{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...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=U(B(this,"addOptions",{name:this.name}))),this.storage=U(B(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new it(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>$a(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new it(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.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: "${n.name}".`),n.options=U(B(n,"addOptions",{name:n.name})),n.storage=U(B(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(l=>l?.type.name===n.name))return!1;const u=o.find(l=>l?.type.name===n.name);return u&&r.removeStoredMark(u),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}}function a3(t){return typeof t=="number"}class u1{constructor(e){this.find=e.find,this.handler=e.handler}}const u3=(t,e,n)=>{if(vd(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,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 l3(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:u,chain:l,can:c}=new Pa({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,p)=>{if(!f.isTextblock||f.type.spec.code)return;const m=Math.max(r,p),g=Math.min(i,p+f.content.size),b=f.textBetween(m-p,g-p,void 0,"");u3(b,s.find,o).forEach(_=>{if(_.index===void 0)return;const x=m+_.index+1,y=x+_[0].length,w={from:n.tr.mapping.map(x),to:n.tr.mapping.map(y)},C=s.handler({state:n,range:w,match:_,commands:u,chain:l,can:c,pasteEvent:o,dropEvent:a});d.push(C)})}),d.every(f=>f!==null)}let Ls=null;const c3=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function d3(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const u=({state:c,from:d,to:h,rule:f,pasteEvt:p})=>{const m=c.tr,g=Ia({state:c,transaction:m});if(!(!l3({editor:e,state:g,from:Math.max(d-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!m.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return n.map(c=>new we({view(d){const h=p=>{var m;r=!((m=d.dom.parentElement)===null||m===void 0)&&m.contains(p.target)?d.dom.parentElement:null,r&&(Ls=e)},f=()=>{Ls&&(Ls=null)};return window.addEventListener("dragstart",h),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",h),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(d,h)=>{if(s=r===d.dom.parentElement,a=h,!s){const f=Ls;f?.isEditable&&setTimeout(()=>{const p=f.state.selection;p&&f.commands.deleteRange({from:p.from,to:p.to})},10)}return!1},paste:(d,h)=>{var f;const p=(f=h.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(d,h,f)=>{const p=d[0],m=p.getMeta("uiEvent")==="paste"&&!i,g=p.getMeta("uiEvent")==="drop"&&!s,b=p.getMeta("applyPasteRules"),v=!!b;if(!m&&!g&&!v)return;if(v){let{text:y}=b;typeof y=="string"?y=y:y=vs(M.from(y),f.schema);const{from:w}=b,C=w+y.length,k=c3(y);return u({rule:c,state:f,from:w,to:{b:C},pasteEvt:k})}const _=h.doc.content.findDiffStart(f.doc.content),x=h.doc.content.findDiffEnd(f.doc.content);if(!(!a3(_)||!x||_===x.b))return u({rule:c,state:f,from:_,to:x,pasteEvt:o})}}))}function h3(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}class Vr{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=Vr.resolve(e),this.schema=n3(this.extensions,n),this.setupExtensions()}static resolve(e){const n=Vr.sort(Vr.flatten(e)),r=h3(n.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.`),n}static flatten(e){return e.map(n=>{const r={name:n.name,options:n.options,storage:n.storage},i=B(n,"addExtensions",r);return i?[n,...this.flatten(i())]:n}).flat(10)}static sort(e){return e.sort((r,i)=>{const s=B(r,"priority")||100,o=B(i,"priority")||100;return s>o?-1:s<o?1:0})}get commands(){return this.extensions.reduce((e,n)=>{const r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:Pu(n.name,this.schema)},i=B(n,"addCommands",r);return i?{...e,...i()}:e},{})}get plugins(){const{editor:e}=this,n=Vr.sort([...this.extensions].reverse()),r=[],i=[],s=n.map(o=>{const a={name:o.name,options:o.options,storage:o.storage,editor:e,type:Pu(o.name,this.schema)},u=[],l=B(o,"addKeyboardShortcuts",a);let c={};if(o.type==="mark"&&B(o,"exitable",a)&&(c.ArrowRight=()=>it.handleExit({editor:e,mark:o})),l){const m=Object.fromEntries(Object.entries(l()).map(([g,b])=>[g,()=>b({editor:e})]));c={...c,...m}}const d=Rk(c);u.push(d);const h=B(o,"addInputRules",a);ip(o,e.options.enableInputRules)&&h&&r.push(...h());const f=B(o,"addPasteRules",a);ip(o,e.options.enablePasteRules)&&f&&i.push(...f());const p=B(o,"addProseMirrorPlugins",a);if(p){const m=p();u.push(...m)}return u}).flat();return[s3({editor:e,rules:r}),...d3({editor:e,rules:i}),...s]}get attributes(){return o1(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=La(this.extensions);return Object.fromEntries(n.filter(r=>!!B(r,"addNodeView")).map(r=>{const i=this.attributes.filter(u=>u.type===r.name),s={name:r.name,options:r.options,storage:r.storage,editor:e,type:Pe(r.name,this.schema)},o=B(r,"addNodeView",s);if(!o)return[];const a=(u,l,c,d,h)=>{const f=ac(u,i);return o()({node:u,view:l,getPos:c,decorations:d,innerDecorations:h,editor:e,extension:r,HTMLAttributes:f})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Pu(e.name,this.schema)};e.type==="mark"&&(!((n=U(B(e,"keepOnSplit",r)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const i=B(e,"onBeforeCreate",r),s=B(e,"onCreate",r),o=B(e,"onUpdate",r),a=B(e,"onSelectionUpdate",r),u=B(e,"onTransaction",r),l=B(e,"onFocus",r),c=B(e,"onBlur",r),d=B(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),u&&this.editor.on("transaction",u),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)})}}class Le{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...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=U(B(this,"addOptions",{name:this.name}))),this.storage=U(B(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Le(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>$a(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Le({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.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: "${n.name}".`),n.options=U(B(n,"addOptions",{name:n.name})),n.storage=U(B(n,"addStorage",{name:n.name,options:n.options})),n}}function l1(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
|
|
13
|
+
|
|
14
|
+
`,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(u,l,c,d)=>{var h;u.isBlock&&l>r&&(a+=s);const f=o?.[u.type.name];if(f)return c&&(a+=f({node:u,pos:l,parent:c,index:d,range:e})),!1;u.isText&&(a+=(h=u?.text)===null||h===void 0?void 0:h.slice(Math.max(r,l)-l,i-l))}),a}function c1(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const d1=Le.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new we({key:new Be("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:s}=i,o=Math.min(...s.map(c=>c.$from.pos)),a=Math.max(...s.map(c=>c.$to.pos)),u=c1(n);return l1(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),f3=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),p3=(t=!1)=>({commands:e})=>e.setContent("",t),m3=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,u)=>{if(a.type.isText)return;const{doc:l,mapping:c}=e,d=l.resolve(c.map(u)),h=l.resolve(c.map(u+a.nodeSize)),f=d.blockRange(h);if(!f)return;const p=ai(f);if(a.type.isTextblock){const{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(f.start,m)}(p||p===0)&&e.lift(f,p)})}),!0},g3=t=>e=>t(e),b3=()=>({state:t,dispatch:e})=>n1(t,e),v3=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new H(r.doc.resolve(Math.max(o-1,0)))),!0},y3=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const a=i.before(s),u=i.after(s);t.delete(a,u).scrollIntoView()}return!0}return!1},_3=t=>({tr:e,state:n,dispatch:r})=>{const i=Pe(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const u=s.before(o),l=s.after(o);e.delete(u,l).scrollIntoView()}return!0}return!1},x3=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},k3=()=>({state:t,dispatch:e})=>fd(t,e),w3=()=>({commands:t})=>t.keyboardShortcut("Enter"),C3=()=>({state:t,dispatch:e})=>Bk(t,e);function jo(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:vd(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function h1(t,e,n={}){return t.find(r=>r.type===e&&jo(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function sp(t,e,n={}){return!!h1(t,e,n)}function yd(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(c=>c.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(c=>c.type===e)||(n=n||((r=i.node.marks[0])===null||r===void 0?void 0:r.attrs),!h1([...i.node.marks],e,n)))return;let o=i.index,a=t.start()+i.offset,u=o+1,l=a+i.node.nodeSize;for(;o>0&&sp([...t.parent.child(o-1).marks],e,n);)o-=1,a-=t.parent.child(o).nodeSize;for(;u<t.parent.childCount&&sp([...t.parent.child(u).marks],e,n);)l+=t.parent.child(u).nodeSize,u+=1;return{from:a,to:l}}function Jn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const E3=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const s=Jn(t,r.schema),{doc:o,selection:a}=n,{$from:u,from:l,to:c}=a;if(i){const d=yd(u,s,e);if(d&&d.from<=l&&d.to>=c){const h=H.create(o,d.from,d.to);n.setSelection(h)}}return!0},S3=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function f1(t){return t instanceof H}function or(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function p1(t,e=null){if(!e)return null;const n=q.atStart(t),r=q.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?H.create(t,or(0,i,s),or(t.content.size,i,s)):H.create(t,or(e,i,s),or(e,i,s))}function op(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Vo(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function M3(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const A3=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(Vo()||op())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),M3()&&!Vo()&&!op()&&r.dom.focus({preventScroll:!0}))})};if(r.hasFocus()&&t===null||t===!1)return!0;if(s&&t===null&&!f1(n.state.selection))return o(),!0;const a=p1(i.doc,t)||n.state.selection,u=n.state.selection.eq(a);return s&&(u||i.setSelection(a),u&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},T3=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),D3=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),m1=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&m1(r)}return t};function Bs(t){const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return m1(n)}function is(t,e,n){if(t instanceof zn||t instanceof M)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(a=>e.nodeFromJSON(a)));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),is("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const u=new Zc({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:l=>(o=!0,a=typeof l=="string"?l:l.outerHTML,null)}]}})});if(n.slice?mn.fromSchema(u).parseSlice(Bs(t),n.parseOptions):mn.fromSchema(u).parse(Bs(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=mn.fromSchema(e);return n.slice?s.parseSlice(Bs(t),n.parseOptions).content:s.parse(Bs(t),n.parseOptions)}return is("",e,n)}function O3(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Se||i instanceof Fe))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,u,l,c)=>{o===0&&(o=c)}),t.setSelection(q.near(t.doc.resolve(o),n))}const R3=t=>!("type"in t),N3=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{var o;if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const u=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{is(e,s.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(g){u(g)}try{a=is(e,s.schema,{parseOptions:l,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(g){return u(g),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},h=!0,f=!0;if((R3(a)?a:[a]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),c===d&&f){const{parent:g}=r.doc.resolve(c);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(c-=1,d+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof M){let g="";e.forEach(b=>{b.text&&(g+=b.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,c,d)}else m=a,r.replaceWith(c,d,m);n.updateSelection&&O3(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:m})}return!0},F3=()=>({state:t,dispatch:e})=>Ik(t,e),I3=()=>({state:t,dispatch:e})=>Pk(t,e),P3=()=>({state:t,dispatch:e})=>Gg(t,e),L3=()=>({state:t,dispatch:e})=>Qg(t,e),B3=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ta(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},$3=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Ta(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},z3=()=>({state:t,dispatch:e})=>Nk(t,e),H3=()=>({state:t,dispatch:e})=>Fk(t,e);function g1(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function j3(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const u=e[a];if(/^(cmd|meta|m)$/i.test(u))o=!0;else if(/^a(lt)?$/i.test(u))r=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))Vo()||g1()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${u}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const V3=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=j3(t).split(/-(?!$)/),o=s.find(l=>!["Alt","Ctrl","Meta","Shift"].includes(l)),a=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}),u=e.captureTransaction(()=>{n.someProp("handleKeyDown",l=>l(n,a))});return u?.steps.forEach(l=>{const c=l.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function ss(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?Pe(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(d,h)=>{if(d.isText)return;const f=Math.max(r,h),p=Math.min(i,h+d.nodeSize);a.push({node:d,from:f,to:p})});const u=i-r,l=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>jo(d.node.attrs,n,{strict:!1}));return s?!!l.length:l.reduce((d,h)=>d+h.to-h.from,0)>=u}const q3=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return ss(n,i,e)?Lk(n,r):!1},W3=()=>({state:t,dispatch:e})=>r1(t,e),U3=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return Gk(r)(e,n)},K3=()=>({state:t,dispatch:e})=>t1(t,e);function za(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ap(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const J3=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=za(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Jn(t,r.schema)),i&&n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(l,c)=>{s&&s===l.type&&n.setNodeMarkup(c,void 0,ap(l.attrs,e)),o&&l.marks.length&&l.marks.forEach(d=>{o===d.type&&n.addMark(c,c+l.nodeSize,o.create(ap(d.attrs,e)))})})}),!0):!1},G3=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Y3=()=>({tr:t,dispatch:e})=>{if(e){const n=new mt(t.doc);t.setSelection(n)}return!0},Z3=()=>({state:t,dispatch:e})=>Zg(t,e),X3=()=>({state:t,dispatch:e})=>e1(t,e),Q3=()=>({state:t,dispatch:e})=>Hk(t,e),ew=()=>({state:t,dispatch:e})=>qk(t,e),tw=()=>({state:t,dispatch:e})=>Vk(t,e);function uc(t,e,n={},r={}){return is(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const nw=(t,e=!1,n={},r={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{var u,l;const{doc:c}=s;if(n.preserveWhitespace!=="full"){const d=uc(t,i.schema,n,{errorOnInvalidContent:(u=r.errorOnInvalidContent)!==null&&u!==void 0?u:i.options.enableContentCheck});return o&&s.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!e),!0}return o&&s.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:n,errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck})};function b1(t,e){const n=Jn(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,u=>{o.push(...u.marks)});const a=o.find(u=>u.type.name===n.name);return a?{...a.attrs}:{}}function rw(t,e){const n=new td(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function iw(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function sw(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function v1(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function _d(t){return e=>v1(e.$from,t)}function ow(t,e){const n={from:0,to:t.content.size};return l1(t,n,e)}function aw(t,e){const n=Pe(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function y1(t,e){const n=za(typeof e=="string"?e:e.name,t.schema);return n==="node"?aw(t,e):n==="mark"?b1(t,e):{}}function uw(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function lw(t){const e=uw(t);return e.length===1?e:e.filter((n,r)=>!e.filter((s,o)=>o!==r).some(s=>n.oldRange.from>=s.oldRange.from&&n.oldRange.to<=s.oldRange.to&&n.newRange.from>=s.newRange.from&&n.newRange.to<=s.newRange.to))}function cw(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,u)=>{o.push({from:a,to:u})});else{const{from:a,to:u}=n[s];if(a===void 0||u===void 0)return;o.push({from:a,to:u})}o.forEach(({from:a,to:u})=>{const l=e.slice(s).map(a,-1),c=e.slice(s).map(u),d=e.invert().map(l,-1),h=e.invert().map(c);r.push({oldRange:{from:d,to:h},newRange:{from:l,to:c}})})}),lw(r)}function xd(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=n.resolve(t),o=yd(s,i.type);o&&r.push({mark:i,...o})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function no(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}function lc(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Jn(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(d=>s?s.name===d.type.name:!0).find(d=>jo(d.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:d,$to:h})=>{const f=d.pos,p=h.pos;t.doc.nodesBetween(f,p,(m,g)=>{if(!m.isText&&!m.marks.length)return;const b=Math.max(f,g),v=Math.min(p,g+m.nodeSize),_=v-b;o+=_,a.push(...m.marks.map(x=>({mark:x,from:b,to:v})))})}),o===0)return!1;const u=a.filter(d=>s?s.name===d.mark.type.name:!0).filter(d=>jo(d.mark.attrs,n,{strict:!1})).reduce((d,h)=>d+h.to-h.from,0),l=a.filter(d=>s?d.mark.type!==s&&d.mark.type.excludes(s):!0).reduce((d,h)=>d+h.to-h.from,0);return(u>0?u+l:u)>=o}function dw(t,e,n={}){if(!e)return ss(t,null,n)||lc(t,null,n);const r=za(e,t.schema);return r==="node"?ss(t,e,n):r==="mark"?lc(t,e,n):!1}function up(t,e){const{nodeExtensions:n}=La(e),r=n.find(o=>o.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},s=U(B(r,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function kd(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!==null&&r!==void 0?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(kd(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function hw(t){return t instanceof z}function fw(t,e,n){var r;const{selection:i}=e;let s=null;if(f1(i)&&(s=i.$cursor),s){const a=(r=t.storedMarks)!==null&&r!==void 0?r:s.marks();return!!n.isInSet(a)||!a.some(u=>u.type.excludes(n))}const{ranges:o}=i;return o.some(({$from:a,$to:u})=>{let l=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,u.pos,(c,d,h)=>{if(l)return!1;if(c.isInline){const f=!h||h.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(m=>m.type.excludes(n));l=f&&p}return!l}),l})}const pw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,u=Jn(t,r.schema);if(i)if(o){const l=b1(r,u);n.addStoredMark(u.create({...l,...e}))}else a.forEach(l=>{const c=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(c,d,(h,f)=>{const p=Math.max(f,c),m=Math.min(f+h.nodeSize,d);h.marks.find(b=>b.type===u)?h.marks.forEach(b=>{u===b.type&&n.addMark(p,m,u.create({...b.attrs,...e}))}):n.addMark(p,m,u.create(e))})});return fw(r,n,u)},mw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),gw=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=Pe(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>tp(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>tp(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},bw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=or(t,0,r.content.size),s=z.create(r,i);e.setSelection(s)}return!0},vw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=H.atStart(r).from,a=H.atEnd(r).to,u=or(i,o,a),l=or(s,o,a),c=H.create(r,u,l);e.setSelection(c)}return!0},yw=t=>({state:e,dispatch:n})=>{const r=Pe(t,e.schema);return Xk(r)(e,n)};function lp(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const _w=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:u}=s,l=i.extensionManager.attributes,c=no(l,a.node().type.name,a.node().attrs);if(s instanceof z&&s.node.isBlock)return!a.parentOffset||!gn(o,a.pos)?!1:(r&&(t&&lp(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=u.parentOffset===u.parent.content.size,h=a.depth===0?void 0:iw(a.node(-1).contentMatchAt(a.indexAfter(-1)));let f=d&&h?[{type:h,attrs:c}]:void 0,p=gn(e.doc,e.mapping.map(a.pos),1,f);if(!f&&!p&&gn(e.doc,e.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:c}]:void 0),r){if(p&&(s instanceof H&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,f),h&&!d&&!a.parentOffset&&a.parent.type!==h)){const m=e.mapping.map(a.before()),g=e.doc.resolve(m);a.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(a.before()),h)}t&&lp(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},xw=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{var o;const a=Pe(t,r.schema),{$from:u,$to:l}=r.selection,c=r.selection.node;if(c&&c.isBlock||u.depth<2||!u.sameParent(l))return!1;const d=u.node(-1);if(d.type!==a)return!1;const h=s.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==a||u.index(-2)!==u.node(-2).childCount-1)return!1;if(i){let b=M.empty;const v=u.index(-1)?1:u.index(-2)?2:3;for(let k=u.depth-v;k>=u.depth-3;k-=1)b=M.from(u.node(k).copy(b));const _=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,x={...no(h,u.node().type.name,u.node().attrs),...e},y=((o=a.contentMatch.defaultType)===null||o===void 0?void 0:o.createAndFill(x))||void 0;b=b.append(M.from(a.createAndFill(null,y)||void 0));const w=u.before(u.depth-(v-1));n.replace(w,u.after(-_),new R(b,4-v,0));let C=-1;n.doc.nodesBetween(w,n.doc.content.size,(k,S)=>{if(C>-1)return!1;k.isTextblock&&k.content.size===0&&(C=S+1)}),C>-1&&n.setSelection(H.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const f=l.pos===u.end()?d.contentMatchAt(0).defaultType:null,p={...no(h,d.type.name,d.attrs),...e},m={...no(h,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,l.pos);const g=f?[{type:a,attrs:p},{type:f,attrs:m}]:[{type:a,attrs:p}];if(!gn(n.doc,u.pos,2))return!1;if(i){const{selection:b,storedMarks:v}=r,{splittableMarks:_}=s.extensionManager,x=v||b.$to.parentOffset&&b.$from.marks();if(n.split(u.pos,2,g).scrollIntoView(),!x||!i)return!0;const y=x.filter(w=>_.includes(w.type.name));n.ensureMarks(y)}return!0},Lu=(t,e)=>{const n=_d(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Un(t.doc,n.pos)&&t.join(n.pos),!0},Bu=(t,e)=>{const n=_d(o=>o.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&Un(t.doc,r)&&t.join(r),!0},kw=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:u,commands:l,can:c})=>{const{extensions:d,splittableMarks:h}=i.extensionManager,f=Pe(t,o.schema),p=Pe(e,o.schema),{selection:m,storedMarks:g}=o,{$from:b,$to:v}=m,_=b.blockRange(v),x=g||m.$to.parentOffset&&m.$from.marks();if(!_)return!1;const y=_d(w=>up(w.type.name,d))(m);if(_.depth>=1&&y&&_.depth-y.depth<=1){if(y.node.type===f)return l.liftListItem(p);if(up(y.node.type.name,d)&&f.validContent(y.node.content)&&a)return u().command(()=>(s.setNodeMarkup(y.pos,f),!0)).command(()=>Lu(s,f)).command(()=>Bu(s,f)).run()}return!n||!x||!a?u().command(()=>c().wrapInList(f,r)?!0:l.clearNodes()).wrapInList(f,r).command(()=>Lu(s,f)).command(()=>Bu(s,f)).run():u().command(()=>{const w=c().wrapInList(f,r),C=x.filter(k=>h.includes(k.type.name));return s.ensureMarks(C),w?!0:l.clearNodes()}).wrapInList(f,r).command(()=>Lu(s,f)).command(()=>Bu(s,f)).run()},ww=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Jn(t,r.schema);return lc(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Cw=(t,e,n={})=>({state:r,commands:i})=>{const s=Pe(t,r.schema),o=Pe(e,r.schema),a=ss(r,s,n);let u;return r.selection.$anchor.sameParent(r.selection.$head)&&(u=r.selection.$anchor.parent.attrs),a?i.setNode(o,u):i.setNode(s,{...u,...n})},Ew=(t,e={})=>({state:n,commands:r})=>{const i=Pe(t,n.schema);return ss(n,i,e)?r.lift(i):r.wrapIn(i,e)},Sw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let u=a.steps.length-1;u>=0;u-=1)o.step(a.steps[u].invert(a.docs[u]));if(s.text){const u=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,u))}else o.delete(s.from,s.to)}return!0}}return!1},Mw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(s=>{t.removeMark(s.$from.pos,s.$to.pos)}),!0},Aw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:a}=n,u=Jn(t,r.schema),{$from:l,empty:c,ranges:d}=a;if(!i)return!0;if(c&&o){let{from:h,to:f}=a;const p=(s=l.marks().find(g=>g.type===u))===null||s===void 0?void 0:s.attrs,m=yd(l,u,p);m&&(h=m.from,f=m.to),n.removeMark(h,f,u)}else d.forEach(h=>{n.removeMark(h.$from.pos,h.$to.pos,u)});return n.removeStoredMark(u),!0},Tw=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=za(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(s=Pe(t,r.schema)),a==="mark"&&(o=Jn(t,r.schema)),i&&n.selection.ranges.forEach(u=>{const l=u.$from.pos,c=u.$to.pos;let d,h,f,p;n.selection.empty?r.doc.nodesBetween(l,c,(m,g)=>{s&&s===m.type&&(f=Math.max(g,l),p=Math.min(g+m.nodeSize,c),d=g,h=m)}):r.doc.nodesBetween(l,c,(m,g)=>{g<l&&s&&s===m.type&&(f=Math.max(g,l),p=Math.min(g+m.nodeSize,c),d=g,h=m),g>=l&&g<=c&&(s&&s===m.type&&n.setNodeMarkup(g,void 0,{...m.attrs,...e}),o&&m.marks.length&&m.marks.forEach(b=>{if(o===b.type){const v=Math.max(g,l),_=Math.min(g+m.nodeSize,c);n.addMark(v,_,o.create({...b.attrs,...e}))}}))}),h&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(m=>{o===m.type&&n.addMark(f,p,o.create({...m.attrs,...e}))}))}),!0):!1},Dw=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return Wk(i,e)(n,r)},Ow=(t,e={})=>({state:n,dispatch:r})=>{const i=Pe(t,n.schema);return Uk(i,e)(n,r)};var Rw=Object.freeze({__proto__:null,blur:f3,clearContent:p3,clearNodes:m3,command:g3,createParagraphNear:b3,cut:v3,deleteCurrentNode:y3,deleteNode:_3,deleteRange:x3,deleteSelection:k3,enter:w3,exitCode:C3,extendMarkRange:E3,first:S3,focus:A3,forEach:T3,insertContent:D3,insertContentAt:N3,joinBackward:P3,joinDown:I3,joinForward:L3,joinItemBackward:B3,joinItemForward:$3,joinTextblockBackward:z3,joinTextblockForward:H3,joinUp:F3,keyboardShortcut:V3,lift:q3,liftEmptyBlock:W3,liftListItem:U3,newlineInCode:K3,resetAttributes:J3,scrollIntoView:G3,selectAll:Y3,selectNodeBackward:Z3,selectNodeForward:X3,selectParentNode:Q3,selectTextblockEnd:ew,selectTextblockStart:tw,setContent:nw,setMark:pw,setMeta:mw,setNode:gw,setNodeSelection:bw,setTextSelection:vw,sinkListItem:yw,splitBlock:_w,splitListItem:xw,toggleList:kw,toggleMark:ww,toggleNode:Cw,toggleWrap:Ew,undoInputRule:Sw,unsetAllMarks:Mw,unsetMark:Aw,updateAttributes:Tw,wrapIn:Dw,wrapInList:Ow});const _1=Le.create({name:"commands",addCommands(){return{...Rw}}}),x1=Le.create({name:"drop",addProseMirrorPlugins(){return[new we({key:new Be("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),k1=Le.create({name:"editable",addProseMirrorPlugins(){return[new we({key:new Be("editable"),props:{editable:()=>this.editor.options.editable}})]}}),w1=new Be("focusEvents"),C1=Le.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new we({key:w1,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),E1=Le.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:u,doc:l}=a,{empty:c,$anchor:d}=u,{pos:h,parent:f}=d,p=d.parent.isTextblock&&h>0?a.doc.resolve(h-1):d,m=p.parent.type.spec.isolating,g=d.pos-d.parentOffset,b=m&&p.parent.childCount===1?g===d.pos:q.atStart(l).from===h;return!c||!f.type.isTextblock||f.textContent.length||!b||b&&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:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"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 Vo()||g1()?s:i},addProseMirrorPlugins(){return[new we({key:new Be("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(m=>m.getMeta("composition")))return;const r=t.some(m=>m.docChanged)&&!e.doc.eq(n.doc),i=t.some(m=>m.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,u=q.atStart(e.doc).from,l=q.atEnd(e.doc).to;if(s||!(o===u&&a===l)||!kd(n.doc))return;const h=n.tr,f=Ia({state:n,transaction:h}),{commands:p}=new Pa({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),S1=Le.create({name:"paste",addProseMirrorPlugins(){return[new we({key:new Be("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),M1=Le.create({name:"tabindex",addProseMirrorPlugins(){return[new we({key:new Be("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Nw=Object.freeze({__proto__:null,ClipboardTextSerializer:d1,Commands:_1,Drop:x1,Editable:k1,FocusEvents:C1,Keymap:E1,Paste:S1,Tabindex:M1,focusEventsPluginKey:w1});class rr{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,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 n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new rr(n,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 rr(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 rr(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=this.pos+r+(s?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!i&&a.depth<=this.depth)return;const u=new rr(a,this.editor,i,i?n:null);i&&(u.actualDepth=this.depth+1),e.push(new rr(a,this.editor,i,i?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const u=o[a];if(s[u]!==n[u])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(u=>n[u]===o.node.attrs[u])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const Fw=`.ProseMirror {
|
|
15
15
|
position: relative;
|
|
16
16
|
}
|
|
17
17
|
|
|
@@ -85,48 +85,48 @@ img.ProseMirror-separator {
|
|
|
85
85
|
|
|
86
86
|
.tippy-box[data-animation=fade][data-state=hidden] {
|
|
87
87
|
opacity: 0
|
|
88
|
-
}`;function
|
|
88
|
+
}`;function Iw(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class Pw extends Qk{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,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},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:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,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=Iw(Fw,this.options.injectNonce))}setOptions(e={}){this.options={...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,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){const r=a1(n)?n(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;const n=this.state.plugins;let r=n;if([].concat(e).forEach(s=>{const o=typeof s=="string"?`${s}$`:s.key;r=r.filter(a=>!a.key.startsWith(o))}),n.length===r.length)return;const i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var e,n;const i=[...this.options.enableCoreExtensions?[k1,d1.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),_1,C1,E1,M1,x1,S1].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Vr(i,this)}createCommandManager(){this.commandManager=new Pa({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=uc(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(a=>a.name!=="collaboration"),this.createExtensionManager()}}),n=uc(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=p1(n,this.options.autofocus);this.view=new Kg(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)===null||e===void 0?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:jr.create({doc:n,selection:r||void 0})});const i=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(i),this.createNodeViews(),this.prependClass();const 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;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(o=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(o)});return}const n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const 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 y1(this.state,e)}isActive(e,n){const r=typeof e=="string"?e:null,i=typeof e=="string"?n:e;return dw(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return vs(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
|
|
89
89
|
|
|
90
|
-
`,textSerializers:r={}}=e||{};return
|
|
91
|
-
`," "],Fw=["{","}","|","\\","^","`"].concat(Nw),Iw=["'"].concat(Fw),lp=["%","/","?",";","#"].concat(Iw),cp=["/","?","#"],Pw=255,dp=/^[+a-z0-9A-Z_-]{0,63}$/,Lw=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,hp={javascript:!0,"javascript:":!0},fp={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function xd(t,e){if(t&&t instanceof Vo)return t;const n=new Vo;return n.parse(t,e),n}Vo.prototype.parse=function(t,e){let n,r,i,s=t;if(s=s.trim(),!e&&t.split("#").length===1){const l=Rw.exec(s);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let o=Dw.exec(s);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,s=s.substr(o.length)),(e||o||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=s.substr(0,2)==="//",i&&!(o&&hp[o])&&(s=s.substr(2),this.slashes=!0)),!hp[o]&&(i||o&&!fp[o])){let l=-1;for(let p=0;p<cp.length;p++)r=s.indexOf(cp[p]),r!==-1&&(l===-1||r<l)&&(l=r);let c,d;l===-1?d=s.lastIndexOf("@"):d=s.lastIndexOf("@",l),d!==-1&&(c=s.slice(0,d),s=s.slice(d+1),this.auth=c),l=-1;for(let p=0;p<lp.length;p++)r=s.indexOf(lp[p]),r!==-1&&(l===-1||r<l)&&(l=r);l===-1&&(l=s.length),s[l-1]===":"&&l--;const h=s.slice(0,l);s=s.slice(l),this.parseHost(h),this.hostname=this.hostname||"";const f=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!f){const p=this.hostname.split(/\./);for(let m=0,g=p.length;m<g;m++){const b=p[m];if(b&&!b.match(dp)){let v="";for(let _=0,x=b.length;_<x;_++)b.charCodeAt(_)>127?v+="x":v+=b[_];if(!v.match(dp)){const _=p.slice(0,m),x=p.slice(m+1),y=b.match(Lw);y&&(_.push(y[1]),x.unshift(y[2])),x.length&&(s=x.join(".")+s),this.hostname=_.join(".");break}}}}this.hostname.length>Pw&&(this.hostname=""),f&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const u=s.indexOf("?");return u!==-1&&(this.search=s.substr(u),s=s.slice(0,u)),s&&(this.pathname=s),fp[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};Vo.prototype.parseHost=function(t){let e=Ow.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const Bw=Object.freeze(Object.defineProperty({__proto__:null,decode:ii,encode:vs,format:_d,parse:xd},Symbol.toStringTag,{value:"Module"})),E1=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,S1=/[\0-\x1F\x7F-\x9F]/,$w=/[\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]/,kd=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/,M1=/[\$\+<->\^`\|~\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]/,A1=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,zw=Object.freeze(Object.defineProperty({__proto__:null,Any:E1,Cc:S1,Cf:$w,P:kd,S:M1,Z:A1},Symbol.toStringTag,{value:"Module"})),Hw=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),jw=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var Lu;const Vw=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]]),qw=(Lu=String.fromCodePoint)!==null&&Lu!==void 0?Lu: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 Ww(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=Vw.get(t))!==null&&e!==void 0?e:t}var Ne;(function(t){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"})(Ne||(Ne={}));const Uw=32;var Ln;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Ln||(Ln={}));function cc(t){return t>=Ne.ZERO&&t<=Ne.NINE}function Kw(t){return t>=Ne.UPPER_A&&t<=Ne.UPPER_F||t>=Ne.LOWER_A&&t<=Ne.LOWER_F}function Jw(t){return t>=Ne.UPPER_A&&t<=Ne.UPPER_Z||t>=Ne.LOWER_A&&t<=Ne.LOWER_Z||cc(t)}function Gw(t){return t===Ne.EQUALS||Jw(t)}var Re;(function(t){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"})(Re||(Re={}));var On;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(On||(On={}));class Yw{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Re.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=On.Strict}startEntity(e){this.decodeMode=e,this.state=Re.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Re.EntityStart:return e.charCodeAt(n)===Ne.NUM?(this.state=Re.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Re.NamedEntity,this.stateNamedEntity(e,n));case Re.NumericStart:return this.stateNumericStart(e,n);case Re.NumericDecimal:return this.stateNumericDecimal(e,n);case Re.NumericHex:return this.stateNumericHex(e,n);case Re.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|Uw)===Ne.LOWER_X?(this.state=Re.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Re.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(cc(i)||Kw(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(cc(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Ne.SEMI)this.consumed+=1;else if(this.decodeMode===On.Strict)return 0;return this.emitCodePoint(Ww(this.result),this.consumed),this.errors&&(e!==Ne.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&Ln.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=Zw(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===On.Attribute&&(s===0||Gw(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&Ln.VALUE_LENGTH)>>14,s!==0){if(o===Ne.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==On.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&Ln.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~Ln.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Re.NamedEntity:return this.result!==0&&(this.decodeMode!==On.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Re.NumericDecimal:return this.emitNumericEntity(0,2);case Re.NumericHex:return this.emitNumericEntity(0,3);case Re.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Re.EntityStart:return 0}}}function T1(t){let e="";const n=new Yw(t,r=>e+=qw(r));return function(i,s){let o=0,a=0;for(;(a=i.indexOf("&",a))>=0;){e+=i.slice(o,a),n.startEntity(s);const l=n.write(i,a+1);if(l<0){o=a+n.end();break}o=a+l,a=l===0?o+1:o}const u=e+i.slice(o);return e="",u}}function Zw(t,e,n,r){const i=(e&Ln.BRANCH_LENGTH)>>7,s=e&Ln.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=i?-1:t[n+u]-1}let o=n,a=o+i-1;for(;o<=a;){const u=o+a>>>1,l=t[u];if(l<r)o=u+1;else if(l>r)a=u-1;else return t[u+i]}return-1}const Xw=T1(Hw);T1(jw);function D1(t,e=On.Legacy){return Xw(t,e)}function Qw(t){return Object.prototype.toString.call(t)}function wd(t){return Qw(t)==="[object String]"}const e6=Object.prototype.hasOwnProperty;function t6(t,e){return e6.call(t,e)}function za(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function O1(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function Cd(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 qo(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const R1=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,n6=/&([a-z#][a-z0-9]{1,31});/gi,r6=new RegExp(R1.source+"|"+n6.source,"gi"),i6=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function s6(t,e){if(e.charCodeAt(0)===35&&i6.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Cd(r)?qo(r):t}const n=D1(t);return n!==t?n:t}function o6(t){return t.indexOf("\\")<0?t:t.replace(R1,"$1")}function si(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(r6,function(e,n,r){return n||s6(e,r)})}const a6=/[&<>"]/,u6=/[&<>"]/g,l6={"&":"&","<":"<",">":">",'"':"""};function c6(t){return l6[t]}function qn(t){return a6.test(t)?t.replace(u6,c6):t}const d6=/[.?*+^$[\]\\(){}|-]/g;function h6(t){return t.replace(d6,"\\$&")}function ae(t){switch(t){case 9:case 32:return!0}return!1}function as(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 us(t){return kd.test(t)||M1.test(t)}function ls(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 Ha(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const f6={mdurl:Bw,ucmicro:zw},p6=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:O1,assign:za,escapeHtml:qn,escapeRE:h6,fromCodePoint:qo,has:t6,isMdAsciiPunct:ls,isPunctChar:us,isSpace:ae,isString:wd,isValidEntityCode:Cd,isWhiteSpace:as,lib:f6,normalizeReference:Ha,unescapeAll:si,unescapeMd:o6},Symbol.toStringTag,{value:"Module"}));function m6(t,e,n){let r,i,s,o;const a=t.posMax,u=t.pos;for(t.pos=e+1,r=1;t.pos<a;){if(s=t.src.charCodeAt(t.pos),s===93&&(r--,r===0)){i=!0;break}if(o=t.pos,t.md.inline.skipToken(t),s===91){if(o===t.pos-1)r++;else if(n)return t.pos=u,-1}}let l=-1;return i&&(l=t.pos),t.pos=u,l}function g6(t,e,n){let r,i=e;const s={ok:!1,pos:0,str:""};if(t.charCodeAt(i)===60){for(i++;i<n;){if(r=t.charCodeAt(i),r===10||r===60)return s;if(r===62)return s.pos=i+1,s.str=si(t.slice(e+1,i)),s.ok=!0,s;if(r===92&&i+1<n){i+=2;continue}i++}return s}let o=0;for(;i<n&&(r=t.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(t.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return s;if(r===41){if(o===0)break;o--}i++}return e===i||o!==0||(s.str=si(t.slice(e,i)),s.pos=i,s.ok=!0),s}function b6(t,e,n,r){let i,s=e;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(s>=n)return o;let a=t.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return o;e++,s++,a===40&&(a=41),o.marker=a}for(;s<n;){if(i=t.charCodeAt(s),i===o.marker)return o.pos=s+1,o.str+=si(t.slice(e,s)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&s+1<n&&s++,s++}return o.can_continue=!0,o.str+=si(t.slice(e,s)),o}const v6=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:g6,parseLinkLabel:m6,parseLinkTitle:b6},Symbol.toStringTag,{value:"Module"})),Gt={};Gt.code_inline=function(t,e,n,r,i){const s=t[e];return"<code"+i.renderAttrs(s)+">"+qn(s.content)+"</code>"};Gt.code_block=function(t,e,n,r,i){const s=t[e];return"<pre"+i.renderAttrs(s)+"><code>"+qn(t[e].content)+`</code></pre>
|
|
92
|
-
`};
|
|
90
|
+
`,textSerializers:r={}}=e||{};return ow(this.state.doc,{blockSeparator:n,textSerializers:{...c1(this.schema),...r}})}get isEmpty(){return kd(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){const 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,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(e,n))||null}$nodes(e,n){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new rr(n,this)}get $doc(){return this.$pos(0)}}function ii(t){return new Ba({find:t.find,handler:({state:e,range:n,match:r})=>{const i=U(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const u=a.search(/\S/),l=n.from+a.indexOf(o),c=l+o.length;if(xd(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===t.type&&m!==f.mark.type)).filter(f=>f.to>l).length)return null;c<n.to&&s.delete(c,n.to),l>n.from&&s.delete(n.from+u,l);const h=n.from+u+o.length;s.addMark(n.from+u,h,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}function A1(t){return new Ba({find:t.find,handler:({state:e,range:n,match:r})=>{const i=U(t.getAttributes,void 0,r)||{},{tr:s}=e,o=n.from;let a=n.to;const u=t.type.create(i);if(r[1]){const l=r[0].lastIndexOf(r[1]);let c=o+l;c>a?c=a:a=c+r[1].length;const d=r[0][r[0].length-1];s.insertText(d,o+r[0].length-1),s.replaceWith(c,a,u)}else if(r[0]){const l=t.type.isInline?o:o-1;s.insert(l,t.type.create(i)).delete(s.mapping.map(o),s.mapping.map(a))}s.scrollIntoView()}})}function cc(t){return new Ba({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),s=U(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)}})}function as(t){return new Ba({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const s=U(t.getAttributes,void 0,r)||{},o=e.tr.delete(n.from,n.to),u=o.doc.resolve(n.from).blockRange(),l=u&&ed(u,t.type,s);if(!l)return null;if(o.wrap(u,l),t.keepMarks&&t.editor){const{selection:d,storedMarks:h}=e,{splittableMarks:f}=t.editor.extensionManager,p=h||d.$to.parentOffset&&d.$from.marks();if(p){const m=p.filter(g=>f.includes(g.type.name));o.ensureMarks(m)}}if(t.keepAttributes){const d=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(d,s).run()}const c=o.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&Un(o.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&o.join(n.from-1)}})}let te=class dc{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...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=U(B(this,"addOptions",{name:this.name}))),this.storage=U(B(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new dc(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>$a(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new dc(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.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: "${n.name}".`),n.options=U(B(n,"addOptions",{name:n.name})),n.storage=U(B(n,"addStorage",{name:n.name,options:n.options})),n}};function yr(t){return new u1({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=U(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],u=r[0];let l=n.to;if(a){const c=u.search(/\S/),d=n.from+u.indexOf(a),h=d+a.length;if(xd(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(g=>g===t.type&&g!==p.mark.type)).filter(p=>p.to>d).length)return null;h<n.to&&o.delete(h,n.to),d>n.from&&o.delete(n.from+c,d),l=n.from+c+a.length,o.addMark(n.from+c,l,t.type.create(s||{})),o.removeStoredMark(t.type)}}})}function Lw(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof z){const s=r.index();return r.parent.canReplaceWith(s,s+1,e)}let i=r.depth;for(;i>=0;){const s=r.index(i);if(r.node(i).contentMatchAt(s).matchType(e))return!0;i-=1}return!1}function Bw(t){return new u1({find:t.find,handler({match:e,chain:n,range:r,pasteEvent:i}){const s=U(t.getAttributes,void 0,e,i),o=U(t.getContent,void 0,s);if(s===!1||s===null)return null;const a={type:t.type.name,attrs:s};o&&(a.content=o),e.input&&n().deleteRange(r).insertContentAt(r.from,a)}})}const cp={};function $w(t){let e=cp[t];if(e)return e;e=cp[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);e.push(r)}for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);e[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return e}function si(t,e){typeof e!="string"&&(e=si.defaultChars);const n=$w(e);return t.replace(/(%[a-f0-9]{2})+/gi,function(r){let i="";for(let s=0,o=r.length;s<o;s+=3){const a=parseInt(r.slice(s+1,s+3),16);if(a<128){i+=n[a];continue}if((a&224)===192&&s+3<o){const u=parseInt(r.slice(s+4,s+6),16);if((u&192)===128){const l=a<<6&1984|u&63;l<128?i+="��":i+=String.fromCharCode(l),s+=3;continue}}if((a&240)===224&&s+6<o){const u=parseInt(r.slice(s+4,s+6),16),l=parseInt(r.slice(s+7,s+9),16);if((u&192)===128&&(l&192)===128){const c=a<<12&61440|u<<6&4032|l&63;c<2048||c>=55296&&c<=57343?i+="���":i+=String.fromCharCode(c),s+=6;continue}}if((a&248)===240&&s+9<o){const u=parseInt(r.slice(s+4,s+6),16),l=parseInt(r.slice(s+7,s+9),16),c=parseInt(r.slice(s+10,s+12),16);if((u&192)===128&&(l&192)===128&&(c&192)===128){let d=a<<18&1835008|u<<12&258048|l<<6&4032|c&63;d<65536||d>1114111?i+="����":(d-=65536,i+=String.fromCharCode(55296+(d>>10),56320+(d&1023))),s+=9;continue}}i+="�"}return i})}si.defaultChars=";/?:@&=+$,#";si.componentChars="";const dp={};function zw(t){let e=dp[t];if(e)return e;e=dp[t]=[];for(let n=0;n<128;n++){const r=String.fromCharCode(n);/^[0-9a-z]$/i.test(r)?e.push(r):e.push("%"+("0"+n.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<t.length;n++)e[t.charCodeAt(n)]=t[n];return e}function ys(t,e,n){typeof e!="string"&&(n=e,e=ys.defaultChars),typeof n>"u"&&(n=!0);const r=zw(e);let i="";for(let s=0,o=t.length;s<o;s++){const a=t.charCodeAt(s);if(n&&a===37&&s+2<o&&/^[0-9a-f]{2}$/i.test(t.slice(s+1,s+3))){i+=t.slice(s,s+3),s+=2;continue}if(a<128){i+=r[a];continue}if(a>=55296&&a<=57343){if(a>=55296&&a<=56319&&s+1<o){const u=t.charCodeAt(s+1);if(u>=56320&&u<=57343){i+=encodeURIComponent(t[s]+t[s+1]),s++;continue}}i+="%EF%BF%BD";continue}i+=encodeURIComponent(t[s])}return i}ys.defaultChars=";/?:@&=+$,-_.!~*'()#";ys.componentChars="-_.!~*'()";function wd(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 qo(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}const Hw=/^([a-z0-9.+-]+:)/i,jw=/:[0-9]*$/,Vw=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,qw=["<",">",'"',"`"," ","\r",`
|
|
91
|
+
`," "],Ww=["{","}","|","\\","^","`"].concat(qw),Uw=["'"].concat(Ww),hp=["%","/","?",";","#"].concat(Uw),fp=["/","?","#"],Kw=255,pp=/^[+a-z0-9A-Z_-]{0,63}$/,Jw=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,mp={javascript:!0,"javascript:":!0},gp={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Cd(t,e){if(t&&t instanceof qo)return t;const n=new qo;return n.parse(t,e),n}qo.prototype.parse=function(t,e){let n,r,i,s=t;if(s=s.trim(),!e&&t.split("#").length===1){const l=Vw.exec(s);if(l)return this.pathname=l[1],l[2]&&(this.search=l[2]),this}let o=Hw.exec(s);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,s=s.substr(o.length)),(e||o||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=s.substr(0,2)==="//",i&&!(o&&mp[o])&&(s=s.substr(2),this.slashes=!0)),!mp[o]&&(i||o&&!gp[o])){let l=-1;for(let p=0;p<fp.length;p++)r=s.indexOf(fp[p]),r!==-1&&(l===-1||r<l)&&(l=r);let c,d;l===-1?d=s.lastIndexOf("@"):d=s.lastIndexOf("@",l),d!==-1&&(c=s.slice(0,d),s=s.slice(d+1),this.auth=c),l=-1;for(let p=0;p<hp.length;p++)r=s.indexOf(hp[p]),r!==-1&&(l===-1||r<l)&&(l=r);l===-1&&(l=s.length),s[l-1]===":"&&l--;const h=s.slice(0,l);s=s.slice(l),this.parseHost(h),this.hostname=this.hostname||"";const f=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!f){const p=this.hostname.split(/\./);for(let m=0,g=p.length;m<g;m++){const b=p[m];if(b&&!b.match(pp)){let v="";for(let _=0,x=b.length;_<x;_++)b.charCodeAt(_)>127?v+="x":v+=b[_];if(!v.match(pp)){const _=p.slice(0,m),x=p.slice(m+1),y=b.match(Jw);y&&(_.push(y[1]),x.unshift(y[2])),x.length&&(s=x.join(".")+s),this.hostname=_.join(".");break}}}}this.hostname.length>Kw&&(this.hostname=""),f&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}const a=s.indexOf("#");a!==-1&&(this.hash=s.substr(a),s=s.slice(0,a));const u=s.indexOf("?");return u!==-1&&(this.search=s.substr(u),s=s.slice(0,u)),s&&(this.pathname=s),gp[n]&&this.hostname&&!this.pathname&&(this.pathname=""),this};qo.prototype.parseHost=function(t){let e=jw.exec(t);e&&(e=e[0],e!==":"&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};const Gw=Object.freeze(Object.defineProperty({__proto__:null,decode:si,encode:ys,format:wd,parse:Cd},Symbol.toStringTag,{value:"Module"})),T1=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,D1=/[\0-\x1F\x7F-\x9F]/,Yw=/[\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]/,Ed=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\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]/,O1=/[\$\+<->\^`\|~\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]/,R1=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Zw=Object.freeze(Object.defineProperty({__proto__:null,Any:T1,Cc:D1,Cf:Yw,P:Ed,S:O1,Z:R1},Symbol.toStringTag,{value:"Module"})),Xw=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏઑඡ༉༦ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲϏϢϸontourIntegraìȹoɴ\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲy;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱còJTabcdfgorstרׯؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ߂ߐĀiyޱrc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣসে্ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४ĀnrࢃgleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpwਖਛgȀLRlr৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼અઋp;椅y;䐜Ādl੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑඞcy;䐊cute;䅃ƀaeyહાron;䅇dil;䅅;䐝ƀgswે૰ativeƀMTV૨ediumSpace;怋hiĀcn૦ëeryThiîtedĀGLଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷreak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪௫ఄ಄ದൡඅ櫬Āoungruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater;EFGLSTஶஷ扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨setĀ;Eೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂෛ෧ขภยา฿ไlig;䅒cute耻Ó䃓Āiyීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲcr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬืde耻Õ䃕es;樷ml耻Ö䃖erĀBP๋Āar๐๓r;怾acĀek๚;揞et;掴arenthesis;揜ҀacfhilorsງຊຏຒດຝະrtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ檻cedesȀ;EST່້扺qual;檯lantEqual;扼ilde;找me;怳Ādpuct;戏ortionĀ;aȥl;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL憒ar;懥eftArrow;懄eiling;按oǵ\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄቕቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHcቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗ĀeiቻDzኀ\0ኇefore;戴a;䎘ĀcnኘkSpace;쀀 Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtèa;䎖r;愨pf;愤cr;쀀𝒵ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒;Eaeiopᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;eᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;eᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰᝃᝈ០៦ᠹᡐᜍ᥈ᥰot;櫭ĀcrᛶkȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;tbrk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯᝳ;䎲;愶een;扬r;쀀𝔟gcostuvwឍឝឳេ៕៛ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀakoᠦᠵĀcn៲ᠣkƀlst֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ;敛;敘;攘;攔;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģbar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;elƀ;bhᥨᥩᥫ䁜;槅sub;柈ŬᥴlĀ;e怢t»pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭒\0᯽\0ᰌƀcprᦲute;䄇̀;abcdsᦿᧀᧄ᧕᧙戩nd;橄rcup;橉Āau᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r;Ecefms᩠ᩢᩫ᪤᪪旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ\0\0aĀ;t䀬;䁀ƀ;fl戁îᅠeĀmxent»eóɍǧ\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯delprvw᭠᭬᭷ᮂᮬᯔarrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;pᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰻᰿ᱝᱩᱵᲞᲬᲷᴍᵻᶑᶫᶻ᷆᷍ròar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂᳖᳜᳠mƀ;oș᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄĀDoḆᴴoôĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»ṺƀaeiἒἚls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧\0耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₥₰₴⃰℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽ƀ;qsؾٌlanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqrⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0proør;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼ròòΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonóquigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roøurĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨íistĀ;sடr;쀀𝔫ȀEest⩦⩹⩼ƀ;qs⩭ƀ;qs⩴lanôií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast⭕⭚⭟lleìl;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖchimpqu⮽⯍⯙⬄⯤⯯Ȁ;cerല⯆ഷ⯉uå;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭ååഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñĀ;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;cⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācrir;榿;쀀𝔬ͯ\0\0\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕⶥⶨrò᪀Āirⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔǒr;榷rp;榹;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ\0\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ脀¶;l䂶leìЃɩ\0\0m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳ᤈ⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t⾴ïrel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⋢⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔ABHabcdefhilmnoprstuxけさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstwガクシスゼゾダッデナp;極Ā;fゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ìâヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘rrowĀ;tㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowóarpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓ròaòՑ;怏oustĀ;a㈞掱che»mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì耻䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;qኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫwar;椪lig耻ß䃟㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rëƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproøim»ኬsðኞĀas㚺㚮ðrn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈadempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xôheadĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roðtré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜtré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),Qw=new Uint16Array("Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢".split("").map(t=>t.charCodeAt(0)));var $u;const e6=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]]),t6=($u=String.fromCodePoint)!==null&&$u!==void 0?$u: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 n6(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=e6.get(t))!==null&&e!==void 0?e:t}var Ne;(function(t){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"})(Ne||(Ne={}));const r6=32;var Bn;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(Bn||(Bn={}));function hc(t){return t>=Ne.ZERO&&t<=Ne.NINE}function i6(t){return t>=Ne.UPPER_A&&t<=Ne.UPPER_F||t>=Ne.LOWER_A&&t<=Ne.LOWER_F}function s6(t){return t>=Ne.UPPER_A&&t<=Ne.UPPER_Z||t>=Ne.LOWER_A&&t<=Ne.LOWER_Z||hc(t)}function o6(t){return t===Ne.EQUALS||s6(t)}var Re;(function(t){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"})(Re||(Re={}));var Rn;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(Rn||(Rn={}));class a6{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=Re.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Rn.Strict}startEntity(e){this.decodeMode=e,this.state=Re.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case Re.EntityStart:return e.charCodeAt(n)===Ne.NUM?(this.state=Re.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=Re.NamedEntity,this.stateNamedEntity(e,n));case Re.NumericStart:return this.stateNumericStart(e,n);case Re.NumericDecimal:return this.stateNumericDecimal(e,n);case Re.NumericHex:return this.stateNumericHex(e,n);case Re.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|r6)===Ne.LOWER_X?(this.state=Re.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=Re.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(hc(i)||i6(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(hc(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Ne.SEMI)this.consumed+=1;else if(this.decodeMode===Rn.Strict)return 0;return this.emitCodePoint(n6(this.result),this.consumed),this.errors&&(e!==Ne.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&Bn.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=u6(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===Rn.Attribute&&(s===0||o6(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&Bn.VALUE_LENGTH)>>14,s!==0){if(o===Ne.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==Rn.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&Bn.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~Bn.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case Re.NamedEntity:return this.result!==0&&(this.decodeMode!==Rn.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Re.NumericDecimal:return this.emitNumericEntity(0,2);case Re.NumericHex:return this.emitNumericEntity(0,3);case Re.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Re.EntityStart:return 0}}}function N1(t){let e="";const n=new a6(t,r=>e+=t6(r));return function(i,s){let o=0,a=0;for(;(a=i.indexOf("&",a))>=0;){e+=i.slice(o,a),n.startEntity(s);const l=n.write(i,a+1);if(l<0){o=a+n.end();break}o=a+l,a=l===0?o+1:o}const u=e+i.slice(o);return e="",u}}function u6(t,e,n,r){const i=(e&Bn.BRANCH_LENGTH)>>7,s=e&Bn.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const u=r-s;return u<0||u>=i?-1:t[n+u]-1}let o=n,a=o+i-1;for(;o<=a;){const u=o+a>>>1,l=t[u];if(l<r)o=u+1;else if(l>r)a=u-1;else return t[u+i]}return-1}const l6=N1(Xw);N1(Qw);function F1(t,e=Rn.Legacy){return l6(t,e)}function c6(t){return Object.prototype.toString.call(t)}function Sd(t){return c6(t)==="[object String]"}const d6=Object.prototype.hasOwnProperty;function h6(t,e){return d6.call(t,e)}function Ha(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){if(n){if(typeof n!="object")throw new TypeError(n+"must be object");Object.keys(n).forEach(function(r){t[r]=n[r]})}}),t}function I1(t,e,n){return[].concat(t.slice(0,e),n,t.slice(e+1))}function Md(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 Wo(t){if(t>65535){t-=65536;const e=55296+(t>>10),n=56320+(t&1023);return String.fromCharCode(e,n)}return String.fromCharCode(t)}const P1=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,f6=/&([a-z#][a-z0-9]{1,31});/gi,p6=new RegExp(P1.source+"|"+f6.source,"gi"),m6=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function g6(t,e){if(e.charCodeAt(0)===35&&m6.test(e)){const r=e[1].toLowerCase()==="x"?parseInt(e.slice(2),16):parseInt(e.slice(1),10);return Md(r)?Wo(r):t}const n=F1(t);return n!==t?n:t}function b6(t){return t.indexOf("\\")<0?t:t.replace(P1,"$1")}function oi(t){return t.indexOf("\\")<0&&t.indexOf("&")<0?t:t.replace(p6,function(e,n,r){return n||g6(e,r)})}const v6=/[&<>"]/,y6=/[&<>"]/g,_6={"&":"&","<":"<",">":">",'"':"""};function x6(t){return _6[t]}function Wn(t){return v6.test(t)?t.replace(y6,x6):t}const k6=/[.?*+^$[\]\\(){}|-]/g;function w6(t){return t.replace(k6,"\\$&")}function ae(t){switch(t){case 9:case 32:return!0}return!1}function us(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 Ed.test(t)||O1.test(t)}function cs(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 ja(t){return t=t.trim().replace(/\s+/g," "),"ẞ".toLowerCase()==="Ṿ"&&(t=t.replace(/ẞ/g,"ß")),t.toLowerCase().toUpperCase()}const C6={mdurl:Gw,ucmicro:Zw},E6=Object.freeze(Object.defineProperty({__proto__:null,arrayReplaceAt:I1,assign:Ha,escapeHtml:Wn,escapeRE:w6,fromCodePoint:Wo,has:h6,isMdAsciiPunct:cs,isPunctChar:ls,isSpace:ae,isString:Sd,isValidEntityCode:Md,isWhiteSpace:us,lib:C6,normalizeReference:ja,unescapeAll:oi,unescapeMd:b6},Symbol.toStringTag,{value:"Module"}));function S6(t,e,n){let r,i,s,o;const a=t.posMax,u=t.pos;for(t.pos=e+1,r=1;t.pos<a;){if(s=t.src.charCodeAt(t.pos),s===93&&(r--,r===0)){i=!0;break}if(o=t.pos,t.md.inline.skipToken(t),s===91){if(o===t.pos-1)r++;else if(n)return t.pos=u,-1}}let l=-1;return i&&(l=t.pos),t.pos=u,l}function M6(t,e,n){let r,i=e;const s={ok:!1,pos:0,str:""};if(t.charCodeAt(i)===60){for(i++;i<n;){if(r=t.charCodeAt(i),r===10||r===60)return s;if(r===62)return s.pos=i+1,s.str=oi(t.slice(e+1,i)),s.ok=!0,s;if(r===92&&i+1<n){i+=2;continue}i++}return s}let o=0;for(;i<n&&(r=t.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(t.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return s;if(r===41){if(o===0)break;o--}i++}return e===i||o!==0||(s.str=oi(t.slice(e,i)),s.pos=i,s.ok=!0),s}function A6(t,e,n,r){let i,s=e;const o={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(s>=n)return o;let a=t.charCodeAt(s);if(a!==34&&a!==39&&a!==40)return o;e++,s++,a===40&&(a=41),o.marker=a}for(;s<n;){if(i=t.charCodeAt(s),i===o.marker)return o.pos=s+1,o.str+=oi(t.slice(e,s)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&s+1<n&&s++,s++}return o.can_continue=!0,o.str+=oi(t.slice(e,s)),o}const T6=Object.freeze(Object.defineProperty({__proto__:null,parseLinkDestination:M6,parseLinkLabel:S6,parseLinkTitle:A6},Symbol.toStringTag,{value:"Module"})),Yt={};Yt.code_inline=function(t,e,n,r,i){const s=t[e];return"<code"+i.renderAttrs(s)+">"+Wn(s.content)+"</code>"};Yt.code_block=function(t,e,n,r,i){const s=t[e];return"<pre"+i.renderAttrs(s)+"><code>"+Wn(t[e].content)+`</code></pre>
|
|
92
|
+
`};Yt.fence=function(t,e,n,r,i){const s=t[e],o=s.info?oi(s.info).trim():"";let a="",u="";if(o){const c=o.split(/(\s+)/g);a=c[0],u=c.slice(2).join("")}let l;if(n.highlight?l=n.highlight(s.content,a,u)||Wn(s.content):l=Wn(s.content),l.indexOf("<pre")===0)return l+`
|
|
93
93
|
`;if(o){const c=s.attrIndex("class"),d=s.attrs?s.attrs.slice():[];c<0?d.push(["class",n.langPrefix+a]):(d[c]=d[c].slice(),d[c][1]+=" "+n.langPrefix+a);const h={attrs:d};return`<pre><code${i.renderAttrs(h)}>${l}</code></pre>
|
|
94
94
|
`}return`<pre><code${i.renderAttrs(s)}>${l}</code></pre>
|
|
95
|
-
`};
|
|
95
|
+
`};Yt.image=function(t,e,n,r,i){const s=t[e];return s.attrs[s.attrIndex("alt")][1]=i.renderInlineAsText(s.children,n,r),i.renderToken(t,e,n)};Yt.hardbreak=function(t,e,n){return n.xhtmlOut?`<br />
|
|
96
96
|
`:`<br>
|
|
97
|
-
`};
|
|
97
|
+
`};Yt.softbreak=function(t,e,n){return n.breaks?n.xhtmlOut?`<br />
|
|
98
98
|
`:`<br>
|
|
99
99
|
`:`
|
|
100
|
-
`};
|
|
100
|
+
`};Yt.text=function(t,e){return Wn(t[e].content)};Yt.html_block=function(t,e){return t[e].content};Yt.html_inline=function(t,e){return t[e].content};function ui(){this.rules=Ha({},Yt)}ui.prototype.renderAttrs=function(e){let n,r,i;if(!e.attrs)return"";for(i="",n=0,r=e.attrs.length;n<r;n++)i+=" "+Wn(e.attrs[n][0])+'="'+Wn(e.attrs[n][1])+'"';return i};ui.prototype.renderToken=function(e,n,r){const i=e[n];let s="";if(i.hidden)return"";i.block&&i.nesting!==-1&&n&&e[n-1].hidden&&(s+=`
|
|
101
101
|
`),s+=(i.nesting===-1?"</":"<")+i.tag,s+=this.renderAttrs(i),i.nesting===0&&r.xhtmlOut&&(s+=" /");let o=!1;if(i.block&&(o=!0,i.nesting===1&&n+1<e.length)){const a=e[n+1];(a.type==="inline"||a.hidden||a.nesting===-1&&a.tag===i.tag)&&(o=!1)}return s+=o?`>
|
|
102
|
-
`:">",s};
|
|
103
|
-
`;break}return r};
|
|
104
|
-
`),e=e.replace(_6,"�"),t.src=e}function k6(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 w6(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const i=e[n];i.type==="inline"&&t.md.inline.parse(i.content,t.md,t.env,i.children)}}function C6(t){return/^<a[>\s]/i.test(t)}function E6(t){return/^<\/a\s*>/i.test(t)}function S6(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if(e[n].type!=="inline"||!t.md.linkify.pretest(e[n].content))continue;let i=e[n].children,s=0;for(let o=i.length-1;o>=0;o--){const a=i[o];if(a.type==="link_close"){for(o--;i[o].level!==a.level&&i[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(C6(a.content)&&s>0&&s--,E6(a.content)&&s++),!(s>0)&&a.type==="text"&&t.md.linkify.test(a.content)){const u=a.content;let l=t.md.linkify.match(u);const c=[];let d=a.level,h=0;l.length>0&&l[0].index===0&&o>0&&i[o-1].type==="text_special"&&(l=l.slice(1));for(let f=0;f<l.length;f++){const p=l[f].url,m=t.md.normalizeLink(p);if(!t.md.validateLink(m))continue;let g=l[f].text;l[f].schema?l[f].schema==="mailto:"&&!/^mailto:/i.test(g)?g=t.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=t.md.normalizeLinkText(g):g=t.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,"");const b=l[f].index;if(b>h){const y=new t.Token("text","",0);y.content=u.slice(h,b),y.level=d,c.push(y)}const v=new t.Token("link_open","a",1);v.attrs=[["href",m]],v.level=d++,v.markup="linkify",v.info="auto",c.push(v);const _=new t.Token("text","",0);_.content=g,_.level=d,c.push(_);const x=new t.Token("link_close","a",-1);x.level=--d,x.markup="linkify",x.info="auto",c.push(x),h=l[f].lastIndex}if(h<u.length){const f=new t.Token("text","",0);f.content=u.slice(h),f.level=d,c.push(f)}e[n].children=i=O1(i,o,c)}}}}const F1=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,M6=/\((c|tm|r)\)/i,A6=/\((c|tm|r)\)/ig,T6={c:"©",r:"®",tm:"™"};function D6(t,e){return T6[e.toLowerCase()]}function O6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace(A6,D6)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function R6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&F1.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function N6(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(M6.test(t.tokens[e].content)&&O6(t.tokens[e].children),F1.test(t.tokens[e].content)&&R6(t.tokens[e].children))}const F6=/['"]/,pp=/['"]/g,mp="’";function Bs(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function I6(t,e){let n;const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,s.type!=="text")continue;let a=s.content,u=0,l=a.length;e:for(;u<l;){pp.lastIndex=u;const c=pp.exec(a);if(!c)break;let d=!0,h=!0;u=c.index+1;const f=c[0]==="'";let p=32;if(c.index-1>=0)p=a.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){p=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(u<l)m=a.charCodeAt(u);else for(n=i+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){m=t[n].content.charCodeAt(0);break}const g=ls(p)||us(String.fromCharCode(p)),b=ls(m)||us(String.fromCharCode(m)),v=as(p),_=as(m);if(_?d=!1:b&&(v||g||(d=!1)),v?h=!1:g&&(_||b||(h=!1)),m===34&&c[0]==='"'&&p>=48&&p<=57&&(h=d=!1),d&&h&&(d=g,h=b),!d&&!h){f&&(s.content=Bs(s.content,c.index,mp));continue}if(h)for(n=r.length-1;n>=0;n--){let x=r[n];if(r[n].level<o)break;if(x.single===f&&r[n].level===o){x=r[n];let y,w;f?(y=e.md.options.quotes[2],w=e.md.options.quotes[3]):(y=e.md.options.quotes[0],w=e.md.options.quotes[1]),s.content=Bs(s.content,c.index,w),t[x.token].content=Bs(t[x.token].content,x.pos,y),u+=w.length-1,x.token===i&&(u+=y.length-1),a=s.content,l=a.length,r.length=n;continue e}}d?r.push({token:i,pos:c.index,single:f,level:o}):h&&f&&(s.content=Bs(s.content,c.index,mp))}}}function P6(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!F6.test(t.tokens[e].content)||I6(t.tokens[e].children,t)}function L6(t){let e,n;const r=t.tokens,i=r.length;for(let s=0;s<i;s++){if(r[s].type!=="inline")continue;const o=r[s].children,a=o.length;for(e=0;e<a;e++)o[e].type==="text_special"&&(o[e].type="text");for(e=n=0;e<a;e++)o[e].type==="text"&&e+1<a&&o[e+1].type==="text"?o[e+1].content=o[e].content+o[e+1].content:(e!==n&&(o[n]=o[e]),n++);e!==n&&(o.length=n)}}const Bu=[["normalize",x6],["block",k6],["inline",w6],["linkify",S6],["replacements",N6],["smartquotes",P6],["text_join",L6]];function Ed(){this.ruler=new lt;for(let t=0;t<Bu.length;t++)this.ruler.push(Bu[t][0],Bu[t][1])}Ed.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)};Ed.prototype.State=N1;function Yt(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const i=this.src;for(let s=0,o=0,a=0,u=0,l=i.length,c=!1;o<l;o++){const d=i.charCodeAt(o);if(!c)if(ae(d)){a++,d===9?u+=4-u%4:u++;continue}else c=!0;(d===10||o===l-1)&&(d!==10&&o++,this.bMarks.push(s),this.eMarks.push(o),this.tShift.push(a),this.sCount.push(u),this.bsCount.push(0),c=!1,a=0,u=0,s=o+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}Yt.prototype.push=function(t,e,n){const r=new Ft(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r};Yt.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Yt.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};Yt.prototype.skipSpaces=function(e){for(let n=this.src.length;e<n;e++){const r=this.src.charCodeAt(e);if(!ae(r))break}return e};Yt.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!ae(this.src.charCodeAt(--e)))return e+1;return e};Yt.prototype.skipChars=function(e,n){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e};Yt.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e};Yt.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const s=new Array(n-e);for(let o=0,a=e;a<n;a++,o++){let u=0;const l=this.bMarks[a];let c=l,d;for(a+1<n||i?d=this.eMarks[a]+1:d=this.eMarks[a];c<d&&u<r;){const h=this.src.charCodeAt(c);if(ae(h))h===9?u+=4-(u+this.bsCount[a])%4:u++;else if(c-l<this.tShift[a])u++;else break;c++}u>r?s[o]=new Array(u-r+1).join(" ")+this.src.slice(c,d):s[o]=this.src.slice(c,d)}return s.join("")};Yt.prototype.Token=Ft;const B6=65536;function $u(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function gp(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),s=!1,o=0,a="";for(;r<n;)i===124&&(s?(a+=t.substring(o,r-1),o=r):(e.push(a+t.substring(o,r)),a="",o=r+1)),s=i===92,r++,i=t.charCodeAt(r);return e.push(a+t.substring(o)),e}function $6(t,e,n,r){if(e+2>n)return!1;let i=e+1;if(t.sCount[i]<t.blkIndent||t.sCount[i]-t.blkIndent>=4)return!1;let s=t.bMarks[i]+t.tShift[i];if(s>=t.eMarks[i])return!1;const o=t.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=t.eMarks[i])return!1;const a=t.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!ae(a)||o===45&&ae(a))return!1;for(;s<t.eMarks[i];){const x=t.src.charCodeAt(s);if(x!==124&&x!==45&&x!==58&&!ae(x))return!1;s++}let u=$u(t,e+1),l=u.split("|");const c=[];for(let x=0;x<l.length;x++){const y=l[x].trim();if(!y){if(x===0||x===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(y))return!1;y.charCodeAt(y.length-1)===58?c.push(y.charCodeAt(0)===58?"center":"right"):y.charCodeAt(0)===58?c.push("left"):c.push("")}if(u=$u(t,e).trim(),u.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;l=gp(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();const d=l.length;if(d===0||d!==c.length)return!1;if(r)return!0;const h=t.parentType;t.parentType="table";const f=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),m=[e,0];p.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const b=t.push("tr_open","tr",1);b.map=[e,e+1];for(let x=0;x<l.length;x++){const y=t.push("th_open","th",1);c[x]&&(y.attrs=[["style","text-align:"+c[x]]]);const w=t.push("inline","",0);w.content=l[x].trim(),w.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let v,_=0;for(i=e+2;i<n&&!(t.sCount[i]<t.blkIndent);i++){let x=!1;for(let w=0,C=f.length;w<C;w++)if(f[w](t,i,n,!0)){x=!0;break}if(x||(u=$u(t,i).trim(),!u)||t.sCount[i]-t.blkIndent>=4||(l=gp(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),_+=d-l.length,_>B6))break;if(i===e+2){const w=t.push("tbody_open","tbody",1);w.map=v=[e+2,0]}const y=t.push("tr_open","tr",1);y.map=[i,i+1];for(let w=0;w<d;w++){const C=t.push("td_open","td",1);c[w]&&(C.attrs=[["style","text-align:"+c[w]]]);const k=t.push("inline","",0);k.content=l[w]?l[w].trim():"",k.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return v&&(t.push("tbody_close","tbody",-1),v[1]=i),t.push("table_close","table",-1),m[1]=i,t.parentType=h,t.line=i,!0}function z6(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,i=r;for(;r<n;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,i=r;continue}break}t.line=i;const s=t.push("code_block","code",0);return s.content=t.getLines(e,i,4+t.blkIndent,!1)+`
|
|
105
|
-
`,s.map=[e,t.line],!0}function H6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>s)return!1;const o=t.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let a=i;i=t.skipChars(i,o);let u=i-a;if(u<3)return!1;const l=t.src.slice(a,i),c=t.src.slice(i,s);if(o===96&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=e,h=!1;for(;d++,!(d>=n||(i=a=t.bMarks[d]+t.tShift[d],s=t.eMarks[d],i<s&&t.sCount[d]<t.blkIndent));)if(t.src.charCodeAt(i)===o&&!(t.sCount[d]-t.blkIndent>=4)&&(i=t.skipChars(i,o),!(i-a<u)&&(i=t.skipSpaces(i),!(i<s)))){h=!0;break}u=t.sCount[e],t.line=d+(h?1:0);const f=t.push("fence","code",0);return f.info=c,f.content=t.getLines(e+1,d,u,!0),f.markup=l,f.map=[e,t.line],!0}function j6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];const o=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const a=[],u=[],l=[],c=[],d=t.md.block.ruler.getRules("blockquote"),h=t.parentType;t.parentType="blockquote";let f=!1,p;for(p=e;p<n;p++){const _=t.sCount[p]<t.blkIndent;if(i=t.bMarks[p]+t.tShift[p],s=t.eMarks[p],i>=s)break;if(t.src.charCodeAt(i++)===62&&!_){let y=t.sCount[p]+1,w,C;t.src.charCodeAt(i)===32?(i++,y++,C=!1,w=!0):t.src.charCodeAt(i)===9?(w=!0,(t.bsCount[p]+y)%4===3?(i++,y++,C=!1):C=!0):w=!1;let k=y;for(a.push(t.bMarks[p]),t.bMarks[p]=i;i<s;){const S=t.src.charCodeAt(i);if(ae(S))S===9?k+=4-(k+t.bsCount[p]+(C?1:0))%4:k++;else break;i++}f=i>=s,u.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(w?1:0),l.push(t.sCount[p]),t.sCount[p]=k-y,c.push(t.tShift[p]),t.tShift[p]=i-t.bMarks[p];continue}if(f)break;let x=!1;for(let y=0,w=d.length;y<w;y++)if(d[y](t,p,n,!0)){x=!0;break}if(x){t.lineMax=p,t.blkIndent!==0&&(a.push(t.bMarks[p]),u.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]-=t.blkIndent);break}a.push(t.bMarks[p]),u.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const b=[e,0];g.map=b,t.md.block.tokenize(t,e,p);const v=t.push("blockquote_close","blockquote",-1);v.markup=">",t.lineMax=o,t.parentType=h,b[1]=t.line;for(let _=0;_<c.length;_++)t.bMarks[_+e]=a[_],t.tShift[_+e]=c[_],t.sCount[_+e]=l[_],t.bsCount[_+e]=u[_];return t.blkIndent=m,!0}function V6(t,e,n,r){const i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.bMarks[e]+t.tShift[e];const o=t.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;s<i;){const l=t.src.charCodeAt(s++);if(l!==o&&!ae(l))return!1;l===o&&a++}if(a<3)return!1;if(r)return!0;t.line=e+1;const u=t.push("hr","hr",0);return u.map=[e,t.line],u.markup=Array(a+1).join(String.fromCharCode(o)),!0}function bp(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(r++);if(i!==42&&i!==45&&i!==43)return-1;if(r<n){const s=t.src.charCodeAt(r);if(!ae(s))return-1}return r}function vp(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let i=n;if(i+1>=r)return-1;let s=t.src.charCodeAt(i++);if(s<48||s>57)return-1;for(;;){if(i>=r)return-1;if(s=t.src.charCodeAt(i++),s>=48&&s<=57){if(i-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return i<r&&(s=t.src.charCodeAt(i),!ae(s))?-1:i}function q6(t,e){const n=t.level+2;for(let r=e+2,i=t.tokens.length-2;r<i;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function W6(t,e,n,r){let i,s,o,a,u=e,l=!0;if(t.sCount[u]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[u]-t.listIndent>=4&&t.sCount[u]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[u]>=t.blkIndent&&(c=!0);let d,h,f;if((f=vp(t,u))>=0){if(d=!0,o=t.bMarks[u]+t.tShift[u],h=Number(t.src.slice(o,f-1)),c&&h!==1)return!1}else if((f=bp(t,u))>=0)d=!1;else return!1;if(c&&t.skipSpaces(f)>=t.eMarks[u])return!1;if(r)return!0;const p=t.src.charCodeAt(f-1),m=t.tokens.length;d?(a=t.push("ordered_list_open","ol",1),h!==1&&(a.attrs=[["start",h]])):a=t.push("bullet_list_open","ul",1);const g=[u,0];a.map=g,a.markup=String.fromCharCode(p);let b=!1;const v=t.md.block.ruler.getRules("list"),_=t.parentType;for(t.parentType="list";u<n;){s=f,i=t.eMarks[u];const x=t.sCount[u]+f-(t.bMarks[u]+t.tShift[u]);let y=x;for(;s<i;){const X=t.src.charCodeAt(s);if(X===9)y+=4-(y+t.bsCount[u])%4;else if(X===32)y++;else break;s++}const w=s;let C;w>=i?C=1:C=y-x,C>4&&(C=1);const k=x+C;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const S=[u,0];a.map=S,d&&(a.info=t.src.slice(o,f-1));const D=t.tight,F=t.tShift[u],L=t.sCount[u],j=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=k,t.tight=!0,t.tShift[u]=w-t.bMarks[u],t.sCount[u]=y,w>=i&&t.isEmpty(u+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,u,n,!0),(!t.tight||b)&&(l=!1),b=t.line-u>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=j,t.tShift[u]=F,t.sCount[u]=L,t.tight=D,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),u=t.line,S[1]=u,u>=n||t.sCount[u]<t.blkIndent||t.sCount[u]-t.blkIndent>=4)break;let W=!1;for(let X=0,ne=v.length;X<ne;X++)if(v[X](t,u,n,!0)){W=!0;break}if(W)break;if(d){if(f=vp(t,u),f<0)break;o=t.bMarks[u]+t.tShift[u]}else if(f=bp(t,u),f<0)break;if(p!==t.src.charCodeAt(f-1))break}return d?a=t.push("ordered_list_close","ol",-1):a=t.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),g[1]=u,t.line=u,t.parentType=_,l&&q6(t,m),!0}function U6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],o=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==91)return!1;function a(v){const _=t.lineMax;if(v>=_||t.isEmpty(v))return null;let x=!1;if(t.sCount[v]-t.blkIndent>3&&(x=!0),t.sCount[v]<0&&(x=!0),!x){const C=t.md.block.ruler.getRules("reference"),k=t.parentType;t.parentType="reference";let S=!1;for(let D=0,F=C.length;D<F;D++)if(C[D](t,v,_,!0)){S=!0;break}if(t.parentType=k,S)return null}const y=t.bMarks[v]+t.tShift[v],w=t.eMarks[v];return t.src.slice(y,w+1)}let u=t.src.slice(i,s+1);s=u.length;let l=-1;for(i=1;i<s;i++){const v=u.charCodeAt(i);if(v===91)return!1;if(v===93){l=i;break}else if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(v===92&&(i++,i<s&&u.charCodeAt(i)===10)){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}}if(l<0||u.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<s;i++){const v=u.charCodeAt(i);if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(!ae(v))break}const c=t.md.helpers.parseLinkDestination(u,i,s);if(!c.ok)return!1;const d=t.md.normalizeLink(c.str);if(!t.md.validateLink(d))return!1;i=c.pos;const h=i,f=o,p=i;for(;i<s;i++){const v=u.charCodeAt(i);if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(!ae(v))break}let m=t.md.helpers.parseLinkTitle(u,i,s);for(;m.can_continue;){const v=a(o);if(v===null)break;u+=v,i=s,s=u.length,o++,m=t.md.helpers.parseLinkTitle(u,i,s,m)}let g;for(i<s&&p!==i&&m.ok?(g=m.str,i=m.pos):(g="",i=h,o=f);i<s;){const v=u.charCodeAt(i);if(!ae(v))break;i++}if(i<s&&u.charCodeAt(i)!==10&&g)for(g="",i=h,o=f;i<s;){const v=u.charCodeAt(i);if(!ae(v))break;i++}if(i<s&&u.charCodeAt(i)!==10)return!1;const b=Ha(u.slice(1,l));return b?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[b]>"u"&&(t.env.references[b]={title:g,href:d}),t.line=o),!0):!1}const K6=["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"],J6="[a-zA-Z_:][a-zA-Z0-9:._-]*",G6="[^\"'=<>`\\x00-\\x20]+",Y6="'[^']*'",Z6='"[^"]*"',X6="(?:"+G6+"|"+Y6+"|"+Z6+")",Q6="(?:\\s+"+J6+"(?:\\s*=\\s*"+X6+")?)",I1="<[A-Za-z][A-Za-z0-9\\-]*"+Q6+"*\\s*\\/?>",P1="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",e4="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",t4="<[?][\\s\\S]*?[?]>",n4="<![A-Za-z][^>]*>",r4="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",i4=new RegExp("^(?:"+I1+"|"+P1+"|"+e4+"|"+t4+"|"+n4+"|"+r4+")"),s4=new RegExp("^(?:"+I1+"|"+P1+")"),Dr=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+K6.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(s4.source+"\\s*$"),/^$/,!1]];function o4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let o=t.src.slice(i,s),a=0;for(;a<Dr.length&&!Dr[a][0].test(o);a++);if(a===Dr.length)return!1;if(r)return Dr[a][2];let u=e+1;if(!Dr[a][1].test(o)){for(;u<n&&!(t.sCount[u]<t.blkIndent);u++)if(i=t.bMarks[u]+t.tShift[u],s=t.eMarks[u],o=t.src.slice(i,s),Dr[a][1].test(o)){o.length!==0&&u++;break}}t.line=u;const l=t.push("html_block","",0);return l.map=[e,u],l.content=t.getLines(e,u,t.blkIndent,!0),!0}function a4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.src.charCodeAt(i);if(o!==35||i>=s)return!1;let a=1;for(o=t.src.charCodeAt(++i);o===35&&i<s&&a<=6;)a++,o=t.src.charCodeAt(++i);if(a>6||i<s&&!ae(o))return!1;if(r)return!0;s=t.skipSpacesBack(s,i);const u=t.skipCharsBack(s,35,i);u>i&&ae(t.src.charCodeAt(u-1))&&(s=u),t.line=e+1;const l=t.push("heading_open","h"+String(a),1);l.markup="########".slice(0,a),l.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(i,s).trim(),c.map=[e,t.line],c.children=[];const d=t.push("heading_close","h"+String(a),-1);return d.markup="########".slice(0,a),!0}function u4(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let s=0,o,a=e+1;for(;a<n&&!t.isEmpty(a);a++){if(t.sCount[a]-t.blkIndent>3)continue;if(t.sCount[a]>=t.blkIndent){let f=t.bMarks[a]+t.tShift[a];const p=t.eMarks[a];if(f<p&&(o=t.src.charCodeAt(f),(o===45||o===61)&&(f=t.skipChars(f,o),f=t.skipSpaces(f),f>=p))){s=o===61?1:2;break}}if(t.sCount[a]<0)continue;let h=!1;for(let f=0,p=r.length;f<p;f++)if(r[f](t,a,n,!0)){h=!0;break}if(h)break}if(!s)return!1;const u=t.getLines(e,a,t.blkIndent,!1).trim();t.line=a+1;const l=t.push("heading_open","h"+String(s),1);l.markup=String.fromCharCode(o),l.map=[e,t.line];const c=t.push("inline","",0);c.content=u,c.map=[e,t.line-1],c.children=[];const d=t.push("heading_close","h"+String(s),-1);return d.markup=String.fromCharCode(o),t.parentType=i,!0}function l4(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),i=t.parentType;let s=e+1;for(t.parentType="paragraph";s<n&&!t.isEmpty(s);s++){if(t.sCount[s]-t.blkIndent>3||t.sCount[s]<0)continue;let l=!1;for(let c=0,d=r.length;c<d;c++)if(r[c](t,s,n,!0)){l=!0;break}if(l)break}const o=t.getLines(e,s,t.blkIndent,!1).trim();t.line=s;const a=t.push("paragraph_open","p",1);a.map=[e,t.line];const u=t.push("inline","",0);return u.content=o,u.map=[e,t.line],u.children=[],t.push("paragraph_close","p",-1),t.parentType=i,!0}const $s=[["table",$6,["paragraph","reference"]],["code",z6],["fence",H6,["paragraph","reference","blockquote","list"]],["blockquote",j6,["paragraph","reference","blockquote","list"]],["hr",V6,["paragraph","reference","blockquote","list"]],["list",W6,["paragraph","reference","blockquote"]],["reference",U6],["html_block",o4,["paragraph","reference","blockquote"]],["heading",a4,["paragraph","reference","blockquote"]],["lheading",u4],["paragraph",l4]];function ja(){this.ruler=new lt;for(let t=0;t<$s.length;t++)this.ruler.push($s[t][0],$s[t][1],{alt:($s[t][2]||[]).slice()})}ja.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),i=r.length,s=t.md.options.maxNesting;let o=e,a=!1;for(;o<n&&(t.line=o=t.skipEmptyLines(o),!(o>=n||t.sCount[o]<t.blkIndent));){if(t.level>=s){t.line=n;break}const u=t.line;let l=!1;for(let c=0;c<i;c++)if(l=r[c](t,o,n,!1),l){if(u>=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),o=t.line,o<n&&t.isEmpty(o)&&(a=!0,o++,t.line=o)}};ja.prototype.parse=function(t,e,n,r){if(!t)return;const i=new this.State(t,e,n,r);this.tokenize(i,i.line,i.lineMax)};ja.prototype.State=Yt;function ys(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}ys.prototype.pushPending=function(){const t=new Ft("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};ys.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new Ft(t,e,n);let i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};ys.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let s=t;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const o=s-t,a=s<n?this.src.charCodeAt(s):32,u=ls(i)||us(String.fromCharCode(i)),l=ls(a)||us(String.fromCharCode(a)),c=as(i),d=as(a),h=!d&&(!l||c||u),f=!c&&(!u||d||l);return{can_open:h&&(e||!f||u),can_close:f&&(e||!h||l),length:o}};ys.prototype.Token=Ft;function c4(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function d4(t,e){let n=t.pos;for(;n<t.posMax&&!c4(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const h4=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function f4(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(h4);if(!i)return!1;const s=i[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let a=o.url;if(a.length<=s.length)return!1;let u=a.length;for(;u>0&&a.charCodeAt(u-1)===42;)u--;u!==a.length&&(a=a.slice(0,u));const l=t.md.normalizeLink(a);if(!t.md.validateLink(l))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const c=t.push("link_open","a",1);c.attrs=[["href",l]],c.markup="linkify",c.info="auto";const d=t.push("text","",0);d.content=t.md.normalizeLinkText(a);const h=t.push("link_close","a",-1);h.markup="linkify",h.info="auto"}return t.pos+=a.length-s.length,!0}function p4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&t.pending.charCodeAt(s-1)===32;)s--;t.pending=t.pending.slice(0,s),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(n++;n<i&&ae(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const Sd=[];for(let t=0;t<256;t++)Sd.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Sd[t.charCodeAt(0)]=1});function m4(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(i=t.src.charCodeAt(n),!!ae(i));)n++;return t.pos=n,!0}let s=t.src[n];if(i>=55296&&i<=56319&&n+1<r){const a=t.src.charCodeAt(n+1);a>=56320&&a<=57343&&(s+=t.src[n+1],n++)}const o="\\"+s;if(!e){const a=t.push("text_special","",0);i<256&&Sd[i]!==0?a.content=s:a.content=o,a.markup=o,a.info="escape"}return t.pos=n+1,!0}function g4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const s=t.posMax;for(;n<s&&t.src.charCodeAt(n)===96;)n++;const o=t.src.slice(i,n),a=o.length;if(t.backticksScanned&&(t.backticks[a]||0)<=i)return e||(t.pending+=o),t.pos+=a,!0;let u=n,l;for(;(l=t.src.indexOf("`",u))!==-1;){for(u=l+1;u<s&&t.src.charCodeAt(u)===96;)u++;const c=u-l;if(c===a){if(!e){const d=t.push("code_inline","code",0);d.markup=o,d.content=t.src.slice(n,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=u,!0}t.backticks[c]=l}return t.backticksScanned=!0,e||(t.pending+=o),t.pos+=a,!0}function b4(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const i=t.scanDelims(t.pos,!0);let s=i.length;const o=String.fromCharCode(r);if(s<2)return!1;let a;s%2&&(a=t.push("text","",0),a.content=o,s--);for(let u=0;u<s;u+=2)a=t.push("text","",0),a.content=o+o,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return t.pos+=i.length,!0}function yp(t,e){let n;const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(o.marker!==126||o.end===-1)continue;const a=e[o.end];n=t.tokens[o.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[a.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[a.token-1].type==="text"&&t.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const s=r.pop();let o=s+1;for(;o<t.tokens.length&&t.tokens[o].type==="s_close";)o++;o--,s!==o&&(n=t.tokens[o],t.tokens[o]=t.tokens[s],t.tokens[s]=n)}}function v4(t){const e=t.tokens_meta,n=t.tokens_meta.length;yp(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&yp(t,e[r].delimiters)}const L1={tokenize:b4,postProcess:v4};function y4(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const i=t.scanDelims(t.pos,r===42);for(let s=0;s<i.length;s++){const o=t.push("text","",0);o.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:i.length,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return t.pos+=i.length,!0}function _p(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const s=e[i.end],o=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===s.token+1,a=String.fromCharCode(i.marker),u=t.tokens[i.token];u.type=o?"strong_open":"em_open",u.tag=o?"strong":"em",u.nesting=1,u.markup=o?a+a:a,u.content="";const l=t.tokens[s.token];l.type=o?"strong_close":"em_close",l.tag=o?"strong":"em",l.nesting=-1,l.markup=o?a+a:a,l.content="",o&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function _4(t){const e=t.tokens_meta,n=t.tokens_meta.length;_p(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&_p(t,e[r].delimiters)}const B1={tokenize:y4,postProcess:_4};function x4(t,e){let n,r,i,s,o="",a="",u=t.pos,l=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,d=t.posMax,h=t.pos+1,f=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(f<0)return!1;let p=f+1;if(p<d&&t.src.charCodeAt(p)===40){for(l=!1,p++;p<d&&(n=t.src.charCodeAt(p),!(!ae(n)&&n!==10));p++);if(p>=d)return!1;if(u=p,i=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),i.ok){for(o=t.md.normalizeLink(i.str),t.md.validateLink(o)?p=i.pos:o="",u=p;p<d&&(n=t.src.charCodeAt(p),!(!ae(n)&&n!==10));p++);if(i=t.md.helpers.parseLinkTitle(t.src,p,t.posMax),p<d&&u!==p&&i.ok)for(a=i.str,p=i.pos;p<d&&(n=t.src.charCodeAt(p),!(!ae(n)&&n!==10));p++);}(p>=d||t.src.charCodeAt(p)!==41)&&(l=!0),p++}if(l){if(typeof t.env.references>"u")return!1;if(p<d&&t.src.charCodeAt(p)===91?(u=p+1,p=t.md.helpers.parseLinkLabel(t,p),p>=0?r=t.src.slice(u,p++):p=f+1):p=f+1,r||(r=t.src.slice(h,f)),s=t.env.references[Ha(r)],!s)return t.pos=c,!1;o=s.href,a=s.title}if(!e){t.pos=h,t.posMax=f;const m=t.push("link_open","a",1),g=[["href",o]];m.attrs=g,a&&g.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=d,!0}function k4(t,e){let n,r,i,s,o,a,u,l,c="";const d=t.pos,h=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const f=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(s=p+1,s<h&&t.src.charCodeAt(s)===40){for(s++;s<h&&(n=t.src.charCodeAt(s),!(!ae(n)&&n!==10));s++);if(s>=h)return!1;for(l=s,a=t.md.helpers.parseLinkDestination(t.src,s,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?s=a.pos:c=""),l=s;s<h&&(n=t.src.charCodeAt(s),!(!ae(n)&&n!==10));s++);if(a=t.md.helpers.parseLinkTitle(t.src,s,t.posMax),s<h&&l!==s&&a.ok)for(u=a.str,s=a.pos;s<h&&(n=t.src.charCodeAt(s),!(!ae(n)&&n!==10));s++);else u="";if(s>=h||t.src.charCodeAt(s)!==41)return t.pos=d,!1;s++}else{if(typeof t.env.references>"u")return!1;if(s<h&&t.src.charCodeAt(s)===91?(l=s+1,s=t.md.helpers.parseLinkLabel(t,s),s>=0?i=t.src.slice(l,s++):s=p+1):s=p+1,i||(i=t.src.slice(f,p)),o=t.env.references[Ha(i)],!o)return t.pos=d,!1;c=o.href,u=o.title}if(!e){r=t.src.slice(f,p);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),b=[["src",c],["alt",""]];g.attrs=b,g.children=m,g.content=r,u&&b.push(["title",u])}return t.pos=s,t.posMax=h,!0}const w4=/^([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])?)*)$/,C4=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function E4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const o=t.src.charCodeAt(n);if(o===60)return!1;if(o===62)break}const s=t.src.slice(r+1,n);if(C4.test(s)){const o=t.md.normalizeLink(s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(s);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=s.length+2,!0}if(w4.test(s)){const o=t.md.normalizeLink("mailto:"+s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(s);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=s.length+2,!0}return!1}function S4(t){return/^<a[>\s]/i.test(t)}function M4(t){return/^<\/a\s*>/i.test(t)}function A4(t){const e=t|32;return e>=97&&e<=122}function T4(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!A4(i))return!1;const s=t.src.slice(r).match(i4);if(!s)return!1;if(!e){const o=t.push("html_inline","",0);o.content=s[0],S4(o.content)&&t.linkLevel++,M4(o.content)&&t.linkLevel--}return t.pos+=s[0].length,!0}const D4=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,O4=/^&([a-z][a-z0-9]{1,31});/i;function R4(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const s=t.src.slice(n).match(D4);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=t.push("text_special","",0);a.content=Cd(o)?qo(o):qo(65533),a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}else{const s=t.src.slice(n).match(O4);if(s){const o=D1(s[0]);if(o!==s[0]){if(!e){const a=t.push("text_special","",0);a.content=o,a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}}return!1}function xp(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const s=[];for(let o=0;o<n;o++){const a=t[o];if(s.push(0),(t[r].marker!==a.marker||i!==a.token-1)&&(r=o),i=a.token,a.length=a.length||0,!a.close)continue;e.hasOwnProperty(a.marker)||(e[a.marker]=[-1,-1,-1,-1,-1,-1]);const u=e[a.marker][(a.open?3:0)+a.length%3];let l=r-s[r]-1,c=l;for(;l>u;l-=s[l]+1){const d=t[l];if(d.marker===a.marker&&d.open&&d.end<0){let h=!1;if((d.close||a.open)&&(d.length+a.length)%3===0&&(d.length%3!==0||a.length%3!==0)&&(h=!0),!h){const f=l>0&&!t[l-1].open?s[l-1]+1:0;s[o]=o-l+f,s[l]=f,a.open=!1,d.end=o,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function N4(t){const e=t.tokens_meta,n=t.tokens_meta.length;xp(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&xp(e[r].delimiters)}function F4(t){let e,n,r=0;const i=t.tokens,s=t.tokens.length;for(e=n=0;e<s;e++)i[e].nesting<0&&r--,i[e].level=r,i[e].nesting>0&&r++,i[e].type==="text"&&e+1<s&&i[e+1].type==="text"?i[e+1].content=i[e].content+i[e+1].content:(e!==n&&(i[n]=i[e]),n++);e!==n&&(i.length=n)}const zu=[["text",d4],["linkify",f4],["newline",p4],["escape",m4],["backticks",g4],["strikethrough",L1.tokenize],["emphasis",B1.tokenize],["link",x4],["image",k4],["autolink",E4],["html_inline",T4],["entity",R4]],Hu=[["balance_pairs",N4],["strikethrough",L1.postProcess],["emphasis",B1.postProcess],["fragments_join",F4]];function _s(){this.ruler=new lt;for(let t=0;t<zu.length;t++)this.ruler.push(zu[t][0],zu[t][1]);this.ruler2=new lt;for(let t=0;t<Hu.length;t++)this.ruler2.push(Hu[t][0],Hu[t][1])}_s.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,i=t.md.options.maxNesting,s=t.cache;if(typeof s[e]<"u"){t.pos=s[e];return}let o=!1;if(t.level<i){for(let a=0;a<r;a++)if(t.level++,o=n[a](t,!0),t.level--,o){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;o||t.pos++,s[e]=t.pos};_s.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos<r;){const s=t.pos;let o=!1;if(t.level<i){for(let a=0;a<n;a++)if(o=e[a](t,!1),o){if(s>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};_s.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let a=0;a<o;a++)s[a](i)};_s.prototype.State=ys;function I4(t){const e={};t=t||{},e.src_Any=E1.source,e.src_Cc=S1.source,e.src_Z=A1.source,e.src_P=kd.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function dc(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function Va(t){return Object.prototype.toString.call(t)}function P4(t){return Va(t)==="[object String]"}function L4(t){return Va(t)==="[object Object]"}function B4(t){return Va(t)==="[object RegExp]"}function kp(t){return Va(t)==="[object Function]"}function $4(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const $1={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function z4(t){return Object.keys(t||{}).reduce(function(e,n){return e||$1.hasOwnProperty(n)},!1)}const H4={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},j4="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]",V4="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function q4(t){t.__index__=-1,t.__text_cache__=""}function W4(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function wp(){return function(t,e){e.normalize(t)}}function Wo(t){const e=t.re=I4(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(j4),n.push(e.src_xn),e.src_tlds=n.join("|");function r(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function s(a,u){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+u)}Object.keys(t.__schemas__).forEach(function(a){const u=t.__schemas__[a];if(u===null)return;const l={validate:null,link:null};if(t.__compiled__[a]=l,L4(u)){B4(u.validate)?l.validate=W4(u.validate):kp(u.validate)?l.validate=u.validate:s(a,u),kp(u.normalize)?l.normalize=u.normalize:u.normalize?s(a,u):l.normalize=wp();return}if(P4(u)){i.push(a);return}s(a,u)}),i.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:wp()};const o=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map($4).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","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"),q4(t)}function U4(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function hc(t,e){const n=new U4(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function gt(t,e){if(!(this instanceof gt))return new gt(t,e);e||z4(t)&&(e=t,t={}),this.__opts__=dc({},$1,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=dc({},H4,t),this.__compiled__={},this.__tlds__=V4,this.__tlds_replaced__=!1,this.re={},Wo(this)}gt.prototype.add=function(e,n){return this.__schemas__[e]=n,Wo(this),this};gt.prototype.set=function(e){return this.__opts__=dc(this.__opts__,e),this};gt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,s,o,a,u,l,c;if(this.re.schema_test.test(e)){for(u=this.re.schema_search,u.lastIndex=0;(n=u.exec(e))!==null;)if(s=this.testSchemaAt(e,n[2],u.lastIndex),s){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=r.index+r[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(i=e.match(this.re.email_fuzzy))!==null&&(o=i.index+i[1].length,a=i.index+i[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=a))),this.__index__>=0};gt.prototype.pretest=function(e){return this.re.pretest.test(e)};gt.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};gt.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(hc(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(hc(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};gt.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,hc(this,0)):null};gt.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,s){return r!==s[i-1]}).reverse(),Wo(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Wo(this),this)};gt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};gt.prototype.onCompile=function(){};const Kr=2147483647,Wt=36,Md=1,cs=26,K4=38,J4=700,z1=72,H1=128,j1="-",G4=/^xn--/,Y4=/[^\0-\x7F]/,Z4=/[\x2E\u3002\uFF0E\uFF61]/g,X4={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},ju=Wt-Md,Ut=Math.floor,Vu=String.fromCharCode;function Sn(t){throw new RangeError(X4[t])}function Q4(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function V1(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(Z4,".");const i=t.split("."),s=Q4(i,e).join(".");return r+s}function q1(t){const e=[];let n=0;const r=t.length;for(;n<r;){const i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const s=t.charCodeAt(n++);(s&64512)==56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e}const eC=t=>String.fromCodePoint(...t),tC=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Wt},Cp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},W1=function(t,e,n){let r=0;for(t=n?Ut(t/J4):t>>1,t+=Ut(t/e);t>ju*cs>>1;r+=Wt)t=Ut(t/ju);return Ut(r+(ju+1)*t/(t+K4))},U1=function(t){const e=[],n=t.length;let r=0,i=H1,s=z1,o=t.lastIndexOf(j1);o<0&&(o=0);for(let a=0;a<o;++a)t.charCodeAt(a)>=128&&Sn("not-basic"),e.push(t.charCodeAt(a));for(let a=o>0?o+1:0;a<n;){const u=r;for(let c=1,d=Wt;;d+=Wt){a>=n&&Sn("invalid-input");const h=tC(t.charCodeAt(a++));h>=Wt&&Sn("invalid-input"),h>Ut((Kr-r)/c)&&Sn("overflow"),r+=h*c;const f=d<=s?Md:d>=s+cs?cs:d-s;if(h<f)break;const p=Wt-f;c>Ut(Kr/p)&&Sn("overflow"),c*=p}const l=e.length+1;s=W1(r-u,l,u==0),Ut(r/l)>Kr-i&&Sn("overflow"),i+=Ut(r/l),r%=l,e.splice(r++,0,i)}return String.fromCodePoint(...e)},K1=function(t){const e=[];t=q1(t);const n=t.length;let r=H1,i=0,s=z1;for(const u of t)u<128&&e.push(Vu(u));const o=e.length;let a=o;for(o&&e.push(j1);a<n;){let u=Kr;for(const c of t)c>=r&&c<u&&(u=c);const l=a+1;u-r>Ut((Kr-i)/l)&&Sn("overflow"),i+=(u-r)*l,r=u;for(const c of t)if(c<r&&++i>Kr&&Sn("overflow"),c===r){let d=i;for(let h=Wt;;h+=Wt){const f=h<=s?Md:h>=s+cs?cs:h-s;if(d<f)break;const p=d-f,m=Wt-f;e.push(Vu(Cp(f+p%m,0))),d=Ut(p/m)}e.push(Vu(Cp(d,0))),s=W1(i,l,a===o),i=0,++a}++i,++r}return e.join("")},nC=function(t){return V1(t,function(e){return G4.test(e)?U1(e.slice(4).toLowerCase()):e})},rC=function(t){return V1(t,function(e){return Y4.test(e)?"xn--"+K1(e):e})},J1={version:"2.3.1",ucs2:{decode:q1,encode:eC},decode:U1,encode:K1,toASCII:rC,toUnicode:nC},iC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},sC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},oC={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},aC={default:iC,zero:sC,commonmark:oC},uC=/^(vbscript|javascript|file|data):/,lC=/^data:image\/(gif|png|jpeg|webp);/;function cC(t){const e=t.trim().toLowerCase();return uC.test(e)?lC.test(e):!0}const G1=["http:","https:","mailto:"];function dC(t){const e=xd(t,!0);if(e.hostname&&(!e.protocol||G1.indexOf(e.protocol)>=0))try{e.hostname=J1.toASCII(e.hostname)}catch{}return vs(_d(e))}function hC(t){const e=xd(t,!0);if(e.hostname&&(!e.protocol||G1.indexOf(e.protocol)>=0))try{e.hostname=J1.toUnicode(e.hostname)}catch{}return ii(_d(e),ii.defaultChars+"%")}function ct(t,e){if(!(this instanceof ct))return new ct(t,e);e||wd(t)||(e=t||{},t="default"),this.inline=new _s,this.block=new ja,this.core=new Ed,this.renderer=new ai,this.linkify=new gt,this.validateLink=cC,this.normalizeLink=dC,this.normalizeLinkText=hC,this.utils=p6,this.helpers=za({},v6),this.options={},this.configure(t),e&&this.set(e)}ct.prototype.set=function(t){return za(this.options,t),this};ct.prototype.configure=function(t){const e=this;if(wd(t)){const n=t;if(t=aC[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", 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(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};ct.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};ct.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};ct.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};ct.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};ct.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};ct.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};ct.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const fC=new Jc({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:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function pC(t,e){if(t.isText&&e.isText&&re.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class mC{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:re.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 n=this.top(),r=n.content,i=r[r.length-1],s=this.schema.text(e,n.marks),o;i&&(o=pC(i,s))?r[r.length-1]=o:r.push(s)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],i=this.tokenHandlers[r.type];if(!i)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");i(this,r,e,n)}}addNode(e,n,r){let i=this.top(),s=e.createAndFill(n,r,i?i.marks:[]);return s?(this.push(s),s):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:re.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function bi(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function qu(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function Ep(t){return t[t.length-1]==`
|
|
106
|
-
`?t.slice(0,t.length-1):t}function
|
|
102
|
+
`:">",s};ui.prototype.renderInline=function(t,e,n){let r="";const i=this.rules;for(let s=0,o=t.length;s<o;s++){const a=t[s].type;typeof i[a]<"u"?r+=i[a](t,s,e,n,this):r+=this.renderToken(t,s,e)}return r};ui.prototype.renderInlineAsText=function(t,e,n){let r="";for(let i=0,s=t.length;i<s;i++)switch(t[i].type){case"text":r+=t[i].content;break;case"image":r+=this.renderInlineAsText(t[i].children,e,n);break;case"html_inline":case"html_block":r+=t[i].content;break;case"softbreak":case"hardbreak":r+=`
|
|
103
|
+
`;break}return r};ui.prototype.render=function(t,e,n){let r="";const i=this.rules;for(let s=0,o=t.length;s<o;s++){const a=t[s].type;a==="inline"?r+=this.renderInline(t[s].children,e,n):typeof i[a]<"u"?r+=i[a](t,s,e,n,this):r+=this.renderToken(t,s,e,n)}return r};function lt(){this.__rules__=[],this.__cache__=null}lt.prototype.__find__=function(t){for(let e=0;e<this.__rules__.length;e++)if(this.__rules__[e].name===t)return e;return-1};lt.prototype.__compile__=function(){const t=this,e=[""];t.__rules__.forEach(function(n){n.enabled&&n.alt.forEach(function(r){e.indexOf(r)<0&&e.push(r)})}),t.__cache__={},e.forEach(function(n){t.__cache__[n]=[],t.__rules__.forEach(function(r){r.enabled&&(n&&r.alt.indexOf(n)<0||t.__cache__[n].push(r.fn))})})};lt.prototype.at=function(t,e,n){const r=this.__find__(t),i=n||{};if(r===-1)throw new Error("Parser rule not found: "+t);this.__rules__[r].fn=e,this.__rules__[r].alt=i.alt||[],this.__cache__=null};lt.prototype.before=function(t,e,n,r){const i=this.__find__(t),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i,0,{name:e,enabled:!0,fn:n,alt:s.alt||[]}),this.__cache__=null};lt.prototype.after=function(t,e,n,r){const i=this.__find__(t),s=r||{};if(i===-1)throw new Error("Parser rule not found: "+t);this.__rules__.splice(i+1,0,{name:e,enabled:!0,fn:n,alt:s.alt||[]}),this.__cache__=null};lt.prototype.push=function(t,e,n){const r=n||{};this.__rules__.push({name:t,enabled:!0,fn:e,alt:r.alt||[]}),this.__cache__=null};lt.prototype.enable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!0,n.push(r)},this),this.__cache__=null,n};lt.prototype.enableOnly=function(t,e){Array.isArray(t)||(t=[t]),this.__rules__.forEach(function(n){n.enabled=!1}),this.enable(t,e)};lt.prototype.disable=function(t,e){Array.isArray(t)||(t=[t]);const n=[];return t.forEach(function(r){const i=this.__find__(r);if(i<0){if(e)return;throw new Error("Rules manager: invalid rule name "+r)}this.__rules__[i].enabled=!1,n.push(r)},this),this.__cache__=null,n};lt.prototype.getRules=function(t){return this.__cache__===null&&this.__compile__(),this.__cache__[t]||[]};function Ft(t,e,n){this.type=t,this.tag=e,this.attrs=null,this.map=null,this.nesting=n,this.level=0,this.children=null,this.content="",this.markup="",this.info="",this.meta=null,this.block=!1,this.hidden=!1}Ft.prototype.attrIndex=function(e){if(!this.attrs)return-1;const n=this.attrs;for(let r=0,i=n.length;r<i;r++)if(n[r][0]===e)return r;return-1};Ft.prototype.attrPush=function(e){this.attrs?this.attrs.push(e):this.attrs=[e]};Ft.prototype.attrSet=function(e,n){const r=this.attrIndex(e),i=[e,n];r<0?this.attrPush(i):this.attrs[r]=i};Ft.prototype.attrGet=function(e){const n=this.attrIndex(e);let r=null;return n>=0&&(r=this.attrs[n][1]),r};Ft.prototype.attrJoin=function(e,n){const r=this.attrIndex(e);r<0?this.attrPush([e,n]):this.attrs[r][1]=this.attrs[r][1]+" "+n};function L1(t,e,n){this.src=t,this.env=n,this.tokens=[],this.inlineMode=!1,this.md=e}L1.prototype.Token=Ft;const D6=/\r\n?|\n/g,O6=/\0/g;function R6(t){let e;e=t.src.replace(D6,`
|
|
104
|
+
`),e=e.replace(O6,"�"),t.src=e}function N6(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 F6(t){const e=t.tokens;for(let n=0,r=e.length;n<r;n++){const i=e[n];i.type==="inline"&&t.md.inline.parse(i.content,t.md,t.env,i.children)}}function I6(t){return/^<a[>\s]/i.test(t)}function P6(t){return/^<\/a\s*>/i.test(t)}function L6(t){const e=t.tokens;if(t.md.options.linkify)for(let n=0,r=e.length;n<r;n++){if(e[n].type!=="inline"||!t.md.linkify.pretest(e[n].content))continue;let i=e[n].children,s=0;for(let o=i.length-1;o>=0;o--){const a=i[o];if(a.type==="link_close"){for(o--;i[o].level!==a.level&&i[o].type!=="link_open";)o--;continue}if(a.type==="html_inline"&&(I6(a.content)&&s>0&&s--,P6(a.content)&&s++),!(s>0)&&a.type==="text"&&t.md.linkify.test(a.content)){const u=a.content;let l=t.md.linkify.match(u);const c=[];let d=a.level,h=0;l.length>0&&l[0].index===0&&o>0&&i[o-1].type==="text_special"&&(l=l.slice(1));for(let f=0;f<l.length;f++){const p=l[f].url,m=t.md.normalizeLink(p);if(!t.md.validateLink(m))continue;let g=l[f].text;l[f].schema?l[f].schema==="mailto:"&&!/^mailto:/i.test(g)?g=t.md.normalizeLinkText("mailto:"+g).replace(/^mailto:/,""):g=t.md.normalizeLinkText(g):g=t.md.normalizeLinkText("http://"+g).replace(/^http:\/\//,"");const b=l[f].index;if(b>h){const y=new t.Token("text","",0);y.content=u.slice(h,b),y.level=d,c.push(y)}const v=new t.Token("link_open","a",1);v.attrs=[["href",m]],v.level=d++,v.markup="linkify",v.info="auto",c.push(v);const _=new t.Token("text","",0);_.content=g,_.level=d,c.push(_);const x=new t.Token("link_close","a",-1);x.level=--d,x.markup="linkify",x.info="auto",c.push(x),h=l[f].lastIndex}if(h<u.length){const f=new t.Token("text","",0);f.content=u.slice(h),f.level=d,c.push(f)}e[n].children=i=I1(i,o,c)}}}}const B1=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,B6=/\((c|tm|r)\)/i,$6=/\((c|tm|r)\)/ig,z6={c:"©",r:"®",tm:"™"};function H6(t,e){return z6[e.toLowerCase()]}function j6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&(r.content=r.content.replace($6,H6)),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function V6(t){let e=0;for(let n=t.length-1;n>=0;n--){const r=t[n];r.type==="text"&&!e&&B1.test(r.content)&&(r.content=r.content.replace(/\+-/g,"±").replace(/\.{2,}/g,"…").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/mg,"$1—").replace(/(^|\s)--(?=\s|$)/mg,"$1–").replace(/(^|[^-\s])--(?=[^-\s]|$)/mg,"$1–")),r.type==="link_open"&&r.info==="auto"&&e--,r.type==="link_close"&&r.info==="auto"&&e++}}function q6(t){let e;if(t.md.options.typographer)for(e=t.tokens.length-1;e>=0;e--)t.tokens[e].type==="inline"&&(B6.test(t.tokens[e].content)&&j6(t.tokens[e].children),B1.test(t.tokens[e].content)&&V6(t.tokens[e].children))}const W6=/['"]/,bp=/['"]/g,vp="’";function $s(t,e,n){return t.slice(0,e)+n+t.slice(e+1)}function U6(t,e){let n;const r=[];for(let i=0;i<t.length;i++){const s=t[i],o=t[i].level;for(n=r.length-1;n>=0&&!(r[n].level<=o);n--);if(r.length=n+1,s.type!=="text")continue;let a=s.content,u=0,l=a.length;e:for(;u<l;){bp.lastIndex=u;const c=bp.exec(a);if(!c)break;let d=!0,h=!0;u=c.index+1;const f=c[0]==="'";let p=32;if(c.index-1>=0)p=a.charCodeAt(c.index-1);else for(n=i-1;n>=0&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n--)if(t[n].content){p=t[n].content.charCodeAt(t[n].content.length-1);break}let m=32;if(u<l)m=a.charCodeAt(u);else for(n=i+1;n<t.length&&!(t[n].type==="softbreak"||t[n].type==="hardbreak");n++)if(t[n].content){m=t[n].content.charCodeAt(0);break}const g=cs(p)||ls(String.fromCharCode(p)),b=cs(m)||ls(String.fromCharCode(m)),v=us(p),_=us(m);if(_?d=!1:b&&(v||g||(d=!1)),v?h=!1:g&&(_||b||(h=!1)),m===34&&c[0]==='"'&&p>=48&&p<=57&&(h=d=!1),d&&h&&(d=g,h=b),!d&&!h){f&&(s.content=$s(s.content,c.index,vp));continue}if(h)for(n=r.length-1;n>=0;n--){let x=r[n];if(r[n].level<o)break;if(x.single===f&&r[n].level===o){x=r[n];let y,w;f?(y=e.md.options.quotes[2],w=e.md.options.quotes[3]):(y=e.md.options.quotes[0],w=e.md.options.quotes[1]),s.content=$s(s.content,c.index,w),t[x.token].content=$s(t[x.token].content,x.pos,y),u+=w.length-1,x.token===i&&(u+=y.length-1),a=s.content,l=a.length,r.length=n;continue e}}d?r.push({token:i,pos:c.index,single:f,level:o}):h&&f&&(s.content=$s(s.content,c.index,vp))}}}function K6(t){if(t.md.options.typographer)for(let e=t.tokens.length-1;e>=0;e--)t.tokens[e].type!=="inline"||!W6.test(t.tokens[e].content)||U6(t.tokens[e].children,t)}function J6(t){let e,n;const r=t.tokens,i=r.length;for(let s=0;s<i;s++){if(r[s].type!=="inline")continue;const o=r[s].children,a=o.length;for(e=0;e<a;e++)o[e].type==="text_special"&&(o[e].type="text");for(e=n=0;e<a;e++)o[e].type==="text"&&e+1<a&&o[e+1].type==="text"?o[e+1].content=o[e].content+o[e+1].content:(e!==n&&(o[n]=o[e]),n++);e!==n&&(o.length=n)}}const zu=[["normalize",R6],["block",N6],["inline",F6],["linkify",L6],["replacements",q6],["smartquotes",K6],["text_join",J6]];function Ad(){this.ruler=new lt;for(let t=0;t<zu.length;t++)this.ruler.push(zu[t][0],zu[t][1])}Ad.prototype.process=function(t){const e=this.ruler.getRules("");for(let n=0,r=e.length;n<r;n++)e[n](t)};Ad.prototype.State=L1;function Zt(t,e,n,r){this.src=t,this.md=e,this.env=n,this.tokens=r,this.bMarks=[],this.eMarks=[],this.tShift=[],this.sCount=[],this.bsCount=[],this.blkIndent=0,this.line=0,this.lineMax=0,this.tight=!1,this.ddIndent=-1,this.listIndent=-1,this.parentType="root",this.level=0;const i=this.src;for(let s=0,o=0,a=0,u=0,l=i.length,c=!1;o<l;o++){const d=i.charCodeAt(o);if(!c)if(ae(d)){a++,d===9?u+=4-u%4:u++;continue}else c=!0;(d===10||o===l-1)&&(d!==10&&o++,this.bMarks.push(s),this.eMarks.push(o),this.tShift.push(a),this.sCount.push(u),this.bsCount.push(0),c=!1,a=0,u=0,s=o+1)}this.bMarks.push(i.length),this.eMarks.push(i.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}Zt.prototype.push=function(t,e,n){const r=new Ft(t,e,n);return r.block=!0,n<0&&this.level--,r.level=this.level,n>0&&this.level++,this.tokens.push(r),r};Zt.prototype.isEmpty=function(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]};Zt.prototype.skipEmptyLines=function(e){for(let n=this.lineMax;e<n&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e};Zt.prototype.skipSpaces=function(e){for(let n=this.src.length;e<n;e++){const r=this.src.charCodeAt(e);if(!ae(r))break}return e};Zt.prototype.skipSpacesBack=function(e,n){if(e<=n)return e;for(;e>n;)if(!ae(this.src.charCodeAt(--e)))return e+1;return e};Zt.prototype.skipChars=function(e,n){for(let r=this.src.length;e<r&&this.src.charCodeAt(e)===n;e++);return e};Zt.prototype.skipCharsBack=function(e,n,r){if(e<=r)return e;for(;e>r;)if(n!==this.src.charCodeAt(--e))return e+1;return e};Zt.prototype.getLines=function(e,n,r,i){if(e>=n)return"";const s=new Array(n-e);for(let o=0,a=e;a<n;a++,o++){let u=0;const l=this.bMarks[a];let c=l,d;for(a+1<n||i?d=this.eMarks[a]+1:d=this.eMarks[a];c<d&&u<r;){const h=this.src.charCodeAt(c);if(ae(h))h===9?u+=4-(u+this.bsCount[a])%4:u++;else if(c-l<this.tShift[a])u++;else break;c++}u>r?s[o]=new Array(u-r+1).join(" ")+this.src.slice(c,d):s[o]=this.src.slice(c,d)}return s.join("")};Zt.prototype.Token=Ft;const G6=65536;function Hu(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];return t.src.slice(n,r)}function yp(t){const e=[],n=t.length;let r=0,i=t.charCodeAt(r),s=!1,o=0,a="";for(;r<n;)i===124&&(s?(a+=t.substring(o,r-1),o=r):(e.push(a+t.substring(o,r)),a="",o=r+1)),s=i===92,r++,i=t.charCodeAt(r);return e.push(a+t.substring(o)),e}function Y6(t,e,n,r){if(e+2>n)return!1;let i=e+1;if(t.sCount[i]<t.blkIndent||t.sCount[i]-t.blkIndent>=4)return!1;let s=t.bMarks[i]+t.tShift[i];if(s>=t.eMarks[i])return!1;const o=t.src.charCodeAt(s++);if(o!==124&&o!==45&&o!==58||s>=t.eMarks[i])return!1;const a=t.src.charCodeAt(s++);if(a!==124&&a!==45&&a!==58&&!ae(a)||o===45&&ae(a))return!1;for(;s<t.eMarks[i];){const x=t.src.charCodeAt(s);if(x!==124&&x!==45&&x!==58&&!ae(x))return!1;s++}let u=Hu(t,e+1),l=u.split("|");const c=[];for(let x=0;x<l.length;x++){const y=l[x].trim();if(!y){if(x===0||x===l.length-1)continue;return!1}if(!/^:?-+:?$/.test(y))return!1;y.charCodeAt(y.length-1)===58?c.push(y.charCodeAt(0)===58?"center":"right"):y.charCodeAt(0)===58?c.push("left"):c.push("")}if(u=Hu(t,e).trim(),u.indexOf("|")===-1||t.sCount[e]-t.blkIndent>=4)return!1;l=yp(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop();const d=l.length;if(d===0||d!==c.length)return!1;if(r)return!0;const h=t.parentType;t.parentType="table";const f=t.md.block.ruler.getRules("blockquote"),p=t.push("table_open","table",1),m=[e,0];p.map=m;const g=t.push("thead_open","thead",1);g.map=[e,e+1];const b=t.push("tr_open","tr",1);b.map=[e,e+1];for(let x=0;x<l.length;x++){const y=t.push("th_open","th",1);c[x]&&(y.attrs=[["style","text-align:"+c[x]]]);const w=t.push("inline","",0);w.content=l[x].trim(),w.children=[],t.push("th_close","th",-1)}t.push("tr_close","tr",-1),t.push("thead_close","thead",-1);let v,_=0;for(i=e+2;i<n&&!(t.sCount[i]<t.blkIndent);i++){let x=!1;for(let w=0,C=f.length;w<C;w++)if(f[w](t,i,n,!0)){x=!0;break}if(x||(u=Hu(t,i).trim(),!u)||t.sCount[i]-t.blkIndent>=4||(l=yp(u),l.length&&l[0]===""&&l.shift(),l.length&&l[l.length-1]===""&&l.pop(),_+=d-l.length,_>G6))break;if(i===e+2){const w=t.push("tbody_open","tbody",1);w.map=v=[e+2,0]}const y=t.push("tr_open","tr",1);y.map=[i,i+1];for(let w=0;w<d;w++){const C=t.push("td_open","td",1);c[w]&&(C.attrs=[["style","text-align:"+c[w]]]);const k=t.push("inline","",0);k.content=l[w]?l[w].trim():"",k.children=[],t.push("td_close","td",-1)}t.push("tr_close","tr",-1)}return v&&(t.push("tbody_close","tbody",-1),v[1]=i),t.push("table_close","table",-1),m[1]=i,t.parentType=h,t.line=i,!0}function Z6(t,e,n){if(t.sCount[e]-t.blkIndent<4)return!1;let r=e+1,i=r;for(;r<n;){if(t.isEmpty(r)){r++;continue}if(t.sCount[r]-t.blkIndent>=4){r++,i=r;continue}break}t.line=i;const s=t.push("code_block","code",0);return s.content=t.getLines(e,i,4+t.blkIndent,!1)+`
|
|
105
|
+
`,s.map=[e,t.line],!0}function X6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||i+3>s)return!1;const o=t.src.charCodeAt(i);if(o!==126&&o!==96)return!1;let a=i;i=t.skipChars(i,o);let u=i-a;if(u<3)return!1;const l=t.src.slice(a,i),c=t.src.slice(i,s);if(o===96&&c.indexOf(String.fromCharCode(o))>=0)return!1;if(r)return!0;let d=e,h=!1;for(;d++,!(d>=n||(i=a=t.bMarks[d]+t.tShift[d],s=t.eMarks[d],i<s&&t.sCount[d]<t.blkIndent));)if(t.src.charCodeAt(i)===o&&!(t.sCount[d]-t.blkIndent>=4)&&(i=t.skipChars(i,o),!(i-a<u)&&(i=t.skipSpaces(i),!(i<s)))){h=!0;break}u=t.sCount[e],t.line=d+(h?1:0);const f=t.push("fence","code",0);return f.info=c,f.content=t.getLines(e+1,d,u,!0),f.markup=l,f.map=[e,t.line],!0}function Q6(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];const o=t.lineMax;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==62)return!1;if(r)return!0;const a=[],u=[],l=[],c=[],d=t.md.block.ruler.getRules("blockquote"),h=t.parentType;t.parentType="blockquote";let f=!1,p;for(p=e;p<n;p++){const _=t.sCount[p]<t.blkIndent;if(i=t.bMarks[p]+t.tShift[p],s=t.eMarks[p],i>=s)break;if(t.src.charCodeAt(i++)===62&&!_){let y=t.sCount[p]+1,w,C;t.src.charCodeAt(i)===32?(i++,y++,C=!1,w=!0):t.src.charCodeAt(i)===9?(w=!0,(t.bsCount[p]+y)%4===3?(i++,y++,C=!1):C=!0):w=!1;let k=y;for(a.push(t.bMarks[p]),t.bMarks[p]=i;i<s;){const S=t.src.charCodeAt(i);if(ae(S))S===9?k+=4-(k+t.bsCount[p]+(C?1:0))%4:k++;else break;i++}f=i>=s,u.push(t.bsCount[p]),t.bsCount[p]=t.sCount[p]+1+(w?1:0),l.push(t.sCount[p]),t.sCount[p]=k-y,c.push(t.tShift[p]),t.tShift[p]=i-t.bMarks[p];continue}if(f)break;let x=!1;for(let y=0,w=d.length;y<w;y++)if(d[y](t,p,n,!0)){x=!0;break}if(x){t.lineMax=p,t.blkIndent!==0&&(a.push(t.bMarks[p]),u.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]-=t.blkIndent);break}a.push(t.bMarks[p]),u.push(t.bsCount[p]),c.push(t.tShift[p]),l.push(t.sCount[p]),t.sCount[p]=-1}const m=t.blkIndent;t.blkIndent=0;const g=t.push("blockquote_open","blockquote",1);g.markup=">";const b=[e,0];g.map=b,t.md.block.tokenize(t,e,p);const v=t.push("blockquote_close","blockquote",-1);v.markup=">",t.lineMax=o,t.parentType=h,b[1]=t.line;for(let _=0;_<c.length;_++)t.bMarks[_+e]=a[_],t.tShift[_+e]=c[_],t.sCount[_+e]=l[_],t.bsCount[_+e]=u[_];return t.blkIndent=m,!0}function e4(t,e,n,r){const i=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let s=t.bMarks[e]+t.tShift[e];const o=t.src.charCodeAt(s++);if(o!==42&&o!==45&&o!==95)return!1;let a=1;for(;s<i;){const l=t.src.charCodeAt(s++);if(l!==o&&!ae(l))return!1;l===o&&a++}if(a<3)return!1;if(r)return!0;t.line=e+1;const u=t.push("hr","hr",0);return u.map=[e,t.line],u.markup=Array(a+1).join(String.fromCharCode(o)),!0}function _p(t,e){const n=t.eMarks[e];let r=t.bMarks[e]+t.tShift[e];const i=t.src.charCodeAt(r++);if(i!==42&&i!==45&&i!==43)return-1;if(r<n){const s=t.src.charCodeAt(r);if(!ae(s))return-1}return r}function xp(t,e){const n=t.bMarks[e]+t.tShift[e],r=t.eMarks[e];let i=n;if(i+1>=r)return-1;let s=t.src.charCodeAt(i++);if(s<48||s>57)return-1;for(;;){if(i>=r)return-1;if(s=t.src.charCodeAt(i++),s>=48&&s<=57){if(i-n>=10)return-1;continue}if(s===41||s===46)break;return-1}return i<r&&(s=t.src.charCodeAt(i),!ae(s))?-1:i}function t4(t,e){const n=t.level+2;for(let r=e+2,i=t.tokens.length-2;r<i;r++)t.tokens[r].level===n&&t.tokens[r].type==="paragraph_open"&&(t.tokens[r+2].hidden=!0,t.tokens[r].hidden=!0,r+=2)}function n4(t,e,n,r){let i,s,o,a,u=e,l=!0;if(t.sCount[u]-t.blkIndent>=4||t.listIndent>=0&&t.sCount[u]-t.listIndent>=4&&t.sCount[u]<t.blkIndent)return!1;let c=!1;r&&t.parentType==="paragraph"&&t.sCount[u]>=t.blkIndent&&(c=!0);let d,h,f;if((f=xp(t,u))>=0){if(d=!0,o=t.bMarks[u]+t.tShift[u],h=Number(t.src.slice(o,f-1)),c&&h!==1)return!1}else if((f=_p(t,u))>=0)d=!1;else return!1;if(c&&t.skipSpaces(f)>=t.eMarks[u])return!1;if(r)return!0;const p=t.src.charCodeAt(f-1),m=t.tokens.length;d?(a=t.push("ordered_list_open","ol",1),h!==1&&(a.attrs=[["start",h]])):a=t.push("bullet_list_open","ul",1);const g=[u,0];a.map=g,a.markup=String.fromCharCode(p);let b=!1;const v=t.md.block.ruler.getRules("list"),_=t.parentType;for(t.parentType="list";u<n;){s=f,i=t.eMarks[u];const x=t.sCount[u]+f-(t.bMarks[u]+t.tShift[u]);let y=x;for(;s<i;){const X=t.src.charCodeAt(s);if(X===9)y+=4-(y+t.bsCount[u])%4;else if(X===32)y++;else break;s++}const w=s;let C;w>=i?C=1:C=y-x,C>4&&(C=1);const k=x+C;a=t.push("list_item_open","li",1),a.markup=String.fromCharCode(p);const S=[u,0];a.map=S,d&&(a.info=t.src.slice(o,f-1));const D=t.tight,F=t.tShift[u],L=t.sCount[u],j=t.listIndent;if(t.listIndent=t.blkIndent,t.blkIndent=k,t.tight=!0,t.tShift[u]=w-t.bMarks[u],t.sCount[u]=y,w>=i&&t.isEmpty(u+1)?t.line=Math.min(t.line+2,n):t.md.block.tokenize(t,u,n,!0),(!t.tight||b)&&(l=!1),b=t.line-u>1&&t.isEmpty(t.line-1),t.blkIndent=t.listIndent,t.listIndent=j,t.tShift[u]=F,t.sCount[u]=L,t.tight=D,a=t.push("list_item_close","li",-1),a.markup=String.fromCharCode(p),u=t.line,S[1]=u,u>=n||t.sCount[u]<t.blkIndent||t.sCount[u]-t.blkIndent>=4)break;let W=!1;for(let X=0,ne=v.length;X<ne;X++)if(v[X](t,u,n,!0)){W=!0;break}if(W)break;if(d){if(f=xp(t,u),f<0)break;o=t.bMarks[u]+t.tShift[u]}else if(f=_p(t,u),f<0)break;if(p!==t.src.charCodeAt(f-1))break}return d?a=t.push("ordered_list_close","ol",-1):a=t.push("bullet_list_close","ul",-1),a.markup=String.fromCharCode(p),g[1]=u,t.line=u,t.parentType=_,l&&t4(t,m),!0}function r4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e],o=e+1;if(t.sCount[e]-t.blkIndent>=4||t.src.charCodeAt(i)!==91)return!1;function a(v){const _=t.lineMax;if(v>=_||t.isEmpty(v))return null;let x=!1;if(t.sCount[v]-t.blkIndent>3&&(x=!0),t.sCount[v]<0&&(x=!0),!x){const C=t.md.block.ruler.getRules("reference"),k=t.parentType;t.parentType="reference";let S=!1;for(let D=0,F=C.length;D<F;D++)if(C[D](t,v,_,!0)){S=!0;break}if(t.parentType=k,S)return null}const y=t.bMarks[v]+t.tShift[v],w=t.eMarks[v];return t.src.slice(y,w+1)}let u=t.src.slice(i,s+1);s=u.length;let l=-1;for(i=1;i<s;i++){const v=u.charCodeAt(i);if(v===91)return!1;if(v===93){l=i;break}else if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(v===92&&(i++,i<s&&u.charCodeAt(i)===10)){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}}if(l<0||u.charCodeAt(l+1)!==58)return!1;for(i=l+2;i<s;i++){const v=u.charCodeAt(i);if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(!ae(v))break}const c=t.md.helpers.parseLinkDestination(u,i,s);if(!c.ok)return!1;const d=t.md.normalizeLink(c.str);if(!t.md.validateLink(d))return!1;i=c.pos;const h=i,f=o,p=i;for(;i<s;i++){const v=u.charCodeAt(i);if(v===10){const _=a(o);_!==null&&(u+=_,s=u.length,o++)}else if(!ae(v))break}let m=t.md.helpers.parseLinkTitle(u,i,s);for(;m.can_continue;){const v=a(o);if(v===null)break;u+=v,i=s,s=u.length,o++,m=t.md.helpers.parseLinkTitle(u,i,s,m)}let g;for(i<s&&p!==i&&m.ok?(g=m.str,i=m.pos):(g="",i=h,o=f);i<s;){const v=u.charCodeAt(i);if(!ae(v))break;i++}if(i<s&&u.charCodeAt(i)!==10&&g)for(g="",i=h,o=f;i<s;){const v=u.charCodeAt(i);if(!ae(v))break;i++}if(i<s&&u.charCodeAt(i)!==10)return!1;const b=ja(u.slice(1,l));return b?(r||(typeof t.env.references>"u"&&(t.env.references={}),typeof t.env.references[b]>"u"&&(t.env.references[b]={title:g,href:d}),t.line=o),!0):!1}const i4=["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"],s4="[a-zA-Z_:][a-zA-Z0-9:._-]*",o4="[^\"'=<>`\\x00-\\x20]+",a4="'[^']*'",u4='"[^"]*"',l4="(?:"+o4+"|"+a4+"|"+u4+")",c4="(?:\\s+"+s4+"(?:\\s*=\\s*"+l4+")?)",$1="<[A-Za-z][A-Za-z0-9\\-]*"+c4+"*\\s*\\/?>",z1="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>",d4="<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->",h4="<[?][\\s\\S]*?[?]>",f4="<![A-Za-z][^>]*>",p4="<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",m4=new RegExp("^(?:"+$1+"|"+z1+"|"+d4+"|"+h4+"|"+f4+"|"+p4+")"),g4=new RegExp("^(?:"+$1+"|"+z1+")"),Or=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp("^</?("+i4.join("|")+")(?=(\\s|/?>|$))","i"),/^$/,!0],[new RegExp(g4.source+"\\s*$"),/^$/,!1]];function b4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4||!t.md.options.html||t.src.charCodeAt(i)!==60)return!1;let o=t.src.slice(i,s),a=0;for(;a<Or.length&&!Or[a][0].test(o);a++);if(a===Or.length)return!1;if(r)return Or[a][2];let u=e+1;if(!Or[a][1].test(o)){for(;u<n&&!(t.sCount[u]<t.blkIndent);u++)if(i=t.bMarks[u]+t.tShift[u],s=t.eMarks[u],o=t.src.slice(i,s),Or[a][1].test(o)){o.length!==0&&u++;break}}t.line=u;const l=t.push("html_block","",0);return l.map=[e,u],l.content=t.getLines(e,u,t.blkIndent,!0),!0}function v4(t,e,n,r){let i=t.bMarks[e]+t.tShift[e],s=t.eMarks[e];if(t.sCount[e]-t.blkIndent>=4)return!1;let o=t.src.charCodeAt(i);if(o!==35||i>=s)return!1;let a=1;for(o=t.src.charCodeAt(++i);o===35&&i<s&&a<=6;)a++,o=t.src.charCodeAt(++i);if(a>6||i<s&&!ae(o))return!1;if(r)return!0;s=t.skipSpacesBack(s,i);const u=t.skipCharsBack(s,35,i);u>i&&ae(t.src.charCodeAt(u-1))&&(s=u),t.line=e+1;const l=t.push("heading_open","h"+String(a),1);l.markup="########".slice(0,a),l.map=[e,t.line];const c=t.push("inline","",0);c.content=t.src.slice(i,s).trim(),c.map=[e,t.line],c.children=[];const d=t.push("heading_close","h"+String(a),-1);return d.markup="########".slice(0,a),!0}function y4(t,e,n){const r=t.md.block.ruler.getRules("paragraph");if(t.sCount[e]-t.blkIndent>=4)return!1;const i=t.parentType;t.parentType="paragraph";let s=0,o,a=e+1;for(;a<n&&!t.isEmpty(a);a++){if(t.sCount[a]-t.blkIndent>3)continue;if(t.sCount[a]>=t.blkIndent){let f=t.bMarks[a]+t.tShift[a];const p=t.eMarks[a];if(f<p&&(o=t.src.charCodeAt(f),(o===45||o===61)&&(f=t.skipChars(f,o),f=t.skipSpaces(f),f>=p))){s=o===61?1:2;break}}if(t.sCount[a]<0)continue;let h=!1;for(let f=0,p=r.length;f<p;f++)if(r[f](t,a,n,!0)){h=!0;break}if(h)break}if(!s)return!1;const u=t.getLines(e,a,t.blkIndent,!1).trim();t.line=a+1;const l=t.push("heading_open","h"+String(s),1);l.markup=String.fromCharCode(o),l.map=[e,t.line];const c=t.push("inline","",0);c.content=u,c.map=[e,t.line-1],c.children=[];const d=t.push("heading_close","h"+String(s),-1);return d.markup=String.fromCharCode(o),t.parentType=i,!0}function _4(t,e,n){const r=t.md.block.ruler.getRules("paragraph"),i=t.parentType;let s=e+1;for(t.parentType="paragraph";s<n&&!t.isEmpty(s);s++){if(t.sCount[s]-t.blkIndent>3||t.sCount[s]<0)continue;let l=!1;for(let c=0,d=r.length;c<d;c++)if(r[c](t,s,n,!0)){l=!0;break}if(l)break}const o=t.getLines(e,s,t.blkIndent,!1).trim();t.line=s;const a=t.push("paragraph_open","p",1);a.map=[e,t.line];const u=t.push("inline","",0);return u.content=o,u.map=[e,t.line],u.children=[],t.push("paragraph_close","p",-1),t.parentType=i,!0}const zs=[["table",Y6,["paragraph","reference"]],["code",Z6],["fence",X6,["paragraph","reference","blockquote","list"]],["blockquote",Q6,["paragraph","reference","blockquote","list"]],["hr",e4,["paragraph","reference","blockquote","list"]],["list",n4,["paragraph","reference","blockquote"]],["reference",r4],["html_block",b4,["paragraph","reference","blockquote"]],["heading",v4,["paragraph","reference","blockquote"]],["lheading",y4],["paragraph",_4]];function Va(){this.ruler=new lt;for(let t=0;t<zs.length;t++)this.ruler.push(zs[t][0],zs[t][1],{alt:(zs[t][2]||[]).slice()})}Va.prototype.tokenize=function(t,e,n){const r=this.ruler.getRules(""),i=r.length,s=t.md.options.maxNesting;let o=e,a=!1;for(;o<n&&(t.line=o=t.skipEmptyLines(o),!(o>=n||t.sCount[o]<t.blkIndent));){if(t.level>=s){t.line=n;break}const u=t.line;let l=!1;for(let c=0;c<i;c++)if(l=r[c](t,o,n,!1),l){if(u>=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),o=t.line,o<n&&t.isEmpty(o)&&(a=!0,o++,t.line=o)}};Va.prototype.parse=function(t,e,n,r){if(!t)return;const i=new this.State(t,e,n,r);this.tokenize(i,i.line,i.lineMax)};Va.prototype.State=Zt;function _s(t,e,n,r){this.src=t,this.env=n,this.md=e,this.tokens=r,this.tokens_meta=Array(r.length),this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache={},this.delimiters=[],this._prev_delimiters=[],this.backticks={},this.backticksScanned=!1,this.linkLevel=0}_s.prototype.pushPending=function(){const t=new Ft("text","",0);return t.content=this.pending,t.level=this.pendingLevel,this.tokens.push(t),this.pending="",t};_s.prototype.push=function(t,e,n){this.pending&&this.pushPending();const r=new Ft(t,e,n);let i=null;return n<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,n>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],i={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(i),r};_s.prototype.scanDelims=function(t,e){const n=this.posMax,r=this.src.charCodeAt(t),i=t>0?this.src.charCodeAt(t-1):32;let s=t;for(;s<n&&this.src.charCodeAt(s)===r;)s++;const o=s-t,a=s<n?this.src.charCodeAt(s):32,u=cs(i)||ls(String.fromCharCode(i)),l=cs(a)||ls(String.fromCharCode(a)),c=us(i),d=us(a),h=!d&&(!l||c||u),f=!c&&(!u||d||l);return{can_open:h&&(e||!f||u),can_close:f&&(e||!h||l),length:o}};_s.prototype.Token=Ft;function x4(t){switch(t){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function k4(t,e){let n=t.pos;for(;n<t.posMax&&!x4(t.src.charCodeAt(n));)n++;return n===t.pos?!1:(e||(t.pending+=t.src.slice(t.pos,n)),t.pos=n,!0)}const w4=/(?:^|[^a-z0-9.+-])([a-z][a-z0-9.+-]*)$/i;function C4(t,e){if(!t.md.options.linkify||t.linkLevel>0)return!1;const n=t.pos,r=t.posMax;if(n+3>r||t.src.charCodeAt(n)!==58||t.src.charCodeAt(n+1)!==47||t.src.charCodeAt(n+2)!==47)return!1;const i=t.pending.match(w4);if(!i)return!1;const s=i[1],o=t.md.linkify.matchAtStart(t.src.slice(n-s.length));if(!o)return!1;let a=o.url;if(a.length<=s.length)return!1;let u=a.length;for(;u>0&&a.charCodeAt(u-1)===42;)u--;u!==a.length&&(a=a.slice(0,u));const l=t.md.normalizeLink(a);if(!t.md.validateLink(l))return!1;if(!e){t.pending=t.pending.slice(0,-s.length);const c=t.push("link_open","a",1);c.attrs=[["href",l]],c.markup="linkify",c.info="auto";const d=t.push("text","",0);d.content=t.md.normalizeLinkText(a);const h=t.push("link_close","a",-1);h.markup="linkify",h.info="auto"}return t.pos+=a.length-s.length,!0}function E4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==10)return!1;const r=t.pending.length-1,i=t.posMax;if(!e)if(r>=0&&t.pending.charCodeAt(r)===32)if(r>=1&&t.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&t.pending.charCodeAt(s-1)===32;)s--;t.pending=t.pending.slice(0,s),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(n++;n<i&&ae(t.src.charCodeAt(n));)n++;return t.pos=n,!0}const Td=[];for(let t=0;t<256;t++)Td.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(t){Td[t.charCodeAt(0)]=1});function S4(t,e){let n=t.pos;const r=t.posMax;if(t.src.charCodeAt(n)!==92||(n++,n>=r))return!1;let i=t.src.charCodeAt(n);if(i===10){for(e||t.push("hardbreak","br",0),n++;n<r&&(i=t.src.charCodeAt(n),!!ae(i));)n++;return t.pos=n,!0}let s=t.src[n];if(i>=55296&&i<=56319&&n+1<r){const a=t.src.charCodeAt(n+1);a>=56320&&a<=57343&&(s+=t.src[n+1],n++)}const o="\\"+s;if(!e){const a=t.push("text_special","",0);i<256&&Td[i]!==0?a.content=s:a.content=o,a.markup=o,a.info="escape"}return t.pos=n+1,!0}function M4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==96)return!1;const i=n;n++;const s=t.posMax;for(;n<s&&t.src.charCodeAt(n)===96;)n++;const o=t.src.slice(i,n),a=o.length;if(t.backticksScanned&&(t.backticks[a]||0)<=i)return e||(t.pending+=o),t.pos+=a,!0;let u=n,l;for(;(l=t.src.indexOf("`",u))!==-1;){for(u=l+1;u<s&&t.src.charCodeAt(u)===96;)u++;const c=u-l;if(c===a){if(!e){const d=t.push("code_inline","code",0);d.markup=o,d.content=t.src.slice(n,l).replace(/\n/g," ").replace(/^ (.+) $/,"$1")}return t.pos=u,!0}t.backticks[c]=l}return t.backticksScanned=!0,e||(t.pending+=o),t.pos+=a,!0}function A4(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==126)return!1;const i=t.scanDelims(t.pos,!0);let s=i.length;const o=String.fromCharCode(r);if(s<2)return!1;let a;s%2&&(a=t.push("text","",0),a.content=o,s--);for(let u=0;u<s;u+=2)a=t.push("text","",0),a.content=o+o,t.delimiters.push({marker:r,length:0,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close});return t.pos+=i.length,!0}function kp(t,e){let n;const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(o.marker!==126||o.end===-1)continue;const a=e[o.end];n=t.tokens[o.token],n.type="s_open",n.tag="s",n.nesting=1,n.markup="~~",n.content="",n=t.tokens[a.token],n.type="s_close",n.tag="s",n.nesting=-1,n.markup="~~",n.content="",t.tokens[a.token-1].type==="text"&&t.tokens[a.token-1].content==="~"&&r.push(a.token-1)}for(;r.length;){const s=r.pop();let o=s+1;for(;o<t.tokens.length&&t.tokens[o].type==="s_close";)o++;o--,s!==o&&(n=t.tokens[o],t.tokens[o]=t.tokens[s],t.tokens[s]=n)}}function T4(t){const e=t.tokens_meta,n=t.tokens_meta.length;kp(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&kp(t,e[r].delimiters)}const H1={tokenize:A4,postProcess:T4};function D4(t,e){const n=t.pos,r=t.src.charCodeAt(n);if(e||r!==95&&r!==42)return!1;const i=t.scanDelims(t.pos,r===42);for(let s=0;s<i.length;s++){const o=t.push("text","",0);o.content=String.fromCharCode(r),t.delimiters.push({marker:r,length:i.length,token:t.tokens.length-1,end:-1,open:i.can_open,close:i.can_close})}return t.pos+=i.length,!0}function wp(t,e){const n=e.length;for(let r=n-1;r>=0;r--){const i=e[r];if(i.marker!==95&&i.marker!==42||i.end===-1)continue;const s=e[i.end],o=r>0&&e[r-1].end===i.end+1&&e[r-1].marker===i.marker&&e[r-1].token===i.token-1&&e[i.end+1].token===s.token+1,a=String.fromCharCode(i.marker),u=t.tokens[i.token];u.type=o?"strong_open":"em_open",u.tag=o?"strong":"em",u.nesting=1,u.markup=o?a+a:a,u.content="";const l=t.tokens[s.token];l.type=o?"strong_close":"em_close",l.tag=o?"strong":"em",l.nesting=-1,l.markup=o?a+a:a,l.content="",o&&(t.tokens[e[r-1].token].content="",t.tokens[e[i.end+1].token].content="",r--)}}function O4(t){const e=t.tokens_meta,n=t.tokens_meta.length;wp(t,t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&wp(t,e[r].delimiters)}const j1={tokenize:D4,postProcess:O4};function R4(t,e){let n,r,i,s,o="",a="",u=t.pos,l=!0;if(t.src.charCodeAt(t.pos)!==91)return!1;const c=t.pos,d=t.posMax,h=t.pos+1,f=t.md.helpers.parseLinkLabel(t,t.pos,!0);if(f<0)return!1;let p=f+1;if(p<d&&t.src.charCodeAt(p)===40){for(l=!1,p++;p<d&&(n=t.src.charCodeAt(p),!(!ae(n)&&n!==10));p++);if(p>=d)return!1;if(u=p,i=t.md.helpers.parseLinkDestination(t.src,p,t.posMax),i.ok){for(o=t.md.normalizeLink(i.str),t.md.validateLink(o)?p=i.pos:o="",u=p;p<d&&(n=t.src.charCodeAt(p),!(!ae(n)&&n!==10));p++);if(i=t.md.helpers.parseLinkTitle(t.src,p,t.posMax),p<d&&u!==p&&i.ok)for(a=i.str,p=i.pos;p<d&&(n=t.src.charCodeAt(p),!(!ae(n)&&n!==10));p++);}(p>=d||t.src.charCodeAt(p)!==41)&&(l=!0),p++}if(l){if(typeof t.env.references>"u")return!1;if(p<d&&t.src.charCodeAt(p)===91?(u=p+1,p=t.md.helpers.parseLinkLabel(t,p),p>=0?r=t.src.slice(u,p++):p=f+1):p=f+1,r||(r=t.src.slice(h,f)),s=t.env.references[ja(r)],!s)return t.pos=c,!1;o=s.href,a=s.title}if(!e){t.pos=h,t.posMax=f;const m=t.push("link_open","a",1),g=[["href",o]];m.attrs=g,a&&g.push(["title",a]),t.linkLevel++,t.md.inline.tokenize(t),t.linkLevel--,t.push("link_close","a",-1)}return t.pos=p,t.posMax=d,!0}function N4(t,e){let n,r,i,s,o,a,u,l,c="";const d=t.pos,h=t.posMax;if(t.src.charCodeAt(t.pos)!==33||t.src.charCodeAt(t.pos+1)!==91)return!1;const f=t.pos+2,p=t.md.helpers.parseLinkLabel(t,t.pos+1,!1);if(p<0)return!1;if(s=p+1,s<h&&t.src.charCodeAt(s)===40){for(s++;s<h&&(n=t.src.charCodeAt(s),!(!ae(n)&&n!==10));s++);if(s>=h)return!1;for(l=s,a=t.md.helpers.parseLinkDestination(t.src,s,t.posMax),a.ok&&(c=t.md.normalizeLink(a.str),t.md.validateLink(c)?s=a.pos:c=""),l=s;s<h&&(n=t.src.charCodeAt(s),!(!ae(n)&&n!==10));s++);if(a=t.md.helpers.parseLinkTitle(t.src,s,t.posMax),s<h&&l!==s&&a.ok)for(u=a.str,s=a.pos;s<h&&(n=t.src.charCodeAt(s),!(!ae(n)&&n!==10));s++);else u="";if(s>=h||t.src.charCodeAt(s)!==41)return t.pos=d,!1;s++}else{if(typeof t.env.references>"u")return!1;if(s<h&&t.src.charCodeAt(s)===91?(l=s+1,s=t.md.helpers.parseLinkLabel(t,s),s>=0?i=t.src.slice(l,s++):s=p+1):s=p+1,i||(i=t.src.slice(f,p)),o=t.env.references[ja(i)],!o)return t.pos=d,!1;c=o.href,u=o.title}if(!e){r=t.src.slice(f,p);const m=[];t.md.inline.parse(r,t.md,t.env,m);const g=t.push("image","img",0),b=[["src",c],["alt",""]];g.attrs=b,g.children=m,g.content=r,u&&b.push(["title",u])}return t.pos=s,t.posMax=h,!0}const F4=/^([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])?)*)$/,I4=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function P4(t,e){let n=t.pos;if(t.src.charCodeAt(n)!==60)return!1;const r=t.pos,i=t.posMax;for(;;){if(++n>=i)return!1;const o=t.src.charCodeAt(n);if(o===60)return!1;if(o===62)break}const s=t.src.slice(r+1,n);if(I4.test(s)){const o=t.md.normalizeLink(s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(s);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=s.length+2,!0}if(F4.test(s)){const o=t.md.normalizeLink("mailto:"+s);if(!t.md.validateLink(o))return!1;if(!e){const a=t.push("link_open","a",1);a.attrs=[["href",o]],a.markup="autolink",a.info="auto";const u=t.push("text","",0);u.content=t.md.normalizeLinkText(s);const l=t.push("link_close","a",-1);l.markup="autolink",l.info="auto"}return t.pos+=s.length+2,!0}return!1}function L4(t){return/^<a[>\s]/i.test(t)}function B4(t){return/^<\/a\s*>/i.test(t)}function $4(t){const e=t|32;return e>=97&&e<=122}function z4(t,e){if(!t.md.options.html)return!1;const n=t.posMax,r=t.pos;if(t.src.charCodeAt(r)!==60||r+2>=n)return!1;const i=t.src.charCodeAt(r+1);if(i!==33&&i!==63&&i!==47&&!$4(i))return!1;const s=t.src.slice(r).match(m4);if(!s)return!1;if(!e){const o=t.push("html_inline","",0);o.content=s[0],L4(o.content)&&t.linkLevel++,B4(o.content)&&t.linkLevel--}return t.pos+=s[0].length,!0}const H4=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,j4=/^&([a-z][a-z0-9]{1,31});/i;function V4(t,e){const n=t.pos,r=t.posMax;if(t.src.charCodeAt(n)!==38||n+1>=r)return!1;if(t.src.charCodeAt(n+1)===35){const s=t.src.slice(n).match(H4);if(s){if(!e){const o=s[1][0].toLowerCase()==="x"?parseInt(s[1].slice(1),16):parseInt(s[1],10),a=t.push("text_special","",0);a.content=Md(o)?Wo(o):Wo(65533),a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}else{const s=t.src.slice(n).match(j4);if(s){const o=F1(s[0]);if(o!==s[0]){if(!e){const a=t.push("text_special","",0);a.content=o,a.markup=s[0],a.info="entity"}return t.pos+=s[0].length,!0}}}return!1}function Cp(t){const e={},n=t.length;if(!n)return;let r=0,i=-2;const s=[];for(let o=0;o<n;o++){const a=t[o];if(s.push(0),(t[r].marker!==a.marker||i!==a.token-1)&&(r=o),i=a.token,a.length=a.length||0,!a.close)continue;e.hasOwnProperty(a.marker)||(e[a.marker]=[-1,-1,-1,-1,-1,-1]);const u=e[a.marker][(a.open?3:0)+a.length%3];let l=r-s[r]-1,c=l;for(;l>u;l-=s[l]+1){const d=t[l];if(d.marker===a.marker&&d.open&&d.end<0){let h=!1;if((d.close||a.open)&&(d.length+a.length)%3===0&&(d.length%3!==0||a.length%3!==0)&&(h=!0),!h){const f=l>0&&!t[l-1].open?s[l-1]+1:0;s[o]=o-l+f,s[l]=f,a.open=!1,d.end=o,d.close=!1,c=-1,i=-2;break}}}c!==-1&&(e[a.marker][(a.open?3:0)+(a.length||0)%3]=c)}}function q4(t){const e=t.tokens_meta,n=t.tokens_meta.length;Cp(t.delimiters);for(let r=0;r<n;r++)e[r]&&e[r].delimiters&&Cp(e[r].delimiters)}function W4(t){let e,n,r=0;const i=t.tokens,s=t.tokens.length;for(e=n=0;e<s;e++)i[e].nesting<0&&r--,i[e].level=r,i[e].nesting>0&&r++,i[e].type==="text"&&e+1<s&&i[e+1].type==="text"?i[e+1].content=i[e].content+i[e+1].content:(e!==n&&(i[n]=i[e]),n++);e!==n&&(i.length=n)}const ju=[["text",k4],["linkify",C4],["newline",E4],["escape",S4],["backticks",M4],["strikethrough",H1.tokenize],["emphasis",j1.tokenize],["link",R4],["image",N4],["autolink",P4],["html_inline",z4],["entity",V4]],Vu=[["balance_pairs",q4],["strikethrough",H1.postProcess],["emphasis",j1.postProcess],["fragments_join",W4]];function xs(){this.ruler=new lt;for(let t=0;t<ju.length;t++)this.ruler.push(ju[t][0],ju[t][1]);this.ruler2=new lt;for(let t=0;t<Vu.length;t++)this.ruler2.push(Vu[t][0],Vu[t][1])}xs.prototype.skipToken=function(t){const e=t.pos,n=this.ruler.getRules(""),r=n.length,i=t.md.options.maxNesting,s=t.cache;if(typeof s[e]<"u"){t.pos=s[e];return}let o=!1;if(t.level<i){for(let a=0;a<r;a++)if(t.level++,o=n[a](t,!0),t.level--,o){if(e>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}else t.pos=t.posMax;o||t.pos++,s[e]=t.pos};xs.prototype.tokenize=function(t){const e=this.ruler.getRules(""),n=e.length,r=t.posMax,i=t.md.options.maxNesting;for(;t.pos<r;){const s=t.pos;let o=!1;if(t.level<i){for(let a=0;a<n;a++)if(o=e[a](t,!1),o){if(s>=t.pos)throw new Error("inline rule didn't increment state.pos");break}}if(o){if(t.pos>=r)break;continue}t.pending+=t.src[t.pos++]}t.pending&&t.pushPending()};xs.prototype.parse=function(t,e,n,r){const i=new this.State(t,e,n,r);this.tokenize(i);const s=this.ruler2.getRules(""),o=s.length;for(let a=0;a<o;a++)s[a](i)};xs.prototype.State=_s;function U4(t){const e={};t=t||{},e.src_Any=T1.source,e.src_Cc=D1.source,e.src_Z=R1.source,e.src_P=Ed.source,e.src_ZPCc=[e.src_Z,e.src_P,e.src_Cc].join("|"),e.src_ZCc=[e.src_Z,e.src_Cc].join("|");const n="[><|]";return e.src_pseudo_letter="(?:(?!"+n+"|"+e.src_ZPCc+")"+e.src_Any+")",e.src_ip4="(?:(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",e.src_auth="(?:(?:(?!"+e.src_ZCc+"|[@/\\[\\]()]).)+@)?",e.src_port="(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?",e.src_host_terminator="(?=$|"+n+"|"+e.src_ZPCc+")(?!"+(t["---"]?"-(?!--)|":"-|")+"_|:\\d|\\.-|\\.(?!$|"+e.src_ZPCc+"))",e.src_path="(?:[/?#](?:(?!"+e.src_ZCc+"|"+n+`|[()[\\]{}.,"'?!\\-;]).|\\[(?:(?!`+e.src_ZCc+"|\\]).)*\\]|\\((?:(?!"+e.src_ZCc+"|[)]).)*\\)|\\{(?:(?!"+e.src_ZCc+'|[}]).)*\\}|\\"(?:(?!'+e.src_ZCc+`|["]).)+\\"|\\'(?:(?!`+e.src_ZCc+"|[']).)+\\'|\\'(?="+e.src_pseudo_letter+"|[-])|\\.{2,}[a-zA-Z0-9%/&]|\\.(?!"+e.src_ZCc+"|[.]|$)|"+(t["---"]?"\\-(?!--(?:[^-]|$))(?:-*)|":"\\-+|")+",(?!"+e.src_ZCc+"|$)|;(?!"+e.src_ZCc+"|$)|\\!+(?!"+e.src_ZCc+"|[!]|$)|\\?(?!"+e.src_ZCc+"|[?]|$))+|\\/)?",e.src_email_name='[\\-;:&=\\+\\$,\\.a-zA-Z0-9_][\\-;:&=\\+\\$,\\"\\.a-zA-Z0-9_]*',e.src_xn="xn--[a-z0-9\\-]{1,59}",e.src_domain_root="(?:"+e.src_xn+"|"+e.src_pseudo_letter+"{1,63})",e.src_domain="(?:"+e.src_xn+"|(?:"+e.src_pseudo_letter+")|(?:"+e.src_pseudo_letter+"(?:-|"+e.src_pseudo_letter+"){0,61}"+e.src_pseudo_letter+"))",e.src_host="(?:(?:(?:(?:"+e.src_domain+")\\.)*"+e.src_domain+"))",e.tpl_host_fuzzy="(?:"+e.src_ip4+"|(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%)))",e.tpl_host_no_ip_fuzzy="(?:(?:(?:"+e.src_domain+")\\.)+(?:%TLDS%))",e.src_host_strict=e.src_host+e.src_host_terminator,e.tpl_host_fuzzy_strict=e.tpl_host_fuzzy+e.src_host_terminator,e.src_host_port_strict=e.src_host+e.src_port+e.src_host_terminator,e.tpl_host_port_fuzzy_strict=e.tpl_host_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_port_no_ip_fuzzy_strict=e.tpl_host_no_ip_fuzzy+e.src_port+e.src_host_terminator,e.tpl_host_fuzzy_test="localhost|www\\.|\\.\\d{1,3}\\.|(?:\\.(?:%TLDS%)(?:"+e.src_ZPCc+"|>|$))",e.tpl_email_fuzzy="(^|"+n+'|"|\\(|'+e.src_ZCc+")("+e.src_email_name+"@"+e.tpl_host_fuzzy_strict+")",e.tpl_link_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_fuzzy_strict+e.src_path+")",e.tpl_link_no_ip_fuzzy="(^|(?![.:/\\-_@])(?:[$+<=>^`||]|"+e.src_ZPCc+"))((?![$+<=>^`||])"+e.tpl_host_port_no_ip_fuzzy_strict+e.src_path+")",e}function fc(t){return Array.prototype.slice.call(arguments,1).forEach(function(n){n&&Object.keys(n).forEach(function(r){t[r]=n[r]})}),t}function qa(t){return Object.prototype.toString.call(t)}function K4(t){return qa(t)==="[object String]"}function J4(t){return qa(t)==="[object Object]"}function G4(t){return qa(t)==="[object RegExp]"}function Ep(t){return qa(t)==="[object Function]"}function Y4(t){return t.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}const V1={fuzzyLink:!0,fuzzyEmail:!0,fuzzyIP:!1};function Z4(t){return Object.keys(t||{}).reduce(function(e,n){return e||V1.hasOwnProperty(n)},!1)}const X4={"http:":{validate:function(t,e,n){const r=t.slice(e);return n.re.http||(n.re.http=new RegExp("^\\/\\/"+n.re.src_auth+n.re.src_host_port_strict+n.re.src_path,"i")),n.re.http.test(r)?r.match(n.re.http)[0].length:0}},"https:":"http:","ftp:":"http:","//":{validate:function(t,e,n){const r=t.slice(e);return n.re.no_http||(n.re.no_http=new RegExp("^"+n.re.src_auth+"(?:localhost|(?:(?:"+n.re.src_domain+")\\.)+"+n.re.src_domain_root+")"+n.re.src_port+n.re.src_host_terminator+n.re.src_path,"i")),n.re.no_http.test(r)?e>=3&&t[e-3]===":"||e>=3&&t[e-3]==="/"?0:r.match(n.re.no_http)[0].length:0}},"mailto:":{validate:function(t,e,n){const r=t.slice(e);return n.re.mailto||(n.re.mailto=new RegExp("^"+n.re.src_email_name+"@"+n.re.src_host_strict,"i")),n.re.mailto.test(r)?r.match(n.re.mailto)[0].length:0}}},Q4="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]",eC="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф".split("|");function tC(t){t.__index__=-1,t.__text_cache__=""}function nC(t){return function(e,n){const r=e.slice(n);return t.test(r)?r.match(t)[0].length:0}}function Sp(){return function(t,e){e.normalize(t)}}function Uo(t){const e=t.re=U4(t.__opts__),n=t.__tlds__.slice();t.onCompile(),t.__tlds_replaced__||n.push(Q4),n.push(e.src_xn),e.src_tlds=n.join("|");function r(a){return a.replace("%TLDS%",e.src_tlds)}e.email_fuzzy=RegExp(r(e.tpl_email_fuzzy),"i"),e.link_fuzzy=RegExp(r(e.tpl_link_fuzzy),"i"),e.link_no_ip_fuzzy=RegExp(r(e.tpl_link_no_ip_fuzzy),"i"),e.host_fuzzy_test=RegExp(r(e.tpl_host_fuzzy_test),"i");const i=[];t.__compiled__={};function s(a,u){throw new Error('(LinkifyIt) Invalid schema "'+a+'": '+u)}Object.keys(t.__schemas__).forEach(function(a){const u=t.__schemas__[a];if(u===null)return;const l={validate:null,link:null};if(t.__compiled__[a]=l,J4(u)){G4(u.validate)?l.validate=nC(u.validate):Ep(u.validate)?l.validate=u.validate:s(a,u),Ep(u.normalize)?l.normalize=u.normalize:u.normalize?s(a,u):l.normalize=Sp();return}if(K4(u)){i.push(a);return}s(a,u)}),i.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:Sp()};const o=Object.keys(t.__compiled__).filter(function(a){return a.length>0&&t.__compiled__[a]}).map(Y4).join("|");t.re.schema_test=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","i"),t.re.schema_search=RegExp("(^|(?!_)(?:[><|]|"+e.src_ZPCc+"))("+o+")","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"),tC(t)}function rC(t,e){const n=t.__index__,r=t.__last_index__,i=t.__text_cache__.slice(n,r);this.schema=t.__schema__.toLowerCase(),this.index=n+e,this.lastIndex=r+e,this.raw=i,this.text=i,this.url=i}function pc(t,e){const n=new rC(t,e);return t.__compiled__[n.schema].normalize(n,t),n}function gt(t,e){if(!(this instanceof gt))return new gt(t,e);e||Z4(t)&&(e=t,t={}),this.__opts__=fc({},V1,e),this.__index__=-1,this.__last_index__=-1,this.__schema__="",this.__text_cache__="",this.__schemas__=fc({},X4,t),this.__compiled__={},this.__tlds__=eC,this.__tlds_replaced__=!1,this.re={},Uo(this)}gt.prototype.add=function(e,n){return this.__schemas__[e]=n,Uo(this),this};gt.prototype.set=function(e){return this.__opts__=fc(this.__opts__,e),this};gt.prototype.test=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return!1;let n,r,i,s,o,a,u,l,c;if(this.re.schema_test.test(e)){for(u=this.re.schema_search,u.lastIndex=0;(n=u.exec(e))!==null;)if(s=this.testSchemaAt(e,n[2],u.lastIndex),s){this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+s;break}}return this.__opts__.fuzzyLink&&this.__compiled__["http:"]&&(l=e.search(this.re.host_fuzzy_test),l>=0&&(this.__index__<0||l<this.__index__)&&(r=e.match(this.__opts__.fuzzyIP?this.re.link_fuzzy:this.re.link_no_ip_fuzzy))!==null&&(o=r.index+r[1].length,(this.__index__<0||o<this.__index__)&&(this.__schema__="",this.__index__=o,this.__last_index__=r.index+r[0].length))),this.__opts__.fuzzyEmail&&this.__compiled__["mailto:"]&&(c=e.indexOf("@"),c>=0&&(i=e.match(this.re.email_fuzzy))!==null&&(o=i.index+i[1].length,a=i.index+i[0].length,(this.__index__<0||o<this.__index__||o===this.__index__&&a>this.__last_index__)&&(this.__schema__="mailto:",this.__index__=o,this.__last_index__=a))),this.__index__>=0};gt.prototype.pretest=function(e){return this.re.pretest.test(e)};gt.prototype.testSchemaAt=function(e,n,r){return this.__compiled__[n.toLowerCase()]?this.__compiled__[n.toLowerCase()].validate(e,r,this):0};gt.prototype.match=function(e){const n=[];let r=0;this.__index__>=0&&this.__text_cache__===e&&(n.push(pc(this,r)),r=this.__last_index__);let i=r?e.slice(r):e;for(;this.test(i);)n.push(pc(this,r)),i=i.slice(this.__last_index__),r+=this.__last_index__;return n.length?n:null};gt.prototype.matchAtStart=function(e){if(this.__text_cache__=e,this.__index__=-1,!e.length)return null;const n=this.re.schema_at_start.exec(e);if(!n)return null;const r=this.testSchemaAt(e,n[2],n[0].length);return r?(this.__schema__=n[2],this.__index__=n.index+n[1].length,this.__last_index__=n.index+n[0].length+r,pc(this,0)):null};gt.prototype.tlds=function(e,n){return e=Array.isArray(e)?e:[e],n?(this.__tlds__=this.__tlds__.concat(e).sort().filter(function(r,i,s){return r!==s[i-1]}).reverse(),Uo(this),this):(this.__tlds__=e.slice(),this.__tlds_replaced__=!0,Uo(this),this)};gt.prototype.normalize=function(e){e.schema||(e.url="http://"+e.url),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url="mailto:"+e.url)};gt.prototype.onCompile=function(){};const Jr=2147483647,Wt=36,Dd=1,ds=26,iC=38,sC=700,q1=72,W1=128,U1="-",oC=/^xn--/,aC=/[^\0-\x7F]/,uC=/[\x2E\u3002\uFF0E\uFF61]/g,lC={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},qu=Wt-Dd,Ut=Math.floor,Wu=String.fromCharCode;function Mn(t){throw new RangeError(lC[t])}function cC(t,e){const n=[];let r=t.length;for(;r--;)n[r]=e(t[r]);return n}function K1(t,e){const n=t.split("@");let r="";n.length>1&&(r=n[0]+"@",t=n[1]),t=t.replace(uC,".");const i=t.split("."),s=cC(i,e).join(".");return r+s}function J1(t){const e=[];let n=0;const r=t.length;for(;n<r;){const i=t.charCodeAt(n++);if(i>=55296&&i<=56319&&n<r){const s=t.charCodeAt(n++);(s&64512)==56320?e.push(((i&1023)<<10)+(s&1023)+65536):(e.push(i),n--)}else e.push(i)}return e}const dC=t=>String.fromCodePoint(...t),hC=function(t){return t>=48&&t<58?26+(t-48):t>=65&&t<91?t-65:t>=97&&t<123?t-97:Wt},Mp=function(t,e){return t+22+75*(t<26)-((e!=0)<<5)},G1=function(t,e,n){let r=0;for(t=n?Ut(t/sC):t>>1,t+=Ut(t/e);t>qu*ds>>1;r+=Wt)t=Ut(t/qu);return Ut(r+(qu+1)*t/(t+iC))},Y1=function(t){const e=[],n=t.length;let r=0,i=W1,s=q1,o=t.lastIndexOf(U1);o<0&&(o=0);for(let a=0;a<o;++a)t.charCodeAt(a)>=128&&Mn("not-basic"),e.push(t.charCodeAt(a));for(let a=o>0?o+1:0;a<n;){const u=r;for(let c=1,d=Wt;;d+=Wt){a>=n&&Mn("invalid-input");const h=hC(t.charCodeAt(a++));h>=Wt&&Mn("invalid-input"),h>Ut((Jr-r)/c)&&Mn("overflow"),r+=h*c;const f=d<=s?Dd:d>=s+ds?ds:d-s;if(h<f)break;const p=Wt-f;c>Ut(Jr/p)&&Mn("overflow"),c*=p}const l=e.length+1;s=G1(r-u,l,u==0),Ut(r/l)>Jr-i&&Mn("overflow"),i+=Ut(r/l),r%=l,e.splice(r++,0,i)}return String.fromCodePoint(...e)},Z1=function(t){const e=[];t=J1(t);const n=t.length;let r=W1,i=0,s=q1;for(const u of t)u<128&&e.push(Wu(u));const o=e.length;let a=o;for(o&&e.push(U1);a<n;){let u=Jr;for(const c of t)c>=r&&c<u&&(u=c);const l=a+1;u-r>Ut((Jr-i)/l)&&Mn("overflow"),i+=(u-r)*l,r=u;for(const c of t)if(c<r&&++i>Jr&&Mn("overflow"),c===r){let d=i;for(let h=Wt;;h+=Wt){const f=h<=s?Dd:h>=s+ds?ds:h-s;if(d<f)break;const p=d-f,m=Wt-f;e.push(Wu(Mp(f+p%m,0))),d=Ut(p/m)}e.push(Wu(Mp(d,0))),s=G1(i,l,a===o),i=0,++a}++i,++r}return e.join("")},fC=function(t){return K1(t,function(e){return oC.test(e)?Y1(e.slice(4).toLowerCase()):e})},pC=function(t){return K1(t,function(e){return aC.test(e)?"xn--"+Z1(e):e})},X1={version:"2.3.1",ucs2:{decode:J1,encode:dC},decode:Y1,encode:Z1,toASCII:pC,toUnicode:fC},mC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},gC={options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},bC={options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"“”‘’",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}},vC={default:mC,zero:gC,commonmark:bC},yC=/^(vbscript|javascript|file|data):/,_C=/^data:image\/(gif|png|jpeg|webp);/;function xC(t){const e=t.trim().toLowerCase();return yC.test(e)?_C.test(e):!0}const Q1=["http:","https:","mailto:"];function kC(t){const e=Cd(t,!0);if(e.hostname&&(!e.protocol||Q1.indexOf(e.protocol)>=0))try{e.hostname=X1.toASCII(e.hostname)}catch{}return ys(wd(e))}function wC(t){const e=Cd(t,!0);if(e.hostname&&(!e.protocol||Q1.indexOf(e.protocol)>=0))try{e.hostname=X1.toUnicode(e.hostname)}catch{}return si(wd(e),si.defaultChars+"%")}function ct(t,e){if(!(this instanceof ct))return new ct(t,e);e||Sd(t)||(e=t||{},t="default"),this.inline=new xs,this.block=new Va,this.core=new Ad,this.renderer=new ui,this.linkify=new gt,this.validateLink=xC,this.normalizeLink=kC,this.normalizeLinkText=wC,this.utils=E6,this.helpers=Ha({},T6),this.options={},this.configure(t),e&&this.set(e)}ct.prototype.set=function(t){return Ha(this.options,t),this};ct.prototype.configure=function(t){const e=this;if(Sd(t)){const n=t;if(t=vC[n],!t)throw new Error('Wrong `markdown-it` preset "'+n+'", 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(n){t.components[n].rules&&e[n].ruler.enableOnly(t.components[n].rules),t.components[n].rules2&&e[n].ruler2.enableOnly(t.components[n].rules2)}),this};ct.prototype.enable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.enable(t,!0))},this),n=n.concat(this.inline.ruler2.enable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to enable unknown rule(s): "+r);return this};ct.prototype.disable=function(t,e){let n=[];Array.isArray(t)||(t=[t]),["core","block","inline"].forEach(function(i){n=n.concat(this[i].ruler.disable(t,!0))},this),n=n.concat(this.inline.ruler2.disable(t,!0));const r=t.filter(function(i){return n.indexOf(i)<0});if(r.length&&!e)throw new Error("MarkdownIt. Failed to disable unknown rule(s): "+r);return this};ct.prototype.use=function(t){const e=[this].concat(Array.prototype.slice.call(arguments,1));return t.apply(t,e),this};ct.prototype.parse=function(t,e){if(typeof t!="string")throw new Error("Input data should be a String");const n=new this.core.State(t,this,e);return this.core.process(n),n.tokens};ct.prototype.render=function(t,e){return e=e||{},this.renderer.render(this.parse(t,e),this.options,e)};ct.prototype.parseInline=function(t,e){const n=new this.core.State(t,this,e);return n.inlineMode=!0,this.core.process(n),n.tokens};ct.prototype.renderInline=function(t,e){return e=e||{},this.renderer.render(this.parseInline(t,e),this.options,e)};const CC=new Zc({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:{code:!0,parseDOM:[{tag:"code"}],toDOM(){return["code"]}}}});function EC(t,e){if(t.isText&&e.isText&&re.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}class SC{constructor(e,n){this.schema=e,this.tokenHandlers=n,this.stack=[{type:e.topNodeType,attrs:null,content:[],marks:re.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 n=this.top(),r=n.content,i=r[r.length-1],s=this.schema.text(e,n.marks),o;i&&(o=EC(i,s))?r[r.length-1]=o:r.push(s)}openMark(e){let n=this.top();n.marks=e.addToSet(n.marks)}closeMark(e){let n=this.top();n.marks=e.removeFromSet(n.marks)}parseTokens(e){for(let n=0;n<e.length;n++){let r=e[n],i=this.tokenHandlers[r.type];if(!i)throw new Error("Token type `"+r.type+"` not supported by Markdown parser");i(this,r,e,n)}}addNode(e,n,r){let i=this.top(),s=e.createAndFill(n,r,i?i.marks:[]);return s?(this.push(s),s):null}openNode(e,n){this.stack.push({type:e,attrs:n,content:[],marks:re.none})}closeNode(){let e=this.stack.pop();return this.addNode(e.type,e.attrs,e.content)}}function vi(t,e,n,r){return t.getAttrs?t.getAttrs(e,n,r):t.attrs instanceof Function?t.attrs(e):t.attrs}function Uu(t,e){return t.noCloseToken||e=="code_inline"||e=="code_block"||e=="fence"}function Ap(t){return t[t.length-1]==`
|
|
106
|
+
`?t.slice(0,t.length-1):t}function Ku(){}function MC(t,e){let n=Object.create(null);for(let r in e){let i=e[r];if(i.block){let s=t.nodeType(i.block);Uu(i,r)?n[r]=(o,a,u,l)=>{o.openNode(s,vi(i,a,u,l)),o.addText(Ap(a.content)),o.closeNode()}:(n[r+"_open"]=(o,a,u,l)=>o.openNode(s,vi(i,a,u,l)),n[r+"_close"]=o=>o.closeNode())}else if(i.node){let s=t.nodeType(i.node);n[r]=(o,a,u,l)=>o.addNode(s,vi(i,a,u,l))}else if(i.mark){let s=t.marks[i.mark];Uu(i,r)?n[r]=(o,a,u,l)=>{o.openMark(s.create(vi(i,a,u,l))),o.addText(Ap(a.content)),o.closeMark(s)}:(n[r+"_open"]=(o,a,u,l)=>o.openMark(s.create(vi(i,a,u,l))),n[r+"_close"]=o=>o.closeMark(s))}else if(i.ignore)Uu(i,r)?n[r]=Ku:(n[r+"_open"]=Ku,n[r+"_close"]=Ku);else throw new RangeError("Unrecognized parsing spec "+JSON.stringify(i))}return n.text=(r,i)=>r.addText(i.content),n.inline=(r,i)=>r.parseTokens(i.children),n.softbreak=n.softbreak||(r=>r.addText(" ")),n}let AC=class{constructor(e,n,r){this.schema=e,this.tokenizer=n,this.tokens=r,this.tokenHandlers=MC(e,r)}parse(e,n={}){let r=new SC(this.schema,this.tokenHandlers),i;r.parseTokens(this.tokenizer.parse(e,n));do i=r.closeNode();while(r.stack.length);return i||this.schema.topNodeType.createAndFill()}};function Tp(t,e){for(;++e<t.length;)if(t[e].type!="list_item_open")return t[e].hidden;return!1}new AC(CC,ct("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(t,e,n)=>({tight:Tp(e,n)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,n)=>({order:+t.attrGet("start")||1,tight:Tp(e,n)})},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}});const TC={open:"",close:"",mixable:!0};let DC=class{constructor(e,n,r={}){this.nodes=e,this.marks=n,this.options=r}serialize(e,n={}){n=Object.assign({},this.options,n);let r=new eb(this.nodes,this.marks,n);return r.renderContent(e),r.out}};const Xt=new DC({blockquote(t,e){t.wrapBlock("> ",null,e,()=>t.renderContent(e))},code_block(t,e){const n=e.textContent.match(/`{3,}/gm),r=n?n.sort().slice(-1)[0]+"`":"```";t.write(r+(e.attrs.params||"")+`
|
|
107
107
|
`),t.text(e.textContent,!1),t.write(`
|
|
108
108
|
`),t.write(r),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 n=e.attrs.order||1,r=String(n+e.childCount-1).length,i=t.repeat(" ",r+2);t.renderList(e,i,s=>{let o=String(n+s);return t.repeat(" ",r-o.length)+o+". "})},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(`\\
|
|
109
|
-
`);return}},text(t,e){t.text(e.text,!t.inAutolink)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open(t,e,n,r){return t.inAutolink=
|
|
109
|
+
`);return}},text(t,e){t.text(e.text,!t.inAutolink)}},{em:{open:"*",close:"*",mixable:!0,expelEnclosingWhitespace:!0},strong:{open:"**",close:"**",mixable:!0,expelEnclosingWhitespace:!0},link:{open(t,e,n,r){return t.inAutolink=OC(e,n,r),t.inAutolink?"<":"["},close(t,e,n,r){let{inAutolink:i}=t;return t.inAutolink=void 0,i?">":"]("+e.attrs.href.replace(/[\(\)"]/g,"\\$&")+(e.attrs.title?` "${e.attrs.title.replace(/"/g,'\\"')}"`:"")+")"},mixable:!0},code:{open(t,e,n,r){return Dp(n.child(r),-1)},close(t,e,n,r){return Dp(n.child(r-1),1)},escape:!1}});function Dp(t,e){let n=/`+/g,r,i=0;if(t.isText)for(;r=n.exec(t.text);)i=Math.max(i,r[0].length);let s=i>0&&e>0?" `":"`";for(let o=0;o<i;o++)s+="`";return i>0&&e<0&&(s+=" "),s}function OC(t,e,n){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;let r=e.child(n);return!r.isText||r.text!=t.attrs.href||r.marks[r.marks.length-1]!=t?!1:n==e.childCount-1||!t.isInSet(e.child(n+1).marks)}let eb=class{constructor(e,n,r){this.nodes=e,this.marks=n,this.options=r,this.delim="",this.out="",this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,typeof this.options.tightLists>"u"&&(this.options.tightLists=!1),typeof this.options.hardBreakNodeName>"u"&&(this.options.hardBreakNodeName="hard_break")}flushClose(e=2){if(this.closed){if(this.atBlank()||(this.out+=`
|
|
110
110
|
`),e>1){let n=this.delim,r=/\s+$/.exec(n);r&&(n=n.slice(0,n.length-r[0].length));for(let i=1;i<e;i++)this.out+=n+`
|
|
111
|
-
`}this.closed=null}}getMark(e){let n=this.marks[e];if(!n){if(this.options.strict!==!1)throw new Error(`Mark type \`${e}\` not supported by Markdown renderer`);n=
|
|
111
|
+
`}this.closed=null}}getMark(e){let n=this.marks[e];if(!n){if(this.options.strict!==!1)throw new Error(`Mark type \`${e}\` not supported by Markdown renderer`);n=TC}return n}wrapBlock(e,n,r,i){let s=this.delim;this.write(n??e),this.delim+=e,i(),this.delim=s,this.closeBlock(r)}atBlank(){return/(^|\n)$/.test(this.out)}ensureNewLine(){this.atBlank()||(this.out+=`
|
|
112
112
|
`)}write(e){this.flushClose(),this.delim&&this.atBlank()&&(this.out+=this.delim),e&&(this.out+=e)}closeBlock(e){this.closed=e}text(e,n=!0){let r=e.split(`
|
|
113
113
|
`);for(let i=0;i<r.length;i++)this.write(),!n&&r[i][0]=="["&&/(^|[^\\])\!$/.test(this.out)&&(this.out=this.out.slice(0,this.out.length-1)+"\\!"),this.out+=n?this.esc(r[i],this.atBlockStart):r[i],i!=r.length-1&&(this.out+=`
|
|
114
|
-
`)}render(e,n,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,n,r);else{if(this.options.strict!==!1)throw new Error("Token type `"+e.type.name+"` not supported by Markdown renderer");e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}}renderContent(e){e.forEach((n,r,i)=>this.render(n,e,i))}renderInline(e,n=!0){this.atBlockStart=n;let r=[],i="",s=(o,a,u)=>{let l=o?o.marks:[];o&&o.type.name===this.options.hardBreakNodeName&&(l=l.filter(m=>{if(u+1==e.childCount)return!1;let g=e.child(u+1);return m.isInSet(g.marks)&&(!g.isText||/\S/.test(g.text))}));let c=i;if(i="",o&&o.isText&&l.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!m.isInSet(r)})){let[m,g,b]=/^(\s*)(.*)$/m.exec(o.text);g&&(c+=g,o=b?o.withText(b):null,o||(l=r))}if(o&&o.isText&&l.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!this.isMarkAhead(e,u+1,m)})){let[m,g,b]=/^(.*?)(\s*)$/m.exec(o.text);b&&(i=b,o=g?o.withText(g):null,o||(l=r))}let d=l.length?l[l.length-1]:null,h=d&&this.getMark(d.type.name).escape===!1,f=l.length-(h?1:0);e:for(let m=0;m<f;m++){let g=l[m];if(!this.getMark(g.type.name).mixable)break;for(let b=0;b<r.length;b++){let v=r[b];if(!this.getMark(v.type.name).mixable)break;if(g.eq(v)){m>b?l=l.slice(0,b).concat(g).concat(l.slice(b,m)).concat(l.slice(m+1,f)):b>m&&(l=l.slice(0,m).concat(l.slice(m+1,b)).concat(g).concat(l.slice(b,f)));continue e}}}let p=0;for(;p<Math.min(r.length,f)&&l[p].eq(r[p]);)++p;for(;p<r.length;)this.text(this.markString(r.pop(),!1,e,u),!1);if(c&&this.text(c),o){for(;r.length<f;){let m=l[r.length];r.push(m),this.text(this.markString(m,!0,e,u),!1),this.atBlockStart=!1}h&&o.isText?this.text(this.markString(d,!0,e,u)+o.text+this.markString(d,!1,e,u+1),!1):this.render(o,e,u),this.atBlockStart=!1}o?.isText&&o.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(s),s(null,0,e.childCount),this.atBlockStart=!1}renderList(e,n,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let i=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,s=this.inTightList;this.inTightList=i,e.forEach((o,a,u)=>{u&&i&&this.flushClose(1),this.wrapBlock(n,r(u),e,()=>this.render(o,e,u))}),this.inTightList=s}esc(e,n=!1){return e=e.replace(/[`*\\~\[\]_]/g,(r,i)=>r=="_"&&i>0&&i+1<e.length&&e[i-1].match(/\w/)&&e[i+1].match(/\w/)?r:"\\"+r),n&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").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 n=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return n[0]+e+n[1]}repeat(e,n){let r="";for(let i=0;i<n;i++)r+=e;return r}markString(e,n,r,i){let s=this.getMark(e.type.name),o=n?s.open:s.close;return typeof o=="string"?o:o(this,e,r,i)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,n,r){for(;;n++){if(n>=e.childCount)return!1;let i=e.child(n);if(i.type.name!=this.options.hardBreakNodeName)return r.isInSet(i.marks);n++}}};var
|
|
114
|
+
`)}render(e,n,r){if(this.nodes[e.type.name])this.nodes[e.type.name](this,e,n,r);else{if(this.options.strict!==!1)throw new Error("Token type `"+e.type.name+"` not supported by Markdown renderer");e.type.isLeaf||(e.type.inlineContent?this.renderInline(e):this.renderContent(e),e.isBlock&&this.closeBlock(e))}}renderContent(e){e.forEach((n,r,i)=>this.render(n,e,i))}renderInline(e,n=!0){this.atBlockStart=n;let r=[],i="",s=(o,a,u)=>{let l=o?o.marks:[];o&&o.type.name===this.options.hardBreakNodeName&&(l=l.filter(m=>{if(u+1==e.childCount)return!1;let g=e.child(u+1);return m.isInSet(g.marks)&&(!g.isText||/\S/.test(g.text))}));let c=i;if(i="",o&&o.isText&&l.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!m.isInSet(r)})){let[m,g,b]=/^(\s*)(.*)$/m.exec(o.text);g&&(c+=g,o=b?o.withText(b):null,o||(l=r))}if(o&&o.isText&&l.some(m=>{let g=this.getMark(m.type.name);return g&&g.expelEnclosingWhitespace&&!this.isMarkAhead(e,u+1,m)})){let[m,g,b]=/^(.*?)(\s*)$/m.exec(o.text);b&&(i=b,o=g?o.withText(g):null,o||(l=r))}let d=l.length?l[l.length-1]:null,h=d&&this.getMark(d.type.name).escape===!1,f=l.length-(h?1:0);e:for(let m=0;m<f;m++){let g=l[m];if(!this.getMark(g.type.name).mixable)break;for(let b=0;b<r.length;b++){let v=r[b];if(!this.getMark(v.type.name).mixable)break;if(g.eq(v)){m>b?l=l.slice(0,b).concat(g).concat(l.slice(b,m)).concat(l.slice(m+1,f)):b>m&&(l=l.slice(0,m).concat(l.slice(m+1,b)).concat(g).concat(l.slice(b,f)));continue e}}}let p=0;for(;p<Math.min(r.length,f)&&l[p].eq(r[p]);)++p;for(;p<r.length;)this.text(this.markString(r.pop(),!1,e,u),!1);if(c&&this.text(c),o){for(;r.length<f;){let m=l[r.length];r.push(m),this.text(this.markString(m,!0,e,u),!1),this.atBlockStart=!1}h&&o.isText?this.text(this.markString(d,!0,e,u)+o.text+this.markString(d,!1,e,u+1),!1):this.render(o,e,u),this.atBlockStart=!1}o?.isText&&o.nodeSize>0&&(this.atBlockStart=!1)};e.forEach(s),s(null,0,e.childCount),this.atBlockStart=!1}renderList(e,n,r){this.closed&&this.closed.type==e.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let i=typeof e.attrs.tight<"u"?e.attrs.tight:this.options.tightLists,s=this.inTightList;this.inTightList=i,e.forEach((o,a,u)=>{u&&i&&this.flushClose(1),this.wrapBlock(n,r(u),e,()=>this.render(o,e,u))}),this.inTightList=s}esc(e,n=!1){return e=e.replace(/[`*\\~\[\]_]/g,(r,i)=>r=="_"&&i>0&&i+1<e.length&&e[i-1].match(/\w/)&&e[i+1].match(/\w/)?r:"\\"+r),n&&(e=e.replace(/^(\+[ ]|[\-*>])/,"\\$&").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 n=e.indexOf('"')==-1?'""':e.indexOf("'")==-1?"''":"()";return n[0]+e+n[1]}repeat(e,n){let r="";for(let i=0;i<n;i++)r+=e;return r}markString(e,n,r,i){let s=this.getMark(e.type.name),o=n?s.open:s.close;return typeof o=="string"?o:o(this,e,r,i)}getEnclosingWhitespace(e){return{leading:(e.match(/^(\s+)/)||[void 0])[0],trailing:(e.match(/(\s+)$/)||[void 0])[0]}}isMarkAhead(e,n,r){for(;;n++){if(n>=e.childCount)return!1;let i=e.child(n);if(i.type.name!=this.options.hardBreakNodeName)return r.isInSet(i.marks);n++}}};var mc=!0,tb=!1,nb=!1,RC=function(t,e){e&&(mc=!e.enabled,tb=!!e.label,nb=!!e.labelAfter),t.core.ruler.after("inline","github-task-lists",function(n){for(var r=n.tokens,i=2;i<r.length;i++)FC(r,i)&&(IC(r[i],n.Token),Op(r[i-2],"class","task-list-item"+(mc?"":" enabled")),Op(r[NC(r,i-2)],"class","contains-task-list"))})};function Op(t,e,n){var r=t.attrIndex(e),i=[e,n];r<0?t.attrPush(i):t.attrs[r]=i}function NC(t,e){for(var n=t[e].level-1,r=e-1;r>=0;r--)if(t[r].level===n)return r;return-1}function FC(t,e){return zC(t[e])&&HC(t[e-1])&&jC(t[e-2])&&VC(t[e])}function IC(t,e){if(t.children.unshift(PC(t,e)),t.children[1].content=t.children[1].content.slice(3),t.content=t.content.slice(3),tb)if(nb){t.children.pop();var n="task-item-"+Math.ceil(Math.random()*(1e4*1e3)-1e3);t.children[0].content=t.children[0].content.slice(0,-1)+' id="'+n+'">',t.children.push($C(t.content,n,e))}else t.children.unshift(LC(e)),t.children.push(BC(e))}function PC(t,e){var n=new e("html_inline","",0),r=mc?' disabled="" ':"";return t.content.indexOf("[ ] ")===0?n.content='<input class="task-list-item-checkbox"'+r+'type="checkbox">':(t.content.indexOf("[x] ")===0||t.content.indexOf("[X] ")===0)&&(n.content='<input class="task-list-item-checkbox" checked=""'+r+'type="checkbox">'),n}function LC(t){var e=new t("html_inline","",0);return e.content="<label>",e}function BC(t){var e=new t("html_inline","",0);return e.content="</label>",e}function $C(t,e,n){var r=new n("html_inline","",0);return r.content='<label class="task-list-item-label" for="'+e+'">'+t+"</label>",r.attrs=[{for:e}],r}function zC(t){return t.type==="inline"}function HC(t){return t.type==="paragraph_open"}function jC(t){return t.type==="list_item_open"}function VC(t){return t.content.indexOf("[ ] ")===0||t.content.indexOf("[x] ")===0||t.content.indexOf("[X] ")===0}const qC=Vb(RC);var WC=Object.defineProperty,UC=(t,e,n)=>e in t?WC(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Ko=(t,e,n)=>(UC(t,typeof e!="symbol"?e+"":e,n),n);const KC=Le.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(){var t=this;return{toggleTight:function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return n=>{let{editor:r,commands:i}=n;function s(o){if(!r.isActive(o))return!1;const a=r.getAttributes(o);return i.updateAttributes(o,{tight:e??!(a!=null&&a.tight)})}return t.options.listTypes.some(o=>s(o))}}}}}),Rp=ct();function rb(t,e){return Rp.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new Rp.inline.State(t,null,null,[]).scanDelims(e,!0)}function ib(t,e,n,r){let i=t.substring(0,n)+t.substring(n+e.length);return i=i.substring(0,n+r)+e+i.substring(n+r),i}function JC(t,e,n,r){let i=n,s=t;for(;i<r&&!rb(s,i).can_open;)s=ib(s,e,i,1),i++;return{text:s,from:i,to:r}}function GC(t,e,n,r){let i=r,s=t;for(;i>n&&!rb(s,i).can_close;)s=ib(s,e,i,-1),i--;return{text:s,from:n,to:i}}function YC(t,e,n,r){let i={text:t,from:n,to:r};return i=JC(i.text,e,i.from,i.to),i=GC(i.text,e,i.from,i.to),i.to-i.from<e.length+1&&(i.text=i.text.substring(0,i.from)+i.text.substring(i.to+e.length)),i.text}class ZC extends eb{constructor(e,n,r){super(e,n,r??{}),Ko(this,"inTable",!1),this.inlines=[]}render(e,n,r){super.render(e,n,r);const i=this.inlines[this.inlines.length-1];if(i!=null&&i.start&&i!==null&&i!==void 0&&i.end){const{delimiter:s,start:o,end:a}=this.normalizeInline(i);this.out=YC(this.out,s,o,a),this.inlines.pop()}}markString(e,n,r,i){const s=this.marks[e.type.name];if(s.expelEnclosingWhitespace)if(n)this.inlines.push({start:this.out.length,delimiter:s.open});else{const o=this.inlines.pop();this.inlines.push({...o,end:this.out.length})}return super.markString(e,n,r,i)}normalizeInline(e){let{start:n,end:r}=e;for(;this.out.charAt(n).match(/\s/);)n++;return{...e,start:n}}}const sb=it.create({name:"markdownHTMLMark",addStorage(){return{markdown:{serialize:{open(t,e){var n,r;return this.editor.storage.markdown.options.html?(n=(r=Np(e))===null||r===void 0?void 0:r[0])!==null&&n!==void 0?n:"":(console.warn(`Tiptap Markdown: "${e.type.name}" mark is only available in html mode`),"")},close(t,e){var n,r;return this.editor.storage.markdown.options.html&&(n=(r=Np(e))===null||r===void 0?void 0:r[1])!==null&&n!==void 0?n:""}},parse:{}}}}});function Np(t){const e=t.type.schema,n=e.text(" ",[t]),i=vs(M.from(n),e).match(/^(<.*?>) (<\/.*?>)$/);return i?[i[1],i[2]]:null}function Od(t){const e=`<body>${t}</body>`;return new window.DOMParser().parseFromString(e,"text/html").body}function XC(t){return t?.replace(/</g,"<").replace(/>/g,">")}function QC(t){const e=t.parentElement,n=e.cloneNode();for(;e.firstChild&&e.firstChild!==t;)n.appendChild(e.firstChild);n.childNodes.length>0&&e.parentElement.insertBefore(n,e),e.parentElement.insertBefore(t,e),e.childNodes.length===0&&e.remove()}function eE(t){const e=t.parentNode;for(;t.firstChild;)e.insertBefore(t.firstChild,t);e.removeChild(t)}const Wa=te.create({name:"markdownHTMLNode",addStorage(){return{markdown:{serialize(t,e,n){this.editor.storage.markdown.options.html?t.write(tE(e,n)):(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 tE(t,e){const n=t.type.schema,r=vs(M.from(t),n);return t.isBlock&&(e instanceof M||e.type.name===n.topNodeType.name)?nE(r):r}function nE(t){const n=Od(t).firstElementChild;return n.innerHTML=n.innerHTML.trim()?`
|
|
115
115
|
${n.innerHTML}
|
|
116
116
|
`:`
|
|
117
|
-
`,n.outerHTML}const
|
|
118
|
-
`),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:(e=this.options.languageClassPrefix)!==null&&e!==void 0?e:"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}}}}),
|
|
119
|
-
`);return}},parse:{}}}}}),
|
|
117
|
+
`,n.outerHTML}const rE=te.create({name:"blockquote"}),iE=rE.extend({addStorage(){return{markdown:{serialize:Xt.nodes.blockquote,parse:{}}}}}),sE=te.create({name:"bulletList"}),ob=sE.extend({addStorage(){return{markdown:{serialize(t,e){return t.renderList(e," ",()=>(this.editor.storage.markdown.options.bulletListMarker||"-")+" ")},parse:{}}}}}),oE=te.create({name:"codeBlock"}),aE=oE.extend({addStorage(){return{markdown:{serialize(t,e){t.write("```"+(e.attrs.language||"")+`
|
|
118
|
+
`),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){var e;t.set({langPrefix:(e=this.options.languageClassPrefix)!==null&&e!==void 0?e:"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replace(/\n<\/code><\/pre>/g,"</code></pre>")}}}}}}),uE=te.create({name:"hardBreak"}),ab=uE.extend({addStorage(){return{markdown:{serialize(t,e,n,r){for(let i=r+1;i<n.childCount;i++)if(n.child(i).type!=e.type){t.write(t.inTable?Wa.storage.markdown.serialize.call(this,t,e,n):`\\
|
|
119
|
+
`);return}},parse:{}}}}}),lE=te.create({name:"heading"}),cE=lE.extend({addStorage(){return{markdown:{serialize:Xt.nodes.heading,parse:{}}}}}),dE=te.create({name:"horizontalRule"}),hE=dE.extend({addStorage(){return{markdown:{serialize:Xt.nodes.horizontal_rule,parse:{}}}}}),fE=te.create({name:"image"}),pE=fE.extend({addStorage(){return{markdown:{serialize:Xt.nodes.image,parse:{}}}}}),mE=te.create({name:"listItem"}),gE=mE.extend({addStorage(){return{markdown:{serialize:Xt.nodes.list_item,parse:{}}}}}),bE=te.create({name:"orderedList"});function vE(t,e,n){let r=0;for(;n-r>0&&e.child(n-r-1).type.name===t.type.name;r++);return r}const yE=bE.extend({addStorage(){return{markdown:{serialize(t,e,n,r){const i=e.attrs.start||1,s=String(i+e.childCount-1).length,o=t.repeat(" ",s+2),u=vE(e,n,r)%2?") ":". ";t.renderList(e,o,l=>{const c=String(i+l);return t.repeat(" ",s-c.length)+c+u})},parse:{}}}}}),_E=te.create({name:"paragraph"}),xE=_E.extend({addStorage(){return{markdown:{serialize:Xt.nodes.paragraph,parse:{}}}}});function Ju(t){var e,n;return(e=t==null||(n=t.content)===null||n===void 0?void 0:n.content)!==null&&e!==void 0?e:[]}const kE=te.create({name:"table"}),wE=kE.extend({addStorage(){return{markdown:{serialize(t,e,n){if(!CE(e)){Wa.storage.markdown.serialize.call(this,t,e,n);return}t.inTable=!0,e.forEach((r,i,s)=>{if(t.write("| "),r.forEach((o,a,u)=>{u&&t.write(" | ");const l=o.firstChild;l.textContent.trim()&&t.renderInline(l)}),t.write(" |"),t.ensureNewLine(),!s){const o=Array.from({length:r.childCount}).map(()=>"---").join(" | ");t.write(`| ${o} |`),t.ensureNewLine()}}),t.closeBlock(e),t.inTable=!1},parse:{}}}}});function Fp(t){return t.attrs.colspan>1||t.attrs.rowspan>1}function CE(t){const e=Ju(t),n=e[0],r=e.slice(1);return!(Ju(n).some(i=>i.type.name!=="tableHeader"||Fp(i)||i.childCount>1)||r.some(i=>Ju(i).some(s=>s.type.name==="tableHeader"||Fp(s)||s.childCount>1)))}const EE=te.create({name:"taskItem"}),SE=EE.extend({addStorage(){return{markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){[...t.querySelectorAll(".task-list-item")].forEach(e=>{const n=e.querySelector("input");e.setAttribute("data-type","taskItem"),n&&(e.setAttribute("data-checked",n.checked),n.remove())})}}}}}}),ME=te.create({name:"taskList"}),AE=ME.extend({addStorage(){return{markdown:{serialize:ob.storage.markdown.serialize,parse:{setup(t){t.use(qC)},updateDOM(t){[...t.querySelectorAll(".contains-task-list")].forEach(e=>{e.setAttribute("data-type","taskList")})}}}}}}),TE=te.create({name:"text"}),DE=TE.extend({addStorage(){return{markdown:{serialize(t,e){t.text(XC(e.text))},parse:{}}}}}),OE=it.create({name:"bold"}),RE=OE.extend({addStorage(){return{markdown:{serialize:Xt.marks.strong,parse:{}}}}}),NE=it.create({name:"code"}),FE=NE.extend({addStorage(){return{markdown:{serialize:Xt.marks.code,parse:{}}}}}),IE=it.create({name:"italic"}),PE=IE.extend({addStorage(){return{markdown:{serialize:Xt.marks.em,parse:{}}}}}),LE=it.create({name:"link"}),BE=LE.extend({addStorage(){return{markdown:{serialize:Xt.marks.link,parse:{}}}}}),$E=it.create({name:"strike"}),zE=$E.extend({addStorage(){return{markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}}}}),HE=[iE,ob,aE,ab,cE,hE,Wa,pE,gE,yE,xE,wE,SE,AE,DE,RE,FE,sb,PE,BE,zE];function Jo(t){var e,n;const r=(e=t.storage)===null||e===void 0?void 0:e.markdown,i=(n=HE.find(s=>s.name===t.name))===null||n===void 0?void 0:n.storage.markdown;return r||i?{...i,...r}:null}class jE{constructor(e){Ko(this,"editor",null),this.editor=e}serialize(e){const n=new ZC(this.nodes,this.marks,{hardBreakNodeName:ab.name});return n.renderContent(e),n.out}get nodes(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.nodes).map(n=>[n,this.serializeNode(Wa)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="node"&&this.serializeNode(n)).map(n=>[n.name,this.serializeNode(n)]))!==null&&e!==void 0?e:[])}}get marks(){var e;return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map(n=>[n,this.serializeMark(sb)])),...Object.fromEntries((e=this.editor.extensionManager.extensions.filter(n=>n.type==="mark"&&this.serializeMark(n)).map(n=>[n.name,this.serializeMark(n)]))!==null&&e!==void 0?e:[])}}serializeNode(e){var n;return(n=Jo(e))===null||n===void 0||(n=n.serialize)===null||n===void 0?void 0:n.bind({editor:this.editor,options:e.options})}serializeMark(e){var n;const r=(n=Jo(e))===null||n===void 0?void 0:n.serialize;return r?{...r,open:typeof r.open=="function"?r.open.bind({editor:this.editor,options:e.options}):r.open,close:typeof r.close=="function"?r.close.bind({editor:this.editor,options:e.options}):r.close}:null}}class VE{constructor(e,n){Ko(this,"editor",null),Ko(this,"md",null);let{html:r,linkify:i,breaks:s}=n;this.editor=e,this.md=this.withPatchedRenderer(ct({html:r,linkify:i,breaks:s}))}parse(e){let{inline:n}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e=="string"){this.editor.extensionManager.extensions.forEach(s=>{var o;return(o=Jo(s))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.setup)===null||o===void 0?void 0:o.call({editor:this.editor,options:s.options},this.md)});const r=this.md.render(e),i=Od(r);return this.editor.extensionManager.extensions.forEach(s=>{var o;return(o=Jo(s))===null||o===void 0||(o=o.parse)===null||o===void 0||(o=o.updateDOM)===null||o===void 0?void 0:o.call({editor:this.editor,options:s.options},i)}),this.normalizeDOM(i,{inline:n,content:e}),i.innerHTML}return e}normalizeDOM(e,n){let{inline:r,content:i}=n;return this.normalizeBlocks(e),e.querySelectorAll("*").forEach(s=>{var o;((o=s.nextSibling)===null||o===void 0?void 0:o.nodeType)===Node.TEXT_NODE&&!s.closest("pre")&&(s.nextSibling.textContent=s.nextSibling.textContent.replace(/^\n/,""))}),r&&this.normalizeInline(e,i),e}normalizeBlocks(e){const r=Object.values(this.editor.schema.nodes).filter(i=>i.isBlock).map(i=>{var s;return(s=i.spec.parseDOM)===null||s===void 0?void 0:s.map(o=>o.tag)}).flat().filter(Boolean).join(",");r&&[...e.querySelectorAll(r)].forEach(i=>{i.parentElement.matches("p")&&QC(i)})}normalizeInline(e,n){var r;if((r=e.firstElementChild)!==null&&r!==void 0&&r.matches("p")){var i,s,o,a;const u=e.firstElementChild,{nextElementSibling:l}=u,c=(i=(s=n.match(/^\s+/))===null||s===void 0?void 0:s[0])!==null&&i!==void 0?i:"",d=l?"":(o=(a=n.match(/\s+$/))===null||a===void 0?void 0:a[0])!==null&&o!==void 0?o:"";if(n.match(/^\n\n/)){u.innerHTML=`${u.innerHTML}${d}`;return}eE(u),e.innerHTML=`${c}${e.innerHTML}${d}`}}withPatchedRenderer(e){const n=r=>function(){const i=r(...arguments);return i===`
|
|
120
120
|
`?i:i[i.length-1]===`
|
|
121
|
-
`?i.slice(0,-1):i};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const
|
|
121
|
+
`?i.slice(0,-1):i};return e.renderer.rules.hardbreak=n(e.renderer.rules.hardbreak),e.renderer.rules.softbreak=n(e.renderer.rules.softbreak),e.renderer.rules.fence=n(e.renderer.rules.fence),e.renderer.rules.code_block=n(e.renderer.rules.code_block),e.renderer.renderToken=n(e.renderer.renderToken.bind(e.renderer)),e}}const qE=Le.create({name:"markdownClipboard",addOptions(){return{transformPastedText:!1,transformCopiedText:!1}},addProseMirrorPlugins(){return[new we({key:new Be("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const r=this.editor.storage.markdown.parser.parse(t,{inline:!0});return mn.fromSchema(this.editor.schema).parseSlice(Od(r),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}}),WE=Le.create({name:"markdown",priority:50,addOptions(){return{html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}},addCommands(){const t=Nw.Commands.config.addCommands();return{setContent:(e,n,r)=>i=>t.setContent(i.editor.storage.markdown.parser.parse(e),n,r)(i),insertContentAt:(e,n,r)=>i=>t.insertContentAt(e,i.editor.storage.markdown.parser.parse(n,{inline:!0}),r)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new VE(this.editor,this.options),serializer:new jE(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[KC.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),qE.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}}),UE=/^\s*>\s$/,KE=te.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",ge(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[as({find:UE,type:this.type})]}}),JE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,GE=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,YE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ZE=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,XE=it.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",ge(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[ii({find:JE,type:this.type}),ii({find:YE,type:this.type})]},addPasteRules(){return[yr({find:GE,type:this.type}),yr({find:ZE,type:this.type})]}}),QE="listItem",Ip="textStyle",Pp=/^\s*([-+*])\s$/,eS=te.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",ge(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(QE,this.editor.getAttributes(Ip)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=as({find:Pp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=as({find:Pp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ip),editor:this.editor})),[t]}}),tS=/(^|[^`])`([^`]+)`(?!`)/,nS=/(^|[^`])`([^`]+)`(?!`)/g,rS=it.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({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[ii({find:tS,type:this.type})]},addPasteRules(){return[yr({find:nS,type:this.type})]}}),iS=/^```([a-z]+)?[\s\n]$/,sS=/^~~~([a-z]+)?[\s\n]$/,oS=te.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;const{languageClassPrefix:n}=this.options,s=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return s||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ge(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:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const s=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
|
|
122
122
|
|
|
123
|
-
`);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:l})=>(l.setSelection(q.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[
|
|
124
|
-
`));return o.replaceSelectionWith(this.type.create({language:s},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(H.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),
|
|
125
|
-
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:c})=>{if(c&&u&&o){const d=u.filter(h=>a.includes(h.type.name));l.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),lS=te.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]}`,ge(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)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>uc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Jo=200,Ie=function(){};Ie.prototype.append=function(e){return e.length?(e=Ie.from(e),!this.length&&e||e.length<Jo&&this.leafAppend(e)||this.length<Jo&&e.leafPrepend(this)||this.appendInner(e)):this};Ie.prototype.prepend=function(e){return e.length?Ie.from(e).append(this):this};Ie.prototype.appendInner=function(e){return new cS(this,e)};Ie.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ie.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ie.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ie.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ie.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Ie.from=function(e){return e instanceof Ie?e:e&&e.length?new sb(e):Ie.empty};var sb=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var u=s;u<o;u++)if(i(this.values[u],a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var u=s-1;u>=o;u--)if(i(this.values[u],a+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Jo)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Jo)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ie);Ie.empty=new sb([]);var cS=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(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(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ie);const dS=500;class Nt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,u,l=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new Pt(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],l.push(new Pt(p,void 0,void 0,l.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,u=new Nt(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,u=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new Pt(e.mapping.maps[c],d,n),f;(f=u&&u.merge(h))&&(h=f,c?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(u=h)}let l=o-r.depth;return l>fS&&(a=hS(a,l),o-=l),new Nt(a.append(s),o)}remapping(e,n){let r=new Xi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Nt(this.items.append(e.map(n=>new Pt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let u=n;this.items.forEach(h=>{let f=s.getMirror(--u);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(u+1,f));g&&a++,r.push(new Pt(p,m,g))}else r.push(new Pt(p))},i);let l=[];for(let h=n;h<o;h++)l.push(new Pt(s.maps[h]));let c=this.items.slice(0,i).append(l).append(r),d=new Nt(c,a);return d.emptyItemCount()>dS&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let u=o.step.map(n.slice(r)),l=u&&u.getMap();if(r--,l&&n.appendMap(l,r),u){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let d=new Pt(l.invert(),u,c),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new Nt(Ie.from(i.reverse()),s)}}Nt.empty=new Nt(Ie.empty,0);function hS(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Pt{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Pt(n.getMap().invert(),n,this.selection)}}}class Mn{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const fS=20;function pS(t,e,n,r){let i=n.getMeta(hr),s;if(i)return i.historyState;n.getMeta(bS)&&(t=new Mn(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(hr))return o.getMeta(hr).redo?new Mn(t.done.addTransform(n,void 0,r,no(e)),t.undone,Fp(n.mapping.maps),t.prevTime,t.prevComposition):new Mn(t.done,t.undone.addTransform(n,void 0,r,no(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!mS(n,t.prevRanges)),l=o?Ku(t.prevRanges,n.mapping):Fp(n.mapping.maps);return new Mn(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,no(e)),Nt.empty,l,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new Mn(t.done.rebased(n,s),t.undone.rebased(n,s),Ku(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Mn(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Ku(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function mS(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Fp(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function Ku(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function gS(t,e,n){let r=no(e),i=hr.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new Mn(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(hr,{redo:n,historyState:u})}let Ju=!1,Ip=null;function no(t){let e=t.plugins;if(Ip!=e){Ju=!1,Ip=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Ju=!0;break}}return Ju}const hr=new Be("history"),bS=new Be("closeHistory");function vS(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new we({key:hr,state:{init(){return new Mn(Nt.empty,Nt.empty,null,0,-1)},apply(e,n,r){return pS(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?ab:r=="historyRedo"?ub:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function ob(t,e){return(n,r)=>{let i=hr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=gS(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const ab=ob(!1,!0),ub=ob(!0,!0),yS=Le.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>ab(t,e),redo:()=>({state:t,dispatch:e})=>ub(t,e)}},addProseMirrorPlugins(){return[vS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),_S=te.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ge(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Sw(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):tw(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:a})=>{var u;if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(z.create(o.doc,l.pos)):o.setSelection(H.create(o.doc,l.pos));else{const d=(u=l.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();d&&(o.insert(c,d),o.setSelection(H.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[C1({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),xS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,kS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,wS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,CS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,ES=it.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",ge(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[ri({find:xS,type:this.type}),ri({find:wS,type:this.type})]},addPasteRules(){return[vr({find:kS,type:this.type}),vr({find:CS,type:this.type})]}}),SS=te.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ge(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)}}}),MS="listItem",Pp="textStyle",Lp=/^(\d+)\.\s$/,AS=te.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:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ge(this.options.HTMLAttributes,n),0]:["ol",ge(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(MS,this.editor.getAttributes(Pp)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=ss({find:Lp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=ss({find:Lp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Pp)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),lb=te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),TS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,DS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,OS=it.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",ge(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[ri({find:TS,type:this.type})]},addPasteRules(){return[vr({find:DS,type:this.type})]}}),RS=te.create({name:"text",group:"inline"}),NS=Le.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(HE.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(PE.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(VE.configure(this.options.bulletList)),this.options.code!==!1&&t.push(UE.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(GE.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(YE.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(QE.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(aS.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(uS.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(lS.configure(this.options.heading)),this.options.history!==!1&&t.push(yS.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(_S.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(ES.configure(this.options.italic)),this.options.listItem!==!1&&t.push(SS.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(AS.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(lb.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(OS.configure(this.options.strike)),this.options.text!==!1&&t.push(RS.configure(this.options.text)),t}});let pc,mc;if(typeof WeakMap<"u"){let t=new WeakMap;pc=e=>t.get(e),mc=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;pc=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},mc=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var xe=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==n;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:a,top:u,bottom:l}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,u),right:Math.max(r,a),bottom:Math.max(s,l)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(t){return pc(t)||mc(t,FS(t))}};function FS(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=IS(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let l=0,c=e*n;l<c;l++)r[l]=0;for(let l=0,c=0;l<n;l++){const d=t.child(l);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:b,colwidth:v}=m.attrs;for(let _=0;_<b;_++){if(_+l>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:b-_});break}const x=i+_*e;for(let y=0;y<g;y++){r[x+y]==0?r[x+y]=c:(s||(s=[])).push({type:"collision",row:l,pos:c,n:g-y});const w=v&&v[y];if(w){const C=(x+y)%e*2,k=o[C];k==null||k!=w&&o[C+1]==1?(o[C]=w,o[C+1]=1):k==w&&o[C+1]++}}}i+=g,c+=m.nodeSize}const h=(l+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:l,n:f}),c++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new xe(e,n,r,s);let u=!1;for(let l=0;!u&&l<o.length;l+=2)o[l]!=null&&o[l+1]<n&&(u=!0);return u&&PS(a,o,t),a}function IS(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let u=0;u<a.childCount;u++){const l=a.child(u);o+l.attrs.rowspan>r&&(s+=l.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function PS(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const u=o.attrs;for(let l=0;l<u.colspan;l++){const c=e[(i+l)%t.width*2];c!=null&&(!u.colwidth||u.colwidth[l]!=c)&&((a||(a=LS(u)))[l]=c)}a&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function LS(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Ge(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Rn=new Be("selectingCells");function yr(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function BS(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function It(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Wa(t){const 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;const n=yr(e.$head)||$S(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function $S(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function gc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function zS(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Dd(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function cb(t,e,n){const r=t.node(-1),i=xe.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function _r(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function db(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function HS(t,e,n){const r=Ge(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var ue=class on extends q{constructor(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),a=e.node(0),u=i.cellsInRect(o).filter(c=>c!=n.pos-s);u.unshift(n.pos-s);const l=u.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const h=s+c+1;return new og(a.resolve(h),a.resolve(h+d.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(gc(r)&&gc(i)&&Dd(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?on.rowSelection(r,i):s&&this.isColSelection()?on.colSelection(r,i):new on(r,i)}return H.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let u=i.top;u<i.bottom;u++){const l=[];for(let c=u*n.width+i.left,d=i.left;d<i.right;d++,c++){const h=n.map[c];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const m=i.left-f.left,g=f.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=_r(b,0,m)),g>0&&(b=_r(b,b.colspan-g,g)),f.left<i.left){if(p=p.type.createAndFill(b),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(f.top<i.top||f.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}l.push(p)}o.push(e.child(u).copy(M.from(l)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new R(M.from(a),1,1)}replace(e,n=R.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:u}=i[o],l=e.mapping.slice(r);e.replace(l.map(a.pos),l.map(u.pos),o?R.empty:n)}const s=q.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new R(M.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=xe.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),u=e.node(0);return o.top<=a.top?(o.top>0&&(e=u.resolve(s+i.map[o.left])),a.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=u.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new on(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof on&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),u=e.node(0);return o.left<=a.left?(o.left>0&&(e=u.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(n=u.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=u.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=u.resolve(s+i.map[i.width*(o.top+1)-1]))),new on(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new on(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new on(e.resolve(n),e.resolve(r))}getBookmark(){return new jS(this.$anchorCell.pos,this.$headCell.pos)}};ue.prototype.visible=!1;q.jsonID("cell",ue);var jS=class hb{constructor(e,n){this.anchor=e,this.head=n}map(e){return new hb(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Dd(n,r)?new ue(n,r):q.near(r,1)}};function VS(t){if(!(t.selection instanceof ue))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(tt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ye.create(t.doc,e)}function qS({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function WS({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function US(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof z&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=ue.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=ue.rowSelection(a,a)}else if(!n){const a=xe.get(r.node),u=r.from+1,l=u+a.map[a.width*a.height-1];s=ue.create(i,u+1,l)}}else r instanceof H&&qS(r)?s=H.create(i,r.from):r instanceof H&&WS(r)&&(s=H.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const KS=new Be("fix-tables");function fb(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const u=e.child(o);for(let l=a,c=Math.min(i,o+3);l<c;l++)if(t.child(l)==u){a=l+1,n+=u.nodeSize;continue e}r(u,n),a<i&&t.child(a).sameMarkup(u)?fb(t.child(a),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function pb(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=JS(t,i,s,n))};return e?e.doc!=t.doc&&fb(e.doc,t.doc,0,r):t.doc.descendants(r),n}function JS(t,e,n,r){const i=xe.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const l=i.problems[u];if(l.type=="collision"){const c=e.nodeAt(l.pos);if(!c)continue;const d=c.attrs;for(let h=0;h<d.rowspan;h++)s[l.row+h]+=l.n;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,_r(d,d.colspan-l.n,l.n))}else if(l.type=="missing")s[l.row]+=l.n;else if(l.type=="overlong_rowspan"){const c=e.nodeAt(l.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-l.n})}else if(l.type=="colwidth mismatch"){const c=e.nodeAt(l.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,{...c.attrs,colwidth:l.colwidth})}else if(l.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let o,a;for(let u=0;u<s.length;u++)s[u]&&(o==null&&(o=u),a=u);for(let u=0,l=n+1;u<i.height;u++){const c=e.child(u),d=l+c.nodeSize,h=s[u];if(h>0){let f="cell";c.firstChild&&(f=c.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const b=Ge(t.schema)[f].createAndFill();b&&p.push(b)}const m=(u==0||o==u-1)&&a==u?l+1:d-1;r.insert(r.mapping.map(m),p)}l=d}return r.setMeta(KS,{fixTables:!0})}function Xt(t){const e=t.selection,n=Wa(t),r=n.node(-1),i=n.start(-1),s=xe.get(r);return{...e instanceof ue?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function mb(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;HS(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const u=e.map[a],l=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,db(l.attrs,i-e.colCount(u))),o+=l.attrs.rowspan-1}else{const u=s==null?Ge(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,l=e.positionAt(o,i,r);t.insert(t.mapping.map(n+l),u.createAndFill())}}return t}function GS(t,e){if(!It(t))return!1;if(e){const n=Xt(t);e(mb(t.tr,n,n.left))}return!0}function YS(t,e){if(!It(t))return!1;if(e){const n=Xt(t);e(mb(t.tr,n,n.right))}return!0}function ZS(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,u=e.map[a],l=n.nodeAt(u),c=l.attrs;if(i>0&&e.map[a-1]==u||i<e.width-1&&e.map[a+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,_r(c,i-e.colCount(u)));else{const d=t.mapping.slice(s).map(r+u);t.delete(d,d+l.nodeSize)}o+=c.rowspan}}function XS(t,e){if(!It(t))return!1;if(e){const n=Xt(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;ZS(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=xe.get(s)}e(r)}return!0}function QS(t,e,n){var r;const i=Ge(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function gb(t,{map:e,tableStart:n,table:r},i){let s=n;for(let l=0;l<i;l++)s+=r.child(l).nodeSize;const o=[];let a=i>0?-1:0;QS(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let l=0,c=e.width*i;l<e.width;l++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],h=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),l+=h.colspan-1}else{var u;const d=a==null?Ge(r.type.schema).cell:(u=r.nodeAt(e.map[c+a*e.width]))===null||u===void 0?void 0:u.type,h=d?.createAndFill();h&&o.push(h)}return t.insert(s,Ge(r.type.schema).row.create(null,o)),t}function e8(t,e){if(!It(t))return!1;if(e){const n=Xt(t);e(gb(t.tr,n,n.top))}return!0}function t8(t,e){if(!It(t))return!1;if(e){const n=Xt(t);e(gb(t.tr,n,n.bottom))}return!0}function n8(t,{map:e,table:n,tableStart:r},i){let s=0;for(let l=0;l<i;l++)s+=n.child(l).nodeSize;const o=s+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(s+r,o+r);const u=new Set;for(let l=0,c=i*e.width;l<e.width;l++,c++){const d=e.map[c];if(!u.has(d)){if(u.add(d),i>0&&d==e.map[c-e.width]){const h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),l+=h.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),m=e.positionAt(i+1,l,n);t.insert(t.mapping.slice(a).map(r+m),p),l+=f.colspan-1}}}}function r8(t,e){if(!It(t))return!1;if(e){const n=Xt(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;n8(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=xe.get(n.table)}e(r)}return!0}function Bp(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function i8({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[a]==n[a+1])return!0;s+=t,a+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function $p(t,e){const n=t.selection;if(!(n instanceof ue)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Xt(t),{map:i}=r;if(i8(i,r))return!1;if(e){const s=t.tr,o={};let a=M.empty,u,l;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const h=i.map[c*i.width+d],f=r.table.nodeAt(h);if(!(o[h]||!f))if(o[h]=!0,u==null)u=h,l=f;else{Bp(f)||(a=a.append(f.content));const p=s.mapping.map(h+r.tableStart);s.delete(p,p+f.nodeSize)}}if(u==null||l==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...db(l.attrs,l.attrs.colspan,r.right-r.left-l.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const c=u+1+l.content.size,d=Bp(l)?u+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,a)}s.setSelection(new ue(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function zp(t,e){const n=Ge(t.schema);return s8(({node:r})=>n[r.type.spec.tableRole])(t,e)}function s8(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof ue){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=BS(r.$from),!i)return!1;s=(o=yr(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const u=[],l=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const c=Xt(e),d=e.tr;for(let f=0;f<c.right-c.left;f++)u.push(l?{...a,colwidth:l&&l[f]?[l[f]]:null}:a);let h;for(let f=c.top;f<c.bottom;f++){let p=c.map.positionAt(f,c.left,c.table);f==c.top&&(p+=i.nodeSize);for(let m=c.left,g=0;m<c.right;m++,g++)m==c.left&&f==c.top||d.insert(h=d.mapping.map(p+c.tableStart,1),t({node:i,row:f,col:m}).createAndFill(u[g]))}d.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),u[0]),r instanceof ue&&d.setSelection(new ue(d.doc.resolve(r.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function o8(t,e){return function(n,r){if(!It(n))return!1;const i=Wa(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof ue?n.selection.forEachCell((o,a)=>{o.attrs[t]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function a8(t){return function(e,n){if(!It(e))return!1;if(n){const r=Ge(e.schema),i=Xt(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(u=>i.table.nodeAt(u));for(let u=0;u<o.length;u++)a[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[u],r.cell,a[u].attrs);if(s.steps.length===0)for(let u=0;u<o.length;u++)s.setNodeMarkup(i.tableStart+o[u],r.header_cell,a[u].attrs);n(s)}return!0}}function Hp(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function ds(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?a8(t):function(n,r){if(!It(n))return!1;if(r){const i=Ge(n.schema),s=Xt(n),o=n.tr,a=Hp("row",s,i),u=Hp("column",s,i),l=(t==="column"?a:t==="row"&&u)?1:0,c=t=="column"?{left:0,top:l,right:1,bottom:s.map.height}:t=="row"?{left:l,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?u?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(h=>{const f=h+s.tableStart,p=o.doc.nodeAt(f);p&&o.setNodeMarkup(f,d,p.attrs)}),r(o)}return!0}}ds("row",{useDeprecatedLogic:!0});ds("column",{useDeprecatedLogic:!0});const u8=ds("cell",{useDeprecatedLogic:!0});function l8(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function jp(t){return function(e,n){if(!It(e))return!1;const r=l8(Wa(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(H.between(i,zS(i))).scrollIntoView())}return!0}}function c8(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function Hs(t,e){const n=t.selection;if(!(n instanceof ue))return!1;if(e){const r=t.tr,i=Ge(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new R(i,0,0))}),r.docChanged&&e(r)}return!0}function d8(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let u=0;u<e.childCount;u++){let l=e.child(u).content;const c=u?0:Math.max(0,n-1),d=u<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(l=bc(Ge(o).row,new R(l,c,d)).content),a.push(l)}else if(s=="cell"||s=="header_cell")a.push(n||r?bc(Ge(o).row,new R(e,n,r)).content:e);else return null;return h8(o,a)}function h8(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:u}=s.child(o).attrs;for(let l=i;l<i+a;l++)n[l]=(n[l]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(M.empty),n[i]<r){const s=Ge(t).cell.createAndFill(),o=[];for(let a=n[i];a<r;a++)o.push(s);e[i]=e[i].append(M.from(o))}return{height:e.length,width:r,rows:e}}function bc(t,e){const n=t.createAndFill();return new Xc(n).replace(0,n.content.size,e).doc}function f8({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let a=0;a<n.length;a++){const u=n[a],l=[];for(let c=s[a]||0,d=0;c<r;d++){let h=u.child(d%u.childCount);c+h.attrs.colspan>r&&(h=h.type.createChecked(_r(h.attrs,h.attrs.colspan,c+h.attrs.colspan-r),h.content)),l.push(h),c+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(M.from(l))}n=o,t=r}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const u=[],l=n[a%e];for(let c=0;c<l.childCount;c++){let d=l.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),u.push(d)}s.push(M.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function p8(t,e,n,r,i,s,o){const a=t.doc.type.schema,u=Ge(a);let l,c;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==u.cell?m=l||(l=u.cell.createAndFill()):m=c||(c=u.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);t.insert(t.mapping.slice(o).map(h-1+r),p)}if(s>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==u.header_cell;d.push(g?c||(c=u.header_cell.createAndFill()):l||(l=u.cell.createAndFill()))}const h=u.row.create(null,M.from(d)),f=[];for(let p=e.height;p<s;p++)f.push(h);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||c)}function Vp(t,e,n,r,i,s,o,a){if(o==0||o==e.height)return!1;let u=!1;for(let l=i;l<s;l++){const c=o*e.width+l,d=e.map[c];if(e.map[c-e.width]==d){u=!0;const h=n.nodeAt(d),{top:f,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:o-f}),t.insert(t.mapping.slice(a).map(e.positionAt(o,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),l+=h.attrs.colspan-1}}return u}function qp(t,e,n,r,i,s,o,a){if(o==0||o==e.width)return!1;let u=!1;for(let l=i;l<s;l++){const c=l*e.width+o,d=e.map[c];if(e.map[c-1]==d){u=!0;const h=n.nodeAt(d),f=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,_r(h.attrs,o-f,h.attrs.colspan-(o-f))),t.insert(p+h.nodeSize,h.type.createAndFill(_r(h.attrs,0,o-f))),l+=h.attrs.rowspan-1}}return u}function Wp(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=xe.get(s);const{top:a,left:u}=r,l=u+i.width,c=a+i.height,d=t.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=xe.get(s),h=d.mapping.maps.length}p8(d,o,s,n,l,c,h)&&f(),Vp(d,o,s,n,u,l,a,h)&&f(),Vp(d,o,s,n,u,l,c,h)&&f(),qp(d,o,s,n,a,c,u,h)&&f(),qp(d,o,s,n,a,c,l,h)&&f();for(let p=a;p<c;p++){const m=o.positionAt(p,u,s),g=o.positionAt(p,l,s);d.replace(d.mapping.slice(h).map(m+n),d.mapping.slice(h).map(g+n),new R(i.rows[p-a],0,0))}f(),d.setSelection(new ue(d.doc.resolve(n+o.positionAt(a,u,s)),d.doc.resolve(n+o.positionAt(c-1,l-1,s)))),e(d)}const m8=ld({ArrowLeft:js("horiz",-1),ArrowRight:js("horiz",1),ArrowUp:js("vert",-1),ArrowDown:js("vert",1),"Shift-ArrowLeft":Vs("horiz",-1),"Shift-ArrowRight":Vs("horiz",1),"Shift-ArrowUp":Vs("vert",-1),"Shift-ArrowDown":Vs("vert",1),Backspace:Hs,"Mod-Backspace":Hs,Delete:Hs,"Mod-Delete":Hs});function ro(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function js(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof ue)return ro(n,r,q.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=bb(i,t,e);if(o==null)return!1;if(t=="horiz")return ro(n,r,q.near(n.doc.resolve(s.head+e),e));{const a=n.doc.resolve(o),u=cb(a,t,e);let l;return u?l=q.near(u,1):e<0?l=q.near(n.doc.resolve(a.before(-1)),-1):l=q.near(n.doc.resolve(a.after(-1)),1),ro(n,r,l)}}}function Vs(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof ue)o=s;else{const u=bb(i,t,e);if(u==null)return!1;o=new ue(n.doc.resolve(u))}const a=cb(o.$headCell,t,e);return a?ro(n,r,new ue(o.$anchorCell,a)):!1}}function g8(t,e){const n=t.state.doc,r=yr(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ue(r))),!0):!1}function b8(t,e,n){if(!It(t.state))return!1;let r=d8(n);const i=t.state.selection;if(i instanceof ue){r||(r={width:1,height:1,rows:[M.from(bc(Ge(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=xe.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=f8(r,a.right-a.left,a.bottom-a.top),Wp(t.state,t.dispatch,o,a,r),!0}else if(r){const s=Wa(t.state),o=s.start(-1);return Wp(t.state,t.dispatch,o,xe.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function v8(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Up(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof ue)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=yr(t.state.selection.$anchor))!=null&&((n=Gu(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,l){let c=Gu(t,l);const d=Rn.getState(t.state)==null;if(!c||!Dd(u,c))if(d)c=u;else return;const h=new ue(u,c);if(d||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);d&&f.setMeta(Rn,u.pos),t.dispatch(f)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Rn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Rn,-1))}function a(u){const l=u,c=Rn.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(Up(t,l.target)!=r&&(d=Gu(t,e),!d))return o();d&&s(d,l)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function bb(t,e,n){if(!(t.state.selection instanceof H))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?o:null}}return null}function Up(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Gu(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&yr(t.state.doc.resolve(r))||yr(t.state.doc.resolve(i))}var y8=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),vc(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,vc(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function vc(t,e,n,r,i,s){let o=0,a=!0,u=e.firstChild;const l=t.firstChild;if(l){for(let d=0,h=0;d<l.childCount;d++){const{colspan:f,colwidth:p}=l.child(d).attrs;for(let m=0;m<f;m++,h++){const g=i==h?s:p&&p[m],b=g?g+"px":"";if(o+=g||r,g||(a=!1),u)u.style.width!=b&&(u.style.width=b),u=u.nextSibling;else{const v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;u;){var c;const d=u.nextSibling;(c=u.parentNode)===null||c===void 0||c.removeChild(u),u=d}a?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const ht=new Be("tableColumnResizing");function _8({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=y8,lastColumnResizable:i=!0}={}){const s=new we({key:ht,state:{init(o,a){var u;const l=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,c=Ge(a.schema).table.name;return r&&l&&(l[c]=(d,h)=>new r(d,n,h)),new x8(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=ht.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{k8(o,a,t,i)},mouseleave:o=>{w8(o)},mousedown:(o,a)=>{C8(o,a,e,n)}},decorations:o=>{const a=ht.getState(o);if(a&&a.activeHandle>-1)return T8(o,a.activeHandle)},nodeViews:{}}});return s}var x8=class io{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(ht);if(r&&r.setHandle!=null)return new io(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new io(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return gc(e.doc.resolve(i))||(i=-1),new io(i,n.dragging)}return n}};function k8(t,e,n,r){if(!t.editable)return;const i=ht.getState(t.state);if(i&&!i.dragging){const s=S8(e.target);let o=-1;if(s){const{left:a,right:u}=s.getBoundingClientRect();e.clientX-a<=n?o=Kp(t,e,"left",n):u-e.clientX<=n&&(o=Kp(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),u=a.node(-1),l=xe.get(u),c=a.start(-1);if(l.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==l.width-1)return}vb(t,o)}}}function w8(t){if(!t.editable)return;const e=ht.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&vb(t,-1)}function C8(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=ht.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),u=E8(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(ht,{setDragging:{startX:e.clientX,startWidth:u}}));function l(d){s.removeEventListener("mouseup",l),s.removeEventListener("mousemove",c);const h=ht.getState(t.state);h?.dragging&&(M8(t,h.activeHandle,Jp(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta(ht,{setDragging:null})))}function c(d){if(!d.which)return l(d);const h=ht.getState(t.state);if(h&&h.dragging){const f=Jp(h.dragging,d,n);Gp(t,h.activeHandle,f,r)}}return Gp(t,o.activeHandle,u,r),s.addEventListener("mouseup",l),s.addEventListener("mousemove",c),e.preventDefault(),!0}function E8(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let u=0;u<n;u++)r[u]&&(o-=r[u],a--);return o/a}function S8(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Kp(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=yr(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const u=xe.get(a.node(-1)),l=a.start(-1),c=u.map.indexOf(a.pos-l);return c%u.width==0?-1:l+u.map[c-1]}function Jp(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function vb(t,e){t.dispatch(t.state.tr.setMeta(ht,{setHandle:e}))}function M8(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=xe.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let l=0;l<s.height;l++){const c=l*s.width+a;if(l&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():A8(h.colspan);p[f]=n,u.setNodeMarkup(o+d,null,{...h,colwidth:p})}u.docChanged&&t.dispatch(u)}function Gp(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=xe.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&vc(s,u.firstChild,u,r,a,n)}function A8(t){return Array(t).fill(0)}function T8(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ye.empty;const s=xe.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let l=0;l<s.height;l++){const c=a+l*s.width;if((a==s.width-1||s.map[c]!=s.map[c+1])&&(l==0||s.map[c]!=s.map[c-s.width])){var u;const d=s.map[c],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((u=ht.getState(t))===null||u===void 0)&&u.dragging&&n.push(tt.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(tt.widget(h,f))}}return ye.create(t.doc,n)}function D8({allowTableNodeSelection:t=!1}={}){return new we({key:Rn,state:{init(){return null},apply(e,n){const r=e.getMeta(Rn);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:VS,handleDOMEvents:{mousedown:v8},createSelectionBetween(e){return Rn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:g8,handleKeyDown:m8,handlePaste:b8},appendTransaction(e,n,r){return US(r,pb(r,n),t)}})}function yc(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Yp(t,e,n,r,i,s){var o;let a=0,u=!0,l=e.firstChild;const c=t.firstChild;if(c!==null)for(let d=0,h=0;d<c.childCount;d+=1){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=i===h?s:p&&p[m],b=g?`${g}px`:"";if(a+=g||r,g||(u=!1),l){if(l.style.width!==b){const[v,_]=yc(r,g);l.style.setProperty(v,_)}l=l.nextSibling}else{const v=document.createElement("col"),[_,x]=yc(r,g);v.style.setProperty(_,x),e.appendChild(v)}}}for(;l;){const d=l.nextSibling;(o=l.parentNode)===null||o===void 0||o.removeChild(l),l=d}u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}class O8{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Yp(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Yp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function R8(t,e,n,r){let i=0,s=!0;const o=[],a=t.firstChild;if(!a)return{};for(let d=0,h=0;d<a.childCount;d+=1){const{colspan:f,colwidth:p}=a.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=n===h?r:p&&p[m];i+=g||e,g||(s=!1);const[b,v]=yc(e,g);o.push(["col",{style:`${b}: ${v}`}])}}const u=s?`${i}px`:"",l=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:u,tableMinWidth:l}}function Zp(t,e){return t.createAndFill()}function N8(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function F8(t,e,n,r,i){const s=N8(t),o=[],a=[];for(let l=0;l<n;l+=1){const c=Zp(s.cell);if(c&&a.push(c),r){const d=Zp(s.header_cell);d&&o.push(d)}}const u=[];for(let l=0;l<e;l+=1)u.push(s.row.createChecked(null,r&&l===0?o:a));return s.table.createChecked(null,u)}function I8(t){return t instanceof ue}const qs=({editor:t})=>{const{selection:e}=t.state;if(!I8(e))return!1;let n=0;const r=p1(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},P8=te.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:O8,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=R8(t,this.options.cellMinWidth),s=["table",ge(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=F8(s.schema,t,e,n);if(i){const a=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(H.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>GS(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>YS(t,e),deleteColumn:()=>({state:t,dispatch:e})=>XS(t,e),addRowBefore:()=>({state:t,dispatch:e})=>e8(t,e),addRowAfter:()=>({state:t,dispatch:e})=>t8(t,e),deleteRow:()=>({state:t,dispatch:e})=>r8(t,e),deleteTable:()=>({state:t,dispatch:e})=>c8(t,e),mergeCells:()=>({state:t,dispatch:e})=>$p(t,e),splitCell:()=>({state:t,dispatch:e})=>zp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>ds("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>ds("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>u8(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>$p(t,e)?!0:zp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>o8(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>jp(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>jp(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&pb(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=ue.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}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:qs,"Mod-Backspace":qs,Delete:qs,"Mod-Delete":qs}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[_8({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],D8({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:U(B(t,"tableRole",e))}}}),L8=te.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ge(this.options.HTMLAttributes,t),0]}}),B8=te.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",ge(this.options.HTMLAttributes,t),0]}}),$8=te.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ge(this.options.HTMLAttributes,t),0]}}),z8="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",H8="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",_c="numeric",xc="ascii",kc="alpha",$i="asciinumeric",Ti="alphanumeric",wc="domain",yb="emoji",j8="scheme",V8="slashscheme",Yu="whitespace";function q8(t,e){return t in e||(e[t]=[]),e[t]}function or(t,e,n){e[_c]&&(e[$i]=!0,e[Ti]=!0),e[xc]&&(e[$i]=!0,e[kc]=!0),e[$i]&&(e[Ti]=!0),e[kc]&&(e[Ti]=!0),e[Ti]&&(e[wc]=!0),e[yb]&&(e[wc]=!0);for(const r in e){const i=q8(r,n);i.indexOf(t)<0&&i.push(t)}}function W8(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ot(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ot.groups={};ot.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||ot.groups;let i;return e&&e.j?i=e:(i=new ot(e),n&&r&&or(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||ot.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new ot,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new ot,s){if(r)if(o.t&&typeof o.t=="string"){const u=Object.assign(W8(o.t,r),n);or(s,u,r)}else n&&or(s,n,r);o.t=s}return i.j[t]=o,o}};const K=(t,e,n,r,i)=>t.ta(e,n,r,i),be=(t,e,n,r,i)=>t.tr(e,n,r,i),Xp=(t,e,n,r,i)=>t.ts(e,n,r,i),T=(t,e,n,r,i)=>t.tt(e,n,r,i),an="WORD",Cc="UWORD",_b="ASCIINUMERICAL",xb="ALPHANUMERICAL",hs="LOCALHOST",Ec="TLD",Sc="UTLD",so="SCHEME",Lr="SLASH_SCHEME",Od="NUM",Mc="WS",Rd="NL",zi="OPENBRACE",Hi="CLOSEBRACE",Go="OPENBRACKET",Yo="CLOSEBRACKET",Zo="OPENPAREN",Xo="CLOSEPAREN",Qo="OPENANGLEBRACKET",ea="CLOSEANGLEBRACKET",ta="FULLWIDTHLEFTPAREN",na="FULLWIDTHRIGHTPAREN",ra="LEFTCORNERBRACKET",ia="RIGHTCORNERBRACKET",sa="LEFTWHITECORNERBRACKET",oa="RIGHTWHITECORNERBRACKET",aa="FULLWIDTHLESSTHAN",ua="FULLWIDTHGREATERTHAN",la="AMPERSAND",ca="APOSTROPHE",da="ASTERISK",An="AT",ha="BACKSLASH",fa="BACKTICK",pa="CARET",Nn="COLON",Nd="COMMA",ma="DOLLAR",Lt="DOT",ga="EQUALS",Fd="EXCLAMATION",xt="HYPHEN",ji="PERCENT",ba="PIPE",va="PLUS",ya="POUND",Vi="QUERY",Id="QUOTE",kb="FULLWIDTHMIDDLEDOT",Pd="SEMI",Bt="SLASH",qi="TILDE",_a="UNDERSCORE",wb="EMOJI",xa="SYM";var Cb=Object.freeze({__proto__:null,ALPHANUMERICAL:xb,AMPERSAND:la,APOSTROPHE:ca,ASCIINUMERICAL:_b,ASTERISK:da,AT:An,BACKSLASH:ha,BACKTICK:fa,CARET:pa,CLOSEANGLEBRACKET:ea,CLOSEBRACE:Hi,CLOSEBRACKET:Yo,CLOSEPAREN:Xo,COLON:Nn,COMMA:Nd,DOLLAR:ma,DOT:Lt,EMOJI:wb,EQUALS:ga,EXCLAMATION:Fd,FULLWIDTHGREATERTHAN:ua,FULLWIDTHLEFTPAREN:ta,FULLWIDTHLESSTHAN:aa,FULLWIDTHMIDDLEDOT:kb,FULLWIDTHRIGHTPAREN:na,HYPHEN:xt,LEFTCORNERBRACKET:ra,LEFTWHITECORNERBRACKET:sa,LOCALHOST:hs,NL:Rd,NUM:Od,OPENANGLEBRACKET:Qo,OPENBRACE:zi,OPENBRACKET:Go,OPENPAREN:Zo,PERCENT:ji,PIPE:ba,PLUS:va,POUND:ya,QUERY:Vi,QUOTE:Id,RIGHTCORNERBRACKET:ia,RIGHTWHITECORNERBRACKET:oa,SCHEME:so,SEMI:Pd,SLASH:Bt,SLASH_SCHEME:Lr,SYM:xa,TILDE:qi,TLD:Ec,UNDERSCORE:_a,UTLD:Sc,UWORD:Cc,WORD:an,WS:Mc});const nn=/[a-z]/,vi=/\p{L}/u,Zu=/\p{Emoji}/u,rn=/\d/,Xu=/\s/,Qp="\r",Qu=`
|
|
126
|
-
`,
|
|
123
|
+
`);return!s||!o?!1:t.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:s}=n;if(!s||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const a=i.after();return a===void 0?!1:r.nodeAt(a)?t.commands.command(({tr:l})=>(l.setSelection(q.near(r.resolve(a))),!0)):t.commands.exitCode()}}},addInputRules(){return[cc({find:iS,type:this.type,getAttributes:t=>({language:t[1]})}),cc({find:sS,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new we({key:new Be("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,s=i?.mode;if(!n||!s)return!1;const{tr:o,schema:a}=t.state,u=a.text(n.replace(/\r\n?/g,`
|
|
124
|
+
`));return o.replaceSelectionWith(this.type.create({language:s},u)),o.selection.$from.parent.type!==this.type&&o.setSelection(H.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),t.dispatch(o),!0}}})]}}),aS=te.create({name:"doc",topNode:!0,content:"block+"});function uS(t={}){return new we({view(e){return new lS(e,t)}})}class lS{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let s=o=>{this[i](o)};return e.dom.addEventListener(i,s),{name:i,handler:s}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.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),n=!e.parent.inlineContent,r,i=this.editorView.dom,s=i.getBoundingClientRect(),o=s.width/i.offsetWidth,a=s.height/i.offsetHeight;if(n){let d=e.nodeBefore,h=e.nodeAfter;if(d||h){let f=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(f){let p=f.getBoundingClientRect(),m=d?p.bottom:p.top;d&&h&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let g=this.width/2*a;r={left:p.left,right:p.right,top:m-g,bottom:m+g}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*o;r={left:d.left-h,right:d.left+h,top:d.top,bottom:d.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let l,c;if(!u||u==document.body&&getComputedStyle(u).position=="static")l=-pageXOffset,c=-pageYOffset;else{let d=u.getBoundingClientRect(),h=d.width/u.offsetWidth,f=d.height/u.offsetHeight;l=d.left-u.scrollLeft*h,c=d.top-u.scrollTop*f}this.element.style.left=(r.left-l)/o+"px",this.element.style.top=(r.top-c)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,s=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!s){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=sg(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const cS=Le.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[uS(this.options)]}});class _e extends q{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return _e.valid(r)?new _e(r):q.near(r)}content(){return R.empty}eq(e){return e instanceof _e&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new _e(e.resolve(n.pos))}getBookmark(){return new Rd(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!dS(e)||!hS(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&_e.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let u=e.doc.resolve(i);if(_e.valid(u))return u}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!z.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(_e.valid(a))return a}return null}}}_e.prototype.visible=!1;_e.findFrom=_e.findGapCursorFrom;q.jsonID("gapcursor",_e);class Rd{constructor(e){this.pos=e}map(e){return new Rd(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return _e.valid(n)?new _e(n):q.near(n)}}function ub(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function dS(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||ub(i.type))return!0;if(i.inlineContent)return!1}}return!0}function hS(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||ub(i.type))return!0;if(i.inlineContent)return!1}}return!0}function fS(){return new we({props:{decorations:bS,createSelectionBetween(t,e,n){return e.pos==n.pos&&_e.valid(n)?new _e(n):null},handleClick:mS,handleKeyDown:pS,handleDOMEvents:{beforeinput:gS}}})}const pS=hd({ArrowLeft:Hs("horiz",-1),ArrowRight:Hs("horiz",1),ArrowUp:Hs("vert",-1),ArrowDown:Hs("vert",1)});function Hs(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,u=o.empty;if(o instanceof H){if(!s.endOfTextblock(n)||a.depth==0)return!1;u=!1,a=r.doc.resolve(e>0?a.after():a.before())}let l=_e.findGapCursorFrom(a,e,u);return l?(i&&i(r.tr.setSelection(new _e(l))),!0):!1}}function mS(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!_e.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&z.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new _e(r))),!0)}function gS(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof _e))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=M.empty;for(let o=r.length-1;o>=0;o--)i=M.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new R(i,0,0));return s.setSelection(H.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function bS(t){if(!(t.selection instanceof _e))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ye.create(t.doc,[tt.widget(t.selection.head,e,{key:"gapcursor"})])}const vS=Le.create({name:"gapCursor",addProseMirrorPlugins(){return[fS()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=U(B(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),yS=te.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",ge(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
125
|
+
`},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:s}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,u=s||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:l,dispatch:c})=>{if(c&&u&&o){const d=u.filter(h=>a.includes(h.type.name));l.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),_S=te.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]}`,ge(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)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>cc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Go=200,Ie=function(){};Ie.prototype.append=function(e){return e.length?(e=Ie.from(e),!this.length&&e||e.length<Go&&this.leafAppend(e)||this.length<Go&&e.leafPrepend(this)||this.appendInner(e)):this};Ie.prototype.prepend=function(e){return e.length?Ie.from(e).append(this):this};Ie.prototype.appendInner=function(e){return new xS(this,e)};Ie.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ie.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};Ie.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};Ie.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};Ie.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};Ie.from=function(e){return e instanceof Ie?e:e&&e.length?new lb(e):Ie.empty};var lb=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var u=s;u<o;u++)if(i(this.values[u],a+u)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var u=s-1;u>=o;u--)if(i(this.values[u],a+u)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Go)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Go)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ie);Ie.empty=new lb([]);var xS=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(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(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(Ie);const kS=500;class Nt{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,u,l=[],c=[];return this.items.forEach((d,h)=>{if(!d.step){i||(i=this.remapping(r,h+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new Pt(d.map));let f=d.step.map(i.slice(s)),p;f&&o.maybeStep(f).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],l.push(new Pt(p,void 0,void 0,l.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,u=new Nt(this.items.slice(0,r).append(c.reverse().concat(l)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,u=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),h=new Pt(e.mapping.maps[c],d,n),f;(f=u&&u.merge(h))&&(h=f,c?s.pop():a=a.slice(0,a.length-1)),s.push(h),n&&(o++,n=void 0),i||(u=h)}let l=o-r.depth;return l>CS&&(a=wS(a,l),o-=l),new Nt(a.append(s),o)}remapping(e,n){let r=new Qi;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Nt(this.items.append(e.map(n=>new Pt(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let u=n;this.items.forEach(h=>{let f=s.getMirror(--u);if(f==null)return;o=Math.min(o,f);let p=s.maps[f];if(h.step){let m=e.steps[f].invert(e.docs[f]),g=h.selection&&h.selection.map(s.slice(u+1,f));g&&a++,r.push(new Pt(p,m,g))}else r.push(new Pt(p))},i);let l=[];for(let h=n;h<o;h++)l.push(new Pt(s.maps[h]));let c=this.items.slice(0,i).append(l).append(r),d=new Nt(c,a);return d.emptyItemCount()>kS&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let u=o.step.map(n.slice(r)),l=u&&u.getMap();if(r--,l&&n.appendMap(l,r),u){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let d=new Pt(l.invert(),u,c),h,f=i.length-1;(h=i.length&&i[f].merge(d))?i[f]=h:i.push(d)}}else o.map&&r--},this.items.length,0),new Nt(Ie.from(i.reverse()),s)}}Nt.empty=new Nt(Ie.empty,0);function wS(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class Pt{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new Pt(n.getMap().invert(),n,this.selection)}}}class An{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const CS=20;function ES(t,e,n,r){let i=n.getMeta(fr),s;if(i)return i.historyState;n.getMeta(AS)&&(t=new An(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(fr))return o.getMeta(fr).redo?new An(t.done.addTransform(n,void 0,r,ro(e)),t.undone,Lp(n.mapping.maps),t.prevTime,t.prevComposition):new An(t.done,t.undone.addTransform(n,void 0,r,ro(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),u=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!SS(n,t.prevRanges)),l=o?Gu(t.prevRanges,n.mapping):Lp(n.mapping.maps);return new An(t.done.addTransform(n,u?e.selection.getBookmark():void 0,r,ro(e)),Nt.empty,l,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new An(t.done.rebased(n,s),t.undone.rebased(n,s),Gu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new An(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),Gu(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function SS(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Lp(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function Gu(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function MS(t,e,n){let r=ro(e),i=fr.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),u=new An(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(fr,{redo:n,historyState:u})}let Yu=!1,Bp=null;function ro(t){let e=t.plugins;if(Bp!=e){Yu=!1,Bp=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){Yu=!0;break}}return Yu}const fr=new Be("history"),AS=new Be("closeHistory");function TS(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new we({key:fr,state:{init(){return new An(Nt.empty,Nt.empty,null,0,-1)},apply(e,n,r){return ES(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?db:r=="historyRedo"?hb:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function cb(t,e){return(n,r)=>{let i=fr.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=MS(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const db=cb(!1,!0),hb=cb(!0,!0),DS=Le.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>db(t,e),redo:()=>({state:t,dispatch:e})=>hb(t,e)}},addProseMirrorPlugins(){return[TS(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),OS=te.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ge(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!Lw(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$from:r,$to:i}=n,s=t();return r.parentOffset===0?s.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):hw(n)?s.insertContentAt(i.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:o,dispatch:a})=>{var u;if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(H.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(z.create(o.doc,l.pos)):o.setSelection(H.create(o.doc,l.pos));else{const d=(u=l.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();d&&(o.insert(c,d),o.setSelection(H.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[A1({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),RS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,NS=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,FS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,IS=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,PS=it.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",ge(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[ii({find:RS,type:this.type}),ii({find:FS,type:this.type})]},addPasteRules(){return[yr({find:NS,type:this.type}),yr({find:IS,type:this.type})]}}),LS=te.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ge(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)}}}),BS="listItem",$p="textStyle",zp=/^(\d+)\.\s$/,$S=te.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:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",ge(this.options.HTMLAttributes,n),0]:["ol",ge(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(BS,this.editor.getAttributes($p)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=as({find:zp,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=as({find:zp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes($p)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),fb=te.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ge(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),zS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,HS=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jS=it.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",ge(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[ii({find:zS,type:this.type})]},addPasteRules(){return[yr({find:HS,type:this.type})]}}),VS=te.create({name:"text",group:"inline"}),qS=Le.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(XE.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(KE.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(eS.configure(this.options.bulletList)),this.options.code!==!1&&t.push(rS.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(oS.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(aS.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(cS.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(vS.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(yS.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(_S.configure(this.options.heading)),this.options.history!==!1&&t.push(DS.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(OS.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(PS.configure(this.options.italic)),this.options.listItem!==!1&&t.push(LS.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push($S.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(fb.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(jS.configure(this.options.strike)),this.options.text!==!1&&t.push(VS.configure(this.options.text)),t}});let gc,bc;if(typeof WeakMap<"u"){let t=new WeakMap;gc=e=>t.get(e),bc=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;gc=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},bc=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var xe=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==n;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:a,top:u,bottom:l}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,u),right:Math.max(r,a),bottom:Math.max(s,l)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(t){return gc(t)||bc(t,WS(t))}};function WS(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=US(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let l=0,c=e*n;l<c;l++)r[l]=0;for(let l=0,c=0;l<n;l++){const d=t.child(l);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const m=d.child(p),{colspan:g,rowspan:b,colwidth:v}=m.attrs;for(let _=0;_<b;_++){if(_+l>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:b-_});break}const x=i+_*e;for(let y=0;y<g;y++){r[x+y]==0?r[x+y]=c:(s||(s=[])).push({type:"collision",row:l,pos:c,n:g-y});const w=v&&v[y];if(w){const C=(x+y)%e*2,k=o[C];k==null||k!=w&&o[C+1]==1?(o[C]=w,o[C+1]=1):k==w&&o[C+1]++}}}i+=g,c+=m.nodeSize}const h=(l+1)*e;let f=0;for(;i<h;)r[i++]==0&&f++;f&&(s||(s=[])).push({type:"missing",row:l,n:f}),c++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new xe(e,n,r,s);let u=!1;for(let l=0;!u&&l<o.length;l+=2)o[l]!=null&&o[l+1]<n&&(u=!0);return u&&KS(a,o,t),a}function US(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let u=0;u<a.childCount;u++){const l=a.child(u);o+l.attrs.rowspan>r&&(s+=l.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function KS(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const u=o.attrs;for(let l=0;l<u.colspan;l++){const c=e[(i+l)%t.width*2];c!=null&&(!u.colwidth||u.colwidth[l]!=c)&&((a||(a=JS(u)))[l]=c)}a&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function JS(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Ge(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Nn=new Be("selectingCells");function _r(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function GS(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function It(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Ua(t){const 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;const n=_r(e.$head)||YS(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function YS(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function vc(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function ZS(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Nd(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function pb(t,e,n){const r=t.node(-1),i=xe.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function xr(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function mb(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function XS(t,e,n){const r=Ge(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var ue=class an extends q{constructor(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),a=e.node(0),u=i.cellsInRect(o).filter(c=>c!=n.pos-s);u.unshift(n.pos-s);const l=u.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const h=s+c+1;return new cg(a.resolve(h),a.resolve(h+d.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(vc(r)&&vc(i)&&Nd(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?an.rowSelection(r,i):s&&this.isColSelection()?an.colSelection(r,i):new an(r,i)}return H.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let u=i.top;u<i.bottom;u++){const l=[];for(let c=u*n.width+i.left,d=i.left;d<i.right;d++,c++){const h=n.map[c];if(s[h])continue;s[h]=!0;const f=n.findCell(h);let p=e.nodeAt(h);if(!p)throw new RangeError(`No cell with offset ${h} found`);const m=i.left-f.left,g=f.right-i.right;if(m>0||g>0){let b=p.attrs;if(m>0&&(b=xr(b,0,m)),g>0&&(b=xr(b,b.colspan-g,g)),f.left<i.left){if(p=p.type.createAndFill(b),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else p=p.type.create(b,p.content)}if(f.top<i.top||f.bottom>i.bottom){const b={...p.attrs,rowspan:Math.min(f.bottom,i.bottom)-Math.max(f.top,i.top)};f.top<i.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}l.push(p)}o.push(e.child(u).copy(M.from(l)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new R(M.from(a),1,1)}replace(e,n=R.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:u}=i[o],l=e.mapping.slice(r);e.replace(l.map(a.pos),l.map(u.pos),o?R.empty:n)}const s=q.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new R(M.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=xe.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),u=e.node(0);return o.top<=a.top?(o.top>0&&(e=u.resolve(s+i.map[o.left])),a.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=u.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new an(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=xe.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof an&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=xe.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),u=e.node(0);return o.left<=a.left?(o.left>0&&(e=u.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(n=u.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=u.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=u.resolve(s+i.map[i.width*(o.top+1)-1]))),new an(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new an(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new an(e.resolve(n),e.resolve(r))}getBookmark(){return new QS(this.$anchorCell.pos,this.$headCell.pos)}};ue.prototype.visible=!1;q.jsonID("cell",ue);var QS=class gb{constructor(e,n){this.anchor=e,this.head=n}map(e){return new gb(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Nd(n,r)?new ue(n,r):q.near(r,1)}};function e8(t){if(!(t.selection instanceof ue))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(tt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ye.create(t.doc,e)}function t8({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function n8({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function r8(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof z&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=ue.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=ue.rowSelection(a,a)}else if(!n){const a=xe.get(r.node),u=r.from+1,l=u+a.map[a.width*a.height-1];s=ue.create(i,u+1,l)}}else r instanceof H&&t8(r)?s=H.create(i,r.from):r instanceof H&&n8(r)&&(s=H.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const i8=new Be("fix-tables");function bb(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const u=e.child(o);for(let l=a,c=Math.min(i,o+3);l<c;l++)if(t.child(l)==u){a=l+1,n+=u.nodeSize;continue e}r(u,n),a<i&&t.child(a).sameMarkup(u)?bb(t.child(a),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function vb(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=s8(t,i,s,n))};return e?e.doc!=t.doc&&bb(e.doc,t.doc,0,r):t.doc.descendants(r),n}function s8(t,e,n,r){const i=xe.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const l=i.problems[u];if(l.type=="collision"){const c=e.nodeAt(l.pos);if(!c)continue;const d=c.attrs;for(let h=0;h<d.rowspan;h++)s[l.row+h]+=l.n;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,xr(d,d.colspan-l.n,l.n))}else if(l.type=="missing")s[l.row]+=l.n;else if(l.type=="overlong_rowspan"){const c=e.nodeAt(l.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-l.n})}else if(l.type=="colwidth mismatch"){const c=e.nodeAt(l.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+l.pos),null,{...c.attrs,colwidth:l.colwidth})}else if(l.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let o,a;for(let u=0;u<s.length;u++)s[u]&&(o==null&&(o=u),a=u);for(let u=0,l=n+1;u<i.height;u++){const c=e.child(u),d=l+c.nodeSize,h=s[u];if(h>0){let f="cell";c.firstChild&&(f=c.firstChild.type.spec.tableRole);const p=[];for(let g=0;g<h;g++){const b=Ge(t.schema)[f].createAndFill();b&&p.push(b)}const m=(u==0||o==u-1)&&a==u?l+1:d-1;r.insert(r.mapping.map(m),p)}l=d}return r.setMeta(i8,{fixTables:!0})}function Qt(t){const e=t.selection,n=Ua(t),r=n.node(-1),i=n.start(-1),s=xe.get(r);return{...e instanceof ue?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function yb(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;XS(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const u=e.map[a],l=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,mb(l.attrs,i-e.colCount(u))),o+=l.attrs.rowspan-1}else{const u=s==null?Ge(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,l=e.positionAt(o,i,r);t.insert(t.mapping.map(n+l),u.createAndFill())}}return t}function o8(t,e){if(!It(t))return!1;if(e){const n=Qt(t);e(yb(t.tr,n,n.left))}return!0}function a8(t,e){if(!It(t))return!1;if(e){const n=Qt(t);e(yb(t.tr,n,n.right))}return!0}function u8(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,u=e.map[a],l=n.nodeAt(u),c=l.attrs;if(i>0&&e.map[a-1]==u||i<e.width-1&&e.map[a+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,xr(c,i-e.colCount(u)));else{const d=t.mapping.slice(s).map(r+u);t.delete(d,d+l.nodeSize)}o+=c.rowspan}}function l8(t,e){if(!It(t))return!1;if(e){const n=Qt(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;u8(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=xe.get(s)}e(r)}return!0}function c8(t,e,n){var r;const i=Ge(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function _b(t,{map:e,tableStart:n,table:r},i){let s=n;for(let l=0;l<i;l++)s+=r.child(l).nodeSize;const o=[];let a=i>0?-1:0;c8(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let l=0,c=e.width*i;l<e.width;l++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],h=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...h,rowspan:h.rowspan+1}),l+=h.colspan-1}else{var u;const d=a==null?Ge(r.type.schema).cell:(u=r.nodeAt(e.map[c+a*e.width]))===null||u===void 0?void 0:u.type,h=d?.createAndFill();h&&o.push(h)}return t.insert(s,Ge(r.type.schema).row.create(null,o)),t}function d8(t,e){if(!It(t))return!1;if(e){const n=Qt(t);e(_b(t.tr,n,n.top))}return!0}function h8(t,e){if(!It(t))return!1;if(e){const n=Qt(t);e(_b(t.tr,n,n.bottom))}return!0}function f8(t,{map:e,table:n,tableStart:r},i){let s=0;for(let l=0;l<i;l++)s+=n.child(l).nodeSize;const o=s+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(s+r,o+r);const u=new Set;for(let l=0,c=i*e.width;l<e.width;l++,c++){const d=e.map[c];if(!u.has(d)){if(u.add(d),i>0&&d==e.map[c-e.width]){const h=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h,rowspan:h.rowspan-1}),l+=h.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const h=n.nodeAt(d),f=h.attrs,p=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),m=e.positionAt(i+1,l,n);t.insert(t.mapping.slice(a).map(r+m),p),l+=f.colspan-1}}}}function p8(t,e){if(!It(t))return!1;if(e){const n=Qt(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;f8(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=xe.get(n.table)}e(r)}return!0}function Hp(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function m8({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[a]==n[a+1])return!0;s+=t,a+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function jp(t,e){const n=t.selection;if(!(n instanceof ue)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Qt(t),{map:i}=r;if(m8(i,r))return!1;if(e){const s=t.tr,o={};let a=M.empty,u,l;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const h=i.map[c*i.width+d],f=r.table.nodeAt(h);if(!(o[h]||!f))if(o[h]=!0,u==null)u=h,l=f;else{Hp(f)||(a=a.append(f.content));const p=s.mapping.map(h+r.tableStart);s.delete(p,p+f.nodeSize)}}if(u==null||l==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...mb(l.attrs,l.attrs.colspan,r.right-r.left-l.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const c=u+1+l.content.size,d=Hp(l)?u+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,a)}s.setSelection(new ue(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function Vp(t,e){const n=Ge(t.schema);return g8(({node:r})=>n[r.type.spec.tableRole])(t,e)}function g8(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof ue){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=GS(r.$from),!i)return!1;s=(o=_r(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const u=[],l=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const c=Qt(e),d=e.tr;for(let f=0;f<c.right-c.left;f++)u.push(l?{...a,colwidth:l&&l[f]?[l[f]]:null}:a);let h;for(let f=c.top;f<c.bottom;f++){let p=c.map.positionAt(f,c.left,c.table);f==c.top&&(p+=i.nodeSize);for(let m=c.left,g=0;m<c.right;m++,g++)m==c.left&&f==c.top||d.insert(h=d.mapping.map(p+c.tableStart,1),t({node:i,row:f,col:m}).createAndFill(u[g]))}d.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),u[0]),r instanceof ue&&d.setSelection(new ue(d.doc.resolve(r.$anchorCell.pos),h?d.doc.resolve(h):void 0)),n(d)}return!0}}function b8(t,e){return function(n,r){if(!It(n))return!1;const i=Ua(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof ue?n.selection.forEachCell((o,a)=>{o.attrs[t]!==e&&s.setNodeMarkup(a,null,{...o.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function v8(t){return function(e,n){if(!It(e))return!1;if(n){const r=Ge(e.schema),i=Qt(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(u=>i.table.nodeAt(u));for(let u=0;u<o.length;u++)a[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[u],r.cell,a[u].attrs);if(s.steps.length===0)for(let u=0;u<o.length;u++)s.setNodeMarkup(i.tableStart+o[u],r.header_cell,a[u].attrs);n(s)}return!0}}function qp(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function hs(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?v8(t):function(n,r){if(!It(n))return!1;if(r){const i=Ge(n.schema),s=Qt(n),o=n.tr,a=qp("row",s,i),u=qp("column",s,i),l=(t==="column"?a:t==="row"&&u)?1:0,c=t=="column"?{left:0,top:l,right:1,bottom:s.map.height}:t=="row"?{left:l,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?u?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(h=>{const f=h+s.tableStart,p=o.doc.nodeAt(f);p&&o.setNodeMarkup(f,d,p.attrs)}),r(o)}return!0}}hs("row",{useDeprecatedLogic:!0});hs("column",{useDeprecatedLogic:!0});const y8=hs("cell",{useDeprecatedLogic:!0});function _8(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Wp(t){return function(e,n){if(!It(e))return!1;const r=_8(Ua(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(H.between(i,ZS(i))).scrollIntoView())}return!0}}function x8(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function js(t,e){const n=t.selection;if(!(n instanceof ue))return!1;if(e){const r=t.tr,i=Ge(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new R(i,0,0))}),r.docChanged&&e(r)}return!0}function k8(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let u=0;u<e.childCount;u++){let l=e.child(u).content;const c=u?0:Math.max(0,n-1),d=u<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(l=yc(Ge(o).row,new R(l,c,d)).content),a.push(l)}else if(s=="cell"||s=="header_cell")a.push(n||r?yc(Ge(o).row,new R(e,n,r)).content:e);else return null;return w8(o,a)}function w8(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:u}=s.child(o).attrs;for(let l=i;l<i+a;l++)n[l]=(n[l]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(M.empty),n[i]<r){const s=Ge(t).cell.createAndFill(),o=[];for(let a=n[i];a<r;a++)o.push(s);e[i]=e[i].append(M.from(o))}return{height:e.length,width:r,rows:e}}function yc(t,e){const n=t.createAndFill();return new td(n).replace(0,n.content.size,e).doc}function C8({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let a=0;a<n.length;a++){const u=n[a],l=[];for(let c=s[a]||0,d=0;c<r;d++){let h=u.child(d%u.childCount);c+h.attrs.colspan>r&&(h=h.type.createChecked(xr(h.attrs,h.attrs.colspan,c+h.attrs.colspan-r),h.content)),l.push(h),c+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)s[a+f]=(s[a+f]||0)+h.attrs.colspan}o.push(M.from(l))}n=o,t=r}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const u=[],l=n[a%e];for(let c=0;c<l.childCount;c++){let d=l.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),u.push(d)}s.push(M.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function E8(t,e,n,r,i,s,o){const a=t.doc.type.schema,u=Ge(a);let l,c;if(i>e.width)for(let d=0,h=0;d<e.height;d++){const f=n.child(d);h+=f.nodeSize;const p=[];let m;f.lastChild==null||f.lastChild.type==u.cell?m=l||(l=u.cell.createAndFill()):m=c||(c=u.header_cell.createAndFill());for(let g=e.width;g<i;g++)p.push(m);t.insert(t.mapping.slice(o).map(h-1+r),p)}if(s>e.height){const d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const g=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==u.header_cell;d.push(g?c||(c=u.header_cell.createAndFill()):l||(l=u.cell.createAndFill()))}const h=u.row.create(null,M.from(d)),f=[];for(let p=e.height;p<s;p++)f.push(h);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),f)}return!!(l||c)}function Up(t,e,n,r,i,s,o,a){if(o==0||o==e.height)return!1;let u=!1;for(let l=i;l<s;l++){const c=o*e.width+l,d=e.map[c];if(e.map[c-e.width]==d){u=!0;const h=n.nodeAt(d),{top:f,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...h.attrs,rowspan:o-f}),t.insert(t.mapping.slice(a).map(e.positionAt(o,p,n)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-o})),l+=h.attrs.colspan-1}}return u}function Kp(t,e,n,r,i,s,o,a){if(o==0||o==e.width)return!1;let u=!1;for(let l=i;l<s;l++){const c=l*e.width+o,d=e.map[c];if(e.map[c-1]==d){u=!0;const h=n.nodeAt(d),f=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,xr(h.attrs,o-f,h.attrs.colspan-(o-f))),t.insert(p+h.nodeSize,h.type.createAndFill(xr(h.attrs,0,o-f))),l+=h.attrs.rowspan-1}}return u}function Jp(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=xe.get(s);const{top:a,left:u}=r,l=u+i.width,c=a+i.height,d=t.tr;let h=0;function f(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=xe.get(s),h=d.mapping.maps.length}E8(d,o,s,n,l,c,h)&&f(),Up(d,o,s,n,u,l,a,h)&&f(),Up(d,o,s,n,u,l,c,h)&&f(),Kp(d,o,s,n,a,c,u,h)&&f(),Kp(d,o,s,n,a,c,l,h)&&f();for(let p=a;p<c;p++){const m=o.positionAt(p,u,s),g=o.positionAt(p,l,s);d.replace(d.mapping.slice(h).map(m+n),d.mapping.slice(h).map(g+n),new R(i.rows[p-a],0,0))}f(),d.setSelection(new ue(d.doc.resolve(n+o.positionAt(a,u,s)),d.doc.resolve(n+o.positionAt(c-1,l-1,s)))),e(d)}const S8=hd({ArrowLeft:Vs("horiz",-1),ArrowRight:Vs("horiz",1),ArrowUp:Vs("vert",-1),ArrowDown:Vs("vert",1),"Shift-ArrowLeft":qs("horiz",-1),"Shift-ArrowRight":qs("horiz",1),"Shift-ArrowUp":qs("vert",-1),"Shift-ArrowDown":qs("vert",1),Backspace:js,"Mod-Backspace":js,Delete:js,"Mod-Delete":js});function io(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Vs(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof ue)return io(n,r,q.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=xb(i,t,e);if(o==null)return!1;if(t=="horiz")return io(n,r,q.near(n.doc.resolve(s.head+e),e));{const a=n.doc.resolve(o),u=pb(a,t,e);let l;return u?l=q.near(u,1):e<0?l=q.near(n.doc.resolve(a.before(-1)),-1):l=q.near(n.doc.resolve(a.after(-1)),1),io(n,r,l)}}}function qs(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof ue)o=s;else{const u=xb(i,t,e);if(u==null)return!1;o=new ue(n.doc.resolve(u))}const a=pb(o.$headCell,t,e);return a?io(n,r,new ue(o.$anchorCell,a)):!1}}function M8(t,e){const n=t.state.doc,r=_r(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new ue(r))),!0):!1}function A8(t,e,n){if(!It(t.state))return!1;let r=k8(n);const i=t.state.selection;if(i instanceof ue){r||(r={width:1,height:1,rows:[M.from(yc(Ge(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=xe.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=C8(r,a.right-a.left,a.bottom-a.top),Jp(t.state,t.dispatch,o,a,r),!0}else if(r){const s=Ua(t.state),o=s.start(-1);return Jp(t.state,t.dispatch,o,xe.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function T8(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=Gp(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof ue)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=_r(t.state.selection.$anchor))!=null&&((n=Zu(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,l){let c=Zu(t,l);const d=Nn.getState(t.state)==null;if(!c||!Nd(u,c))if(d)c=u;else return;const h=new ue(u,c);if(d||!t.state.selection.eq(h)){const f=t.state.tr.setSelection(h);d&&f.setMeta(Nn,u.pos),t.dispatch(f)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Nn.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Nn,-1))}function a(u){const l=u,c=Nn.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(Gp(t,l.target)!=r&&(d=Zu(t,e),!d))return o();d&&s(d,l)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function xb(t,e,n){if(!(t.state.selection instanceof H))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?o:null}}return null}function Gp(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Zu(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&_r(t.state.doc.resolve(r))||_r(t.state.doc.resolve(i))}var D8=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,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",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),_c(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,_c(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function _c(t,e,n,r,i,s){let o=0,a=!0,u=e.firstChild;const l=t.firstChild;if(l){for(let d=0,h=0;d<l.childCount;d++){const{colspan:f,colwidth:p}=l.child(d).attrs;for(let m=0;m<f;m++,h++){const g=i==h?s:p&&p[m],b=g?g+"px":"";if(o+=g||r,g||(a=!1),u)u.style.width!=b&&(u.style.width=b),u=u.nextSibling;else{const v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;u;){var c;const d=u.nextSibling;(c=u.parentNode)===null||c===void 0||c.removeChild(u),u=d}a?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const ht=new Be("tableColumnResizing");function O8({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=D8,lastColumnResizable:i=!0}={}){const s=new we({key:ht,state:{init(o,a){var u;const l=(u=s.spec)===null||u===void 0||(u=u.props)===null||u===void 0?void 0:u.nodeViews,c=Ge(a.schema).table.name;return r&&l&&(l[c]=(d,h)=>new r(d,n,h)),new R8(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=ht.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{N8(o,a,t,i)},mouseleave:o=>{F8(o)},mousedown:(o,a)=>{I8(o,a,e,n)}},decorations:o=>{const a=ht.getState(o);if(a&&a.activeHandle>-1)return z8(o,a.activeHandle)},nodeViews:{}}});return s}var R8=class so{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(ht);if(r&&r.setHandle!=null)return new so(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new so(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return vc(e.doc.resolve(i))||(i=-1),new so(i,n.dragging)}return n}};function N8(t,e,n,r){if(!t.editable)return;const i=ht.getState(t.state);if(i&&!i.dragging){const s=L8(e.target);let o=-1;if(s){const{left:a,right:u}=s.getBoundingClientRect();e.clientX-a<=n?o=Yp(t,e,"left",n):u-e.clientX<=n&&(o=Yp(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),u=a.node(-1),l=xe.get(u),c=a.start(-1);if(l.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==l.width-1)return}kb(t,o)}}}function F8(t){if(!t.editable)return;const e=ht.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&kb(t,-1)}function I8(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=ht.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),u=P8(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(ht,{setDragging:{startX:e.clientX,startWidth:u}}));function l(d){s.removeEventListener("mouseup",l),s.removeEventListener("mousemove",c);const h=ht.getState(t.state);h?.dragging&&(B8(t,h.activeHandle,Zp(h.dragging,d,n)),t.dispatch(t.state.tr.setMeta(ht,{setDragging:null})))}function c(d){if(!d.which)return l(d);const h=ht.getState(t.state);if(h&&h.dragging){const f=Zp(h.dragging,d,n);Xp(t,h.activeHandle,f,r)}}return Xp(t,o.activeHandle,u,r),s.addEventListener("mouseup",l),s.addEventListener("mousemove",c),e.preventDefault(),!0}function P8(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let u=0;u<n;u++)r[u]&&(o-=r[u],a--);return o/a}function L8(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Yp(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=_r(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const u=xe.get(a.node(-1)),l=a.start(-1),c=u.map.indexOf(a.pos-l);return c%u.width==0?-1:l+u.map[c-1]}function Zp(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function kb(t,e){t.dispatch(t.state.tr.setMeta(ht,{setHandle:e}))}function B8(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=xe.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let l=0;l<s.height;l++){const c=l*s.width+a;if(l&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],h=i.nodeAt(d).attrs,f=h.colspan==1?0:a-s.colCount(d);if(h.colwidth&&h.colwidth[f]==n)continue;const p=h.colwidth?h.colwidth.slice():$8(h.colspan);p[f]=n,u.setNodeMarkup(o+d,null,{...h,colwidth:p})}u.docChanged&&t.dispatch(u)}function Xp(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=xe.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&_c(s,u.firstChild,u,r,a,n)}function $8(t){return Array(t).fill(0)}function z8(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return ye.empty;const s=xe.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let l=0;l<s.height;l++){const c=a+l*s.width;if((a==s.width-1||s.map[c]!=s.map[c+1])&&(l==0||s.map[c]!=s.map[c-s.width])){var u;const d=s.map[c],h=o+d+i.nodeAt(d).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",!((u=ht.getState(t))===null||u===void 0)&&u.dragging&&n.push(tt.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(tt.widget(h,f))}}return ye.create(t.doc,n)}function H8({allowTableNodeSelection:t=!1}={}){return new we({key:Nn,state:{init(){return null},apply(e,n){const r=e.getMeta(Nn);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:e8,handleDOMEvents:{mousedown:T8},createSelectionBetween(e){return Nn.getState(e.state)!=null?e.state.selection:null},handleTripleClick:M8,handleKeyDown:S8,handlePaste:A8},appendTransaction(e,n,r){return r8(r,vb(r,n),t)}})}function xc(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Qp(t,e,n,r,i,s){var o;let a=0,u=!0,l=e.firstChild;const c=t.firstChild;if(c!==null)for(let d=0,h=0;d<c.childCount;d+=1){const{colspan:f,colwidth:p}=c.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=i===h?s:p&&p[m],b=g?`${g}px`:"";if(a+=g||r,g||(u=!1),l){if(l.style.width!==b){const[v,_]=xc(r,g);l.style.setProperty(v,_)}l=l.nextSibling}else{const v=document.createElement("col"),[_,x]=xc(r,g);v.style.setProperty(_,x),e.appendChild(v)}}}for(;l;){const d=l.nextSibling;(o=l.parentNode)===null||o===void 0||o.removeChild(l),l=d}u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}class j8{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qp(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Qp(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function V8(t,e,n,r){let i=0,s=!0;const o=[],a=t.firstChild;if(!a)return{};for(let d=0,h=0;d<a.childCount;d+=1){const{colspan:f,colwidth:p}=a.child(d).attrs;for(let m=0;m<f;m+=1,h+=1){const g=n===h?r:p&&p[m];i+=g||e,g||(s=!1);const[b,v]=xc(e,g);o.push(["col",{style:`${b}: ${v}`}])}}const u=s?`${i}px`:"",l=s?"":`${i}px`;return{colgroup:["colgroup",{},...o],tableWidth:u,tableMinWidth:l}}function e0(t,e){return t.createAndFill()}function q8(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function W8(t,e,n,r,i){const s=q8(t),o=[],a=[];for(let l=0;l<n;l+=1){const c=e0(s.cell);if(c&&a.push(c),r){const d=e0(s.header_cell);d&&o.push(d)}}const u=[];for(let l=0;l<e;l+=1)u.push(s.row.createChecked(null,r&&l===0?o:a));return s.table.createChecked(null,u)}function U8(t){return t instanceof ue}const Ws=({editor:t})=>{const{selection:e}=t.state;if(!U8(e))return!1;let n=0;const r=v1(e.ranges[0].$from,s=>s.type.name==="table");return r?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},K8=te.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:j8,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=V8(t,this.options.cellMinWidth),s=["table",ge(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const o=W8(s.schema,t,e,n);if(i){const a=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(H.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>o8(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>a8(t,e),deleteColumn:()=>({state:t,dispatch:e})=>l8(t,e),addRowBefore:()=>({state:t,dispatch:e})=>d8(t,e),addRowAfter:()=>({state:t,dispatch:e})=>h8(t,e),deleteRow:()=>({state:t,dispatch:e})=>p8(t,e),deleteTable:()=>({state:t,dispatch:e})=>x8(t,e),mergeCells:()=>({state:t,dispatch:e})=>jp(t,e),splitCell:()=>({state:t,dispatch:e})=>Vp(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>hs("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>hs("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>y8(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>jp(t,e)?!0:Vp(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>b8(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Wp(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Wp(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&vb(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=ue.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}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:Ws,"Mod-Backspace":Ws,Delete:Ws,"Mod-Delete":Ws}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[O8({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],H8({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:U(B(t,"tableRole",e))}}}),J8=te.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",ge(this.options.HTMLAttributes,t),0]}}),G8=te.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",ge(this.options.HTMLAttributes,t),0]}}),Y8=te.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ge(this.options.HTMLAttributes,t),0]}}),Z8="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",X8="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",kc="numeric",wc="ascii",Cc="alpha",zi="asciinumeric",Di="alphanumeric",Ec="domain",wb="emoji",Q8="scheme",e5="slashscheme",Xu="whitespace";function t5(t,e){return t in e||(e[t]=[]),e[t]}function ar(t,e,n){e[kc]&&(e[zi]=!0,e[Di]=!0),e[wc]&&(e[zi]=!0,e[Cc]=!0),e[zi]&&(e[Di]=!0),e[Cc]&&(e[Di]=!0),e[Di]&&(e[Ec]=!0),e[wb]&&(e[Ec]=!0);for(const r in e){const i=t5(r,n);i.indexOf(t)<0&&i.push(t)}}function n5(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function ot(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}ot.groups={};ot.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],s=e.jr[r][1];if(s&&i.test(t))return s}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||ot.groups;let i;return e&&e.j?i=e:(i=new ot(e),n&&r&&ar(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const s=t.length;if(!s)return i;for(let o=0;o<s-1;o++)i=i.tt(t[o]);return i.tt(t[s-1],e,n,r)},tt(t,e,n,r){r=r||ot.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const s=e;let o,a=i.go(t);if(a?(o=new ot,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new ot,s){if(r)if(o.t&&typeof o.t=="string"){const u=Object.assign(n5(o.t,r),n);ar(s,u,r)}else n&&ar(s,n,r);o.t=s}return i.j[t]=o,o}};const K=(t,e,n,r,i)=>t.ta(e,n,r,i),be=(t,e,n,r,i)=>t.tr(e,n,r,i),t0=(t,e,n,r,i)=>t.ts(e,n,r,i),T=(t,e,n,r,i)=>t.tt(e,n,r,i),un="WORD",Sc="UWORD",Cb="ASCIINUMERICAL",Eb="ALPHANUMERICAL",fs="LOCALHOST",Mc="TLD",Ac="UTLD",oo="SCHEME",Br="SLASH_SCHEME",Fd="NUM",Tc="WS",Id="NL",Hi="OPENBRACE",ji="CLOSEBRACE",Yo="OPENBRACKET",Zo="CLOSEBRACKET",Xo="OPENPAREN",Qo="CLOSEPAREN",ea="OPENANGLEBRACKET",ta="CLOSEANGLEBRACKET",na="FULLWIDTHLEFTPAREN",ra="FULLWIDTHRIGHTPAREN",ia="LEFTCORNERBRACKET",sa="RIGHTCORNERBRACKET",oa="LEFTWHITECORNERBRACKET",aa="RIGHTWHITECORNERBRACKET",ua="FULLWIDTHLESSTHAN",la="FULLWIDTHGREATERTHAN",ca="AMPERSAND",da="APOSTROPHE",ha="ASTERISK",Tn="AT",fa="BACKSLASH",pa="BACKTICK",ma="CARET",Fn="COLON",Pd="COMMA",ga="DOLLAR",Lt="DOT",ba="EQUALS",Ld="EXCLAMATION",xt="HYPHEN",Vi="PERCENT",va="PIPE",ya="PLUS",_a="POUND",qi="QUERY",Bd="QUOTE",Sb="FULLWIDTHMIDDLEDOT",$d="SEMI",Bt="SLASH",Wi="TILDE",xa="UNDERSCORE",Mb="EMOJI",ka="SYM";var Ab=Object.freeze({__proto__:null,ALPHANUMERICAL:Eb,AMPERSAND:ca,APOSTROPHE:da,ASCIINUMERICAL:Cb,ASTERISK:ha,AT:Tn,BACKSLASH:fa,BACKTICK:pa,CARET:ma,CLOSEANGLEBRACKET:ta,CLOSEBRACE:ji,CLOSEBRACKET:Zo,CLOSEPAREN:Qo,COLON:Fn,COMMA:Pd,DOLLAR:ga,DOT:Lt,EMOJI:Mb,EQUALS:ba,EXCLAMATION:Ld,FULLWIDTHGREATERTHAN:la,FULLWIDTHLEFTPAREN:na,FULLWIDTHLESSTHAN:ua,FULLWIDTHMIDDLEDOT:Sb,FULLWIDTHRIGHTPAREN:ra,HYPHEN:xt,LEFTCORNERBRACKET:ia,LEFTWHITECORNERBRACKET:oa,LOCALHOST:fs,NL:Id,NUM:Fd,OPENANGLEBRACKET:ea,OPENBRACE:Hi,OPENBRACKET:Yo,OPENPAREN:Xo,PERCENT:Vi,PIPE:va,PLUS:ya,POUND:_a,QUERY:qi,QUOTE:Bd,RIGHTCORNERBRACKET:sa,RIGHTWHITECORNERBRACKET:aa,SCHEME:oo,SEMI:$d,SLASH:Bt,SLASH_SCHEME:Br,SYM:ka,TILDE:Wi,TLD:Mc,UNDERSCORE:xa,UTLD:Ac,UWORD:Sc,WORD:un,WS:Tc});const rn=/[a-z]/,yi=/\p{L}/u,Qu=/\p{Emoji}/u,sn=/\d/,el=/\s/,n0="\r",tl=`
|
|
126
|
+
`,r5="️",i5="",nl="";let Us=null,Ks=null;function s5(t=[]){const e={};ot.groups=e;const n=new ot;Us==null&&(Us=r0(Z8)),Ks==null&&(Ks=r0(X8)),T(n,"'",da),T(n,"{",Hi),T(n,"}",ji),T(n,"[",Yo),T(n,"]",Zo),T(n,"(",Xo),T(n,")",Qo),T(n,"<",ea),T(n,">",ta),T(n,"(",na),T(n,")",ra),T(n,"「",ia),T(n,"」",sa),T(n,"『",oa),T(n,"』",aa),T(n,"<",ua),T(n,">",la),T(n,"&",ca),T(n,"*",ha),T(n,"@",Tn),T(n,"`",pa),T(n,"^",ma),T(n,":",Fn),T(n,",",Pd),T(n,"$",ga),T(n,".",Lt),T(n,"=",ba),T(n,"!",Ld),T(n,"-",xt),T(n,"%",Vi),T(n,"|",va),T(n,"+",ya),T(n,"#",_a),T(n,"?",qi),T(n,'"',Bd),T(n,"/",Bt),T(n,";",$d),T(n,"~",Wi),T(n,"_",xa),T(n,"\\",fa),T(n,"・",Sb);const r=be(n,sn,Fd,{[kc]:!0});be(r,sn,r);const i=be(r,rn,Cb,{[zi]:!0}),s=be(r,yi,Eb,{[Di]:!0}),o=be(n,rn,un,{[wc]:!0});be(o,sn,i),be(o,rn,o),be(i,sn,i),be(i,rn,i);const a=be(n,yi,Sc,{[Cc]:!0});be(a,rn),be(a,sn,s),be(a,yi,a),be(s,sn,s),be(s,rn),be(s,yi,s);const u=T(n,tl,Id,{[Xu]:!0}),l=T(n,n0,Tc,{[Xu]:!0}),c=be(n,el,Tc,{[Xu]:!0});T(n,nl,c),T(l,tl,u),T(l,nl,c),be(l,el,c),T(c,n0),T(c,tl),be(c,el,c),T(c,nl,c);const d=be(n,Qu,Mb,{[wb]:!0});T(d,"#"),be(d,Qu,d),T(d,r5,d);const h=T(d,i5);T(h,"#"),be(h,Qu,d);const f=[[rn,o],[sn,i]],p=[[rn,null],[yi,a],[sn,s]];for(let m=0;m<Us.length;m++)Cn(n,Us[m],Mc,un,f);for(let m=0;m<Ks.length;m++)Cn(n,Ks[m],Ac,Sc,p);ar(Mc,{tld:!0,ascii:!0},e),ar(Ac,{utld:!0,alpha:!0},e),Cn(n,"file",oo,un,f),Cn(n,"mailto",oo,un,f),Cn(n,"http",Br,un,f),Cn(n,"https",Br,un,f),Cn(n,"ftp",Br,un,f),Cn(n,"ftps",Br,un,f),ar(oo,{scheme:!0,ascii:!0},e),ar(Br,{slashscheme:!0,ascii:!0},e),t=t.sort((m,g)=>m[0]>g[0]?1:-1);for(let m=0;m<t.length;m++){const g=t[m][0],v=t[m][1]?{[Q8]:!0}:{[e5]:!0};g.indexOf("-")>=0?v[Ec]=!0:rn.test(g)?sn.test(g)?v[zi]=!0:v[wc]=!0:v[kc]=!0,t0(n,g,g,v)}return t0(n,"localhost",fs,{ascii:!0}),n.jd=new ot(ka),{start:n,tokens:Object.assign({groups:e},Ab)}}function Tb(t,e){const n=o5(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,i=[];let s=0,o=0;for(;o<r;){let a=t,u=null,l=0,c=null,d=-1,h=-1;for(;o<r&&(u=a.go(n[o]));)a=u,a.accepts()?(d=0,h=0,c=a):d>=0&&(d+=n[o].length,h++),l+=n[o].length,s+=n[o].length,o++;s-=d,o-=h,l-=d,i.push({t:c.t,v:e.slice(s-l,s),s:s-l,e:s})}return i}function o5(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),s,o=i<55296||i>56319||r+1===n||(s=t.charCodeAt(r+1))<56320||s>57343?t[r]:t.slice(r,r+2);e.push(o),r+=o.length}return e}function Cn(t,e,n,r,i){let s;const o=e.length;for(let a=0;a<o-1;a++){const u=e[a];t.j[u]?s=t.j[u]:(s=new ot(r),s.jr=i.slice(),t.j[u]=s),t=s}return s=new ot(n),s.jr=i.slice(),t.j[e[o-1]]=s,s}function r0(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let s=0;for(;i.indexOf(t[r+s])>=0;)s++;if(s>0){e.push(n.join(""));for(let o=parseInt(t.substring(r,r+s),10);o>0;o--)n.pop();r+=s}else n.push(t[r]),r++}return e}const ps={defaultProtocol:"http",events:null,format:i0,formatHref:i0,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function zd(t,e=null){let n=Object.assign({},ps);t&&(n=Object.assign(n,t instanceof zd?t.o:t));const r=n.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}zd.prototype={o:ps,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:ps[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function i0(t){return t}function Db(t,e){this.t="token",this.v=t,this.tk=e}Db.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},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=ps.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){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),s=this.toFormattedString(t),o={},a=t.get("className",n,e),u=t.get("target",n,e),l=t.get("rel",n,e),c=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return o.href=r,a&&(o.class=a),u&&(o.target=u),l&&(o.rel=l),c&&Object.assign(o,c),{tagName:i,attributes:o,content:s,eventListeners:d}}};function Ka(t,e){class n extends Db{constructor(i,s){super(i,s),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const s0=Ka("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),o0=Ka("text"),a5=Ka("nl"),Js=Ka("url",{isLink:!0,toHref(t=ps.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==fs&&t[1].t===Fn}}),yt=t=>new ot(t);function u5({groups:t}){const e=t.domain.concat([ca,ha,Tn,fa,pa,ma,ga,ba,xt,Fd,Vi,va,ya,_a,Bt,ka,Wi,xa]),n=[da,Fn,Pd,Lt,Ld,Vi,qi,Bd,$d,ea,ta,Hi,ji,Zo,Yo,Xo,Qo,na,ra,ia,sa,oa,aa,ua,la],r=[ca,da,ha,fa,pa,ma,ga,ba,xt,Hi,ji,Vi,va,ya,_a,qi,Bt,ka,Wi,xa],i=yt(),s=T(i,Wi);K(s,r,s),K(s,t.domain,s);const o=yt(),a=yt(),u=yt();K(i,t.domain,o),K(i,t.scheme,a),K(i,t.slashscheme,u),K(o,r,s),K(o,t.domain,o);const l=T(o,Tn);T(s,Tn,l),T(a,Tn,l),T(u,Tn,l);const c=T(s,Lt);K(c,r,s),K(c,t.domain,s);const d=yt();K(l,t.domain,d),K(d,t.domain,d);const h=T(d,Lt);K(h,t.domain,d);const f=yt(s0);K(h,t.tld,f),K(h,t.utld,f),T(l,fs,f);const p=T(d,xt);T(p,xt,p),K(p,t.domain,d),K(f,t.domain,d),T(f,Lt,h),T(f,xt,p);const m=T(f,Fn);K(m,t.numeric,s0);const g=T(o,xt),b=T(o,Lt);T(g,xt,g),K(g,t.domain,o),K(b,r,s),K(b,t.domain,o);const v=yt(Js);K(b,t.tld,v),K(b,t.utld,v),K(v,t.domain,o),K(v,r,s),T(v,Lt,b),T(v,xt,g),T(v,Tn,l);const _=T(v,Fn),x=yt(Js);K(_,t.numeric,x);const y=yt(Js),w=yt();K(y,e,y),K(y,n,w),K(w,e,y),K(w,n,w),T(v,Bt,y),T(x,Bt,y);const C=T(a,Fn),k=T(u,Fn),S=T(k,Bt),D=T(S,Bt);K(a,t.domain,o),T(a,Lt,b),T(a,xt,g),K(u,t.domain,o),T(u,Lt,b),T(u,xt,g),K(C,t.domain,y),T(C,Bt,y),T(C,qi,y),K(D,t.domain,y),K(D,e,y),T(D,Bt,y);const F=[[Hi,ji],[Yo,Zo],[Xo,Qo],[ea,ta],[na,ra],[ia,sa],[oa,aa],[ua,la]];for(let L=0;L<F.length;L++){const[j,W]=F[L],X=T(y,j);T(w,j,X),T(X,W,y);const ne=yt(Js);K(X,e,ne);const se=yt();K(X,n),K(ne,e,ne),K(ne,n,se),K(se,e,ne),K(se,n,se),T(ne,W,y),T(se,W,y)}return T(i,fs,v),T(i,Id,a5),{start:i,tokens:Ab}}function l5(t,e,n){let r=n.length,i=0,s=[],o=[];for(;i<r;){let a=t,u=null,l=null,c=0,d=null,h=-1;for(;i<r&&!(u=a.go(n[i].t));)o.push(n[i++]);for(;i<r&&(l=u||a.go(n[i].t));)u=null,a=l,a.accepts()?(h=0,d=a):h>=0&&h++,i++,c++;if(h<0)i-=c,i<r&&(o.push(n[i]),i++);else{o.length>0&&(s.push(rl(o0,e,o)),o=[]),i-=h,c-=h;const f=d.t,p=n.slice(i-c,i);s.push(rl(f,e,p))}}return o.length>0&&s.push(rl(o0,e,o)),s}function rl(t,e,n){const r=n[0].s,i=n[n.length-1].e,s=e.slice(r,i);return new t(s,n)}const c5=typeof console<"u"&&console&&console.warn||(()=>{}),d5="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",le={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function h5(){return ot.groups={},le.scanner=null,le.parser=null,le.tokenQueue=[],le.pluginQueue=[],le.customSchemes=[],le.initialized=!1,le}function a0(t,e=!1){if(le.initialized&&c5(`linkifyjs: already initialized - will not register custom scheme "${t}" ${d5}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
127
127
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
128
128
|
2. Cannot start or end with "-"
|
|
129
|
-
3. "-" cannot repeat`);le.customSchemes.push([t,e])}function n5(){le.scanner=J8(le.customSchemes);for(let t=0;t<le.tokenQueue.length;t++)le.tokenQueue[t][1]({scanner:le.scanner});le.parser=Z8(le.scanner.tokens);for(let t=0;t<le.pluginQueue.length;t++)le.pluginQueue[t][1]({scanner:le.scanner,parser:le.parser});return le.initialized=!0,le}function Bd(t){return le.initialized||n5(),X8(le.parser.start,t,Eb(le.scanner.start,t))}Bd.scan=Eb;function Mb(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new Ld(n),i=Bd(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}const $d="[\0- -\u2029 ]",r5=new RegExp($d),i5=new RegExp(`${$d}$`),s5=new RegExp($d,"g");function o5(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function a5(t){return new we({key:new Be("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),s=e.some(l=>l.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=U3(n.doc,[...e]);if(Q3(a).forEach(({newRange:l})=>{const c=J3(r.doc,l,f=>f.isTextblock);let d,h;if(c.length>1)d=c[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(l.from,l.to," "," ");if(!i5.test(f))return;d=c[0],h=r.doc.textBetween(d.pos,l.to,void 0," ")}if(d&&h){const f=h.split(r5).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const g=Bd(p).map(b=>b.toObject(t.defaultProtocol));if(!o5(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{vd(b.from,b.to,r.doc).some(v=>v.mark.type===t.type)||o.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function u5(t){return new we({key:new Be("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(h=>h.nodeName==="A"))return!1;const u=m1(e.state,t.type.name),l=r.target,c=(i=l?.href)!==null&&i!==void 0?i:u.href,d=(s=l?.target)!==null&&s!==void 0?s:u.target;return l&&c?(window.open(c,d),!0):!1}}})}function l5(t){return new we({key:new Be("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";r.content.forEach(l=>{a+=l.textContent});const u=Mb(a,{defaultProtocol:t.defaultProtocol}).find(l=>l.isLink&&l.value===a);return!a||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Xn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(s5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const c5=it.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"){i0(t);return}i0(t.scheme,t.optionalSlashes)})},onDestroy(){t5()},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)=>!!Xn(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=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Xn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Xn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ge(this.options.HTMLAttributes,t),0]:["a",ge(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Xn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Xn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vr({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=Mb(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Xn(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(a5({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Xn(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(u5({type:this.type})),this.options.linkOnPaste&&t.push(l5({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),d5=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,h5=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,Ab=t=>t.match(d5),f5=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",p5=t=>t.searchParams.has("v")?{id:t.searchParams.get("v")}:t.hostname==="youtu.be"||t.pathname.includes("shorts")||t.pathname.includes("live")?{id:t.pathname.split("/").pop()}:t.searchParams.has("list")?{id:t.searchParams.get("list"),isPlaylist:!0}:null,m5=t=>{var e;const{url:n,allowFullscreen:r,autoplay:i,ccLanguage:s,ccLoadPolicy:o,controls:a,disableKBcontrols:u,enableIFrameApi:l,endTime:c,interfaceLanguage:d,ivLoadPolicy:h,loop:f,modestBranding:p,nocookie:m,origin:g,playlist:b,progressBarColor:v,startAt:_,rel:x}=t;if(!Ab(n))return null;if(n.includes("/embed/"))return n;const y=new URL(n),{id:w,isPlaylist:C}=(e=p5(y))!==null&&e!==void 0?e:{};if(!w)return null;const k=new URL(`${f5(m,C)}${w}`);return y.searchParams.has("t")&&k.searchParams.set("start",y.searchParams.get("t").replaceAll("s","")),r===!1&&k.searchParams.set("fs","0"),i&&k.searchParams.set("autoplay","1"),s&&k.searchParams.set("cc_lang_pref",s),o&&k.searchParams.set("cc_load_policy","1"),a||k.searchParams.set("controls","0"),u&&k.searchParams.set("disablekb","1"),l&&k.searchParams.set("enablejsapi","1"),c&&k.searchParams.set("end",c.toString()),d&&k.searchParams.set("hl",d),h&&k.searchParams.set("iv_load_policy",h.toString()),f&&k.searchParams.set("loop","1"),p&&k.searchParams.set("modestbranding","1"),g&&k.searchParams.set("origin",g),b&&k.searchParams.set("playlist",b),_&&k.searchParams.set("start",_.toString()),v&&k.searchParams.set("color",v),x!==void 0&&k.searchParams.set("rel",x.toString()),k.toString()},g5=te.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,rel:1}},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})=>Ab(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[Mw({find:h5,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=m5({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,rel:this.options.rel});return t.src=e,["div",{"data-youtube-video":""},["iframe",ge(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,rel:this.options.rel},t)]]}});function b5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Tb={exports:{}},nl={};/**
|
|
129
|
+
3. "-" cannot repeat`);le.customSchemes.push([t,e])}function f5(){le.scanner=s5(le.customSchemes);for(let t=0;t<le.tokenQueue.length;t++)le.tokenQueue[t][1]({scanner:le.scanner});le.parser=u5(le.scanner.tokens);for(let t=0;t<le.pluginQueue.length;t++)le.pluginQueue[t][1]({scanner:le.scanner,parser:le.parser});return le.initialized=!0,le}function Hd(t){return le.initialized||f5(),l5(le.parser.start,t,Tb(le.scanner.start,t))}Hd.scan=Tb;function Ob(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new zd(n),i=Hd(t),s=[];for(let o=0;o<i.length;o++){const a=i[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}const jd="[\0- -\u2029 ]",p5=new RegExp(jd),m5=new RegExp(`${jd}$`),g5=new RegExp(jd,"g");function b5(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function v5(t){return new we({key:new Be("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(l=>l.docChanged)&&!n.doc.eq(r.doc),s=e.some(l=>l.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,a=rw(n.doc,[...e]);if(cw(a).forEach(({newRange:l})=>{const c=sw(r.doc,l,f=>f.isTextblock);let d,h;if(c.length>1)d=c[0],h=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(c.length){const f=r.doc.textBetween(l.from,l.to," "," ");if(!m5.test(f))return;d=c[0],h=r.doc.textBetween(d.pos,l.to,void 0," ")}if(d&&h){const f=h.split(p5).filter(Boolean);if(f.length<=0)return!1;const p=f[f.length-1],m=d.pos+h.lastIndexOf(p);if(!p)return!1;const g=Hd(p).map(b=>b.toObject(t.defaultProtocol));if(!b5(g))return!1;g.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>t.validate(b.value)).filter(b=>t.shouldAutoLink(b.value)).forEach(b=>{xd(b.from,b.to,r.doc).some(v=>v.mark.type===t.type)||o.addMark(b.from,b.to,t.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function y5(t){return new we({key:new Be("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,s;if(r.button!==0||!e.editable)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(h=>h.nodeName==="A"))return!1;const u=y1(e.state,t.type.name),l=r.target,c=(i=l?.href)!==null&&i!==void 0?i:u.href,d=(s=l?.target)!==null&&s!==void 0?s:u.target;return l&&c?(window.open(c,d),!0):!1}}})}function _5(t){return new we({key:new Be("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let a="";r.content.forEach(l=>{a+=l.textContent});const u=Ob(a,{defaultProtocol:t.defaultProtocol}).find(l=>l.isLink&&l.value===a);return!a||!u?!1:t.editor.commands.setMark(t.type,{href:u.href})}}})}function Qn(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(g5,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const x5=it.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"){a0(t);return}a0(t.scheme,t.optionalSlashes)})},onDestroy(){h5()},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)=>!!Qn(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=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Qn(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Qn(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ge(this.options.HTMLAttributes,t),0]:["a",ge(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Qn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Qn(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[yr({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=Ob(t).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:o=>!!Qn(o,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.start}))}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(v5({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Qn(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(y5({type:this.type})),this.options.linkOnPaste&&t.push(_5({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),k5=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/,w5=/^((?:https?:)?\/\/)?((?:www|m|music)\.)?((?:youtube\.com|youtu\.be|youtube-nocookie\.com))(\/(?:[\w-]+\?v=|embed\/|v\/)?)([\w-]+)(\S+)?$/g,Rb=t=>t.match(k5),C5=(t,e)=>e?"https://www.youtube-nocookie.com/embed/videoseries?list=":t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",E5=t=>t.searchParams.has("v")?{id:t.searchParams.get("v")}:t.hostname==="youtu.be"||t.pathname.includes("shorts")||t.pathname.includes("live")?{id:t.pathname.split("/").pop()}:t.searchParams.has("list")?{id:t.searchParams.get("list"),isPlaylist:!0}:null,S5=t=>{var e;const{url:n,allowFullscreen:r,autoplay:i,ccLanguage:s,ccLoadPolicy:o,controls:a,disableKBcontrols:u,enableIFrameApi:l,endTime:c,interfaceLanguage:d,ivLoadPolicy:h,loop:f,modestBranding:p,nocookie:m,origin:g,playlist:b,progressBarColor:v,startAt:_,rel:x}=t;if(!Rb(n))return null;if(n.includes("/embed/"))return n;const y=new URL(n),{id:w,isPlaylist:C}=(e=E5(y))!==null&&e!==void 0?e:{};if(!w)return null;const k=new URL(`${C5(m,C)}${w}`);return y.searchParams.has("t")&&k.searchParams.set("start",y.searchParams.get("t").replaceAll("s","")),r===!1&&k.searchParams.set("fs","0"),i&&k.searchParams.set("autoplay","1"),s&&k.searchParams.set("cc_lang_pref",s),o&&k.searchParams.set("cc_load_policy","1"),a||k.searchParams.set("controls","0"),u&&k.searchParams.set("disablekb","1"),l&&k.searchParams.set("enablejsapi","1"),c&&k.searchParams.set("end",c.toString()),d&&k.searchParams.set("hl",d),h&&k.searchParams.set("iv_load_policy",h.toString()),f&&k.searchParams.set("loop","1"),p&&k.searchParams.set("modestbranding","1"),g&&k.searchParams.set("origin",g),b&&k.searchParams.set("playlist",b),_&&k.searchParams.set("start",_.toString()),v&&k.searchParams.set("color",v),x!==void 0&&k.searchParams.set("rel",x.toString()),k.toString()},M5=te.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,rel:1}},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})=>Rb(t.src)?e.insertContent({type:this.name,attrs:t}):!1}},addPasteRules(){return this.options.addPasteHandler?[Bw({find:w5,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=S5({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,rel:this.options.rel});return t.src=e,["div",{"data-youtube-video":""},["iframe",ge(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,rel:this.options.rel},t)]]}});function A5(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Nb={exports:{}},il={};/**
|
|
130
130
|
* @license React
|
|
131
131
|
* use-sync-external-store-shim.production.min.js
|
|
132
132
|
*
|
|
@@ -134,7 +134,7 @@ ${n.innerHTML}
|
|
|
134
134
|
*
|
|
135
135
|
* This source code is licensed under the MIT license found in the
|
|
136
136
|
* LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/var
|
|
137
|
+
*/var u0;function T5(){if(u0)return il;u0=1;var t=oe;function e(d,h){return d===h&&(d!==0||1/d===1/h)||d!==d&&h!==h}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,s=t.useLayoutEffect,o=t.useDebugValue;function a(d,h){var f=h(),p=r({inst:{value:f,getSnapshot:h}}),m=p[0].inst,g=p[1];return s(function(){m.value=f,m.getSnapshot=h,u(m)&&g({inst:m})},[d,f,h]),i(function(){return u(m)&&g({inst:m}),d(function(){u(m)&&g({inst:m})})},[d]),o(f),f}function u(d){var h=d.getSnapshot;d=d.value;try{var f=h();return!n(d,f)}catch{return!0}}function l(d,h){return h()}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return il.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:c,il}Nb.exports=T5();var Vd=Nb.exports;const D5=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},O5=({contentComponent:t})=>{const e=Vd.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return oe.createElement(oe.Fragment,null,Object.values(e))};function R5(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:Jb.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}class N5 extends oe.Component{constructor(e){var n;super(e),this.editorContentRef=oe.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=R5(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...r}=this.props;return oe.createElement(oe.Fragment,null,oe.createElement("div",{ref:D5(n,this.editorContentRef),...r}),e?.contentComponent&&oe.createElement(O5,{contentComponent:e.contentComponent}))}}const F5=p0((t,e)=>{const n=oe.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return oe.createElement(N5,{key:n,innerRef:e,...t})}),I5=oe.memo(F5);var P5=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n},L5=A5(P5),Fb={exports:{}},sl={};/**
|
|
138
138
|
* @license React
|
|
139
139
|
* use-sync-external-store-shim/with-selector.production.min.js
|
|
140
140
|
*
|
|
@@ -142,7 +142,7 @@ ${n.innerHTML}
|
|
|
142
142
|
*
|
|
143
143
|
* This source code is licensed under the MIT license found in the
|
|
144
144
|
* LICENSE file in the root directory of this source tree.
|
|
145
|
-
*/var o0;function M5(){if(o0)return rl;o0=1;var t=oe,e=zd;function n(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,u=t.useDebugValue;return rl.useSyncExternalStoreWithSelector=function(l,c,d,h,f){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(w){if(!v){if(v=!0,_=w,w=h(w),f!==void 0&&m.hasValue){var C=m.value;if(f(C,w))return x=C}return x=w}if(C=x,r(_,w))return C;var k=h(w);return f!==void 0&&f(C,k)?C:(_=w,x=k)}var v=!1,_,x,y=d===void 0?null:d;return[function(){return b(c())},y===null?void 0:function(){return b(y())}]},[c,d,h,f]);var g=i(l,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),u(g),g},rl}Db.exports=M5();var A5=Db.exports;const T5=typeof window<"u"?c0:J;class D5{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function O5(t){var e;const[n]=Z(()=>new D5(t.editor)),r=A5.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:S5);return T5(()=>n.watch(t.editor),[t.editor,n]),h0(r),r}const R5=!1,Ac=typeof window>"u",N5=Ac||!!(typeof window<"u"&&window.next);class Hd{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Ac||N5?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)===null||s===void 0?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)===null||s===void 0?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)===null||s===void 0?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)===null||s===void 0?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)===null||s===void 0?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)===null||s===void 0?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)===null||s===void 0?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)===null||s===void 0?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)===null||s===void 0?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)===null||s===void 0?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)===null||s===void 0?void 0:s.call(i,...r)}};return new Ew(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?Hd.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function F5(t={},e=[]){const n=De(t);n.current=t;const[r]=Z(()=>new Hd(n)),i=zd.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return h0(i),J(r.onRender(e)),O5({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const I5=Oc({editor:null});I5.Consumer;const P5=Oc({onDragStart:void 0}),L5=()=>l0(P5);oe.forwardRef((t,e)=>{const{onDragStart:n}=L5(),r=t.as||"div";return oe.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function B5(t){return ee({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"},child:[]}]})(t)}function $5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M16 8l-4 -4l-4 4"},child:[]},{tag:"path",attr:{d:"M12 20v-16"},child:[]},{tag:"path",attr:{d:"M18 18c-4 -1.333 -6 -4.667 -6 -10"},child:[]},{tag:"path",attr:{d:"M6 18c4 -1.333 6 -4.667 6 -10"},child:[]}]})(t)}function z5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 15h15"},child:[]},{tag:"path",attr:{d:"M21 19h-15"},child:[]},{tag:"path",attr:{d:"M15 11h6"},child:[]},{tag:"path",attr:{d:"M21 7h-6"},child:[]},{tag:"path",attr:{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"},child:[]}]})(t)}function H5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"},child:[]},{tag:"path",attr:{d:"M10 9l5 3l-5 3z"},child:[]}]})(t)}function j5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"},child:[]},{tag:"path",attr:{d:"M15 12l4 0"},child:[]},{tag:"path",attr:{d:"M17 10l0 4"},child:[]}]})(t)}function V5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"},child:[]},{tag:"path",attr:{d:"M16 10l4 4"},child:[]},{tag:"path",attr:{d:"M16 14l4 -4"},child:[]}]})(t)}function q5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 8h.01"},child:[]},{tag:"path",attr:{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z"},child:[]},{tag:"path",attr:{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"},child:[]},{tag:"path",attr:{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3"},child:[]}]})(t)}function W5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"},child:[]},{tag:"path",attr:{d:"M12 15l0 4"},child:[]},{tag:"path",attr:{d:"M14 17l-4 0"},child:[]}]})(t)}function U5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"},child:[]},{tag:"path",attr:{d:"M10 16l4 4"},child:[]},{tag:"path",attr:{d:"M10 20l4 -4"},child:[]}]})(t)}function K5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(t)}function J5(t){return ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M3.604 3.089A.75.75 0 0 1 4 3.75V8.5h.75a.75.75 0 0 1 0 1.5h-3a.75.75 0 1 1 0-1.5h.75V5.151l-.334.223a.75.75 0 0 1-.832-1.248l1.5-1a.75.75 0 0 1 .77-.037ZM8.75 5.5a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75ZM5.5 15.75c0-.704-.271-1.286-.72-1.686a2.302 2.302 0 0 0-1.53-.564c-.535 0-1.094.178-1.53.565-.449.399-.72.982-.72 1.685a.75.75 0 0 0 1.5 0c0-.296.104-.464.217-.564A.805.805 0 0 1 3.25 15c.215 0 .406.072.533.185.113.101.217.268.217.565 0 .332-.069.48-.21.657-.092.113-.216.24-.403.419l-.147.14c-.152.144-.33.313-.52.504l-1.5 1.5a.75.75 0 0 0-.22.53v.25c0 .414.336.75.75.75H5A.75.75 0 0 0 5 19H3.31l.47-.47c.176-.176.333-.324.48-.465l.165-.156a5.98 5.98 0 0 0 .536-.566c.358-.447.539-.925.539-1.593Z"},child:[]}]})(t)}function G5(t){return ee({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z"},child:[]}]})(t)}const Y5=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Z5=te.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",ge(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[C1({find:Y5,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),a0=1920,u0=1080;function X5(t){return new Promise((e,n)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{URL.revokeObjectURL(i);let{width:s,height:o}=r;if(s>a0||o>u0){const l=Math.min(a0/s,u0/o);s=Math.round(s*l),o=Math.round(o*l)}const a=document.createElement("canvas");a.width=s,a.height=o;const u=a.getContext("2d");if(!u)return n(new Error("Could not get 2D canvas context"));u.drawImage(r,0,0,s,o),a.toBlob(l=>{l?e(l):n(new Error("canvas.toBlob returned null"))},"image/png")},r.onerror=()=>{URL.revokeObjectURL(i),n(new Error("Failed to load image for conversion"))},r.src=i})}function wM(t){const e=/!\[[^\]]*\]\(([^)\s]+)\)/g,n=[];let r;for(;(r=e.exec(t))!==null;)n.push(r[1]);return n}var Ob=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const Q5=new Be("imageUpload"),eM=t=>Z5.extend({addProseMirrorPlugins(){const e=this.editor;return[new we({key:Q5,props:{handleDrop(n,r){var i,s;if(!t)return!1;const a=Array.from((s=(i=r.dataTransfer)===null||i===void 0?void 0:i.files)!==null&&s!==void 0?s:[]).find(u=>u.type.startsWith("image/"));return a?(r.preventDefault(),Tc(a,t,e),!0):!1},handlePaste(n,r){var i,s;if(!t)return!1;const a=Array.from((s=(i=r.clipboardData)===null||i===void 0?void 0:i.items)!==null&&s!==void 0?s:[]).find(l=>l.type.startsWith("image/"));if(!a)return!1;const u=a.getAsFile();return u?(r.preventDefault(),Tc(u,t,e),!0):!1}}})]}}).configure({HTMLAttributes:{class:"max-w-full h-auto rounded-lg my-4"}});function Tc(t,e,n){return Ob(this,void 0,void 0,function*(){try{const r=yield X5(t),i=yield e(r);i&&n.chain().focus().setImage({src:i}).run()}catch{}})}function tM(t,e){const n=document.createElement("input");n.type="file",n.accept="image/*",n.onchange=()=>Ob(this,void 0,void 0,function*(){var r;const i=(r=n.files)===null||r===void 0?void 0:r[0];i&&(yield Tc(i,t,e))}),n.click()}var Dc=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const nM=lb.extend({addStorage(){return{markdown:{serialize(t,e){e.childCount===0?t.write("<p></p>"):t.renderInline(e),t.closeBlock(e)},parse:{}}}}});function oo(t){return t.storage.markdown.getMarkdown()}const _t=({editor:t,action:e,isActive:n,label:r,disabled:i,title:s})=>{const o="w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 "+(n?"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground");if(e.toLowerCase().includes("heading")){const a=parseInt(e[e.length-1]);return A("button",{type:"button",title:s,onClick:()=>t.chain().focus().toggleHeading({level:a}).run(),className:o,children:r})}return A("button",{type:"button",title:s,onClick:()=>t.chain().focus()[e]().run(),disabled:i?!t.can().chain()[e]().run():!1,className:o,children:r})},rM=({panel:t,onClose:e,editor:n,onUpdate:r,labels:i,onTransform:s,isTransforming:o})=>{const[a,u]=Z("");if(J(()=>{if(t==="link"){const f=n.getAttributes("link").href;u(typeof f=="string"?f:"https://")}else u("")},[t,n]),!t)return null;const l=()=>{if(t==="link"){const f=a.trim();f&&f!=="https://"&&n.chain().focus().setLink({href:f}).run(),e()}else if(t==="youtube"){const f=a.trim();f&&n.commands.setYoutubeVideo({src:f}),e()}else if(t==="markdown"){if(!a.trim())return;const p=oo(n)+`
|
|
145
|
+
*/var l0;function B5(){if(l0)return sl;l0=1;var t=oe,e=Vd;function n(l,c){return l===c&&(l!==0||1/l===1/c)||l!==l&&c!==c}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,s=t.useRef,o=t.useEffect,a=t.useMemo,u=t.useDebugValue;return sl.useSyncExternalStoreWithSelector=function(l,c,d,h,f){var p=s(null);if(p.current===null){var m={hasValue:!1,value:null};p.current=m}else m=p.current;p=a(function(){function b(w){if(!v){if(v=!0,_=w,w=h(w),f!==void 0&&m.hasValue){var C=m.value;if(f(C,w))return x=C}return x=w}if(C=x,r(_,w))return C;var k=h(w);return f!==void 0&&f(C,k)?C:(_=w,x=k)}var v=!1,_,x,y=d===void 0?null:d;return[function(){return b(c())},y===null?void 0:function(){return b(y())}]},[c,d,h,f]);var g=i(l,p[0],p[1]);return o(function(){m.hasValue=!0,m.value=g},[g]),u(g),g},sl}Fb.exports=B5();var $5=Fb.exports;const z5=typeof window<"u"?f0:J;class H5{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const n=()=>{this.transactionNumber+=1,this.subscribers.forEach(i=>i())},r=this.editor;return r.on("transaction",n),()=>{r.off("transaction",n)}}}}function j5(t){var e;const[n]=Z(()=>new H5(t.editor)),r=$5.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:L5);return z5(()=>n.watch(t.editor),[t.editor,n]),m0(r),r}const V5=!1,Dc=typeof window>"u",q5=Dc||!!(typeof window<"u"&&window.next);class qd{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Dc||q5?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onBeforeCreate)===null||s===void 0?void 0:s.call(i,...r)},onBlur:(...r)=>{var i,s;return(s=(i=this.options.current).onBlur)===null||s===void 0?void 0:s.call(i,...r)},onCreate:(...r)=>{var i,s;return(s=(i=this.options.current).onCreate)===null||s===void 0?void 0:s.call(i,...r)},onDestroy:(...r)=>{var i,s;return(s=(i=this.options.current).onDestroy)===null||s===void 0?void 0:s.call(i,...r)},onFocus:(...r)=>{var i,s;return(s=(i=this.options.current).onFocus)===null||s===void 0?void 0:s.call(i,...r)},onSelectionUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onSelectionUpdate)===null||s===void 0?void 0:s.call(i,...r)},onTransaction:(...r)=>{var i,s;return(s=(i=this.options.current).onTransaction)===null||s===void 0?void 0:s.call(i,...r)},onUpdate:(...r)=>{var i,s;return(s=(i=this.options.current).onUpdate)===null||s===void 0?void 0:s.call(i,...r)},onContentError:(...r)=>{var i,s;return(s=(i=this.options.current).onContentError)===null||s===void 0?void 0:s.call(i,...r)},onDrop:(...r)=>{var i,s;return(s=(i=this.options.current).onDrop)===null||s===void 0?void 0:s.call(i,...r)},onPaste:(...r)=>{var i,s;return(s=(i=this.options.current).onPaste)===null||s===void 0?void 0:s.call(i,...r)}};return new Pw(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,s)=>{var o;return i===((o=n.extensions)===null||o===void 0?void 0:o[s])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?qd.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function W5(t={},e=[]){const n=De(t);n.current=t;const[r]=Z(()=>new qd(n)),i=Vd.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return m0(i),J(r.onRender(e)),j5({editor:i,selector:({transactionNumber:s})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&s===0?0:s+1}),i}const U5=Nc({editor:null});U5.Consumer;const K5=Nc({onDragStart:void 0}),J5=()=>h0(K5);oe.forwardRef((t,e)=>{const{onDragStart:n}=J5(),r=t.as||"div";return oe.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function G5(t){return ee({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M58.34,101.66l-32-32a8,8,0,0,1,0-11.32l32-32A8,8,0,0,1,69.66,37.66L43.31,64,69.66,90.34a8,8,0,0,1-11.32,11.32Zm40,0a8,8,0,0,0,11.32,0l32-32a8,8,0,0,0,0-11.32l-32-32A8,8,0,0,0,98.34,37.66L124.69,64,98.34,90.34A8,8,0,0,0,98.34,101.66ZM200,40H176a8,8,0,0,0,0,16h24V200H56V136a8,8,0,0,0-16,0v64a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Z"},child:[]}]})(t)}function Y5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M16 8l-4 -4l-4 4"},child:[]},{tag:"path",attr:{d:"M12 20v-16"},child:[]},{tag:"path",attr:{d:"M18 18c-4 -1.333 -6 -4.667 -6 -10"},child:[]},{tag:"path",attr:{d:"M6 18c4 -1.333 6 -4.667 6 -10"},child:[]}]})(t)}function Z5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 15h15"},child:[]},{tag:"path",attr:{d:"M21 19h-15"},child:[]},{tag:"path",attr:{d:"M15 11h6"},child:[]},{tag:"path",attr:{d:"M21 7h-6"},child:[]},{tag:"path",attr:{d:"M9 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"},child:[]},{tag:"path",attr:{d:"M3 9h1a1 1 0 1 1 -1 1v-2.5a2 2 0 0 1 2 -2"},child:[]}]})(t)}function X5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z"},child:[]},{tag:"path",attr:{d:"M10 9l5 3l-5 3z"},child:[]}]})(t)}function Q5(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"},child:[]},{tag:"path",attr:{d:"M15 12l4 0"},child:[]},{tag:"path",attr:{d:"M17 10l0 4"},child:[]}]})(t)}function eM(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M6 4h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1v-14a1 1 0 0 1 1 -1z"},child:[]},{tag:"path",attr:{d:"M16 10l4 4"},child:[]},{tag:"path",attr:{d:"M16 14l4 -4"},child:[]}]})(t)}function tM(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 8h.01"},child:[]},{tag:"path",attr:{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z"},child:[]},{tag:"path",attr:{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5"},child:[]},{tag:"path",attr:{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3"},child:[]}]})(t)}function nM(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"},child:[]},{tag:"path",attr:{d:"M12 15l0 4"},child:[]},{tag:"path",attr:{d:"M14 17l-4 0"},child:[]}]})(t)}function rM(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6v4a1 1 0 0 1 -1 1h-14a1 1 0 0 1 -1 -1v-4a1 1 0 0 1 1 -1h14a1 1 0 0 1 1 1z"},child:[]},{tag:"path",attr:{d:"M10 16l4 4"},child:[]},{tag:"path",attr:{d:"M10 20l4 -4"},child:[]}]})(t)}function iM(t){return ee({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]},{tag:"path",attr:{d:"M10 3v18"},child:[]}]})(t)}function sM(t){return ee({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M3.604 3.089A.75.75 0 0 1 4 3.75V8.5h.75a.75.75 0 0 1 0 1.5h-3a.75.75 0 1 1 0-1.5h.75V5.151l-.334.223a.75.75 0 0 1-.832-1.248l1.5-1a.75.75 0 0 1 .77-.037ZM8.75 5.5a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75Zm0 6a.75.75 0 0 0 0 1.5h11.5a.75.75 0 0 0 0-1.5H8.75ZM5.5 15.75c0-.704-.271-1.286-.72-1.686a2.302 2.302 0 0 0-1.53-.564c-.535 0-1.094.178-1.53.565-.449.399-.72.982-.72 1.685a.75.75 0 0 0 1.5 0c0-.296.104-.464.217-.564A.805.805 0 0 1 3.25 15c.215 0 .406.072.533.185.113.101.217.268.217.565 0 .332-.069.48-.21.657-.092.113-.216.24-.403.419l-.147.14c-.152.144-.33.313-.52.504l-1.5 1.5a.75.75 0 0 0-.22.53v.25c0 .414.336.75.75.75H5A.75.75 0 0 0 5 19H3.31l.47-.47c.176-.176.333-.324.48-.465l.165-.156a5.98 5.98 0 0 0 .536-.566c.358-.447.539-.925.539-1.593Z"},child:[]}]})(t)}function oM(t){return ee({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M912 192H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 284H328c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h584c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM104 228a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0zm0 284a56 56 0 1 0 112 0 56 56 0 1 0-112 0z"},child:[]}]})(t)}const aM=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,uM=te.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",ge(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[A1({find:aM,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),c0=1920,d0=1080;function lM(t){return new Promise((e,n)=>{const r=new Image,i=URL.createObjectURL(t);r.onload=()=>{URL.revokeObjectURL(i);let{width:s,height:o}=r;if(s>c0||o>d0){const l=Math.min(c0/s,d0/o);s=Math.round(s*l),o=Math.round(o*l)}const a=document.createElement("canvas");a.width=s,a.height=o;const u=a.getContext("2d");if(!u)return n(new Error("Could not get 2D canvas context"));u.drawImage(r,0,0,s,o),a.toBlob(l=>{l?e(l):n(new Error("canvas.toBlob returned null"))},"image/png")},r.onerror=()=>{URL.revokeObjectURL(i),n(new Error("Failed to load image for conversion"))},r.src=i})}function cM(t){const e=/!\[[^\]]*\]\(([^)\s]+)\)/g,n=[];let r;for(;(r=e.exec(t))!==null;)n.push(r[1]);return n}var Ib=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const dM=new Be("imageUpload"),hM=t=>uM.extend({addProseMirrorPlugins(){const e=this.editor;return[new we({key:dM,props:{handleDrop(n,r){var i,s;if(!t)return!1;const a=Array.from((s=(i=r.dataTransfer)===null||i===void 0?void 0:i.files)!==null&&s!==void 0?s:[]).find(u=>u.type.startsWith("image/"));return a?(r.preventDefault(),Oc(a,t,e),!0):!1},handlePaste(n,r){var i,s;if(!t)return!1;const a=Array.from((s=(i=r.clipboardData)===null||i===void 0?void 0:i.items)!==null&&s!==void 0?s:[]).find(l=>l.type.startsWith("image/"));if(!a)return!1;const u=a.getAsFile();return u?(r.preventDefault(),Oc(u,t,e),!0):!1}}})]}}).configure({HTMLAttributes:{class:"max-w-full h-auto rounded-lg my-4"}});function Oc(t,e,n){return Ib(this,void 0,void 0,function*(){try{const r=yield lM(t),i=yield e(r);i&&n.chain().focus().setImage({src:i}).run()}catch{}})}function fM(t,e){const n=document.createElement("input");n.type="file",n.accept="image/*",n.onchange=()=>Ib(this,void 0,void 0,function*(){var r;const i=(r=n.files)===null||r===void 0?void 0:r[0];i&&(yield Oc(i,t,e))}),n.click()}var Rc=function(t,e,n,r){function i(s){return s instanceof n?s:new n(function(o){o(s)})}return new(n||(n=Promise))(function(s,o){function a(c){try{l(r.next(c))}catch(d){o(d)}}function u(c){try{l(r.throw(c))}catch(d){o(d)}}function l(c){c.done?s(c.value):i(c.value).then(a,u)}l((r=r.apply(t,e||[])).next())})};const pM=fb.extend({addStorage(){return{markdown:{serialize(t,e){e.childCount===0?t.write("<p></p>"):t.renderInline(e),t.closeBlock(e)},parse:{}}}}});function ao(t){return t.storage.markdown.getMarkdown()}const _t=({editor:t,action:e,isActive:n,label:r,disabled:i,title:s})=>{const o="w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 "+(n?"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-accent-foreground");if(e.toLowerCase().includes("heading")){const a=parseInt(e[e.length-1]);return A("button",{type:"button",title:s,onClick:()=>t.chain().focus().toggleHeading({level:a}).run(),className:o,children:r})}return A("button",{type:"button",title:s,onClick:()=>t.chain().focus()[e]().run(),disabled:i?!t.can().chain()[e]().run():!1,className:o,children:r})},mM=({panel:t,onClose:e,editor:n,onUpdate:r,labels:i,onTransform:s,isTransforming:o})=>{const[a,u]=Z("");if(J(()=>{if(t==="link"){const f=n.getAttributes("link").href;u(typeof f=="string"?f:"https://")}else u("")},[t,n]),!t)return null;const l=()=>{if(t==="link"){const f=a.trim();f&&f!=="https://"&&n.chain().focus().setLink({href:f}).run(),e()}else if(t==="youtube"){const f=a.trim();f&&n.commands.setYoutubeVideo({src:f}),e()}else if(t==="markdown"){if(!a.trim())return;const p=ao(n)+`
|
|
146
146
|
|
|
147
|
-
`+a.trim();n.commands.setContent(p),n.commands.focus("end"),r(p),e()}else if(t==="transform"){if(!a.trim()||!s)return;s(a.trim())}},c=f=>{f.key==="Enter"&&l(),f.key==="Escape"&&e()},d=t==="markdown",h=t==="transform";return Me("div",{className:"bg-muted/80 border-b border-border px-2 py-1.5 flex flex-col gap-1.5",children:[A("p",{className:"text-xs text-muted-foreground",children:t==="link"?i.setLinkTitle:t==="youtube"?i.addYoutubeTitle:t==="transform"?i.transformSelectionTitle:i.appendMarkdownTitle}),h?A("input",{autoFocus:!0,type:"text",value:a,onChange:f=>u(f.target.value),onKeyDown:c,placeholder:i.transformSelectionPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring"}):d?A("textarea",{autoFocus:!0,rows:4,value:a,onChange:f=>u(f.target.value),onKeyDown:f=>f.key==="Escape"&&e(),placeholder:i.appendMarkdownPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 resize-y outline-none focus:ring-1 focus:ring-ring"}):A("input",{autoFocus:!0,type:"url",value:a,onChange:f=>u(f.target.value),onKeyDown:c,placeholder:t==="link"?i.setLinkUrlPlaceholder:i.addYoutubeUrlPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring"}),Me("div",{className:"flex gap-2 justify-end",children:[A("button",{type:"button",onClick:e,disabled:o,className:"text-xs px-3 py-1 rounded border border-border hover:bg-accent transition-colors disabled:opacity-40",children:i.cancel}),Me("button",{type:"button",onClick:l,disabled:!a.trim()||t==="link"&&a.trim()==="https://"||o,className:"text-xs px-3 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-colors flex items-center gap-1",children:[o&&A(
|
|
148
|
-
`);b(!0);const L=yield a.getText({messages:[],prompt:"global.editor.transform-text",variables:{instruction:k,text:F}});if(b(!1),!L)return;x.chain().focus().deleteRange({from:S,to:D}).insertContentAt(S,L).run();const j=
|
|
147
|
+
`+a.trim();n.commands.setContent(p),n.commands.focus("end"),r(p),e()}else if(t==="transform"){if(!a.trim()||!s)return;s(a.trim())}},c=f=>{f.key==="Enter"&&l(),f.key==="Escape"&&e()},d=t==="markdown",h=t==="transform";return Me("div",{className:"bg-muted/80 border-b border-border px-2 py-1.5 flex flex-col gap-1.5",children:[A("p",{className:"text-xs text-muted-foreground",children:t==="link"?i.setLinkTitle:t==="youtube"?i.addYoutubeTitle:t==="transform"?i.transformSelectionTitle:i.appendMarkdownTitle}),h?A("input",{autoFocus:!0,type:"text",value:a,onChange:f=>u(f.target.value),onKeyDown:c,placeholder:i.transformSelectionPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring"}):d?A("textarea",{autoFocus:!0,rows:4,value:a,onChange:f=>u(f.target.value),onKeyDown:f=>f.key==="Escape"&&e(),placeholder:i.appendMarkdownPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 resize-y outline-none focus:ring-1 focus:ring-ring"}):A("input",{autoFocus:!0,type:"url",value:a,onChange:f=>u(f.target.value),onKeyDown:c,placeholder:t==="link"?i.setLinkUrlPlaceholder:i.addYoutubeUrlPlaceholder,className:"w-full text-sm font-mono rounded border border-border bg-background px-2 py-1 outline-none focus:ring-1 focus:ring-ring"}),Me("div",{className:"flex gap-2 justify-end",children:[A("button",{type:"button",onClick:e,disabled:o,className:"text-xs px-3 py-1 rounded border border-border hover:bg-accent transition-colors disabled:opacity-40",children:i.cancel}),Me("button",{type:"button",onClick:l,disabled:!a.trim()||t==="link"&&a.trim()==="https://"||o,className:"text-xs px-3 py-1 rounded bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-40 transition-colors flex items-center gap-1",children:[o&&A(Wy,{size:12,className:"animate-spin"}),t==="link"?i.setLinkConfirm:t==="youtube"?i.addYoutubeConfirm:t==="transform"?i.transformSelectionConfirm:i.appendMarkdownConfirm]})]})]})},gM=({editor:t,onUpdate:e,uploadImage:n,labels:r,onCopy:i,copied:s,isFullscreen:o,onToggleFullscreen:a,hasSelection:u,onTransform:l,isTransforming:c})=>{const[d,h]=Z(null),f=b=>h(v=>v===b?null:b),p=t.isActive("table"),m=t.isActive("link"),g="w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-40 disabled:pointer-events-none";return Me(Gd,{children:[Me("div",{className:"bg-muted/50 border-b border-border text-base flex flex-row flex-wrap items-center gap-0.5 p-1.5",children:[A(_t,{editor:t,action:"toggleBold",isActive:t.isActive("bold"),label:A(yy,{}),disabled:!0,title:r.bold}),A(_t,{editor:t,action:"toggleItalic",isActive:t.isActive("italic"),label:A(xy,{}),disabled:!0,title:r.italic}),A(_t,{editor:t,action:"toggleStrike",isActive:t.isActive("strike"),label:A(Ey,{}),disabled:!0,title:r.strike}),A(_t,{editor:t,action:"toggleCode",isActive:t.isActive("code"),label:A(_y,{}),disabled:!0,title:r.code}),A(_t,{editor:t,action:"setParagraph",isActive:t.isActive("paragraph"),label:A(ky,{}),title:r.paragraph}),A(_t,{editor:t,action:"setHeading1",isActive:t.isActive("heading",{level:1}),label:A(Hy,{size:"24px"}),title:r.heading1}),A(_t,{editor:t,action:"setHeading2",isActive:t.isActive("heading",{level:2}),label:A(jy,{size:"24px"}),title:r.heading2}),A(_t,{editor:t,action:"setHeading3",isActive:t.isActive("heading",{level:3}),label:A(Vy,{size:"24px"}),title:r.heading3}),A(_t,{editor:t,action:"toggleBulletList",isActive:t.isActive("bulletList"),label:A(oM,{size:"24px"}),title:r.bulletList}),A(_t,{editor:t,action:"toggleOrderedList",isActive:t.isActive("orderedList"),label:A(sM,{size:"24px"}),title:r.orderedList}),A(_t,{editor:t,action:"toggleCodeBlock",isActive:t.isActive("codeBlock"),label:A(G5,{size:"24px"}),title:r.codeBlock}),A(_t,{editor:t,action:"toggleBlockquote",isActive:t.isActive("blockquote"),label:A(Z5,{size:"24px"}),title:r.blockquote}),A("div",{className:"w-px h-5 bg-border mx-0.5"}),A("button",{type:"button",onClick:()=>{m?t.chain().focus().unsetLink().run():f("link")},title:m?r.unsetLink:r.setLink,className:"w-8 h-8 flex items-center justify-center rounded-md transition-colors duration-150 "+(m?"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-foreground hover:bg-destructive/10 hover:text-destructive":"text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:A(qy,{size:18})}),A("button",{type:"button",onClick:()=>f("youtube"),className:g,title:r.addYoutube,children:A(X5,{size:18})}),n&&A("button",{type:"button",onClick:()=>fM(n,t),className:g,title:r.insertImage,children:A(tM,{size:18})}),A("div",{className:"w-px h-5 bg-border mx-0.5"}),A("button",{type:"button",onClick:()=>t.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),className:g,title:r.insertTable,children:A(iM,{size:18})}),p&&Me(Gd,{children:[A("button",{type:"button",onClick:()=>t.chain().focus().addColumnAfter().run(),className:g,title:r.addColumnAfter,children:A(Q5,{size:18})}),A("button",{type:"button",onClick:()=>t.chain().focus().addRowAfter().run(),className:g,title:r.addRowAfter,children:A(nM,{size:18})}),A("button",{type:"button",onClick:()=>t.chain().focus().deleteColumn().run(),className:g,title:r.deleteColumn,children:A(eM,{size:18})}),A("button",{type:"button",onClick:()=>t.chain().focus().deleteRow().run(),className:g,title:r.deleteRow,children:A(rM,{size:18})}),A("button",{type:"button",onClick:()=>t.chain().focus().mergeOrSplit().run(),className:g,title:r.mergeOrSplit,children:A(Y5,{size:18})})]}),Me("div",{className:"ml-auto flex items-center gap-0.5 "+(o?"pr-10":""),children:[u&&A("button",{type:"button",onClick:()=>f("transform"),className:g+(d==="transform"?" bg-primary/10 text-primary":""),title:r.transformSelection,children:A(Jy,{size:16})}),A("button",{type:"button",onClick:()=>f("markdown"),className:g,title:r.appendMarkdown,children:A($y,{size:18,style:{transform:"scaleX(-1)"}})}),A("button",{type:"button",onClick:i,title:"Copy as Markdown",className:g,children:s?A(By,{size:16,className:"text-green-500"}):A(zy,{size:16})}),A("button",{type:"button",onClick:a,title:o?"Exit fullscreen":"Fullscreen",className:g,children:o?A(Ky,{size:16}):A(Uy,{size:16})})]})]}),A(mM,{panel:d,onClose:()=>!c&&h(null),editor:t,onUpdate:e,labels:r,onTransform:b=>Rc(void 0,void 0,void 0,function*(){yield l(b),h(null)}),isTransforming:c})]})},bM={bold:"Bold",italic:"Italic",strike:"Strikethrough",code:"Inline code",paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",bulletList:"Bullet list",orderedList:"Ordered list",codeBlock:"Code block",blockquote:"Blockquote",setLink:"Set link",setLinkTitle:"Set link",setLinkUrlPlaceholder:"https://example.com",setLinkConfirm:"Apply",unsetLink:"Remove link",insertImage:"Insert image",addYoutube:"Add YouTube video",addYoutubeTitle:"Add YouTube video",addYoutubeUrlPlaceholder:"https://www.youtube.com/watch?v=…",addYoutubeConfirm:"Insert",insertTable:"Insert table",addColumnAfter:"Add column",addRowAfter:"Add row",deleteColumn:"Delete column",deleteRow:"Delete row",mergeOrSplit:"Merge or split cells",appendMarkdown:"Append markdown",appendMarkdownTitle:"Append Markdown",appendMarkdownPlaceholder:"Paste markdown here…",appendMarkdownConfirm:"Append",transformSelection:"Transform selection with AI",transformSelectionTitle:"Transform selected text with AI",transformSelectionPlaceholder:'e.g. "Fix grammar", "Make more formal", "Translate to Spanish"…',transformSelectionConfirm:"Transform",cancel:"Cancel"},vM=({content:t,editable:e,className:n,onUpdate:r,labels:i,onContentClick:s})=>{const{storage:o,ai:a}=Gt(),u=Object.assign(Object.assign({},bM),i),l=De(t??""),[c,d]=Z(!1),[h,f]=Z(!1),[p,m]=Z(!1),[g,b]=Z(!1),v=zt(k=>Rc(void 0,void 0,void 0,function*(){const{data:S,error:D}=yield o.uploadImage(k);return D?null:S.url}),[o]),_=Fc(()=>[qS.configure({paragraph:!1}),pM,K8.configure({resizable:!1}),Y8,G8,J8,x5.configure({defaultProtocol:"https"}),M5,WE,hM(v)],[v]),x=W5({extensions:_,content:t,editable:e,autofocus:!1,editorProps:{attributes:{class:(e?"p-3 min-h-[200px] ":"")+"outline-none"}},onUpdate:({editor:k})=>{const S=ao(k);l.current=S,r?.(S)},onSelectionUpdate:({editor:k})=>{const{from:S,to:D}=k.state.selection;m(S!==D)}}),y=zt(k=>Rc(void 0,void 0,void 0,function*(){if(!x)return;const{from:S,to:D}=x.state.selection;if(S===D)return;const F=x.state.doc.textBetween(S,D,`
|
|
148
|
+
`);b(!0);const L=yield a.getText({messages:[],prompt:"global.editor.transform-text",variables:{instruction:k,text:F}});if(b(!1),!L)return;x.chain().focus().deleteRange({from:S,to:D}).insertContentAt(S,L).run();const j=ao(x);l.current=j,r?.(j)}),[x,a,r]),w=zt(()=>{x&&navigator.clipboard.writeText(ao(x)).then(()=>{f(!0),setTimeout(()=>f(!1),2e3)})},[x]);J(()=>{if(!x)return;const k=t??"";k!==l.current&&(l.current=k,x.commands.setContent(k,!1))},[x,t]),J(()=>{x&&x.setEditable(e)},[x,e]);const C=c?"text-md overflow-hidden rounded-lg border border-border bg-card shadow-sm fixed inset-0 z-50 flex flex-col":"text-md overflow-hidden rounded-lg "+(e?"border border-border bg-card shadow-sm":"bg-transparent")+" "+(n??"");return Me("div",{className:C,onClick:s,children:[x&&e&&A(gM,{editor:x,onUpdate:r??(()=>{}),uploadImage:v,labels:u,onCopy:w,copied:h,isFullscreen:c,onToggleFullscreen:()=>d(k=>!k),hasSelection:p,onTransform:y,isTransforming:g}),A(I5,{editor:x,className:c?"flex-1 overflow-y-auto":""})]})};function yM(t,e){if(typeof document>"u"||!e)return;const n=`${t}-css`;if(document.getElementById(n))return;const r=document.createElement("style");r.id=n,r.textContent=e;const i=document.head.querySelector('style, link[rel="stylesheet"]');i?document.head.insertBefore(r,i):document.head.appendChild(r)}const _M=Object.freeze(Object.defineProperty({__proto__:null,AudioPlayOptions:Rm,AudioPlayer:My,Avatar:Ry,BuddyAssistant:Ly,MarkdownEditor:vM,PluginProvider:iy,VoiceRecorder:Yc,extractImageUrls:cM,injectFederationCss:yM,useChat:Tm,useExerciseTracker:dy,useRimori:Gt,useSettings:ly,useTranslation:Ny},Symbol.toStringTag,{value:"Module"})),Ja="__mf_module_cache__";globalThis[Ja]||={share:{},remote:{}};globalThis[Ja].share||={};globalThis[Ja].remote||={};const Pb=globalThis[Ja];let pn=Pb.share["@rimori/react-client"];pn===void 0&&(pn=_M,Pb.share["@rimori/react-client"]=pn);const xM=pn,kM=pn.__esModule?pn.default:pn.default??pn,{useTranslation:wM,Avatar:CM,BuddyAssistant:EM,VoiceRecorder:SM,MarkdownEditor:MM,extractImageUrls:AM,injectFederationCss:TM,useChat:DM,useSettings:OM,useExerciseTracker:RM,PluginProvider:NM,useRimori:FM,AudioPlayOptions:IM,AudioPlayer:PM}=pn,UM=Gb({__proto__:null,AudioPlayOptions:IM,AudioPlayer:PM,Avatar:CM,BuddyAssistant:EM,MarkdownEditor:MM,PluginProvider:NM,VoiceRecorder:SM,default:kM,extractImageUrls:AM,injectFederationCss:TM,useChat:DM,useExerciseTracker:RM,useRimori:FM,useSettings:OM,useTranslation:wM},[xM]);export{UM as _,NM as a,_M as b};
|