nv-basic-bw 1.0.18 → 1.0.19
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/nv-basci-bw.js +14 -10
- package/README/calc.d.ts +97 -0
- package/README/code.d.ts +113 -0
- package/calc.js +129 -2
- package/code.js +319 -1
- package/package.json +1 -1
package/DIST/nv-basci-bw.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var nvbasicbw=(()=>{var f=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=f((ah,ar)=>{var la=Symbol("empty"),Me=Symbol("unknown"),Ks=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null,Qs=/^[\-\+]?[0-9]+$/,Zs=/^\+?[0-9]+$/,aa=/^[\-\+]?0[bB][0-1]+$/,ca=/^[\-\+]?0[oO][0-7]+$/,er=/^[\-\+]?0[xX][0-9a-fA-F]+$/,oa=e=>Qs.test(e)||er.test(e),zs={"0b":2,"0o":8,"0x":16,2:"0b",8:"0o",16:"0x"},ua=/^[\-\+]?[0-9]+n$/,_a=/^[\-\+]?0[bB][0-1]+n$/,fa=/^[\-\+]?0[oO][0-7]+n$/,ha=/^[\-\+]?0[xX][0-9a-fA-F]+n$/,tr=e=>ua.test(e)||_a.test(e)||fa.test(e)||ha.test(e),ue={Integer:6,Float:7,BigInt:8,PosInfinity:9,NegInfinity:10,NaN:11,6:"Integer",7:"Float",8:"BigInt",9:"PosInfinity",10:"NegInfinity",11:"NaN"},sr=(e,t=!1)=>{let r={value:void 0,type:void 0};return e==="+Infinity"||e==="Infinity"?(r.value=1/0,r.type=ue.PosInfinity):e==="-Infinity"?(r.value=-1/0,r.type=ue.NegInfinity):(e==="NaN"||e==="+NaN"||e==="-NaN")&&(r.value=NaN,r.type=ue.NaN),t?r:r.value},da=e=>{let t,r,n;e[0]==="+"||e[0]==="-"?(t=e[0],r=zs[e.slice(1,3).join("").toLowerCase()],n=e.slice(3).join("").toLowerCase()):(t="+",r=zs[e.slice(0,2).join("").toLowerCase()],n=e.slice(2).join("").toLowerCase());let i=parseInt(n,r);return t==="+"?+i:-i},rr=e=>{let t=Array.from(e);if(Qs.test(e))return parseInt(e);if(aa.test(e)||ca.test(e)||er.test(e))return da(t)},pa=e=>{let t=e.be.sign+e.be.bd+e.be.dot+e.be.ad,r=e.ae.sign+e.ae.bd+e.ae.dot+e.ae.ad,n;if(!(t==="+"||t==="-"||r==="+"||r==="-")){if(r!=="")if(e.ae.dot==="."){let i=parseFloat(t),l=parseFloat(r);n=i*10**l}else n=parseFloat(t+"e"+r);else n=parseFloat(t);return n}},ga=(e,t)=>e.length===0||t==="."||t==="-."||t==="+."||t==="+"||t==="-",ma=()=>({be:{sign:"",bd:"",dot:"",ad:""},ae:{sign:"",bd:"",dot:"",ad:""},state:"init"}),Vs=(e,t,r,n)=>((e[r]==="-"||e[r]==="+")&&(t[n].sign=e[r],r=r+1),[e,r]),ba=(e,t,r,n)=>{if(t.state=n+"bd",e[r]===".")t[n].bd="0",t[n].dot=".",t.state=n+"ad";else if(Zs.test(e[r]))t[n].bd=e[r];else return[!0,r];return[!1,r+1]},Js=(e,t,r,n)=>{let i;for(i=r;i<e.length;i++)if(e[i]==="."){if(t[n].dot===".")return[!0,i];t[n].dot=".",t.state=n+"ad"}else{if(e[i]==="e"||e[i]==="E")return n==="ae"?[!0,i]:(t.state="aebd",[!1,i+1]);if(Zs.test(e[i]))t.state===n+"bd"?t[n].bd=t[n].bd+e[i]:t[n].ad=t[n].ad+e[i];else return[!0,i]}return[!1,i+1]},nr=e=>{let t=ma(),r=Array.from(e);if(ga(r,e))return;let n=0,i=!1;if([r,n]=Vs(r,t,n,"be"),[i,n]=ba(r,t,n,"be"),!i&&([i,n]=Js(r,t,n,"be"),!i&&([r,n]=Vs(r,t,n,"ae"),[i,n]=Js(r,t,n,"ae"),!i)))return pa(t)},ir=(e,t=!1)=>{let r={value:void 0,type:void 0};if(tr(e))r.value=BigInt(e.substr(0,e.length-1)),r.type=ue.BigInt;else{let n=rr(e);n!==void 0?(r.value=n,r.type=ue.Integer):(n=nr(e),n!==void 0?(r.value=n,r.type=ue.Float):(n=sr(e,t=!0),n.value!==void 0&&(r=n)))}return t?r:r.value},ya=(e,t=!0)=>{if(typeof e=="string")return e;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="number")return e.toString();if(typeof e=="bigint")return e.toString()+"n";if(typeof e=="symbol")return e.description;if(Ks()&&e[Symbol.for("nodejs.util.inspect.custom")])return e[Symbol.for("nodejs.util.inspect.custom")]();{let r=function(n){if(typeof n.toString=="function")return n.toString()};try{return t?s=JSON.stringify(e):s=JSON.stringify(e,null,4),typeof s=="string"?s:r(e)}catch{return r(e)}}},Fe={UndefinedLiteral:0,NullLiteral:1,FalseLiteral:3,TrueLiteral:4,StringLiteral:12},wa={only_value:!0,with_value:!0,with_type:!1,unknown_as_string:!1};function lr(e,t={only_value:!0,with_value:!0,with_type:!1,unknown_as_string:!1}){let r=JSON.parse(JSON.stringify(wa));Object.assign(r,t);let{only_value:n,with_value:i,with_type:l,unknown_as_string:a}=r,c={value:Me,type:Me};if(e==="undefined")c.value=void 0,c.type=Fe.UndefinedLiteral;else if(e==="null")c.value=null,c.type=Fe.NullLiteral;else if(e==="false")c.value=!1,c.type=Fe.FalseLiteral;else if(e==="true")c.value=!0,c.type=Fe.TrueLiteral;else{let o=ir(e,!0);o.type===void 0?a?(c.value=e,c.type=Fe.StringLiteral):(c.value=e,c.type=Me):(c.value=o.value,c.type=o.type)}return n?c.value:(l||delete c.type,i||delete c.value,c)}lr.unknown=Me;var $a={UndefinedLiteral:0,NullLiteral:1,BooleanLiteral:{_self:2,FalseLiteral:3,TrueLiteral:4},NumericLiteral:{_self:5,Integer:6,Float:7,BigInt:8,PosInfinity:9,NegInfinity:10,NaN:11},StringLiteral:12,ArrayExpression:{_self:13,element:14},ObjectExpression:{_self:15,property:16},_Ref:17,CommentLine:{_self:18,tt:19,k:20,bv:21,av:22},CommentBlock:{_self:23,tt:24,k:25,bv:26,av:27}};ar.exports={TYPE_DICT:$a,isNode:Ks,empty:la,unknown:Me,is_bigint_str:tr,is_jsint_str:oa,NUM_TYPE_DICT:ue,parse_abnormal_num:sr,parse_int:rr,parse_float:nr,parse_num:ir,parse0:lr,to_str:ya}});var _r=f((ch,ur)=>{var Ye={backSpace:8,tab:9,lineFeed:10,lineTab:11,formFeed:12,carriageReturn:13,shiftOut:14,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,nonBreakingSpace:160,oghamSpaceMark:5760,enQuad:8192,emQuad:8193,enSpace:8194,emSpace:8195,threePerEmSpace:8196,fourPerEmSpace:8197,sixPerEmSpace:8198,figureSpace:8199,punctuationSpace:8200,thinSpace:8201,hairSpace:8202,lineSeparator:8232,paragraphSeparator:8233,narrowNoBreakSpace:8239,mediumMathematicalSpace:8287,ideographicSpace:12288,zeroWidthNoBreakSpace:65279};function va(e){let t=Object.entries(e),r=new Map;return t.forEach(n=>r.set(n[1],n[0])),r}var Lt=va(Ye);function ka(e){let t=Object.entries(e);return t=t.map(r=>[r[0],String.fromCharCode(r[1])]),Object.fromEntries(t)}var xa=ka(Ye),cr=e=>55296<=e&&e<=56319,Ta=e=>56320<=e&&e<=57343,Sa=(e,t)=>(e-55296)*1024+(t-56320)+65536,or=e=>e<=65535,Ea=e=>!or(e),Ca=e=>{if(e<=65535)return[e,null];{e=e-65536;let t=[null,null];return t[0]=(e>>10)+55296,t[1]=e%1024+56320,t}},qa=(e,t)=>cr(e)?t+2:t+1;ur.exports={CODE_DICT:Ye,CH_DICT:xa,CODE_NAME_MP:Lt,cd2ch:e=>String.fromCharCode(e),ch2cd:e=>e.codePointAt(0),cd2n:e=>Lt.get(e),n2cd:e=>String.fromCharCode(Ye[e]),n2ch:e=>Ye[e],ch2n:e=>Lt.get(e.codePointAt(0)),is_high_code:cr,is_low_code:Ta,get_code_point_from_high_low:Sa,get_high_low_from_code_point:Ca,is_length1_code_point:or,is_length2_code_point:Ea,_next_code_index:qa}});var ve=f((oh,T)=>{var{CODE_DICT:d,CH_DICT:b}=_r(),fr=/\r\n?|[\n\u2028\u2029]/;T.exports.line_break_regexp=fr;T.exports.line_break_regexp_g=new RegExp(fr.source,"g");function hr(e){switch(e){case d.lineFeed:case d.carriageReturn:case d.lineSeparator:case d.paragraphSeparator:return!0;default:return!1}}function dr(e){switch(e){case b.lineFeed:case b.carriageReturn:case b.lineSeparator:case b.paragraphSeparator:return!0;default:return!1}}var Ot=[d.lineFeed,d.carriageReturn,d.lineSeparator,d.paragraphSeparator],pr=Ot.map(e=>String.fromCharCode(e));T.exports.NL_CODE_ARR=Ot;T.exports.NL_CH_ARR=pr;T.exports.is_nl_code=hr;T.exports.is_nl=dr;T.exports.skip_white_space_regexp=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;function gr(e){switch(e){case 9:case 11:case 12:case d.space:case d.nonBreakingSpace:case d.oghamSpaceMark:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}T.exports.is_non_nl_ws_code=gr;function mr(e){switch(e){case b.tab:case b.lineTab:case b.formFeed:case b.space:case b.nonBreakingSpace:case b.oghamSpaceMark:case b.enQuad:case b.emQuad:case b.enSpace:case b.emSpace:case b.threePerEmSpace:case b.fourPerEmSpace:case b.sixPerEmSpace:case b.figureSpace:case b.punctuationSpace:case b.thinSpace:case b.hairSpace:case b.narrowNoBreakSpace:case b.mediumMathematicalSpace:case b.ideographicSpace:case b.zeroWidthNoBreakSpace:return!0;default:return!1}}T.exports.is_non_nl_ws=mr;var Rt=[d.tab,d.lineTab,d.formFeed,d.space,d.nonBreakingSpace,d.oghamSpaceMark,d.enQuad,d.emQuad,d.enSpace,d.emSpace,d.threePerEmSpace,d.fourPerEmSpace,d.sixPerEmSpace,d.figureSpace,d.punctuationSpace,d.thinSpace,d.hairSpace,d.narrowNoBreakSpace,d.mediumMathematicalSpace,d.ideographicSpace,d.zeroWidthNoBreakSpace];T.exports.NON_NL_WS_CODE_ARR=Rt;var br=Rt.map(e=>String.fromCharCode(e));T.exports.NON_NL_WS_CH_ARR=br;function Aa(e){return gr(e)||hr(e)}function $e(e){return mr(e)||dr(e)}T.exports.is_ws_code=Aa;T.exports.is_ws=$e;T.exports.WS_CHCODE_ARR=Ot.concat(Rt);T.exports.WS_CH_ARR=pr.concat(br);var Q={init:0,executing:1,succ:2,eof:3};T.exports.STATE_DICT=Q;function Na(e,t=new Set){let r={g:e,rslt:"",state:Q.init},n=r.g.next().value;if(n===void 0)return r.state=Q.eof,r;for(;n!==void 0&&($e(n)||t.has(n));)n=r.g.next().value;for(;n!==void 0&&!$e(n)&&!t.has(n);)r.rslt=r.rslt+n,n=r.g.next().value;return n===void 0?r.state=Q.eof:($e(n)||t.has(n))&&(r.state=Q.succ),r}function Ia(e,t=0,r=new Set){let n={arr:e,pos:t,rslt:"",state:Q.init};for(let l=n.pos;l<e.length;l++){let a=e[l];if($e(a)||r.has(a))n.pos=n.pos+1;else break}let i=n.pos;for(let l=n.pos;l<e.length;l++){let a=e[l];if(!$e(a)&&!r.has(a))n.pos=n.pos+1;else break}return n.pos===e.length?n.state=Q.eof:n.state=Q.succ,n.rslt=e.slice(i,n.pos).join(""),n}T.exports.from_generator=Na;T.exports.from_charr=Ia});var Z=f((uh,xr)=>{var{WS_CH_ARR:yr,NON_NL_WS_CH_ARR:Da,NL_CH_ARR:La}=ve();function Oa(e){return Array.from(e).length}var Ra="\u200C",wr="\u200D",Pa=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function Pt(e,t,...r){let n=function(){return t(this,...r)};Pa()?e.prototype[Symbol.for("nodejs.util.inspect.custom")]=n:e.prototype.repr=n}var B={tmpl_quote:new Error("tmpl_quote: ` cant be deleted"),reserved:new Error(" [/,*,#,&,`,\\,] and whitespaces are reserved"),inuse:new Error("in using"),char:new Error("must be a char"),pair:new Error("left block must be different with right"),cant_be_empty:new Error("can NOT be empty")},nt=Symbol("get_pair_lmp"),ja=Symbol("add_pair_reserved"),We=class{#t;#e=new Map;#s=new Map;constructor(t){this.#t=t}get[nt](){return this.#e}get size(){return this.#e.size}[ja](t,r){if(t===r)throw B.pair;this.#e.set(t,r),this.#s.set(r,t)}add(t,r){if(this.#t.validate(t),this.#t.validate(r),t===r)throw B.pair;this.#e.set(t,r),this.#s.set(r,t)}ldelete(t){if(this.size<2)throw B.cant_be_empty;{let r=this.#e.get(t);this.#e.delete(t),this.#s.delete(r)}}rdelete(t){if(this.size<2)throw B.cant_be_empty;{let r=this.#s.get(t);this.#s.delete(t),this.#e.delete(r)}}lhas(t){return this.#e.has(t)}rhas(t){return this.#s.has(t)}has(t){return this.lhas(t)||this.rhas(t)}getl(t){return this.#s.get(t)}getr(t){return this.#e.get(t)}[Symbol.iterator](){return this.#e[Symbol.iterator]()}};function Ba(e){return new Map(e[nt])}Pt(We,Ba);var $r=Symbol("get_single_set"),vr=Symbol("add_single_reserved"),ke=class{#t;#e=new Set;constructor(t){this.#t=t}get[$r](){return this.#e}[vr](t){this.#e.add(t)}add(t){this.#t.validate(t),this.#e.add(t)}delete(t){if(this.size<2)throw B.cant_be_empty;if(t==="`")throw B.tmpl_quote;this.#e.delete(t)}has(t){return this.#e.has(t)}[Symbol.iterator](){return this.#e[Symbol.iterator]()}};function Fa(e){return new Set(e[$r])}Pt(ke,Fa);var it=class{#t;#e;#s;#r;#n;#i=!1;constructor(){this.#t=new We(this),this.#t.add("[","]"),this.#t.add("(",")"),this.#t.add("<",">"),this.#t.add("\uFF08","\uFF09"),this.#t.add("\u2018","\u2019"),this.#e=new We(this),this.#e.add("{","}"),this.#e.add("\u3010","\u3011"),this.#e.add("\u300A","\u300B"),this.#e.add("\u201C","\u201D"),this.#s=new ke(this),this.#s.add('"'),this.#s.add("'"),this.#s.add("\xB7"),this.#s[vr]("`"),this.#r=new ke(this),this.#r.add(","),this.#r.add("\uFF0C"),this.#r.add(";"),this.#r.add("\uFF1B"),this.#r.add("\u3002"),this.#r.add("\u3001"),this.#n=new ke(this),this.#n.add(":"),this.#n.add("\uFF1A"),this.#n.add("="),this.#i=!0}get reserved(){return["/","*","#","&","`","\\"].concat(yr)}get inuse(){let t=new Set;if(this.#i){for(let r of this.#s)t.add(r);for(let r of this.#r)t.add(r);for(let r of this.#n)t.add(r);for(let r of this.#t[nt])t.add(r);for(let r of this.#e[nt])t.add(r)}return t}validate(t){if(typeof t!="string"||Oa(t)!==1)throw B.char;if(this.reserved.includes(t))throw B.reserved;if(Array.from(this.inuse).flat().includes(t))throw B.inuse;return t}get esc(){return"\\"}get slash(){return"/"}get line_comment(){return"//"}get asterisk(){return"*"}get blk_comments(){return["/*","*/"]}get hash(){return"#"}get ref(){return"&"}get tmpl_quote(){return"`"}get nl(){return La}get non_nl_ws(){return Da}get ws(){return yr}get array_blks(){return this.#t}get fst_ary_blks(){return Array.from(this.#t)[0]}get obj_blks(){return this.#e}get fst_obj_blks(){return Array.from(this.#e)[0]}get quotes(){return this.#s}get fst_quote(){return Array.from(this.#s)[0]}get commas(){return this.#r}get fst_comma(){return Array.from(this.#r)[0]}get colons(){return this.#n}get fst_colon(){return Array.from(this.#n)[0]}},lt=class{constructor(t){this.reserved=t.reserved}get[Symbol.toStringTag](){return"reserved"}};Object.defineProperty(lt,"name",{value:wr});var at=class{constructor(t){this.esc=t.esc,this.hash=t.hash,this.ref=t.ref,this.tmpl_quote=t.tmpl_quote,this.slash=t.slash,this.asterisk=t.asterisk,this.line_comment=t.line_comment,this.blk_comments=t.blk_comments,this.nl=t.nl,this.non_nl_ws=t.non_nl_ws}get[Symbol.toStringTag](){return"fixed"}};Object.defineProperty(at,"name",{value:wr});var ct=class{constructor(t){this.obj_blks=t.obj_blks,this.array_blks=t.array_blks,this.quotes=t.quotes,this.commas=t.commas,this.colons=t.colons}get[Symbol.toStringTag](){return"configurable-if-not-reserved"}};Object.defineProperty(ct,"name",{value:Ra});function Ma(e){return[new at(e),new ct(e),new lt(e)]}Pt(it,Ma);var kr=new it;kr.ERROR_DICT=B;xr.exports=kr});var Sr=f((_h,Tr)=>{function*Ya(e){for(let t of e)yield t;e=null}Tr.exports.sync_gen_from_str=Ya});var I=f((fh,qr)=>{var Er={bk:{_self:0,eof:{_self:1,lc:2,blkc:3,hash:{_self:4,naked:5,quote:6},ref:{_self:7,naked:8,quote:9}}},k:{_self:10,eof:{_self:11,lc:12,blkc:13,hash:{_self:14,naked:15,quote:16},ref:{_self:17,naked:18,quote:19}}},ak:{_self:20,eof:{_self:21,lc:22,blkc:23,hash:{_self:24,naked:25,quote:26},ref:{_self:27,naked:28,quote:29}}},bv:{_self:30,eof:{_self:31,lc:32,blkc:33,hash:{_self:34,naked:35,quote:36},ref:{_self:37,naked:38,quote:39}}},v:{_self:40,eof:{_self:41,lc:42,blkc:43,hash:{_self:44,naked:45,quote:46},ref:{_self:47,naked:48,quote:49}}},av:{_self:50,eof:{_self:51,lc:52,blkc:53,hash:{_self:54,naked:55,quote:56},ref:{_self:57,naked:58,quote:59}}}};function N(e){return e instanceof Object?e._self:e}function Wa(e){return e+1}function Ha(e){return e+2}function Ga(e){return e+3}function Ua(e){return e+6}function Xa(e){return e+5}function za(e){return e+9}function Va(e){return e+8}function Cr(e){return e%10!==0}var Ja={backslash:0,lcmt:1,blkcmt:2,quote:3,naked:4},Ka={handling:0,handled:1};function Qa(e,t,r){let n=Er;return e.$has_yield_sign()||Cr(r)||t===N(n.av)&&r===N(n.bv)||t===N(n.av)&&r===N(n.bk)||t===N(n.av)&&r===N(n.k)||t===N(n.av)&&r===N(n.v)||t===N(n.av)&&r===N(n.ak)||t===N(n.v)&&r===N(n.bv)||t===N(n.v)&&r===N(n.bk)}qr.exports={STATE_DICT:Er,gtv:N,get_main_eofv_with_code:Wa,get_lcmt_eofv_with_code:Ha,get_blkcmt_eofv_with_code:Ga,get_hash_quote_eofv_with_code:Ua,get_hash_naked_eofv_with_code:Xa,get_ref_quote_eofv_with_code:za,get_ref_naked_eofv_with_code:Va,LEFTED_TYPE:Ja,AVND_CACHE_STATE_DICT:Ka,is_eofv:Cr,is_should_yield:Qa}});var Gt=f((hh,Fr)=>{var{is_nl:Ir}=ve(),Dr=(e,t,r=" ",n=!1)=>{let i=e.length;return i<=t?r.repeat(t-i)+e:n?e.substr(i-t):e},ot=(e,t,r,n="0",i=!1)=>{let l=e.toString(t);return Dr(l,r,n,i)},Za=/^[0-7]$/,ec=/^[0-9a-fA-F]$/,_e=e=>Za.test(e),X=e=>ec.test(e),ut={b:"\b",f:"\f",n:`
|
|
2
|
-
`,r:"\r",t:" ",v:"\v"},Lr={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\\":"\\\\"};function tc(e){return Lr[e]}function Or(e){return ut[e]}function sc(e){if(e.length>1)return;let t=e.charCodeAt(0);if(t>=0&&t<=255)return"\\x"+ot(t,16,2)}function rc(e){e=Array.from(e);let t=e[0],r=e[1];if(X(t)&&X(r)){let n=parseInt("0x"+t+r);return String.fromCharCode(n)}}function nc(e){if(e.length>1)return;let t=e.charCodeAt(0);if(t>=0&&t<=255)return"\\u"+ot(t,16,4)}function ic(e){e=Array.from(e);let t=e[0],r=e[1],n=e[2],i=e[3];if(X(t)&&X(r)&&X(n)&&X(i)){let l=parseInt("0x"+t+r+n+i);return String.fromCharCode(l)}}function lc(e){if(e.length>1)return;let t=e.charCodeAt(0);if(t>=0&&t<=255)return"\\"+ot(t,8,3)}function ac(e){let t="";e=Array.from(e);let r=e[0];if(_e(r)){t=t+r;let n=e[1];if(_e(n)){t=t+n;let l=e[2];_e(l)&&(t=t+l)}let i=parseInt(t,8);return String.fromCharCode(i)}}var p={init:0,executing:1,succ:2,eof:3,backslash:4,x:5,u:6,o:7};function*cc(e){let t=Array.from(e);for(let r of t)yield r}function*Ar(e,t){yield*t,yield*e}function Rr(e,t,r,n,i=!1){if(typeof t=="string"){let a=t;t=c=>c===a}if(typeof(r==="string")&&r.length>0){let a=cc(r);e=Ar(e,a)}else e=Ar(e,r);let l={state:p.init,end:t,esc:n,g:e,curr:"",ch:e.next().value,offset:0};return l.ch!==void 0&&(l.offset=l.offset+1),i&&(l.rslt=""),l}function jt(e){return e.ch===void 0||e.end(e.ch)&&e.state!==p.backslash||e.state===p.x||e.state===p.u||e.state===p.o}function Bt(e,t=!1){return e.ch===e.esc?(e.state=p.backslash,e.curr=""):(e.state=p.executing,t&&(e.rslt=e.rslt+e.ch),e.curr=e.ch),e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function Nr(e,t,r,n,i,l,a){return a===!0?n===Pr?(e.state=p.x,e.ch="\\x"+t.join(""),e):n===jr?(e.state=p.u,e.ch="\\u"+t.join(""),e):(n===Br&&(e.state=p.o,e.ch="\\"+t.join("")),e):i?(e.curr=t.join(""),l&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=r,e):(e.curr=n(t),l&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=r,e)}function oc(e,t,r,n,i){return e.curr=n(t),i&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function _t(e,t,r,n,i=!0,l=!1,a=void 0,c=!1){let o;if(a!==void 0?o=a:(o=e.g.next().value,o!==void 0&&(e.offset=e.offset+1)),o===void 0)return e;let u=0,_=[],h;if(l?h=!0:h=r(o),h)u=u+1,_.push(o);else return e.state=p.executing,e.ch=o,e;for(;u<t;){if(o=e.g.next().value,o===void 0)return Nr(e,_,o,n,i,c,tail=!0);if(e.offset=e.offset+1,h=r(o),h)u=u+1,_.push(o);else return Nr(e,_,o,n,i,c,tail=!1)}return oc(e,_,o,n,c)}function Pr(e){let t=parseInt("0x"+e[0]+e[1]);return String.fromCharCode(t)}function jr(e){let t=parseInt("0x"+e[0]+e[1]+e[2]+e[3]);return String.fromCharCode(t)}function Br(e){let t=parseInt(e.join(""),8);return String.fromCharCode(t)}function Ft(e,t=!1){return e.curr=Or(e.ch),t&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function Mt(e,t=!1){return _t(e,2,X,Pr,!0,!1,void 0,t)}function Yt(e,t=!1){return _t(e,4,X,jr,!0,!1,void 0,t)}function Wt(e,t=!1){return _t(e,3,_e,Br,!1,!0,e.ch,t)}function Ht(e,t=!1){return e.curr=e.ch,t&&(e.rslt=e.rslt+e.ch),e.state=p.executing,e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function uc(e,t=i=>i==='"',r="",n="\\"){let i=Rr(e,t,r,n,!0);for(i.state=p.executing;!jt(i);)i.state===p.executing?Bt(i,!0):i.state===p.backslash&&(Ir(i.ch)?(i.ch=i.g.next().value,i.ch!==void 0&&(i.offset=i.offset+1),i.state=p.executing):i.ch in ut?Ft(i,!0):i.ch==="x"?Mt(i,!0):i.ch==="u"?Yt(i,!0):_e(i.ch)?Wt(i,!0):Ht(i,!0));return typeof i.ch=="string"&&i.end(i.ch)?(i.state=p.succ,i.ch=""):i.state===p.backslash?i.ch=i.esc:i.ch===void 0&&(i.state=p.eof,i.ch=""),i}function*_c(e){let t=e;for(t.state=p.executing;!jt(t);)t.state===p.executing?(Bt(t,!1),t.curr!==""&&(yield t.curr)):t.state===p.backslash&&(Ir(t.ch)?(t.state=p.executing,t.ch=t.g.next().value,t.ch!==void 0&&(t.offset=t.offset+1)):t.ch in ut?(Ft(t,!1),t.curr!==""&&(yield t.curr)):t.ch==="x"?(Mt(t,!1),t.curr!==""&&(yield t.curr)):t.ch==="u"?(Yt(t,!1),t.curr!==""&&(yield t.curr)):_e(t.ch)?(Wt(t,!1),t.curr!==""&&(yield t.curr)):(Ht(t,!1),t.curr!==""&&(yield t.curr)));return typeof t.ch=="string"&&t.end(t.ch)?(t.state=p.succ,t.ch=""):t.state===p.backslash?(t.ch=t.esc,yield t.curr):t.ch===void 0&&(t.state=p.eof,t.ch=""),t}Fr.exports={CHAR_UNESC_DICT:ut,CHAR_ESC_DICT:Lr,escc:tc,unescc:Or,escx:sc,unescx:rc,escu:nc,unescu:ic,esco:lc,unesco:ac,STATE_DICT:p,from_generator:uc,init:Rr,handle_executing:Bt,is_terminated:jt,handle_escc:Ft,esc_handle_engine:_t,handle_escx:Mt,handle_escu:Yt,handle_esco:Wt,handle_esc_other:Ht,gen:_c,prepend:Dr,prepend_num:ot,is_odigit_ch:_e,is_hdigit_ch:X}});var Vr=f((dh,zr)=>{var{is_nl:fc}=ve(),xe=Gt(),Mr={line_comment:0,blk_comment:1},ee={init:0,executing:1,succ:2,eof:3,asterisk:4};function Yr(e){return{state:ee.init,g:e,rslt:"",ch:"",offset:0}}function Wr(e,t){return e.state=ee.eof,e.rslt=e.rslt+t.rslt,e.ch="",e}function Hr(e,t){return e.state=ee.succ,e.rslt=e.rslt+t.rslt,e.ch="",e}function Gr(e,t){return e.state=ee.executing,e.rslt=e.rslt+t.rslt,e.ch=t.ch,e}function Ur(e,t=""){let r=Yr(e);r.state=ee.executing;let n=xe.from_generator(r.g,fc,t);return r.offset=n.offset+r.offset,r.g=n.g,n.state===xe.STATE_DICT.eof?Wr(r,n):n.state===xe.STATE_DICT.succ?Hr(r,n):Gr(r,n)}function Xr(e,t=""){let r=Yr(e);r.state=ee.executing;let n;for(;;){if(n=xe.from_generator(r.g,"*",t),r.offset=r.offset+n.offset,r.g=n.g,n.state===xe.STATE_DICT.eof)return Wr(r,n);if(n.state===xe.STATE_DICT.succ){let i=r.g.next().value;if(i!==void 0&&(r.offset=r.offset+1),i==="/")return Hr(r,n);if(i!==void 0)r.rslt=r.rslt+n.rslt+"*",t=i,r.offset=r.offset-1;else return r.rslt=r.rslt+n.rslt,r.ch="*",r.state=ee.asterisk,r}else return Gr(r,n)}return r}function hc(e,t,r=""){return t===Mr.line_comment?Ur(e,r):Xr(e,r)}zr.exports={TYPE_DICT:Mr,STATE_DICT:ee,lc_from_generator:Ur,blk_from_generator:Xr,from_generator:hc}});var Ut=f((ph,Jr)=>{function dc(e){if(globalThis.document===void 0){let i=globalThis.require("fs").readFileSync(e).toString();return JSON.parse(i)}else return}function pc(e,t){if(globalThis.document===void 0){let n=globalThis.require("fs"),i=JSON.stringify(t);n.writeFileSync(e,i)}else return}function gc(e){return parseInt(e).toString()===e}Jr.exports={rjson:dc,wjson:pc,is_int_str:gc}});var Xt=f((gh,Kr)=>{var mc=()=>Math.random()*9007199254740992;function bc(e,t){return Array.from({length:t-e}).map((r,n)=>n+e)}function yc(e,t){return t.filter((r,n)=>e.includes(n))}function wc(e){return Object.entries(e).length===0}function $c(e){return Object.entries(e).map(n=>n[1])}function vc(e){return Object.entries(e).map(n=>n[0])}function kc(e){return Object.entries(e).length}function xc(e,t){for(let r in e)t(r,e[r]);return e}function Tc(e,t){for(let r in e)e[r]=t(r,e[r]);return e}function Sc(e,t){for(let r in t)e[r]=t[r];return e}function Ec(e,t){for(let r in t)!(r in e)&&(e[r]=t[r]);return e}function Cc(e,t,r){return r=r.filter(n=>n[e]!==t),r}function qc(e,t,r){return r.findIndex(i=>i[e]===t)}function Ac(e){return JSON.parse(JSON.stringify(e))}function Nc(e,t){for(let r=0;r<e.length;r++){lyr=e[r];for(let n=0;n<lyr.length;n++)e[r][n]=t(e[r][n],r,n)}return e}function Ic(e){let t=e[0]!=="_",r=e[0]!=="$";return t&&r}Kr.exports={gen_guid:mc,range:bc,seqs_slct:yc,dict_length:kc,is_empty_dict:wc,dict_values:$c,dict_keys:vc,dict_map:Tc,dict_foreach:xc,dict_plus:Sc,dict_update:Ec,dtb_kv_rm:Cc,dtb_kv_get_seq:qc,dcp:Ac,mat_map:Nc,is_cu_property:Ic}});var ls=f((mh,xn)=>{var v=Xt();function Jt(e){if(v.is_empty_dict(e))return 0;{let t=v.dict_keys(e);return Math.max(...t)+1}}function He(e){return e!=null}function Zr(e,t){return e._id=e._id+t,e._tree=e._tree+t,He(e._fstch)&&(e._fstch=e._fstch+t),He(e._lsib)&&(e._lsib=e._lsib+t),He(e._rsib)&&(e._rsib=e._rsib+t),He(e._parent)&&(e._parent=e._parent+t),e}function fe(e,t){let r=Jt(e);for(let n in t){let i=Zr(t[n],r);t[i._id]=i,delete t[n]}return t}function Dc(e=0){let t=e;return{_id:t,_fstch:null,_lsib:null,_rsib:null,_parent:null,_tree:t}}function Lc(e,t=0){return{_id:Jt(e)+t,_fstch:null,_lsib:void 0,_rsib:void 0,_parent:void 0,_tree:void 0}}function en(e){return e._tree!==void 0}function te(e){let t=e._tree!==void 0,r=e._tree===e._id;return t&&r}function Kt(e){return e._lsib===null}function Qt(e){return e._rsib===null}function F(e){return e._fstch===null}function tn(e,t){if(te(e))return!0;{let n=k(e,t);return Y(n,t).length===1}}function ze(e){return te(e)||!en(e)}function ft(e,t,r){if(!ze(t))return console.log("only root or uninited could be prepend"),e;let n=F(e);if(t._tree=e._tree,t._lsib=null,n)t._rsib=null,t._parent=e._id;else{let i=r[e._fstch];i._lsib=void 0,t._rsib=i._id,t._parent=void 0}return e._fstch=t._id,r[t._id]=t,e}function Zt(e,t,r){if(!ze(t))return console.log("only root or uninited could be append"),e;let n=F(e);if(t._tree=e._tree,t._rsib=null,n)e._fstch=t._id,t._lsib=null;else{let i=de(e,r);i._parent=void 0,i._rsib=t._id,t._lsib=void 0}return t._parent=e._id,r[t._id]=t,e}function es(e,t,r){if(!ze(t))return console.log("only root or uninited could be add"),e;if(te(e))return console.log("cant addrsib to root"),e;let n=Qt(e);return t._tree=e._tree,n?(t._parent=e._parent,e._parent=void 0,t._rsib=null):(t._rsib=e._rsib,t._parent=void 0),e._rsib=t._id,t._lsib=void 0,r[t._id]=t,e}function sn(e,t,r){if(!ze(t))return console.log("only root or uninited could be add"),e;if(te(e))return console.log("cant addlsib to root"),e;let n=Kt(e);if(t._tree=e._tree,n){let i=k(e,r);e._lsib=void 0,t._lsib=null,i._fstch=t._id}else{let i=M(e,r);i._rsib=t._id,t._lsib=void 0}return t._rsib=e._id,t._parent=void 0,r[t._id]=t,e}function rn(e,t,r,n){let i=Y(t,n),l=i.length;if(l===0)return ft(t,r,n);if(e<=l&&e>=0){if(e===0)return ft(t,r,n);if(e===l)return Zt(t,r,n);{let c=i[e-1];return es(c,r,n)}}else return console.log("not in range!!"),t}function Te(e,t){for(let r in t)t[r]._tree=e._tree}function Oc(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=ft(e,i,t),Te(e,r),v.dict_plus(t,r),e}function Rc(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=Zt(e,i,t),Te(e,r),v.dict_plus(t,r),e}function Pc(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=es(e,i,t),Te(e,r),v.dict_plus(t,r),e}function jc(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=sn(e,i,t),Te(e,r),v.dict_plus(t,r),e}function Bc(e,t,r,n){n=fe(r,n);let i=v.dict_keys(n)[0],l=re(n[i],n);return t=rn(e,t,l,r),Te(t,n),v.dict_plus(r,n),t}function Ge(e,t){let r=W(e,t),n=r[0]._id;return r.forEach(i=>{i._tree=n}),r}function Ue(e,t){let r={};return e.map(n=>{let i=n._id;r[i]=n,delete t[i]}),r}function nn(e){return e._fstch=null,e}function Xe(e){return e._lsib=null,e._rsib=null,e._parent=null,e}function Se(e,t){if(te(e))return[e,t];if(tn(e,t)){let n=t[e._parent];nn(n);let i=Ge(e,t),l=Ue(i,t);return Xe(e),[e,l]}else if(Kt(e)){let n=P(e,t);n._lsib=null;let i=k(e,t);i._fstch=e._rsib;let l=Ge(e,t),a=Ue(l,t);return Xe(e),[e,a]}else if(Qt(e)){let n=M(e,t);n._rsib=e._rsib,n._parent=e._parent;let i=Ge(e,t),l=Ue(i,t);return Xe(e),[e,l]}else{let n=M(e,t);n._rsib=e._rsib;let i=Ge(e,t),l=Ue(i,t);return Xe(e),[e,l]}}function Fc(e,t){let r=he(e,t);return r===null?[e,t]:Se(r,t)}function Mc(e,t){let r=de(e,t);return r===null?[e,t]:Se(r,t)}function Yc(e,t,r){let n=ln(e,t,r);return n===null?[t,r]:Se(n,r)}function Wc(e,t,...r){let n=an(e,t,...whiches);for(let i=0;i<n.length;i++)Se(n[i],t);return[e,t]}function Hc(e,t){let r=Y(e,t);for(let n=0;n<r.length;n++)Se(r[n],t);return t}function he(e,t){return e._fstch===null?null:t[e._fstch]}function Y(e,t){let r=[],n=he(e,t);for(;n!==null;)r.push(n),n=P(n,t);return r}function de(e,t){let r=Y(e,t);return r.length===0?null:r[r.length-1]}function ln(e,t,r){let n=Y(t,r);return n.length===0||e>n.length-1||e<0?null:n[e]}function an(e,t,...r){let n=Y(e,t),i=[];if(n.length!==0)for(let l=0;l<r.length;l++){let a=r[l];a>n.length-1||a<0||i.push(n[a])}return i}function cn(e,t,r=!1){let n=e,i=P(e,t);for(;i!==null;)n=i,i=P(i,t);return r||n._id!==e._id?n:null}function Gc(e,t){let r=se(e,t,!0),n=v.dtb_kv_get_seq("_id",e._id,r),i=[];if(r.length!==0)for(let l=0;l<r.length;l++)l<n&&i.push(r[l]);return i}function Uc(e,t){let r=se(e,t,!0),n=v.dtb_kv_get_seq("_id",e._id,r),i=[];if(r.length!==0)for(let l=0;l<r.length;l++)l>n&&i.push(r[l]);return i}function se(e,t,r=!1){let n=k(e,t),i;return n!==null?i=Y(n,t):i=[e],r||(i=v.dtb_kv_rm("_id",e._id,i)),i}function Xc(e,t,r=!1){let n=se(e,t,!0);return r?n[0]:n[0]._id===e._id?null:n[0]}function zc(e,t,r){let n=se(t,r,!0),i=n.length;return e<=i-1&&e>=0?n[e]:null}function Vc(e,t,...r){let n=se(e,t,!0),i=[];if(n.length!==0)for(let l=0;l<r.length;l++){let a=r[l];a>n.length-1||a<0||i.push(n[a])}return i}function Jc(e,t){let r=se(e,t,!0);return v.dtb_kv_get_seq("_id",e._id,r)}function M(e,t){let r=se(e,t,!0),n=v.dtb_kv_get_seq("_id",e._id,r);return n===0?null:r[n-1]}function P(e,t){return e._rsib===null?null:t[e._rsib]}function C(e,t){return ht(e,t,!0).length-1}function on(e,t){let r=C(e,t),i=W(e,t).map(a=>C(a,t));return Math.max(...i)-r+1}function Kc(e,t){return F(e)?null:C(e,t)+1}function Qc(e,t){if(F(e))return null;{let n=C(e,t),l=W(e,t).map(c=>C(c,t));return Math.max(...l)}}function Zc(e,t,r){let n=C(t,r);return on(t,r)<=e?null:n+e}function un(e,t){let r=re(e,t),n=W(r,t),i=C(e,t);return n.filter(a=>C(a,t)===i)}function zt(e,t){let r=un(e,t);return v.dtb_kv_get_seq("_id",e._id,r)}function eo(e,t){return W(e,t).length}function re(e,t){let r=e,n=k(e,t);for(;n!==null;)r=n,n=k(n,t);return r}function k(e,t){let r;if(te(e))r=null;else{let n=cn(e,t,!0);r=t[n._parent]}return r}function ht(e,t,r=!1){let n=[],i=k(e,t);for(;i!==null;)n.push(i),i=k(i,t);return r&&n.unshift(e),n}function to(e,t,r){let n=ht(t,r,!0),i=n.length;return e<i&&e>=0?n[e]:null}function so(e,t,...r){let n=ht(e,t,!0),i=[];if(n.length!==0)for(let l=0;l<r.length;l++){let a=r[l];a>n.length-1||a<0||i.push(n[a])}return i}function _n(e,t){let r=k(e,t);for(;r!==null;){let n=P(r,t);if(n!==null)return n;r=k(r,t)}return null}function fn(e,t){let r=he(e,t);if(r!==null)return r;{let n=P(e,t);return n!==null?n:_n(e,t)}}function hn(e,t){let r=e,n=de(e,t);for(;n!==null;)r=n,n=de(n,t);return r}function ro(e,t){if(te(e))return null;if(F(e)){let n=M(e,t);return n!==null?n:k(e,t)}else{let n=M(e,t);return n!==null?F(n)?n:hn(n,t):k(e,t)}}function W(e,t){let r=C(e,t),n=[];for(;e!==null&&(n.push(e),e=fn(e,t),!(e!==null&&C(e,t)<=r)););return n}function ts(e,t){let r=e,n=he(e,t);for(;n!==null;)r=n,n=he(n,t);return r}function dn(e,t){let r=P(e,t);return r===null?k(e,t):ts(r,t)}function pn(e,t){let r=k(e,t);for(;r!==null;){let n=M(r,t);if(n!==null)return n;r=k(r,t)}return null}function no(e,t){if(F(e)){let n=M(e,t);return n===null?pn(e,t):n}else return de(e,t)}function gn(e,t){let r=[],n=ts(e,t);for(;n!==null&&(r.push(n),n._id!==e._id);)n=dn(n,t);return r}function Vt(e){v.dict_foreach(e,(t,r)=>{e[t]._$visited=!1})}function mn(e,t){let r=e._$visited;if(F(e))if(r){let i=P(e,t);return i===null?k(e,t):i}else return e._$visited=!0,e;else if(r){let i=P(e,t);return i===null?k(e,t):i}else return e._$visited=!0,he(e,t)}function io(e,t,r){if(F(t)){if(e)return t;{let i=M(t,r);return i===null?k(t,r):i}}else{if(e)return de(t,r);{let i=M(t,r);return i===null?k(t,r):i}}}function bn(e,t){return t._$visited&&e===t._id}function yn(e,t,r=!1,n=!0){let i=[];Vt(t);let l=e._id;for(;!bn(l,e);)r?i.push(v.dcp(e)):i.push(e),e=mn(e,t);return r?i.push(v.dcp(e)):i.push(e),n&&Vt(t),i}function lo(e,t){let r={};r._depth=C(e,t),r._breadth=zt(e,t);let n=k(e,t);return r._pbreadth=n===null?null:zt(n,t),r._id=e._id,r}function Qr(e){let t={};return t.ele={},t.nd=e,t.ele._id=e._id,t.ele._children=[],t}function ss(e,t){let r=[],n=e[0],i=[Qr(n)];for(i[0].ele._pbreadth=null;i.length>0;){let l=[];for(let c=0;c<i.length;c++){i[c].ele._breadth=c,i[c].ele._depth=r.length;let o=Y(i[c].nd,t);o=o.map(u=>Qr(u)),o.forEach((u,_)=>{u.ele._pbreadth=i[c].ele._breadth,i[c].ele._children.push([r.length+1,l.length+_])}),l=l.concat(o)}let a=i.map(c=>c.ele);r.push(a),i=l}return r}function wn(e,t){return gn(e[0],t)}function $n(e,t,r=!1,n=!0){return yn(e[0],t,r,n)}function ao(e,t){let r=rs(e,t);return ss(r,t)}function rs(e,t){let r=e[e.length-1];return W(r,t)}function co(e,t,r=!1,n=!0){let i=rs(e,t);return $n(i,t,r,n)}function oo(e,t){let r=ns(e,t);return ss(r,t)}function ns(e,t){let r=e[0];return W(r,t)}function uo(e,t){let r=ns(e,t);return wn(r,t)}function is(e,t,r=!1){let n=W(e,t);return r||n.splice(0,1),n}function _o(e,t){return Y(e,t)}function fo(e,t){let r=is(e,t,!1),n=sdfs.map(l=>C(l,t)),i=Math.max(...n);return r=r.filter(l=>C(l,t)===i),r}function vn(e,t,r){let n=C(t,r),i=is(t,r,!1),l=sdfs.map(a=>C(a,r));return i=i.filter(a=>C(a,r)===n+e),i}function ho(e,t,...r){let n=r.map(i=>vn(i,e,t));return n=Array.prototype.concat(...n),n}function kn(e){let t=v.dict_keys(e)[0],r=e[t];return re(r,e)}function po(e){let t=kn(e);return W(t,e)}xn.exports={calc_next_id:Jt,update_nodes_ids:fe,creat_root:Dc,creat_nd:Lc,is_inited:en,is_root:te,is_fstch:Kt,is_lstch:Qt,is_leaf:F,is_lonely:tn,is_id:He,is_connectable:ze,prepend_child:ft,append_child:Zt,insert_child:rn,add_rsib:es,add_lsib:sn,get_fstch:he,get_rsib:P,get_children:Y,get_lstch:de,get_which_child:ln,get_some_children:an,get_fstsib:Xc,get_lstsib:cn,get_preceding_sibs:Gc,get_following_sibs:Uc,get_sibs:se,get_which_sib:zc,get_some_sibs:Vc,get_sibseq:Jc,get_lsib:M,get_rsib:P,get_lyr:un,get_breadth:zt,get_count:eo,get_depth:C,get_height:on,get_fst_lyr_des_depth:Kc,get_lst_lyr_des_depth:Qc,get_which_lyr_des_depth:Zc,get_root:re,get_parent:k,get_ances:ht,get_which_ance:to,get_some_ances:so,get_rsib_of_fst_ance_having_rsib:_n,get_sdfs_next:fn,get_drmost_des:hn,get_sdfs_prev:ro,get_sdfs:W,get_lsib_of_fst_ance_having_lsib:pn,get_dlmost_des:ts,get_edfs_next:dn,get_edfs_prev:no,get_edfs:gn,clear_$visited:Vt,get_sedfs_next:mn,is_sedfs_traverse_finished:bn,get_sedfs_prev:io,get_sedfs:yn,get_deses:is,get_fst_lyr_deses:_o,get_lst_lyr_deses:fo,get_which_lyr_deses:vn,get_some_lyrs_deses:ho,nd2ele:lo,sdfs2mat:ss,sdfs2edfs:wn,sdfs2sedfs:$n,edfs2mat:ao,edfs2sdfs:rs,edfs2sedfs:co,sedfs2mat:oo,sedfs2sdfs:ns,sedfs2edfs:uo,update_disconnected_nodes:Ge,update_orig_nodes:Ue,leafize:nn,rootize:Xe,disconnect:Se,rm_fstch:Fc,rm_lstch:Mc,rm_which:Yc,rm_some:Wc,rm_all:Hc,update_treeid:Te,update_one_nodeid:Zr,update_nodes_ids:fe,prepend_child_tree:Oc,append_child_tree:Rc,add_rsib_tree:Pc,add_lsib_tree:jc,insert_child_tree:Bc,get_root_via_tree:kn,tree2sdfs:po}});var qn=f((bh,Cn)=>{function Tn(e="E"){class t extends Event{#t;constructor(n,i){super(n),this.#t=i}get data(){return this.#t}set data(n){this.#t=n}}return t}var Sn=Tn();function En(e="ET"){class t extends EventTarget{#t=new Map;addEventListener(n,i){super.addEventListener(n,i),this.#t.set(n,i)}ls(){return this.#t}removeEventListener(n){super.removeEventListener(n),this.#t.delete(n)}dispatch(n,i){let l=new Sn(n,i);return this.dispatchEvent(l),l}}return t}var go=En();Cn.exports={creat_event_cls:Tn,E:Sn,creat_event_target_cls:En,ET:go}});var li=f((yh,ii)=>{var Wn=Ut(),Je=Xt(),pe=ls(),{ET:An}=qn(),mo=["_fstch","_lsib","_rsib","_parent","_tree"];function Hn(e){return e._tree!==void 0}function as(e){return e._tree===e}function bo(e){return e._lsib===null}function yo(e){return e._rsib===null}function wo(e){return e._fstch===null}function $o(e){return e.$sibs(!0).length===1}function wt(e){return as(e)||!Hn(e)}function Nn(e){let t=e._fstch,r=t;for(;t!==null;)r=t,t=t._rsib;return r}function In(e,t){let r=0,n=t._fstch;for(;;){if(r===e)return n;if(n===null)return n;n=n._rsib,r=r+1}}function Dn(e,...t){let r=[],n=0,i=e._fstch;for(;;){if(t.includes(n))r.push(i);else if(i===null)return r;i=i._rsib,n=n+1}}function cs(e){let t=[],r=0,n=e._fstch;for(;;){if(n===null)return t;t.push(n),n=n._rsib,r=r+1}}function vo(e){let t=0,r=e._fstch;for(;;){if(r===null)return t;r=r._rsib,t=t+1}}function Gn(e,t=!1){let r=e._rsib,n=e;for(;r!==null;)n=r,r=r._rsib;return t||n!==e?n:null}function $t(e,t=!1){let r=os(e);if(r===null)return t?e:null;{let n=r._fstch;return t||n!==e?n:null}}function ko(e){let t=$t(e,!1);if(t===null)return null;{let r=t;for(;;){if(r._rsib===e)return r;r=r._rsib}}}function fs(e){let t=[],n=$t(e,!0);for(;n!==null;){if(n===e)return t;t.push(n),n=n._rsib}}function Un(e){let t=[],r=e._rsib;for(;r!==null;)t.push(r),r=r._rsib;return t}function Xn(e,t=!1){let r=fs(e),n=Un(e),i=[e],l;return t?l=r.concat(i,n):l=r.concat(n),l}function xo(e,t){let r=$t(t,!0),n=0;for(;;){if(r===null)return null;if(n==e)return r;r=r._rsib,n=n+1}}function To(e,...t){return Xn(e,!0).filter((i,l)=>t.includes(l))}function Ln(e){return fs(e).length}function So(e,t=!1){return e.$sibs(t).length}function os(e){return Gn(e,!0)._parent}function Eo(e){let t=e,r=e;for(;t!==null;)r=t,t=t.$parent();return r}function Co(e,t){let r=0,n=t;for(;n!==null;){if(r===e)return n;n=n.$parent(),r=r+1}return null}function bt(e,t=!1){let r=[],n=e;for(t&&r.push(n),n=n.$parent();n!==null;)r.push(n),n=n.$parent();return r}function qo(e,...t){return bt(e,!0).filter((i,l)=>t.includes(l))}function Ao(e,t=!1){return bt(e,t).length}function No(e){let t=e.$parent();return t===null?null:t.$lsib()}function Io(e){let t=e.$parent();return t===null?null:t.$rsib()}function Do(e){let t=e.$luncle();return e.$is_fstch()?t===null?null:t.$lstch():null}function Lo(e){let t=e.$runcle();return e.$is_lstch()?t===null?null:t.$fstch():null}function Oo(e){let r=e.$root().$sdfs(),n=e.$depth();return r.filter(l=>l.$depth()===n)}function Ro(e){let t=e.$parent();return t===null?null:t.$breadth()}function Po(e){return e.$lyr().indexOf(e)}function jo(e){let t=e.$sdfs();return t=t.filter(r=>r.$is_leaf()),t.length}function Bo(e){let r=e.$root().$edfs(),n;if(e.$is_leaf())n=r.indexOf(e);else{let i=e.$dlmost_des();n=r.indexOf(i)}return r=r.slice(0,n+1),offset=r.filter(i=>i.$is_leaf()).length-1,offset}function On(e,t=!1){let r=Vn(e),n=me(e),i=n.indexOf(r);return t?n.slice(0,i+1):n.slice(1,i+1)}function Fo(e){let t=e.$deses(!1),r=t.map(i=>i.$depth()),n=Math.max(...r);return t=t.filter(i=>i.$depth()===n),t}function Mo(e,t){let r=t.$depth(),n=t.$deses(!1),i=n.map(l=>l.$depth());return n=n.filter(l=>l.$depth()===r+e),n}function Yo(e,...t){let r=e.$depth(),n=t.map(a=>a+r),i=e.$deses(!1),l=i.map(a=>a.$depth());return i=i.filter(a=>n.includes(a.$depth())),i}function us(e,t){if(!wt(t))return console.log("only root or uninited could be prepend"),t;let r=e.$is_leaf();if(t._tree=e._tree,t._lsib=null,r)t._rsib=null,t._parent=e;else{let n=e._fstch;n._lsib=void 0,t._rsib=n,t._parent=void 0}return e._fstch=t,t}function _s(e,t){if(!wt(t))return console.log("only root or uninited could be append"),t;let r=e.$is_leaf();if(t._tree=e._tree,t._rsib=null,r)e._fstch=t,t._lsib=null;else{let n=e.$lstch();n._parent=void 0,n._rsib=t,t._lsib=void 0}return t._parent=e,t}function zn(e,t){if(!wt(t))return console.log("only root or uninited could be add"),t;if(e.$is_root())return console.log("cant addrsib to root"),e;let r=e.$is_lstch();return t._tree=e._tree,r?(t._parent=e._parent,e._parent=void 0,t._rsib=null):(t._rsib=e._rsib,t._parent=void 0),e._rsib=t,t._lsib=void 0,t}function Wo(e,t){if(!wt(t))return console.log("only root or uninited could be add"),t;if(e.$is_root())return console.log("cant addlsib to root"),e;let r=e.$is_fstch();if(t._tree=e._tree,r){let n=e.$parent();e._lsib=void 0,t._lsib=null,n._fstch=t}else{let n=e.$lsib();n._rsib=t,t._lsib=void 0}return t._rsib=e,t._parent=void 0,t}function Rn(e,t,r){let n=cs(t),i=n.length;if(i===0)r=us(t,r);else if(!(e<=i&&e>=0))console.log("not in range!!");else if(e===0)r=us(t,r);else if(e===i)r=_s(t,r);else{let a=n[e-1];r=zn(a,r)}return r}function Ho(e){let t=e.$parent();for(;t!==null;){let r=t.$rsib();if(r!==null)return r;t=t.$parent()}return null}function Go(e){let t=e.$fstch();if(t!==null)return t;{let r=e.$rsib();return r!==null?r:e.$rsib_of_fst_ance_having_rsib()}}function Vn(e){let t=e,r=e.$lstch();for(;r!==null;)t=r,r=r.$lstch();return t}function Uo(e){if(e.$is_root())return null;if(e.$is_leaf()){let r=e.$lsib();return r!==null?r:e.$parent()}else{let r=e.$lsib();return r!==null?r.$is_leaf()?r:r.$drmost_des():e.$parent()}}function me(e){let t=e.$depth();if(e===null)return[];{let r=[e];for(e=e.$sdfs_next();e!==null&&e.$depth()>t;)r.push(e),e=e.$sdfs_next();return r}}function Xo(e){let t=e,r=e.$fstch();for(;r!==null;)t=r,r=r.$fstch();return t}function zo(e){let t=e.$rsib();return t===null?e.$parent():t.$dlmost_des()}function Vo(e){let t=e.$parent();for(;t!==null;){let r=t.$lsib();if(r!==null)return r;t=t.$parent()}return null}function Jo(e){if(e.$is_leaf()){let r=e.$lsib();return r===null?e.$lsib_of_fst_ance_having_lsib():r}else return e.$lstch()}function Ko(e){let t=[],r=e.$dlmost_des();for(;r!==null&&(t.push(r),r!==e);)r=r.$edfs_next();return t}function Jn(e){let t=e.$visited;if(e.$is_leaf())if(t){let n=e.$rsib();return n===null?e.$parent():n}else return e.$visited=!0,e;else if(t){let n=e.$rsib();return n===null?e.$parent():n}else return e.$visited=!0,e.$fstch()}function Qo(e,t){if(t.$is_leaf()){if(e)return t;{let n=t.$lsib();return n===null?t.$parent():n}}else{if(e)return t.$lstch();{let n=t.$lsib();return n===null?t.$parent():n}}}function Zo(e){e.$sdfs().forEach(r=>{delete r.$visited})}function eu(e,t){return t.$visited&&e===t}function Pn(e){Zo(e);let t=[],r=new Set,n=e;for(;!eu(n,e);)r.has(e)?e.$close_at=t.length:(e.$open_at=t.length,r.add(e)),t.push(e),e=Jn(e);return n.$close_at=t.length,t.push(n),t.forEach(i=>{delete i.$visited}),t}function tu(e){return e._fstch=null,e}function dt(e){return e._lsib=null,e._rsib=null,e._parent=null,e}function pt(e){let t=e.$sdfs();return t.forEach(r=>{r._tree=t[0]}),t}function ge(e){if(e.$is_root())return e;if(e.$is_lonely()){let r=e.$parent();tu(r);let n=pt(e);return dt(e),e}else if(e.$is_fstch()){let r=e.$rsib();r._lsib=null;let n=e.$parent();n._fstch=e._rsib;let i=pt(e);return dt(e),e}else if(e.$is_lstch()){let r=e.$lsib();r._rsib=e._rsib,r._parent=e._parent;let n=pt(e);return dt(e),e}else{let r=e.$lsib();r._rsib=e._rsib;let n=pt(e);return dt(e),e}}function jn(e){let t={};return t._nd=e,t._children=[],t}function Bn(e){let t=[],r=e[0],n=[jn(r)];for(n[0]._pbreadth=null;n.length>0;){let i=[];for(let a=0;a<n.length;a++){n[a]._breadth=a,n[a]._depth=t.length;let c=n[a]._nd.$children();c=c.map(o=>jn(o)),c.forEach((o,u)=>{o._pbreadth=n[a]._breadth,n[a]._children.push([t.length+1,i.length+u])}),i=i.concat(c)}let l=n;t.push(l),n=i}return t}function Fn(e,t="_children"){let r=e._nd,n={};n[t]=[],n.$guid=r.$guid;for(let i in r)Je.is_cu_property(i)&&(n[i]=r[i]);return n}function su(e,t="_children"){let r=e[0][0],n=Fn(r,t),i=[{d:n,ele:r}];for(;i.length>0;){let l=[];for(let a=0;a<i.length;a++){let c=i[a],o=c.d,u=c.ele,h=c.ele._children.map(m=>e[m[0]][m[1]]);for(let m=0;m<h.length;m++){let y=h[m],E=Fn(y,t);o[t].push(E);let Gs={d:E,ele:y};l.push(Gs)}}i=l}return n}function Mn(e,t="_children"){let r=new z;e.$guid!==void 0&&(r.$guid=e.$guid);for(let n in e)Je.is_cu_property(n)&&t!==n&&(r[n]=e[n]);return r}function ru(e,t="_children"){let r=Mn(e,t),n=[{d:e,nd:r}];for(;n.length>0;){let i=[];for(let l=0;l<n.length;l++){let a=n[l].d,c=n[l].nd,o=a[t]===void 0?[]:a[t];for(let u=0;u<o.length;u++){let _=o[u],h=Mn(_,t);c.$append_child(h);let m={d:_,nd:h};i.push(m)}}n=i}return r}function nu(e){let t=["_fstch","_lsib","_rsib","_parent","_tree","$guid","_guid","_id","$open_at","$close_at"];e._fstch=void 0,e._lsib=void 0,e._rsib=void 0,e._parent=void 0,e._tree=void 0,e.$guid=void 0,e._guid=void 0,e._id=void 0,e.$open_at=void 0,e.$close_at=void 0;for(let r of t)Object.defineProperty(e,r,{enumerable:!1})}function iu(e,t,r){let n=e.$depth();return" ".repeat(n)+"["+r.indexOf(e)+"] : "+e.$guid}function lu(e,t){let r=e.$depth(),n=" ".repeat(r),i="";return t===e.$open_at&&(i=n+"<"+e._id+" : "+e.$guid+">"),t===e.$close_at&&(i=n+"</"+e._id+" : "+e.$guid+">"),i}var au=["$fstch","$rsib","$parent"];function cu(e){if(e.$fstch()!==null)return["$fstch"];if(e.$rsib()!==null)return["$rsib"];{let n=[],i=e.$parent();for(;i!==null;)if(n.push("$parent"),i.$rsib()!==null){n.push("$rsib");break}else i=i.$parent();return n}}function ou(e){return e.$sdfs().map(n=>n.$sdfs_next_action_for_srch())}var Kn={$fstch:"$append_child",$rsib:"$add_rsib",$parent:"$parent"};function uu(e,t){for(let r=0;r<t.length;r++){let n=Kn[t[r]];e=e[n]()}return e}function _u(e){let t=new z,r=t;for(let n=0;n<e.length;n++){let i=e[n];r=uu(r,i)}return t}function fu(e,t,r){if(r&&(t=t.$clone()),!e.$is_root())if(e.$is_lonely()){let n=e.$parent();e.$disconn(),n.$append_child(t)}else if(e.$is_lstch()){let n=e.$lsib();e.$disconn(),n.$add_rsib(t)}else{let n=e.$rsib();e.$disconn(),n.$add_lsib(t)}return t}var L=class{#t=null;#e={with_id:!1,with_et:!1};constructor(t=!1,r=!1){nu(this),this._fstch=null,this.#e.with_id=t,this.#e.with_et=r,t&&(this.$guid=Je.gen_guid()),r&&(this.#t=new An)}get opt(){return this.#e}enable_et(){this.#t=new An}disable_et(){this.#t=null}get et(){return this.#t}regis_recv_from_handler(t){let r=function(n){t(n.data.src,n.data.msg)};this.et.addEventListener("$msg__",r)}send_to(t,r){t.et.dispatch("$msg__",{src:this,msg:r})}$is_inited(){return Hn(this)}$is_root(){return as(this)}$is_fstch(){return bo(this)}$is_lstch(){return yo(this)}$is_leaf(){return wo(this)}$is_lonely(){return $o(this)}$fstch(){return this._fstch}$lstch(){return Nn(this)}$which_child(t){return In(t,this)}$some_children(...t){return Dn(this,...t)}$children(){return cs(this)}$children_count(){return vo(this)}$rsib(){return this._rsib}$lsib(){return ko(this)}$fstsib(t=!1){return $t(this,t)}$lstsib(t=!1){return Gn(this,t)}$psibs(){return fs(this)}$fsibs(){return Un(this)}$which_sib(t){return xo(t,this)}$some_sibs(...t){return To(this,...t)}$sibseq(){return Ln(this)}$sibs(t=!1){return Xn(this,t)}$sibs_count(t=!1){return So(this,t)}$parent(){return os(this)}$root(){return Eo(this)}$ances(t=!1){return bt(this,t)}$which_ance(t){return Co(t,this)}$some_ances(...t){return qo(this,...t)}$ances_count(t=!1){return Ao(this,t)}$prepend_child(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,us(this,t)}$insert_child(t,r){return r=r===void 0?new L(this.#e.with_id,this.#e.with_et):r,Rn(t,this,r)}$append_child(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,_s(this,t)}$clone(){if(as(this)){let t=mt(this);return yt(t)}else{let t=Ln(this),r=os(this);ge(this);let n=mt(this),i=yt(n);return Rn(t,r,this),i}}$append_children(t,r){let n=[];for(let i=0;i<t;i++){let l=r===void 0?new L(this.#e.with_id,this.#e.with_et):r.$clone();l=_s(this,l),n.push(l)}return n}$add_rsib(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,zn(this,t)}$add_lsib(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,Wo(this,t)}$rsib_of_fst_ance_having_rsib(){return Ho(this)}$sdfs_next(){return Go(this)}$drmost_des(){return Vn(this)}$sdfs_prev(){return Uo(this)}$sdfs(){return me(this)}$dlmost_des(){return Xo(this)}$edfs_next(){return zo(this)}$lsib_of_fst_ance_having_lsib(){return Vo(this)}$edfs_prev(){return Jo(this)}$edfs(){return Ko(this)}$offset(){return Bo(this)}$sedfs_next(){return Jn(this)}$sedfs_prev(t){return Qo(this)}$sedfs(){return Pn(this)}$deses(t=!1){return On(this,t)}$lst_lyr_deses(){return Fo(this)}$which_lyr_deses(t){return Mo(t,this)}$some_lyrs_deses(...t){return Yo(this,...t)}$count(t=!0){return On(this,t).length}$depth(t=!1){return bt(this,t).length}$height(){let t=this.$depth(),n=this.$sdfs().map(l=>l.$depth());return Math.max(...n)-t+1}$pbreadth(){return Ro(this)}$breadth(){return Po(this)}$width(){return jo(this)}$lyr(){return Oo(this)}$lcin(){return Do(this)}$rcin(){return Lo(this)}$luncle(){return No(this)}$runcle(){return Io(this)}$sdfs_repr(t=iu,r=!1){let n=this.$root(),i=me(n),c=me(this).map((o,u)=>t(o,u,i)).join(`
|
|
3
|
-
`);if(console.log(
|
|
4
|
-
`);if(console.log(a),r)return a}$disconn(){return ge(this)}$rm_fstch(){let t=this._fstch;return ge(t)}$rm_lstch(){let t=
|
|
5
|
-
`){return"//"+Ke(this.value)+t}},xs=class extends O{constructor(t){super(),this.value=t,this.type=q.TYPE_DICT.CommentBlock._self}vto_rawstr(){return"/*"+Ke(this.value)+"*/"}};oi.exports={UndefinedLiteral:gs,NullLiteral:ms,BooleanLiteral:bs,NumericLiteral:ys,StringLiteral:ws,ArrayExpression:$s,ObjectExpression:vs,_Ref:ks,CommentLine:vt,CommentBlock:xs,_ndtree:vu}});var gi=f((Ah,pi)=>{var{empty:Es}=x(),{UndefinedLiteral:ui,NullLiteral:_i,BooleanLiteral:fi,NumericLiteral:hi,StringLiteral:Ts,ArrayExpression:Eu,ObjectExpression:Cu,CommentLine:qu,CommentBlock:Au,_Ref:Ss}=xt();function Nu(e,t){let r=Es,n=e;for(;n!==null;){if(n.key===t){r=n;break}else if(n.hashes.has(t)){r=n;break}else if(n.$sibseq().toString()===t){r=n;break}n=n.$sdfs_prev()}return r!==null?r:Es}function di(e,t){return e instanceof ui?new ui("undefined",t):e instanceof _i?new _i("null",t):e instanceof fi?new fi(e.vto_rawstr(),t):e instanceof hi?new hi(e.vto_rawstr(),t):e instanceof Ts?new Ts(e.value,t):e instanceof qu||e instanceof Au?new Ts(e.value,t):e instanceof Eu?new Ss(e,t):e instanceof Cu?new Ss(e,t):e instanceof Ss?(e=e.value,di(e,t)):Es}pi.exports={find_refnd_with_hash:Nu,clone:di}});var Ci=f((Nh,be)=>{var Iu=Array,Du=x(),{empty:$,parse0:Lu}=x(),Ze=class extends Iu{get lst(){return this[this.length-1]}set lst(t){this[this.length-1]=t}get top(){return this[this.length-1]}set top(t){this[this.length-1]=t}get fst(){return this[0]}set fst(t){this[0]=t}get bot(){return this[0]}set bot(t){this[0]=t}*gen_from_lst(){for(let t=this.length-1;t>-1;t--)yield this[t]}};function*Ou(e){for(let t of e)yield t;e=null}function*Ru(e,t){yield*t,yield*e}var et=Gt(),Cs=ve(),Ce=Vr(),{UndefinedLiteral:Pu,NullLiteral:ju,BooleanLiteral:mi,NumericLiteral:Bu,StringLiteral:bi,CommentLine:Qe,CommentBlock:Fu,ArrayExpression:qs,ObjectExpression:Mu}=xt(),G=I(),yi=G.gtv,ne=G.STATE_DICT,As=G.LEFTED_TYPE,Ee=G.AVND_CACHE_STATE_DICT,H=x(),w=Z(),wi=gi();function*Si(e){for(;e.length>0;)yield e.pop()}function $i(e){let t;return e.__is_sync_mode()?t=et.from_generator(e.g,e.ch_cache.curr):t=et.from_generator(Si(e.unshift_cache),e.ch_cache.curr),t}function vi(e,t,r){e.lefted.type=As.quote,e.lefted.data={rslt:t.rslt,lefted:t.ch,state:t.state,quote:r},e.state=G.get_main_eofv_with_code(e.state)}function Ei(e,t,r){e.lefted.type=r,e.lefted.data={rslt:t.rslt,lefted:t.ch,state:t.state}}function Yu(e,t,r){return Ei(e,t,r),e.state=G.get_lcmt_eofv_with_code(e.state),e}function Wu(e,t,r){return Ei(e,t,r),e.state=G.get_blkcmt_eofv_with_code(e.state),e}function Hu(e,t){let r;return e.__is_sync_mode()?r=t(e.g,e.ch_cache.curr):r=t(Si(e.unshift_cache),e.ch_cache.curr),r}function ki(e,t,r,n){let i=Hu(e,r);return i.state!==Ce.STATE_DICT.succ?((t===Qe?Yu:Wu)(e,i,n),$):new t(i.rslt)}function xi(e,t){let r=new t(e.str_cache.k);return e.$set_avnd_cache(r),e.$mv_key_to_nd(r),e.$mv_kcmt_to_kcmt(),e.$mv_bvcmt_to_bvcmt(),r.open=e.ch_cache.curr,e.stack.lst.append_child(r),e.stack.push(r),t===qs?e.state=ne.bv:e.state=ne.bk,e}var Ns=Symbol("root_lblk_ch"),Ti=Symbol("root_rblk_ch"),qe=class{#t=yi(ne.bv);#e=new Ze;constructor(t,r=" "){if(r!==$){let i=Ou(r);t=Ru(t,i)}this.g=t,this.lefted={type:$,data:$},this.ch_cache={tmp:$,curr:$},this.str_cache={k:$,v:$,maybe_vquote:$},this.cmt_cache={kcmt:[],bvcmt:[],avcmt:[]};let n=new qs;this.stack.push(n),n.open=Ns,this.avnd_cache={state:Ee.handling,data:n},this.unshift_cache=new Ze,this.mode="sync"}__use_sync_mode(){this.mode="sync"}__use_async_mode(){this.mode="async"}__is_sync_mode(){return this.mode==="sync"}__is_async_mode(){return this.mode==="async"}__unshift_g(t){t=t??this.ch_cache.curr;for(let r of t)this.unshift_cache.unshift(r)}$has_yield_sign(){return this.avnd_cache.state===Ee.handled}$set_yield_sign(){this.avnd_cache.state=Ee.handled}$clear_yield_sign(){this.avnd_cache.state=Ee.handling}get state(){return this.#t}set state(t){this.#t=yi(t)}get stack(){return this.#e}$next_ch(){return this.unshift_cache.length>0?this.ch_cache.curr=this.unshift_cache.pop():this.ch_cache.curr=this.g.next().value,this.ch_cache.curr}$is_currch_eof(){return this.ch_cache.curr===void 0}$handle_main_eof(){return this.state=G.get_main_eofv_with_code(this.state),this}$is_currch_comma(){return w.commas.has(this.ch_cache.curr)}$is_currch_colon(){return w.colons.has(this.ch_cache.curr)}$is_currch_ws(){return Cs.is_ws(this.ch_cache.curr)}$is_currch_quote(){return w.quotes.has(this.ch_cache.curr)}$is_currch_slash(){return this.ch_cache.curr===w.slash}$is_currch_asterisk(){return this.ch_cache.curr===w.asterisk}$is_currch_ary_lblk(){return w.array_blks.lhas(this.ch_cache.curr)}$is_currch_obj_lblk(){return w.obj_blks.lhas(this.ch_cache.curr)}$is_currch_lblk(){return this.$is_currch_ary_lblk()||this.$is_currch_obj_lblk()}$is_currch_ary_rblk(){return w.array_blks.rhas(this.ch_cache.curr)}$is_currch_obj_rblk(){return w.obj_blks.rhas(this.ch_cache.curr)}$is_currch_rblk(){return this.$is_currch_ary_rblk()||this.$is_currch_obj_rblk()}$is_currch_hash(){return w.hash===this.ch_cache.curr}$is_currch_ref(){return w.ref===this.ch_cache.curr}$mv_avcmt_to_avcmt(){let t=this.avnd_cache.data;t.avcmt=this.cmt_cache.avcmt,this.cmt_cache.avcmt=[]}$change_state_when_end_av(t=$,r=$){return this.stack.lst.is_ary()?t===$?this.state=ne.bv:(this.state=ne.v,this.str_cache.v=t,r===$||(this.str_cache.maybe_vquote=r)):t===$?this.state=ne.bk:(this.state=ne.k,this.str_cache.k=t),this.state}$vcache_to_nd(){let t=this.str_cache.v,r;if(this.str_cache.maybe_vquote===$){let n=Lu(t,{only_value:!1,with_value:!0,with_type:!0,unknown_as_string:!0});n.type===H.TYPE_DICT.UndefinedLiteral?r=new Pu(this.str_cache.k):n.type===H.TYPE_DICT.NullLiteral?r=new ju(this.str_cache.k):n.type===H.TYPE_DICT.BooleanLiteral.TrueLiteral?r=new mi("true",this.str_cache.k):n.type===H.TYPE_DICT.BooleanLiteral.FalseLiteral?r=new mi("false",this.str_cache.k):n.type===H.TYPE_DICT.StringLiteral?r=new bi(n.value,this.str_cache.k):r=new Bu(n,this.str_cache.k)}else r=new bi(t,this.str_cache.k);return this.str_cache.v=$,this.str_cache.maybe_vquote=$,r}$mv_kcmt_to_kcmt(){let t=this.avnd_cache.data;t.kcmt=this.cmt_cache.kcmt,this.cmt_cache.kcmt=[]}$mv_bvcmt_to_bvcmt(){let t=this.avnd_cache.data;t.bvcmt=this.cmt_cache.bvcmt,this.cmt_cache.bvcmt=[]}$mv_key_to_nd(){let t=this.avnd_cache.data;return t.key=this.str_cache.k,this.str_cache.k=$,t.key}$set_avnd_cache(t,r=Ee.handling){return this.avnd_cache.data=t,this.avnd_cache.state=r,this.avnd_cache}$setup_leafnd(){let t=this.$vcache_to_nd();this.$set_avnd_cache(t,Ee.handling),this.$mv_key_to_nd(),this.$mv_kcmt_to_kcmt(),this.$mv_bvcmt_to_bvcmt(),this.$mv_avcmt_to_avcmt(),this.stack.lst.append_child(t)}$handle_quote(t){let r=$i(this);return r.state!==et.STATE_DICT.succ?(vi(this,r,t),$):r.rslt}$abandon_key_when_end_bv(){this.cmt_cache.kcmt=[],this.cmt_cache.bvcmt=[],this.str_cache.k=$}$refresh_key(t=$){t===$?this.str_cache.k=this.ch_cache.curr:this.str_cache.k=t,this.cmt_cache.kcmt=[]}$handle_lcmt(){return ki(this,Qe,Ce.lc_from_generator,As.lcmt)}$handle_blkcmt(){return ki(this,Fu,Ce.blk_from_generator,As.blkcmt)}$push_kcmt(t){t.type=Ce instanceof Qe?H.TYPE_DICT.CommentLine.k:H.TYPE_DICT.CommentBlock.k,this.cmt_cache.kcmt.push(t)}$push_bvcmt(t){let r=t instanceof Qe?"CommentLine":"CommentBlock";t.type=H.TYPE_DICT[r].bv,this.cmt_cache.bvcmt.push(t)}$push_avcmt(t){t.type=Ce instanceof Qe?H.TYPE_DICT.CommentLine.k:H.TYPE_DICT.CommentBlock.k,this.cmt_cache.avcmt.push(t)}$mv_avcmt_to_ttcmt(t){t=t??this.avnd_cache.data.$parent();for(let r of this.cmt_cache.avcmt)t.$append_child(r);this.cmt_cache.avcmt=[]}$open_nonleaf_nd(){if(w.array_blks.lhas(this.ch_cache.curr))return xi(this,qs);if(w.obj_blks.lhas(this.ch_cache.curr))return xi(this,Mu)}$is_rblk_match(){let t=this.stack.lst,r=t.is_ary()?"array_blks":"obj_blks";return w[r].getl(this.ch_cache.curr)===t.open}$close_nonleaf_nd(){let t=this.stack.lst;t.close=this.ch_cache.curr,this.$set_avnd_cache(t),this.stack.pop(),this.state=ne.av}$get_hash_or_ref(t="#"){let r=$,n=this.$next_ch(),i="";for(;!Cs.is_ws(n)&&!w.commas.has(n)&&!w.colons.has(n)&&!w.array_blks.has(n)&&!w.obj_blks.has(n)&&n!==w.hash&&n!==w.ref&&n!==w.slash;)if(w.quotes.has(n)){let l=$i(this);if(l.state!==et.STATE_DICT.succ)return vi(this,l,this.ch_cache.curr),t===w.hash?this.state=G.get_hash_quote_eofv_with_code(this.state):this.state=G.get_ref_quote_eofv_with_code(this.state),r;i=i+l.rslt,n=this.$next_ch()}else{if(n===void 0)return $handle_main_eof(),r;i=i+n,n=this.$next_ch()}return this.__unshift_g(n),r=i,r}$is_hash_of_pnd(){return this.stack.lst.$children().length===0}$find_ref(t){let r=this.stack.lst,n=r.$lstch();return n===null&&(n=r),wi.find_refnd_with_hash(n,t)}$add_ref_to_parent(t){let r=this.stack.lst,n=wi.clone(t,this.str_cache.k);this.$set_avnd_cache(n),this.$mv_key_to_nd(n),this.$mv_kcmt_to_kcmt(),this.$mv_bvcmt_to_bvcmt(),r.append_child(n)}};qe[Ns]=Ns;qe[Ti]=Ti;qe.MODES=["sync","async"];be.exports=qe;be.exports.Stack=Ze;be.exports._type_util=Du;be.exports._esc=et;be.exports._cmt=Ce;be.exports._ws=Cs});var Ii=f((Ih,Ni)=>{var{empty:qi}=x(),Ai=I(),Ae=Ai.gtv,U=Ai.STATE_DICT;function Gu(e){let t=e.state;return t===Ae(U.bk)||(t===Ae(U.k)||t===Ae(U.ak)?(e.str_cache.k=qi,e.state=U.bk):t===Ae(U.bv)?(e.$abandon_key_when_end_bv(),e.stack.lst.is_ary()?e.state=U.bv:e.state=U.bk):t===Ae(U.v)?(e.$setup_leafnd(),e.$change_state_when_end_av()):t===Ae(U.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av())),e}Ni.exports=Gu});var Oi=f((Lh,Li)=>{var{empty:Dh}=x(),Di=I(),Ne=Di.gtv,ie=Di.STATE_DICT;function Uu(e){let t=e.state;return t===Ne(ie.bk)||(t===Ne(ie.k)||t===Ne(ie.ak)?e.state=ie.bv:t===Ne(ie.bv)||(t===Ne(ie.v)?(e.$setup_leafnd(),e.$change_state_when_end_av()):t===Ne(ie.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av()))),e}Li.exports=Uu});var Is=f((Rh,Pi)=>{var{empty:Oh}=x(),Ri=I(),Ie=Ri.gtv,le=Ri.STATE_DICT;function Xu(e){let t=e.state;return t===Ie(le.bk)||(t===Ie(le.k)?e.state=le.ak:t===Ie(le.ak)||t===Ie(le.bv)||(t===Ie(le.v)?(e.$setup_leafnd(),e.state=le.av):Ie(le.av))),e}Pi.exports=Xu});var Mi=f((Ph,Fi)=>{var{empty:ji}=x(),Bi=I(),De=Bi.gtv,V=Bi.STATE_DICT;function zu(e,t){let r=e.state,n=e.$handle_quote(t);return n===ji||(r===De(V.bk)?(e.str_cache.k=n,e.state=V.k):r===De(V.k)?e.str_cache.k=e.str_cache.k+n:r===De(V.ak)?(e.$refresh_key(n),e.state=V.k):r===De(V.bv)?(e.str_cache.maybe_vquote=t,e.str_cache.v=n,e.state=V.v):r===De(V.v)?(e.str_cache.v=e.str_cache.v+n,e.str_cache.maybe_vquote=ji):r===De(V.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(n,t))),e}Fi.exports=zu});var Gi=f((jh,Hi)=>{var{empty:Yi}=x(),Ds=I(),R=Ds.gtv,S=Ds.STATE_DICT,Vu=Ds.LEFTED_TYPE,ye=Z();function Wi(e,t){let r=e.state,n=e[t]();if(n!==Yi){let i=e.stack.lst;if(r===R(S.bk))i.append_ttcmt(n);else if(r===R(S.k))e.$push_kcmt(n),e.state=S.ak;else if(r===R(S.ak))e.$push_kcmt(n);else if(r===R(S.bv))i.is_ary()?i.append_ttcmt(n):i.is_dict()&&e.$push_bvcmt(n);else if(r===R(S.v))e.$setup_leafnd(),e.state=S.av;else if(r===R(S.av)){let l=e.stack.lst;l.is_ary()?(l.append_ttcmt(n),e.state=S.bv):l.is_dict()&&e.$push_avcmt(n)}}return e}function Ju(e){return Wi(e,"$handle_lcmt")}function Ku(e){return Wi(e,"$handle_blkcmt")}function Qu(e){let t=e.state;t===R(S.bk)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.k=ye.slash,e.state=S.k):t===R(S.k)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.k=e.str_cache.k+ye.slash):t===R(S.ak)?(e.__unshift_g(e.ch_cache.curr),e.$refresh_key(ye.slash),e.state=S.k):t===R(S.bv)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.v=ye.slash,e.state=S.v):t===R(S.v)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.v=e.str_cache.v+ye.slash,e.str_cache.maybe_vquote=Yi):t===R(S.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(ye.slash))}function Zu(e){let t=e.state,r=e.$next_ch();return e.$is_currch_eof()?(e.lefted.data=ye.slash,e.lefted.type=Vu.backslash,e.$handle_main_eof()):e.$is_currch_slash()?Ju(e):e.$is_currch_asterisk()?Ku(e):Qu(e),e}Hi.exports=Zu});var zi=f((Fh,Xi)=>{var{empty:Bh}=x(),Ui=I(),Le=Ui.gtv,ae=Ui.STATE_DICT;function e_(e){let t=e.state;return t===Le(ae.bk)?(e.str_cache.k=e.ch_cache.curr,e.state=ae.k):t===Le(ae.k)?e.str_cache.k=e.str_cache.k+e.ch_cache.curr:t===Le(ae.ak)?(e.$refresh_key(),e.state=ae.k):t===Le(ae.bv)?e.$open_nonleaf_nd():t===Le(ae.v)?(e.$setup_leafnd(),e.$change_state_when_end_av(),e.__unshift_g(e.ch_cache.curr)):t===Le(ae.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(),e.__unshift_g(e.ch_cache.curr)),e}Xi.exports=e_});var Qi=f((Mh,Ki)=>{var{empty:Vi}=x(),Ji=I(),Oe=Ji.gtv,we=Ji.STATE_DICT,t_=Is();function s_(e){let t=e.state;return t===Oe(we.bk)?e.$close_nonleaf_nd():t===Oe(we.k)?(e.str_cache.k=Vi,e.$close_nonleaf_nd()):t===Oe(we.ak)?(e.$refresh_key(),e.str_cache.k=Vi,e.$close_nonleaf_nd()):t===Oe(we.bv)?(e.$abandon_key_when_end_bv(),e.$close_nonleaf_nd()):t===Oe(we.v)?(e.$setup_leafnd(),e.state=we.av,e.__unshift_g(e.ch_cache.curr)):t===Oe(we.av)&&(e.$has_yield_sign()?(e.$clear_yield_sign(),e.$close_nonleaf_nd()):(e.$mv_avcmt_to_avcmt(),e.$set_yield_sign(),e.__unshift_g(e.ch_cache.curr))),e}function r_(e){return e.$is_rblk_match()?s_(e):t_(e),e}Ki.exports=r_});var sl=f((Yh,tl)=>{var{empty:n_}=x(),el=I(),Re=el.gtv,ce=el.STATE_DICT,i_=Z(),{CommentLine:Zi}=xt();function l_(e){let t=e.state,r=e.$get_hash_or_ref(i_.hash);if(r!==n_){let n=e.stack.lst;if(t===Re(ce.bk))e.$is_hash_of_pnd()&&n.hashes.add(r);else if(t===Re(ce.k)){let i=new Zi(r);e.$push_kcmt(i),e.state=ce.ak}else if(t===Re(ce.ak)){let i=new Zi(r);e.$push_kcmt(i)}else t===Re(ce.bv)?e.$is_hash_of_pnd()&&n.is_ary()&&n.hashes.add(r):t===Re(ce.v)?(e.$setup_leafnd(),e.avnd_cache.data.hashes.add(r),e.state=ce.av):t===Re(ce.av)&&e.avnd_cache.data.hashes.add(r)}return e}tl.exports=l_});var il=f((Wh,nl)=>{var{empty:Ls}=x(),rl=I(),Pe=rl.gtv,D=rl.STATE_DICT,a_=Z();function c_(e){let t=e.state,r=e.$get_hash_or_ref(a_.ref);if(r!==Ls){let n=e.$find_ref(r);if(n!==Ls){let i=e.stack.lst;t===Pe(D.bk)||t===Pe(D.k)||t===Pe(D.ak)?(e.$refresh_key(n.vto_rawstr()),e.state=D.ak):t===Pe(D.bv)?(e.$add_ref_to_parent(n),e.state=D.av):t===Pe(D.v)?(e.str_cache.maybe_vquote=Ls,e.$setup_leafnd(),e.state=D.av):t===Pe(D.av)&&(e.$has_yield_sign()?(e.$clear_yield_sign(),i.is_ary()?(e.$add_ref_to_parent(n),e.state=D.av):i.is_dict()&&(e.str_cache.k=n.vto_rawstr(),e.state=D.ak)):(e.$mv_avcmt_to_avcmt(),e.$set_yield_sign()))}}return e}nl.exports=c_});var cl=f((Hh,al)=>{var{empty:o_}=x(),ll=I(),je=ll.gtv,J=ll.STATE_DICT;function u_(e){let t=e.state;return t===je(J.bk)?(e.str_cache.k=e.ch_cache.curr,e.state=J.k):t===je(J.k)?e.str_cache.k=e.str_cache.k+e.ch_cache.curr:t===je(J.ak)?(e.$refresh_key(),e.state=J.k):t===je(J.bv)?(e.str_cache.v=e.ch_cache.curr,e.state=J.v):t===je(J.v)?(e.str_cache.v=e.str_cache.v+e.ch_cache.curr,e.str_cache.maybe_vquote=o_):t===je(J.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(),e.__unshift_g(e.ch_cache.curr)),e}al.exports=u_});var hl=f((Gh,fl)=>{var{empty:__}=x(),f_=Ci(),h_=Ii(),d_=Oi(),p_=Is(),g_=Mi(),m_=Gi(),b_=zi(),y_=Qi(),w_=sl(),$_=il(),v_=cl(),_l=I(),ol=_l.gtv,ul=_l.STATE_DICT,k_=Z();function*x_(e,t=__){let r=new f_(e,t);for(;;)if(r.$next_ch(),r.$is_currch_eof()){r.$handle_main_eof(),yield r;break}else r.$is_currch_comma()?(h_(r),yield r):r.$is_currch_colon()?(d_(r),yield r):r.$is_currch_ws()?(p_(r),yield r):r.$is_currch_quote()?(g_(r,r.ch_cache.curr),yield r):r.$is_currch_slash()?(m_(r),yield r):r.$is_currch_lblk()?(b_(r),yield r):r.$is_currch_rblk()?(y_(r),yield r):r.$is_currch_hash()?(w_(r),yield r):r.$is_currch_ref()?r.state===ol(ul.av)||r.state===ol(ul.v)?r.__unshift_g(k_.fst_comma+r.ch_cache.curr):($_(r),yield r):(v_(r),yield r)}fl.exports=x_});var bl=f((Uh,ml)=>{var{sync_gen_from_str:Os}=Sr(),{is_should_yield:Rs}=I(),j=Z(),{is_nl:T_,is_ws:dl}=ve(),Ps=hl(),S_={enable_ref:!1,encoding:"utf8"};function pl(e,t={enable_ref:!1}){let r=Ps(e),n=r.next().value,i=n.avnd_cache.data.$root(),l=n.state;for(let a of r){let c=a.state;if(Rs(n,l,c)&&!t.enable_ref){let o=n.avnd_cache.data;o.$disconn(),o=null}l=c}return i}function E_(e,t={enable_ref:!1}){let r=Os(e);return pl(r,t)}function*gl(e,t={enable_ref:!1,encoding:"utf8"}){let r=Ps(e),n=r.next().value,i=n.state;for(let l of r){let a=l.state;if(Rs(n,i,a)&&!t.enable_ref){let c=n.avnd_cache.data;yield c,c.$disconn(),c=null}i=a}}function*C_(e,t={enable_ref:!1,encoding:"utf8"}){let r=Os(e);yield*gl(r,t)}function q_(){return{d:void 0,ppg:void 0,prev:void 0,curr:void 0,can_send:!1,data:"",state:"init",label:"",pstate:""}}function A_(e){let t=Os(""),r=Ps(t," "),n=r.next().value;n.__use_async_mode();let i=q_();return i.rt=n.avnd_cache.data,i.prev=n.state,i.ppg=r,i.d=n,i}function N_(e,t){return e.data=e.data+t,e.state==="init"?t===j.slash?e.state="slash":j.quotes.has(t)?(e.label=t,e.state="quote"):t===j.hash?e.state="hash":t===j.ref?e.state="ref":e.can_send=!0:e.state==="quote"?t==="\\"?(e.state="esc",e.pstate="quote"):t===e.label&&(e.pstate!==""?(e.state=e.pstate,e.pstate=""):e.can_send=!0):e.state==="slash"?t===j.slash?e.state="lcmt":t===j.asterisk?e.state="blkcmt":j.quotes.has(t)?(e.label=t,e.state="quote"):e.can_send=!0:e.state==="lcmt"?t==="\\"?(e.state="esc",e.pstate="lcmt"):T_(t)&&(e.can_send=!0):e.state==="blkcmt"?t==="\\"?(e.state="esc",e.pstate="blkcmt"):t===j.asterisk&&(e.state="asterisk"):e.state==="asterisk"?t==="\\"?(e.state="esc",e.pstate="blkcmt"):t===j.slash&&(e.can_send=!0):e.state==="hash"?dl(t)?e.can_send=!0:j.quotes.has(t)&&(e.state="quote",e.pstate="hash"):e.state==="ref"?dl(t)?e.can_send=!0:j.quotes.has(t)&&(e.state="quote",e.pstate="ref"):e.state==="esc"?(e.state=e.pstate,e.pstate=""):console.log("impossible"),e}async function*I_(e,t){for(let r of e)N_(t,r),t.can_send&&(yield t,t.data="",t.state="init",t.label="",t.can_send=!1)}async function*D_(e){let t=A_(e);for await(let r of e)yield*I_(r,t);yield t}function L_(e){let t=e.d.unshift_cache;t.forEach(r=>{e.prev=e.curr,e.d=e.ppg.next().value,e.curr=e.d.state}),t=null}async function*O_(e,t){if(e.d.__unshift_g(e.data),e.prev=e.curr,e.d=e.ppg.next().value,e.curr=e.d.state,Rs(e.d,e.prev,e.curr)&&!t.enable_ref){let r=e.d.avnd_cache.data;yield r,r.$disconn(),r=null}}async function*R_(e,t={enable_ref:!1,encoding:"utf8"}){e=D_(e);let r;for await(r of e)L_(r),yield*O_(r,t);yield r.rt}ml.exports={OPT_DICT:S_,parse_from_generator:pl,parse_from_str:E_,gen_from_generator:gl,gen_from_str:C_,agen_from_generator:R_}});var Tt=f((Xh,st)=>{var{empty:P_}=x(),j_=Z(),tt=bl();function js(e){return e.length===1?e[0]:e}function B_(){for(let e in tt){let t;e.startsWith("gen_")?t=function*(r,n={enable_ref:!1,encoding:"utf8"}){let i=tt[e](r,n);for(let l of i)l=js(l),yield[l.key,l.value]}:e.startsWith("agen_")?t=async function*(r,n={enable_ref:!1,encoding:"utf8"}){let i=tt[e](r,n);for await(let l of i)l=js(l),yield[l.key,l.value]}:t=function(r,n={enable_ref:!1,encoding:"utf8"}){let i=tt[e](r,n).value;return js(i)},Object.defineProperty(t,"name",{value:e}),st.exports[e]=t}st.exports.OPT_DICT=tt.OPT_DICT}B_();st.exports.CFG=j_;st.exports.empty=P_});var Be=f((zh,yl)=>{var F_=e=>e.constructor.name==="AsyncFunction",M_=e=>typeof e!="string"||(e=e.trim(),e==="")?!1:!!(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("ws://")||e.startsWith("wss://")||e.startsWith("//")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||/^(data|blob|file|wasm):/i.test(e)),Y_=e=>e.startsWith("http://")||e.startsWith("https://")||e.startsWith("ws://")||e.startsWith("wss://")||/^(data|blob|file|wasm):/i.test(e)?e:e.startsWith("//")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?e.startsWith("//")?window.location.protocol+e:e.startsWith("/")?window.location.origin+e:new URL(e,window.location.href).href:e,W_=()=>new Date().toISOString().replace(/[:.]/g,"-"),H_=/^(.*?)=["]?(.*)["]?$/,G_=(e=document.cookie)=>{let t=e.split("; "),r={};for(let n of t){let i=H_.exec(n);r[i[1]]=i[2]}return r};yl.exports={is_async:F_,is_url:M_,fullfill_url:Y_,creat_dt_prefix:W_,get_ck:G_}});var Ct=f((Vh,vl)=>{var{is_async:oe}=Be(),U_=e=>{let t=0;for(;e&&e.parentNode;)e=e.parentNode,t++;return t},X_=(e,t)=>{if(t>0){let r=1;for(;;){let n=e.parentNode;if(r===t)return n;e=n,++r}}else return e},z_=e=>{for(;e.parentNode;)e=e.parentNode;return e},K=e=>e.firstChild===null||e.firstChild===void 0,St=(e,t=K)=>{let r=0;for(;!t(e);)e=e.lastChild,++r;return[e,r]},Et=(e,t=K)=>{let r=0;for(;!t(e);)e=e.firstChild,++r;return[e,r]},wl=(e,t)=>{if(e.nextSibling)return[e.nextSibling,t];let r=e.parentNode,n=t;for(;r;){if(n-=1,r.nextSibling)return[r.nextSibling,n];r=r.parentNode}return[null,-1]},V_=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=St(e,r),l=e,a=oe(t),c=0;for(;;){let o=!1;if(a?o=await t(l,c):o=t(l,c),o||l===n)return;if(!r(l))++c,l=l.firstChild;else{let u=wl(l,c);if(l=u[0],l)c=u[1];else break}}},$l=(e,t)=>{if(e.prevSibling)return[e.prevSibling,t];let r=e.parentNode,n=t;for(;r;){if(n-=1,r.prevSibling)return[r.prevSibling,n];r=r.parentNode}return[null,-1]},J_=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=Et(e,r),l=e,a=oe(t),c=0;for(;;){let o=!1;if(a?o=await t(l,c):o=t(l,c),o||l===n)return;if(!r(l))++c,l=l.lastChild;else{let u=$l(l,c);if(l=u[0],l)c=u[1];else break}}},K_=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=Et(e,r),l=oe(t);for(;;){let a=!1;if(l?a=await t(n,i):a=t(n,i),a||n===e)return;{let c=n.nextSibling;if(c){let o=Et(c,r);i+=o[1],n=o[0]}else{let o=n.parentNode;if(o)--i,n=o;else break}}}},Q_=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=St(e,r),l=oe(t);for(;;){let a=!1;if(l?a=await t(n,i):a=t(n,i),a||n===e)return;{let c=n.prevSibling;if(c){let o=St(c,r);i+=o[1],n=o[0]}else{let o=n.parentNode;if(o)--i,n=o;else break}}}},Z_=async(e,t=(i,l)=>{},r=(i,l)=>{},n=K)=>{let i=e,l="open",a={open:[r,oe(r)],clos:[t,oe(t)]},c=0;for(;;){let o=!1,[u,_]=a[l];if(l==="open"){if(_?o=await u(i,c):o=u(i,c),o)return;n(i)?l="clos":(i=i.firstChild,++c)}else{let h,m,y,E=i.nextSibling;if(E?(y="open",h=E,m=c):(y="clos",h=i.parentNode,m=c-1),_?o=await u(i,c):o=u(i,c),o)return;if(i!==e)l=y,i=h,c=m;else break}}},ef=async(e,t=(i,l)=>{},r=(i,l)=>{},n=K)=>{let i=e,l="open",a={open:[r,oe(r)],clos:[t,oe(t)]},c=0;for(;;){let o=!1,[u,_]=a[l];if(l==="open"){if(_?o=await u(i,c):o=u(i,c),o)return;n(i)?l="clos":(i=i.lastChild,++c)}else{let h,m,y,E=i.prevSibling;if(E?(y="open",h=E,m=c):(y="clos",h=i.parentNode,m=c-1),_?o=await u(i,c):o=u(i,c),o)return;if(i!==e)l=y,i=h,c=m;else break}}};vl.exports={get_depth:U_,get_ance:X_,get_rt:z_,is_topo_leaf:K,get_drmost:St,get_dlmost:Et,find_rb_of_fst_ance_has_rb:wl,editonly_sdfs_for_each:V_,find_lb_of_fst_ance_has_lb:$l,editonly_rsdfs_for_each:J_,editonly_edfs_for_each:K_,editonly_redfs_for_each:Q_,visit:Z_,rvisit:ef}});var xl=f((Jh,kl)=>{var tf=new Set(["html","head","body","title","meta","link","base","style","header","footer","nav","main","section","article","aside","h1","h2","h3","h4","h5","h6","address","p","hr","pre","blockquote","ol","ul","li","dl","dt","dd","figure","figcaption","div","a","em","strong","small","s","cite","q","dfn","abbr","ruby","rt","rp","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr","ins","del","img","iframe","embed","object","param","video","audio","source","track","picture","map","area","canvas","svg","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","button","select","datalist","optgroup","option","textarea","output","progress","meter","fieldset","legend","details","summary","dialog","script","noscript","template","slot"]),sf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),rf=new Set(["class","rel","sandbox","allow","headers","aria-describedby","aria-labelledby"]);kl.exports={TAGS:tf,VOID_TAGS:sf,NEED_TO_SP_ATTR_NMS:rf}});var Nl=f((Kh,Al)=>{var{TAGS:nf,VOID_TAGS:Tl,NEED_TO_SP_ATTR_NMS:lf}=xl(),{is_url:Sl,fullfill_url:af}=Be(),{editonly_sdfs_for_each:A,is_topo_leaf:Fs}=Ct(),El=(e,t)=>{let r=[e];for(let n of t){let i=[];for(let l of r){let a=l.children;for(let c=0;c<a.length;c++){let o=a[c];o.tagName.toLowerCase()===n&&i.push(o)}}if(i.length===0)return[];r=i}return r},Cl=(e,t)=>{let r=[],n=t.length;function i(l,a){let c=a;l.nodeType===1&&l.tagName.toLowerCase()===t[a]&&(c=a+1,c===n&&r.push(l));let o=l.children;if(o)for(let u=0;u<o.length;u++)i(o[u],c)}return i(e,0),r},Bs=async(e,t,r=Fs)=>{let n=[];return await A(e,async(i,l)=>{if(i.tagName){if(t.test(i.tagName))n.push(i);else if(i.attributes){for(let a of i.attributes)if(t.test(a.name)){n.push(i);break}}}},r),n},cf=async(e,t=Fs)=>{let r=new Set,n=new Set,i=new Set,l=new Set,a=new Set;return await A(e,async(c,o)=>{if(c.nodeType===Node.ELEMENT_NODE){if(r.add(c.tagName.toLowerCase()),c.attributes)for(let u of c.attributes)if(n.add(u.name.toLowerCase()),lf.has(u.name.toLowerCase())){let _=u.value.split(/[ ]+/g);for(let h of _)i.add(h)}else i.add(u.value)}else c.nodeType===Node.TEXT_NODE?l.add(c.nodeValue):c.nodeType===Node.COMMENT_NODE&&a.add(c.nodeValue)},t),{tags:Array.from(r),keys:Array.from(n),vals:Array.from(i),txts:Array.from(l),cmts:Array.from(a)}},ql=async(e,t,r=Fs)=>{if(typeof t=="string")if(t[0]==="#"){let n=[];return await A(e,async(i,l)=>{if(i.tagName){let a=t.slice(1),c=i.getAttribute("id");a===c&&n.push(i)}},r),n}else if(t[0]==="."){let n=[];return await A(e,async(i,l)=>{if(i.tagName){let a=t.slice(1);i.getAttribute("class").split(/[ ]+/g).map(o=>o.toLowerCase()).includes(a)&&n.push(i)}},r),n}else if(t[0]==="`"){let n=[];return await A(e,async(i,l)=>{if(i.nodeType===Node.TEXT_NODE){let a=t.slice(1);node.nodeValue.includes(a)&&n.push(i)}},r),n}else if(t[0]==="!"){let n=[];return await A(e,async(i,l)=>{if(i.nodeType===Node.ELEMENT_NODE&&typeof i.click=="function"){let a=i.tagName.toLowerCase();["html","head","meta","link","style","script"].includes(a)||a.includes(t.slice(1).toLowerCase())&&n.push(i)}},r),n}else if(t[0]==="@"){let n=[];return await A(e,async(i,l)=>{if(i.tagName&&i.attributes)for(let a of i.attributes){let o=a.value.split(/[ ]+/g),u=t.slice(1);for(let _ of o)if(Sl(_)&&_.includes(u)){n.push(i);break}}},r),n}else if(t[0]==="-"){let n={};return await A(e,async(i,l)=>{if(i.tagName&&i.attributes){for(let a of i.attributes)if(a.name.startsWith("data-")){let c=a.name.slice(5);if(c.includes(t.slice(1))){let o=a.value;try{o=JSON.parse(o)}catch{}n[c]?n[c].push(o):n[c]=[o]}}}},r),n}else{if(t[0]==="*")return cf(e,r);if(t[0]==="&"){let n=[];return await A(e,async(i,l)=>{if(i.tagName&&i.attributes)for(let a of i.attributes){let o=a.value.split(/[ ]+/g),u=t.slice(1);for(let _ of o)Sl(_)&&_.includes(u)&&n.push(af(_))}},r),n}else if(t.slice(0,2)==="?:"){let n=[];return await A(e,async(i,l)=>{if(i.tagName&&i.attributes){for(let a of i.attributes)if(t.slice(2).toLowerCase()===a.name.toLowerCase()){n.push(i);break}}},r),n}else if(t.slice(0,2)===":?"){let n=[];return await A(e,async(i,l)=>{if(i.tagName&&i.attributes){for(let a of i.attributes)if(a.value.includes(t.slice(2))){n.push(i);break}}},r),n}else if(t.slice(0,3)==="</>"){let n=[];return await A(e,async(i,l)=>{if(i.nodeType===Node.ELEMENT_NODE){let a=node.nodeValue.toLowerCase();if(!Tl.has(a)){let c=t.slice(3);a.includes(c.toLowerCase())&&n.push(i)}}},r),n}else if(t.slice(0,2)==="<>"){let n=[];return await A(e,async(i,l)=>{if(i.nodeType===Node.ELEMENT_NODE){let a=node.nodeValue.toLowerCase();if(Tl.has(a)){let c=t.slice(2);a.includes(c.toLowerCase())&&n.push(i)}}},r),n}else if(t.slice(0,2)==="//"){let n=[];return await A(e,async(i,l)=>{if(i.nodeType===Node.COMMENT_NODE){let a=t.slice(2);node.nodeValue.toLowerCase().includes(a.toLowerCase())&&n.push(i)}},r),n}else if(t[0]==="/"){let n=t.split("/").filter(l=>l!==""),i=El(document,n);return i.length===0?await Bs(e,new RegExp(t),r):i}else if(t.includes("/")){let n=t.split("/").filter(i=>i!=="");return Cl(document,n)}else{let n=[];return await A(e,async(i,l)=>{(i.tagName?i.tagName.toLowerCase()===t.toLowerCase():!1)&&n.push(i)},r),n}}else{if(t instanceof RegExp)return await Bs(e,t,r);{let n=[];return is_async(t)?await A(e,async(i,l)=>{await t(i,l)&&n.push(i)},r):await A(e,async(i,l)=>{t(i,l)&&n.push(i)},r),n}}},of=new Proxy(document,{get(e,t,r){return nf.has(t.toLowerCase())||t[0]==="*"||t[0]==="&"||t[0]==="-"||t[0]==="#"||t[0]==="."||t[0]==="?"||t[0]===":"||t[0]==="@"||t[0]==="!"||t[0]==="<"||t.includes("/")?ql(document,t):Reflect.get(e,t,r)}});Al.exports={plget:El,plinget:Cl,filter_on_tag_or_attr_key_with_rgx:Bs,filter:ql,$:of}});var qt=f((Qh,Il)=>{var uf=Tt(),_f=(e,t=!1)=>{let r=e.split("-");for(let n=1;n<r.length;++n)r[n]=r[n].charAt(0).toUpperCase()+r[n].slice(1);return t&&(r[0]=r[0].charAt(0).toUpperCase()+r[0].slice(1)),r.join("")},ff=e=>e.replace(/-/g,"_"),hf=(e,t)=>typeof e=="string"?(e=e.trim().toLowerCase(),e==="false"||e==="0"||e==="no"||e==="off"||e==="fls"||e==="f"||e==="null"||e==="nul"||e==="none"||e==="nu"||e==="n"?!1:e==="true"||e==="1"||e==="yes"||e==="on"||e==="tru"||e==="t"||e==="y"?!0:e===""||e==="undefined"||e==="un"||e==="default"||e==="dflt"?!!t:!!e):e===void 0?!!t:!!e,df=e=>{let t=e.replace(/[^0-9.-]/g,"");return parseFloat(t)},pf=e=>uf.parse_from_str(e+" ");Il.exports={dash_to_camel:_f,dash_to_snake:ff,attr_value_to_bool:hf,css_str_to_num:df,parse_json_input:pf}});var Pl=f((Zh,Rl)=>{var Dl=()=>new Promise(e=>{requestAnimationFrame(()=>{e()})}),gf=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(e)})}),mf=async e=>{for(let t=0;t<e;++t)await Dl()},bf=async(e=0)=>new Promise(t=>{setTimeout(()=>{t()},e)}),At=class{timers={};run(t,r,n=300){this.timers[t]&&clearTimeout(this.timers[t]),this.timers[t]=setTimeout(async()=>{await r(),delete this.timers[t]},n)}cancel(t){this.timers[t]&&(clearTimeout(this.timers[t]),delete this.timers[t])}},Ll=()=>new At,Ol=Ll(),yf=(e,t,r=300)=>{Ol.run(e,t,r)},wf=e=>{Ol.cancel(e)};Rl.exports={wait_for_layout_ready:Dl,wait_for_paint_ready:gf,wait_for_n_raf:mf,wait:bf,SimpleDebounce:At,creat_simple_debounce:Ll,simple_debounce:yf,cancel_simple_debounce:wf}});var Fl=f((ed,Bl)=>{var{dash_to_camel:Nt}=qt(),jl=(e,t,r=!1)=>{let n=Nt(t,r)+"Element";e.constructor.prototype.hasOwnProperty(n)||Object.defineProperty(e.constructor.prototype,n,{get:function(){let i=this.shadowRoot;return i?i.querySelector(`.${t}`):null}})},$f=(e,t)=>{for(let r of t)jl(e,r,!1)},vf=e=>{for(let t in DYN_CLSES){{let n="all"+Nt(t,!0)+"Elements";e.constructor.prototype.hasOwnProperty(n)||Object.defineProperty(e.constructor.prototype,n,{get:function(){let i=this.shadowRoot;return i?i.querySelectorAll(`.${t}`):null}})}let r=DYN_CLSES[t];for(let n of r){let i=Nt(n,!0),l="get"+Nt(t,!0)+"ElementBy"+i;e.constructor.prototype.hasOwnProperty(l)||(e.constructor.prototype[l]=function(a){let c=this.shadowRoot;return c?c.querySelector(`.${t}[${n}="${a}"]`):null})}}};Bl.exports={add_one_fixed_element_getter:jl,add_fixed_element_getters:$f,add_dyn_element_getters:vf}});var Yl=f((td,Ml)=>{var kf=Tt(),{dash_to_snake:xf,css_str_to_num:Tf}=qt(),Sf=(e,t)=>{let r=Object.keys(t);for(let n of ATTRS_KEYS){let i=xf(n),l=t[n],a=l.type;e.prototype.hasOwnProperty(i)||(a==="boolean"?Object.defineProperty(e.prototype,i,{get:function(){return attr_value_to_bool(this.getAttribute(n),l.default)},set:function(c){this.setAttribute(n,c?"true":"false")}}):a==="number"?Object.defineProperty(e.prototype,i,{get:function(){let c=this.getAttribute(n);return c?Number(c):l.default},set:function(c){this.setAttribute(n,String(c))}}):Array.isArray(a)&&a.includes("cssnum")&&a.includes("number")?Object.defineProperty(e.prototype,i,{get:function(){return Tf(this.getAttribute(n))},set:function(c){isNaN(Number(c))?this.setAttribute(n,c):this.setAttribute(n,String(c)+"px")}}):a==="json"?Object.defineProperty(e.prototype,i,{get:function(){let c=this.getAttribute(n);return c?kf.parse_from_str(c):l.default},set:function(c){this.setAttribute(n,JSON.stringify(c))}}):Object.defineProperty(e.prototype,i,{get:function(){return this.getAttribute(n)||l.default},set:function(c){this.setAttribute(n,c)}}))}};Ml.exports={add_attr_accessors_to_cls:Sf}});var Hl=f((sd,Wl)=>{var Ms=class{css=`
|
|
1
|
+
var nvbasicbw=(()=>{var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=h((vh,fr)=>{var fa=Symbol("empty"),Fe=Symbol("unknown"),sr=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null,rr=/^[\-\+]?[0-9]+$/,nr=/^\+?[0-9]+$/,ha=/^[\-\+]?0[bB][0-1]+$/,da=/^[\-\+]?0[oO][0-7]+$/,ir=/^[\-\+]?0[xX][0-9a-fA-F]+$/,pa=e=>rr.test(e)||ir.test(e),Zs={"0b":2,"0o":8,"0x":16,2:"0b",8:"0o",16:"0x"},ga=/^[\-\+]?[0-9]+n$/,ma=/^[\-\+]?0[bB][0-1]+n$/,ba=/^[\-\+]?0[oO][0-7]+n$/,ya=/^[\-\+]?0[xX][0-9a-fA-F]+n$/,lr=e=>ga.test(e)||ma.test(e)||ba.test(e)||ya.test(e),ue={Integer:6,Float:7,BigInt:8,PosInfinity:9,NegInfinity:10,NaN:11,6:"Integer",7:"Float",8:"BigInt",9:"PosInfinity",10:"NegInfinity",11:"NaN"},ar=(e,t=!1)=>{let r={value:void 0,type:void 0};return e==="+Infinity"||e==="Infinity"?(r.value=1/0,r.type=ue.PosInfinity):e==="-Infinity"?(r.value=-1/0,r.type=ue.NegInfinity):(e==="NaN"||e==="+NaN"||e==="-NaN")&&(r.value=NaN,r.type=ue.NaN),t?r:r.value},wa=e=>{let t,r,n;e[0]==="+"||e[0]==="-"?(t=e[0],r=Zs[e.slice(1,3).join("").toLowerCase()],n=e.slice(3).join("").toLowerCase()):(t="+",r=Zs[e.slice(0,2).join("").toLowerCase()],n=e.slice(2).join("").toLowerCase());let i=parseInt(n,r);return t==="+"?+i:-i},or=e=>{let t=Array.from(e);if(rr.test(e))return parseInt(e);if(ha.test(e)||da.test(e)||ir.test(e))return wa(t)},$a=e=>{let t=e.be.sign+e.be.bd+e.be.dot+e.be.ad,r=e.ae.sign+e.ae.bd+e.ae.dot+e.ae.ad,n;if(!(t==="+"||t==="-"||r==="+"||r==="-")){if(r!=="")if(e.ae.dot==="."){let i=parseFloat(t),l=parseFloat(r);n=i*10**l}else n=parseFloat(t+"e"+r);else n=parseFloat(t);return n}},va=(e,t)=>e.length===0||t==="."||t==="-."||t==="+."||t==="+"||t==="-",ka=()=>({be:{sign:"",bd:"",dot:"",ad:""},ae:{sign:"",bd:"",dot:"",ad:""},state:"init"}),er=(e,t,r,n)=>((e[r]==="-"||e[r]==="+")&&(t[n].sign=e[r],r=r+1),[e,r]),xa=(e,t,r,n)=>{if(t.state=n+"bd",e[r]===".")t[n].bd="0",t[n].dot=".",t.state=n+"ad";else if(nr.test(e[r]))t[n].bd=e[r];else return[!0,r];return[!1,r+1]},tr=(e,t,r,n)=>{let i;for(i=r;i<e.length;i++)if(e[i]==="."){if(t[n].dot===".")return[!0,i];t[n].dot=".",t.state=n+"ad"}else{if(e[i]==="e"||e[i]==="E")return n==="ae"?[!0,i]:(t.state="aebd",[!1,i+1]);if(nr.test(e[i]))t.state===n+"bd"?t[n].bd=t[n].bd+e[i]:t[n].ad=t[n].ad+e[i];else return[!0,i]}return[!1,i+1]},cr=e=>{let t=ka(),r=Array.from(e);if(va(r,e))return;let n=0,i=!1;if([r,n]=er(r,t,n,"be"),[i,n]=xa(r,t,n,"be"),!i&&([i,n]=tr(r,t,n,"be"),!i&&([r,n]=er(r,t,n,"ae"),[i,n]=tr(r,t,n,"ae"),!i)))return $a(t)},ur=(e,t=!1)=>{let r={value:void 0,type:void 0};if(lr(e))r.value=BigInt(e.substr(0,e.length-1)),r.type=ue.BigInt;else{let n=or(e);n!==void 0?(r.value=n,r.type=ue.Integer):(n=cr(e),n!==void 0?(r.value=n,r.type=ue.Float):(n=ar(e,t=!0),n.value!==void 0&&(r=n)))}return t?r:r.value},Sa=(e,t=!0)=>{if(typeof e=="string")return e;if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="number")return e.toString();if(typeof e=="bigint")return e.toString()+"n";if(typeof e=="symbol")return e.description;if(sr()&&e[Symbol.for("nodejs.util.inspect.custom")])return e[Symbol.for("nodejs.util.inspect.custom")]();{let r=function(n){if(typeof n.toString=="function")return n.toString()};try{return t?s=JSON.stringify(e):s=JSON.stringify(e,null,4),typeof s=="string"?s:r(e)}catch{return r(e)}}},Me={UndefinedLiteral:0,NullLiteral:1,FalseLiteral:3,TrueLiteral:4,StringLiteral:12},Ta={only_value:!0,with_value:!0,with_type:!1,unknown_as_string:!1};function _r(e,t={only_value:!0,with_value:!0,with_type:!1,unknown_as_string:!1}){let r=JSON.parse(JSON.stringify(Ta));Object.assign(r,t);let{only_value:n,with_value:i,with_type:l,unknown_as_string:a}=r,o={value:Fe,type:Fe};if(e==="undefined")o.value=void 0,o.type=Me.UndefinedLiteral;else if(e==="null")o.value=null,o.type=Me.NullLiteral;else if(e==="false")o.value=!1,o.type=Me.FalseLiteral;else if(e==="true")o.value=!0,o.type=Me.TrueLiteral;else{let c=ur(e,!0);c.type===void 0?a?(o.value=e,o.type=Me.StringLiteral):(o.value=e,o.type=Fe):(o.value=c.value,o.type=c.type)}return n?o.value:(l||delete o.type,i||delete o.value,o)}_r.unknown=Fe;var Ea={UndefinedLiteral:0,NullLiteral:1,BooleanLiteral:{_self:2,FalseLiteral:3,TrueLiteral:4},NumericLiteral:{_self:5,Integer:6,Float:7,BigInt:8,PosInfinity:9,NegInfinity:10,NaN:11},StringLiteral:12,ArrayExpression:{_self:13,element:14},ObjectExpression:{_self:15,property:16},_Ref:17,CommentLine:{_self:18,tt:19,k:20,bv:21,av:22},CommentBlock:{_self:23,tt:24,k:25,bv:26,av:27}};fr.exports={TYPE_DICT:Ea,isNode:sr,empty:fa,unknown:Fe,is_bigint_str:lr,is_jsint_str:pa,NUM_TYPE_DICT:ue,parse_abnormal_num:ar,parse_int:or,parse_float:cr,parse_num:ur,parse0:_r,to_str:Sa}});var gr=h((kh,pr)=>{var We={backSpace:8,tab:9,lineFeed:10,lineTab:11,formFeed:12,carriageReturn:13,shiftOut:14,space:32,exclamationMark:33,quotationMark:34,numberSign:35,dollarSign:36,percentSign:37,ampersand:38,apostrophe:39,leftParenthesis:40,rightParenthesis:41,asterisk:42,plusSign:43,comma:44,dash:45,dot:46,slash:47,digit0:48,digit1:49,digit2:50,digit3:51,digit4:52,digit5:53,digit6:54,digit7:55,digit8:56,digit9:57,colon:58,semicolon:59,lessThan:60,equalsTo:61,greaterThan:62,questionMark:63,atSign:64,uppercaseA:65,uppercaseB:66,uppercaseC:67,uppercaseD:68,uppercaseE:69,uppercaseF:70,uppercaseG:71,uppercaseH:72,uppercaseI:73,uppercaseJ:74,uppercaseK:75,uppercaseL:76,uppercaseM:77,uppercaseN:78,uppercaseO:79,uppercaseP:80,uppercaseQ:81,uppercaseR:82,uppercaseS:83,uppercaseT:84,uppercaseU:85,uppercaseV:86,uppercaseW:87,uppercaseX:88,uppercaseY:89,uppercaseZ:90,leftSquareBracket:91,backslash:92,rightSquareBracket:93,caret:94,underscore:95,graveAccent:96,lowercaseA:97,lowercaseB:98,lowercaseC:99,lowercaseD:100,lowercaseE:101,lowercaseF:102,lowercaseG:103,lowercaseH:104,lowercaseI:105,lowercaseJ:106,lowercaseK:107,lowercaseL:108,lowercaseM:109,lowercaseN:110,lowercaseO:111,lowercaseP:112,lowercaseQ:113,lowercaseR:114,lowercaseS:115,lowercaseT:116,lowercaseU:117,lowercaseV:118,lowercaseW:119,lowercaseX:120,lowercaseY:121,lowercaseZ:122,leftCurlyBrace:123,verticalBar:124,rightCurlyBrace:125,tilde:126,nonBreakingSpace:160,oghamSpaceMark:5760,enQuad:8192,emQuad:8193,enSpace:8194,emSpace:8195,threePerEmSpace:8196,fourPerEmSpace:8197,sixPerEmSpace:8198,figureSpace:8199,punctuationSpace:8200,thinSpace:8201,hairSpace:8202,lineSeparator:8232,paragraphSeparator:8233,narrowNoBreakSpace:8239,mediumMathematicalSpace:8287,ideographicSpace:12288,zeroWidthNoBreakSpace:65279};function Ca(e){let t=Object.entries(e),r=new Map;return t.forEach(n=>r.set(n[1],n[0])),r}var Ot=Ca(We);function qa(e){let t=Object.entries(e);return t=t.map(r=>[r[0],String.fromCharCode(r[1])]),Object.fromEntries(t)}var Na=qa(We),hr=e=>55296<=e&&e<=56319,Aa=e=>56320<=e&&e<=57343,Ia=(e,t)=>(e-55296)*1024+(t-56320)+65536,dr=e=>e<=65535,Da=e=>!dr(e),La=e=>{if(e<=65535)return[e,null];{e=e-65536;let t=[null,null];return t[0]=(e>>10)+55296,t[1]=e%1024+56320,t}},Oa=(e,t)=>hr(e)?t+2:t+1;pr.exports={CODE_DICT:We,CH_DICT:Na,CODE_NAME_MP:Ot,cd2ch:e=>String.fromCharCode(e),ch2cd:e=>e.codePointAt(0),cd2n:e=>Ot.get(e),n2cd:e=>String.fromCharCode(We[e]),n2ch:e=>We[e],ch2n:e=>Ot.get(e.codePointAt(0)),is_high_code:hr,is_low_code:Aa,get_code_point_from_high_low:Ia,get_high_low_from_code_point:La,is_length1_code_point:dr,is_length2_code_point:Da,_next_code_index:Oa}});var ve=h((xh,S)=>{var{CODE_DICT:d,CH_DICT:b}=gr(),mr=/\r\n?|[\n\u2028\u2029]/;S.exports.line_break_regexp=mr;S.exports.line_break_regexp_g=new RegExp(mr.source,"g");function br(e){switch(e){case d.lineFeed:case d.carriageReturn:case d.lineSeparator:case d.paragraphSeparator:return!0;default:return!1}}function yr(e){switch(e){case b.lineFeed:case b.carriageReturn:case b.lineSeparator:case b.paragraphSeparator:return!0;default:return!1}}var Rt=[d.lineFeed,d.carriageReturn,d.lineSeparator,d.paragraphSeparator],wr=Rt.map(e=>String.fromCharCode(e));S.exports.NL_CODE_ARR=Rt;S.exports.NL_CH_ARR=wr;S.exports.is_nl_code=br;S.exports.is_nl=yr;S.exports.skip_white_space_regexp=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;function $r(e){switch(e){case 9:case 11:case 12:case d.space:case d.nonBreakingSpace:case d.oghamSpaceMark:case 8192:case 8193:case 8194:case 8195:case 8196:case 8197:case 8198:case 8199:case 8200:case 8201:case 8202:case 8239:case 8287:case 12288:case 65279:return!0;default:return!1}}S.exports.is_non_nl_ws_code=$r;function vr(e){switch(e){case b.tab:case b.lineTab:case b.formFeed:case b.space:case b.nonBreakingSpace:case b.oghamSpaceMark:case b.enQuad:case b.emQuad:case b.enSpace:case b.emSpace:case b.threePerEmSpace:case b.fourPerEmSpace:case b.sixPerEmSpace:case b.figureSpace:case b.punctuationSpace:case b.thinSpace:case b.hairSpace:case b.narrowNoBreakSpace:case b.mediumMathematicalSpace:case b.ideographicSpace:case b.zeroWidthNoBreakSpace:return!0;default:return!1}}S.exports.is_non_nl_ws=vr;var Pt=[d.tab,d.lineTab,d.formFeed,d.space,d.nonBreakingSpace,d.oghamSpaceMark,d.enQuad,d.emQuad,d.enSpace,d.emSpace,d.threePerEmSpace,d.fourPerEmSpace,d.sixPerEmSpace,d.figureSpace,d.punctuationSpace,d.thinSpace,d.hairSpace,d.narrowNoBreakSpace,d.mediumMathematicalSpace,d.ideographicSpace,d.zeroWidthNoBreakSpace];S.exports.NON_NL_WS_CODE_ARR=Pt;var kr=Pt.map(e=>String.fromCharCode(e));S.exports.NON_NL_WS_CH_ARR=kr;function Ra(e){return $r(e)||br(e)}function $e(e){return vr(e)||yr(e)}S.exports.is_ws_code=Ra;S.exports.is_ws=$e;S.exports.WS_CHCODE_ARR=Rt.concat(Pt);S.exports.WS_CH_ARR=wr.concat(kr);var Q={init:0,executing:1,succ:2,eof:3};S.exports.STATE_DICT=Q;function Pa(e,t=new Set){let r={g:e,rslt:"",state:Q.init},n=r.g.next().value;if(n===void 0)return r.state=Q.eof,r;for(;n!==void 0&&($e(n)||t.has(n));)n=r.g.next().value;for(;n!==void 0&&!$e(n)&&!t.has(n);)r.rslt=r.rslt+n,n=r.g.next().value;return n===void 0?r.state=Q.eof:($e(n)||t.has(n))&&(r.state=Q.succ),r}function ja(e,t=0,r=new Set){let n={arr:e,pos:t,rslt:"",state:Q.init};for(let l=n.pos;l<e.length;l++){let a=e[l];if($e(a)||r.has(a))n.pos=n.pos+1;else break}let i=n.pos;for(let l=n.pos;l<e.length;l++){let a=e[l];if(!$e(a)&&!r.has(a))n.pos=n.pos+1;else break}return n.pos===e.length?n.state=Q.eof:n.state=Q.succ,n.rslt=e.slice(i,n.pos).join(""),n}S.exports.from_generator=Pa;S.exports.from_charr=ja});var Z=h((Sh,qr)=>{var{WS_CH_ARR:xr,NON_NL_WS_CH_ARR:Ba,NL_CH_ARR:Ma}=ve();function Fa(e){return Array.from(e).length}var Wa="\u200C",Sr="\u200D",Ya=()=>typeof process<"u"&&process.versions!=null&&process.versions.node!=null;function jt(e,t,...r){let n=function(){return t(this,...r)};Ya()?e.prototype[Symbol.for("nodejs.util.inspect.custom")]=n:e.prototype.repr=n}var B={tmpl_quote:new Error("tmpl_quote: ` cant be deleted"),reserved:new Error(" [/,*,#,&,`,\\,] and whitespaces are reserved"),inuse:new Error("in using"),char:new Error("must be a char"),pair:new Error("left block must be different with right"),cant_be_empty:new Error("can NOT be empty")},it=Symbol("get_pair_lmp"),Ha=Symbol("add_pair_reserved"),Ye=class{#t;#e=new Map;#s=new Map;constructor(t){this.#t=t}get[it](){return this.#e}get size(){return this.#e.size}[Ha](t,r){if(t===r)throw B.pair;this.#e.set(t,r),this.#s.set(r,t)}add(t,r){if(this.#t.validate(t),this.#t.validate(r),t===r)throw B.pair;this.#e.set(t,r),this.#s.set(r,t)}ldelete(t){if(this.size<2)throw B.cant_be_empty;{let r=this.#e.get(t);this.#e.delete(t),this.#s.delete(r)}}rdelete(t){if(this.size<2)throw B.cant_be_empty;{let r=this.#s.get(t);this.#s.delete(t),this.#e.delete(r)}}lhas(t){return this.#e.has(t)}rhas(t){return this.#s.has(t)}has(t){return this.lhas(t)||this.rhas(t)}getl(t){return this.#s.get(t)}getr(t){return this.#e.get(t)}[Symbol.iterator](){return this.#e[Symbol.iterator]()}};function Ga(e){return new Map(e[it])}jt(Ye,Ga);var Tr=Symbol("get_single_set"),Er=Symbol("add_single_reserved"),ke=class{#t;#e=new Set;constructor(t){this.#t=t}get[Tr](){return this.#e}[Er](t){this.#e.add(t)}add(t){this.#t.validate(t),this.#e.add(t)}delete(t){if(this.size<2)throw B.cant_be_empty;if(t==="`")throw B.tmpl_quote;this.#e.delete(t)}has(t){return this.#e.has(t)}[Symbol.iterator](){return this.#e[Symbol.iterator]()}};function za(e){return new Set(e[Tr])}jt(ke,za);var lt=class{#t;#e;#s;#r;#n;#i=!1;constructor(){this.#t=new Ye(this),this.#t.add("[","]"),this.#t.add("(",")"),this.#t.add("<",">"),this.#t.add("\uFF08","\uFF09"),this.#t.add("\u2018","\u2019"),this.#e=new Ye(this),this.#e.add("{","}"),this.#e.add("\u3010","\u3011"),this.#e.add("\u300A","\u300B"),this.#e.add("\u201C","\u201D"),this.#s=new ke(this),this.#s.add('"'),this.#s.add("'"),this.#s.add("\xB7"),this.#s[Er]("`"),this.#r=new ke(this),this.#r.add(","),this.#r.add("\uFF0C"),this.#r.add(";"),this.#r.add("\uFF1B"),this.#r.add("\u3002"),this.#r.add("\u3001"),this.#n=new ke(this),this.#n.add(":"),this.#n.add("\uFF1A"),this.#n.add("="),this.#i=!0}get reserved(){return["/","*","#","&","`","\\"].concat(xr)}get inuse(){let t=new Set;if(this.#i){for(let r of this.#s)t.add(r);for(let r of this.#r)t.add(r);for(let r of this.#n)t.add(r);for(let r of this.#t[it])t.add(r);for(let r of this.#e[it])t.add(r)}return t}validate(t){if(typeof t!="string"||Fa(t)!==1)throw B.char;if(this.reserved.includes(t))throw B.reserved;if(Array.from(this.inuse).flat().includes(t))throw B.inuse;return t}get esc(){return"\\"}get slash(){return"/"}get line_comment(){return"//"}get asterisk(){return"*"}get blk_comments(){return["/*","*/"]}get hash(){return"#"}get ref(){return"&"}get tmpl_quote(){return"`"}get nl(){return Ma}get non_nl_ws(){return Ba}get ws(){return xr}get array_blks(){return this.#t}get fst_ary_blks(){return Array.from(this.#t)[0]}get obj_blks(){return this.#e}get fst_obj_blks(){return Array.from(this.#e)[0]}get quotes(){return this.#s}get fst_quote(){return Array.from(this.#s)[0]}get commas(){return this.#r}get fst_comma(){return Array.from(this.#r)[0]}get colons(){return this.#n}get fst_colon(){return Array.from(this.#n)[0]}},at=class{constructor(t){this.reserved=t.reserved}get[Symbol.toStringTag](){return"reserved"}};Object.defineProperty(at,"name",{value:Sr});var ot=class{constructor(t){this.esc=t.esc,this.hash=t.hash,this.ref=t.ref,this.tmpl_quote=t.tmpl_quote,this.slash=t.slash,this.asterisk=t.asterisk,this.line_comment=t.line_comment,this.blk_comments=t.blk_comments,this.nl=t.nl,this.non_nl_ws=t.non_nl_ws}get[Symbol.toStringTag](){return"fixed"}};Object.defineProperty(ot,"name",{value:Sr});var ct=class{constructor(t){this.obj_blks=t.obj_blks,this.array_blks=t.array_blks,this.quotes=t.quotes,this.commas=t.commas,this.colons=t.colons}get[Symbol.toStringTag](){return"configurable-if-not-reserved"}};Object.defineProperty(ct,"name",{value:Wa});function Ua(e){return[new ot(e),new ct(e),new at(e)]}jt(lt,Ua);var Cr=new lt;Cr.ERROR_DICT=B;qr.exports=Cr});var Ar=h((Th,Nr)=>{function*Va(e){for(let t of e)yield t;e=null}Nr.exports.sync_gen_from_str=Va});var I=h((Eh,Lr)=>{var Ir={bk:{_self:0,eof:{_self:1,lc:2,blkc:3,hash:{_self:4,naked:5,quote:6},ref:{_self:7,naked:8,quote:9}}},k:{_self:10,eof:{_self:11,lc:12,blkc:13,hash:{_self:14,naked:15,quote:16},ref:{_self:17,naked:18,quote:19}}},ak:{_self:20,eof:{_self:21,lc:22,blkc:23,hash:{_self:24,naked:25,quote:26},ref:{_self:27,naked:28,quote:29}}},bv:{_self:30,eof:{_self:31,lc:32,blkc:33,hash:{_self:34,naked:35,quote:36},ref:{_self:37,naked:38,quote:39}}},v:{_self:40,eof:{_self:41,lc:42,blkc:43,hash:{_self:44,naked:45,quote:46},ref:{_self:47,naked:48,quote:49}}},av:{_self:50,eof:{_self:51,lc:52,blkc:53,hash:{_self:54,naked:55,quote:56},ref:{_self:57,naked:58,quote:59}}}};function A(e){return e instanceof Object?e._self:e}function Xa(e){return e+1}function Ja(e){return e+2}function Ka(e){return e+3}function Qa(e){return e+6}function Za(e){return e+5}function eo(e){return e+9}function to(e){return e+8}function Dr(e){return e%10!==0}var so={backslash:0,lcmt:1,blkcmt:2,quote:3,naked:4},ro={handling:0,handled:1};function no(e,t,r){let n=Ir;return e.$has_yield_sign()||Dr(r)||t===A(n.av)&&r===A(n.bv)||t===A(n.av)&&r===A(n.bk)||t===A(n.av)&&r===A(n.k)||t===A(n.av)&&r===A(n.v)||t===A(n.av)&&r===A(n.ak)||t===A(n.v)&&r===A(n.bv)||t===A(n.v)&&r===A(n.bk)}Lr.exports={STATE_DICT:Ir,gtv:A,get_main_eofv_with_code:Xa,get_lcmt_eofv_with_code:Ja,get_blkcmt_eofv_with_code:Ka,get_hash_quote_eofv_with_code:Qa,get_hash_naked_eofv_with_code:Za,get_ref_quote_eofv_with_code:eo,get_ref_naked_eofv_with_code:to,LEFTED_TYPE:so,AVND_CACHE_STATE_DICT:ro,is_eofv:Dr,is_should_yield:no}});var zt=h((Ch,Gr)=>{var{is_nl:Pr}=ve(),jr=(e,t,r=" ",n=!1)=>{let i=e.length;return i<=t?r.repeat(t-i)+e:n?e.substr(i-t):e},ut=(e,t,r,n="0",i=!1)=>{let l=e.toString(t);return jr(l,r,n,i)},io=/^[0-7]$/,lo=/^[0-9a-fA-F]$/,_e=e=>io.test(e),U=e=>lo.test(e),_t={b:"\b",f:"\f",n:`
|
|
2
|
+
`,r:"\r",t:" ",v:"\v"},Br={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\\":"\\\\"};function ao(e){return Br[e]}function Mr(e){return _t[e]}function oo(e){if(e.length>1)return;let t=e.charCodeAt(0);if(t>=0&&t<=255)return"\\x"+ut(t,16,2)}function co(e){e=Array.from(e);let t=e[0],r=e[1];if(U(t)&&U(r)){let n=parseInt("0x"+t+r);return String.fromCharCode(n)}}function uo(e){if(e.length>1)return;let t=e.charCodeAt(0);if(t>=0&&t<=255)return"\\u"+ut(t,16,4)}function _o(e){e=Array.from(e);let t=e[0],r=e[1],n=e[2],i=e[3];if(U(t)&&U(r)&&U(n)&&U(i)){let l=parseInt("0x"+t+r+n+i);return String.fromCharCode(l)}}function fo(e){if(e.length>1)return;let t=e.charCodeAt(0);if(t>=0&&t<=255)return"\\"+ut(t,8,3)}function ho(e){let t="";e=Array.from(e);let r=e[0];if(_e(r)){t=t+r;let n=e[1];if(_e(n)){t=t+n;let l=e[2];_e(l)&&(t=t+l)}let i=parseInt(t,8);return String.fromCharCode(i)}}var p={init:0,executing:1,succ:2,eof:3,backslash:4,x:5,u:6,o:7};function*po(e){let t=Array.from(e);for(let r of t)yield r}function*Or(e,t){yield*t,yield*e}function Fr(e,t,r,n,i=!1){if(typeof t=="string"){let a=t;t=o=>o===a}if(typeof(r==="string")&&r.length>0){let a=po(r);e=Or(e,a)}else e=Or(e,r);let l={state:p.init,end:t,esc:n,g:e,curr:"",ch:e.next().value,offset:0};return l.ch!==void 0&&(l.offset=l.offset+1),i&&(l.rslt=""),l}function Bt(e){return e.ch===void 0||e.end(e.ch)&&e.state!==p.backslash||e.state===p.x||e.state===p.u||e.state===p.o}function Mt(e,t=!1){return e.ch===e.esc?(e.state=p.backslash,e.curr=""):(e.state=p.executing,t&&(e.rslt=e.rslt+e.ch),e.curr=e.ch),e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function Rr(e,t,r,n,i,l,a){return a===!0?n===Wr?(e.state=p.x,e.ch="\\x"+t.join(""),e):n===Yr?(e.state=p.u,e.ch="\\u"+t.join(""),e):(n===Hr&&(e.state=p.o,e.ch="\\"+t.join("")),e):i?(e.curr=t.join(""),l&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=r,e):(e.curr=n(t),l&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=r,e)}function go(e,t,r,n,i){return e.curr=n(t),i&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function ft(e,t,r,n,i=!0,l=!1,a=void 0,o=!1){let c;if(a!==void 0?c=a:(c=e.g.next().value,c!==void 0&&(e.offset=e.offset+1)),c===void 0)return e;let u=0,_=[],f;if(l?f=!0:f=r(c),f)u=u+1,_.push(c);else return e.state=p.executing,e.ch=c,e;for(;u<t;){if(c=e.g.next().value,c===void 0)return Rr(e,_,c,n,i,o,tail=!0);if(e.offset=e.offset+1,f=r(c),f)u=u+1,_.push(c);else return Rr(e,_,c,n,i,o,tail=!1)}return go(e,_,c,n,o)}function Wr(e){let t=parseInt("0x"+e[0]+e[1]);return String.fromCharCode(t)}function Yr(e){let t=parseInt("0x"+e[0]+e[1]+e[2]+e[3]);return String.fromCharCode(t)}function Hr(e){let t=parseInt(e.join(""),8);return String.fromCharCode(t)}function Ft(e,t=!1){return e.curr=Mr(e.ch),t&&(e.rslt=e.rslt+e.curr),e.state=p.executing,e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function Wt(e,t=!1){return ft(e,2,U,Wr,!0,!1,void 0,t)}function Yt(e,t=!1){return ft(e,4,U,Yr,!0,!1,void 0,t)}function Ht(e,t=!1){return ft(e,3,_e,Hr,!1,!0,e.ch,t)}function Gt(e,t=!1){return e.curr=e.ch,t&&(e.rslt=e.rslt+e.ch),e.state=p.executing,e.ch=e.g.next().value,e.ch!==void 0&&(e.offset=e.offset+1),e}function mo(e,t=i=>i==='"',r="",n="\\"){let i=Fr(e,t,r,n,!0);for(i.state=p.executing;!Bt(i);)i.state===p.executing?Mt(i,!0):i.state===p.backslash&&(Pr(i.ch)?(i.ch=i.g.next().value,i.ch!==void 0&&(i.offset=i.offset+1),i.state=p.executing):i.ch in _t?Ft(i,!0):i.ch==="x"?Wt(i,!0):i.ch==="u"?Yt(i,!0):_e(i.ch)?Ht(i,!0):Gt(i,!0));return typeof i.ch=="string"&&i.end(i.ch)?(i.state=p.succ,i.ch=""):i.state===p.backslash?i.ch=i.esc:i.ch===void 0&&(i.state=p.eof,i.ch=""),i}function*bo(e){let t=e;for(t.state=p.executing;!Bt(t);)t.state===p.executing?(Mt(t,!1),t.curr!==""&&(yield t.curr)):t.state===p.backslash&&(Pr(t.ch)?(t.state=p.executing,t.ch=t.g.next().value,t.ch!==void 0&&(t.offset=t.offset+1)):t.ch in _t?(Ft(t,!1),t.curr!==""&&(yield t.curr)):t.ch==="x"?(Wt(t,!1),t.curr!==""&&(yield t.curr)):t.ch==="u"?(Yt(t,!1),t.curr!==""&&(yield t.curr)):_e(t.ch)?(Ht(t,!1),t.curr!==""&&(yield t.curr)):(Gt(t,!1),t.curr!==""&&(yield t.curr)));return typeof t.ch=="string"&&t.end(t.ch)?(t.state=p.succ,t.ch=""):t.state===p.backslash?(t.ch=t.esc,yield t.curr):t.ch===void 0&&(t.state=p.eof,t.ch=""),t}Gr.exports={CHAR_UNESC_DICT:_t,CHAR_ESC_DICT:Br,escc:ao,unescc:Mr,escx:oo,unescx:co,escu:uo,unescu:_o,esco:fo,unesco:ho,STATE_DICT:p,from_generator:mo,init:Fr,handle_executing:Mt,is_terminated:Bt,handle_escc:Ft,esc_handle_engine:ft,handle_escx:Wt,handle_escu:Yt,handle_esco:Ht,handle_esc_other:Gt,gen:bo,prepend:jr,prepend_num:ut,is_odigit_ch:_e,is_hdigit_ch:U}});var en=h((qh,Zr)=>{var{is_nl:yo}=ve(),xe=zt(),zr={line_comment:0,blk_comment:1},ee={init:0,executing:1,succ:2,eof:3,asterisk:4};function Ur(e){return{state:ee.init,g:e,rslt:"",ch:"",offset:0}}function Vr(e,t){return e.state=ee.eof,e.rslt=e.rslt+t.rslt,e.ch="",e}function Xr(e,t){return e.state=ee.succ,e.rslt=e.rslt+t.rslt,e.ch="",e}function Jr(e,t){return e.state=ee.executing,e.rslt=e.rslt+t.rslt,e.ch=t.ch,e}function Kr(e,t=""){let r=Ur(e);r.state=ee.executing;let n=xe.from_generator(r.g,yo,t);return r.offset=n.offset+r.offset,r.g=n.g,n.state===xe.STATE_DICT.eof?Vr(r,n):n.state===xe.STATE_DICT.succ?Xr(r,n):Jr(r,n)}function Qr(e,t=""){let r=Ur(e);r.state=ee.executing;let n;for(;;){if(n=xe.from_generator(r.g,"*",t),r.offset=r.offset+n.offset,r.g=n.g,n.state===xe.STATE_DICT.eof)return Vr(r,n);if(n.state===xe.STATE_DICT.succ){let i=r.g.next().value;if(i!==void 0&&(r.offset=r.offset+1),i==="/")return Xr(r,n);if(i!==void 0)r.rslt=r.rslt+n.rslt+"*",t=i,r.offset=r.offset-1;else return r.rslt=r.rslt+n.rslt,r.ch="*",r.state=ee.asterisk,r}else return Jr(r,n)}return r}function wo(e,t,r=""){return t===zr.line_comment?Kr(e,r):Qr(e,r)}Zr.exports={TYPE_DICT:zr,STATE_DICT:ee,lc_from_generator:Kr,blk_from_generator:Qr,from_generator:wo}});var Ut=h((Nh,tn)=>{function $o(e){if(globalThis.document===void 0){let i=globalThis.require("fs").readFileSync(e).toString();return JSON.parse(i)}else return}function vo(e,t){if(globalThis.document===void 0){let n=globalThis.require("fs"),i=JSON.stringify(t);n.writeFileSync(e,i)}else return}function ko(e){return parseInt(e).toString()===e}tn.exports={rjson:$o,wjson:vo,is_int_str:ko}});var Vt=h((Ah,sn)=>{var xo=()=>Math.random()*9007199254740992;function So(e,t){return Array.from({length:t-e}).map((r,n)=>n+e)}function To(e,t){return t.filter((r,n)=>e.includes(n))}function Eo(e){return Object.entries(e).length===0}function Co(e){return Object.entries(e).map(n=>n[1])}function qo(e){return Object.entries(e).map(n=>n[0])}function No(e){return Object.entries(e).length}function Ao(e,t){for(let r in e)t(r,e[r]);return e}function Io(e,t){for(let r in e)e[r]=t(r,e[r]);return e}function Do(e,t){for(let r in t)e[r]=t[r];return e}function Lo(e,t){for(let r in t)!(r in e)&&(e[r]=t[r]);return e}function Oo(e,t,r){return r=r.filter(n=>n[e]!==t),r}function Ro(e,t,r){return r.findIndex(i=>i[e]===t)}function Po(e){return JSON.parse(JSON.stringify(e))}function jo(e,t){for(let r=0;r<e.length;r++){lyr=e[r];for(let n=0;n<lyr.length;n++)e[r][n]=t(e[r][n],r,n)}return e}function Bo(e){let t=e[0]!=="_",r=e[0]!=="$";return t&&r}sn.exports={gen_guid:xo,range:So,seqs_slct:To,dict_length:No,is_empty_dict:Eo,dict_values:Co,dict_keys:qo,dict_map:Io,dict_foreach:Ao,dict_plus:Do,dict_update:Lo,dtb_kv_rm:Oo,dtb_kv_get_seq:Ro,dcp:Po,mat_map:jo,is_cu_property:Bo}});var as=h((Ih,qn)=>{var v=Vt();function Kt(e){if(v.is_empty_dict(e))return 0;{let t=v.dict_keys(e);return Math.max(...t)+1}}function He(e){return e!=null}function nn(e,t){return e._id=e._id+t,e._tree=e._tree+t,He(e._fstch)&&(e._fstch=e._fstch+t),He(e._lsib)&&(e._lsib=e._lsib+t),He(e._rsib)&&(e._rsib=e._rsib+t),He(e._parent)&&(e._parent=e._parent+t),e}function fe(e,t){let r=Kt(e);for(let n in t){let i=nn(t[n],r);t[i._id]=i,delete t[n]}return t}function Mo(e=0){let t=e;return{_id:t,_fstch:null,_lsib:null,_rsib:null,_parent:null,_tree:t}}function Fo(e,t=0){return{_id:Kt(e)+t,_fstch:null,_lsib:void 0,_rsib:void 0,_parent:void 0,_tree:void 0}}function ln(e){return e._tree!==void 0}function te(e){let t=e._tree!==void 0,r=e._tree===e._id;return t&&r}function Qt(e){return e._lsib===null}function Zt(e){return e._rsib===null}function M(e){return e._fstch===null}function an(e,t){if(te(e))return!0;{let n=k(e,t);return W(n,t).length===1}}function Ve(e){return te(e)||!ln(e)}function ht(e,t,r){if(!Ve(t))return console.log("only root or uninited could be prepend"),e;let n=M(e);if(t._tree=e._tree,t._lsib=null,n)t._rsib=null,t._parent=e._id;else{let i=r[e._fstch];i._lsib=void 0,t._rsib=i._id,t._parent=void 0}return e._fstch=t._id,r[t._id]=t,e}function es(e,t,r){if(!Ve(t))return console.log("only root or uninited could be append"),e;let n=M(e);if(t._tree=e._tree,t._rsib=null,n)e._fstch=t._id,t._lsib=null;else{let i=de(e,r);i._parent=void 0,i._rsib=t._id,t._lsib=void 0}return t._parent=e._id,r[t._id]=t,e}function ts(e,t,r){if(!Ve(t))return console.log("only root or uninited could be add"),e;if(te(e))return console.log("cant addrsib to root"),e;let n=Zt(e);return t._tree=e._tree,n?(t._parent=e._parent,e._parent=void 0,t._rsib=null):(t._rsib=e._rsib,t._parent=void 0),e._rsib=t._id,t._lsib=void 0,r[t._id]=t,e}function on(e,t,r){if(!Ve(t))return console.log("only root or uninited could be add"),e;if(te(e))return console.log("cant addlsib to root"),e;let n=Qt(e);if(t._tree=e._tree,n){let i=k(e,r);e._lsib=void 0,t._lsib=null,i._fstch=t._id}else{let i=F(e,r);i._rsib=t._id,t._lsib=void 0}return t._rsib=e._id,t._parent=void 0,r[t._id]=t,e}function cn(e,t,r,n){let i=W(t,n),l=i.length;if(l===0)return ht(t,r,n);if(e<=l&&e>=0){if(e===0)return ht(t,r,n);if(e===l)return es(t,r,n);{let o=i[e-1];return ts(o,r,n)}}else return console.log("not in range!!"),t}function Se(e,t){for(let r in t)t[r]._tree=e._tree}function Wo(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=ht(e,i,t),Se(e,r),v.dict_plus(t,r),e}function Yo(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=es(e,i,t),Se(e,r),v.dict_plus(t,r),e}function Ho(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=ts(e,i,t),Se(e,r),v.dict_plus(t,r),e}function Go(e,t,r){r=fe(t,r);let n=v.dict_keys(r)[0],i=re(r[n],r);return e=on(e,i,t),Se(e,r),v.dict_plus(t,r),e}function zo(e,t,r,n){n=fe(r,n);let i=v.dict_keys(n)[0],l=re(n[i],n);return t=cn(e,t,l,r),Se(t,n),v.dict_plus(r,n),t}function Ge(e,t){let r=Y(e,t),n=r[0]._id;return r.forEach(i=>{i._tree=n}),r}function ze(e,t){let r={};return e.map(n=>{let i=n._id;r[i]=n,delete t[i]}),r}function un(e){return e._fstch=null,e}function Ue(e){return e._lsib=null,e._rsib=null,e._parent=null,e}function Te(e,t){if(te(e))return[e,t];if(an(e,t)){let n=t[e._parent];un(n);let i=Ge(e,t),l=ze(i,t);return Ue(e),[e,l]}else if(Qt(e)){let n=P(e,t);n._lsib=null;let i=k(e,t);i._fstch=e._rsib;let l=Ge(e,t),a=ze(l,t);return Ue(e),[e,a]}else if(Zt(e)){let n=F(e,t);n._rsib=e._rsib,n._parent=e._parent;let i=Ge(e,t),l=ze(i,t);return Ue(e),[e,l]}else{let n=F(e,t);n._rsib=e._rsib;let i=Ge(e,t),l=ze(i,t);return Ue(e),[e,l]}}function Uo(e,t){let r=he(e,t);return r===null?[e,t]:Te(r,t)}function Vo(e,t){let r=de(e,t);return r===null?[e,t]:Te(r,t)}function Xo(e,t,r){let n=_n(e,t,r);return n===null?[t,r]:Te(n,r)}function Jo(e,t,...r){let n=fn(e,t,...whiches);for(let i=0;i<n.length;i++)Te(n[i],t);return[e,t]}function Ko(e,t){let r=W(e,t);for(let n=0;n<r.length;n++)Te(r[n],t);return t}function he(e,t){return e._fstch===null?null:t[e._fstch]}function W(e,t){let r=[],n=he(e,t);for(;n!==null;)r.push(n),n=P(n,t);return r}function de(e,t){let r=W(e,t);return r.length===0?null:r[r.length-1]}function _n(e,t,r){let n=W(t,r);return n.length===0||e>n.length-1||e<0?null:n[e]}function fn(e,t,...r){let n=W(e,t),i=[];if(n.length!==0)for(let l=0;l<r.length;l++){let a=r[l];a>n.length-1||a<0||i.push(n[a])}return i}function hn(e,t,r=!1){let n=e,i=P(e,t);for(;i!==null;)n=i,i=P(i,t);return r||n._id!==e._id?n:null}function Qo(e,t){let r=se(e,t,!0),n=v.dtb_kv_get_seq("_id",e._id,r),i=[];if(r.length!==0)for(let l=0;l<r.length;l++)l<n&&i.push(r[l]);return i}function Zo(e,t){let r=se(e,t,!0),n=v.dtb_kv_get_seq("_id",e._id,r),i=[];if(r.length!==0)for(let l=0;l<r.length;l++)l>n&&i.push(r[l]);return i}function se(e,t,r=!1){let n=k(e,t),i;return n!==null?i=W(n,t):i=[e],r||(i=v.dtb_kv_rm("_id",e._id,i)),i}function ec(e,t,r=!1){let n=se(e,t,!0);return r?n[0]:n[0]._id===e._id?null:n[0]}function tc(e,t,r){let n=se(t,r,!0),i=n.length;return e<=i-1&&e>=0?n[e]:null}function sc(e,t,...r){let n=se(e,t,!0),i=[];if(n.length!==0)for(let l=0;l<r.length;l++){let a=r[l];a>n.length-1||a<0||i.push(n[a])}return i}function rc(e,t){let r=se(e,t,!0);return v.dtb_kv_get_seq("_id",e._id,r)}function F(e,t){let r=se(e,t,!0),n=v.dtb_kv_get_seq("_id",e._id,r);return n===0?null:r[n-1]}function P(e,t){return e._rsib===null?null:t[e._rsib]}function C(e,t){return dt(e,t,!0).length-1}function dn(e,t){let r=C(e,t),i=Y(e,t).map(a=>C(a,t));return Math.max(...i)-r+1}function nc(e,t){return M(e)?null:C(e,t)+1}function ic(e,t){if(M(e))return null;{let n=C(e,t),l=Y(e,t).map(o=>C(o,t));return Math.max(...l)}}function lc(e,t,r){let n=C(t,r);return dn(t,r)<=e?null:n+e}function pn(e,t){let r=re(e,t),n=Y(r,t),i=C(e,t);return n.filter(a=>C(a,t)===i)}function Xt(e,t){let r=pn(e,t);return v.dtb_kv_get_seq("_id",e._id,r)}function ac(e,t){return Y(e,t).length}function re(e,t){let r=e,n=k(e,t);for(;n!==null;)r=n,n=k(n,t);return r}function k(e,t){let r;if(te(e))r=null;else{let n=hn(e,t,!0);r=t[n._parent]}return r}function dt(e,t,r=!1){let n=[],i=k(e,t);for(;i!==null;)n.push(i),i=k(i,t);return r&&n.unshift(e),n}function oc(e,t,r){let n=dt(t,r,!0),i=n.length;return e<i&&e>=0?n[e]:null}function cc(e,t,...r){let n=dt(e,t,!0),i=[];if(n.length!==0)for(let l=0;l<r.length;l++){let a=r[l];a>n.length-1||a<0||i.push(n[a])}return i}function gn(e,t){let r=k(e,t);for(;r!==null;){let n=P(r,t);if(n!==null)return n;r=k(r,t)}return null}function mn(e,t){let r=he(e,t);if(r!==null)return r;{let n=P(e,t);return n!==null?n:gn(e,t)}}function bn(e,t){let r=e,n=de(e,t);for(;n!==null;)r=n,n=de(n,t);return r}function uc(e,t){if(te(e))return null;if(M(e)){let n=F(e,t);return n!==null?n:k(e,t)}else{let n=F(e,t);return n!==null?M(n)?n:bn(n,t):k(e,t)}}function Y(e,t){let r=C(e,t),n=[];for(;e!==null&&(n.push(e),e=mn(e,t),!(e!==null&&C(e,t)<=r)););return n}function ss(e,t){let r=e,n=he(e,t);for(;n!==null;)r=n,n=he(n,t);return r}function yn(e,t){let r=P(e,t);return r===null?k(e,t):ss(r,t)}function wn(e,t){let r=k(e,t);for(;r!==null;){let n=F(r,t);if(n!==null)return n;r=k(r,t)}return null}function _c(e,t){if(M(e)){let n=F(e,t);return n===null?wn(e,t):n}else return de(e,t)}function $n(e,t){let r=[],n=ss(e,t);for(;n!==null&&(r.push(n),n._id!==e._id);)n=yn(n,t);return r}function Jt(e){v.dict_foreach(e,(t,r)=>{e[t]._$visited=!1})}function vn(e,t){let r=e._$visited;if(M(e))if(r){let i=P(e,t);return i===null?k(e,t):i}else return e._$visited=!0,e;else if(r){let i=P(e,t);return i===null?k(e,t):i}else return e._$visited=!0,he(e,t)}function fc(e,t,r){if(M(t)){if(e)return t;{let i=F(t,r);return i===null?k(t,r):i}}else{if(e)return de(t,r);{let i=F(t,r);return i===null?k(t,r):i}}}function kn(e,t){return t._$visited&&e===t._id}function xn(e,t,r=!1,n=!0){let i=[];Jt(t);let l=e._id;for(;!kn(l,e);)r?i.push(v.dcp(e)):i.push(e),e=vn(e,t);return r?i.push(v.dcp(e)):i.push(e),n&&Jt(t),i}function hc(e,t){let r={};r._depth=C(e,t),r._breadth=Xt(e,t);let n=k(e,t);return r._pbreadth=n===null?null:Xt(n,t),r._id=e._id,r}function rn(e){let t={};return t.ele={},t.nd=e,t.ele._id=e._id,t.ele._children=[],t}function rs(e,t){let r=[],n=e[0],i=[rn(n)];for(i[0].ele._pbreadth=null;i.length>0;){let l=[];for(let o=0;o<i.length;o++){i[o].ele._breadth=o,i[o].ele._depth=r.length;let c=W(i[o].nd,t);c=c.map(u=>rn(u)),c.forEach((u,_)=>{u.ele._pbreadth=i[o].ele._breadth,i[o].ele._children.push([r.length+1,l.length+_])}),l=l.concat(c)}let a=i.map(o=>o.ele);r.push(a),i=l}return r}function Sn(e,t){return $n(e[0],t)}function Tn(e,t,r=!1,n=!0){return xn(e[0],t,r,n)}function dc(e,t){let r=ns(e,t);return rs(r,t)}function ns(e,t){let r=e[e.length-1];return Y(r,t)}function pc(e,t,r=!1,n=!0){let i=ns(e,t);return Tn(i,t,r,n)}function gc(e,t){let r=is(e,t);return rs(r,t)}function is(e,t){let r=e[0];return Y(r,t)}function mc(e,t){let r=is(e,t);return Sn(r,t)}function ls(e,t,r=!1){let n=Y(e,t);return r||n.splice(0,1),n}function bc(e,t){return W(e,t)}function yc(e,t){let r=ls(e,t,!1),n=sdfs.map(l=>C(l,t)),i=Math.max(...n);return r=r.filter(l=>C(l,t)===i),r}function En(e,t,r){let n=C(t,r),i=ls(t,r,!1),l=sdfs.map(a=>C(a,r));return i=i.filter(a=>C(a,r)===n+e),i}function wc(e,t,...r){let n=r.map(i=>En(i,e,t));return n=Array.prototype.concat(...n),n}function Cn(e){let t=v.dict_keys(e)[0],r=e[t];return re(r,e)}function $c(e){let t=Cn(e);return Y(t,e)}qn.exports={calc_next_id:Kt,update_nodes_ids:fe,creat_root:Mo,creat_nd:Fo,is_inited:ln,is_root:te,is_fstch:Qt,is_lstch:Zt,is_leaf:M,is_lonely:an,is_id:He,is_connectable:Ve,prepend_child:ht,append_child:es,insert_child:cn,add_rsib:ts,add_lsib:on,get_fstch:he,get_rsib:P,get_children:W,get_lstch:de,get_which_child:_n,get_some_children:fn,get_fstsib:ec,get_lstsib:hn,get_preceding_sibs:Qo,get_following_sibs:Zo,get_sibs:se,get_which_sib:tc,get_some_sibs:sc,get_sibseq:rc,get_lsib:F,get_rsib:P,get_lyr:pn,get_breadth:Xt,get_count:ac,get_depth:C,get_height:dn,get_fst_lyr_des_depth:nc,get_lst_lyr_des_depth:ic,get_which_lyr_des_depth:lc,get_root:re,get_parent:k,get_ances:dt,get_which_ance:oc,get_some_ances:cc,get_rsib_of_fst_ance_having_rsib:gn,get_sdfs_next:mn,get_drmost_des:bn,get_sdfs_prev:uc,get_sdfs:Y,get_lsib_of_fst_ance_having_lsib:wn,get_dlmost_des:ss,get_edfs_next:yn,get_edfs_prev:_c,get_edfs:$n,clear_$visited:Jt,get_sedfs_next:vn,is_sedfs_traverse_finished:kn,get_sedfs_prev:fc,get_sedfs:xn,get_deses:ls,get_fst_lyr_deses:bc,get_lst_lyr_deses:yc,get_which_lyr_deses:En,get_some_lyrs_deses:wc,nd2ele:hc,sdfs2mat:rs,sdfs2edfs:Sn,sdfs2sedfs:Tn,edfs2mat:dc,edfs2sdfs:ns,edfs2sedfs:pc,sedfs2mat:gc,sedfs2sdfs:is,sedfs2edfs:mc,update_disconnected_nodes:Ge,update_orig_nodes:ze,leafize:un,rootize:Ue,disconnect:Te,rm_fstch:Uo,rm_lstch:Vo,rm_which:Xo,rm_some:Jo,rm_all:Ko,update_treeid:Se,update_one_nodeid:nn,update_nodes_ids:fe,prepend_child_tree:Wo,append_child_tree:Yo,add_rsib_tree:Ho,add_lsib_tree:Go,insert_child_tree:zo,get_root_via_tree:Cn,tree2sdfs:$c}});var Ln=h((Dh,Dn)=>{function Nn(e="E"){class t extends Event{#t;constructor(n,i){super(n),this.#t=i}get data(){return this.#t}set data(n){this.#t=n}}return t}var An=Nn();function In(e="ET"){class t extends EventTarget{#t=new Map;addEventListener(n,i){super.addEventListener(n,i),this.#t.set(n,i)}ls(){return this.#t}removeEventListener(n){super.removeEventListener(n),this.#t.delete(n)}dispatch(n,i){let l=new An(n,i);return this.dispatchEvent(l),l}}return t}var vc=In();Dn.exports={creat_event_cls:Nn,E:An,creat_event_target_cls:In,ET:vc}});var _i=h((Lh,ui)=>{var Vn=Ut(),Je=Vt(),pe=as(),{ET:On}=Ln(),kc=["_fstch","_lsib","_rsib","_parent","_tree"];function Xn(e){return e._tree!==void 0}function os(e){return e._tree===e}function xc(e){return e._lsib===null}function Sc(e){return e._rsib===null}function Tc(e){return e._fstch===null}function Ec(e){return e.$sibs(!0).length===1}function $t(e){return os(e)||!Xn(e)}function Rn(e){let t=e._fstch,r=t;for(;t!==null;)r=t,t=t._rsib;return r}function Pn(e,t){let r=0,n=t._fstch;for(;;){if(r===e)return n;if(n===null)return n;n=n._rsib,r=r+1}}function jn(e,...t){let r=[],n=0,i=e._fstch;for(;;){if(t.includes(n))r.push(i);else if(i===null)return r;i=i._rsib,n=n+1}}function cs(e){let t=[],r=0,n=e._fstch;for(;;){if(n===null)return t;t.push(n),n=n._rsib,r=r+1}}function Cc(e){let t=0,r=e._fstch;for(;;){if(r===null)return t;r=r._rsib,t=t+1}}function Jn(e,t=!1){let r=e._rsib,n=e;for(;r!==null;)n=r,r=r._rsib;return t||n!==e?n:null}function vt(e,t=!1){let r=us(e);if(r===null)return t?e:null;{let n=r._fstch;return t||n!==e?n:null}}function qc(e){let t=vt(e,!1);if(t===null)return null;{let r=t;for(;;){if(r._rsib===e)return r;r=r._rsib}}}function hs(e){let t=[],n=vt(e,!0);for(;n!==null;){if(n===e)return t;t.push(n),n=n._rsib}}function Kn(e){let t=[],r=e._rsib;for(;r!==null;)t.push(r),r=r._rsib;return t}function Qn(e,t=!1){let r=hs(e),n=Kn(e),i=[e],l;return t?l=r.concat(i,n):l=r.concat(n),l}function Nc(e,t){let r=vt(t,!0),n=0;for(;;){if(r===null)return null;if(n==e)return r;r=r._rsib,n=n+1}}function Ac(e,...t){return Qn(e,!0).filter((i,l)=>t.includes(l))}function Bn(e){return hs(e).length}function Ic(e,t=!1){return e.$sibs(t).length}function us(e){return Jn(e,!0)._parent}function Dc(e){let t=e,r=e;for(;t!==null;)r=t,t=t.$parent();return r}function Lc(e,t){let r=0,n=t;for(;n!==null;){if(r===e)return n;n=n.$parent(),r=r+1}return null}function yt(e,t=!1){let r=[],n=e;for(t&&r.push(n),n=n.$parent();n!==null;)r.push(n),n=n.$parent();return r}function Oc(e,...t){return yt(e,!0).filter((i,l)=>t.includes(l))}function Rc(e,t=!1){return yt(e,t).length}function Pc(e){let t=e.$parent();return t===null?null:t.$lsib()}function jc(e){let t=e.$parent();return t===null?null:t.$rsib()}function Bc(e){let t=e.$luncle();return e.$is_fstch()?t===null?null:t.$lstch():null}function Mc(e){let t=e.$runcle();return e.$is_lstch()?t===null?null:t.$fstch():null}function Fc(e){let r=e.$root().$sdfs(),n=e.$depth();return r.filter(l=>l.$depth()===n)}function Wc(e){let t=e.$parent();return t===null?null:t.$breadth()}function Yc(e){return e.$lyr().indexOf(e)}function Hc(e){let t=e.$sdfs();return t=t.filter(r=>r.$is_leaf()),t.length}function Gc(e){let r=e.$root().$edfs(),n;if(e.$is_leaf())n=r.indexOf(e);else{let i=e.$dlmost_des();n=r.indexOf(i)}return r=r.slice(0,n+1),offset=r.filter(i=>i.$is_leaf()).length-1,offset}function Mn(e,t=!1){let r=ei(e),n=me(e),i=n.indexOf(r);return t?n.slice(0,i+1):n.slice(1,i+1)}function zc(e){let t=e.$deses(!1),r=t.map(i=>i.$depth()),n=Math.max(...r);return t=t.filter(i=>i.$depth()===n),t}function Uc(e,t){let r=t.$depth(),n=t.$deses(!1),i=n.map(l=>l.$depth());return n=n.filter(l=>l.$depth()===r+e),n}function Vc(e,...t){let r=e.$depth(),n=t.map(a=>a+r),i=e.$deses(!1),l=i.map(a=>a.$depth());return i=i.filter(a=>n.includes(a.$depth())),i}function _s(e,t){if(!$t(t))return console.log("only root or uninited could be prepend"),t;let r=e.$is_leaf();if(t._tree=e._tree,t._lsib=null,r)t._rsib=null,t._parent=e;else{let n=e._fstch;n._lsib=void 0,t._rsib=n,t._parent=void 0}return e._fstch=t,t}function fs(e,t){if(!$t(t))return console.log("only root or uninited could be append"),t;let r=e.$is_leaf();if(t._tree=e._tree,t._rsib=null,r)e._fstch=t,t._lsib=null;else{let n=e.$lstch();n._parent=void 0,n._rsib=t,t._lsib=void 0}return t._parent=e,t}function Zn(e,t){if(!$t(t))return console.log("only root or uninited could be add"),t;if(e.$is_root())return console.log("cant addrsib to root"),e;let r=e.$is_lstch();return t._tree=e._tree,r?(t._parent=e._parent,e._parent=void 0,t._rsib=null):(t._rsib=e._rsib,t._parent=void 0),e._rsib=t,t._lsib=void 0,t}function Xc(e,t){if(!$t(t))return console.log("only root or uninited could be add"),t;if(e.$is_root())return console.log("cant addlsib to root"),e;let r=e.$is_fstch();if(t._tree=e._tree,r){let n=e.$parent();e._lsib=void 0,t._lsib=null,n._fstch=t}else{let n=e.$lsib();n._rsib=t,t._lsib=void 0}return t._rsib=e,t._parent=void 0,t}function Fn(e,t,r){let n=cs(t),i=n.length;if(i===0)r=_s(t,r);else if(!(e<=i&&e>=0))console.log("not in range!!");else if(e===0)r=_s(t,r);else if(e===i)r=fs(t,r);else{let a=n[e-1];r=Zn(a,r)}return r}function Jc(e){let t=e.$parent();for(;t!==null;){let r=t.$rsib();if(r!==null)return r;t=t.$parent()}return null}function Kc(e){let t=e.$fstch();if(t!==null)return t;{let r=e.$rsib();return r!==null?r:e.$rsib_of_fst_ance_having_rsib()}}function ei(e){let t=e,r=e.$lstch();for(;r!==null;)t=r,r=r.$lstch();return t}function Qc(e){if(e.$is_root())return null;if(e.$is_leaf()){let r=e.$lsib();return r!==null?r:e.$parent()}else{let r=e.$lsib();return r!==null?r.$is_leaf()?r:r.$drmost_des():e.$parent()}}function me(e){let t=e.$depth();if(e===null)return[];{let r=[e];for(e=e.$sdfs_next();e!==null&&e.$depth()>t;)r.push(e),e=e.$sdfs_next();return r}}function Zc(e){let t=e,r=e.$fstch();for(;r!==null;)t=r,r=r.$fstch();return t}function eu(e){let t=e.$rsib();return t===null?e.$parent():t.$dlmost_des()}function tu(e){let t=e.$parent();for(;t!==null;){let r=t.$lsib();if(r!==null)return r;t=t.$parent()}return null}function su(e){if(e.$is_leaf()){let r=e.$lsib();return r===null?e.$lsib_of_fst_ance_having_lsib():r}else return e.$lstch()}function ru(e){let t=[],r=e.$dlmost_des();for(;r!==null&&(t.push(r),r!==e);)r=r.$edfs_next();return t}function ti(e){let t=e.$visited;if(e.$is_leaf())if(t){let n=e.$rsib();return n===null?e.$parent():n}else return e.$visited=!0,e;else if(t){let n=e.$rsib();return n===null?e.$parent():n}else return e.$visited=!0,e.$fstch()}function nu(e,t){if(t.$is_leaf()){if(e)return t;{let n=t.$lsib();return n===null?t.$parent():n}}else{if(e)return t.$lstch();{let n=t.$lsib();return n===null?t.$parent():n}}}function iu(e){e.$sdfs().forEach(r=>{delete r.$visited})}function lu(e,t){return t.$visited&&e===t}function Wn(e){iu(e);let t=[],r=new Set,n=e;for(;!lu(n,e);)r.has(e)?e.$close_at=t.length:(e.$open_at=t.length,r.add(e)),t.push(e),e=ti(e);return n.$close_at=t.length,t.push(n),t.forEach(i=>{delete i.$visited}),t}function au(e){return e._fstch=null,e}function pt(e){return e._lsib=null,e._rsib=null,e._parent=null,e}function gt(e){let t=e.$sdfs();return t.forEach(r=>{r._tree=t[0]}),t}function ge(e){if(e.$is_root())return e;if(e.$is_lonely()){let r=e.$parent();au(r);let n=gt(e);return pt(e),e}else if(e.$is_fstch()){let r=e.$rsib();r._lsib=null;let n=e.$parent();n._fstch=e._rsib;let i=gt(e);return pt(e),e}else if(e.$is_lstch()){let r=e.$lsib();r._rsib=e._rsib,r._parent=e._parent;let n=gt(e);return pt(e),e}else{let r=e.$lsib();r._rsib=e._rsib;let n=gt(e);return pt(e),e}}function Yn(e){let t={};return t._nd=e,t._children=[],t}function Hn(e){let t=[],r=e[0],n=[Yn(r)];for(n[0]._pbreadth=null;n.length>0;){let i=[];for(let a=0;a<n.length;a++){n[a]._breadth=a,n[a]._depth=t.length;let o=n[a]._nd.$children();o=o.map(c=>Yn(c)),o.forEach((c,u)=>{c._pbreadth=n[a]._breadth,n[a]._children.push([t.length+1,i.length+u])}),i=i.concat(o)}let l=n;t.push(l),n=i}return t}function Gn(e,t="_children"){let r=e._nd,n={};n[t]=[],n.$guid=r.$guid;for(let i in r)Je.is_cu_property(i)&&(n[i]=r[i]);return n}function ou(e,t="_children"){let r=e[0][0],n=Gn(r,t),i=[{d:n,ele:r}];for(;i.length>0;){let l=[];for(let a=0;a<i.length;a++){let o=i[a],c=o.d,u=o.ele,f=o.ele._children.map(m=>e[m[0]][m[1]]);for(let m=0;m<f.length;m++){let y=f[m],E=Gn(y,t);c[t].push(E);let Js={d:E,ele:y};l.push(Js)}}i=l}return n}function zn(e,t="_children"){let r=new V;e.$guid!==void 0&&(r.$guid=e.$guid);for(let n in e)Je.is_cu_property(n)&&t!==n&&(r[n]=e[n]);return r}function cu(e,t="_children"){let r=zn(e,t),n=[{d:e,nd:r}];for(;n.length>0;){let i=[];for(let l=0;l<n.length;l++){let a=n[l].d,o=n[l].nd,c=a[t]===void 0?[]:a[t];for(let u=0;u<c.length;u++){let _=c[u],f=zn(_,t);o.$append_child(f);let m={d:_,nd:f};i.push(m)}}n=i}return r}function uu(e){let t=["_fstch","_lsib","_rsib","_parent","_tree","$guid","_guid","_id","$open_at","$close_at"];e._fstch=void 0,e._lsib=void 0,e._rsib=void 0,e._parent=void 0,e._tree=void 0,e.$guid=void 0,e._guid=void 0,e._id=void 0,e.$open_at=void 0,e.$close_at=void 0;for(let r of t)Object.defineProperty(e,r,{enumerable:!1})}function _u(e,t,r){let n=e.$depth();return" ".repeat(n)+"["+r.indexOf(e)+"] : "+e.$guid}function fu(e,t){let r=e.$depth(),n=" ".repeat(r),i="";return t===e.$open_at&&(i=n+"<"+e._id+" : "+e.$guid+">"),t===e.$close_at&&(i=n+"</"+e._id+" : "+e.$guid+">"),i}var hu=["$fstch","$rsib","$parent"];function du(e){if(e.$fstch()!==null)return["$fstch"];if(e.$rsib()!==null)return["$rsib"];{let n=[],i=e.$parent();for(;i!==null;)if(n.push("$parent"),i.$rsib()!==null){n.push("$rsib");break}else i=i.$parent();return n}}function pu(e){return e.$sdfs().map(n=>n.$sdfs_next_action_for_srch())}var si={$fstch:"$append_child",$rsib:"$add_rsib",$parent:"$parent"};function gu(e,t){for(let r=0;r<t.length;r++){let n=si[t[r]];e=e[n]()}return e}function mu(e){let t=new V,r=t;for(let n=0;n<e.length;n++){let i=e[n];r=gu(r,i)}return t}function bu(e,t,r){if(r&&(t=t.$clone()),!e.$is_root())if(e.$is_lonely()){let n=e.$parent();e.$disconn(),n.$append_child(t)}else if(e.$is_lstch()){let n=e.$lsib();e.$disconn(),n.$add_rsib(t)}else{let n=e.$rsib();e.$disconn(),n.$add_lsib(t)}return t}var L=class{#t=null;#e={with_id:!1,with_et:!1};constructor(t=!1,r=!1){uu(this),this._fstch=null,this.#e.with_id=t,this.#e.with_et=r,t&&(this.$guid=Je.gen_guid()),r&&(this.#t=new On)}get opt(){return this.#e}enable_et(){this.#t=new On}disable_et(){this.#t=null}get et(){return this.#t}regis_recv_from_handler(t){let r=function(n){t(n.data.src,n.data.msg)};this.et.addEventListener("$msg__",r)}send_to(t,r){t.et.dispatch("$msg__",{src:this,msg:r})}$is_inited(){return Xn(this)}$is_root(){return os(this)}$is_fstch(){return xc(this)}$is_lstch(){return Sc(this)}$is_leaf(){return Tc(this)}$is_lonely(){return Ec(this)}$fstch(){return this._fstch}$lstch(){return Rn(this)}$which_child(t){return Pn(t,this)}$some_children(...t){return jn(this,...t)}$children(){return cs(this)}$children_count(){return Cc(this)}$rsib(){return this._rsib}$lsib(){return qc(this)}$fstsib(t=!1){return vt(this,t)}$lstsib(t=!1){return Jn(this,t)}$psibs(){return hs(this)}$fsibs(){return Kn(this)}$which_sib(t){return Nc(t,this)}$some_sibs(...t){return Ac(this,...t)}$sibseq(){return Bn(this)}$sibs(t=!1){return Qn(this,t)}$sibs_count(t=!1){return Ic(this,t)}$parent(){return us(this)}$root(){return Dc(this)}$ances(t=!1){return yt(this,t)}$which_ance(t){return Lc(t,this)}$some_ances(...t){return Oc(this,...t)}$ances_count(t=!1){return Rc(this,t)}$prepend_child(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,_s(this,t)}$insert_child(t,r){return r=r===void 0?new L(this.#e.with_id,this.#e.with_et):r,Fn(t,this,r)}$append_child(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,fs(this,t)}$clone(){if(os(this)){let t=bt(this);return wt(t)}else{let t=Bn(this),r=us(this);ge(this);let n=bt(this),i=wt(n);return Fn(t,r,this),i}}$append_children(t,r){let n=[];for(let i=0;i<t;i++){let l=r===void 0?new L(this.#e.with_id,this.#e.with_et):r.$clone();l=fs(this,l),n.push(l)}return n}$add_rsib(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,Zn(this,t)}$add_lsib(t){return t=t===void 0?new L(this.#e.with_id,this.#e.with_et):t,Xc(this,t)}$rsib_of_fst_ance_having_rsib(){return Jc(this)}$sdfs_next(){return Kc(this)}$drmost_des(){return ei(this)}$sdfs_prev(){return Qc(this)}$sdfs(){return me(this)}$dlmost_des(){return Zc(this)}$edfs_next(){return eu(this)}$lsib_of_fst_ance_having_lsib(){return tu(this)}$edfs_prev(){return su(this)}$edfs(){return ru(this)}$offset(){return Gc(this)}$sedfs_next(){return ti(this)}$sedfs_prev(t){return nu(this)}$sedfs(){return Wn(this)}$deses(t=!1){return Mn(this,t)}$lst_lyr_deses(){return zc(this)}$which_lyr_deses(t){return Uc(t,this)}$some_lyrs_deses(...t){return Vc(this,...t)}$count(t=!0){return Mn(this,t).length}$depth(t=!1){return yt(this,t).length}$height(){let t=this.$depth(),n=this.$sdfs().map(l=>l.$depth());return Math.max(...n)-t+1}$pbreadth(){return Wc(this)}$breadth(){return Yc(this)}$width(){return Hc(this)}$lyr(){return Fc(this)}$lcin(){return Bc(this)}$rcin(){return Mc(this)}$luncle(){return Pc(this)}$runcle(){return jc(this)}$sdfs_repr(t=_u,r=!1){let n=this.$root(),i=me(n),o=me(this).map((c,u)=>t(c,u,i)).join(`
|
|
3
|
+
`);if(console.log(o),r)return o}$sedfs_repr(t=fu,r=!1){let n=this.$root();ri(n);let a=Wn(this).map((o,c)=>t(o,c)).join(`
|
|
4
|
+
`);if(console.log(a),r)return a}$disconn(){return ge(this)}$rm_fstch(){let t=this._fstch;return ge(t)}$rm_lstch(){let t=Rn(this);return ge(t)}$rm_which(t){let r=Pn(t,this);return ge(r)}$rm_some_children(...t){return jn(this,...t).map(n=>ge(n))}$rm_all_children(){return cs(this).map(r=>ge(r))}$dump(){if(this.$is_root())return bt(this);console.log("only root !!!")}$dump2file(t){if(this.$is_root()){let r=bt(this);Vn.wjson(t,r)}else console.log("only root !!!")}$sdfs2mat(){return Hn(me(this))}$nest_dict(t="_children"){let r=Hn(me(this));return ou(r,t)}$index(){return this.$sibseq()}$sdfs_index(){return this.$root().$sdfs().indexOf(this)}$sdfs_leafs(){return this.$root().$sdfs().filter(i=>i.$is_leaf())}$sdfs_nonleafs(){return this.$root().$sdfs().filter(i=>!i.$is_leaf())}$sdfs_leaf_index(){return this.$sdfs_leafs().indexOf(this)}$sdfs_nonleaf_index(){return this.$sdfs_nonleafs().indexOf(this)}$sdfs_next_action_for_srch(){return du(this)}$sdfs_srch_action_list(){return pu(this)}$get_node_with_action(t){let r=this;for(let n=0;n<t.length;n++)r=r[t[n]]();return r}$replace_with(t,r=!0){return bu(this,t,r)}[Symbol.iterator](){return this.$sdfs()[Symbol.iterator]()}get[Symbol.toStringTag](){return this.$guid?this.$guid.substr(0,8):"<empty>"}};Object.defineProperty(L,"name",{value:"\u200D"});function ri(e){let t=me(e);return t.forEach((r,n)=>{r._id=n}),t}function yu(e){let t=new V;return t._id=e._id,t.$guid=e._guid,t}function Un(e,t){for(;t._id!==e;)t=t._parent;return t}function Xe(e,t){let r=ni(t);for(let n of r)e[n]=t[n];return e}function wt(e){let t=Je.dict_keys(e)[0],r=pe.get_root(e[t],e),n=yu(r);n=Xe(n,r);let i=n,l=r,a=pe.get_sdfs_next(l,e),o;for(;a!==null;)if(l._fstch===a._id)o=i.$prepend_child(),o._id=a._id,o.$guid=a._guid,o=Xe(o,a),i=o,l=a,a=pe.get_sdfs_next(l,e);else if(l._rsib===a._id)o=i.$add_rsib(),o._id=a._id,o.$guid=a._guid,o=Xe(o,a),i=o,l=a,a=pe.get_sdfs_next(l,e);else if(a._parent!==null&&a._parent!==void 0){let c=a._parent;i=Un(c,i),o=i.$append_child(),o._id=a._id,o.$guid=a._guid,o=Xe(o,a),i=o,l=a,a=pe.get_sdfs_next(l,e)}else if(a._parent===void 0){let u=pe.get_parent(a,e)._id;i=Un(u,i),o=i.$append_child(),o._id=a._id,o.$guid=a._guid,o=Xe(o,a),i=o,l=a,a=pe.get_sdfs_next(l,e)}else console.log("Impossible",i,l,a);return n}function mt(e,t){return e[t]===null?null:e[t]===void 0?void 0:e[t]._id}function ni(e){return Je.dict_keys(e).filter(n=>!kc.includes(n))}function wu(e,t){let r=ni(e);for(let n of r)t[n]=e[n];return t}function bt(e){let t=ri(e),r=e._id,n={};return t.forEach((i,l)=>{let a={};a._tree=r,a._fstch=mt(i,"_fstch"),a._lsib=mt(i,"_lsib"),a._rsib=mt(i,"_rsib"),a._parent=mt(i,"_parent"),a._id=i._id,a._guid=i.$guid,a=wu(i,a),n[i._id]=a}),n}var V=class extends L{constructor(t=!0,r=!0){super(t,r),this._fstch=null,this._lsib=null,this._rsib=null,this._parent=null,this._tree=this}$is_parent_of(t){return t.$parent()===this}$is_root_of(t){return t.$root()===this}$is_descendant_of(t){return t.$deses(!1).indexOf(this)>=0}$is_inclusive_descendant_of(t){return t.$deses(!0).indexOf(this)>=0}$is_ancestor_of(t){return t.$ances(!1).indexOf(this)>=0}$is_inclusive_ancestor_of(t){return t.$ances(!0).indexOf(this)>=0}$is_sibling_of(t){return t.$sibs(!1).indexOf(this)>=0}$is_inclusive_siblings_of(t){return t.$sibs(!0).indexOf(this)>=0}$is_preceding_of(t){let r=t.$sdfs(),n=r.indexOf(t),i=r.indexof(this);return i>=0&&i<n}$is_following_of(t){let r=t.$sdfs(),n=r.indexOf(t);return r.indexof(this)>n}$is_first_child_of(t){return this===t.$fstch()}$is_child_of(t){return t.$children().indexOf(this)>=0}$is_last_child_of(t){return this===t.$lstch()}$is_previous_sibling_of(t){return this===t.$lsib()}$is_next_sibling_of(t){return this===t.$rsib()}};Object.defineProperty(V,"name",{value:"\u200D"});function ii(e){if(typeof e=="string"){let t=Vn.rjson(e);return wt(t)}else return typeof e=="object"?wt(e):new V}function $u(e,t="_children"){return cu(e,t)}function vu(e){let t=e.$dump();return ii(ndict)}function ds(e,t,...r){let n=t(e,...r);return n=new Buffer.from(n).toString("base64"),n}function li(e){let t=e.$ances(!0).map(r=>r.$children().length);return t=t.join("-"),t}function ai(e){return e.$pbreadth()+"-"+e.$breadth()+"-"+e.$depth()}function oi(e,t,...r){let n=li(e);return t&&(out=ds(e,t,...r),n=n+"@"+out),n}function ci(e,t,...r){let n=ai(e);return t&&(out=ds(e,t,...r),n=n+"@"+out),n}function ps(e,t,r,n,i,...l){let a=r.$sdfs(),o=n.$sdfs();if(a.length!==o.length)return!1;{let c=a.map(_=>t(_,i,...l)),u=o.map(_=>t(_,i,...l));e&&(c.sort(),u.sort());for(let _=0;_<c.length;_++){let f=c[_],m=u[_];if(f!==m)return!1}}return!0}function ku(e,t,r,...n){return ps(!1,ci,e,t,r,...n)}function xu(e,t,r,...n){return ps(!0,oi,e,t,r,...n)}ui.exports={SDFS_NEXT_BUILD_ACTION_DICT:si,build_from_srch_action_list:mu,SDFS_NEXT_SRCH_ACTIONS:hu,RESERVED_EVENT_TYPES:["$msg__"],Node:L,Tree:V,Root:V,load:ii,load_from_nest_dict:$u,clone:vu,get_cu_sign:ds,get_internal_sign_ignore_order:li,get_internal_sign_keep_order:ai,get_sign_keep_order:ci,struct_eq:ps,struct_eq_keep_order:ku,get_sign_ignore_order:oi,struct_eq_ignore_order:xu}});var gs=h((Oh,fi)=>{var Su=_i(),Tu=as(),Eu=Ut();fi.exports={ndfunc:Tu,ndcls:Su,ndutil:Eu}});var St=h((Hh,di)=>{var q=x(),Cu=gs(),{Root:qu}=gs().ndcls,{TYPE_DICT:Rh,isNode:Ph,empty:g,is_bigint_str:jh,is_jsint_str:Bh,NUM_TYPE_DICT:Mh,parse_abnormal_num:Fh,parse_int:Wh,parse_float:Yh,parse_num:Nu,to_str:xt}=x(),O=class extends qu{constructor(t=g){super(!1,!1),this.key=t,this.value=g,this.type=g,this.chtype=g,this.hashes=new Set,this.kcmt=[],this.bvcmt=[],this.avcmt=[]}kto_str(){return this.key===g?g:JSON.stringify(this.key)}is_undefined(){return this.type===q.TYPE_DICT.UndefinedLiteral}is_null(){return this.type===q.TYPE_DICT.NullLiteral}is_boolean(){return this.type>=2&&this.type<=4}is_false(){return this.type===3}is_true(){return this.type===4}is_numerical(){return nd.type>=5&&nd.type<=11}is_int(){return this.type===6}is_float(){return this.type===7}is_bigint(){return this.type===8}is_infi(){return this.type===9||this.type===10}is_pos_infi(){return this.type===9}is_neg_infi(){return this.type===10}is_nan(){return this.type===11}is_str(){return this.type===12}is_ary(){return this.type===13}is_ele(){return this.chtype===14}is_dict(){return this.type===15}is_prop(){return this.chtype===16}is_ref(){return this.type===17}is_leaf(){return!this.is_ary()&&!this.is_dict()}is_cmt(){return this.is_lcmt()||this.is_blcmt()}is_lcmt(){return this.type>=18&&this.type<=22}is_blcmt(){return this.type>=23&&this.type<=27}is_ttcmt(){return this.type===19||this.type===24}is_kcmt(){return this.type===20||this.type===25}is_bvcmt(){return this.type===21||this.type===26}is_avcmt(){return this.type===22||this.type===27}is_prim(){return this.is_leaf()&&!is_cmt()}},ms=class extends O{constructor(t=g){super(t),this.value=void 0,this.type=q.TYPE_DICT.UndefinedLiteral}vto_rawstr(){return xt(this.value)}},bs=class extends O{constructor(t=g){super(t),this.value=null,this.type=q.TYPE_DICT.NullLiteral}vto_rawstr(){return xt(this.value)}},ys=class extends O{constructor(t,r=g){super(r),t==="true"&&(this.value=!0,this.type=q.TYPE_DICT.BooleanLiteral.TrueLiteral),t==="false"&&(this.value=!1,this.type=q.TYPE_DICT.BooleanLiteral.FalseLiteral)}vto_rawstr(){return xt(this.value)}},ws=class extends O{constructor(t,r=g){if(super(r),typeof t=="string"){let n=Nu(t,!0);this.value=n.value,this.type=n.type}else this.value=t.value,this.type=t.type}vto_rawstr(){let t=xt(this.value);return this.type===q.TYPE_DICT.NumericLiteral.Float&&!t.includes(".")&&(t=t+"."),t}};function Ke(e){return e=JSON.stringify(e),e.substr(1,e.length-2)}var $s=class extends O{constructor(t,r=g){super(r),this.value=t,this.type=q.TYPE_DICT.StringLiteral}vto_rawstr(){return Ke(this.value)}};function Au(e){e instanceof kt?e.type=q.TYPE_DICT.CommentLine.tt:e.type=q.TYPE_DICT.CommentBlock.tt}function Iu(e,t){return{lsib:e.$lsib(),data:t}}function hi(e,t){Au(t);let r=Iu(e,t);return e.ttcmt.push(r),r}var vs=class extends O{constructor(t=g){super(t),this.value=[],this.type=q.TYPE_DICT.ArrayExpression._self,this.open=g,this.close=g,this.ttcmt=[]}is_inited(){return this.open===g&&this.close===g}is_opened(){return this.open!==g&&this.close===g}is_closed(){return this.open!==g&&this.close!==g}append_child(t){return t.chtype=q.TYPE_DICT.ArrayExpression.element,t.is_ref()?this.value.push(t.value.value):this.value.push(t.value),this.$append_child(t)}append_ttcmt(t){return hi(this,t)}},ks=class extends O{constructor(t=g){super(t),this.value={},this.type=q.TYPE_DICT.ObjectExpression._self,this.open=g,this.close=g,this.ttcmt=[]}is_inited(){return this.open===g&&this.close===g}is_opened(){return this.open!==g&&this.close===g}is_closed(){return this.open!==g&&this.close!==g}append_child(t){return t.chtype=q.TYPE_DICT.ObjectExpression.property,t.is_ref()?this.value[t.key]=t.value.value:this.value[t.key]=t.value,this.$append_child(t)}append_ttcmt(t){return hi(this,t)}},xs=class extends O{constructor(t,r=g){super(r),this.value=t,this.type=q.TYPE_DICT._Ref}vto_rawstr(){if(this.value.is_leaf())return this.value.vto_rawstr();if(this.value.key!==g)return'&"'+Ke(this.value.key)+'"';for(let t of this.value.hashes)return'&"'+Ke(t)+'"'}},kt=class extends O{constructor(t){super(),this.value=t,this.type=q.TYPE_DICT.CommentLine._self}vto_rawstr(t=`
|
|
5
|
+
`){return"//"+Ke(this.value)+t}},Ss=class extends O{constructor(t){super(),this.value=t,this.type=q.TYPE_DICT.CommentBlock._self}vto_rawstr(){return"/*"+Ke(this.value)+"*/"}};di.exports={UndefinedLiteral:ms,NullLiteral:bs,BooleanLiteral:ys,NumericLiteral:ws,StringLiteral:$s,ArrayExpression:vs,ObjectExpression:ks,_Ref:xs,CommentLine:kt,CommentBlock:Ss,_ndtree:Cu}});var $i=h((Gh,wi)=>{var{empty:Cs}=x(),{UndefinedLiteral:pi,NullLiteral:gi,BooleanLiteral:mi,NumericLiteral:bi,StringLiteral:Ts,ArrayExpression:Du,ObjectExpression:Lu,CommentLine:Ou,CommentBlock:Ru,_Ref:Es}=St();function Pu(e,t){let r=Cs,n=e;for(;n!==null;){if(n.key===t){r=n;break}else if(n.hashes.has(t)){r=n;break}else if(n.$sibseq().toString()===t){r=n;break}n=n.$sdfs_prev()}return r!==null?r:Cs}function yi(e,t){return e instanceof pi?new pi("undefined",t):e instanceof gi?new gi("null",t):e instanceof mi?new mi(e.vto_rawstr(),t):e instanceof bi?new bi(e.vto_rawstr(),t):e instanceof Ts?new Ts(e.value,t):e instanceof Ou||e instanceof Ru?new Ts(e.value,t):e instanceof Du?new Es(e,t):e instanceof Lu?new Es(e,t):e instanceof Es?(e=e.value,yi(e,t)):Cs}wi.exports={find_refnd_with_hash:Pu,clone:yi}});var Di=h((zh,be)=>{var ju=Array,Bu=x(),{empty:$,parse0:Mu}=x(),Ze=class extends ju{get lst(){return this[this.length-1]}set lst(t){this[this.length-1]=t}get top(){return this[this.length-1]}set top(t){this[this.length-1]=t}get fst(){return this[0]}set fst(t){this[0]=t}get bot(){return this[0]}set bot(t){this[0]=t}*gen_from_lst(){for(let t=this.length-1;t>-1;t--)yield this[t]}};function*Fu(e){for(let t of e)yield t;e=null}function*Wu(e,t){yield*t,yield*e}var et=zt(),qs=ve(),Ce=en(),{UndefinedLiteral:Yu,NullLiteral:Hu,BooleanLiteral:vi,NumericLiteral:Gu,StringLiteral:ki,CommentLine:Qe,CommentBlock:zu,ArrayExpression:Ns,ObjectExpression:Uu}=St(),G=I(),xi=G.gtv,ne=G.STATE_DICT,As=G.LEFTED_TYPE,Ee=G.AVND_CACHE_STATE_DICT,H=x(),w=Z(),Si=$i();function*Ai(e){for(;e.length>0;)yield e.pop()}function Ti(e){let t;return e.__is_sync_mode()?t=et.from_generator(e.g,e.ch_cache.curr):t=et.from_generator(Ai(e.unshift_cache),e.ch_cache.curr),t}function Ei(e,t,r){e.lefted.type=As.quote,e.lefted.data={rslt:t.rslt,lefted:t.ch,state:t.state,quote:r},e.state=G.get_main_eofv_with_code(e.state)}function Ii(e,t,r){e.lefted.type=r,e.lefted.data={rslt:t.rslt,lefted:t.ch,state:t.state}}function Vu(e,t,r){return Ii(e,t,r),e.state=G.get_lcmt_eofv_with_code(e.state),e}function Xu(e,t,r){return Ii(e,t,r),e.state=G.get_blkcmt_eofv_with_code(e.state),e}function Ju(e,t){let r;return e.__is_sync_mode()?r=t(e.g,e.ch_cache.curr):r=t(Ai(e.unshift_cache),e.ch_cache.curr),r}function Ci(e,t,r,n){let i=Ju(e,r);return i.state!==Ce.STATE_DICT.succ?((t===Qe?Vu:Xu)(e,i,n),$):new t(i.rslt)}function qi(e,t){let r=new t(e.str_cache.k);return e.$set_avnd_cache(r),e.$mv_key_to_nd(r),e.$mv_kcmt_to_kcmt(),e.$mv_bvcmt_to_bvcmt(),r.open=e.ch_cache.curr,e.stack.lst.append_child(r),e.stack.push(r),t===Ns?e.state=ne.bv:e.state=ne.bk,e}var Is=Symbol("root_lblk_ch"),Ni=Symbol("root_rblk_ch"),qe=class{#t=xi(ne.bv);#e=new Ze;constructor(t,r=" "){if(r!==$){let i=Fu(r);t=Wu(t,i)}this.g=t,this.lefted={type:$,data:$},this.ch_cache={tmp:$,curr:$},this.str_cache={k:$,v:$,maybe_vquote:$},this.cmt_cache={kcmt:[],bvcmt:[],avcmt:[]};let n=new Ns;this.stack.push(n),n.open=Is,this.avnd_cache={state:Ee.handling,data:n},this.unshift_cache=new Ze,this.mode="sync"}__use_sync_mode(){this.mode="sync"}__use_async_mode(){this.mode="async"}__is_sync_mode(){return this.mode==="sync"}__is_async_mode(){return this.mode==="async"}__unshift_g(t){t=t??this.ch_cache.curr;for(let r of t)this.unshift_cache.unshift(r)}$has_yield_sign(){return this.avnd_cache.state===Ee.handled}$set_yield_sign(){this.avnd_cache.state=Ee.handled}$clear_yield_sign(){this.avnd_cache.state=Ee.handling}get state(){return this.#t}set state(t){this.#t=xi(t)}get stack(){return this.#e}$next_ch(){return this.unshift_cache.length>0?this.ch_cache.curr=this.unshift_cache.pop():this.ch_cache.curr=this.g.next().value,this.ch_cache.curr}$is_currch_eof(){return this.ch_cache.curr===void 0}$handle_main_eof(){return this.state=G.get_main_eofv_with_code(this.state),this}$is_currch_comma(){return w.commas.has(this.ch_cache.curr)}$is_currch_colon(){return w.colons.has(this.ch_cache.curr)}$is_currch_ws(){return qs.is_ws(this.ch_cache.curr)}$is_currch_quote(){return w.quotes.has(this.ch_cache.curr)}$is_currch_slash(){return this.ch_cache.curr===w.slash}$is_currch_asterisk(){return this.ch_cache.curr===w.asterisk}$is_currch_ary_lblk(){return w.array_blks.lhas(this.ch_cache.curr)}$is_currch_obj_lblk(){return w.obj_blks.lhas(this.ch_cache.curr)}$is_currch_lblk(){return this.$is_currch_ary_lblk()||this.$is_currch_obj_lblk()}$is_currch_ary_rblk(){return w.array_blks.rhas(this.ch_cache.curr)}$is_currch_obj_rblk(){return w.obj_blks.rhas(this.ch_cache.curr)}$is_currch_rblk(){return this.$is_currch_ary_rblk()||this.$is_currch_obj_rblk()}$is_currch_hash(){return w.hash===this.ch_cache.curr}$is_currch_ref(){return w.ref===this.ch_cache.curr}$mv_avcmt_to_avcmt(){let t=this.avnd_cache.data;t.avcmt=this.cmt_cache.avcmt,this.cmt_cache.avcmt=[]}$change_state_when_end_av(t=$,r=$){return this.stack.lst.is_ary()?t===$?this.state=ne.bv:(this.state=ne.v,this.str_cache.v=t,r===$||(this.str_cache.maybe_vquote=r)):t===$?this.state=ne.bk:(this.state=ne.k,this.str_cache.k=t),this.state}$vcache_to_nd(){let t=this.str_cache.v,r;if(this.str_cache.maybe_vquote===$){let n=Mu(t,{only_value:!1,with_value:!0,with_type:!0,unknown_as_string:!0});n.type===H.TYPE_DICT.UndefinedLiteral?r=new Yu(this.str_cache.k):n.type===H.TYPE_DICT.NullLiteral?r=new Hu(this.str_cache.k):n.type===H.TYPE_DICT.BooleanLiteral.TrueLiteral?r=new vi("true",this.str_cache.k):n.type===H.TYPE_DICT.BooleanLiteral.FalseLiteral?r=new vi("false",this.str_cache.k):n.type===H.TYPE_DICT.StringLiteral?r=new ki(n.value,this.str_cache.k):r=new Gu(n,this.str_cache.k)}else r=new ki(t,this.str_cache.k);return this.str_cache.v=$,this.str_cache.maybe_vquote=$,r}$mv_kcmt_to_kcmt(){let t=this.avnd_cache.data;t.kcmt=this.cmt_cache.kcmt,this.cmt_cache.kcmt=[]}$mv_bvcmt_to_bvcmt(){let t=this.avnd_cache.data;t.bvcmt=this.cmt_cache.bvcmt,this.cmt_cache.bvcmt=[]}$mv_key_to_nd(){let t=this.avnd_cache.data;return t.key=this.str_cache.k,this.str_cache.k=$,t.key}$set_avnd_cache(t,r=Ee.handling){return this.avnd_cache.data=t,this.avnd_cache.state=r,this.avnd_cache}$setup_leafnd(){let t=this.$vcache_to_nd();this.$set_avnd_cache(t,Ee.handling),this.$mv_key_to_nd(),this.$mv_kcmt_to_kcmt(),this.$mv_bvcmt_to_bvcmt(),this.$mv_avcmt_to_avcmt(),this.stack.lst.append_child(t)}$handle_quote(t){let r=Ti(this);return r.state!==et.STATE_DICT.succ?(Ei(this,r,t),$):r.rslt}$abandon_key_when_end_bv(){this.cmt_cache.kcmt=[],this.cmt_cache.bvcmt=[],this.str_cache.k=$}$refresh_key(t=$){t===$?this.str_cache.k=this.ch_cache.curr:this.str_cache.k=t,this.cmt_cache.kcmt=[]}$handle_lcmt(){return Ci(this,Qe,Ce.lc_from_generator,As.lcmt)}$handle_blkcmt(){return Ci(this,zu,Ce.blk_from_generator,As.blkcmt)}$push_kcmt(t){t.type=Ce instanceof Qe?H.TYPE_DICT.CommentLine.k:H.TYPE_DICT.CommentBlock.k,this.cmt_cache.kcmt.push(t)}$push_bvcmt(t){let r=t instanceof Qe?"CommentLine":"CommentBlock";t.type=H.TYPE_DICT[r].bv,this.cmt_cache.bvcmt.push(t)}$push_avcmt(t){t.type=Ce instanceof Qe?H.TYPE_DICT.CommentLine.k:H.TYPE_DICT.CommentBlock.k,this.cmt_cache.avcmt.push(t)}$mv_avcmt_to_ttcmt(t){t=t??this.avnd_cache.data.$parent();for(let r of this.cmt_cache.avcmt)t.$append_child(r);this.cmt_cache.avcmt=[]}$open_nonleaf_nd(){if(w.array_blks.lhas(this.ch_cache.curr))return qi(this,Ns);if(w.obj_blks.lhas(this.ch_cache.curr))return qi(this,Uu)}$is_rblk_match(){let t=this.stack.lst,r=t.is_ary()?"array_blks":"obj_blks";return w[r].getl(this.ch_cache.curr)===t.open}$close_nonleaf_nd(){let t=this.stack.lst;t.close=this.ch_cache.curr,this.$set_avnd_cache(t),this.stack.pop(),this.state=ne.av}$get_hash_or_ref(t="#"){let r=$,n=this.$next_ch(),i="";for(;!qs.is_ws(n)&&!w.commas.has(n)&&!w.colons.has(n)&&!w.array_blks.has(n)&&!w.obj_blks.has(n)&&n!==w.hash&&n!==w.ref&&n!==w.slash;)if(w.quotes.has(n)){let l=Ti(this);if(l.state!==et.STATE_DICT.succ)return Ei(this,l,this.ch_cache.curr),t===w.hash?this.state=G.get_hash_quote_eofv_with_code(this.state):this.state=G.get_ref_quote_eofv_with_code(this.state),r;i=i+l.rslt,n=this.$next_ch()}else{if(n===void 0)return $handle_main_eof(),r;i=i+n,n=this.$next_ch()}return this.__unshift_g(n),r=i,r}$is_hash_of_pnd(){return this.stack.lst.$children().length===0}$find_ref(t){let r=this.stack.lst,n=r.$lstch();return n===null&&(n=r),Si.find_refnd_with_hash(n,t)}$add_ref_to_parent(t){let r=this.stack.lst,n=Si.clone(t,this.str_cache.k);this.$set_avnd_cache(n),this.$mv_key_to_nd(n),this.$mv_kcmt_to_kcmt(),this.$mv_bvcmt_to_bvcmt(),r.append_child(n)}};qe[Is]=Is;qe[Ni]=Ni;qe.MODES=["sync","async"];be.exports=qe;be.exports.Stack=Ze;be.exports._type_util=Bu;be.exports._esc=et;be.exports._cmt=Ce;be.exports._ws=qs});var Pi=h((Uh,Ri)=>{var{empty:Li}=x(),Oi=I(),Ne=Oi.gtv,z=Oi.STATE_DICT;function Ku(e){let t=e.state;return t===Ne(z.bk)||(t===Ne(z.k)||t===Ne(z.ak)?(e.str_cache.k=Li,e.state=z.bk):t===Ne(z.bv)?(e.$abandon_key_when_end_bv(),e.stack.lst.is_ary()?e.state=z.bv:e.state=z.bk):t===Ne(z.v)?(e.$setup_leafnd(),e.$change_state_when_end_av()):t===Ne(z.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av())),e}Ri.exports=Ku});var Mi=h((Xh,Bi)=>{var{empty:Vh}=x(),ji=I(),Ae=ji.gtv,ie=ji.STATE_DICT;function Qu(e){let t=e.state;return t===Ae(ie.bk)||(t===Ae(ie.k)||t===Ae(ie.ak)?e.state=ie.bv:t===Ae(ie.bv)||(t===Ae(ie.v)?(e.$setup_leafnd(),e.$change_state_when_end_av()):t===Ae(ie.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av()))),e}Bi.exports=Qu});var Ds=h((Kh,Wi)=>{var{empty:Jh}=x(),Fi=I(),Ie=Fi.gtv,le=Fi.STATE_DICT;function Zu(e){let t=e.state;return t===Ie(le.bk)||(t===Ie(le.k)?e.state=le.ak:t===Ie(le.ak)||t===Ie(le.bv)||(t===Ie(le.v)?(e.$setup_leafnd(),e.state=le.av):Ie(le.av))),e}Wi.exports=Zu});var zi=h((Qh,Gi)=>{var{empty:Yi}=x(),Hi=I(),De=Hi.gtv,X=Hi.STATE_DICT;function e_(e,t){let r=e.state,n=e.$handle_quote(t);return n===Yi||(r===De(X.bk)?(e.str_cache.k=n,e.state=X.k):r===De(X.k)?e.str_cache.k=e.str_cache.k+n:r===De(X.ak)?(e.$refresh_key(n),e.state=X.k):r===De(X.bv)?(e.str_cache.maybe_vquote=t,e.str_cache.v=n,e.state=X.v):r===De(X.v)?(e.str_cache.v=e.str_cache.v+n,e.str_cache.maybe_vquote=Yi):r===De(X.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(n,t))),e}Gi.exports=e_});var Ji=h((Zh,Xi)=>{var{empty:Ui}=x(),Ls=I(),R=Ls.gtv,T=Ls.STATE_DICT,t_=Ls.LEFTED_TYPE,ye=Z();function Vi(e,t){let r=e.state,n=e[t]();if(n!==Ui){let i=e.stack.lst;if(r===R(T.bk))i.append_ttcmt(n);else if(r===R(T.k))e.$push_kcmt(n),e.state=T.ak;else if(r===R(T.ak))e.$push_kcmt(n);else if(r===R(T.bv))i.is_ary()?i.append_ttcmt(n):i.is_dict()&&e.$push_bvcmt(n);else if(r===R(T.v))e.$setup_leafnd(),e.state=T.av;else if(r===R(T.av)){let l=e.stack.lst;l.is_ary()?(l.append_ttcmt(n),e.state=T.bv):l.is_dict()&&e.$push_avcmt(n)}}return e}function s_(e){return Vi(e,"$handle_lcmt")}function r_(e){return Vi(e,"$handle_blkcmt")}function n_(e){let t=e.state;t===R(T.bk)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.k=ye.slash,e.state=T.k):t===R(T.k)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.k=e.str_cache.k+ye.slash):t===R(T.ak)?(e.__unshift_g(e.ch_cache.curr),e.$refresh_key(ye.slash),e.state=T.k):t===R(T.bv)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.v=ye.slash,e.state=T.v):t===R(T.v)?(e.__unshift_g(e.ch_cache.curr),e.str_cache.v=e.str_cache.v+ye.slash,e.str_cache.maybe_vquote=Ui):t===R(T.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(ye.slash))}function i_(e){let t=e.state,r=e.$next_ch();return e.$is_currch_eof()?(e.lefted.data=ye.slash,e.lefted.type=t_.backslash,e.$handle_main_eof()):e.$is_currch_slash()?s_(e):e.$is_currch_asterisk()?r_(e):n_(e),e}Xi.exports=i_});var Zi=h((td,Qi)=>{var{empty:ed}=x(),Ki=I(),Le=Ki.gtv,ae=Ki.STATE_DICT;function l_(e){let t=e.state;return t===Le(ae.bk)?(e.str_cache.k=e.ch_cache.curr,e.state=ae.k):t===Le(ae.k)?e.str_cache.k=e.str_cache.k+e.ch_cache.curr:t===Le(ae.ak)?(e.$refresh_key(),e.state=ae.k):t===Le(ae.bv)?e.$open_nonleaf_nd():t===Le(ae.v)?(e.$setup_leafnd(),e.$change_state_when_end_av(),e.__unshift_g(e.ch_cache.curr)):t===Le(ae.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(),e.__unshift_g(e.ch_cache.curr)),e}Qi.exports=l_});var rl=h((sd,sl)=>{var{empty:el}=x(),tl=I(),Oe=tl.gtv,we=tl.STATE_DICT,a_=Ds();function o_(e){let t=e.state;return t===Oe(we.bk)?e.$close_nonleaf_nd():t===Oe(we.k)?(e.str_cache.k=el,e.$close_nonleaf_nd()):t===Oe(we.ak)?(e.$refresh_key(),e.str_cache.k=el,e.$close_nonleaf_nd()):t===Oe(we.bv)?(e.$abandon_key_when_end_bv(),e.$close_nonleaf_nd()):t===Oe(we.v)?(e.$setup_leafnd(),e.state=we.av,e.__unshift_g(e.ch_cache.curr)):t===Oe(we.av)&&(e.$has_yield_sign()?(e.$clear_yield_sign(),e.$close_nonleaf_nd()):(e.$mv_avcmt_to_avcmt(),e.$set_yield_sign(),e.__unshift_g(e.ch_cache.curr))),e}function c_(e){return e.$is_rblk_match()?o_(e):a_(e),e}sl.exports=c_});var al=h((rd,ll)=>{var{empty:u_}=x(),il=I(),Re=il.gtv,oe=il.STATE_DICT,__=Z(),{CommentLine:nl}=St();function f_(e){let t=e.state,r=e.$get_hash_or_ref(__.hash);if(r!==u_){let n=e.stack.lst;if(t===Re(oe.bk))e.$is_hash_of_pnd()&&n.hashes.add(r);else if(t===Re(oe.k)){let i=new nl(r);e.$push_kcmt(i),e.state=oe.ak}else if(t===Re(oe.ak)){let i=new nl(r);e.$push_kcmt(i)}else t===Re(oe.bv)?e.$is_hash_of_pnd()&&n.is_ary()&&n.hashes.add(r):t===Re(oe.v)?(e.$setup_leafnd(),e.avnd_cache.data.hashes.add(r),e.state=oe.av):t===Re(oe.av)&&e.avnd_cache.data.hashes.add(r)}return e}ll.exports=f_});var ul=h((id,cl)=>{var{empty:Os}=x(),ol=I(),Pe=ol.gtv,D=ol.STATE_DICT,h_=Z();function d_(e){let t=e.state,r=e.$get_hash_or_ref(h_.ref);if(r!==Os){let n=e.$find_ref(r);if(n!==Os){let i=e.stack.lst;t===Pe(D.bk)||t===Pe(D.k)||t===Pe(D.ak)?(e.$refresh_key(n.vto_rawstr()),e.state=D.ak):t===Pe(D.bv)?(e.$add_ref_to_parent(n),e.state=D.av):t===Pe(D.v)?(e.str_cache.maybe_vquote=Os,e.$setup_leafnd(),e.state=D.av):t===Pe(D.av)&&(e.$has_yield_sign()?(e.$clear_yield_sign(),i.is_ary()?(e.$add_ref_to_parent(n),e.state=D.av):i.is_dict()&&(e.str_cache.k=n.vto_rawstr(),e.state=D.ak)):(e.$mv_avcmt_to_avcmt(),e.$set_yield_sign()))}}return e}cl.exports=d_});var hl=h((ld,fl)=>{var{empty:p_}=x(),_l=I(),je=_l.gtv,J=_l.STATE_DICT;function g_(e){let t=e.state;return t===je(J.bk)?(e.str_cache.k=e.ch_cache.curr,e.state=J.k):t===je(J.k)?e.str_cache.k=e.str_cache.k+e.ch_cache.curr:t===je(J.ak)?(e.$refresh_key(),e.state=J.k):t===je(J.bv)?(e.str_cache.v=e.ch_cache.curr,e.state=J.v):t===je(J.v)?(e.str_cache.v=e.str_cache.v+e.ch_cache.curr,e.str_cache.maybe_vquote=p_):t===je(J.av)&&(e.$mv_avcmt_to_avcmt(),e.$change_state_when_end_av(),e.__unshift_g(e.ch_cache.curr)),e}fl.exports=g_});var bl=h((ad,ml)=>{var{empty:m_}=x(),b_=Di(),y_=Pi(),w_=Mi(),$_=Ds(),v_=zi(),k_=Ji(),x_=Zi(),S_=rl(),T_=al(),E_=ul(),C_=hl(),gl=I(),dl=gl.gtv,pl=gl.STATE_DICT,q_=Z();function*N_(e,t=m_){let r=new b_(e,t);for(;;)if(r.$next_ch(),r.$is_currch_eof()){r.$handle_main_eof(),yield r;break}else r.$is_currch_comma()?(y_(r),yield r):r.$is_currch_colon()?(w_(r),yield r):r.$is_currch_ws()?($_(r),yield r):r.$is_currch_quote()?(v_(r,r.ch_cache.curr),yield r):r.$is_currch_slash()?(k_(r),yield r):r.$is_currch_lblk()?(x_(r),yield r):r.$is_currch_rblk()?(S_(r),yield r):r.$is_currch_hash()?(T_(r),yield r):r.$is_currch_ref()?r.state===dl(pl.av)||r.state===dl(pl.v)?r.__unshift_g(q_.fst_comma+r.ch_cache.curr):(E_(r),yield r):(C_(r),yield r)}ml.exports=N_});var kl=h((od,vl)=>{var{sync_gen_from_str:Rs}=Ar(),{is_should_yield:Ps}=I(),j=Z(),{is_nl:A_,is_ws:yl}=ve(),js=bl(),I_={enable_ref:!1,encoding:"utf8"};function wl(e,t={enable_ref:!1}){let r=js(e),n=r.next().value,i=n.avnd_cache.data.$root(),l=n.state;for(let a of r){let o=a.state;if(Ps(n,l,o)&&!t.enable_ref){let c=n.avnd_cache.data;c.$disconn(),c=null}l=o}return i}function D_(e,t={enable_ref:!1}){let r=Rs(e);return wl(r,t)}function*$l(e,t={enable_ref:!1,encoding:"utf8"}){let r=js(e),n=r.next().value,i=n.state;for(let l of r){let a=l.state;if(Ps(n,i,a)&&!t.enable_ref){let o=n.avnd_cache.data;yield o,o.$disconn(),o=null}i=a}}function*L_(e,t={enable_ref:!1,encoding:"utf8"}){let r=Rs(e);yield*$l(r,t)}function O_(){return{d:void 0,ppg:void 0,prev:void 0,curr:void 0,can_send:!1,data:"",state:"init",label:"",pstate:""}}function R_(e){let t=Rs(""),r=js(t," "),n=r.next().value;n.__use_async_mode();let i=O_();return i.rt=n.avnd_cache.data,i.prev=n.state,i.ppg=r,i.d=n,i}function P_(e,t){return e.data=e.data+t,e.state==="init"?t===j.slash?e.state="slash":j.quotes.has(t)?(e.label=t,e.state="quote"):t===j.hash?e.state="hash":t===j.ref?e.state="ref":e.can_send=!0:e.state==="quote"?t==="\\"?(e.state="esc",e.pstate="quote"):t===e.label&&(e.pstate!==""?(e.state=e.pstate,e.pstate=""):e.can_send=!0):e.state==="slash"?t===j.slash?e.state="lcmt":t===j.asterisk?e.state="blkcmt":j.quotes.has(t)?(e.label=t,e.state="quote"):e.can_send=!0:e.state==="lcmt"?t==="\\"?(e.state="esc",e.pstate="lcmt"):A_(t)&&(e.can_send=!0):e.state==="blkcmt"?t==="\\"?(e.state="esc",e.pstate="blkcmt"):t===j.asterisk&&(e.state="asterisk"):e.state==="asterisk"?t==="\\"?(e.state="esc",e.pstate="blkcmt"):t===j.slash&&(e.can_send=!0):e.state==="hash"?yl(t)?e.can_send=!0:j.quotes.has(t)&&(e.state="quote",e.pstate="hash"):e.state==="ref"?yl(t)?e.can_send=!0:j.quotes.has(t)&&(e.state="quote",e.pstate="ref"):e.state==="esc"?(e.state=e.pstate,e.pstate=""):console.log("impossible"),e}async function*j_(e,t){for(let r of e)P_(t,r),t.can_send&&(yield t,t.data="",t.state="init",t.label="",t.can_send=!1)}async function*B_(e){let t=R_(e);for await(let r of e)yield*j_(r,t);yield t}function M_(e){let t=e.d.unshift_cache;t.forEach(r=>{e.prev=e.curr,e.d=e.ppg.next().value,e.curr=e.d.state}),t=null}async function*F_(e,t){if(e.d.__unshift_g(e.data),e.prev=e.curr,e.d=e.ppg.next().value,e.curr=e.d.state,Ps(e.d,e.prev,e.curr)&&!t.enable_ref){let r=e.d.avnd_cache.data;yield r,r.$disconn(),r=null}}async function*W_(e,t={enable_ref:!1,encoding:"utf8"}){e=B_(e);let r;for await(r of e)M_(r),yield*F_(r,t);yield r.rt}vl.exports={OPT_DICT:I_,parse_from_generator:wl,parse_from_str:D_,gen_from_generator:$l,gen_from_str:L_,agen_from_generator:W_}});var Tt=h((cd,st)=>{var{empty:Y_}=x(),H_=Z(),tt=kl();function Bs(e){return e.length===1?e[0]:e}function G_(){for(let e in tt){let t;e.startsWith("gen_")?t=function*(r,n={enable_ref:!1,encoding:"utf8"}){let i=tt[e](r,n);for(let l of i)l=Bs(l),yield[l.key,l.value]}:e.startsWith("agen_")?t=async function*(r,n={enable_ref:!1,encoding:"utf8"}){let i=tt[e](r,n);for await(let l of i)l=Bs(l),yield[l.key,l.value]}:t=function(r,n={enable_ref:!1,encoding:"utf8"}){let i=tt[e](r,n).value;return Bs(i)},Object.defineProperty(t,"name",{value:e}),st.exports[e]=t}st.exports.OPT_DICT=tt.OPT_DICT}G_();st.exports.CFG=H_;st.exports.empty=Y_});var Be=h((ud,xl)=>{var z_=e=>e.constructor.name==="AsyncFunction",U_=e=>typeof e!="string"||(e=e.trim(),e==="")?!1:!!(e.startsWith("http://")||e.startsWith("https://")||e.startsWith("ws://")||e.startsWith("wss://")||e.startsWith("//")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")||/^(data|blob|file|wasm):/i.test(e)),V_=e=>e.startsWith("http://")||e.startsWith("https://")||e.startsWith("ws://")||e.startsWith("wss://")||/^(data|blob|file|wasm):/i.test(e)?e:e.startsWith("//")||e.startsWith("/")||e.startsWith("./")||e.startsWith("../")?e.startsWith("//")?window.location.protocol+e:e.startsWith("/")?window.location.origin+e:new URL(e,window.location.href).href:e,X_=()=>new Date().toISOString().replace(/[:.]/g,"-"),J_=/^(.*?)=["]?(.*)["]?$/,K_=(e=document.cookie)=>{let t=e.split("; "),r={};for(let n of t){let i=J_.exec(n);r[i[1]]=i[2]}return r};xl.exports={is_async:z_,is_url:U_,fullfill_url:V_,creat_dt_prefix:X_,get_ck:K_}});var rt=h((_d,El)=>{var{is_async:ce}=Be(),Q_=e=>{let t=0;for(;e&&e.parentNode;)e=e.parentNode,t++;return t},Z_=(e,t)=>{if(t>0){let r=1;for(;;){let n=e.parentNode;if(r===t)return n;e=n,++r}}else return e},ef=e=>{for(;e.parentNode;)e=e.parentNode;return e},K=e=>e.firstChild===null||e.firstChild===void 0,Et=(e,t=K)=>{let r=0;for(;!t(e);)e=e.lastChild,++r;return[e,r]},Ct=(e,t=K)=>{let r=0;for(;!t(e);)e=e.firstChild,++r;return[e,r]},Sl=(e,t)=>{if(e.nextSibling)return[e.nextSibling,t];let r=e.parentNode,n=t;for(;r;){if(n-=1,r.nextSibling)return[r.nextSibling,n];r=r.parentNode}return[null,-1]},tf=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=Et(e,r),l=e,a=ce(t),o=0;for(;;){let c=!1;if(a?c=await t(l,o):c=t(l,o),c||l===n)return;if(!r(l))++o,l=l.firstChild;else{let u=Sl(l,o);if(l=u[0],l)o=u[1];else break}}},Tl=(e,t)=>{if(e.prevSibling)return[e.prevSibling,t];let r=e.parentNode,n=t;for(;r;){if(n-=1,r.prevSibling)return[r.prevSibling,n];r=r.parentNode}return[null,-1]},sf=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=Ct(e,r),l=e,a=ce(t),o=0;for(;;){let c=!1;if(a?c=await t(l,o):c=t(l,o),c||l===n)return;if(!r(l))++o,l=l.lastChild;else{let u=Tl(l,o);if(l=u[0],l)o=u[1];else break}}},rf=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=Ct(e,r),l=ce(t);for(;;){let a=!1;if(l?a=await t(n,i):a=t(n,i),a||n===e)return;{let o=n.nextSibling;if(o){let c=Ct(o,r);i+=c[1],n=c[0]}else{let c=n.parentNode;if(c)--i,n=c;else break}}}},nf=async(e,t=(n,i)=>{},r=K)=>{let[n,i]=Et(e,r),l=ce(t);for(;;){let a=!1;if(l?a=await t(n,i):a=t(n,i),a||n===e)return;{let o=n.prevSibling;if(o){let c=Et(o,r);i+=c[1],n=c[0]}else{let c=n.parentNode;if(c)--i,n=c;else break}}}},lf=async(e,t=(i,l)=>{},r=(i,l)=>{},n=K)=>{let i=e,l="open",a={open:[r,ce(r)],clos:[t,ce(t)]},o=0;for(;;){let c=!1,[u,_]=a[l];if(l==="open"){if(_?c=await u(i,o):c=u(i,o),c)return;n(i)?l="clos":(i=i.firstChild,++o)}else{let f,m,y,E=i.nextSibling;if(E?(y="open",f=E,m=o):(y="clos",f=i.parentNode,m=o-1),_?c=await u(i,o):c=u(i,o),c)return;if(i!==e)l=y,i=f,o=m;else break}}},af=async(e,t=(i,l)=>{},r=(i,l)=>{},n=K)=>{let i=e,l="open",a={open:[r,ce(r)],clos:[t,ce(t)]},o=0;for(;;){let c=!1,[u,_]=a[l];if(l==="open"){if(_?c=await u(i,o):c=u(i,o),c)return;n(i)?l="clos":(i=i.lastChild,++o)}else{let f,m,y,E=i.prevSibling;if(E?(y="open",f=E,m=o):(y="clos",f=i.parentNode,m=o-1),_?c=await u(i,o):c=u(i,o),c)return;if(i!==e)l=y,i=f,o=m;else break}}};El.exports={get_depth:Q_,get_ance:Z_,get_rt:ef,is_topo_leaf:K,get_drmost:Et,get_dlmost:Ct,find_rb_of_fst_ance_has_rb:Sl,editonly_sdfs_for_each:tf,find_lb_of_fst_ance_has_lb:Tl,editonly_rsdfs_for_each:sf,editonly_edfs_for_each:rf,editonly_redfs_for_each:nf,visit:lf,rvisit:af}});var ql=h((fd,Cl)=>{var of=new Set(["html","head","body","title","meta","link","base","style","header","footer","nav","main","section","article","aside","h1","h2","h3","h4","h5","h6","address","p","hr","pre","blockquote","ol","ul","li","dl","dt","dd","figure","figcaption","div","a","em","strong","small","s","cite","q","dfn","abbr","ruby","rt","rp","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr","ins","del","img","iframe","embed","object","param","video","audio","source","track","picture","map","area","canvas","svg","table","caption","colgroup","col","thead","tbody","tfoot","tr","th","td","form","label","input","button","select","datalist","optgroup","option","textarea","output","progress","meter","fieldset","legend","details","summary","dialog","script","noscript","template","slot"]),cf=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),uf=new Set(["class","rel","sandbox","allow","headers","aria-describedby","aria-labelledby"]);Cl.exports={TAGS:of,VOID_TAGS:cf,NEED_TO_SP_ATTR_NMS:uf}});var Rl=h((hd,Ol)=>{var{TAGS:_f,VOID_TAGS:Nl,NEED_TO_SP_ATTR_NMS:ff}=ql(),{is_url:Al,fullfill_url:hf}=Be(),{editonly_sdfs_for_each:N,is_topo_leaf:Fs}=rt(),Il=(e,t)=>{let r=[e];for(let n of t){let i=[];for(let l of r){let a=l.children;for(let o=0;o<a.length;o++){let c=a[o];c.tagName.toLowerCase()===n&&i.push(c)}}if(i.length===0)return[];r=i}return r},Dl=(e,t)=>{let r=[],n=t.length;function i(l,a){let o=a;l.nodeType===1&&l.tagName.toLowerCase()===t[a]&&(o=a+1,o===n&&r.push(l));let c=l.children;if(c)for(let u=0;u<c.length;u++)i(c[u],o)}return i(e,0),r},Ms=async(e,t,r=Fs)=>{let n=[];return await N(e,async(i,l)=>{if(i.tagName){if(t.test(i.tagName))n.push(i);else if(i.attributes){for(let a of i.attributes)if(t.test(a.name)){n.push(i);break}}}},r),n},df=async(e,t=Fs)=>{let r=new Set,n=new Set,i=new Set,l=new Set,a=new Set;return await N(e,async(o,c)=>{if(o.nodeType===Node.ELEMENT_NODE){if(r.add(o.tagName.toLowerCase()),o.attributes)for(let u of o.attributes)if(n.add(u.name.toLowerCase()),ff.has(u.name.toLowerCase())){let _=u.value.split(/[ ]+/g);for(let f of _)i.add(f)}else i.add(u.value)}else o.nodeType===Node.TEXT_NODE?l.add(o.nodeValue):o.nodeType===Node.COMMENT_NODE&&a.add(o.nodeValue)},t),{tags:Array.from(r),keys:Array.from(n),vals:Array.from(i),txts:Array.from(l),cmts:Array.from(a)}},Ll=async(e,t,r=Fs)=>{if(typeof t=="string")if(t[0]==="#"){let n=[];return await N(e,async(i,l)=>{if(i.tagName){let a=t.slice(1),o=i.getAttribute("id");a===o&&n.push(i)}},r),n}else if(t[0]==="."){let n=[];return await N(e,async(i,l)=>{if(i.tagName){let a=t.slice(1);i.getAttribute("class").split(/[ ]+/g).map(c=>c.toLowerCase()).includes(a)&&n.push(i)}},r),n}else if(t[0]==="`"){let n=[];return await N(e,async(i,l)=>{if(i.nodeType===Node.TEXT_NODE){let a=t.slice(1);node.nodeValue.includes(a)&&n.push(i)}},r),n}else if(t[0]==="!"){let n=[];return await N(e,async(i,l)=>{if(i.nodeType===Node.ELEMENT_NODE&&typeof i.click=="function"){let a=i.tagName.toLowerCase();["html","head","meta","link","style","script"].includes(a)||a.includes(t.slice(1).toLowerCase())&&n.push(i)}},r),n}else if(t[0]==="@"){let n=[];return await N(e,async(i,l)=>{if(i.tagName&&i.attributes)for(let a of i.attributes){let c=a.value.split(/[ ]+/g),u=t.slice(1);for(let _ of c)if(Al(_)&&_.includes(u)){n.push(i);break}}},r),n}else if(t[0]==="-"){let n={};return await N(e,async(i,l)=>{if(i.tagName&&i.attributes){for(let a of i.attributes)if(a.name.startsWith("data-")){let o=a.name.slice(5);if(o.includes(t.slice(1))){let c=a.value;try{c=JSON.parse(c)}catch{}n[o]?n[o].push(c):n[o]=[c]}}}},r),n}else{if(t[0]==="*")return df(e,r);if(t[0]==="&"){let n=[];return await N(e,async(i,l)=>{if(i.tagName&&i.attributes)for(let a of i.attributes){let c=a.value.split(/[ ]+/g),u=t.slice(1);for(let _ of c)Al(_)&&_.includes(u)&&n.push(hf(_))}},r),n}else if(t.slice(0,2)==="?:"){let n=[];return await N(e,async(i,l)=>{if(i.tagName&&i.attributes){for(let a of i.attributes)if(t.slice(2).toLowerCase()===a.name.toLowerCase()){n.push(i);break}}},r),n}else if(t.slice(0,2)===":?"){let n=[];return await N(e,async(i,l)=>{if(i.tagName&&i.attributes){for(let a of i.attributes)if(a.value.includes(t.slice(2))){n.push(i);break}}},r),n}else if(t.slice(0,3)==="</>"){let n=[];return await N(e,async(i,l)=>{if(i.nodeType===Node.ELEMENT_NODE){let a=node.nodeValue.toLowerCase();if(!Nl.has(a)){let o=t.slice(3);a.includes(o.toLowerCase())&&n.push(i)}}},r),n}else if(t.slice(0,2)==="<>"){let n=[];return await N(e,async(i,l)=>{if(i.nodeType===Node.ELEMENT_NODE){let a=node.nodeValue.toLowerCase();if(Nl.has(a)){let o=t.slice(2);a.includes(o.toLowerCase())&&n.push(i)}}},r),n}else if(t.slice(0,2)==="//"){let n=[];return await N(e,async(i,l)=>{if(i.nodeType===Node.COMMENT_NODE){let a=t.slice(2);node.nodeValue.toLowerCase().includes(a.toLowerCase())&&n.push(i)}},r),n}else if(t[0]==="/"){let n=t.split("/").filter(l=>l!==""),i=Il(document,n);return i.length===0?await Ms(e,new RegExp(t),r):i}else if(t.includes("/")){let n=t.split("/").filter(i=>i!=="");return Dl(document,n)}else{let n=[];return await N(e,async(i,l)=>{(i.tagName?i.tagName.toLowerCase()===t.toLowerCase():!1)&&n.push(i)},r),n}}else{if(t instanceof RegExp)return await Ms(e,t,r);{let n=[];return is_async(t)?await N(e,async(i,l)=>{await t(i,l)&&n.push(i)},r):await N(e,async(i,l)=>{t(i,l)&&n.push(i)},r),n}}},pf=new Proxy(document,{get(e,t,r){return _f.has(t.toLowerCase())||t[0]==="*"||t[0]==="&"||t[0]==="-"||t[0]==="#"||t[0]==="."||t[0]==="?"||t[0]===":"||t[0]==="@"||t[0]==="!"||t[0]==="<"||t.includes("/")?Ll(document,t):Reflect.get(e,t,r)}});Ol.exports={plget:Il,plinget:Dl,filter_on_tag_or_attr_key_with_rgx:Ms,filter:Ll,$:pf}});var qt=h((dd,Pl)=>{var gf=Tt(),mf=(e,t=!1)=>{let r=e.split("-");for(let n=1;n<r.length;++n)r[n]=r[n].charAt(0).toUpperCase()+r[n].slice(1);return t&&(r[0]=r[0].charAt(0).toUpperCase()+r[0].slice(1)),r.join("")},bf=e=>e.replace(/-/g,"_"),yf=(e,t)=>typeof e=="string"?(e=e.trim().toLowerCase(),e==="false"||e==="0"||e==="no"||e==="off"||e==="fls"||e==="f"||e==="null"||e==="nul"||e==="none"||e==="nu"||e==="n"?!1:e==="true"||e==="1"||e==="yes"||e==="on"||e==="tru"||e==="t"||e==="y"?!0:e===""||e==="undefined"||e==="un"||e==="default"||e==="dflt"?!!t:!!e):e===void 0?!!t:!!e,wf=e=>{let t=e.replace(/[^0-9.-]/g,"");return parseFloat(t)},$f=e=>gf.parse_from_str(e+" ");Pl.exports={dash_to_camel:mf,dash_to_snake:bf,attr_value_to_bool:yf,css_str_to_num:wf,parse_json_input:$f}});var Wl=h((pd,Fl)=>{var jl=()=>new Promise(e=>{requestAnimationFrame(()=>{e()})}),vf=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(e)})}),kf=async e=>{for(let t=0;t<e;++t)await jl()},xf=async(e=0)=>new Promise(t=>{setTimeout(()=>{t()},e)}),Nt=class{timers={};run(t,r,n=300){this.timers[t]&&clearTimeout(this.timers[t]),this.timers[t]=setTimeout(async()=>{await r(),delete this.timers[t]},n)}cancel(t){this.timers[t]&&(clearTimeout(this.timers[t]),delete this.timers[t])}},Bl=()=>new Nt,Ml=Bl(),Sf=(e,t,r=300)=>{Ml.run(e,t,r)},Tf=e=>{Ml.cancel(e)};Fl.exports={wait_for_layout_ready:jl,wait_for_paint_ready:vf,wait_for_n_raf:kf,wait:xf,SimpleDebounce:Nt,creat_simple_debounce:Bl,simple_debounce:Sf,cancel_simple_debounce:Tf}});var Gl=h((gd,Hl)=>{var{dash_to_camel:At}=qt(),Yl=(e,t,r=!1)=>{let n=At(t,r)+"Element";e.constructor.prototype.hasOwnProperty(n)||Object.defineProperty(e.constructor.prototype,n,{get:function(){let i=this.shadowRoot;return i?i.querySelector(`.${t}`):null}})},Ef=(e,t)=>{for(let r of t)Yl(e,r,!1)},Cf=e=>{for(let t in DYN_CLSES){{let n="all"+At(t,!0)+"Elements";e.constructor.prototype.hasOwnProperty(n)||Object.defineProperty(e.constructor.prototype,n,{get:function(){let i=this.shadowRoot;return i?i.querySelectorAll(`.${t}`):null}})}let r=DYN_CLSES[t];for(let n of r){let i=At(n,!0),l="get"+At(t,!0)+"ElementBy"+i;e.constructor.prototype.hasOwnProperty(l)||(e.constructor.prototype[l]=function(a){let o=this.shadowRoot;return o?o.querySelector(`.${t}[${n}="${a}"]`):null})}}};Hl.exports={add_one_fixed_element_getter:Yl,add_fixed_element_getters:Ef,add_dyn_element_getters:Cf}});var Ul=h((md,zl)=>{var qf=Tt(),{dash_to_snake:Nf,css_str_to_num:Af}=qt(),If=(e,t)=>{let r=Object.keys(t);for(let n of ATTRS_KEYS){let i=Nf(n),l=t[n],a=l.type;e.prototype.hasOwnProperty(i)||(a==="boolean"?Object.defineProperty(e.prototype,i,{get:function(){return attr_value_to_bool(this.getAttribute(n),l.default)},set:function(o){this.setAttribute(n,o?"true":"false")}}):a==="number"?Object.defineProperty(e.prototype,i,{get:function(){let o=this.getAttribute(n);return o?Number(o):l.default},set:function(o){this.setAttribute(n,String(o))}}):Array.isArray(a)&&a.includes("cssnum")&&a.includes("number")?Object.defineProperty(e.prototype,i,{get:function(){return Af(this.getAttribute(n))},set:function(o){isNaN(Number(o))?this.setAttribute(n,o):this.setAttribute(n,String(o)+"px")}}):a==="json"?Object.defineProperty(e.prototype,i,{get:function(){let o=this.getAttribute(n);return o?qf.parse_from_str(o):l.default},set:function(o){this.setAttribute(n,JSON.stringify(o))}}):Object.defineProperty(e.prototype,i,{get:function(){return this.getAttribute(n)||l.default},set:function(o){this.setAttribute(n,o)}}))}};zl.exports={add_attr_accessors_to_cls:If}});var Xl=h((bd,Vl)=>{var Ws=class{css=`
|
|
6
6
|
position: fixed;
|
|
7
7
|
top: 0;
|
|
8
8
|
left: 0;
|
|
@@ -12,19 +12,23 @@ var nvbasicbw=(()=>{var f=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports
|
|
|
12
12
|
border: none;
|
|
13
13
|
margin: 0;
|
|
14
14
|
padding: 0;
|
|
15
|
-
`;is_ok(t,r,n){return t.style[r]=`${n}px`,t.getBoundingClientRect()[r]===n}find_upbound(t,r){let n=1;for(;this.is_ok(t,r,n);)n*=2;return n}mx(t,r){t.style.cssText=this.css,document.body.appendChild(t);let n=this.find_upbound(t,r),i=Math.floor(n/2);for(;i+1<n;){let l=Math.floor((i+n)/2);this.is_ok(t,r,l)?i=l:n=l}return document.body.removeChild(t),i}},
|
|
15
|
+
`;is_ok(t,r,n){return t.style[r]=`${n}px`,t.getBoundingClientRect()[r]===n}find_upbound(t,r){let n=1;for(;this.is_ok(t,r,n);)n*=2;return n}mx(t,r){t.style.cssText=this.css,document.body.appendChild(t);let n=this.find_upbound(t,r),i=Math.floor(n/2);for(;i+1<n;){let l=Math.floor((i+n)/2);this.is_ok(t,r,l)?i=l:n=l}return document.body.removeChild(t),i}},nt=()=>{let e=document.createElement("div"),t=new Ws,r=t.mx(e,"width"),n=t.mx(e,"height");return[r,n]},Df=(e,t)=>{let[r,n]=nt(),i=document.createElement(e);return i.style.width=`${r}px`,i.style.height=`${t}px`,i},Lf=(e,t)=>{let[r,n]=nt(),i=document.createElement(e);return i.style.width=`${t}px`,i.style.height=`${n}px`,i},Of=e=>{let[t,r]=nt(),n=document.createElement(e);return n.style.width=`${t}px`,n.style.height=`${r}px`,n},Rf=(e,t="height")=>{let[r,n]=nt();return Math.floor(r/e)},Ys=class{css=`
|
|
16
|
+
position: absolute;
|
|
17
|
+
visibility: hidden;
|
|
18
|
+
display: none;
|
|
19
|
+
`;is_ok(t,r){t.style.zIndex=r;let n=window.getComputedStyle(t).zIndex;return String(n)===String(r)}find_upbound(t){let r=1;for(;this.is_ok(t,r);)r*=2;return r}mx(t){t.style.cssText=this.css,document.body.appendChild(t);let r=this.find_upbound(t),n=Math.floor(r/2);for(;n+1<r;){let i=Math.floor((n+r)/2);this.is_ok(t,i)?n=i:r=i}return document.body.removeChild(t),n}},Pf=()=>{let e=document.createElement("div");return new Ys().mx(e)},jf=()=>{let e=document.createElement("div"),t=document.createElement("span");t.style.fontSize="1px",t.innerText="A",e.appendChild(t),document.body.appendChild(e);let r=parseFloat(window.getComputedStyle(t).fontSize);return document.body.removeChild(e),r};Vl.exports={find_mx_wh:nt,creat_mxw_ele:Df,creat_mxh_ele:Lf,creat_mxwh_ele:Of,calc_mx_cnt:Rf,find_mx_zindex:Pf,find_min_font:jf}});var Us=h((yd,Zl)=>{var{fullfill_url:Jl}=Be(),{editonly_sdfs_for_each:Kl}=rt(),Bf=async()=>{let e=document.querySelectorAll("script"),t=[];for(let i of e)if(i.src)t.push(fetch(i.src).then(l=>l.ok?l.text():"").catch(()=>""));else{let l=i.textContent;l.trim()&&t.push(Promise.resolve(l))}return`<script>
|
|
16
20
|
${(await Promise.all(t)).filter(i=>i).join(`
|
|
17
21
|
|
|
18
22
|
`)}
|
|
19
|
-
<\/script>`},
|
|
23
|
+
<\/script>`},Mf=async()=>{let e="";for(let t of document.querySelectorAll('link[rel="stylesheet"]'))if(t.href)try{e+=await(await fetch(t.href)).text()+`
|
|
20
24
|
`}catch{}for(let t of document.querySelectorAll("style"))e+=t.outerHtml+`
|
|
21
|
-
`;return e},
|
|
25
|
+
`;return e},Ff=(e=document,t=r=>!0)=>{let r=new Set;return e.querySelectorAll("img[src]").forEach(n=>{t(n)&&r.add(Jl(n.getAttribute("src")))}),e.querySelectorAll("img[srcset]").forEach(n=>{if(t(n)){let i=n.getAttribute("srcset");if(!i)return;for(let l of i.split(",")){let[a]=l.trim().split(/\s+/);a&&r.add(Jl(a))}}}),e.querySelectorAll("svg").forEach(n=>{if(t(n)){let i=new XMLSerializer().serializeToString(n),l=new Blob([i],{type:"image/svg+xml"}),a=URL.createObjectURL(l);r.add([a,".svg"])}}),e.querySelectorAll("*").forEach(n=>{if(t(n)){let i=getComputedStyle(n).backgroundImage;if(!i||i==="none")return;let l=i.match(/url\(["']?(.*?)["']?\)/);l&&l[1]&&r.add(l[1])}}),Array.from(r).filter(Boolean)},Hs=(e,t)=>{if(e instanceof CSSStyleRule){let r=e.style;for(let n=0;n<r.length;n++){let i=r[n];if(i.startsWith("--")){let l=r.getPropertyValue(i).trim();l&&(t[i]=l)}}}else if(e instanceof CSSMediaRule||e instanceof CSSSupportsRule||e instanceof CSSKeyframesRule){let r=e.cssRules||e.rules;if(r)for(let n=0;n<r.length;n++)Hs(r[n],t)}else if(e instanceof CSSFontFaceRule){let r=e.style;for(let n=0;n<r.length;n++){let i=r[n];if(i.startsWith("--")){let l=r.getPropertyValue(i).trim();l&&(t[i]=l)}}}},Wf=()=>{let e={},t=document.styleSheets;for(let r=0;r<t.length;r++){let n=t[r],i="";n.href?i=n.href:n.ownerNode?n.ownerNode.tagName==="STYLE"?i="inline-style":n.ownerNode.tagName==="LINK"?i=n.ownerNode.href||"external-stylesheet":i="unknown":i="unknown",e[i]||(e[i]={});try{let l=n.cssRules||n.rules;if(!l)continue;for(let a=0;a<l.length;a++){let o=l[a];Hs(o,e[i])}}catch(l){console.warn(`\u65E0\u6CD5\u8BBF\u95EE\u6837\u5F0F\u8868 ${i} \u7684\u89C4\u5219:`,l)}}return e},Gs=(e,t)=>{if(e instanceof CSSStyleRule){let r=e.style;for(let n=0;n<r.length;n++){let i=r[n];i.startsWith("--")&&t.add(i)}}else if(e.cssRules||e.rules){let r=e.cssRules||e.rules;for(let n=0;n<r.length;n++)Gs(r[n],t)}else if(e.style){let r=e.style;for(let n=0;n<r.length;n++){let i=r[n];i.startsWith("--")&&t.add(i)}}},It=()=>{let e=new Set,t=document.styleSheets;for(let r=0;r<t.length;r++)try{let n=t[r],i=n.cssRules||n.rules;if(!i)continue;for(let l=0;l<i.length;l++)Gs(i[l],e)}catch{}return Array.from(e)},zs=(e,t)=>{if(!t||!e)return null;let r=e.startsWith("--")?e:`--${e}`,n=window.getComputedStyle(t).getPropertyValue(r).trim();if(n==="")return null;let i=t;for(;i;){let l=i.parentElement;if(!l&&i.parentNode instanceof ShadowRoot&&(l=i.parentNode.host),!l||window.getComputedStyle(l).getPropertyValue(r).trim()!==n)return i;i=l}return i},Yf=(e,t)=>{if(!t||!e)return!1;let r=e.startsWith("--")?e:`--${e}`,n=window.getComputedStyle(t).getPropertyValue(r).trim();if(n==="")return!1;let i=t.parentElement;if(!i&&t.parentNode instanceof ShadowRoot&&(i=t.parentNode.host),!i)return!0;let l=window.getComputedStyle(i).getPropertyValue(r).trim();return n!==l},Hf=async(e=document.documentElement)=>{let t=It(),r={};t.forEach(i=>r[i]=[]);let n=new Map;return await Kl(e,i=>{let l=window.getComputedStyle(i),a=i.parentElement;!a&&i.parentNode instanceof ShadowRoot&&(a=i.parentNode.host);let o=a?n.get(a):null,c=new Map;for(let u of t){let _=l.getPropertyValue(u).trim();_&&(c.set(u,_),(!o||o.get(u)!==_)&&r[u].push(i))}n.set(i,c)}),r},Gf=async(e=document.documentElement)=>{let t=It(),r=new Map,n=new Map;return await Kl(e,i=>{let l=window.getComputedStyle(i),a=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null),o=a?n.get(a):null,c=new Map,u=[];for(let _ of t){let f=l.getPropertyValue(_).trim();f&&(c.set(_,f),(!o||o.get(_)!==f)&&u.push(_))}u.length>0&&r.set(i,u),n.set(i,c)}),r},zf=(e,t)=>{if(!e)return!1;let r=e.startsWith("--")?e:`--${e}`;return t?zs(r,t)!==null:It().includes(r)},Uf=(e,t,r=document.documentElement)=>{let n=e.startsWith("--")?e:`--${e}`;r.style.setProperty(n,String(t))},Ql=e=>{let t=e.startsWith("--")?e:`--${e}`;for(let r of document.styleSheets)try{let n=r.cssRules||r.rules;if(!n)continue;for(let i=0;i<n.length;i++){let l=n[i];if(window.CSSPropertyRule&&l instanceof CSSPropertyRule&&l.name===t)return{name:l.name,syntax:l.syntax,inherits:l.inherits,initialValue:l.initialValue}}}catch{}return null},Vf=(e,t)=>{let r=Ql(e);return r&&r.inherits===!1?zs(e,t)!==t:!1},Xf=(e,{syntax:t="*",inherits:r=!0,initialValue:n}={})=>{let i=e.startsWith("--")?e:`--${e}`;if(!window.CSS||!window.CSS.registerProperty)return console.warn("\u5F53\u524D\u6D4F\u89C8\u5668\u4E0D\u652F\u6301 CSS.registerProperty"),!1;try{let l={name:i,syntax:t,inherits:r};return n!==void 0?l.initialValue=String(n):t!=="*"&&console.warn(`\u8B66\u544A: \u5F53 syntax \u4E3A "${t}" \u65F6\uFF0C\u5EFA\u8BAE\u63D0\u4F9B initialValue\u3002`),window.CSS.registerProperty(l),!0}catch(l){return console.error(`CSS \u53D8\u91CF "${i}" \u6CE8\u518C\u5931\u8D25:`,l.message),!1}};Zl.exports={get_all_scripts:Bf,get_all_csses:Mf,collect_img_like_urls:Ff,extract_css_varnms_from_rule:Hs,get_all_css_vars:Wf,extract_css_varnms_from_rule_to_set:Gs,get_all_uniq_css_varnms:It,find_css_var_scope_ele:zs,is_css_var_defined_on_self:Yf,get_css_var_scope_ele_mp:Hf,get_scope_ele_css_var_mp:Gf,is_css_var_defined:zf,def_css_var:Uf,get_css_prop_var:Ql,is_css_var_isolated:Vf,def_css_prop_var:Xf}});var Xs=h((wd,na)=>{var ea={success:"#38a169",error:"#e53e3e",warning:"#d69e2e",loading:"#3182ce",info:"#667eea"},Jf=e=>`
|
|
22
26
|
position: fixed;
|
|
23
27
|
top: 50%;
|
|
24
28
|
left: 50%;
|
|
25
29
|
width: 300px;
|
|
26
30
|
height:80px;
|
|
27
|
-
background: ${
|
|
31
|
+
background: ${ea[e]||ea.info};
|
|
28
32
|
color: white;
|
|
29
33
|
padding: 12px 20px;
|
|
30
34
|
border-radius: 8px;
|
|
@@ -36,4 +40,4 @@ ${(await Promise.all(t)).filter(i=>i).join(`
|
|
|
36
40
|
align-items: center;
|
|
37
41
|
justify-content: center;
|
|
38
42
|
font-size: 16px; /* \u5B57\u4F53\u53D8\u5927 */
|
|
39
|
-
`,
|
|
43
|
+
`,Kf=(e,t)=>{let r=document.createElement("div");return r.style.cssText=Jf(e),r.textContent=t,document.body.appendChild(r),r},Dt=class{tasks={};del(t){let r=this.tasks[t];if(!r)return;let{init_timer:n,duration_timer:i,ele:l}=r;clearTimeout(n),clearTimeout(i),l&&document.body.contains(l)&&document.body.removeChild(l),delete this.tasks[t]}add(t,r,n="error",i=1e3,l=100){this.del(t);let a={};this.tasks[t]=a,a.init_timer=setTimeout(()=>{a.ele=Kf(n,r),a.duration_timer=setTimeout(()=>{this.del(t)},i)},l)}},ta=()=>new Dt,sa=ta(),Qf=(e,t,r="error",n=1e3,i=100)=>{sa.add(e,t,r,n,i)},Zf=e=>{sa.del(e)},eh=async(e,t=async(n,i)=>{console.log(n)},r=99999)=>{let n=`${Date.now()}_${Math.floor(Math.random()*1e4)}`,i=`confirm-overlay-${n}`,l=`confirm-dialog-${n}`,a=document.createElement("div");a.className=i,Object.assign(a.style,{position:"fixed",top:"0",left:"0",width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:String(r)});let o=document.createElement("div");o.className=l,Object.assign(o.style,{backgroundColor:"white",borderRadius:"8px",padding:"20px",width:"300px",boxShadow:"0 5px 15px rgba(0, 0, 0, 0.3)",fontFamily:"Arial, sans-serif"});let c=document.createElement("h3");c.textContent=e,c.style.margin="0 0 20px 0",c.style.color="#333",c.style.fontSize="18px";let u=document.createElement("div");u.style.display="flex",u.style.justifyContent="flex-end",u.style.gap="10px";let _=document.createElement("button");_.textContent="\u53D6\u6D88",Object.assign(_.style,{padding:"8px 16px",backgroundColor:"#f5f5f5",border:"1px solid #ddd",borderRadius:"4px",cursor:"pointer",fontSize:"14px"});let f=document.createElement("button");f.textContent="\u786E\u8BA4",Object.assign(f.style,{padding:"8px 16px",backgroundColor:"#3498db",color:"white",border:"none",borderRadius:"4px",cursor:"pointer",fontSize:"14px"});let m=async y=>{try{await t(y,o)}catch(E){console.error("Dialog callback error:",E)}finally{o.remove(),a.remove()}};return _.addEventListener("click",()=>m(!1)),f.addEventListener("click",()=>m(!0)),a.addEventListener("click",y=>{y.target===a&&m(!1)}),u.appendChild(_),u.appendChild(f),o.appendChild(c),o.appendChild(u),a.appendChild(o),document.body.appendChild(a),o},ra=async e=>{let t=document.createElement("div");Object.assign(t.style,{position:"fixed",inset:"0",backgroundColor:"rgba(0,0,0,0.85)",display:"flex",justifyContent:"center",alignItems:"center",zIndex:"100000",backdropFilter:"blur(4px)",overflow:"hidden"});let r=await e,n=r instanceof HTMLElement?r:new Image;typeof r=="string"&&(n.src=r),Object.assign(n.style,{maxWidth:"90%",maxHeight:"90%",objectFit:"contain",border:"1px solid #555",boxShadow:"0 8px 30px rgba(0,0,0,0.5)",backgroundColor:"#fff"});let i=document.createElement("div");Object.assign(i.style,{position:"fixed",top:"30px",right:"30px",display:"flex",height:"40px",background:"#222",borderRadius:"20px",boxShadow:"0 4px 15px rgba(0,0,0,0.8)",zIndex:"100001",overflow:"hidden",border:"1px solid #444"});let l=document.createElement("div");l.innerHTML="\u283F",Object.assign(l.style,{padding:"0 15px",cursor:"move",backgroundColor:"#333",height:"100%",display:"flex",alignItems:"center",color:"#888"});let a=document.createElement("div");a.innerText="\u4FDD\u5B58\u622A\u56FE",Object.assign(a.style,{padding:"0 15px",cursor:"pointer",height:"100%",display:"flex",alignItems:"center",fontSize:"13px",fontWeight:"bold",backgroundColor:"#2f54eb",color:"#fff",borderRight:"1px solid #444"}),a.onclick=async()=>{let _=await window.showSaveFilePicker({suggestedName:`screenshot_${new Date().getTime()}.png`,types:[{description:"PNG Image",accept:{"image/png":[".png"]}}]}),m=await(await fetch(n.src)).blob(),y=await _.createWritable();await y.write(m),await y.close()};let o=document.createElement("div");o.innerText="\u5173\u95ED",Object.assign(o.style,{padding:"0 15px",cursor:"pointer",height:"100%",display:"flex",alignItems:"center",fontSize:"13px",fontWeight:"bold",backgroundColor:"#ff4d4f",color:"#fff"}),o.onclick=()=>{t.remove(),i.remove(),window.onmousemove=null,window.onmouseup=null};let c=!1,u={x:0,y:0};l.onmousedown=_=>{c=!0,u.x=_.clientX-i.offsetLeft,u.y=_.clientY-i.offsetTop},window.onmousemove=_=>{c&&(i.style.left=_.clientX-u.x+"px",i.style.top=_.clientY-u.y+"px",i.style.right="auto")},window.onmouseup=()=>c=!1,i.append(l,a,o),t.appendChild(n),document.body.append(t,i)},Vs=async(e,t)=>{if(t==="b64")return e.toDataURL("image/png");let r=await new Promise(n=>e.toBlob(n,"image/png"));switch(t){case"url":return URL.createObjectURL(r);case"u8a":return new Uint8Array(await r.arrayBuffer());case"ab":return await r.arrayBuffer();case"img":return new Promise((n,i)=>{let l=new Image,a=URL.createObjectURL(r);l.onload=()=>{URL.revokeObjectURL(a),n(l)},l.onerror=i,l.src=a,l.crossOrigin="anonymous"});default:return r}},th=async(e,t=void 0)=>{if(!e||!(e instanceof HTMLElement)){console.error("\u65E0\u6548\u7684\u5143\u7D20\u5BF9\u8C61");return}let r=e.style.outline,n=e.style.transition;try{e.style.transition="outline 0.2s ease",e.style.outline="4px solid #2f54eb",e.style.outlineOffset="2px",e.scrollIntoView({block:"center",behavior:"instant"});let i=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},preferCurrentTab:!0}),l=document.createElement("video");l.srcObject=i,await l.play();let a=l.videoWidth/window.innerWidth,o=l.videoHeight/window.innerHeight,c=e.getBoundingClientRect(),u=document.createElement("canvas");if(u.width=c.width*a,u.height=c.height*o,u.getContext("2d").drawImage(l,c.left*a,c.top*o,c.width*a,c.height*o,0,0,u.width,u.height),i.getTracks().forEach(f=>f.stop()),e.style.outline=r,e.style.transition=n,t===void 0){let f=await Vs(u,"img");ra(f);return}return await Vs(u,t)}catch(i){e.style.outline=r,e.style.transition=n,i.name==="NotAllowedError"?console.warn("\u7528\u6237\u53D6\u6D88\u4E86\u5C4F\u5E55\u5171\u4EAB\u6388\u6743\u6216\u6743\u9650\u88AB\u62D2\u7EDD"):i.name==="NotFoundError"?console.error("\u672A\u627E\u5230\u53EF\u7528\u7684\u5A92\u4F53\u6D41\u6E90"):console.error("\u622A\u56FE\u53D1\u751F\u610F\u5916\u9519\u8BEF:",i)}};na.exports={SimpleAlert:Dt,creat_simple_alert:ta,simple_alert:Qf,cancel_simple_alert:Zf,simple_confirm_cancel:eh,show_img_modal:ra,convert_canvas:Vs,ele2img:th}});var ca=h(($d,oa)=>{var{creat_dt_prefix:ia}=Be(),{simple_alert:sh}=Xs(),{collect_img_like_urls:rh}=Us(),{visit:nh}=rt(),la=async(e,t,r)=>{if(!r)try{r=await window.showDirectoryPicker()}catch(n){return[!1,String(n.stack)]}try{let i=await(await r.getFileHandle(t,{create:!0})).createWritable();return await i.write(e),await i.close(),[!0,null]}catch(n){return[!1,String(n.stack)]}},aa=async(e,t,r,n)=>{if(r)Array.isArray(e)&&(e=e[0]);else if(Array.isArray(e))r=ia()+"_inline"+e[1],e=e[0];else{let l=new URL(e).pathname.split("/");r=ia()+"_"+l[l.length-1]}if(!t)try{dir=await window.showDirectoryPicker()}catch(i){n&&n.fails.push([e,String(i.stack)])}try{let l=await(await fetch(e)).blob(),[a,o]=await la(l,r,t);n&&(a?n.succs.push(e):n.fails.push([e,String(o)]))}catch(i){n&&n.fails.push([e,String(i.stack)])}},ih=async(e=t=>!0)=>{let t=[],r=[],n=await window.showDirectoryPicker(),i=rh(document,e),l=Array.from(new Set(i));for(let a of l)await aa(a,n,void 0,{succs:t,fails:r});return sh("dnld_img_like",JSON.stringify({succs:t,fails:r},null,2),"success"),{succs:t,fails:r}},lh=async(e=document.body,t=100,r=100,n=i=>!0)=>{try{let i=await window.showDirectoryPicker(),l=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},preferCurrentTab:!0}),a=document.createElement("video");a.srcObject=l,await a.play();let o=a.videoWidth/window.innerWidth,c=a.videoHeight/window.innerHeight,u=[];await nh(e,(_,f)=>{_.nodeType===1&&_.offsetWidth>=t&&_.offsetHeight>=r&&n(_)&&u.push({el:_,depth:f})},(_,f)=>{}),console.log(`[Scanner] \u5F00\u59CB\u81EA\u52A8\u4FDD\u5B58 ${u.length} \u5F20\u56FE\u7247\u5230\u76EE\u5F55...`);for(let _=0;_<u.length;_++){let{el:f,depth:m}=u[_];f.scrollIntoView({block:"center",behavior:"instant"}),await new Promise(Lt=>setTimeout(Lt,100));let y=f.getBoundingClientRect(),E=document.createElement("canvas");E.width=y.width*o,E.height=y.height*c,E.getContext("2d").drawImage(a,y.left*o,y.top*c,y.width*o,y.height*c,0,0,E.width,E.height);let Ks=`dep${m}_${f.tagName.toLowerCase()}_${_}.png`,_a=await new Promise(Lt=>E.toBlob(Lt,"image/png")),Qs=await(await i.getFileHandle(Ks,{create:!0})).createWritable();await Qs.write(_a),await Qs.close(),console.log(`\u5DF2\u81EA\u52A8\u5199\u5165: ${Ks}`)}l.getTracks().forEach(_=>_.stop()),console.log("\u6279\u91CF\u4FDD\u5B58\u4EFB\u52A1\u5B8C\u6210\uFF01")}catch(i){if(i.name==="AbortError")return;console.error("\u6279\u91CF\u4FDD\u5B58\u5931\u8D25:",i)}};oa.exports={save_blob:la,fetch_save:aa,dnld_img_like:ih,take_photo_for_all_eles:lh}});var yh=h((vd,ua)=>{var ah=Tt(),oh=Be(),ch=rt(),uh=Rl(),_h=qt(),fh=Wl(),hh=Gl(),dh=Ul(),ph=Xl(),gh=Us(),mh=Xs(),bh=ca();ua.exports={_ison:ah,_util:oh,_nd:ch,_ele:uh,_attr:_h,_wait:fh,_ele_getter:hh,_cls_accessor:dh,_limit:ph,_code:gh,_ui:mh,_dnld:bh}});return yh();})();
|
package/README/calc.d.ts
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* calc.js - UI 几何布局计算与层叠上下文分析工具库
|
|
3
|
+
*/
|
|
4
|
+
declare module "calc" {
|
|
5
|
+
/** 矩形区域描述对象 */
|
|
6
|
+
export interface RectDesc {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
top: number;
|
|
12
|
+
right: number;
|
|
13
|
+
bottom: number;
|
|
14
|
+
left: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** 带有元素引用的位置结果 */
|
|
18
|
+
export interface ElementRectResult {
|
|
19
|
+
el: HTMLElement;
|
|
20
|
+
rect: RectDesc;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** 层叠上下文节点信息 */
|
|
24
|
+
export interface StackingContextNode {
|
|
25
|
+
el: HTMLElement;
|
|
26
|
+
z: number;
|
|
27
|
+
index: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** 创建一个初始化的矩形描述对象 (全 0) */
|
|
31
|
+
export function creat_rect_desc(): RectDesc;
|
|
32
|
+
|
|
33
|
+
/** * 获取元素在移除 transform 后的原始布局位置
|
|
34
|
+
* 会临时操作 DOM style 并触发重排
|
|
35
|
+
*/
|
|
36
|
+
export function get_rect_desc_bfr_transfrom(el: HTMLElement): Promise<RectDesc>;
|
|
37
|
+
|
|
38
|
+
/** * 遍历子树,获取所有匹配元素在 transform 之前的原始位置
|
|
39
|
+
*/
|
|
40
|
+
export function get_all_positions_bfr_transform(
|
|
41
|
+
el: HTMLElement,
|
|
42
|
+
filter?: (el: HTMLElement) => boolean
|
|
43
|
+
): Promise<ElementRectResult[]>;
|
|
44
|
+
|
|
45
|
+
/** * 遍历子树,获取所有匹配元素在 transform 之后的最终渲染位置
|
|
46
|
+
*/
|
|
47
|
+
export function get_all_positions_aft_transform(
|
|
48
|
+
el: HTMLElement,
|
|
49
|
+
filter?: (el: HTMLElement) => boolean
|
|
50
|
+
): Promise<ElementRectResult[]>;
|
|
51
|
+
|
|
52
|
+
/** * 计算并返回 transform 前后产生位移或形变的元素及其差异值
|
|
53
|
+
*/
|
|
54
|
+
export function get_all_positions_transform_diff(
|
|
55
|
+
el: HTMLElement,
|
|
56
|
+
filter?: (el: HTMLElement) => boolean
|
|
57
|
+
): Promise<ElementRectResult[]>;
|
|
58
|
+
|
|
59
|
+
/** * 判断两个矩形区域在二维平面上是否重叠
|
|
60
|
+
*/
|
|
61
|
+
export function is_rect_overlapping(rect1: RectDesc, rect2: RectDesc): boolean;
|
|
62
|
+
|
|
63
|
+
/** * 检查目标元素是否与给定元素列表中的任何一个发生重叠
|
|
64
|
+
*/
|
|
65
|
+
export function is_ele_overlapping_with_eles(checkEle: HTMLElement, eleList: HTMLElement[]): boolean;
|
|
66
|
+
|
|
67
|
+
/** * 获取元素在当前层叠上下文中的权重信息 (z-index 数值与 DOM 索引)
|
|
68
|
+
*/
|
|
69
|
+
export function get_z_stacking_info(el: HTMLElement): { zValue: number; domIndex: number };
|
|
70
|
+
|
|
71
|
+
/** * 溯源获取元素向上直到根节点的层叠上下文链条
|
|
72
|
+
*/
|
|
73
|
+
export function get_z_stacking_context_chain(el: HTMLElement): StackingContextNode[];
|
|
74
|
+
|
|
75
|
+
/** * 物理层面上比较两个元素在 Z 轴上的高低
|
|
76
|
+
* @returns 1: el0 在上, -1: el1 在上, 0: 相同
|
|
77
|
+
*/
|
|
78
|
+
export function compare_z_physically(el0: HTMLElement, el1: HTMLElement): number;
|
|
79
|
+
|
|
80
|
+
/** * 判断 el0 是否在 el1 的下方
|
|
81
|
+
* @param phisically 是否考虑层叠上下文的真实物理覆盖关系。默认 true。
|
|
82
|
+
*/
|
|
83
|
+
export function is_below_at_z(el0: HTMLElement, el1: HTMLElement, phisically?: boolean): boolean;
|
|
84
|
+
|
|
85
|
+
/** * 判断 el0 是否与 el1 在同一层叠层级
|
|
86
|
+
*/
|
|
87
|
+
export function is_same_at_z(el0: HTMLElement, el1: HTMLElement, phisically?: boolean): boolean;
|
|
88
|
+
|
|
89
|
+
/** * 判断 el0 是否在 el1 的上方
|
|
90
|
+
*/
|
|
91
|
+
export function is_upper_at_z(el0: HTMLElement, el1: HTMLElement, phisically?: boolean): boolean;
|
|
92
|
+
/** * 深度穿透探测指定坐标下的所有元素(含 Shadow DOM 内部元素)
|
|
93
|
+
*/
|
|
94
|
+
export function get_deep_elements_from_point(x:Number, y:Number): Array<HTMLElement>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
package/README/code.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* code.js - 资源采集与 CSS 变量深度探测工具库
|
|
3
|
+
*/
|
|
4
|
+
declare module "code" {
|
|
5
|
+
/**
|
|
6
|
+
* 获取页面中所有的脚本代码(包括外链 fetch 的内容和内联内容)
|
|
7
|
+
* 返回包裹在 <script> 标签中的合并字符串
|
|
8
|
+
*/
|
|
9
|
+
export function get_all_scripts(): Promise<string>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 获取页面中所有的 CSS 内容(包括外链 link 和内联 style 标签)
|
|
13
|
+
*/
|
|
14
|
+
export function get_all_csses(): Promise<string>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 从指定根节点搜集所有类似图片的资源 URL
|
|
18
|
+
* 涵盖 img[src], img[srcset], svg 转换出的 Blob URL, 以及 CSS 背景图
|
|
19
|
+
* @param root 起始节点,默认为 document
|
|
20
|
+
* @param fltr 过滤器,返回 false 的元素将被跳过
|
|
21
|
+
*/
|
|
22
|
+
export function collect_img_like_urls(
|
|
23
|
+
root?: Document | HTMLElement,
|
|
24
|
+
fltr?: (el: HTMLElement | SVGElement) => boolean
|
|
25
|
+
): string[];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 从单个 CSSRule 中递归提取 CSS 自定义属性(变量)
|
|
29
|
+
* @param rule 样式规则
|
|
30
|
+
* @param target 存储结果的对象
|
|
31
|
+
*/
|
|
32
|
+
export function extract_css_varnms_from_rule(rule: CSSRule, target: Record<string, string>): void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 获取页面中所有 CSS 自定义属性(变量)及其声明值
|
|
36
|
+
* 返回格式: { [样式表来源]: { [变量名]: 变量值 } }
|
|
37
|
+
*/
|
|
38
|
+
export function get_all_css_vars(): Record<string, Record<string, string>>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 从样式规则中提取变量名并存入 Set
|
|
42
|
+
*/
|
|
43
|
+
export function extract_css_varnms_from_rule_to_set(rule: CSSRule, name_set: Set<string>): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 获取页面所有样式表中定义的唯一 CSS 变量名数组
|
|
47
|
+
*/
|
|
48
|
+
export function get_all_uniq_css_varnms(): string[];
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 寻找定义或重定义指定 CSS 变量的最近源头节点(支持 Shadow DOM)
|
|
52
|
+
* @param varnm 变量名
|
|
53
|
+
* @param target_el 探测起始元素
|
|
54
|
+
*/
|
|
55
|
+
export function find_css_var_scope_ele(varnm: string, target_el: HTMLElement): HTMLElement | null;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* 检查变量是否是在指定元素自身上显式定义或覆盖的(而非纯继承)
|
|
59
|
+
*/
|
|
60
|
+
export function is_css_var_defined_on_self(varnm: string, target_el: HTMLElement): boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 获取变量名到其所有定义源元素的映射
|
|
64
|
+
* 返回: { "--varnm": [el, el...] }
|
|
65
|
+
*/
|
|
66
|
+
export function get_css_var_scope_ele_mp(rt?: HTMLElement): Promise<Record<string, HTMLElement[]>>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* 获取元素到其上定义的变量名列表的映射
|
|
70
|
+
* 返回: Map { el => ["--a", "--b"] }
|
|
71
|
+
*/
|
|
72
|
+
export function get_scope_ele_css_var_mp(rt?: HTMLElement): Promise<Map<HTMLElement, string[]>>;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 检查变量是否定义。
|
|
76
|
+
* 如果带 target_el 则查继承链;否则全局查样式表。
|
|
77
|
+
*/
|
|
78
|
+
export function is_css_var_defined(varnm: string, target_el?: HTMLElement): boolean;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 在指定元素上定义 CSS 变量值
|
|
82
|
+
*/
|
|
83
|
+
export function def_css_var(name: string, val: string | number, el?: HTMLElement): void;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* 获取 @property 注册的元数据(类型语法、继承性、初始值)
|
|
87
|
+
*/
|
|
88
|
+
export function get_css_prop_var(varnm: string): {
|
|
89
|
+
name: string;
|
|
90
|
+
syntax: string;
|
|
91
|
+
inherits: boolean;
|
|
92
|
+
initialValue?: string;
|
|
93
|
+
} | null;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* 探测变量是否因为 @property 规则(inherits: false)而处于隔离状态
|
|
97
|
+
*/
|
|
98
|
+
export function is_css_var_isolated(varnm: string, target_el: HTMLElement): boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 运行时注册 CSS 变量规则(JS 版 @property)
|
|
102
|
+
* @param name 变量名
|
|
103
|
+
* @param options 配置项
|
|
104
|
+
*/
|
|
105
|
+
export function def_css_prop_var(
|
|
106
|
+
name: string,
|
|
107
|
+
options: {
|
|
108
|
+
syntax?: string;
|
|
109
|
+
inherits?: boolean;
|
|
110
|
+
initialValue?: string;
|
|
111
|
+
}
|
|
112
|
+
): boolean;
|
|
113
|
+
}
|
package/calc.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {wait_for_layout_ready}
|
|
1
|
+
const {wait_for_layout_ready} = require("./wait");
|
|
2
2
|
|
|
3
3
|
const creat_rect_desc = () => ({
|
|
4
4
|
"x": 0,
|
|
@@ -132,6 +132,129 @@ const is_ele_overlapping_with_eles = (checkEle, eleList) => {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* 获取元素在层叠上下文中的“真实层叠权重”
|
|
137
|
+
* 返回 [zIndex(数值), DOM索引(数值)]
|
|
138
|
+
*/
|
|
139
|
+
const get_z_stacking_info = (el) => {
|
|
140
|
+
const style = window.getComputedStyle(el);
|
|
141
|
+
const zIndex = style.zIndex;
|
|
142
|
+
// 如果 z-index 是 auto,在层叠上下文计算中视为 0
|
|
143
|
+
// 但 auto 和 0 在某些情况下有细微区别,这里统一转为数字处理
|
|
144
|
+
const zValue = zIndex === 'auto' ? 0 : parseInt(zIndex, 10);
|
|
145
|
+
// 获取它在父元素中的位置索引,用于 z-index 相同时的“后来居上”原则
|
|
146
|
+
const domIndex = Array.from(el.parentNode?.children || []).indexOf(el);
|
|
147
|
+
return { zValue, domIndex };
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* 寻找元素向上直到根节点的“层叠上下文链”
|
|
152
|
+
*/
|
|
153
|
+
const get_z_stacking_context_chain = (el) => {
|
|
154
|
+
const chain = [];
|
|
155
|
+
let curr = el;
|
|
156
|
+
while (curr && curr !== document.documentElement) {
|
|
157
|
+
const style = window.getComputedStyle(curr);
|
|
158
|
+
// 只有创建了层叠上下文的元素才具有“统治力”
|
|
159
|
+
// 简单的判定:zIndex 不是 auto 且 position 不是 static,或者有 opacity, transform 等
|
|
160
|
+
const isStacking = style.zIndex !== 'auto' ||
|
|
161
|
+
style.opacity < 1 ||
|
|
162
|
+
style.transform !== 'none' ||
|
|
163
|
+
style.flex !== 'none'; // 简化版判定
|
|
164
|
+
if (isStacking || curr === el) {
|
|
165
|
+
chain.unshift({
|
|
166
|
+
el: curr,
|
|
167
|
+
z: style.zIndex === 'auto' ? 0 : parseInt(style.zIndex, 10),
|
|
168
|
+
index: Array.from(curr.parentNode?.children || []).indexOf(curr)
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
curr = curr.parentElement;
|
|
172
|
+
}
|
|
173
|
+
return chain;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
//取实时值,,不要取配置值
|
|
177
|
+
/**
|
|
178
|
+
* 比较两个元素在 Z 轴上的高低
|
|
179
|
+
* @returns {number} 1: el0 在上, -1: el1 在上, 0: 相同
|
|
180
|
+
*/
|
|
181
|
+
const compare_z_physically = (el0, el1) => {
|
|
182
|
+
if (el0 === el1) return 0;
|
|
183
|
+
const chain0 = get_z_stacking_context_chain(el0);
|
|
184
|
+
const chain1 = get_z_stacking_context_chain(el1);
|
|
185
|
+
// 找到两个链条开始分叉的地方
|
|
186
|
+
let i = 0;
|
|
187
|
+
while (i < chain0.length && i < chain1.length && chain0[i].el === chain1[i].el) {
|
|
188
|
+
i++;
|
|
189
|
+
}
|
|
190
|
+
// 如果在一个链条内(一个是另一个的祖先)
|
|
191
|
+
if (i === chain0.length) return -1; // el0 是 el1 的祖先,通常在下
|
|
192
|
+
if (i === chain1.length) return 1; // el1 是 el0 的祖先,通常在上
|
|
193
|
+
// 在分叉点对比两者的层叠属性
|
|
194
|
+
const node0 = chain0[i];
|
|
195
|
+
const node1 = chain1[i];
|
|
196
|
+
if (node0.z !== node1.z) {
|
|
197
|
+
return node0.z > node1.z ? 1 : -1;
|
|
198
|
+
}
|
|
199
|
+
// z-index 相同,靠后的胜出
|
|
200
|
+
return node0.index > node1.index ? 1 : -1;
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
const is_below_at_z = (el0, el1, phisically = true) => {
|
|
204
|
+
if (phisically) return compare_z_physically(el0, el1) === -1;
|
|
205
|
+
const s0 = get_z_stacking_info(el0);
|
|
206
|
+
const s1 = get_z_stacking_info(el1);
|
|
207
|
+
return s0.zValue < s1.zValue || (s0.zValue === s1.zValue && s0.domIndex < s1.domIndex);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const is_same_at_z = (el0, el1, phisically = true) => {
|
|
211
|
+
if (phisically) return compare_z_physically(el0, el1) === 0;
|
|
212
|
+
const s0 = get_z_stacking_info(el0);
|
|
213
|
+
const s1 = get_z_stacking_info(el1);
|
|
214
|
+
return s0.zValue === s1.zValue && s0.domIndex === s1.domIndex;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const is_upper_at_z = (el0, el1, phisically = true) => {
|
|
218
|
+
if (phisically) return compare_z_physically(el0, el1) === 1;
|
|
219
|
+
const s0 = get_z_stacking_info(el0);
|
|
220
|
+
const s1 = get_z_stacking_info(el1);
|
|
221
|
+
return s0.zValue > s1.zValue || (s0.zValue === s1.zValue && s0.domIndex > s1.domIndex);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* 深度穿透探测指定坐标下的所有元素(含 Shadow DOM 内部元素)
|
|
226
|
+
* @param {number} x - ClientX
|
|
227
|
+
* @param {number} y - ClientY
|
|
228
|
+
* @returns {Element[]} 按从上到下顺序排列的元素数组
|
|
229
|
+
*/
|
|
230
|
+
const get_deep_elements_from_point = (x, y) => {
|
|
231
|
+
const elements = new Set(); // 使用 Set 去重
|
|
232
|
+
|
|
233
|
+
const get_deep_at = (root) => {
|
|
234
|
+
// 1. 获取当前根节点下该坐标的所有元素
|
|
235
|
+
const targets = root.elementsFromPoint ?
|
|
236
|
+
root.elementsFromPoint(x, y) :
|
|
237
|
+
[];
|
|
238
|
+
|
|
239
|
+
for (const el of targets) {
|
|
240
|
+
// 如果已经处理过(避免死循环),跳过
|
|
241
|
+
if (elements.has(el)) continue;
|
|
242
|
+
elements.add(el);
|
|
243
|
+
|
|
244
|
+
// 2. 核心:如果该元素拥有 ShadowRoot,递归进去
|
|
245
|
+
if (el.shadowRoot) {
|
|
246
|
+
get_deep_at(el.shadowRoot);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
get_deep_at(document);
|
|
252
|
+
|
|
253
|
+
// 转换为数组,并按照它们在 DOM 树中的视觉层级(从上到下)排序
|
|
254
|
+
// elementsFromPoint 默认就是从上到下的,递归合并后大部分情况下顺序是正确的
|
|
255
|
+
return Array.from(elements);
|
|
256
|
+
};
|
|
257
|
+
|
|
135
258
|
module.exports = {
|
|
136
259
|
creat_rect_desc,
|
|
137
260
|
get_rect_desc_bfr_transfrom,
|
|
@@ -140,5 +263,9 @@ module.exports = {
|
|
|
140
263
|
get_all_positions_transform_diff,
|
|
141
264
|
is_rect_overlapping,
|
|
142
265
|
is_ele_overlapping_with_eles,
|
|
143
|
-
|
|
266
|
+
get_z_stacking_info,
|
|
267
|
+
get_z_stacking_context_chain,
|
|
268
|
+
compare_z_physically,
|
|
269
|
+
is_below_at_z,is_same_at_z,is_upper_at_z,
|
|
270
|
+
get_deep_elements_from_point
|
|
144
271
|
}
|
package/code.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const {fullfill_url} = require("./util");
|
|
2
|
+
const {editonly_sdfs_for_each} = require("./nd");
|
|
2
3
|
|
|
3
4
|
const get_all_scripts = async()=>{
|
|
4
5
|
const scripts = document.querySelectorAll('script');
|
|
@@ -182,10 +183,327 @@ const get_all_css_vars =()=>{
|
|
|
182
183
|
return result;
|
|
183
184
|
}
|
|
184
185
|
|
|
186
|
+
const extract_css_varnms_from_rule_to_set = (rule, name_set) => {
|
|
187
|
+
// 1. 处理普通样式规则
|
|
188
|
+
if (rule instanceof CSSStyleRule) {
|
|
189
|
+
const style = rule.style;
|
|
190
|
+
for (let i = 0; i < style.length; i++) {
|
|
191
|
+
const property = style[i];
|
|
192
|
+
if (property.startsWith('--')) {
|
|
193
|
+
name_set.add(property);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// 2. 处理嵌套规则 (@media, @supports, @keyframes)
|
|
198
|
+
else if (rule.cssRules || rule.rules) {
|
|
199
|
+
const nestedRules = rule.cssRules || rule.rules;
|
|
200
|
+
for (let i = 0; i < nestedRules.length; i++) {
|
|
201
|
+
extract_css_varnms_from_rule_to_set(nestedRules[i], name_set);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// 3. 处理 @font-face 等带有 style 的规则
|
|
205
|
+
else if (rule.style) {
|
|
206
|
+
const style = rule.style;
|
|
207
|
+
for (let i = 0; i < style.length; i++) {
|
|
208
|
+
const property = style[i];
|
|
209
|
+
if (property.startsWith('--')) {
|
|
210
|
+
name_set.add(property);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* 获取页面所有样式表中定义的唯一 CSS 变量名数组
|
|
218
|
+
*/
|
|
219
|
+
const get_all_uniq_css_varnms = () => {
|
|
220
|
+
const name_set = new Set();
|
|
221
|
+
const styleSheets = document.styleSheets;
|
|
222
|
+
|
|
223
|
+
for (let i = 0; i < styleSheets.length; i++) {
|
|
224
|
+
try {
|
|
225
|
+
const sheet = styleSheets[i];
|
|
226
|
+
const rules = sheet.cssRules || sheet.rules;
|
|
227
|
+
if (!rules) continue;
|
|
228
|
+
|
|
229
|
+
for (let j = 0; j < rules.length; j++) {
|
|
230
|
+
extract_css_varnms_from_rule_to_set(rules[j], name_set);
|
|
231
|
+
}
|
|
232
|
+
} catch (error) {
|
|
233
|
+
// 跨域样式表安全限制,静默跳过
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return Array.from(name_set);
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const find_css_var_scope_ele = (varnm,target_el) => {
|
|
240
|
+
if (!target_el || !varnm) return null;
|
|
241
|
+
const name = varnm.startsWith("--") ? varnm : `--${varnm}`;
|
|
242
|
+
let current_val = window.getComputedStyle(target_el).getPropertyValue(name).trim();
|
|
243
|
+
// 如果当前位置就读不到,说明整条链都没有
|
|
244
|
+
if (current_val === "") return null;
|
|
245
|
+
let curr = target_el;
|
|
246
|
+
while (curr) {
|
|
247
|
+
// 1. 获取父节点 (兼容 Shadow DOM)
|
|
248
|
+
let parent = curr.parentElement;
|
|
249
|
+
if (!parent && curr.parentNode instanceof ShadowRoot) {
|
|
250
|
+
parent = curr.parentNode.host;
|
|
251
|
+
}
|
|
252
|
+
// 2. 边界情况:如果没有父节点了(到达 <html>),那源头必然是当前节点
|
|
253
|
+
if (!parent) return curr;
|
|
254
|
+
// 3. 获取父节点的值进行对比
|
|
255
|
+
let parent_val = window.getComputedStyle(parent).getPropertyValue(name).trim();
|
|
256
|
+
// 4. 关键判断:
|
|
257
|
+
// 如果父节点的值和我不一样,说明变量是在“我这一层”被改变或初始化的。
|
|
258
|
+
if (parent_val !== current_val) {
|
|
259
|
+
return curr;
|
|
260
|
+
}
|
|
261
|
+
// 5. 如果一样,说明我是继承自父级的,继续向上溯源
|
|
262
|
+
curr = parent;
|
|
263
|
+
// 这里的 current_val 理论上不需要更新,因为 parent_val 是一样的
|
|
264
|
+
}
|
|
265
|
+
return curr;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const is_css_var_defined_on_self = (varnm,target_el) => {
|
|
269
|
+
if (!target_el || !varnm) return false;
|
|
270
|
+
const name = varnm.startsWith("--") ? varnm : `--${varnm}`;
|
|
271
|
+
// 获取当前值
|
|
272
|
+
let current_val = window.getComputedStyle(target_el).getPropertyValue(name).trim();
|
|
273
|
+
if (current_val === "") return false;
|
|
274
|
+
// 获取父节点
|
|
275
|
+
let parent = target_el.parentElement;
|
|
276
|
+
if (!parent && target_el.parentNode instanceof ShadowRoot) {
|
|
277
|
+
parent = target_el.parentNode.host;
|
|
278
|
+
}
|
|
279
|
+
// 如果没有父节点(自身就是 :root),且有值,那肯定是在自己身上定义的
|
|
280
|
+
if (!parent) return true;
|
|
281
|
+
// 获取父节点的值
|
|
282
|
+
let parent_val = window.getComputedStyle(parent).getPropertyValue(name).trim();
|
|
283
|
+
// 核心判断:如果我的值和父节点不一样,说明是我自己定义/覆盖的
|
|
284
|
+
return current_val !== parent_val;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* 返回变量到定义源元素的映射
|
|
289
|
+
* --varnm => [el, el...]
|
|
290
|
+
*/
|
|
291
|
+
const get_css_var_scope_ele_mp = async (rt = document.documentElement) => {
|
|
292
|
+
const all_varnms = get_all_uniq_css_varnms();
|
|
293
|
+
const res_obj = {};
|
|
294
|
+
all_varnms.forEach(name => res_obj[name] = []);
|
|
295
|
+
|
|
296
|
+
// 缓存树结构中各节点的计算值
|
|
297
|
+
const node_values_cache = new Map();
|
|
298
|
+
|
|
299
|
+
await editonly_sdfs_for_each(rt, (curr) => {
|
|
300
|
+
const style = window.getComputedStyle(curr);
|
|
301
|
+
|
|
302
|
+
// 查找逻辑父级(支持穿透 Shadow DOM)
|
|
303
|
+
let parent = curr.parentElement;
|
|
304
|
+
if (!parent && curr.parentNode instanceof ShadowRoot) {
|
|
305
|
+
parent = curr.parentNode.host;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const parent_cache = parent ? node_values_cache.get(parent) : null;
|
|
309
|
+
const current_vals = new Map();
|
|
310
|
+
|
|
311
|
+
for (const name of all_varnms) {
|
|
312
|
+
const val = style.getPropertyValue(name).trim();
|
|
313
|
+
if (!val) continue;
|
|
314
|
+
|
|
315
|
+
current_vals.set(name, val);
|
|
316
|
+
|
|
317
|
+
// 溯源逻辑:如果父级没有该值,或者值发生了变化,说明 curr 是定义源
|
|
318
|
+
if (!parent_cache || parent_cache.get(name) !== val) {
|
|
319
|
+
res_obj[name].push(curr);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
node_values_cache.set(curr, current_vals);
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
return res_obj;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* 返回元素到其上定义的变量名的映射
|
|
332
|
+
* el => [--a, --b...]
|
|
333
|
+
*/
|
|
334
|
+
const get_scope_ele_css_var_mp = async (rt = document.documentElement) => {
|
|
335
|
+
const all_varnms = get_all_uniq_css_varnms();
|
|
336
|
+
const ele_to_vars = new Map();
|
|
337
|
+
const node_values_cache = new Map();
|
|
338
|
+
|
|
339
|
+
await editonly_sdfs_for_each(rt, (curr) => {
|
|
340
|
+
const style = window.getComputedStyle(curr);
|
|
341
|
+
let parent = curr.parentElement || (curr.parentNode instanceof ShadowRoot ? curr.parentNode.host : null);
|
|
342
|
+
|
|
343
|
+
const parent_cache = parent ? node_values_cache.get(parent) : null;
|
|
344
|
+
const current_vals = new Map();
|
|
345
|
+
const defined_on_self = [];
|
|
346
|
+
|
|
347
|
+
for (const name of all_varnms) {
|
|
348
|
+
const val = style.getPropertyValue(name).trim();
|
|
349
|
+
if (!val) continue;
|
|
350
|
+
|
|
351
|
+
current_vals.set(name, val);
|
|
352
|
+
|
|
353
|
+
if (!parent_cache || parent_cache.get(name) !== val) {
|
|
354
|
+
defined_on_self.push(name);
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
if (defined_on_self.length > 0) {
|
|
359
|
+
ele_to_vars.set(curr, defined_on_self);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
node_values_cache.set(curr, current_vals);
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
return ele_to_vars;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* 检查 CSS 变量是否定义
|
|
370
|
+
* @param {string} varnm - 变量名
|
|
371
|
+
* @param {HTMLElement} [target_el] - 可选的起始探测元素
|
|
372
|
+
* @returns {boolean}
|
|
373
|
+
*/
|
|
374
|
+
const is_css_var_defined = (varnm, target_el) => {
|
|
375
|
+
if (!varnm) return false;
|
|
376
|
+
const name = varnm.startsWith("--") ? varnm : `--${varnm}`;
|
|
377
|
+
|
|
378
|
+
if (target_el) {
|
|
379
|
+
// 局部探测:检查该元素及其祖先链上是否定义了该变量
|
|
380
|
+
// 复用之前的 find_css_var_scope_ele,如果能找到源头,说明已定义
|
|
381
|
+
return find_css_var_scope_ele(name, target_el) !== null;
|
|
382
|
+
} else {
|
|
383
|
+
// 全局搜索:检查页面所有样式表中是否声明过这个变量名
|
|
384
|
+
const all_names = get_all_uniq_css_varnms();
|
|
385
|
+
return all_names.includes(name);
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const def_css_var = (name, val, el = document.documentElement) => {
|
|
390
|
+
const nm = name.startsWith('--') ? name : `--${name}`;
|
|
391
|
+
el.style.setProperty(nm, String(val));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* 获取指定 CSS 变量的 @property 注册信息
|
|
396
|
+
* @param {string} varnm - 变量名 (如 --my-score)
|
|
397
|
+
* @returns {Object|null} - 包含 syntax, inherits, initialValue 的对象
|
|
398
|
+
*/
|
|
399
|
+
const get_css_prop_var = (varnm) => {
|
|
400
|
+
const name = varnm.startsWith('--') ? varnm : `--${varnm}`;
|
|
401
|
+
|
|
402
|
+
for (const sheet of document.styleSheets) {
|
|
403
|
+
try {
|
|
404
|
+
const rules = sheet.cssRules || sheet.rules;
|
|
405
|
+
if (!rules) continue;
|
|
406
|
+
|
|
407
|
+
for (let i = 0; i < rules.length; i++) {
|
|
408
|
+
const rule = rules[i];
|
|
409
|
+
|
|
410
|
+
// 关键点:检查是否为 CSSPropertyRule (即 @property)
|
|
411
|
+
if (window.CSSPropertyRule && rule instanceof CSSPropertyRule) {
|
|
412
|
+
if (rule.name === name) {
|
|
413
|
+
return {
|
|
414
|
+
name: rule.name,
|
|
415
|
+
syntax: rule.syntax,
|
|
416
|
+
inherits: rule.inherits,
|
|
417
|
+
initialValue: rule.initialValue
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
} catch (e) {
|
|
423
|
+
// 忽略跨域样式表安全限制
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return null;
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* 检查变量在 target_el 上是否因为 @property 规则而产生了隔离
|
|
431
|
+
*/
|
|
432
|
+
const is_css_var_isolated = (varnm, target_el) => {
|
|
433
|
+
const reg = get_css_prop_var(varnm);
|
|
434
|
+
if (reg && reg.inherits === false) {
|
|
435
|
+
// 如果它不继承,且当前元素不是定义源,那它拿到的就是初始值
|
|
436
|
+
const owner = find_css_var_scope_ele(varnm, target_el);
|
|
437
|
+
return owner !== target_el;
|
|
438
|
+
}
|
|
439
|
+
return false;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* 在运行时通过 JS 注册 CSS 变量规则 (@property 的 JS 版本)
|
|
444
|
+
* @param {Object} options - 注册选项
|
|
445
|
+
* @param {string} options.name - 变量名 (如 --my-var)
|
|
446
|
+
* @param {string} [options.syntax='*'] - 类型 (如 <color>, <number>, <length>)
|
|
447
|
+
* @param {boolean} [options.inherits=true] - 是否允许继承
|
|
448
|
+
* @param {string} [options.initialValue] - 初始值
|
|
449
|
+
*/
|
|
450
|
+
/**
|
|
451
|
+
* 运行时注册 CSS 变量规则 (@property 的 JS 版本)
|
|
452
|
+
* @param {string} name - 变量名 (如 --my-var)
|
|
453
|
+
* @param {Object} options - 配置项
|
|
454
|
+
* @param {string} [options.syntax='*'] - 类型语法
|
|
455
|
+
* @param {boolean} [options.inherits=true] - 是否允许继承
|
|
456
|
+
* @param {string} [options.initialValue] - 初始值 (如果 syntax 不是 '*',则此项必填)
|
|
457
|
+
*/
|
|
458
|
+
const def_css_prop_var = (name, { syntax = '*', inherits = true, initialValue } = {}) => {
|
|
459
|
+
const varnm = name.startsWith('--') ? name : `--${name}`;
|
|
460
|
+
|
|
461
|
+
if (!window.CSS || !window.CSS.registerProperty) {
|
|
462
|
+
console.warn('当前浏览器不支持 CSS.registerProperty');
|
|
463
|
+
return false;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
try {
|
|
467
|
+
// 构建符合原生 API 要求的对象
|
|
468
|
+
const config = {
|
|
469
|
+
name: varnm,
|
|
470
|
+
syntax: syntax,
|
|
471
|
+
inherits: inherits
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
// 只有在提供 initialValue 时才加入,避免 API 报错
|
|
475
|
+
if (initialValue !== undefined) {
|
|
476
|
+
config.initialValue = String(initialValue);
|
|
477
|
+
} else if (syntax !== '*') {
|
|
478
|
+
// 注意:如果指定了 syntax 且不是通配符,initialValue 在规范中通常是必填的
|
|
479
|
+
console.warn(`警告: 当 syntax 为 "${syntax}" 时,建议提供 initialValue。`);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
window.CSS.registerProperty(config);
|
|
483
|
+
return true;
|
|
484
|
+
} catch (e) {
|
|
485
|
+
// 如果重复注册相同名字,浏览器会抛出错误
|
|
486
|
+
console.error(`CSS 变量 "${varnm}" 注册失败:`, e.message);
|
|
487
|
+
return false;
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
|
|
185
491
|
|
|
186
492
|
module.exports = {
|
|
187
493
|
get_all_scripts,
|
|
188
494
|
get_all_csses,
|
|
189
495
|
collect_img_like_urls,
|
|
190
|
-
|
|
496
|
+
extract_css_varnms_from_rule,
|
|
497
|
+
get_all_css_vars,
|
|
498
|
+
extract_css_varnms_from_rule_to_set,
|
|
499
|
+
get_all_uniq_css_varnms,
|
|
500
|
+
find_css_var_scope_ele,
|
|
501
|
+
is_css_var_defined_on_self,
|
|
502
|
+
get_css_var_scope_ele_mp,
|
|
503
|
+
get_scope_ele_css_var_mp,
|
|
504
|
+
is_css_var_defined,
|
|
505
|
+
def_css_var,
|
|
506
|
+
get_css_prop_var,
|
|
507
|
+
is_css_var_isolated,
|
|
508
|
+
def_css_prop_var,
|
|
191
509
|
}
|