diff --git a/BUILD.gn b/BUILD.gn index 2fb8d0eb93981fe0484f1dceaaa5890f68c50f8d..e1893c74188dd0d3e6e7e230c175fac95ae07f65 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -14,6 +14,7 @@ import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") import("//foundation/ace/ace_engine/ace_config.gni") +import("//interface/sdk-js/interface_config.gni") ets_loader_lib_dir = get_label_info(":build_ets_loader_library", "target_out_dir") + "/lib" @@ -143,8 +144,18 @@ ets_loader_sources = [ "compiler/webpack.config.js", ] +ohos_copy("copy_deps") { + sources = + [ "//third_party/typescript/build_package/ohos-typescript-4.2.3-r2.tgz" ] + outputs = [ target_out_dir + "/ets_loader/deps/{{source_file_part}}" ] + license_file = "//third_party/typescript/LICENSE" +} + ohos_copy("ets_loader") { - deps = [ ":build_ets_loader_library" ] + deps = [ + ":build_ets_loader_library", + ":copy_deps", + ] sources = ets_loader_sources deps += [ ":build_ets_sysResource" ] sources += [ ets_sysResource ] @@ -270,8 +281,24 @@ ohos_copy("ets_loader_ark_codegen") { outputs = [ target_out_dir + "/ets_loader_ark/codegen" ] } +ohos_copy("ohos_declaration_ets_ark") { + deps = [ "//interface/sdk-js:ohos_declaration_ets" ] + + sources = [ root_out_dir + "/ohos_declaration/ohos_declaration_ets" ] + + outputs = [ target_out_dir + "/../api" ] +} + +ohos_copy("common_api_ark") { + sources = common_api_src + deps = [ ":ohos_declaration_ets_ark" ] + outputs = [ target_out_dir + "/../../developtools/api/{{source_file_part}}" ] + module_install_name = "" +} + ohos_copy("ets_loader_node_modules") { deps = [ + ":common_api_ark", ":ets_loader_ark", ":ets_loader_ark_codegen", ":ets_loader_ark_components", diff --git a/compiler/babel.config.js b/compiler/babel.config.js index 1c8aa70516ca7db5bda81d75107c87ef219eea50..ed99ab39af3f8807fe5b91fa5256351c050a42fb 100644 --- a/compiler/babel.config.js +++ b/compiler/babel.config.js @@ -16,7 +16,7 @@ module.exports = function(api) { api.cache(true); - const presets = ['@babel/preset-env', '@babel/typescript']; + const presets = ['@babel/typescript']; const plugins = [ '@babel/plugin-transform-modules-commonjs', '@babel/plugin-proposal-class-properties', diff --git a/compiler/build_declarations_file.js b/compiler/build_declarations_file.js index 41d982b4f4413ee321dc9648eb14aa80d723a6db..c878c971d63dc3f2acf05fe245abd909a72ebe21 100644 --- a/compiler/build_declarations_file.js +++ b/compiler/build_declarations_file.js @@ -61,8 +61,6 @@ function generateTargetFile(filePath, output) { const fileName = path.resolve(output, path.basename(item)); if (item === globalTsFile) { content = license + '\n\n' + processsFile(content, fileName, true); - } else if (path.resolve(item) !== middleTsFile) { - content = license + '\n\n' + processsFile(content, fileName, false); } fs.writeFile(fileName, content, err => { if (err) { diff --git a/compiler/codegen/codegen_ets.js b/compiler/codegen/codegen_ets.js index bd20d1f9b2dddb8d5e8cec4e5d7aa66bc6fbc7c0..0c4867ad0d1c6379e6a349831ca0516c66dba31c 100644 --- a/compiler/codegen/codegen_ets.js +++ b/compiler/codegen/codegen_ets.js @@ -13,4 +13,4 @@ * limitations under the License. */ -(()=>{"use strict";var e={904:(e,t)=>{var r;let n;Object.defineProperty(t,"__esModule",{value:!0}),t.setDomain=t.getDomain=t.Domain=void 0,function(e){e[e.FA=0]="FA",e[e.FORM=1]="FORM",e[e.ETS=2]="ETS"}(r||(r={})),t.Domain=r,t.setDomain=e=>{n=e},t.getDomain=()=>null!=n?n:r.ETS},784:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.errorMap=void 0,t.errorMap=new Map([["fileError","Visual file is damaged"],["versionError","Version number of visual file does not match"],["modelError","Visual model in visual file is damaged"],["codegenError","Codegen hml and css failed"]])},117:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNode=void 0,t.ASTNode=class{accept(e){return e.visit(this)}}},862:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Cache=void 0,t.Cache=class{constructor(e,t=0){this.value="",this.indent=t,this.flag=!0,this.INDENT=e}indentOn(){this.flag=!0}indentOff(){this.flag=!1}incIndent(){this.indent++}decIndent(){this.indent--}checkIndent(){return this.indent<0}getIndents(){if(this.flag){let e="";for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;const n=r(117);class o extends n.ASTNode{constructor(e,t,r,n){super(),this.tagName=e,this.params=t,this.content=r,this.properties=n}setParams(e){this.params=e}}t.Tag=o},623:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const n=r(519),o=r(51);class i{constructor(e){this.cache=e}visit(e){e instanceof n.Tag&&this.genTag(e)}static getMethodGen(e){return void 0===i.instance?i.instance=new i(e):i.instance.setCache(e),i.instance}setCache(e){this.cache=e}genParams(e){if("string"==typeof e)this.cache.concat(e);else if(e.size>0){this.cache.concat(o.TokenClass.LBRA,o.TokenClass.SPACE);let t=0;e.forEach(((r,n)=>{this.cache.concat(n,o.TokenClass.COLON,o.TokenClass.SPACE,r),t++,t{this.cache.concat(n,o.TokenClass.COLON,o.TokenClass.SPACE,r),t++,t{e.accept(this),this.cache.indentOff(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn()),this.cache.indentOn(),this.cache.concat(o.TokenClass.RBRA)),null!==e.properties&&(null!==e.content&&0!==e.content.length||this.cache.incIndent(),e.properties.forEach(((e,t)=>{this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(o.TokenClass.PROPERTY_START,t,o.TokenClass.TAG_START),this.cache.indentOff(),"string"==typeof e?this.cache.concat(e,o.TokenClass.TAG_END):this.genObjectProperty(e)})),null!==e.content&&0!==e.content.length||this.cache.decIndent())}}t.ASTNodeGenerator=i,i.instance=void 0},413:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ETSBridge=void 0;const n=r(519),o=r(973);t.ETSBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map;let r=null;const i=new Map,s=new n.Tag(e.type,t,r,i);if(o.parseVisualModel(e,s),e.children.length>0){r=[];for(const t of e.children)r.push(t.accept(this))}return s.content=r,s}}},459:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.genETS=void 0;const n=r(623),o=r(862);t.genETS=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" ",2));return e.accept(t),t.cache.toString()}},435:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StringWriter=void 0;const n=r(459);t.StringWriter=class{genETS(e){return n.genETS(e)}}},51:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(r=t.TokenClass||(t.TokenClass={}))[r.IDENTIFIER=0]="IDENTIFIER",r[r.STRING_LITERAL=1]="STRING_LITERAL",r[r.NUMBER=2]="NUMBER",r[r.CHARACTER=3]="CHARACTER",r[r.EOF=4]="EOF",r[r.INVALID=5]="INVALID",r.EMPTY_DATA="empty",r.ASSIGN="=",r.INDENT=" ",r.NEW_LINE="\n",r.CARRIAGE_RETURN="\r",r.SPACE=" ",r.LQUOTE="'",r.RQUOTE="'",r.TAG_START="(",r.TAG_END=")",r.EMPTY_TAG_END="/>",r.END_TAG_START="{function r(e){return(...t)=>t.lengtht.property.has(e))),o=r(((e,t,r)=>r.type===e&&r.property.has(t))),i=r(((e,t,r)=>{const n=t.property.get(e);void 0!==n&&r.properties.set(f(e),"'"+n+"'")}));function s(e){return void 0===e||""===e}const a=r(((e,t,r)=>{const n=t.property.get(e);s(n)||r.properties.set(f(e),n)})),c=r(((e,t,r)=>{const n=t.property.get(e);s(n)||r.properties.set(f(e),n)})),l=r(((e,t,r,n)=>{const o=r.property.get(e);s(o)||n.properties.set(f(e),y(t,o))})),p=r(((e,t,r)=>{const n=t.property.get(e);void 0!==n&&r.params instanceof Map&&r.params.set(f(e),"'"+n+"'")})),d=r(((e,t,r)=>{const n=t.property.get(e);!s(n)&&r.params instanceof Map&&r.params.set(f(e),n)})),h=r(((e,t,r,n)=>{const o=r.property.get(e);!s(o)&&n.params instanceof Map&&n.params.set(f(e),y(t,o))})),u=r(((e,t,r)=>{let n=t.property.get(e);s(n)||(n=m(n),r.properties.set(f(e),n))}));function g([e,...t]){return(null==e?void 0:e.toUpperCase())+t.join("")}function f(e){const t=e.split("-");let r=t[0];for(let e=1;e{const o=r.property.get(e);if(s(o)||!(n.params instanceof Map))return;let i=y(t,o);"flex-start"===o?i=t+"Start":"flex-end"===o&&(i=t+"End"),n.params.set(f(e),i)})),E=[[n("width"),i("width")],[n("height"),i("height")],[function(e){return e.property.has("constraint-size-min-width")||e.property.has("constraint-size-max-width")||e.property.has("constraint-size-min-height")||e.property.has("constraint-size-min-height")},function(e,t){const r=new Map,n=e.property.get("constraint-size-min-width"),o=e.property.get("constraint-size-max-width"),i=e.property.get("constraint-size-min-height"),s=e.property.get("constraint-size-max-height");v("minWidth",n,r),v("maxWidth",o,r),v("minHeight",i,r),v("maxHeight",s,r),r.size>0&&t.properties.set("constraintSize",r)}],[n("align"),l("align","Alignment.")],[n("direction"),l("direction","Direction.")],[function(e){return e.property.has("left")||e.property.has("top")},function(e,t){const r=e.property.get("position"),n=e.property.get("left"),o=e.property.get("top");s(n)&&s(o)||t.properties.set("absolute"===r?"position":"offset",new Map([["x","'"+(null!=n?n:"0")+"'"],["y","'"+(null!=o?o:"0")+"'"]]))}],[n("aspect-ratio"),a("aspect-ratio")],[n("display-priority"),a("display-priority")],[n("flex-basis"),i("flex-basis")],[n("flex-grow"),a("flex-grow")],[n("flex-shrink"),a("flex-shrink")],[n("align-self"),l("align-self","ItemAlign.")],[n("border-style"),l("border-style","BorderStyle.")],[n("border-width"),i("border-width")],[n("border-color"),u("border-color")],[n("border-radius"),i("border-radius")],[n("background-color"),u("background-color")],[n("opacity"),a("opacity")],[n("visibility"),l("visibility","Visibility.")],[n("enabled"),c("enabled")],[n("font-color"),u("font-color")],[n("font-size"),i("font-size")],[n("font-style"),l("font-style","FontStyle.")],[n("font-weight"),function(e,t){const r=e.property.get("font-weight");s(r)||t.properties.set("fontWeight",["lighter","normal","regular","medium","bold","bolder"].includes(r)?y("FontWeight.",r):r)}],[n("font-family"),i("font-family")],[function(e){return e.property.has("margin")||e.property.has("margin-left")||e.property.has("margin-top")||e.property.has("margin-right")||e.property.has("margin-bottom")},function(e,t){var r,n,o,i;const s=new Map,a=e.property.get("margin"),c=null!==(r=e.property.get("margin-top"))&&void 0!==r?r:a,l=null!==(n=e.property.get("margin-bottom"))&&void 0!==n?n:a,p=null!==(o=e.property.get("margin-left"))&&void 0!==o?o:a,d=null!==(i=e.property.get("margin-right"))&&void 0!==i?i:a;v("top",c,s),v("bottom",l,s),v("left",p,s),v("right",d,s),s.size>0&&t.properties.set("margin",s)}],[function(e){return e.property.has("padding")||e.property.has("padding-left")||e.property.has("padding-top")||e.property.has("padding-right")||e.property.has("padding-bottom")},function(e,t){var r,n,o,i;const s=new Map,a=e.property.get("padding"),c=null!==(r=e.property.get("padding-top"))&&void 0!==r?r:a,l=null!==(n=e.property.get("padding-bottom"))&&void 0!==n?n:a,p=null!==(o=e.property.get("padding-left"))&&void 0!==o?o:a,d=null!==(i=e.property.get("padding-right"))&&void 0!==i?i:a;v("top",c,s),v("bottom",l,s),v("left",p,s),v("right",d,s),s.size>0&&t.properties.set("padding",s)}],[o("button","label"),function(e,t){const r=e.property.get("label");"string"==typeof r&&t.setParams("'"+r+"'")}],[o("button","type"),l("type","ButtonType.")],[o("button","state-effect"),c("state-effect")],[o("divider","vertical"),c("vertical")],[o("divider","color"),u("color")],[o("divider","stroke-width"),i("stroke-width")],[o("divider","line-cap"),l("line-cap","LineCapStyle.")],[o("image","src"),function(e,t){const r=e.property.get("src");"string"==typeof r&&t.setParams(function(e){return null===e.match(/\$(r|rawfile)\('(.*)'\)$/)?"'"+e+"'":e}(r))}],[o("image","alt"),i("alt")],[o("image","object-fit"),l("object-fit","ImageFit.")],[o("image","object-repeat"),l("object-repeat","ImageRepeat.")],[o("image","interpolation"),l("interpolation","ImageInterpolation.")],[o("image","render-mode"),l("render-mode","ImageRenderMode.")],[function(e){return e.property.has("source-size-width")||e.property.has("source-size-height")},function(e,t){let r=e.property.get("source-size-width"),n=e.property.get("source-size-height");if(s(r)&&s(n))return;r="0"===r||s(r)?"0":r.substring(0,r.length-2),n="0"===n||s(n)?"0":n.substring(0,n.length-2);const o=new Map([["width",r],["height",n]]);t.properties.set("sourceSize",o)}],[function(e){return"progress"===e.type&&(e.property.has("value")||e.property.has("total")||e.property.has("style"))},function(e,t){var r;t.params instanceof Map&&t.params.set("value",null!==(r=e.property.get("value"))&&void 0!==r?r:"0")}],[o("progress","total"),d("total")],[o("progress","style"),h("style","ProgressStyle.")],[o("progress","color"),u("color")],[o("slider","value"),d("value")],[o("slider","min"),d("min")],[o("slider","max"),d("max")],[o("slider","step"),d("step")],[o("slider","style"),h("style","SliderStyle.")],[o("slider","block-color"),u("block-color")],[o("slider","track-color"),u("track-color")],[o("slider","selected-color"),u("selected-color")],[o("slider","show-steps"),c("show-steps")],[o("slider","show-tips"),c("show-tips")],[o("text","content"),function(e,t){const r=e.property.get("content");"string"==typeof r&&t.setParams("`"+r+"`")}],[o("text","text-align"),l("text-align","TextAlign.")],[o("text","text-overflow"),function(e,t){const r=e.property.get("text-overflow");s(r)||t.properties.set("textOverflow",new Map([["overflow","TextOverflow."+g(r)]]))}],[o("text","max-lines"),a("max-lines")],[o("text","line-height"),i("line-height")],[function(e){return"text"===e.type&&(e.property.has("decoration-type")||e.property.has("decoration-color"))},function(e,t){const r=e.property.get("decoration-type"),n=e.property.get("decoration-color");if(s(r)&&s(n))return;const o=new Map([["type",s(r)?"TextDecorationType.None":"TextDecorationType."+g(r)]]);t.properties.set("decoration",o),s(n)||o.set("color",m(n))}],[o("text","baseline-offset"),i("baseline-offset")],[o("text","text-case"),l("text-case","TextCase.")],[o("column","space"),p("space")],[o("column","align-items-column"),function(e,t){const r=e.property.get("align-items-column");if(s(r))return;let n=y("HorizontalAlign.",r);"flex-start"===r?n="HorizontalAlign.Start":"flex-end"===r&&(n="HorizontalAlign.End"),t.properties.set("alignItems",n)}],[o("row","space"),p("space")],[o("row","align-items-row"),function(e,t){const r=e.property.get("align-items-row");if(s(r))return;let n=y("VerticalAlign.",r);"flex-start"===r?n="VerticalAlign.Top":"flex-end"===r&&(n="VerticalAlign.Bottom"),t.properties.set("alignItems",n)}],[o("flex","flex-direction"),function(e,t){const r=e.property.get("flex-direction");!s(r)&&t.params instanceof Map&&t.params.set("direction",y("FlexDirection.",r))}],[o("flex","wrap"),function(e,t){const r=e.property.get("wrap");if(s(r)||!(t.params instanceof Map))return;let n=y("FlexWrap.",r);"nowrap"===r&&(n="FlexWrap.NoWrap"),t.params.set("wrap",n)}],[o("flex","justify-content"),T("justify-content","FlexAlign.")],[o("flex","align-items-flex"),function(e,t){const r=e.property.get("align-items-flex");if(s(r)||!(t.params instanceof Map))return;let n=y("ItemAlign.",r);"flex-start"===r?n="ItemAlign.Start":"flex-end"===r&&(n="ItemAlign.End"),t.params.set("alignItems",n)}],[o("flex","align-content"),T("align-content","FlexAlign.")],[o("list","space"),d("space")],[o("list","initial-index"),d("initial-index")],[o("list","list-direction"),l("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.property.has("divider-stroke-width")||e.property.has("divider-color")||e.property.has("divider-start-margin")||e.property.has("divider-end-margin"))},function(e,t){const r=e.property.get("divider-stroke-width"),n=new Map([["strokeWidth","'"+(null!=r?r:"0")+"'"]]),o=e.property.get("divider-color"),i=e.property.get("divider-start-margin"),a=e.property.get("divider-end-margin");s(o)||n.set("color",m(o)),s(i)||n.set("startMargin","'"+i+"'"),s(a)||n.set("endMargin","'"+a+"'"),t.properties.set("divider",n)}],[o("list","edit-mode"),c("edit-mode")],[o("list","edge-effect"),l("edge-effect","EdgeEffect.")],[o("list","chain-animation"),c("chain-animation")],[o("list-item","sticky"),l("sticky","Sticky.")],[o("list-item","editable"),c("editable")],[o("swiper","index"),a("index")],[o("swiper","auto-play"),c("auto-play")],[o("swiper","interval"),a("interval")],[o("swiper","indicator"),c("indicator")],[o("swiper","loop"),c("loop")],[o("swiper","duration"),a("duration")],[o("swiper","vertical"),c("vertical")],[o("swiper","item-space"),i("item-space")]]},945:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FormAction=t.FormModel=void 0,t.FormModel=class{constructor(){this.data=new Map,this.actions=new Map}},t.FormAction=class{constructor(e,t,r){this.action=e,this.params=t,this.want=r}}},891:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setInstance=t.getInstance=void 0;const n=r(933),o=r(945),i=r(904),s={document:{VisualVersion:"12",type:"ETS"},visualModel:new n.VisualModel({type:"div",id:"wrapper"}),formData:new o.FormModel};t.getInstance=function(){return s},t.setInstance=function(e){for(const t in s)Object.prototype.hasOwnProperty.call(e,t)&&(s[t]=e[t]);const t=s.document.type;i.setDomain("ETS"===t?i.Domain.ETS:"FORM"===t?i.Domain.FORM:i.Domain.FA)}},977:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reviver=t.replacer=t.deserialize=t.serialize=void 0;const n=r(933),o=r(891);function i(e,t){if(t instanceof Map)return{dataType:"Map",value:Object.fromEntries(t.entries())};if(t instanceof Set)return{dataType:"Set",value:Array.from(t.entries())};if(t instanceof n.VisualModel){const e=new n.VisualModel({type:"none"}),r={};for(const n in e)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return{dataType:"VisualModel",value:r}}return t}function s(e,t){if("object"==typeof t&&null!=t){if("Map"===t.dataType)return new Map(Object.entries(t.value));if("Set"===t.dataType)return new Set(t.value);if("VisualModel"===t.dataType){const e=new n.VisualModel({type:""});Object.assign(e,t.value),t=e}}return t}t.serialize=function(e,t){return JSON.stringify(null!=t?t:o.getInstance(),i,4)},t.deserialize=function(e){const t=JSON.parse(e,s);o.setInstance(t)},t.replacer=i,t.reviver=s},933:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VisualModel=void 0;const r="-visual";t.VisualModel=class{constructor(e){if(this.mediaProperty=void 0,this.property=void 0!==e.property?e.property:new Map,this.children=void 0!==e.children?e.children:[],"wrapper"===e.type)return this.id="wrapper",void(this.type="div");e.type.endsWith(r)&&(e.type=e.type.substring(0,e.type.length-r.length)),this.id=void 0!==e.id?e.id:"",this.type=e.type}accept(e){return e.visit(this)}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0});const t=r(784),o=r(891),i=r(977),s=r(413),a=r(435);e.genETS=function(e){const r={ets:"",errorType:"",errorMessage:""};!function(e,t){try{i.deserialize(e);const r=o.getInstance().document.VisualVersion,n=/^([1-9]+[0-9]*)$/;if(void 0===r)t.errorType="versionError";else{const e=r.match(n);(null===e||parseInt(e[1])>12)&&(t.errorType="versionError")}}catch(e){t.errorType="fileError"}}(e,r);try{const e=function(e){let t="";const r=new s.ETSBridge,n=e.accept(r),o=(new a.StringWriter).genETS(n);return t=r.getErrorCount()>0?"error":o,t}(o.getInstance().visualModel);"error"===e&&(r.errorType="codegenError"),r.ets=e}catch(e){r.errorType="modelError"}return""!==r.errorType&&(r.errorMessage=t.errorMap.get(r.errorType),r.ets=""),r}})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); \ No newline at end of file +(()=>{var e={486:function(e,t,r){var n;e=r.nmd(e),function(){var o,i="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=32,l=128,u=1/0,p=9007199254740991,f=NaN,d=4294967295,y=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",c],["partialRight",64],["rearg",256]],h="[object Arguments]",m="[object Array]",g="[object Boolean]",E="[object Date]",v="[object Error]",T="[object Function]",S="[object GeneratorFunction]",_="[object Map]",N="[object Number]",A="[object Object]",C="[object Promise]",w="[object RegExp]",b="[object Set]",R="[object String]",I="[object Symbol]",O="[object WeakMap]",P="[object ArrayBuffer]",M="[object DataView]",x="[object Float32Array]",L="[object Float64Array]",k="[object Int8Array]",F="[object Int16Array]",D="[object Int32Array]",U="[object Uint8Array]",G="[object Uint8ClampedArray]",B="[object Uint16Array]",z="[object Uint32Array]",j=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,Y=RegExp($.source),q=RegExp(H.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,re=RegExp(te.source),ne=/^\s+/,oe=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,fe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,he=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,Ee=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,Te=/['\n\r\u2028\u2029\\]/g,Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="a-z\\xdf-\\xf6\\xf8-\\xff",Ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="["+Ae+"]",we="["+Se+"]",be="\\d+",Re="["+_e+"]",Ie="[^\\ud800-\\udfff"+Ae+be+"\\u2700-\\u27bf"+_e+Ne+"]",Oe="\\ud83c[\\udffb-\\udfff]",Pe="[^\\ud800-\\udfff]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",xe="[\\ud800-\\udbff][\\udc00-\\udfff]",Le="["+Ne+"]",ke="(?:"+Re+"|"+Ie+")",Fe="(?:"+Le+"|"+Ie+")",De="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ge="(?:"+we+"|"+Oe+")?",Be="[\\ufe0e\\ufe0f]?",ze=Be+Ge+"(?:\\u200d(?:"+[Pe,Me,xe].join("|")+")"+Be+Ge+")*",je="(?:"+["[\\u2700-\\u27bf]",Me,xe].join("|")+")"+ze,Ve="(?:"+[Pe+we+"?",we,Me,xe,"[\\ud800-\\udfff]"].join("|")+")",We=RegExp("['’]","g"),$e=RegExp(we,"g"),He=RegExp(Oe+"(?="+Oe+")|"+Ve+ze,"g"),Ye=RegExp([Le+"?"+Re+"+"+De+"(?="+[Ce,Le,"$"].join("|")+")",Fe+"+"+Ue+"(?="+[Ce,Le+ke,"$"].join("|")+")",Le+"?"+ke+"+"+De,Le+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",be,je].join("|"),"g"),qe=RegExp("[\\u200d\\ud800-\\udfff"+Se+"\\ufe0e\\ufe0f]"),Qe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Xe=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Je=-1,Ke={};Ke[x]=Ke[L]=Ke[k]=Ke[F]=Ke[D]=Ke[U]=Ke[G]=Ke[B]=Ke[z]=!0,Ke[h]=Ke[m]=Ke[P]=Ke[g]=Ke[M]=Ke[E]=Ke[v]=Ke[T]=Ke[_]=Ke[N]=Ke[A]=Ke[w]=Ke[b]=Ke[R]=Ke[O]=!1;var Ze={};Ze[h]=Ze[m]=Ze[P]=Ze[M]=Ze[g]=Ze[E]=Ze[x]=Ze[L]=Ze[k]=Ze[F]=Ze[D]=Ze[_]=Ze[N]=Ze[A]=Ze[w]=Ze[b]=Ze[R]=Ze[I]=Ze[U]=Ze[G]=Ze[B]=Ze[z]=!0,Ze[v]=Ze[T]=Ze[O]=!1;var et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=parseFloat,rt=parseInt,nt="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,ot="object"==typeof self&&self&&self.Object===Object&&self,it=nt||ot||Function("return this")(),at=t&&!t.nodeType&&t,st=at&&e&&!e.nodeType&&e,ct=st&&st.exports===at,lt=ct&&nt.process,ut=function(){try{return st&&st.require&&st.require("util").types||lt&<.binding&<.binding("util")}catch(e){}}(),pt=ut&&ut.isArrayBuffer,ft=ut&&ut.isDate,dt=ut&&ut.isMap,yt=ut&&ut.isRegExp,ht=ut&&ut.isSet,mt=ut&&ut.isTypedArray;function gt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Et(e,t,r,n){for(var o=-1,i=null==e?0:e.length;++o-1}function At(e,t,r){for(var n=-1,o=null==e?0:e.length;++n-1;);return r}function Yt(e,t){for(var r=e.length;r--&&xt(t,e[r],0)>-1;);return r}function qt(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var Qt=Ut({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Xt=Ut({"&":"&","<":"<",">":">",'"':""","'":"'"});function Jt(e){return"\\"+et[e]}function Kt(e){return qe.test(e)}function Zt(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function er(e,t){return function(r){return e(t(r))}}function tr(e,t){for(var r=-1,n=e.length,o=0,i=[];++r",""":'"',"'":"'"}),cr=function e(t){var r,n=(t=null==t?it:cr.defaults(it.Object(),t,cr.pick(it,Xe))).Array,oe=t.Date,Se=t.Error,_e=t.Function,Ne=t.Math,Ae=t.Object,Ce=t.RegExp,we=t.String,be=t.TypeError,Re=n.prototype,Ie=_e.prototype,Oe=Ae.prototype,Pe=t["__core-js_shared__"],Me=Ie.toString,xe=Oe.hasOwnProperty,Le=0,ke=(r=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Fe=Oe.toString,De=Me.call(Ae),Ue=it._,Ge=Ce("^"+Me.call(xe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=ct?t.Buffer:o,ze=t.Symbol,je=t.Uint8Array,Ve=Be?Be.allocUnsafe:o,He=er(Ae.getPrototypeOf,Ae),qe=Ae.create,et=Oe.propertyIsEnumerable,nt=Re.splice,ot=ze?ze.isConcatSpreadable:o,at=ze?ze.iterator:o,st=ze?ze.toStringTag:o,lt=function(){try{var e=ui(Ae,"defineProperty");return e({},"",{}),e}catch(e){}}(),ut=t.clearTimeout!==it.clearTimeout&&t.clearTimeout,Ot=oe&&oe.now!==it.Date.now&&oe.now,Ut=t.setTimeout!==it.setTimeout&&t.setTimeout,lr=Ne.ceil,ur=Ne.floor,pr=Ae.getOwnPropertySymbols,fr=Be?Be.isBuffer:o,dr=t.isFinite,yr=Re.join,hr=er(Ae.keys,Ae),mr=Ne.max,gr=Ne.min,Er=oe.now,vr=t.parseInt,Tr=Ne.random,Sr=Re.reverse,_r=ui(t,"DataView"),Nr=ui(t,"Map"),Ar=ui(t,"Promise"),Cr=ui(t,"Set"),wr=ui(t,"WeakMap"),br=ui(Ae,"create"),Rr=wr&&new wr,Ir={},Or=Gi(_r),Pr=Gi(Nr),Mr=Gi(Ar),xr=Gi(Cr),Lr=Gi(wr),kr=ze?ze.prototype:o,Fr=kr?kr.valueOf:o,Dr=kr?kr.toString:o;function Ur(e){if(rs(e)&&!$a(e)&&!(e instanceof jr)){if(e instanceof zr)return e;if(xe.call(e,"__wrapped__"))return Bi(e)}return new zr(e)}var Gr=function(){function e(){}return function(t){if(!ts(t))return{};if(qe)return qe(t);e.prototype=t;var r=new e;return e.prototype=o,r}}();function Br(){}function zr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function jr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Vr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function sn(e,t,r,n,i,a){var s,c=1&t,l=2&t,u=4&t;if(r&&(s=i?r(e,n,i,a):r(e)),s!==o)return s;if(!ts(e))return e;var p=$a(e);if(p){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&xe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!c)return Ro(e,s)}else{var f=di(e),d=f==T||f==S;if(Qa(e))return _o(e,c);if(f==A||f==h||d&&!i){if(s=l||d?{}:hi(e),!c)return l?function(e,t){return Io(e,fi(e),t)}(e,function(e,t){return e&&Io(t,xs(t),e)}(s,e)):function(e,t){return Io(e,pi(e),t)}(e,rn(s,e))}else{if(!Ze[f])return i?e:{};s=function(e,t,r){var n,o=e.constructor;switch(t){case P:return No(e);case g:case E:return new o(+e);case M:return function(e,t){var r=t?No(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case x:case L:case k:case F:case D:case U:case G:case B:case z:return Ao(e,r);case _:case b:return new o;case N:case R:return new o(e);case w:return function(e){var t=new e.constructor(e.source,fe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case I:return n=e,Fr?Ae(Fr.call(n)):{}}}(e,f,c)}}a||(a=new Yr);var y=a.get(e);if(y)return y;a.set(e,s),ss(e)?e.forEach((function(n){s.add(sn(n,t,r,n,e,a))})):ns(e)&&e.forEach((function(n,o){s.set(o,sn(n,t,r,o,e,a))}));var m=p?o:(u?l?ni:ri:l?xs:Ms)(e);return vt(m||e,(function(n,o){m&&(n=e[o=n]),Zr(s,o,sn(n,t,r,o,e,a))})),s}function cn(e,t,r){var n=r.length;if(null==e)return!n;for(e=Ae(e);n--;){var i=r[n],a=t[i],s=e[i];if(s===o&&!(i in e)||!a(s))return!1}return!0}function ln(e,t,r){if("function"!=typeof e)throw new be(i);return Oi((function(){e.apply(o,r)}),t)}function un(e,t,r,n){var o=-1,i=Nt,a=!0,s=e.length,c=[],l=t.length;if(!s)return c;r&&(t=Ct(t,Vt(r))),n?(i=At,a=!1):t.length>=200&&(i=$t,a=!1,t=new Hr(t));e:for(;++o-1},Wr.prototype.set=function(e,t){var r=this.__data__,n=en(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},$r.prototype.clear=function(){this.size=0,this.__data__={hash:new Vr,map:new(Nr||Wr),string:new Vr}},$r.prototype.delete=function(e){var t=ci(this,e).delete(e);return this.size-=t?1:0,t},$r.prototype.get=function(e){return ci(this,e).get(e)},$r.prototype.has=function(e){return ci(this,e).has(e)},$r.prototype.set=function(e,t){var r=ci(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Hr.prototype.add=Hr.prototype.push=function(e){return this.__data__.set(e,a),this},Hr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.clear=function(){this.__data__=new Wr,this.size=0},Yr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Yr.prototype.get=function(e){return this.__data__.get(e)},Yr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!Nr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new $r(n)}return r.set(e,t),this.size=r.size,this};var pn=Mo(vn),fn=Mo(Tn,!0);function dn(e,t){var r=!0;return pn(e,(function(e,n,o){return r=!!t(e,n,o)})),r}function yn(e,t,r){for(var n=-1,i=e.length;++n0&&r(s)?t>1?mn(s,t-1,r,n,o):wt(o,s):n||(o[o.length]=s)}return o}var gn=xo(),En=xo(!0);function vn(e,t){return e&&gn(e,t,Ms)}function Tn(e,t){return e&&En(e,t,Ms)}function Sn(e,t){return _t(t,(function(t){return Ka(e[t])}))}function _n(e,t){for(var r=0,n=(t=Eo(t,e)).length;null!=e&&rt}function wn(e,t){return null!=e&&xe.call(e,t)}function bn(e,t){return null!=e&&t in Ae(e)}function Rn(e,t,r){for(var i=r?At:Nt,a=e[0].length,s=e.length,c=s,l=n(s),u=1/0,p=[];c--;){var f=e[c];c&&t&&(f=Ct(f,Vt(t))),u=gr(f.length,u),l[c]=!r&&(t||a>=120&&f.length>=120)?new Hr(c&&f):o}f=e[0];var d=-1,y=l[0];e:for(;++d=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}));n--;)e[n]=e[n].value;return e}(o)}function Vn(e,t,r){for(var n=-1,o=t.length,i={};++n-1;)s!==e&&nt.call(s,c,1),nt.call(e,c,1);return e}function $n(e,t){for(var r=e?t.length:0,n=r-1;r--;){var o=t[r];if(r==n||o!==i){var i=o;gi(o)?nt.call(e,o,1):lo(e,o)}}return e}function Hn(e,t){return e+ur(Tr()*(t-e+1))}function Yn(e,t){var r="";if(!e||t<1||t>p)return r;do{t%2&&(r+=e),(t=ur(t/2))&&(e+=e)}while(t);return r}function qn(e,t){return Pi(Ci(e,t,oc),e+"")}function Qn(e){return Qr(zs(e))}function Xn(e,t){var r=zs(e);return Li(r,an(t,0,r.length))}function Jn(e,t,r,n){if(!ts(e))return e;for(var i=-1,a=(t=Eo(t,e)).length,s=a-1,c=e;null!=c&&++ii?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=n(i);++o>>1,a=e[i];null!==a&&!ls(a)&&(r?a<=t:a=200){var l=t?null:qo(e);if(l)return rr(l);a=!1,o=$t,c=new Hr}else c=t?[]:s;e:for(;++n=n?e:to(e,t,r)}var So=ut||function(e){return it.clearTimeout(e)};function _o(e,t){if(t)return e.slice();var r=e.length,n=Ve?Ve(r):new e.constructor(r);return e.copy(n),n}function No(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function Ao(e,t){var r=t?No(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Co(e,t){if(e!==t){var r=e!==o,n=null===e,i=e==e,a=ls(e),s=t!==o,c=null===t,l=t==t,u=ls(t);if(!c&&!u&&!a&&e>t||a&&s&&l&&!c&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&e1?r[i-1]:o,s=i>2?r[2]:o;for(a=e.length>3&&"function"==typeof a?(i--,a):o,s&&Ei(r[0],r[1],s)&&(a=i<3?o:a,i=1),t=Ae(t);++n-1?i[a?t[s]:s]:o}}function Uo(e){return ti((function(t){var r=t.length,n=r,a=zr.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new be(i);if(a&&!c&&"wrapper"==ii(s))var c=new zr([],!0)}for(n=c?n:r;++n1&&v.reverse(),d&&pc))return!1;var u=a.get(e),p=a.get(t);if(u&&p)return u==t&&p==e;var f=-1,d=!0,y=2&r?new Hr:o;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return vt(y,(function(r){var n="_."+r[0];t&r[1]&&!Nt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(se):[]}(n),r)))}function xi(e){var t=0,r=0;return function(){var n=Er(),i=16-(n-r);if(r=n,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Li(e,t){var r=-1,n=e.length,i=n-1;for(t=t===o?n:t;++r1?e[t-1]:o;return r="function"==typeof r?(e.pop(),r):o,aa(e,r)}));function da(e){var t=Ur(e);return t.__chain__=!0,t}function ya(e,t){return t(e)}var ha=ti((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,i=function(t){return on(t,e)};return!(t>1||this.__actions__.length)&&n instanceof jr&&gi(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:ya,args:[i],thisArg:o}),new zr(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(o),e}))):this.thru(i)})),ma=Oo((function(e,t,r){xe.call(e,r)?++e[r]:nn(e,r,1)})),ga=Do(Wi),Ea=Do($i);function va(e,t){return($a(e)?vt:pn)(e,si(t,3))}function Ta(e,t){return($a(e)?Tt:fn)(e,si(t,3))}var Sa=Oo((function(e,t,r){xe.call(e,r)?e[r].push(t):nn(e,r,[t])})),_a=qn((function(e,t,r){var o=-1,i="function"==typeof t,a=Ya(e)?n(e.length):[];return pn(e,(function(e){a[++o]=i?gt(t,e,r):In(e,t,r)})),a})),Na=Oo((function(e,t,r){nn(e,r,t)}));function Aa(e,t){return($a(e)?Ct:Dn)(e,si(t,3))}var Ca=Oo((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),wa=qn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&Ei(e,t[0],t[1])?t=[]:r>2&&Ei(t[0],t[1],t[2])&&(t=[t[0]]),jn(e,mn(t,1),[])})),ba=Ot||function(){return it.Date.now()};function Ra(e,t,r){return t=r?o:t,t=e&&null==t?e.length:t,Xo(e,l,o,o,o,o,t)}function Ia(e,t){var r;if("function"!=typeof t)throw new be(i);return e=hs(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Oa=qn((function(e,t,r){var n=1;if(r.length){var o=tr(r,ai(Oa));n|=c}return Xo(e,n,t,r,o)})),Pa=qn((function(e,t,r){var n=3;if(r.length){var o=tr(r,ai(Pa));n|=c}return Xo(t,n,e,r,o)}));function Ma(e,t,r){var n,a,s,c,l,u,p=0,f=!1,d=!1,y=!0;if("function"!=typeof e)throw new be(i);function h(t){var r=n,i=a;return n=a=o,p=t,c=e.apply(i,r)}function m(e){return p=e,l=Oi(E,t),f?h(e):c}function g(e){var r=e-u;return u===o||r>=t||r<0||d&&e-p>=s}function E(){var e=ba();if(g(e))return v(e);l=Oi(E,function(e){var r=t-(e-u);return d?gr(r,s-(e-p)):r}(e))}function v(e){return l=o,y&&n?h(e):(n=a=o,c)}function T(){var e=ba(),r=g(e);if(n=arguments,a=this,u=e,r){if(l===o)return m(u);if(d)return So(l),l=Oi(E,t),h(u)}return l===o&&(l=Oi(E,t)),c}return t=gs(t)||0,ts(r)&&(f=!!r.leading,s=(d="maxWait"in r)?mr(gs(r.maxWait)||0,t):s,y="trailing"in r?!!r.trailing:y),T.cancel=function(){l!==o&&So(l),p=0,n=u=a=l=o},T.flush=function(){return l===o?c:v(ba())},T}var xa=qn((function(e,t){return ln(e,1,t)})),La=qn((function(e,t,r){return ln(e,gs(t)||0,r)}));function ka(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new be(i);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=e.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(ka.Cache||$r),r}function Fa(e){if("function"!=typeof e)throw new be(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ka.Cache=$r;var Da=vo((function(e,t){var r=(t=1==t.length&&$a(t[0])?Ct(t[0],Vt(si())):Ct(mn(t,1),Vt(si()))).length;return qn((function(n){for(var o=-1,i=gr(n.length,r);++o=t})),Wa=On(function(){return arguments}())?On:function(e){return rs(e)&&xe.call(e,"callee")&&!et.call(e,"callee")},$a=n.isArray,Ha=pt?Vt(pt):function(e){return rs(e)&&An(e)==P};function Ya(e){return null!=e&&es(e.length)&&!Ka(e)}function qa(e){return rs(e)&&Ya(e)}var Qa=fr||gc,Xa=ft?Vt(ft):function(e){return rs(e)&&An(e)==E};function Ja(e){if(!rs(e))return!1;var t=An(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Ka(e){if(!ts(e))return!1;var t=An(e);return t==T||t==S||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function rs(e){return null!=e&&"object"==typeof e}var ns=dt?Vt(dt):function(e){return rs(e)&&di(e)==_};function os(e){return"number"==typeof e||rs(e)&&An(e)==N}function is(e){if(!rs(e)||An(e)!=A)return!1;var t=He(e);if(null===t)return!0;var r=xe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Me.call(r)==De}var as=yt?Vt(yt):function(e){return rs(e)&&An(e)==w},ss=ht?Vt(ht):function(e){return rs(e)&&di(e)==b};function cs(e){return"string"==typeof e||!$a(e)&&rs(e)&&An(e)==R}function ls(e){return"symbol"==typeof e||rs(e)&&An(e)==I}var us=mt?Vt(mt):function(e){return rs(e)&&es(e.length)&&!!Ke[An(e)]},ps=$o(Fn),fs=$o((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Ya(e))return cs(e)?ir(e):Ro(e);if(at&&e[at])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[at]());var t=di(e);return(t==_?Zt:t==b?rr:zs)(e)}function ys(e){return e?(e=gs(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hs(e){var t=ys(e),r=t%1;return t==t?r?t-r:t:0}function ms(e){return e?an(hs(e),0,d):0}function gs(e){if("number"==typeof e)return e;if(ls(e))return f;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=jt(e);var r=ye.test(e);return r||me.test(e)?rt(e.slice(2),r?2:8):de.test(e)?f:+e}function Es(e){return Io(e,xs(e))}function vs(e){return null==e?"":so(e)}var Ts=Po((function(e,t){if(_i(t)||Ya(t))Io(t,Ms(t),e);else for(var r in t)xe.call(t,r)&&Zr(e,r,t[r])})),Ss=Po((function(e,t){Io(t,xs(t),e)})),_s=Po((function(e,t,r,n){Io(t,xs(t),e,n)})),Ns=Po((function(e,t,r,n){Io(t,Ms(t),e,n)})),As=ti(on),Cs=qn((function(e,t){e=Ae(e);var r=-1,n=t.length,i=n>2?t[2]:o;for(i&&Ei(t[0],t[1],i)&&(n=1);++r1),t})),Io(e,ni(e),r),n&&(r=sn(r,7,Zo));for(var o=t.length;o--;)lo(r,t[o]);return r})),Ds=ti((function(e,t){return null==e?{}:function(e,t){return Vn(e,t,(function(t,r){return Rs(e,r)}))}(e,t)}));function Us(e,t){if(null==e)return{};var r=Ct(ni(e),(function(e){return[e]}));return t=si(t),Vn(e,r,(function(e,r){return t(e,r[0])}))}var Gs=Qo(Ms),Bs=Qo(xs);function zs(e){return null==e?[]:Wt(e,Ms(e))}var js=ko((function(e,t,r){return t=t.toLowerCase(),e+(r?Vs(t):t)}));function Vs(e){return Js(vs(e).toLowerCase())}function Ws(e){return(e=vs(e))&&e.replace(Ee,Qt).replace($e,"")}var $s=ko((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Hs=ko((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ys=Lo("toLowerCase"),qs=ko((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Qs=ko((function(e,t,r){return e+(r?" ":"")+Js(t)})),Xs=ko((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Js=Lo("toUpperCase");function Ks(e,t,r){return e=vs(e),(t=r?o:t)===o?function(e){return Qe.test(e)}(e)?function(e){return e.match(Ye)||[]}(e):function(e){return e.match(ce)||[]}(e):e.match(t)||[]}var Zs=qn((function(e,t){try{return gt(e,o,t)}catch(e){return Ja(e)?e:new Se(e)}})),ec=ti((function(e,t){return vt(t,(function(t){t=Ui(t),nn(e,t,Oa(e[t],e))})),e}));function tc(e){return function(){return e}}var rc=Uo(),nc=Uo(!0);function oc(e){return e}function ic(e){return Ln("function"==typeof e?e:sn(e,1))}var ac=qn((function(e,t){return function(r){return In(r,e,t)}})),sc=qn((function(e,t){return function(r){return In(e,r,t)}}));function cc(e,t,r){var n=Ms(t),o=Sn(t,n);null!=r||ts(t)&&(o.length||!n.length)||(r=t,t=e,e=this,o=Sn(t,Ms(t)));var i=!(ts(r)&&"chain"in r&&!r.chain),a=Ka(e);return vt(o,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=e(this.__wrapped__),o=r.__actions__=Ro(this.__actions__);return o.push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,wt([this.value()],arguments))})})),e}function lc(){}var uc=jo(Ct),pc=jo(St),fc=jo(It);function dc(e){return vi(e)?Dt(Ui(e)):function(e){return function(t){return _n(t,e)}}(e)}var yc=Wo(),hc=Wo(!0);function mc(){return[]}function gc(){return!1}var Ec,vc=zo((function(e,t){return e+t}),0),Tc=Yo("ceil"),Sc=zo((function(e,t){return e/t}),1),_c=Yo("floor"),Nc=zo((function(e,t){return e*t}),1),Ac=Yo("round"),Cc=zo((function(e,t){return e-t}),0);return Ur.after=function(e,t){if("function"!=typeof t)throw new be(i);return e=hs(e),function(){if(--e<1)return t.apply(this,arguments)}},Ur.ary=Ra,Ur.assign=Ts,Ur.assignIn=Ss,Ur.assignInWith=_s,Ur.assignWith=Ns,Ur.at=As,Ur.before=Ia,Ur.bind=Oa,Ur.bindAll=ec,Ur.bindKey=Pa,Ur.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return $a(e)?e:[e]},Ur.chain=da,Ur.chunk=function(e,t,r){t=(r?Ei(e,t,r):t===o)?1:mr(hs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=n(lr(i/t));ai?0:i+r),(n=n===o||n>i?i:hs(n))<0&&(n+=i),n=r>n?0:ms(n);r>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=so(t))&&Kt(e)?To(ir(e),0,r):e.split(t,r):[]},Ur.spread=function(e,t){if("function"!=typeof e)throw new be(i);return t=null==t?0:mr(hs(t),0),qn((function(r){var n=r[t],o=To(r,0,t);return n&&wt(o,n),gt(e,this,o)}))},Ur.tail=function(e){var t=null==e?0:e.length;return t?to(e,1,t):[]},Ur.take=function(e,t,r){return e&&e.length?to(e,0,(t=r||t===o?1:hs(t))<0?0:t):[]},Ur.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?to(e,(t=n-(t=r||t===o?1:hs(t)))<0?0:t,n):[]},Ur.takeRightWhile=function(e,t){return e&&e.length?po(e,si(t,3),!1,!0):[]},Ur.takeWhile=function(e,t){return e&&e.length?po(e,si(t,3)):[]},Ur.tap=function(e,t){return t(e),e},Ur.throttle=function(e,t,r){var n=!0,o=!0;if("function"!=typeof e)throw new be(i);return ts(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),Ma(e,t,{leading:n,maxWait:t,trailing:o})},Ur.thru=ya,Ur.toArray=ds,Ur.toPairs=Gs,Ur.toPairsIn=Bs,Ur.toPath=function(e){return $a(e)?Ct(e,Ui):ls(e)?[e]:Ro(Di(vs(e)))},Ur.toPlainObject=Es,Ur.transform=function(e,t,r){var n=$a(e),o=n||Qa(e)||us(e);if(t=si(t,4),null==r){var i=e&&e.constructor;r=o?n?new i:[]:ts(e)&&Ka(i)?Gr(He(e)):{}}return(o?vt:vn)(e,(function(e,n,o){return t(r,e,n,o)})),r},Ur.unary=function(e){return Ra(e,1)},Ur.union=ra,Ur.unionBy=na,Ur.unionWith=oa,Ur.uniq=function(e){return e&&e.length?co(e):[]},Ur.uniqBy=function(e,t){return e&&e.length?co(e,si(t,2)):[]},Ur.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?co(e,o,t):[]},Ur.unset=function(e,t){return null==e||lo(e,t)},Ur.unzip=ia,Ur.unzipWith=aa,Ur.update=function(e,t,r){return null==e?e:uo(e,t,go(r))},Ur.updateWith=function(e,t,r,n){return n="function"==typeof n?n:o,null==e?e:uo(e,t,go(r),n)},Ur.values=zs,Ur.valuesIn=function(e){return null==e?[]:Wt(e,xs(e))},Ur.without=sa,Ur.words=Ks,Ur.wrap=function(e,t){return Ua(go(t),e)},Ur.xor=ca,Ur.xorBy=la,Ur.xorWith=ua,Ur.zip=pa,Ur.zipObject=function(e,t){return ho(e||[],t||[],Zr)},Ur.zipObjectDeep=function(e,t){return ho(e||[],t||[],Jn)},Ur.zipWith=fa,Ur.entries=Gs,Ur.entriesIn=Bs,Ur.extend=Ss,Ur.extendWith=_s,cc(Ur,Ur),Ur.add=vc,Ur.attempt=Zs,Ur.camelCase=js,Ur.capitalize=Vs,Ur.ceil=Tc,Ur.clamp=function(e,t,r){return r===o&&(r=t,t=o),r!==o&&(r=(r=gs(r))==r?r:0),t!==o&&(t=(t=gs(t))==t?t:0),an(gs(e),t,r)},Ur.clone=function(e){return sn(e,4)},Ur.cloneDeep=function(e){return sn(e,5)},Ur.cloneDeepWith=function(e,t){return sn(e,5,t="function"==typeof t?t:o)},Ur.cloneWith=function(e,t){return sn(e,4,t="function"==typeof t?t:o)},Ur.conformsTo=function(e,t){return null==t||cn(e,t,Ms(t))},Ur.deburr=Ws,Ur.defaultTo=function(e,t){return null==e||e!=e?t:e},Ur.divide=Sc,Ur.endsWith=function(e,t,r){e=vs(e),t=so(t);var n=e.length,i=r=r===o?n:an(hs(r),0,n);return(r-=t.length)>=0&&e.slice(r,i)==t},Ur.eq=za,Ur.escape=function(e){return(e=vs(e))&&q.test(e)?e.replace(H,Xt):e},Ur.escapeRegExp=function(e){return(e=vs(e))&&re.test(e)?e.replace(te,"\\$&"):e},Ur.every=function(e,t,r){var n=$a(e)?St:dn;return r&&Ei(e,t,r)&&(t=o),n(e,si(t,3))},Ur.find=ga,Ur.findIndex=Wi,Ur.findKey=function(e,t){return Pt(e,si(t,3),vn)},Ur.findLast=Ea,Ur.findLastIndex=$i,Ur.findLastKey=function(e,t){return Pt(e,si(t,3),Tn)},Ur.floor=_c,Ur.forEach=va,Ur.forEachRight=Ta,Ur.forIn=function(e,t){return null==e?e:gn(e,si(t,3),xs)},Ur.forInRight=function(e,t){return null==e?e:En(e,si(t,3),xs)},Ur.forOwn=function(e,t){return e&&vn(e,si(t,3))},Ur.forOwnRight=function(e,t){return e&&Tn(e,si(t,3))},Ur.get=bs,Ur.gt=ja,Ur.gte=Va,Ur.has=function(e,t){return null!=e&&yi(e,t,wn)},Ur.hasIn=Rs,Ur.head=Yi,Ur.identity=oc,Ur.includes=function(e,t,r,n){e=Ya(e)?e:zs(e),r=r&&!n?hs(r):0;var o=e.length;return r<0&&(r=mr(o+r,0)),cs(e)?r<=o&&e.indexOf(t,r)>-1:!!o&&xt(e,t,r)>-1},Ur.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=null==r?0:hs(r);return o<0&&(o=mr(n+o,0)),xt(e,t,o)},Ur.inRange=function(e,t,r){return t=ys(t),r===o?(r=t,t=0):r=ys(r),function(e,t,r){return e>=gr(t,r)&&e=-9007199254740991&&e<=p},Ur.isSet=ss,Ur.isString=cs,Ur.isSymbol=ls,Ur.isTypedArray=us,Ur.isUndefined=function(e){return e===o},Ur.isWeakMap=function(e){return rs(e)&&di(e)==O},Ur.isWeakSet=function(e){return rs(e)&&"[object WeakSet]"==An(e)},Ur.join=function(e,t){return null==e?"":yr.call(e,t)},Ur.kebabCase=$s,Ur.last=Ji,Ur.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n;return r!==o&&(i=(i=hs(r))<0?mr(n+i,0):gr(i,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,i):Mt(e,kt,i,!0)},Ur.lowerCase=Hs,Ur.lowerFirst=Ys,Ur.lt=ps,Ur.lte=fs,Ur.max=function(e){return e&&e.length?yn(e,oc,Cn):o},Ur.maxBy=function(e,t){return e&&e.length?yn(e,si(t,2),Cn):o},Ur.mean=function(e){return Ft(e,oc)},Ur.meanBy=function(e,t){return Ft(e,si(t,2))},Ur.min=function(e){return e&&e.length?yn(e,oc,Fn):o},Ur.minBy=function(e,t){return e&&e.length?yn(e,si(t,2),Fn):o},Ur.stubArray=mc,Ur.stubFalse=gc,Ur.stubObject=function(){return{}},Ur.stubString=function(){return""},Ur.stubTrue=function(){return!0},Ur.multiply=Nc,Ur.nth=function(e,t){return e&&e.length?zn(e,hs(t)):o},Ur.noConflict=function(){return it._===this&&(it._=Ue),this},Ur.noop=lc,Ur.now=ba,Ur.pad=function(e,t,r){e=vs(e);var n=(t=hs(t))?or(e):0;if(!t||n>=t)return e;var o=(t-n)/2;return Vo(ur(o),r)+e+Vo(lr(o),r)},Ur.padEnd=function(e,t,r){e=vs(e);var n=(t=hs(t))?or(e):0;return t&&nt){var n=e;e=t,t=n}if(r||e%1||t%1){var i=Tr();return gr(e+i*(t-e+tt("1e-"+((i+"").length-1))),t)}return Hn(e,t)},Ur.reduce=function(e,t,r){var n=$a(e)?bt:Gt,o=arguments.length<3;return n(e,si(t,4),r,o,pn)},Ur.reduceRight=function(e,t,r){var n=$a(e)?Rt:Gt,o=arguments.length<3;return n(e,si(t,4),r,o,fn)},Ur.repeat=function(e,t,r){return t=(r?Ei(e,t,r):t===o)?1:hs(t),Yn(vs(e),t)},Ur.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ur.result=function(e,t,r){var n=-1,i=(t=Eo(t,e)).length;for(i||(i=1,e=o);++np)return[];var r=d,n=gr(e,d);t=si(t),e-=d;for(var o=zt(n,t);++r=a)return e;var c=r-or(n);if(c<1)return n;var l=s?To(s,0,c).join(""):e.slice(0,c);if(i===o)return l+n;if(s&&(c+=l.length-c),as(i)){if(e.slice(c).search(i)){var u,p=l;for(i.global||(i=Ce(i.source,vs(fe.exec(i))+"g")),i.lastIndex=0;u=i.exec(p);)var f=u.index;l=l.slice(0,f===o?c:f)}}else if(e.indexOf(so(i),c)!=c){var d=l.lastIndexOf(i);d>-1&&(l=l.slice(0,d))}return l+n},Ur.unescape=function(e){return(e=vs(e))&&Y.test(e)?e.replace($,sr):e},Ur.uniqueId=function(e){var t=++Le;return vs(e)+t},Ur.upperCase=Xs,Ur.upperFirst=Js,Ur.each=va,Ur.eachRight=Ta,Ur.first=Yi,cc(Ur,(Ec={},vn(Ur,(function(e,t){xe.call(Ur.prototype,t)||(Ec[t]=e)})),Ec),{chain:!1}),Ur.VERSION="4.17.21",vt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ur[e].placeholder=Ur})),vt(["drop","take"],(function(e,t){jr.prototype[e]=function(r){r=r===o?1:mr(hs(r),0);var n=this.__filtered__&&!t?new jr(this):this.clone();return n.__filtered__?n.__takeCount__=gr(r,n.__takeCount__):n.__views__.push({size:gr(r,d),type:e+(n.__dir__<0?"Right":"")}),n},jr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),vt(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;jr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:si(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),vt(["head","last"],(function(e,t){var r="take"+(t?"Right":"");jr.prototype[e]=function(){return this[r](1).value()[0]}})),vt(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");jr.prototype[e]=function(){return this.__filtered__?new jr(this):this[r](1)}})),jr.prototype.compact=function(){return this.filter(oc)},jr.prototype.find=function(e){return this.filter(e).head()},jr.prototype.findLast=function(e){return this.reverse().find(e)},jr.prototype.invokeMap=qn((function(e,t){return"function"==typeof e?new jr(this):this.map((function(r){return In(r,e,t)}))})),jr.prototype.reject=function(e){return this.filter(Fa(si(e)))},jr.prototype.slice=function(e,t){e=hs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new jr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(r=(t=hs(t))<0?r.dropRight(-t):r.take(t-e)),r)},jr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},jr.prototype.toArray=function(){return this.take(d)},vn(jr.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),i=Ur[n?"take"+("last"==t?"Right":""):t],a=n||/^find/.test(t);i&&(Ur.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,c=t instanceof jr,l=s[0],u=c||$a(t),p=function(e){var t=i.apply(Ur,wt([e],s));return n&&f?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var f=this.__chain__,d=!!this.__actions__.length,y=a&&!f,h=c&&!d;if(!a&&u){t=h?t:new jr(this);var m=e.apply(t,s);return m.__actions__.push({func:ya,args:[p],thisArg:o}),new zr(m,f)}return y&&h?e.apply(this,s):(m=this.thru(p),y?n?m.value()[0]:m.value():m)})})),vt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Re[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ur.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var o=this.value();return t.apply($a(o)?o:[],e)}return this[r]((function(r){return t.apply($a(r)?r:[],e)}))}})),vn(jr.prototype,(function(e,t){var r=Ur[t];if(r){var n=r.name+"";xe.call(Ir,n)||(Ir[n]=[]),Ir[n].push({name:t,func:r})}})),Ir[Go(o,2).name]=[{name:"wrapper",func:o}],jr.prototype.clone=function(){var e=new jr(this.__wrapped__);return e.__actions__=Ro(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ro(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ro(this.__views__),e},jr.prototype.reverse=function(){if(this.__filtered__){var e=new jr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},jr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=$a(e),n=t<0,o=r?e.length:0,i=function(e,t,r){for(var n=-1,o=r.length;++n=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},Ur.prototype.plant=function(e){for(var t,r=this;r instanceof Br;){var n=Bi(r);n.__index__=0,n.__values__=o,t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t},Ur.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof jr){var t=e;return this.__actions__.length&&(t=new jr(this)),(t=t.reverse()).__actions__.push({func:ya,args:[ta],thisArg:o}),new zr(t,this.__chain__)}return this.thru(ta)},Ur.prototype.toJSON=Ur.prototype.valueOf=Ur.prototype.value=function(){return fo(this.__wrapped__,this.__actions__)},Ur.prototype.first=Ur.prototype.head,at&&(Ur.prototype[at]=function(){return this}),Ur}();it._=cr,(n=function(){return cr}.call(t,r,t,e))===o||(e.exports=n)}.call(this)},904:(e,t)=>{"use strict";var r;let n;Object.defineProperty(t,"__esModule",{value:!0}),t.setDomain=t.getDomain=t.Domain=void 0,function(e){e[e.FA=0]="FA",e[e.FORM=1]="FORM",e[e.ETS=2]="ETS"}(r||(r={})),t.Domain=r,t.setDomain=e=>{n=e},t.getDomain=()=>null!=n?n:r.FA},784:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorMap=void 0,t.errorMap=new Map([["fileError","Visual file is damaged"],["versionError","Version number of visual file does not match"],["modelError","Visual model in visual file is damaged"],["codegenError","Codegen visual file failed"]])},117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNode=void 0,t.ASTNode=class{accept(e){return e.visit(this)}}},862:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cache=void 0,t.Cache=class{constructor(e,t=0){this.value="",this.indent=t,this.flag=!0,this.INDENT=e}indentOn(){this.flag=!0}indentOff(){this.flag=!1}incIndent(){this.indent++}decIndent(){this.indent--}checkIndent(){return this.indent<0}getIndents(){if(this.flag){let e="";for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;const n=r(117);class o extends n.ASTNode{constructor(e,t,r,n,o){super(),this.defaultValue=new Map,this.mediaParams=new Map,this.mediaProperties=new Map,this.mediaKeyProperty=new Map,this.tagName=e,this.params=t,this.content=r,this.properties=n,this.forEachObj=o,this.ifBoolean=null}setMediaParams(e){this.mediaParams=e}setParams(e){this.params=e}setIfBoolean(e){this.ifBoolean=e}setTagName(e){this.tagName=e}setForEachObj(e){this.forEachObj=e}setMediaProperty(e,t){t.forEach(((t,r)=>{var n;this.mediaKeyProperty.has(r)||this.mediaKeyProperty.set(r,new Map),null===(n=this.mediaKeyProperty.get(r))||void 0===n||n.set(e,t)}))}setDefaultValue(e,t,r="undefined"){this.defaultValue.set(e,[r,t])}}t.Tag=o},623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const n=r(519),o=r(862),i=r(51),a=r(294);class s{constructor(e){this.cache=e,this.etsImport=new o.Cache(" ",1),this.etsVariable=new o.Cache(" ",1),this.etsFunction=new o.Cache(" ",1),this.aboutToAppear=new o.Cache(" ",2),this.needMediaQuery=!0}visit(e){e instanceof n.Tag&&(this.needMediaQuery&&this.genMediaQuery(e),this.genTag(e))}static getMethodGen(e){return void 0===s.instance?s.instance=new s(e):s.instance.setCache(e),s.instance}setCache(e){this.cache=e,this.etsImport=new o.Cache(" ",1),this.etsVariable=new o.Cache(" ",1),this.etsFunction=new o.Cache(" ",1),this.aboutToAppear=new o.Cache(" ",2),this.needMediaQuery=!0}genParams(e){if("string"==typeof e)this.cache.concat(e);else if(e.size>0){this.cache.concat(i.TokenClass.LBRA,i.TokenClass.SPACE);let t=0;e.forEach(((r,n)=>{this.cache.concat(n,i.TokenClass.COLON,i.TokenClass.SPACE,r),t++,t{this.cache.concat(n,i.TokenClass.COLON,i.TokenClass.SPACE,r),t++,t{e.accept(this),this.cache.indentOff(),this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn()),this.cache.indentOn(),this.cache.concat(i.TokenClass.RBRA)),(null!==e.properties||null!==e.mediaProperties)&&(null!==e.content&&0!==e.content.length||this.cache.incIndent(),this.getProperties(e).forEach(((e,t)=>{this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(i.TokenClass.PROPERTY_START,t,i.TokenClass.TAG_START),this.cache.indentOff(),"string"==typeof e?this.cache.concat(e,i.TokenClass.TAG_END):this.genObjectProperty(e)})),null!==e.content&&0!==e.content.length||this.cache.decIndent()),this.genEnd(e)}genStart(e){this.genIfStart(e),this.genForTagStart(e)}genEnd(e){this.genForTagEnd(e),this.genIfEnd(e)}genForTagStart(e){var t;void 0!==(null===(t=e.forEachObj)||void 0===t?void 0:t.for)&&(this.cache.concat("ForEach",i.TokenClass.TAG_START,e.forEachObj.for.toString(),i.TokenClass.COMMA,i.TokenClass.NEW_LINE),this.cache.concat(i.TokenClass.TAG_START,e.forEachObj.item,i.TokenClass.COLON," any",i.TokenClass.COMMA," ",e.forEachObj.idx,i.TokenClass.COLON," number",i.TokenClass.TAG_END," => ",i.TokenClass.LBRA,i.TokenClass.NEW_LINE))}genForTagEnd(e){null!==e.forEachObj&&(this.cache.concat(i.TokenClass.RBRA),void 0!==e.forEachObj.key&&""!==e.forEachObj.key&&(this.cache.concat(i.TokenClass.COMMA,i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(i.TokenClass.TAG_START,e.forEachObj.item,i.TokenClass.COLON," any",i.TokenClass.COMMA," ",e.forEachObj.idx,i.TokenClass.COLON," number",i.TokenClass.TAG_END," => ",i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.concat("return ",e.forEachObj.key.toString(),i.TokenClass.TAG_START,e.forEachObj.item,i.TokenClass.COMMA," ",e.forEachObj.idx,i.TokenClass.TAG_END,i.TokenClass.RBRA),this.cache.indentOff()),this.cache.concat(i.TokenClass.TAG_END))}genIfStart(e){null!==e.ifBoolean&&(this.cache.concat("if",i.TokenClass.SPACE,i.TokenClass.TAG_START,e.ifBoolean.toString(),i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.incIndent())}genIfEnd(e){null!==e.ifBoolean&&(this.cache.indentOn(),this.cache.decIndent(),this.cache.concat(i.TokenClass.NEW_LINE),this.cache.concat(i.TokenClass.RBRA),this.cache.indentOff())}genMediaQuery(e){const t=new Map,r=new Map;if(this.collectMediaQueryMap(e,t),this.collectDefaultValueMap(e,r),0===t.size&&0===r.size)return;const n=(0,a.getUniqueName)("mediaQuery"),s=(0,a.getUniqueName)("initForMediaQuery"),c=(0,a.getUniqueName)("mediaQueryCb"),l=(0,a.getUniqueName)("saveMediaQueryResult"),u=(0,a.getUniqueName)("updateForMediaQuery"),p=new o.Cache(i.TokenClass.INDENT,1),f=new o.Cache(i.TokenClass.INDENT,1),d=new o.Cache(i.TokenClass.INDENT,1),y=new o.Cache(i.TokenClass.INDENT,1),h=new o.Cache(i.TokenClass.INDENT,1),m=new o.Cache(i.TokenClass.INDENT,1),g=new o.Cache(i.TokenClass.INDENT,1),E=new o.Cache(i.TokenClass.INDENT,2);this.genVariableDeclare(r,p),this.genMediaQueryCb(c,f),this.genMediaQueryListener(t,d,y),this.genInitFuc(s,r,h),this.genMediaQueryCbFnc(l,u,t,m),this.genUpdateFnc(u,s,t,g),this.genAboutToAppear(c,l,t,E),this.etsImport.indentOff(),this.aboutToAppear.indentOff(),this.etsVariable.indentOff(),this.etsFunction.indentOff(),this.etsImport.indentOff(),this.etsImport.concat("import ",n," from '@ohos.mediaquery'"),this.aboutToAppear.concat(E.toString()),this.etsVariable.concat(p.toString(),f.toString(),d.toString(),y.toString()),this.etsFunction.concat(m.toString(),i.TokenClass.NEW_LINE,h.toString(),i.TokenClass.NEW_LINE,g.toString()),this.etsImport.indentOn(),this.aboutToAppear.indentOn(),this.etsVariable.indentOn(),this.etsFunction.indentOn(),this.needMediaQuery=!1}genVariableDeclare(e,t){e.forEach(((e,r)=>{t.concat(i.TokenClass.DECORATOR_STATE,i.TokenClass.SPACE,r.slice(5),i.TokenClass.COLON,i.TokenClass.SPACE,e[1],i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.UNDEFINED,i.TokenClass.NEW_LINE)}))}genMediaQueryCb(e,t){t.concat(e,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.NULL,i.TokenClass.NEW_LINE)}genMediaQueryListener(e,t,r){const n=(0,a.getUniqueName)("mediaQuery");e.forEach(((e,o)=>{const s=(0,a.getUniqueName)(this.getMediaQueryVariableName(o));t.concat(s,i.TokenClass.COLON,i.TokenClass.SPACE,i.TokenClass.BOOLEAN,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.FALSE,i.TokenClass.NEW_LINE),r.concat(`listener_${s}`,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,n,i.TokenClass.PROPERTY_START,"matchMediaSync",i.TokenClass.TAG_START,`'${o}'`,i.TokenClass.TAG_END,i.TokenClass.NEW_LINE)}))}genInitFuc(e,t,r){r.concat(e,i.TokenClass.TAG_START,i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),r.indentOn(),r.incIndent(),t.forEach(((e,t)=>{r.concat(t,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,e[0],i.TokenClass.NEW_LINE)})),r.decIndent(),r.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)}genMediaQueryCbFnc(e,t,r,n){const o=Array.from(r.entries());n.concat(e,i.TokenClass.TAG_START,"mediaQueryResult",i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),n.incIndent(),n.concat(i.TokenClass.SWITCH,i.TokenClass.SPACE,i.TokenClass.TAG_START,"mediaQueryResult.media",i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),n.incIndent();for(let e=0;e{const r=(0,a.getUniqueName)(this.getMediaQueryVariableName(t));n.concat(i.TokenClass.IF,i.TokenClass.SPACE,i.TokenClass.TAG_START,i.TokenClass.THIS,i.TokenClass.PROPERTY_START,r,i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),n.incIndent(),e.forEach(((e,t)=>{n.concat(t,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,e,i.TokenClass.NEW_LINE)})),n.decIndent(),n.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)})),n.decIndent(),n.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)}genAboutToAppear(e,t,r,n){let o=1;n.concat(i.TokenClass.THIS,i.TokenClass.PROPERTY_START,e,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.THIS,i.TokenClass.PROPERTY_START,`${t}.bind(this)`,i.TokenClass.NEW_LINE),r.forEach(((t,s)=>{const c=`listener_${(0,a.getUniqueName)(this.getMediaQueryVariableName(s))}`;n.indentOn(),n.concat(i.TokenClass.THIS,i.TokenClass.PROPERTY_START,c,i.TokenClass.PROPERTY_START,`on('change', this.${e})`),o0?e.mediaParams:e.params}getProperties(e){const t=new Map;return e.properties.forEach(((e,r)=>{t.set(r,e)})),e.mediaProperties.forEach(((e,r)=>{t.set(r,e)})),t}collectDefaultValueMap(e,t){void 0!==e.defaultValue&&e.defaultValue.forEach(((e,r)=>{t.set(r,e)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectDefaultValueMap(e,t)}))}collectMediaQueryMap(e,t){void 0!==e.mediaKeyProperty&&e.mediaKeyProperty.forEach(((e,r)=>{var n;const o=null!==(n=t.get(r))&&void 0!==n?n:new Map;e.forEach(((e,t)=>{o.set(t,e)})),t.set(r,o)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectMediaQueryMap(e,t)}))}getMediaQueryVariableName(e){const t="device-type: ",r="orientation: ",n=e.substring(e.indexOf(t),e.length),o=n.substring(t.length,n.indexOf(")")),i=e.substring(e.indexOf(r),e.length),a=i.substring(r.length,i.indexOf(")"));return`${o}${a.slice(0,1).toUpperCase()+a.slice(1).toLowerCase()}`}}t.ASTNodeGenerator=s,s.instance=void 0},413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ETSBridge=void 0;const n=r(519),o=r(973),i=r(497);t.ETSBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map;let r=null;const a=new Map,s=new n.Tag(e.type,t,r,a,null);if((0,o.parseVisualModel)(e,s),(0,i.parseMediaVisualModel)(e,s),e.children.length>0){r=[];for(const t of e.children)r.push(t.accept(this))}return s.content=r,s}}},459:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genETS=void 0;const n=r(623),o=r(862);t.genETS=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" ",2));return e.accept(t),{build:t.cache.toString(),etsImport:t.etsImport.toString(),etsVariable:t.etsVariable.toString(),etsFunction:t.etsFunction.toString(),aboutToAppear:t.aboutToAppear.toString()}}},435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringWriter=void 0;const n=r(459);t.StringWriter=class{genETS(e){return(0,n.genETS)(e)}}},51:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(r=t.TokenClass||(t.TokenClass={}))[r.IDENTIFIER=0]="IDENTIFIER",r[r.STRING_LITERAL=1]="STRING_LITERAL",r[r.NUMBER=2]="NUMBER",r[r.CHARACTER=3]="CHARACTER",r[r.EOF=4]="EOF",r[r.INVALID=5]="INVALID",r.EMPTY_DATA="empty",r.ASSIGN="=",r.INDENT=" ",r.NEW_LINE="\n",r.CARRIAGE_RETURN="\r",r.SPACE=" ",r.LQUOTE="'",r.RQUOTE="'",r.TAG_START="(",r.TAG_END=")",r.EMPTY_TAG_END="/>",r.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMediaProperty=t.parseMediaVisualModel=void 0;const n=r(294),o=r(973),i=r(290),a=(0,o.curry)(((e,t)=>t.hasMediaProperty(e))),s=(0,o.curry)(((e,t,r)=>r.type===e&&r.hasMediaProperty(t)));function c(e){const t=e+"-visual",r=i.etsPropertyList;let n="";for(const e of r)void 0!==e.propertySet.properties&&(n=l(t,e.propertySet.properties)),e.propertySet.property===t&&(n=e.propertySet.etsType);return function(e=""){const t=new Map([["ETSBoolean","boolean"],["ETSNumber","number"],["ETSString","string"],["Rfloat","Resource"],["Rstring","Resource"],["Rcolor","Resource"],["Rmedia","Resource"],["Rrawfile","Resource"],["ETSArray","any[]"]]),r=new Array;return e.split("|").forEach((e=>{const n=t.get(e);"Resource"!==n&&r.push(null!=n?n:e)})),r.join(" | ")}(n)}function l(e,t){for(const r of t)if(r.property===e)return r.etsType;return""}function u(e,t,r){const n=t.get(r);return void 0!==n&&n.has(e)}function p(e){return`'${e}'`}function f(e){return isNaN(Number(e))?(0,o.getEtsEnumValue)("FontWeight.",e):e}function d(e){let t=(0,o.getEtsEnumValue)("FlexAlign.",e);return"flex-start"===e?t="FlexAlign.Start":"flex-end"===e&&(t="FlexAlign.End"),t}function y(e){return"TextOverflow."+(0,o.firstUpperCase)(e)}function h(e,t,r){var n,i;const a=new Map,s=null!==(n=e.mediaProperty)&&void 0!==n?n:new Map,c=null!==(i=e.dynamicMediaProperty)&&void 0!==i?i:new Map;return s.forEach(((e,n)=>{let i=e.get(t);const s=e.get(r);(0,o.isEmptyOrUndefined)(i)&&(0,o.isEmptyOrUndefined)(s)||(i="0"===i||(0,o.isEmptyOrUndefined)(i)?"0":i.substring(0,i.length-2),a.set(n,i))})),c.forEach(((e,r)=>{const n=e.get(t);(0,o.isEmptyOrUndefined)(n)||a.set(r,n)})),a}function m(e,t){const r=e.get("left"),n=e.get("top"),i=t.get("left"),a=t.get("top");let s="undefined",c="undefined";return(0,o.isEmptyOrUndefined)(r)&&(0,o.isEmptyOrUndefined)(n)||(s=`'${null!=r?r:0}'`,c=`'${null!=n?n:0}'`),(0,o.isEmptyOrUndefined)(i)&&(0,o.isEmptyOrUndefined)(a)||(s=null!=i?i:s,c=null!=a?a:c),{leftValue:s,topValue:c}}function g(e,t){e.forEach(((e,r)=>{"undefined"!==e&&t.set(r,"undefined")}))}function E(e,t){var r,n;const o=new Map,i=t.split("-")[0];return(null!==(r=e.mediaProperty)&&void 0!==r?r:new Map).forEach(((r,n)=>{var a,s,c,l;const u=r.get(i),f=null===(s=null===(a=e.dynamicMediaProperty)||void 0===a?void 0:a.get(n))||void 0===s?void 0:s.get(i),d=null!==(l=null!==(c=r.get(t))&&void 0!==c?c:f)&&void 0!==l?l:u;void 0!==d&&o.set(n,p(d))})),(null!==(n=e.dynamicMediaProperty)&&void 0!==n?n:new Map).forEach(((e,r)=>{var n;const a=e.get(i),s=null!==(n=e.get(t))&&void 0!==n?n:a;void 0!==s&&o.set(r,s)})),o}function v(e,t,r){var n,i;const a=new Map;return(null!==(n=e.mediaProperty)&&void 0!==n?n:new Map).forEach(((e,n)=>{let i=e.get(t);(0,o.isEmptyOrUndefined)(i)||("function"==typeof r&&(i=r(i)),(0,o.isEmptyOrUndefined)(i)||a.set(n,i))})),(null!==(i=e.dynamicMediaProperty)&&void 0!==i?i:new Map).forEach(((e,r)=>{let n=e.get(t);void 0===n||"content"!==t&&"label"!==t||(n=(0,o.getContentName)(n)),(0,o.isEmptyOrUndefined)(n)||a.set(r,n)})),a}function T(e,t){const r=`this.${(0,o.getEtsPropName)(e)}${(0,o.firstUpperCase)((0,o.getEtsPropName)(t))}`;return`${r}_${(0,n.getUniqueId)(r)}`}function S(e,t,r){var n;const i=e.property.get(t),a=e.dynamicProperty.get(t);let s=null!==(n=new Map([["if","true"],["auto-play","false"],["interval","3000"]]).get(t))&&void 0!==n?n:"undefined";return(0,o.isEmptyOrUndefined)(i)||(s="function"==typeof r?r(i):i,s=(0,o.isEmptyOrUndefined)(s)?"undefined":s),(0,o.isEmptyOrUndefined)(a)||(s=a),s}const _=(0,o.curry)(((e,t,r)=>{const n=v(t,e,p);if(0===n.size)return;const i=S(t,e,p),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)})),N=(0,o.curry)(((e,t,r)=>{const n=v(t,e);if(0===n.size)return;const i=S(t,e),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)})),A=(0,o.curry)(((e,t,r)=>{const n=v(t,e);if(0===n.size)return;const i=S(t,e),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)})),C=(0,o.curry)(((e,t,r,n)=>{const i=v(r,e,(0,o.curry)(o.getEtsEnumValue)(t));if(0===i.size)return;const a=S(r,e,(0,o.curry)(o.getEtsEnumValue)(t)),s=T(r.id,e);n.setDefaultValue(s,c(e),a),n.setMediaProperty(s,i),n.mediaProperties.set((0,o.getEtsPropName)(e),s)})),w=(0,o.curry)(((e,t,r)=>{const n=v(t,e,p);if(!(r.mediaParams instanceof Map)||0===n.size)return;const i=S(t,e,p),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaParams.set((0,o.getEtsPropName)(e),a)})),b=(0,o.curry)(((e,t,r)=>{const n=v(t,e);if(!(r.mediaParams instanceof Map)||0===n.size)return;const i=S(t,e),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaParams.set((0,o.getEtsPropName)(e),a)})),R=(0,o.curry)(((e,t,r,n)=>{const i=v(r,e,(0,o.curry)(o.getEtsEnumValue)(t));if(!(n.mediaParams instanceof Map)||0===i.size)return;const a=S(r,e,(0,o.curry)(o.getEtsEnumValue)(t)),s=T(r.id,e);n.setDefaultValue(s,c(e),a),n.setMediaProperty(s,i),n.mediaParams.set((0,o.getEtsPropName)(e),s)})),I=(0,o.curry)(((e,t,r)=>{const n=v(t,e,o.dealWithColor);if(0===n.size)return;const i=S(t,e,o.dealWithColor),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)}));function O(e,t,r,n=!1){(0,o.isEmptyOrUndefined)(t)||r.set(e,n?t:`'${t}'`)}t.parseMediaVisualModel=function(e,t){!function(e,t){var r,n,o;const i=null!==(r=e.dynamicProperty.get("for"))&&void 0!==r?r:"[1]",a=null!==(n=e.property.get("item"))&&void 0!==n?n:"item",s=null!==(o=e.property.get("idx"))&&void 0!==o?o:"idx",l=e.dynamicProperty.get("keyGenerator"),u=v(e,"for");if(0===u.size)return;const p=T(e.id,"for"),f={for:p,key:l,item:a,idx:s};t.setDefaultValue(p,c("for"),i),t.setMediaProperty(p,u),t.setForEachObj(f)}(e,t),function(e,t){const r=v(e,"if");if(0===r.size)return;const n=S(e,"if"),o=T(e.id,"if");t.setDefaultValue(o,c("if"),n),t.setMediaProperty(o,r),t.setIfBoolean(o)}(e,t);for(const r of k)("boolean"==typeof r[0]||r[0](e))&&r[1](e,t)};const P=(0,o.curry)(((e,t,r)=>{const n=new Map,i=t.property.get(e),a=t.dynamicProperty.get(e),s=null!=a?a:i,l=["top","bottom","left","right"];let u=0;for(const i of l){const a=`${e}-${i}`,l=t.property.get(a),f=t.dynamicProperty.get(a),d=E(t,a);let y=(0,o.isEmptyOrUndefined)(s)?"undefined":p(s);if((0,o.isEmptyOrUndefined)(l)||(y=p(l)),(0,o.isEmptyOrUndefined)(f)||(y=f),d.size>0){const e=T(t.id,a);r.setDefaultValue(e,c(a),y),r.setMediaProperty(e,d),O(i,e,n,!0),u++}else O(i,y,n,!0)}u>0&&r.mediaProperties.set(e,n)})),M=(0,o.curry)(((e,t,r,n)=>{const i=v(r,e,d);if(!(n.mediaParams instanceof Map)||0===i.size)return;const a=S(r,e,d),s=T(r.id,e);n.setDefaultValue(s,c(e),a),n.setMediaProperty(s,i),n.mediaParams.set((0,o.getEtsPropName)(e),s)})),x=(0,o.curry)(((e,t)=>t.type===e));t.isMediaProperty=function(e,t){return!u(e,L,"common")&&!u(e,L,t)&&!u(e,L,"events")};const L=new Map([["common",new Set(["keyGenerator","item","idx"])],["events",new Set([...o.events])]]),k=[...[[a("width"),_("width")],[a("height"),_("height")],[function(e){return e.hasMediaProperty("constraint-size-min-width")||e.hasMediaProperty("constraint-size-max-width")||e.hasMediaProperty("constraint-size-min-height")||e.hasMediaProperty("constraint-size-min-height")},function(e,t){const r=new Map,n=["min-width","max-width","min-height","max-height"];for(const i of n){const n=`constraint-size-${i}`,a=v(e,n,p),s=S(e,n,p);if(a.size>0){const l=T(e.id,n);t.setDefaultValue(l,c(n),s),t.setMediaProperty(l,a),O((0,o.getEtsPropName)(i),l,r,!0)}}r.size>0&&t.mediaProperties.set("constraintSize",r)}],[a("align"),C("align","Alignment.")],[a("direction"),C("direction","Direction.")],[function(e){return e.hasMediaProperty("left")||e.hasMediaProperty("top")},function(e,t){var r;const n=null!==(r=e.property.get("position"))&&void 0!==r?r:"relative",{leftValue:o,topValue:i}=m(e.property,e.dynamicProperty),{mediaPositionLeft:a,mediaPositionTop:s,mediaOffsetLeft:l,mediaOffsetTop:u}=function(e){var t,r;const n=new Map,o=new Map,i=new Map,a=new Map,s=null!==(t=e.mediaProperty)&&void 0!==t?t:new Map,c=null!==(r=e.dynamicMediaProperty)&&void 0!==r?r:new Map,l=new Set;for(const[e]of s)l.add(e);for(const[e]of c)l.add(e);return l.forEach((t=>{var r,s,c,l;const u=null!==(s=null===(r=e.mediaProperty)||void 0===r?void 0:r.get(t))&&void 0!==s?s:new Map,p=null!==(l=null===(c=e.dynamicMediaProperty)||void 0===c?void 0:c.get(t))&&void 0!==l?l:new Map,f=u.get("position"),{leftValue:d,topValue:y}=m(u,p);"absolute"===f?("undefined"!==d&&n.set(t,d),"undefined"!==y&&o.set(t,y)):("undefined"!==d&&i.set(t,d),"undefined"!==y&&a.set(t,y))})),{mediaPositionLeft:n,mediaPositionTop:o,mediaOffsetLeft:i,mediaOffsetTop:a}}(e),p=a.size>0||s.size>0||"absolute"===n,f=l.size>0||u.size>0||"relative"===n,d=T(e.id,"positionLeft"),y=T(e.id,"positionTop"),h=T(e.id,"offsetLeft"),E=T(e.id,"offsetTop");if(0!==a.size||0!==s.size||0!==u.size||0!==l.size){if(p&&f&&(g(a,l),g(l,a),g(s,u),g(u,s)),p){const e="absolute"===n?o:"undefined",r="absolute"===n?i:"undefined";t.setDefaultValue(d,c("left"),e),t.setDefaultValue(y,c("top"),r),t.setMediaProperty(d,a),t.setMediaProperty(y,s),t.mediaProperties.set("position",new Map([["x",d],["y",y]]))}if(f){const e="relative"===n?o:"undefined",r="relative"===n?i:"undefined";t.setDefaultValue(h,c("left"),e),t.setDefaultValue(E,c("top"),r),t.setMediaProperty(h,l),t.setMediaProperty(E,u),t.mediaProperties.set("offset",new Map([["x",h],["y",E]]))}}}],[a("aspect-ratio"),N("aspect-ratio")],[a("display-priority"),N("display-priority")],[a("flex-basis"),_("flex-basis")],[a("flex-grow"),N("flex-grow")],[a("flex-shrink"),N("flex-shrink")],[a("align-self"),function(e,t){const r=v(e,"align-self",o.dealWithAlignSelf);if(0===r.size)return;const n=S(e,"align-self",o.dealWithAlignSelf),i=T(e.id,"align-self");t.setDefaultValue(i,c("align-self"),n),t.setMediaProperty(i,r),t.mediaProperties.set("alignSelf",i)}],[a("border-style"),C("border-style","BorderStyle.")],[a("border-width"),_("border-width")],[a("border-color"),I("border-color")],[a("border-radius"),_("border-radius")],[a("background-color"),I("background-color")],[function(e){return e.hasMediaProperty("background-image-src")||e.hasMediaProperty("background-image-repeat")},function(e,t){const r=e.property.get("background-image-src"),n=e.property.get("background-image-repeat"),i=e.dynamicProperty.get("background-image-src"),a=e.dynamicProperty.get("background-image-repeat"),s=v(e,"background-image-src",o.dealWithSrc),l=v(e,"background-image-repeat",o.dealWithBackgroundRepeat);if(0===s.size&&0===l.size)return;let u=(0,o.dealWithSrc)(null!=r?r:"");if((0,o.isEmptyOrUndefined)(i)||(u=i),s.size>0){const r=T(e.id,"background-image-src");t.setDefaultValue(r,c("background-image-src"),u),t.setMediaProperty(r,s),u=r}let p="undefined";if(!(0,o.isEmptyOrUndefined)(n)){const e=(0,o.dealWithBackgroundRepeat)(n);null!=e&&""!==e&&(p=e)}if((0,o.isEmptyOrUndefined)(a)||(p=a),l.size>0){const r=T(e.id,"background-image-repeat");t.setDefaultValue(r,c("background-image-repeat"),p),t.setMediaProperty(r,l),p=r}t.mediaProperties.set("backgroundImage",u+", "+p)}],[a("background-image-size"),function(e,t){const r=v(e,"background-image-size",o.dealWithBackgroundImageSize);if(0===r.size)return;const n=S(e,"background-image-size",o.dealWithBackgroundImageSize),i=T(e.id,"background-image-size");t.setDefaultValue(i,"{ width?: string | number, height?: string | number } | ImageSize",n),t.setMediaProperty(i,r),t.mediaProperties.set("backgroundImageSize",i)}],[a("background-image-position"),function(e,t){const r=v(e,"background-image-position",o.dealWithBackgroundImagePosition);if(0===r.size)return;const n=S(e,"background-image-position",o.dealWithBackgroundImagePosition),i=T(e.id,"background-image-position");t.setDefaultValue(i,"{ x?: number | string, y?: number | string } | Alignment",n),t.setMediaProperty(i,r),t.mediaProperties.set("backgroundImagePosition",i)}],[a("opacity"),N("opacity")],[a("visibility"),C("visibility","Visibility.")],[a("enabled"),A("enabled")],[a("font-color"),I("font-color")],[a("font-size"),_("font-size")],[a("font-style"),C("font-style","FontStyle.")],[a("font-weight"),function(e,t){const r=v(e,"font-weight",o.dealWithFontWeight);if(0===r.size)return;const n=S(e,"font-weight",o.dealWithFontWeight),i=T(e.id,"font-weight");t.setDefaultValue(i,c("font-weight"),n),t.setMediaProperty(i,r),t.mediaProperties.set("fontWeight",i)}],[a("font-family"),_("font-family")],[function(e){return e.hasMediaProperty("margin")||e.hasMediaProperty("margin-left")||e.hasMediaProperty("margin-top")||e.hasMediaProperty("margin-right")||e.hasMediaProperty("margin-bottom")},P("margin")],[function(e){return e.hasMediaProperty("padding")||e.hasMediaProperty("padding-left")||e.hasMediaProperty("padding-top")||e.hasMediaProperty("padding-right")||e.hasMediaProperty("padding-bottom")},P("padding")]],[s("button","label"),function(e,t){const r=e.property.get("label"),n=e.dynamicProperty.get("label"),i=v(e,"label",(e=>`\`${e}\``));if(0===i.size)return;let a="''";(0,o.isEmptyOrUndefined)(r)||(a=`\`${r}\``),(0,o.isEmptyOrUndefined)(n)||(a=(0,o.getContentName)(n));const s=T(e.id,"label");t.setDefaultValue(s,c("label"),a),t.setMediaProperty(s,i),t.setMediaParams(s)}],[s("button","type"),C("type","ButtonType.")],[s("button","state-effect"),A("state-effect")],[s("divider","vertical"),A("vertical")],[s("divider","color"),I("color")],[s("divider","stroke-width"),_("stroke-width")],[s("divider","line-cap"),C("line-cap","LineCapStyle.")],[x("image"),function(e,t){var r;const n=null!==(r=e.property.get("src"))&&void 0!==r?r:"",i=e.dynamicProperty.get("src"),a=v(e,"src",p);if(0===a.size)return;let s=(0,o.dealWithSrc)(n);(0,o.isEmptyOrUndefined)(i)||(s=i);const l=T(e.id,"src");t.setDefaultValue(l,c("src"),s),t.setMediaProperty(l,a),t.setMediaParams(l)}],[s("image","alt"),_("alt")],[s("image","object-fit"),C("object-fit","ImageFit.")],[s("image","object-repeat"),C("object-repeat","ImageRepeat.")],[s("image","interpolation"),C("interpolation","ImageInterpolation.")],[s("image","render-mode"),C("render-mode","ImageRenderMode.")],[function(e){return e.hasMediaProperty("source-size-width")||e.hasMediaProperty("source-size-height")},function(e,t){let r=e.property.get("source-size-width"),n=e.property.get("source-size-height");const i=e.dynamicProperty.get("source-size-width"),a=e.dynamicProperty.get("source-size-height"),s=h(e,"source-size-width","source-size-height"),l=h(e,"source-size-height","source-size-width");if(0===s.size)return;r="0"===r||(0,o.isEmptyOrUndefined)(r)?"0":r.substring(0,r.length-2),n="0"===n||(0,o.isEmptyOrUndefined)(n)?"0":n.substring(0,n.length-2),(0,o.isEmptyOrUndefined)(i)||(r=i),(0,o.isEmptyOrUndefined)(a)||(n=a);const u=T(e.id,"source-size-width"),p=T(e.id,"source-size-height");t.setDefaultValue(u,c("source-size-width"),r),t.setDefaultValue(p,c("source-size-height"),n),t.setMediaProperty(u,s),t.setMediaProperty(p,l);const f=new Map([["width",u],["height",p]]);t.mediaProperties.set("sourceSize",f)}],[function(e){return"progress"===e.type&&(e.hasMediaProperty("value")||e.hasMediaProperty("total")||e.hasMediaProperty("style"))},function(e,t){const r=e.property.get("value"),n=e.dynamicProperty.get("value"),i=v(e,"value");if(!(t.mediaParams instanceof Map)||0===i.size)return;let a=null!=r?r:"0";(0,o.isEmptyOrUndefined)(n)||(a=n);const s=T(e.id,"value");t.setDefaultValue(s,c("value"),a),t.setMediaProperty(s,i),t.mediaParams.set("value",s)}],[s("progress","total"),b("total")],[s("progress","style"),R("style","ProgressStyle.")],[s("progress","color"),I("color")],[s("slider","value"),b("value")],[s("slider","min"),b("min")],[s("slider","max"),b("max")],[s("slider","step"),b("step")],[s("slider","style"),R("style","SliderStyle.")],[s("slider","block-color"),I("block-color")],[s("slider","track-color"),I("track-color")],[s("slider","selected-color"),I("selected-color")],[s("slider","show-steps"),A("show-steps")],[s("slider","show-tips"),A("show-tips")],[s("text","content"),function(e,t){const r=e.property.get("content"),n=e.dynamicProperty.get("content"),i=v(e,"content",(e=>`\`${e}\``));if(0===i.size)return;let a="''";(0,o.isEmptyOrUndefined)(r)||(a=`\`${r}\``),(0,o.isEmptyOrUndefined)(n)||(a=(0,o.getContentName)(n));const s=T(e.id,"content");t.setDefaultValue(s,c("content"),a),t.setMediaProperty(s,i),t.setMediaParams(s)}],[s("text","text-align"),C("text-align","TextAlign.")],[s("text","text-overflow"),function(e,t){const r=v(e,"text-overflow",y);if(0===r.size)return;const n=S(e,"text-overflow",y),o=T(e.id,"text-overflow");t.setDefaultValue(o,c("text-overflow"),n),t.setMediaProperty(o,r),t.mediaProperties.set("textOverflow",new Map([["overflow",o]]))}],[s("text","max-lines"),N("max-lines")],[s("text","line-height"),_("line-height")],[function(e){return"text"===e.type&&(e.hasMediaProperty("decoration-type")||e.hasMediaProperty("decoration-color"))},function(e,t){const r=v(e,"decoration-type",(0,o.curry)(o.getEtsEnumValue)("TextDecorationType.")),n=v(e,"decoration-color",o.dealWithColor);if(0===r.size&&0===n.size)return;let i=S(e,"decoration-type",(0,o.curry)(o.getEtsEnumValue)("TextDecorationType.")),a=S(e,"decoration-color",o.dealWithColor);if(r.size>0){const n=T(e.id,"decoration-type");t.setDefaultValue(n,c("decoration-type"),i),t.setMediaProperty(n,r),i=n}if(n.size>0){const r=T(e.id,"decoration-color");t.setDefaultValue(r,c("decoration-color"),a),t.setMediaProperty(r,n),a=r}const s=new Map([["type",i]]);t.mediaProperties.set("decoration",s),"undefined"!==a&&s.set("color",a)}],[s("text","baseline-offset"),_("baseline-offset")],[s("text","text-case"),C("text-case","TextCase.")],[s("column","space"),w("space")],[s("column","align-items-column"),function(e,t){const r=v(e,"align-items-column",o.dealWithColumnAlignItems);if(0===r.size)return;const n=S(e,"align-items-column",o.dealWithColumnAlignItems),i=T(e.id,"align-items-column");t.setDefaultValue(i,c("align-items-column"),n),t.setMediaProperty(i,r),t.mediaProperties.set("alignItems",i)}],[s("row","space"),w("space")],[s("row","align-items-row"),function(e,t){const r=v(e,"align-items-row",o.dealWithRowAlignItems);if(0===r.size)return;const n=S(e,"align-items-row",o.dealWithRowAlignItems),i=T(e.id,"align-items-row");t.setDefaultValue(i,c("align-items-row"),n),t.setMediaProperty(i,r),t.mediaProperties.set("alignItems",i)}],[s("flex","flex-direction"),function(e,t){const r=v(e,"flex-direction",(0,o.curry)(o.getEtsEnumValue)("FlexDirection."));if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"flex-direction",(0,o.curry)(o.getEtsEnumValue)("FlexDirection.")),i=T(e.id,"flex-direction");t.setDefaultValue(i,c("flex-direction"),n),t.setMediaProperty(i,r),t.mediaParams.set("direction",i)}],[s("flex","wrap"),function(e,t){const r=v(e,"wrap",o.dealWithWrap);if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"wrap",o.dealWithWrap),i=T(e.id,"wrap");t.setDefaultValue(i,c("wrap"),n),t.setMediaProperty(i,r),t.mediaParams.set("wrap",i)}],[s("flex","justify-content"),M("justify-content","FlexAlign.")],[s("flex","align-items-flex"),function(e,t){const r=v(e,"align-items-flex",o.dealWithFlexAlignItems);if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"align-items-flex",o.dealWithFlexAlignItems),i=T(e.id,"align-items-flex");t.setDefaultValue(i,c("align-items-flex"),n),t.setMediaProperty(i,r),t.mediaParams.set("alignItems",i)}],[s("flex","align-content"),M("align-content","FlexAlign.")],[s("list","space-list"),function(e,t){const r=v(e,"space-list");if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"space-list"),o=T(e.id,"space-list");t.setDefaultValue(o,c("space-list"),n),t.setMediaProperty(o,r),t.mediaParams.set("space",o)}],[s("list","initial-index"),b("initial-index")],[s("list","list-direction"),C("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasMediaProperty("divider-stroke-width")||e.hasMediaProperty("divider-color")||e.hasMediaProperty("divider-start-margin")||e.hasMediaProperty("divider-end-margin"))},function(e,t){const r=[["divider-stroke-width",p],["divider-color",o.dealWithColor],["divider-start-margin",p],["divider-end-margin",p]];let n=0;const i=new Map;for(const[a,s]of r){const r=v(e,a,s),l=(0,o.getEtsPropName)(a.replace("divider-",""));let u=S(e,a,s);if("undefined"===u&&"divider-stroke-width"===a&&(u="0"),r.size>0){const o=T(e.id,a);t.setDefaultValue(o,c(a),u),t.setMediaProperty(o,r),u=o,n++}i.set(l,u)}n>0&&t.mediaProperties.set("divider",i)}],[s("list","edit-mode"),A("edit-mode")],[s("list","edge-effect"),C("edge-effect","EdgeEffect.")],[s("list","chain-animation"),A("chain-animation")],[s("list-item","sticky"),C("sticky","Sticky.")],[s("list-item","editable"),A("editable")],[s("swiper","index"),N("index")],[s("swiper","auto-play"),A("auto-play")],[s("swiper","interval"),N("interval")],[s("swiper","indicator"),A("indicator")],[s("swiper","loop"),A("loop")],[s("swiper","duration"),N("duration")],[s("swiper","vertical"),A("vertical")],[s("swiper","item-space"),_("item-space")],[s("swiper","cached-count"),N("cached-count")],[s("swiper","disable-swipe"),A("disable-swipe")],[s("text-input","placeholder"),w("placeholder")],[s("text-input","textInput-type"),function(e,t){const r=v(e,"textInput-type",(0,o.curry)(o.getEtsEnumValue)("InputType."));if(0===r.size)return;const n=S(e,"textInput-type",(0,o.curry)(o.getEtsEnumValue)("InputType.")),i=T(e.id,"textInput-type");t.setDefaultValue(i,c("textInput-type"),n),t.setMediaProperty(i,r),t.mediaProperties.set("type",i)}],[s("text-input","placeholderColor"),I("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasMediaProperty("placeholderFont-size")||e.hasMediaProperty("placeholderFont-weight")||e.hasMediaProperty("placeholderFont-family")||e.hasMediaProperty("placeholderFont-style"))},function(e,t){const r=[["size",p],["weight",f],["family",p],["style",(0,o.curry)(o.getEtsEnumValue)("FontStyle.")]];let n=0;const i=new Map;for(const[o,a]of r){const r=`placeholderFont-${o}`,s=v(e,r,a);let l=S(e,r,a);if(s.size>0){const o=T(e.id,r);t.setDefaultValue(o,c(r),l),t.setMediaProperty(o,s),l=o,n++}i.set(o,l)}n>0&&t.mediaProperties.set("placeholderFont",i)}],[s("text-input","enterKeyType"),C("enterKeyType","EnterKeyType.")],[s("text-input","caretColor"),I("caretColor")],[s("text-input","maxLength"),N("maxLength")]]},973:(e,t)=>{"use strict";function r(e){return(...t)=>t.lengtht.property.has(e)||t.dynamicProperty.has(e))),o=r(((e,t,r)=>r.type===e&&(r.property.has(t)||r.dynamicProperty.has(t))));function i(e,t,r){const n=t.dynamicProperty.get(e);return void 0!==n&&""!==n.trim()&&(r.properties.set(g(e),n),!0)}const a=r(((e,t,r)=>{if(i(e,t,r))return;const n=t.property.get(e);void 0!==n&&r.properties.set(g(e),`'${n}'`)}));function s(e){return void 0===e||""===e}t.isEmptyOrUndefined=s;const c=r(((e,t,r)=>{if(i(e,t,r))return;const n=t.property.get(e);s(n)||r.properties.set(g(e),n)})),l=r(((e,t,r)=>{if(i(e,t,r))return;const n=t.property.get(e);s(n)||r.properties.set(g(e),n)})),u=r(((e,t,r,n)=>{if(i(e,r,n))return;const o=r.property.get(e);s(o)||n.properties.set(g(e),E(t,o))}));function p(e,t,r){const n=t.dynamicProperty.get(e);return void 0!==n&&""!==n.trim()&&r.params instanceof Map&&(r.params.set(g(e),n),!0)}const f=r(((e,t,r)=>{if(p(e,t,r))return;const n=t.property.get(e);void 0!==n&&r.params instanceof Map&&r.params.set(g(e),`'${n}'`)})),d=r(((e,t,r)=>{if(p(e,t,r))return;const n=t.property.get(e);!s(n)&&r.params instanceof Map&&r.params.set(g(e),n)})),y=r(((e,t,r,n)=>{if(p(e,r,n))return;const o=r.property.get(e);!s(o)&&n.params instanceof Map&&n.params.set(g(e),E(t,o))})),h=r(((e,t,r)=>{if(i(e,t,r))return;let n=t.property.get(e);s(n)||(n=v(n),r.properties.set(g(e),n))}));function m([e,...t]){return(null==e?void 0:e.toUpperCase())+t.join("")}function g(e){const t=e.split("-");let r=t[0];for(let e=1;ee[0].toUpperCase()+e.slice(1))).join(""));const n=function(e){var t,r;const n=e.dynamicProperty.get("for"),o=e.dynamicProperty.get("keyGenerator"),i=null!==(t=e.property.get("item"))&&void 0!==t?t:"item",a=null!==(r=e.property.get("idx"))&&void 0!==r?r:"idx";return void 0!==e.dynamicProperty.get("for")?{for:n,key:o,item:i,idx:a}:null}(e);r.setForEachObj(n);const o=void 0!==e.dynamicProperty.get("if")?e.dynamicProperty.get("if"):e.property.get("if");void 0===o?r.setIfBoolean(null):r.setIfBoolean(o);for(const t of M)("boolean"==typeof t[0]||t[0](e))&&t[1](e,r);!function(e,r){for(let n of t.events){const t=e.property.get(n);"onDisappear"===n&&(n="onDisAppear"),void 0!==t&&""!==t&&r.properties.set(n,t)}}(e,r)},t.events=["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange","onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop","onComplete","onError","onFinish","onChange","onSubmit","onEditChanged"],t.firstUpperCase=m,t.getEtsPropName=g,t.getEtsEnumValue=E,t.dealWithColor=v;const S=r(((e,t,r,n)=>{if(!(n.params instanceof Map))return;const o=r.dynamicProperty.get(e);if(!s(o))return void n.params.set(g(e),o);const i=r.property.get(e);if(s(i))return;let a=E(t,i);"flex-start"===i?a=t+"Start":"flex-end"===i&&(a=t+"End"),n.params.set(g(e),a)})),_=r(((e,t)=>t.type===e));function N(e){return null===e.match(/\$(r|rawfile)\('(.*)'\)$/)?`'${e}'`:e}function A(e){let t=E("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function C(e){let t=E("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function w(e){let t=E("FlexWrap.",e);return"nowrap"===e&&(t="FlexWrap.NoWrap"),t}function b(e){let t=E("VerticalAlign.",e);return"flex-start"===e?t="VerticalAlign.Top":"flex-end"===e&&(t="VerticalAlign.Bottom"),t}function R(e){let t=E("HorizontalAlign.",e);return"flex-start"===e?t="HorizontalAlign.Start":"flex-end"===e&&(t="HorizontalAlign.End"),t}function I(e){return["lighter","normal","regular","medium","bold","bolder"].includes(e)?E("FontWeight.",e):e}function O(e){const t=new Map([["repeat-x","X"],["repeat-y","Y"],["repeat","XY"],["no-repeat","NoRepeat"]]).get(e);if(null!=t&&""!==t)return E("ImageRepeat.",t)}function P(e){return e.startsWith("$r(")?e:`\`\${${e}}\``}t.dealWithSrc=N,t.dealWithAlignSelf=A,t.dealWithFlexAlignItems=C,t.dealWithWrap=w,t.dealWithRowAlignItems=b,t.dealWithColumnAlignItems=R,t.dealWithFontWeight=I,t.dealWithBackgroundImagePosition=function(e){if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(e))return"Alignment."+e;const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);return null!==t?`{ x: '${t[1]}', y: '${t[4]}' }`:void 0},t.dealWithBackgroundImageSize=function(e){if(new Set(["Cover","Contain","Auto"]).has(e))return E("ImageSize.",e);const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);return null!==t?void 0!==t[5]?`{ width: '${t[1]}', height: '${t[5]}' }`:`{ width: '${t[1]}' }`:void 0},t.dealWithBackgroundRepeat=O,t.getContentName=P;const M=[[n("width"),a("width")],[n("height"),a("height")],[function(e){return e.hasProperty("constraint-size-min-width")||e.hasProperty("constraint-size-max-width")||e.hasProperty("constraint-size-min-height")||e.hasProperty("constraint-size-max-height")},function(e,t){const r=new Map,n=e.getProperty("constraint-size-min-width"),o=e.getProperty("constraint-size-max-width"),i=e.getProperty("constraint-size-min-height"),a=e.getProperty("constraint-size-max-height");T("minWidth",n,r,e.dynamicProperty.has("constraint-size-min-width")),T("maxWidth",o,r,e.dynamicProperty.has("constraint-size-max-width")),T("minHeight",i,r,e.dynamicProperty.has("constraint-size-min-height")),T("maxHeight",a,r,e.dynamicProperty.has("constraint-size-max-height")),r.size>0&&t.properties.set("constraintSize",r)}],[n("align"),u("align","Alignment.")],[n("direction"),u("direction","Direction.")],[function(e){return e.hasProperty("left")||e.hasProperty("top")},function(e,t){const r="absolute"===e.property.get("position")?"position":"offset",n=e.property.get("left"),o=e.property.get("top"),i=e.dynamicProperty.get("left"),a=e.dynamicProperty.get("top");if(s(i)&&s(a)&&s(n)&&s(o))return;const c=new Map([["x",`'${null!=n?n:"0"}'`],["y",`'${null!=o?o:"0"}'`]]);s(i)||c.set("x",i),s(a)||c.set("y",a),t.properties.set(r,c)}],[n("aspect-ratio"),c("aspect-ratio")],[n("display-priority"),c("display-priority")],[n("flex-basis"),a("flex-basis")],[n("flex-grow"),c("flex-grow")],[n("flex-shrink"),c("flex-shrink")],[n("align-self"),function(e,t){const r=e.dynamicProperty.get("align-self");if(!s(r))return void t.properties.set("alignSelf",r);const n=e.property.get("align-self");if(s(n))return;const o=A(n);t.properties.set("alignSelf",o)}],[n("border-style"),u("border-style","BorderStyle.")],[n("border-width"),a("border-width")],[n("border-color"),h("border-color")],[n("border-radius"),a("border-radius")],[n("background-color"),h("background-color")],[function(e){return e.hasProperty("background-image-src")||e.hasProperty("background-image-repeat")},function(e,t){const r=e.getProperty("background-image-src"),n=e.getProperty("background-image-repeat");if(s(r)&&s(n))return;let o=N(null!=r?r:"");if(!s(n)){const e=O(n);null!=e&&""!==e&&(o=o+", "+e)}t.properties.set("backgroundImage",o)}],[n("background-image-size"),function(e,t){const r=e.getProperty("background-image-size");if(s(r))return;if(new Set(["Cover","Contain","Auto"]).has(r))return void t.properties.set("backgroundImageSize",E("ImageSize.",r));const n=r.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);null!==n&&(void 0!==n[5]?t.properties.set("backgroundImageSize",new Map([["width",`'${n[1]}'`],["height",`'${n[5]}'`]])):t.properties.set("backgroundImageSize",new Map([["width",`'${n[1]}'`]])))}],[n("background-image-position"),function(e,t){const r=e.getProperty("background-image-position");if(s(r))return;if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(r))return void t.properties.set("backgroundImagePosition","Alignment."+r);const n=r.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);null!==n&&t.properties.set("backgroundImagePosition",new Map([["x",`'${n[1]}'`],["y",`'${n[4]}'`]]))}],[n("opacity"),c("opacity")],[n("visibility"),u("visibility","Visibility.")],[n("enabled"),l("enabled")],[n("font-color"),h("font-color")],[n("font-size"),a("font-size")],[n("font-style"),u("font-style","FontStyle.")],[n("font-weight"),function(e,t){const r=e.getProperty("font-weight");if(s(r))return;const n=I(r);t.properties.set("fontWeight",n)}],[n("font-family"),a("font-family")],[function(e){return e.hasProperty("margin")||e.hasProperty("margin-left")||e.hasProperty("margin-top")||e.hasProperty("margin-right")||e.hasProperty("margin-bottom")},function(e,t){var r,n,o,i;const a=new Map,s=e.getProperty("margin"),c=null!==(r=e.getProperty("margin-top"))&&void 0!==r?r:s,l=null!==(n=e.getProperty("margin-bottom"))&&void 0!==n?n:s,u=null!==(o=e.getProperty("margin-left"))&&void 0!==o?o:s,p=null!==(i=e.getProperty("margin-right"))&&void 0!==i?i:s,f=e.property.has("margin-top"),d=e.property.has("margin-bottom"),y=e.property.has("margin-left"),h=e.property.has("margin-right"),m=e.dynamicProperty.has("margin"),g=e.dynamicProperty.has("margin-top"),E=e.dynamicProperty.has("margin-bottom"),v=e.dynamicProperty.has("margin-left"),S=e.dynamicProperty.has("margin-right");T("top",c,a,g||!f&&m),T("bottom",l,a,E||!d&&m),T("left",u,a,v||!y&&m),T("right",p,a,S||!h&&m),a.size>0&&t.properties.set("margin",a)}],[function(e){return e.hasProperty("padding")||e.hasProperty("padding-left")||e.hasProperty("padding-top")||e.hasProperty("padding-right")||e.hasProperty("padding-bottom")},function(e,t){var r,n,o,i;const a=new Map,s=e.getProperty("padding"),c=null!==(r=e.getProperty("padding-top"))&&void 0!==r?r:s,l=null!==(n=e.getProperty("padding-bottom"))&&void 0!==n?n:s,u=null!==(o=e.getProperty("padding-left"))&&void 0!==o?o:s,p=null!==(i=e.getProperty("padding-right"))&&void 0!==i?i:s,f=e.property.has("padding-top"),d=e.property.has("padding-bottom"),y=e.property.has("padding-left"),h=e.property.has("padding-right"),m=e.dynamicProperty.has("padding"),g=e.dynamicProperty.has("padding-top"),E=e.dynamicProperty.has("padding-bottom"),v=e.dynamicProperty.has("padding-left"),S=e.dynamicProperty.has("padding-right");T("top",c,a,g||!f&&m),T("bottom",l,a,E||!d&&m),T("left",u,a,v||!y&&m),T("right",p,a,S||!h&&m),a.size>0&&t.properties.set("padding",a)}],[o("button","label"),function(e,t){const r=e.dynamicProperty.get("label");if(!s(r))return void t.setParams(P(r));const n=e.property.get("label");"string"==typeof n&&t.setParams(`\`${n}\``)}],[o("button","type"),u("type","ButtonType.")],[o("button","state-effect"),l("state-effect")],[o("divider","vertical"),l("vertical")],[o("divider","color"),h("color")],[o("divider","stroke-width"),a("stroke-width")],[o("divider","line-cap"),u("line-cap","LineCapStyle.")],[_("image"),function(e,t){var r;const n=e.dynamicProperty.get("src");if(!s(n))return void t.setParams(n);const o=null!==(r=e.property.get("src"))&&void 0!==r?r:"";t.setParams(N(o))}],[o("image","alt"),a("alt")],[o("image","object-fit"),u("object-fit","ImageFit.")],[o("image","object-repeat"),u("object-repeat","ImageRepeat.")],[o("image","interpolation"),u("interpolation","ImageInterpolation.")],[o("image","render-mode"),u("render-mode","ImageRenderMode.")],[function(e){return e.hasProperty("source-size-width")||e.hasProperty("source-size-height")},function(e,t){let r=e.getProperty("source-size-width"),n=e.getProperty("source-size-height");if(s(r)&&s(n))return;const o=e.dynamicProperty.has("source-size-width"),i=e.dynamicProperty.has("source-size-height");r="0"===r||s(r)?"0":o?r:r.substring(0,r.length-2),n="0"===n||s(n)?"0":i?n:n.substring(0,n.length-2);const a=new Map([["width",r],["height",n]]);t.properties.set("sourceSize",a)}],[function(e){return"progress"===e.type&&(e.hasProperty("value")||e.hasProperty("total")||e.hasProperty("style"))},function(e,t){var r;p("value",e,t)||t.params instanceof Map&&t.params.set("value",null!==(r=e.getProperty("value"))&&void 0!==r?r:"0")}],[o("progress","total"),d("total")],[o("progress","style"),y("style","ProgressStyle.")],[o("progress","color"),h("color")],[o("slider","value"),d("value")],[o("slider","min"),d("min")],[o("slider","max"),d("max")],[o("slider","step"),d("step")],[o("slider","style"),y("style","SliderStyle.")],[o("slider","block-color"),h("block-color")],[o("slider","track-color"),h("track-color")],[o("slider","selected-color"),h("selected-color")],[o("slider","show-steps"),l("show-steps")],[o("slider","show-tips"),l("show-tips")],[o("text","content"),function(e,t){const r=e.property.get("content"),n=e.dynamicProperty.get("content");s(n)?"string"==typeof r&&t.setParams(`\`${r}\``):t.setParams(P(n))}],[o("text","text-align"),u("text-align","TextAlign.")],[o("text","text-overflow"),function(e,t){const r=e.dynamicProperty.get("text-overflow");if(!s(r))return void t.properties.set("textOverflow",new Map([["overflow",r]]));const n=e.property.get("text-overflow");s(n)||t.properties.set("textOverflow",new Map([["overflow","TextOverflow."+m(n)]]))}],[o("text","max-lines"),c("max-lines")],[o("text","line-height"),a("line-height")],[function(e){return"text"===e.type&&(e.hasProperty("decoration-type")||e.hasProperty("decoration-color"))},function(e,t){const r=e.property.get("decoration-type"),n=e.dynamicProperty.get("decoration-type"),o=e.property.get("decoration-color"),i=e.dynamicProperty.get("decoration-color");if(s(r)&&s(o)&&s(n)&&s(i))return;const a=new Map;s(n)?a.set("type",s(r)?"TextDecorationType.None":E("TextDecorationType.",r)):a.set("type",n),t.properties.set("decoration",a),s(i)?s(o)||a.set("color",v(o)):a.set("color",i)}],[o("text","baseline-offset"),a("baseline-offset")],[o("text","text-case"),u("text-case","TextCase.")],[o("column","space"),f("space")],[o("column","align-items-column"),function(e,t){const r=e.dynamicProperty.get("align-items-column");if(!s(r))return void t.properties.set("alignItems",r);const n=e.property.get("align-items-column");if(s(n))return;const o=R(n);t.properties.set("alignItems",o)}],[o("row","space"),f("space")],[o("row","align-items-row"),function(e,t){const r=e.dynamicProperty.get("align-items-row");if(!s(r))return void t.properties.set("alignItems",r);const n=e.property.get("align-items-row");if(s(n))return;const o=b(n);t.properties.set("alignItems",o)}],[o("flex","flex-direction"),function(e,t){if(!(t.params instanceof Map))return;const r=e.dynamicProperty.get("flex-direction");if(!s(r))return void t.params.set("direction",r);const n=e.property.get("flex-direction");s(n)||t.params.set("direction",E("FlexDirection.",n))}],[o("flex","wrap"),function(e,t){if(!(t.params instanceof Map))return;const r=e.dynamicProperty.get("wrap");if(!s(r))return void t.params.set("wrap",r);const n=e.property.get("wrap");if(s(n))return;const o=w(n);t.params.set("wrap",o)}],[o("flex","justify-content"),S("justify-content","FlexAlign.")],[o("flex","align-items-flex"),function(e,t){if(!(t.params instanceof Map))return;const r=e.dynamicProperty.get("align-items-flex");if(!s(r))return void t.params.set("alignItems",r);const n=e.property.get("align-items-flex");if(s(n))return;const o=C(n);t.params.set("alignItems",o)}],[o("flex","align-content"),S("align-content","FlexAlign.")],[o("list","space-list"),function(e,t){const r=e.dynamicProperty.get("space-list");if(void 0!==r&&""!==r.trim()&&t.params instanceof Map)return void t.params.set("space",r);const n=e.getProperty("space-list");!s(n)&&t.params instanceof Map&&t.params.set("space",n)}],[o("list","initial-index"),d("initial-index")],[o("list","list-direction"),u("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasProperty("divider-stroke-width")||e.hasProperty("divider-color")||e.hasProperty("divider-start-margin")||e.hasProperty("divider-end-margin"))},function(e,t){const r=e.property.get("divider-stroke-width"),n=e.dynamicProperty.get("divider-stroke-width"),o=new Map([["strokeWidth",`'${null!=r?r:"0"}'`]]);s(n)||o.set("strokeWidth",n);const i=e.property.get("divider-color"),a=e.dynamicProperty.get("divider-color"),c=e.property.get("divider-start-margin"),l=e.dynamicProperty.get("divider-start-margin"),u=e.property.get("divider-end-margin"),p=e.dynamicProperty.get("divider-end-margin");s(a)?s(i)||o.set("color",v(i)):o.set("color",a),s(l)?s(c)||o.set("startMargin",`'${c}'`):o.set("startMargin",l),s(p)?s(u)||o.set("endMargin",`'${u}'`):o.set("endMargin",p),t.properties.set("divider",o)}],[o("list","edit-mode"),l("edit-mode")],[o("list","edge-effect"),u("edge-effect","EdgeEffect.")],[o("list","chain-animation"),l("chain-animation")],[o("list-item","sticky"),u("sticky","Sticky.")],[o("list-item","editable"),l("editable")],[o("swiper","index"),c("index")],[o("swiper","auto-play"),l("auto-play")],[o("swiper","interval"),c("interval")],[o("swiper","indicator"),l("indicator")],[o("swiper","loop"),l("loop")],[o("swiper","duration"),c("duration")],[o("swiper","vertical"),l("vertical")],[o("swiper","item-space"),a("item-space")],[o("swiper","cached-count"),c("cached-count")],[o("swiper","disable-swipe"),l("disable-swipe")],[o("text-input","placeholder"),f("placeholder")],[o("text-input","textInput-type"),function(e,t){const r=e.dynamicProperty.get("textInput-type");if(!s(r))return void t.properties.set("type",r);const n=e.property.get("textInput-type");s(n)||t.properties.set("type","InputType."+n)}],[o("text-input","placeholderColor"),h("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasProperty("placeholderFont-size")||e.hasProperty("placeholderFont-weight")||e.hasProperty("placeholderFont-family")||e.hasProperty("placeholderFont-style"))},function(e,t){const r=e.property.get("placeholderFont-size"),n=e.dynamicProperty.get("placeholderFont-size"),o=e.property.get("placeholderFont-weight"),i=e.dynamicProperty.get("placeholderFont-weight"),a=e.property.get("placeholderFont-family"),c=e.dynamicProperty.get("placeholderFont-family"),l=e.property.get("placeholderFont-style"),u=e.dynamicProperty.get("placeholderFont-style"),p=new Map;s(n)?p.set("size",s(r)?30:parseInt(r)):p.set("size",n),s(i)?s(o)?p.set("weight",400):p.set("weight",isNaN(Number(o))?E("FontWeight.",o):o):p.set("weight",i),s(c)?p.set("family",s(a)?"'sans-serif'":`'${a}'`):p.set("family",c),s(u)?p.set("style",s(l)?"FontStyle.Normal":E("FontStyle.",l)):p.set("style",u),t.properties.set("placeholderFont",p)}],[o("text-input","enterKeyType"),u("enterKeyType","EnterKeyType.")],[o("text-input","caretColor"),h("caretColor")],[o("text-input","maxLength"),c("maxLength")]]},243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Style=t.Tag=void 0;const n=r(117);class o extends n.ASTNode{constructor(e,t,r){super(),this.tagName=e,this.attributes=t,this.content=r}}t.Tag=o;class i extends n.ASTNode{constructor(e,t,r,n){super(),this.mediaQuery=void 0,this.kind=e,this.name=t,this.content=r,this.mediaQuery=n}}t.Style=i},573:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const n=r(243),o=r(334);class i{constructor(e){this.cache=e}visit(e){e instanceof n.Tag?this.genTag(e):e instanceof n.Style&&this.genStyle(e)}static getMethodGen(e){return void 0===i.instance?i.instance=new i(e):i.instance.setCache(e),i.instance}setCache(e){this.cache=e}genTag(e){if(this.cache.concat(o.TokenClass.TAG_START,e.tagName),this.cache.indentOff(),e.attributes.forEach(((e,t)=>{let r="";for(const t of e)r+='"'===t?""":"\n"===t?" ":t;this.cache.concat(o.TokenClass.SPACE,t,o.TokenClass.ASSIGN,o.TokenClass.LQUOTE,r,o.TokenClass.RQUOTE)})),null===e.content)this.cache.concat(o.TokenClass.EMPTY_TAG_END);else{if(this.cache.concat(o.TokenClass.TAG_END),"string"==typeof e.content){let t="";for(const r of e.content)t+="<"===r?"<":r;this.cache.concat(t)}else 0!==e.content.length&&(this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach((e=>{e.accept(this),this.cache.indentOff(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn());this.cache.concat(o.TokenClass.END_TAG_START,e.tagName,o.TokenClass.TAG_END)}}genStyle(e){void 0!==e.mediaQuery&&(this.cache.concat("@media"),this.cache.indentOff(),this.cache.concat(o.TokenClass.SPACE,e.mediaQuery,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent()),"IDStyle"===e.kind&&(this.cache.concat(o.TokenClass.ID_STYLE_START),this.cache.indentOff()),this.cache.concat(e.name,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach(((e,t)=>{this.cache.concat(t,o.TokenClass.COLON,o.TokenClass.SPACE,e,o.TokenClass.SEMICOLON,o.TokenClass.NEW_LINE)})),this.cache.decIndent(),this.cache.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE),void 0!==e.mediaQuery&&(this.cache.decIndent(),this.cache.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)),this.cache.concat(o.TokenClass.NEW_LINE)}}t.ASTNodeGenerator=i,i.instance=void 0},844:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CSSBridge=t.HMLBridge=void 0;const n=r(243),o=r(571);t.HMLBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map([["id",e.id]]);let r="";for(let[n,i]of e.property)(0,o.isAttribute)(n,e.type)?("string"!=typeof i&&(i=JSON.stringify(i)),t.set(n,i)):(0,o.isContent)(n)&&(r=i);if(e.children.length>0){r=[];for(const t of e.children)r.push(t.accept(this))}const i=new n.Tag(e.type,t,r);return"wrapper"===t.get("id")?new n.Tag("div",new Map,[i]):i}},t.CSSBridge=class{constructor(){this.errors=0,this.styles=[]}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}genIDStyle(e){var t;const r=t=>{const r=new Map;for(const[n,i]of t)(0,o.isStyle)(n,e.type)&&r.set(n,i);return r},i=r(e.property);i.size>0&&this.styles.push(new n.Style("IDStyle",e.id,i)),(null!==(t=e.mediaProperty)&&void 0!==t?t:new Map).forEach(((t,o)=>{const i=r(t);i.size>0&&this.styles.push(new n.Style("IDStyle",e.id,i,o))}));for(const t of e.children)t.accept(this)}visit(e){return this.genIDStyle(e),this.styles}}},55:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genFACSS=t.genFAHML=void 0;const n=r(573),o=r(862);t.genFAHML=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" "));return e.accept(t),t.cache.toString()},t.genFACSS=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" "));return e.forEach((e=>{e.accept(t)})),t.cache.toString()}},571:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEvent=t.isData=t.isUnknown=t.isContent=t.isAttribute=t.isStyle=t.styleMap=void 0;const n=r(904),o=["width","height","min-width","min-height","max-width","max-height","padding","padding-start","padding-end","padding-top","padding-right","padding-bottom","padding-left","margin","margin-start","margin-end","margin-top","margin-right","margin-bottom","margin-left","border-width","border-style","border-color","border-radius","border-top-width","border-top-style","border-top-color","border-top-left-radius","border-right-width","border-right-style","border-right-color","border-top-right-radius","border-bottom-width","border-bottom-style","border-bottom-color","border-bottom-right-radius","border-left-width","border-left-style","border-left-color","border-bottom-left-radius","background-color","background","background-image","background-size","background-position","background-repeat","display","opacity","visibility","flex","flex-grow","flex-shrink","flex-basis","position","display","top","right","bottom","left","display-index","flex-weight","aspect-ratio"],i=["font-size","font-family","font-style","font-weight"],a=["text-align","line-height","text-decoration","letter-spacing","max-lines","text-overflow","allow-scale","min-font-size","max-font-size","font-size-step","prefer-font-sizes","color",...i],s=["allow-scale","text-decoration","color",...i],c=["text-color","allow-scale","icon-width","icon-height","radius",...i],l=["texton-color","textoff-color","text-padding","allow-scale",...i],u=["column-height","text-color","allow-scale","letter-spacing","text-decoration","line-height","opacity",...i],p=["text-color","allow-scale","letter-spacing",...i];t.styleMap=new Map([["common",new Set([...o])],["div",new Set(["flex-direction","overflow","flex-wrap","justify-content","align-items","align-content","grid-template-columns","grid-template-rows","grid-row-start","grid-row-end","grid-column-start","grid-column-end","grid-gap","grid-columns-gap","grid-rows-gap"])],["text",new Set([...a])],["image",new Set(["object-fit","match-text-direction","fit-original-size"])],["span",new Set([...s])],["input",new Set(["font-size","font-family","font-weight","color","placeholder-color","allow-scale"])],["button",new Set([...c])],["switch",new Set([...l])],["refresh",new Set(["progress-color"])],["divider",new Set(["stroke-width","line-cap","color"])],["chart",new Set(["stroke-width","radius","start-angle","total-angle","center-x","center-y","colors","weights"])],["picker",new Set([...u])],["picker-view",new Set(["color","font-size","selected-color","selected-font-size","focus-color","focus-font-size","disappear-color","disappear-font-size","font-family"])],["slider",new Set(["color","selected-color","block-color"])],["swiper",new Set(["indicator-color","indicator-selected-color","indicator-size","indicator-top","indicator-right","indicator-bottom","indicator-left"])],["list",new Set(["flex-direction","columns","item-extent","fade-color"])],["list-item",new Set(["column-span"])],["progress",new Set(["color","stroke-width","background-color","secondary-color","scale-width","scale-number","start-angle","total-angle","center-x","center-y","radius"])],["select",new Set(["font-family"])],["menu",new Set([...p])],["option",new Set(["color","font-family","allow-scale","font-size","font-weight","text-decoration"])],["video",new Set(["object-fit"])],["clock",new Set(["font-family"])]]);const f=new Map([["common",new Set(["id","ref","disabled","focusable","data","if","for"])],["image",new Set(["src","alt"])],["button",new Set(["type","value","icon","waiting"])],["refresh",new Set(["offset","refreshing","type","lasttime","friction"])],["input",new Set(["type","checked","name","value","placeholder","maxlength","enterkeytype","headericon"])],["switch",new Set(["checked","showtext","texton","textoff"])],["option",new Set(["value","selected","icon"])],["chart",new Set(["type","percent","datasets","options"])],["picker",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","value","vibrate"])],["picker-view",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","indicatorprefix","indicatorsuffix","vibrate"])],["slider",new Set(["min","max","step","showtips","showsteps","mode","value"])],["divider",new Set(["vertical"])],["list",new Set(["scrollpage","cachedcount","scrollbar","scrolleffect","shapemode","indexer","itemscale","itemcenter","updateeffect","scrollvibrate","initialindex","initialoffset"])],["list-item",new Set(["type","primary","section","sticky","stickyradius","clickeffect"])],["swiper",new Set(["index","autoplay","interval","indicator","digital","indicatordisabled","loop","duration","vertical"])],["progress",new Set(["type","percent","secondarypercent","clockwise"])],["menu",new Set(["target","title","type"])],["clock",new Set(["clockconfig","showdigit","hourswest"])],["badge",new Set(["placement","count","visible","maxcount","config","label"])],["video",new Set(["muted","src","autoplay","poster","controls","loop","starttime","direction","speed"])],["tabs",new Set(["index","vertical"])],["tab-bar",new Set(["mode"])],["tab-content",new Set(["scrollable"])]]),d=new Map([["common",new Set(["ontouchstart","ontouchmove","ontouchcancel","ontouchend","onclick","onlongpress","onfocus","onblur","onkey","onswipe"])],["image",new Set(["oncomplete","onerror"])],["input",new Set(["onchange","onenterkeyclick"])],["select",new Set(["onchange"])],["refresh",new Set(["onrefresh","onpulldown"])],["swiper",new Set(["onchange","onrotation"])],["list",new Set(["onindexerchange","onscroll","onscrollbottom","onscrolltop","onscrollend","onscrolltouchup","onrequestitem"])],["list-item",new Set(["onsticky"])],["menu",new Set(["onselected","oncancel"])],["picker",new Set(["oncolumnchange","onchange","oncancel"])],["picker-view",new Set(["oncolumnchange","onchange"])],["video",new Set(["onprepared","onstart","onpause","onfinish","onerror","onseeking","onseeked","ontimeupdate","onfullscreenchange","onstop"])],["tabs",new Set(["onchange"])],["switch",new Set(["onchange"])],["dialog",new Set(["oncancel"])]]),y=new Map([["common",new Set(["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange"])],["image",new Set(["onComplete","onError","onFinish"])],["swiper",new Set(["onChange"])],["list",new Set(["onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop"])],["text-input",new Set(["onChange","onSubmit","onEditChanged"])]]);function h(e,t,r){const n=t.get(r);return void 0!==n&&n.has(e)}function m(e,r){return h(e,t.styleMap,"common")||h(e,t.styleMap,r)}function g(e,t){return(0,n.getDomain)()===n.Domain.ETS?h(e,y,"common")||h(e,y,t):E(e,t)||v(e,t)}function E(e,t){return h(e,f,"common")||h(e,f,t)}function v(e,t){return h(e,d,"common")||h(e,d,t)}t.isStyle=m,t.isAttribute=g,t.isContent=function(e){return"content"===e},t.isUnknown=function(e,t){return!m(e,t)&&!g(e,t)},t.isData=E,t.isEvent=v},334:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(r=t.TokenClass||(t.TokenClass={}))[r.IDENTIFIER=0]="IDENTIFIER",r[r.STRING_LITERAL=1]="STRING_LITERAL",r[r.NUMBER=2]="NUMBER",r[r.CHARACTER=3]="CHARACTER",r[r.EOF=4]="EOF",r[r.INVALID=5]="INVALID",r.EMPTY_DATA="empty",r.ASSIGN="=",r.NEW_LINE="\n",r.CARRIAGE_RETURN="\r",r.INDENT=" ",r.SPACE=" ",r.LQUOTE='"',r.RQUOTE='"',r.TAG_START="<",r.TAG_END=">",r.EMPTY_TAG_END="/>",r.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.etsPropertyList=void 0;const n=r(958),o=r(513),i=["vp","px","%","lpx"],a=[{propertySector:o.Sector.FEATURE,propertySet:{name:"FontSize",property:"font-size-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["fp","px","lpx"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"FontStyle",property:"font-style-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FONT_STYLE,list:[o.CLEAN_VALUE_NODE,{name:"Normal",value:"normal"},{name:"Italic",value:"italic"}],defaults:"normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"FontColor",property:"font-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"FontWeight",property:"font-weight-visual",type:o.TypeName.SELECT,etsType:`${o.EtsType.FONT_WEIGHT}|${o.EtsType.NUMBER}`,list:[o.CLEAN_VALUE_NODE,{name:"Normal",value:"normal"},{name:"Lighter",value:"lighter"},{name:"Regular",value:"regular"},{name:"Medium",value:"medium"},{name:"Bold",value:"bold"},{name:"Bolder",value:"bolder"},{value:"100"},{value:"200"},{value:"300"},{value:"400"},{value:"500"},{value:"600"},{value:"700"},{value:"800"},{value:"900"}],defaults:"normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"TextAlign",property:"text-align-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_ALIGN,list:[o.CLEAN_VALUE_NODE,{name:"Start",value:"start"},{name:"Center",value:"center"},{name:"End",value:"end"}],defaults:"start"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"LineHeight",property:"line-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["fp","px","lpx"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"TextOverflow",property:"text-overflow-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_OVERFLOW,list:[o.CLEAN_VALUE_NODE,{name:"Clip",value:"clip"},{name:"Ellipsis",value:"ellipsis"},{name:"None",value:"none"}],defaults:"clip"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"BaselineOffset",property:"baseline-offset-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["fp","px","lpx"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"DecorationType",property:"decoration-type-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_DECORATION_TYPE,list:[o.CLEAN_VALUE_NODE,{name:"Underline",value:"underline"},{name:"LineThrough",value:"line-through"},{name:"Overline",value:"overline"},{name:"None",value:"none"}],defaults:"none"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"DecorationColor",property:"decoration-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"TextCase",property:"text-case-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_CASE,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"LowerCase"},{value:"UpperCase"}],defaults:"Normal"}},{propertySector:o.Sector.GENERAL,propertySet:{name:"ForEach",property:"for-visual",type:o.TypeName.BASE,etsType:o.EtsType.ARRAY,defaults:""}},{propertySector:o.Sector.GENERAL,propertySet:{name:"KeyGenerator",property:"keyGenerator-visual",type:o.TypeName.BASE,etsType:"Event",defaults:""}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Item",property:"item-visual",type:o.TypeName.BASE,info:"Variable Name for Item of ForEach Array"}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Idx",property:"idx-visual",type:o.TypeName.BASE,info:"Variable Name for Index of Corresponding Item In ForEach Array"}}],s=[{propertySector:o.Sector.FEATURE,propertySet:{name:"Placeholder",property:"placeholder-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_CONTENT,defaults:""}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Type",property:"textInput-type-visual",type:o.TypeName.SELECT,etsType:o.EtsType.INPUT_TYPE,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"Password"},{value:"Email"},{value:"Number"}],defaults:"Normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderColor",property:"placeholderColor-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontSize",property:"placeholderFont-size-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:["fp"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontWeight",property:"placeholderFont-weight-visual",type:o.TypeName.SELECT,etsType:`${o.EtsType.FONT_WEIGHT}|${o.EtsType.NUMBER}`,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"Lighter"},{value:"Regular"},{value:"Medium"},{value:"Bold"},{value:"Bolder"},{value:"100"},{value:"200"},{value:"300"},{value:"400"},{value:"500"},{value:"600"},{value:"700"},{value:"800"},{value:"900"}],defaults:"400"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontFamily",property:"placeholderFont-family-visual",type:o.TypeName.BASE,etsType:o.EtsType.STRING,defaults:""}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontStyle",property:"placeholderFont-style-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FONT_STYLE,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"Italic"}],defaults:"Normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EnterKeyType",property:"enterKeyType-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ENTER_KEY_TYPE,list:[o.CLEAN_VALUE_NODE,{value:"Go"},{value:"Search"},{value:"Send"},{value:"Next"},{value:"Done"}],defaults:"Done"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"CaretColor",property:"caretColor-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"MaxLength",property:"maxLength-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER}}],c={type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["vp","px","lpx"],placeholder:"0vp"},l=[{propertySector:o.Sector.GENERAL,propertySet:{name:"Width",property:"width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Height",property:"height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MinWidth",property:"constraint-size-min-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MinHeight",property:"constraint-size-min-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MaxWidth",property:"constraint-size-max-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MaxHeight",property:"constraint-size-max-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"Margin",property:"margin-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"Padding",property:"padding-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginTop",property:"margin-top-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginRight",property:"margin-right-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginBottom",property:"margin-bottom-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginLeft",property:"margin-left-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingTop",property:"padding-top-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingRight",property:"padding-right-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingBottom",property:"padding-bottom-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingLeft",property:"padding-left-visual"},c)}],u={type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i},p={type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i},f=[{propertySector:o.Sector.DIMENSION,propertySet:{name:"Border",property:"border-visual",type:o.TypeName.COMPOSITE,detached:1,properties:[Object.assign({name:"Width",property:"border-width-visual"},u),Object.assign({name:"Style",property:"border-style-visual"},o.commonParamsForBorder),{name:"Color",property:"border-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR},Object.assign({name:"Radius",property:"border-radius-visual"},p)]}}],d=[{propertySector:o.Sector.FEATURE,propertySet:Object.assign({name:"Vertical",property:"vertical-visual"},o.commonParamsForJudge)},{propertySector:o.Sector.FEATURE,propertySet:{name:"LineCap",property:"line-cap-visual",type:o.TypeName.SELECT,etsType:o.EtsType.LINE_CAP_STYLE,defaults:"butt",list:[o.CLEAN_VALUE_NODE,{name:"Butt",value:"butt"},{name:"Round",value:"round"},{name:"Square",value:"square"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StrokeWidth",property:"stroke-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i}}],y=[{propertySector:o.Sector.FEATURE,propertySet:{name:"InitialIndex",property:"initial-index-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ListDirection",property:"list-direction-visual",type:o.TypeName.SELECT,etsType:o.EtsType.AXIS,list:[o.CLEAN_VALUE_NODE,{name:"Vertical",value:"vertical"},{name:"Horizontal",value:"horizontal"}],defaults:"vertical"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Color",property:"divider-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StrokeWidth",property:"divider-stroke-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StartMargin",property:"divider-start-margin-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EndMargin",property:"divider-end-margin-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EditMode",property:"edit-mode-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,list:[o.CLEAN_VALUE_NODE,{name:"true",value:"true"},{name:"false",value:"false"}],defaults:"false"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EdgeEffect",property:"edge-effect-visual",type:o.TypeName.SELECT,etsType:o.EtsType.EDGE_EFFECT,list:[o.CLEAN_VALUE_NODE,{name:"Spring",value:"spring"},{name:"None",value:"none"}],defaults:"spring"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ChainAnimation",property:"chain-animation-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,list:[o.CLEAN_VALUE_NODE,{name:"true",value:"true"},{name:"false",value:"false"}],defaults:"false"}}],h=[{propertySector:o.Sector.FEATURE,propertySet:{name:"Sticky",property:"sticky-visual",type:o.TypeName.SELECT,etsType:o.EtsType.STICKY,list:[o.CLEAN_VALUE_NODE,{name:"None",value:"none"},{name:"Normal",value:"normal"}],defaults:"none"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Editable",property:"editable-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,list:[o.CLEAN_VALUE_NODE,{name:"true",value:"true"},{name:"false",value:"false"}],defaults:"false"}}],m=[{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImageSrc",property:"background-image-src-visual",type:o.TypeName.BASE,etsType:o.EtsType.STRING}},{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImageRepeat",property:"background-image-repeat-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_REPERT,list:[o.CLEAN_VALUE_NODE,{name:"X",value:"repeat-x"},{name:"Y",value:"repeat-y"},{name:"XY",value:"repeat"},{name:"NoRepeat",value:"no-repeat"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImageSize",property:"background-image-size-visual",type:o.TypeName.DATA_SELECT_INPUT,etsType:`${o.EtsType.IMAGE_SIZE}|${o.EtsType.STRING}`,list:[o.CLEAN_VALUE_NODE,{name:"Cover",value:"cover"},{name:"Contain",value:"contain"},{name:"Auto",value:"auto"}],defaults:"Auto"}},{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImagePosition",property:"background-image-position-visual",type:o.TypeName.DATA_SELECT_INPUT,etsType:`${o.EtsType.ALIGNMENT}|${o.EtsType.STRING}`,list:[o.CLEAN_VALUE_NODE,{name:"TopStart",value:"top left"},{name:"Top",value:"top center"},{name:"TopEnd",value:"top right"},{name:"Start",value:"center left"},{name:"Center",value:"center center"},{name:"End",value:"center right"},{name:"BottomStart",value:"bottom left"},{name:"Bottom",value:"bottom center"},{name:"BottomEnd",value:"bottom right"}],defaults:"0 0"}}],g=[{propertySector:o.Sector.GENERAL,propertySet:{name:"Location",property:"position-visual",type:o.TypeName.SELECT,defaults:"offset",list:[o.CLEAN_VALUE_NODE,{name:"offset",value:"relative"},{name:"position",value:"absolute"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"X",property:"left-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,defaults:0,units:["vp","px","lpx"]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Y",property:"top-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,defaults:0,units:["vp","px","lpx"]}}],E=[{propertySector:o.Sector.FLEX,propertySet:{name:"FlexBasis",property:"flex-basis-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i,defaults:"auto",fixedValues:["auto"],info:"The initial main size of a flex item. It sets the size of the content box otherwise set with box-sizing."}},{propertySector:o.Sector.FLEX,propertySet:{name:"AlignSelf",property:"align-self-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ITEM_ALIGN,defaults:"auto",list:[o.CLEAN_VALUE_NODE,{name:"Auto",value:"auto"},{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"Stretch",value:"stretch"},{name:"Baseline",value:"baseline"}],info:"The alignment of items on the Cross Axis."}},{propertySector:o.Sector.FLEX,propertySet:{name:"Direction",property:"flex-direction-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_DIRECTION,defaults:"row",list:[o.CLEAN_VALUE_NODE,{name:"Row",value:"row"},{name:"RowReverse",value:"row-reverse"},{name:"Column",value:"column"},{name:"ColumnReverse",value:"column-reverse"}],info:"The direction of flex."}},{propertySector:o.Sector.FLEX,propertySet:{name:"Wrap",property:"wrap-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_WRAP,defaults:"nowrap",list:[o.CLEAN_VALUE_NODE,{name:"NoWrap",value:"nowrap"},{name:"Wrap",value:"wrap"},{name:"WrapReverse",value:"wrap-reverse"}],info:"Whether flex items are forced onto one line or multiple lines."}},{propertySector:o.Sector.FLEX,propertySet:{name:"JustifyContent",property:"justify-content-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_ALIGN,defaults:"flex-start",list:[o.CLEAN_VALUE_NODE,{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"SpaceBetween",value:"space-between"},{name:"SpaceAround",value:"space-around"},{name:"SpaceEvenly",value:"space-evenly"}],info:"Allocate the space between and around the elements along the main axis of the flexible container"}},{propertySector:o.Sector.FLEX,propertySet:{name:"AlignItems",property:"align-items-flex-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ITEM_ALIGN,defaults:"stretch",list:[o.CLEAN_VALUE_NODE,{name:"Auto",value:"auto"},{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"Stretch",value:"stretch"},{name:"Baseline",value:"baseline"}],info:"The alignment of items on the Cross Axis."}},{propertySector:o.Sector.FLEX,propertySet:{name:"AlignContent",property:"align-content-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_ALIGN,defaults:"flex-start",list:[o.CLEAN_VALUE_NODE,{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"SpaceBetween",value:"space-between"},{name:"SpaceAround",value:"space-around"},{name:"SpaceEvenly",value:"space-evenly"}],info:"Set the distribution of space between and around content items along a flexbox's cross-axis or a grid's block axis."}}],v=[{propertySector:o.Sector.FEATURE,propertySet:Object.assign({name:"AutoPlay",property:"auto-play-visual"},o.commonParamsForJudge)},{propertySector:o.Sector.FEATURE,propertySet:{name:"Interval",property:"interval-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:3e3}},{propertySector:o.Sector.FEATURE,propertySet:Object.assign(Object.assign({name:"Loop",property:"loop-visual"},o.commonParamsForJudge),{defaults:!0})},{propertySector:o.Sector.FEATURE,propertySet:{name:"Duration",property:"duration-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:400}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ItemSpace",property:"item-space-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_LENGTH,defaults:"0"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"CachedCount",property:"cached-count-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:1}},{propertySector:o.Sector.FEATURE,propertySet:Object.assign({name:"DisableSwipe",property:"disable-swipe-visual"},o.commonParamsForJudge)},{propertySector:o.Sector.FEATURE,propertySet:{name:"Index",property:"index-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:0}},{propertySector:o.Sector.FEATURE,propertySet:Object.assign(Object.assign({name:"Indicator",property:"indicator-visual"},o.commonParamsForJudge),{defaults:!0})}];t.etsPropertyList=[...f,...l,...a,...s,...d,...g,...y,...h,...E,...v,...n.commonPropertyList,...m,{propertySector:o.Sector.ATOMIC,propertySet:{name:"DisplayPriority",property:"display-priority-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Visibility",property:"visibility-visual",type:o.TypeName.SELECT,etsType:o.EtsType.VISIBILITY,defaults:"Visibility.None",list:[o.CLEAN_VALUE_NODE,{name:"Visible",value:"visible"},{name:"Hidden",value:"hidden"},{name:"None",value:"none"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Enabled",property:"enabled-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,defaults:"true",list:[{value:"true"},{value:"false"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Align",property:"align-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ALIGNMENT,defaults:"center",list:[o.CLEAN_VALUE_NODE,{name:"TopStart",value:"top-start"},{name:"Top",value:"top"},{name:"TopEnd",value:"top-end"},{name:"Start",value:"start"},{name:"Center",value:"center"},{name:"End",value:"end"},{name:"BottomStart",value:"bottom-start"},{name:"Bottom",value:"bottom"},{name:"BottomEnd",value:"bottom-end"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"If",property:"if-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,defaults:"",list:[{name:"true",value:"true"},{name:"false",value:"false"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Space",property:"space-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:["vp","px","lpx"],requires:{"display-visual":["flex","cleanValue"]},info:"Space between any two adjacent child components."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Space",property:"space-list-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER,requires:{"display-visual":["flex","cleanValue"]},info:"Space between any two adjacent child components."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"AlignItems",property:"align-items-row-visual",type:o.TypeName.SELECT,etsType:o.EtsType.VERTICAL_ALIGN,defaults:"center",requires:{"display-visual":["flex","cleanValue"]},list:[o.CLEAN_VALUE_NODE,{value:"flex-start",name:"top",etsEnumValue:"Top"},{value:"flex-end",name:"bottom",etsEnumValue:"End"},{value:"center",name:"center",etsEnumValue:"Center"}],info:"Alignment mode of child components in the vertical direction."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"AlignItems",property:"align-items-column-visual",type:o.TypeName.SELECT,etsType:o.EtsType.HORIZONTAL_ALIGN,defaults:"center",requires:{"display-visual":["flex","cleanValue"]},list:[o.CLEAN_VALUE_NODE,{value:"flex-start",name:"start",etsEnumValue:"Start"},{value:"flex-end",name:"end",etsEnumValue:"End"},{value:"center",name:"center",etsEnumValue:"Center"}],info:"Alignment mode of child components in the horizontal direction."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Src",property:"src-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_SRC}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Alt",property:"alt-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_CONTENT}},{propertySector:o.Sector.FEATURE,propertySet:{name:"RenderMode",property:"render-mode-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_RENDER_MODE,defaults:"original",list:[o.CLEAN_VALUE_NODE,{name:"Original",value:"original"},{name:"Template",value:"template"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ObjectRepeat",property:"object-repeat-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_REPERT,defaults:"NoRepeat",list:[o.CLEAN_VALUE_NODE,{name:"X",value:"X"},{name:"Y",value:"Y"},{name:"XY",value:"XY"},{name:"NoRepeat",value:"no-repeat"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ObjectFit",property:"object-fit-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_FIT,defaults:"cover",list:[o.CLEAN_VALUE_NODE,{name:"Cover",value:"cover"},{name:"Contain",value:"contain"},{name:"Fill",value:"fill"},{name:"None",value:"none"},{name:"ScaleDown",value:"scale-down"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"InterPolation",property:"interpolation-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_INTERPOLATION,defaults:"none",list:[o.CLEAN_VALUE_NODE,{name:"None",value:"none"},{name:"High",value:"high"},{name:"Medium",value:"medium"},{name:"Low",value:"low"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"SourceSizeWidth",property:"source-size-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER,units:["px"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"SourceSizeHeight",property:"source-size-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER,units:["px"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Type",property:"type-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BUTTON_TYPE,defaults:"capsule",list:[{name:"Normal",value:"normal"},{name:"Capsule",value:"capsule"},{name:"Circle",value:"circle"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StateEffect",property:"state-effect-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,defaults:"true",list:[{name:"true",value:"true"},{name:"false",value:"false"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Content",property:"content-visual",type:o.TypeName.ADJUSTABLE,etsType:o.EtsType.COMB_CONTENT}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Label",property:"label-visual",type:o.TypeName.ADJUSTABLE,etsType:o.EtsType.COMB_CONTENT}}]},958:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.commonPropertyList=void 0;const n=r(513);t.commonPropertyList=[{propertySector:n.Sector.GENERAL,propertySet:{name:"BackgroundColor",property:"background-color-visual",type:n.TypeName.COLOR,etsType:n.EtsType.COMB_COLOR}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Display",property:"display-visual",type:n.TypeName.SELECT,defaults:"flex",list:[n.CLEAN_VALUE_NODE,{value:"flex"},{value:"none"}]}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Opacity",property:"opacity-visual",type:n.TypeName.SLIDER,etsType:n.EtsType.NUMBER,defaults:"1",step:.01,max:1,min:0}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Overflow",property:"overflow-visual",type:n.TypeName.SELECT,defaults:"visible",list:[n.CLEAN_VALUE_NODE,{value:"visible"},{value:"hidden"},{value:"scroll"}]}},{propertySector:n.Sector.FLEX,propertySet:{name:"FlexGrow",property:"flex-grow-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:"0",requiresParent:{display:["flex","cleanValue"]},info:"The flex grow factor of a flex item's main size"}},{propertySector:n.Sector.FLEX,propertySet:{name:"FlexShrink",property:"flex-shrink-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:"1",requiresParent:{display:["flex","cleanValue"]},info:"The flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items will shrink"}},{propertySector:n.Sector.FLEX,propertySet:{name:"Columns",property:"columns-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:1,info:"The column number of flex."}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Header Logo",property:"headerLogo-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Title",property:"title-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Status",property:"status-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Logo",property:"logo-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Color",property:"color-visual",type:n.TypeName.COLOR,etsType:n.EtsType.COMB_COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"FontFamily",property:"font-family-visual",type:n.TypeName.BASE,etsType:n.EtsType.STRING,defaults:"sans-serif"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"MaxLines",property:"max-lines-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextColor",property:"text-color-visual",type:n.TypeName.COLOR,defaults:"rgba(0,0,0,0.9)"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"FocusColor",property:"focus-color-visual",type:n.TypeName.COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"DisappearColor",property:"disappear-color-visual",type:n.TypeName.COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IndicatorColor",property:"indicator-color-visual",type:n.TypeName.COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IndicatorSelectedColor",property:"indicator-selected-color-visual",type:n.TypeName.COLOR,defaults:"#ff007dff"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IndicatorSize",property:"indicator-size-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorTop",property:"indicator-top-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorRight",property:"indicator-right-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorBottom",property:"indicator-bottom-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorLeft",property:"indicator-left-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:{name:"AllowScale",property:"allow-scale-visual",type:n.TypeName.SELECT,defaults:"true",list:[n.CLEAN_VALUE_NODE,{value:"true"},{value:"false"}]}},{propertySector:n.Sector.GRID,propertySet:{name:"GridRowStart",property:"grid-row-start-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The start position of its row in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridColumnStart",property:"grid-column-start-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The start position of its column in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridRowEnd",property:"grid-row-end-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The end position of its row in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridColumnEnd",property:"grid-column-end-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The end position of its column in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridTemplateRows",property:"grid-template-rows-visual",type:n.TypeName.BASE,defaults:"1fr",requires:{"display-visual":["grid"]},info:"The number of items in the grid rows."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridTemplateColumns",property:"grid-template-columns-visual",type:n.TypeName.BASE,defaults:"1fr",requires:{"display-visual":["grid"]},info:"The number of items in the grid columns."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridRowsGap",property:"grid-rows-gap-visual",type:n.TypeName.INTEGER,defaults:"0px",units:["px"],requires:{"display-visual":["grid"]},info:"The size of the gap between an element's grid rows."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridColumnsGap",property:"grid-columns-gap-visual",type:n.TypeName.INTEGER,defaults:"0px",units:["px"],requires:{"display-visual":["grid"]},info:"The size of the gap between an element's columns."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridGap",property:"grid-gap-visual",type:n.TypeName.INTEGER,units:["px"],requires:{"display-visual":["grid"]},info:"The gaps between rows and columns. It is a shorthand for row-gap and column-gap."}},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"MatchTextDirection",property:"match-text-direction-visual"},n.commonParamsForJudge)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"FitOriginalSize",property:"fit-original-size-visual"},n.commonParamsForJudge)},{propertySector:n.Sector.FEATURE,propertySet:{name:"IconWidth",property:"icon-width-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IconHeight",property:"icon-height-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextonColor",property:"texton-color-visual",type:n.TypeName.COLOR,defaults:"#000000"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextoffColor",property:"textoff-color-visual",type:n.TypeName.COLOR,defaults:"#000000"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextPadding",property:"text-padding-visual",type:n.TypeName.INTEGER,defaults:0,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"SelectedColor",property:"selected-color-visual",type:n.TypeName.COLOR,defaults:"rgba(0,125,255,1)"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"BlockColor",property:"block-color-visual",type:n.TypeName.COLOR,defaults:"#ffffff"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Radius",property:"radius-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"StartAngle",property:"start-angle-visual",type:n.TypeName.INTEGER,defaults:240}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TotalAngle",property:"total-angle-visual",type:n.TypeName.INTEGER,defaults:240}},{propertySector:n.Sector.FEATURE,propertySet:{name:"CenterX",property:"center-x-visual",type:n.TypeName.INTEGER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"CenterY",property:"center-y-visual",type:n.TypeName.INTEGER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Colors",property:"colors-visual",type:n.TypeName.BASE}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Weights",property:"weights-visual",type:n.TypeName.BASE}},{propertySector:n.Sector.FEATURE,propertySet:{name:"PlaceHolderColor",property:"placeholder-color-visual",type:n.TypeName.COLOR,defaults:"gray"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ProgressColor",property:"progress-color-visual",type:n.TypeName.COLOR,etsType:n.EtsType.COMB_COLOR,defaults:"black"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ItemExtent",property:"item-extent-visual",type:n.TypeName.INTEGER,units:["px","%"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"FadeColor",property:"fade-color-visual",type:n.TypeName.COLOR,defaults:"grey"}},{propertySector:n.Sector.FLEX,propertySet:{name:"ColumnSpan",property:"column-span-visual",type:n.TypeName.INTEGER,defaults:1,min:1,info:"The number of span."}},{propertySector:n.Sector.ATOMIC,propertySet:{name:"FlexWeight",property:"flex-weight-visual",type:n.TypeName.INTEGER}},{propertySector:n.Sector.ATOMIC,propertySet:{name:"AspectRatio",property:"aspect-ratio-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"SecondaryColor",property:"secondary-color-visual",type:n.TypeName.COLOR,requires:{type:["horizontal","ring","scale-ring"]}}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ScaleWidth",property:"scale-width-visual",type:n.TypeName.INTEGER,requires:{type:["ring","scale-ring"]}}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ScaleNumber",property:"scale-number-visual",type:n.TypeName.INTEGER,defaults:120,requires:{type:["ring","scale-ring"]}}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Value",property:"value-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:0}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Total",property:"total-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:100}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Style",property:"style-visual",type:n.TypeName.SELECT,etsType:n.EtsType.PROGRESS_STYLE,defaults:"Linear",list:[{value:"Linear"}]}}]},513:(e,t)=>{"use strict";var r,n,o;Object.defineProperty(t,"__esModule",{value:!0}),t.EtsType=t.commonParamsForBorderRadius=t.commonParamsForIndicator=t.commonParamsForInteger=t.commonParamsForJudge=t.commonParamsForBorder=t.CLEAN_VALUE_NODE=t.TypeName=t.Sector=void 0,function(e){e.GENERAL="general",e.DIMENSION="dimension",e.FEATURE="feature",e.FLEX="flex",e.GRID="grid",e.ATOMIC="atomic"}(r||(r={})),t.Sector=r,function(e){e.BASE="base",e.INTEGER="integer",e.SELECT="select",e.COLOR="color",e.COMPOSITE="composite",e.SLIDER="slider",e.DATA_SELECT_INPUT="dataSelectInput",e.ADJUSTABLE="adjustable"}(n||(n={})),t.TypeName=n,function(e){e.ARRAY="ETSArray",e.BOOLEAN="ETSBoolean",e.NUMBER="ETSNumber",e.OBJECT="ETSObject",e.STRING="ETSString",e.R_FLOAT="Rfloat",e.R_STRING="Rstring",e.R_COLOR="Rcolor",e.R_MEDIA="Rmedia",e.R_RAWFILE="Rrawfile",e.ALIGNMENT="Alignment",e.AXIS="Axis",e.BORDER_STYLE="BorderStyle",e.BUTTON_TYPE="ButtonType",e.COLOR="Color",e.DIRECTION="Direction",e.EDGE_EFFECT="EdgeEffect",e.ENTER_KEY_TYPE="EnterKeyType",e.FLEX_ALIGN="FlexAlign",e.FLEX_DIRECTION="FlexDirection",e.FLEX_WRAP="FlexWrap",e.FONT_STYLE="FontStyle",e.FONT_WEIGHT="FontWeight",e.HORIZONTAL_ALIGN="HorizontalAlign",e.IMAGE_FIT="ImageFit",e.IMAGE_INTERPOLATION="ImageInterpolation",e.IMAGE_RENDER_MODE="ImageRenderMode",e.IMAGE_REPERT="ImageRepeat",e.IMAGE_SIZE="ImageSize",e.INPUT_TYPE="InputType",e.ITEM_ALIGN="ItemAlign",e.LINE_CAP_STYLE="LineCapStyle",e.PROGRESS_STYLE="ProgressStyle",e.STICKY="Sticky",e.TEXT_ALIGN="TextAlign",e.TEXT_OVERFLOW="TextOverflow",e.TEXT_DECORATION_TYPE="TextDecorationType",e.TEXT_CASE="TextCase",e.VERTICAL_ALIGN="VerticalAlign",e.VISIBILITY="Visibility",e.COMB_COLOR="ETSString|ETSNumber|Color|Rcolor",e.COMB_LENGTH="ETSString|ETSNumber",e.COMB_R_LENGTH="ETSString|ETSNumber|Rfloat",e.COMB_CONTENT="ETSString|Rstring",e.COMB_SRC="ETSString|Rmedia|Rrawfile"}(o||(o={})),t.EtsType=o;const i={value:"cleanValue",name:"---Clean Value---"};t.CLEAN_VALUE_NODE=i;const a={type:n.SELECT,etsType:o.BORDER_STYLE,list:[i,{value:"dotted"},{value:"dashed"},{value:"solid"}]};t.commonParamsForBorder=a;const s={type:n.SELECT,etsType:o.BOOLEAN,defaults:"false",list:[i,{value:"true"},{value:"false"}]};t.commonParamsForJudge=s;const c={type:n.INTEGER,units:["px"],placeholder:"0px"};t.commonParamsForInteger=c;const l={type:n.INTEGER,units:["px","%"]};t.commonParamsForIndicator=l;const u={type:n.INTEGER,units:["px"]};t.commonParamsForBorderRadius=u},282:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagTypeMap=void 0,t.TagTypeMap=new Map([["button","TextContent"],["span","TextContent"],["divider","TextContent"],["picker","TextContent"],["option","TextContent"],["clock","TextContent"],["image","Base"],["input","Base"],["chart","Base"],["slider","Base"],["progress","Base"],["text","Text"],["div","Container"],["list","Container"],["list-item","Container"],["list-item-group","Container"],["refresh","Container"],["dialog","Container"],["stack","Container"],["menu","Container"],["select","Container"],["tabs","Container"],["tab-bar","Container"],["tab-content","Container"]])},294:(e,t)=>{"use strict";function r(e){const t=function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");let r="";for(let t=0;t=4&&(r=r.substr(r.length/2-2,4)),r}Object.defineProperty(t,"__esModule",{value:!0}),t.getUniqueName=t.getUniqueId=t.removeFromArray=t.getDataName=void 0,t.getDataName=function(e){if("string"==typeof e&&e.startsWith("{{")&&e.endsWith("}}"))return e.substring(2,e.length-2)},t.removeFromArray=function(e,t){const r=[...e];return t.forEach((e=>{const t=r.indexOf(e);-1!==t&&r.splice(t,1)})),r},t.getUniqueId=r,t.getUniqueName=function(e){return`${e}_${r(e)}`}},207:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formManager=void 0;const n=r(891),o=r(945);t.formManager={removeData(e){this.getFormModel().data.delete(e)},addData(e){e instanceof Map?e.forEach(((e,t)=>{this.getFormModel().data.set(t,e)})):Object.keys(e).forEach((t=>{this.getFormModel().data.set(t,e[t])}))},updateAllData(e){this.getFormModel().data.clear(),this.addData(e)},addAction(e,t,r,n){const i=new Map;void 0!==r&&Object.keys(r).forEach((e=>{i.set(e,r[e])}));const a=new Map;void 0!==n&&Object.keys(n).forEach((e=>{a.set(e,n[e])})),this.getFormModel().actions.set(e,new o.FormAction(t,i,a))},updateAllActions(e){this.getFormModel().actions.clear(),e.forEach(((e,t)=>{const r=void 0===e.params?e.params:this.objectToMap(e.params),n=void 0===e.want?e.want:this.objectToMap(e.want),i=new o.FormAction(e.actionType,r,n);this.getFormModel().actions.set(t,i)}))},removeAction(e){this.getFormModel().actions.delete(e)},addActionParams(e,t){var r,n;const i=null!==(r=this.getFormModel().actions.get(e))&&void 0!==r?r:new o.FormAction(e),a=null!==(n=i.params)&&void 0!==n?n:new Map;Object.keys(t).forEach((e=>{a.set(e,t[e])})),i.params=a},removeActionParam(e,t){var r;const n=this.getFormModel().actions.get(e);null===(r=null==n?void 0:n.params)||void 0===r||r.delete(t)},getFormModel:()=>(0,n.getInstance)().formData,codegenToJson:function(){const e=(0,n.getInstance)().formData,t=this.mapToObject(e.data),r={actions:{},data:{}};return r.data=t,e.actions.forEach(((e,t)=>{r.actions[t]={},r.actions[t].action=e.action,e.params instanceof Map&&e.params.size>0&&(r.actions[t].params=this.mapToObject(e.params)),e.want instanceof Map&&e.want.size>0&&(r.actions[t].want=this.mapToObject(e.want))})),JSON.stringify(r,null,4)},clear(){(0,n.getInstance)().formData.data.clear(),(0,n.getInstance)().formData.actions.clear()},mapToObject:e=>void 0===e?{}:Array.from(e.entries()).reduce(((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r})),{}),objectToMap(e){const t=new Map;return Object.keys(e).forEach(((r,n)=>{t.set(r,e[r])})),t}}},945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FormAction=t.FormModel=void 0,t.FormModel=class{constructor(){this.data=new Map,this.actions=new Map}},t.FormAction=class{constructor(e,t,r){this.action=e,this.params=t,this.want=r}}},509:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeForVersion1=t.rootToVisualContent=t.visualToRootContent=t.serializeForVersion1=void 0;const n=r(891),o=r(933),i=r(571),a=r(282),s=r(945),c=r(977),l=new Map;function u(e){l.set("textMap",new Map);const t=p(null!=e?e:(0,n.getInstance)().visualModel);return JSON.stringify({VisualVersion:"1",content:JSON.stringify(t),extraData:JSON.stringify(y(l))})}function p(e){const t=Array.from(e.property).filter((t=>(0,i.isAttribute)(t[0],e.type)));t.push(["id",e.id]);const r=Array.from(e.property).filter((t=>(0,i.isStyle)(t[0],e.type)));let n=a.TagTypeMap.get(e.type);void 0===n&&(n="Base");let o=e.property.has("content")?e.property.get("content"):[];if(e.children.length>0){if("string"==typeof o){const t=l.get("textMap");t instanceof Map&&t.set(e.id,o)}o=e.children.map((e=>p(e)))}return{id:e.id,tagName:e.type,attributes:t,idStyle:r,type:n,content:o}}function f(e,t){let r;if(t instanceof Map){const n=t.get("textMap");n instanceof Map&&(r=n.get(e.id))}const n=new o.VisualModel({id:e.id,type:e.tagName,property:new Map([...e.attributes,...e.idStyle])});return"string"==typeof r&&n.property.set("content",r),n.property.delete("id"),"string"==typeof e.content&&n.property.set("content",e.content),Array.isArray(e.content)&&(n.children=e.content.map((e=>f(e,t)))),n}function d(e){if(e instanceof Array&&e.length>0&&"$$map"===e[0]){e.shift();const t=new Map;for(const[r,n]of e)t.set(r,d(n));return t}return e}function y(e){if(e instanceof Map){const t=["$$map"];for(const[r,n]of e)t.push([r,y(n)]);return t}return e}t.serializeForVersion1=u,t.visualToRootContent=function(e){try{return u(JSON.parse(e,c.reviver).visualModel)}catch(e){console.error("convert visual model to root model failed")}return e},t.rootToVisualContent=function(e){const t=JSON.parse(e),r=JSON.parse(t.content);let n='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(n=JSON.parse(t.extraData));const o=f(r,d(n));return o.property.has("flex-direction")||o.property.set("flex-direction","column"),JSON.stringify({document:{VisualVersion:"12",type:"FA"},visualModel:o,formData:new s.FormModel},c.replacer)},t.deserializeForVersion1=function(e){try{const t=JSON.parse(e),r=JSON.parse(t.content);let o='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(o=JSON.parse(t.extraData)),(0,n.getInstance)().visualModel=f(r,d(o)),(0,n.getInstance)().visualModel.property.has("flex-direction")||(0,n.getInstance)().visualModel.property.set("flex-direction","column")}catch(e){console.error("convert error")}}},891:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setInstance=t.getInstance=void 0;const n=r(933),o=r(945),i=r(904),a={document:{VisualVersion:"12",type:"FA"},visualModel:new n.VisualModel({type:"div",id:"wrapper"}),formData:new o.FormModel};t.getInstance=function(){return a},t.setInstance=function(e){for(const t in a)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=e[t]);const t=a.document.type;(0,i.setDomain)("ETS"===t?i.Domain.ETS:"FORM"===t?i.Domain.FORM:i.Domain.FA)}},977:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviver=t.replacer=t.deserialize=t.serialize=void 0;const n=r(933),o=r(891),i=r(509);function a(e,t){if(t instanceof Map)return{dataType:"Map",value:Object.fromEntries(t.entries())};if(t instanceof Set)return{dataType:"Set",value:Array.from(t.entries())};if(t instanceof n.VisualModel){const e=new n.VisualModel({type:"none"}),r={};for(const n in e)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return{dataType:"VisualModel",value:r}}return t}function s(e,t){if("object"==typeof t&&null!=t){if("Map"===t.dataType)return new Map(Object.entries(t.value));if("Set"===t.dataType)return new Set(t.value);if("VisualModel"===t.dataType){const e=new n.VisualModel({type:""});Object.assign(e,t.value),t=e}}return t}t.serialize=function(e,t){return 1===e?(0,i.serializeForVersion1)(t):JSON.stringify(null!=t?t:(0,o.getInstance)(),a,4)},t.deserialize=function(e){if("1"===JSON.parse(e).VisualVersion)return(0,i.deserializeForVersion1)(e);const t=JSON.parse(e,s);(0,o.setInstance)(t)},t.replacer=a,t.reviver=s},933:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VisualModel=void 0;const r="-visual";t.VisualModel=class{constructor(e){if(this.mediaProperty=void 0,this.dynamicMediaProperty=void 0,this.property=void 0!==e.property?e.property:new Map,this.dynamicProperty=void 0!==e.dynamicProperty?e.dynamicProperty:new Map,this.children=void 0!==e.children?e.children:[],"wrapper"===e.type)return this.id="wrapper",void(this.type="div");e.type.endsWith(r)&&(e.type=e.type.substring(0,e.type.length-r.length)),this.id=void 0!==e.id?e.id:"",this.type=e.type}getProperty(e){const t=this.dynamicProperty.get(e);return void 0!==t&&""!==t?t:this.property.get(e)}hasMediaProperty(e){if(void 0!==this.mediaProperty)for(const[,t]of this.mediaProperty)if(null==t?void 0:t.has(e))return!0;if(void 0!==this.dynamicMediaProperty)for(const[,t]of this.dynamicMediaProperty)if(null==t?void 0:t.has(e))return!0;return!1}hasProperty(e){return this.dynamicProperty.has(e)||this.property.has(e)}accept(e){return e.visit(this)}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0});const t=r(784),o=r(891),i=r(977),a=r(844),s=r(55),c=r(207),l=r(413),u=r(435),p=r(486),f={build:"",etsImport:"",etsVariable:"",etsFunction:"",aboutToAppear:""};function d(e,r){var n;try{(0,i.deserialize)(e);const t=(0,o.getInstance)().document.VisualVersion,n=/^([1-9]+[0-9]*)$/;if(void 0===t)r.errorType="versionError";else{const e=t.match(n);(null===e||parseInt(e[1])>12)&&(r.errorType="versionError")}}catch(e){r.errorType="fileError"}""!==r.errorType&&(r.errorMessage=null!==(n=t.errorMap.get(r.errorType))&&void 0!==n?n:"Codegen visual file failed")}e.genHmlAndCss=function(e){const r={hmlCss:{hml:"",css:"",json:""},errorType:"",errorMessage:""};if(d(e,r),""!==r.errorType)return r.hmlCss.hml="",r.hmlCss.css="",r;try{const e=function(e){const t={hml:"",css:"",json:""},r=new a.HMLBridge,n=e.accept(r),o=(0,s.genFAHML)(n);t.hml=r.getErrorCount()>0?"error":o;const i=new a.CSSBridge,c=e.accept(i),l=(0,s.genFACSS)(c);return t.css=i.getErrorCount()>0?"error":l,t}((0,o.getInstance)().visualModel);"error"!==e.hml&&"error"!==e.css||(r.errorType="codegenError"),r.hmlCss=e,"FORM"===(0,o.getInstance)().document.type&&(r.hmlCss.json=c.formManager.codegenToJson())}catch(e){r.errorType="modelError"}return""!==r.errorType&&(r.errorMessage=t.errorMap.get(r.errorType),r.hmlCss.hml="",r.hmlCss.css=""),r},e.genETS=function(e){var r;const n={ets:(0,p.cloneDeep)(f),errorType:"",errorMessage:""};if(d(e,n),""!==n.errorType)return n.ets=(0,p.cloneDeep)(f),n;try{const e=function(e){const t=new l.ETSBridge,r=e.accept(t),n=(new u.StringWriter).genETS(r);return t.getErrorCount()>0?"error":n}((0,o.getInstance)().visualModel);"error"===e&&(n.errorType="codegenError"),n.ets=e}catch(e){n.errorType="modelError"}return""!==n.errorType&&(n.errorMessage=null!==(r=t.errorMap.get(n.errorType))&&void 0!==r?r:"Codegen visual file failed",n.ets=(0,p.cloneDeep)(f)),n}})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); diff --git a/compiler/components/form_component.json b/compiler/components/form_component.json index 5532c7f5a9effb104127bc5bb840837c6822c50b..ea5f1bf0fced9605200cf8f2a5838e6ab70dea99 100644 --- a/compiler/components/form_component.json +++ b/compiler/components/form_component.json @@ -3,6 +3,6 @@ "atomic": true, "attrs": [ "size", "moduleName", "dimension", "allowUpdate", "visibility", - "onAcquired", "onError", "onRouter" + "onAcquired", "onError", "onRouter", "onUninstall" ] } \ No newline at end of file diff --git a/compiler/components/web.json b/compiler/components/web.json index 4cb5105b83bcf749f2287b7548af205e5f3688a6..be881ee057b67f1a0522feaecffc33d5519de02a 100644 --- a/compiler/components/web.json +++ b/compiler/components/web.json @@ -7,6 +7,6 @@ "onPageEnd", "onPageBegin", "onProgressChange", "onTitleReceive", "onGeolocationHide", "onGeolocationShow", "onRequestSelected", "javaScriptAccess", "fileAccess", "onAlert", "onBeforeUnload", "onlineImageAccess", "domStorageAccess", "imageAccess", "mixedMode", "zoomAccess", "geolocationAccess", "javaScriptProxy", - "onConfirm", "onConsole", "onErrorReceive", "onHttpErrorReceive", "onDownloadStart" + "userAgent", "onConfirm", "onConsole", "onErrorReceive", "onHttpErrorReceive", "onDownloadStart" ] } \ No newline at end of file diff --git a/compiler/deps/ohos-typescript-4.2.3-r2.tgz b/compiler/deps/ohos-typescript-4.2.3-r2.tgz new file mode 120000 index 0000000000000000000000000000000000000000..03a9d71c8613d6d1882c4389a355f258fc477fe5 --- /dev/null +++ b/compiler/deps/ohos-typescript-4.2.3-r2.tgz @@ -0,0 +1 @@ +../../../../third_party/typescript/build_package/ohos-typescript-4.2.3-r2.tgz \ No newline at end of file diff --git a/compiler/main.js b/compiler/main.js index aa25d1a8b5df60a8ad647e0e21c7d24ab7d2965a..8b7fbca3bab5d05780ecf6fd3ae7ea1f6c822a93 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -15,6 +15,7 @@ const fs = require('fs'); const path = require('path'); +const md5 = require('md5'); const { readFile } = require('./lib/utils'); const { WORKERS_DIR } = require('./lib/pre_define'); @@ -34,7 +35,8 @@ const staticPreviewPage = process.env.aceStaticPreview; const abilityConfig = { abilityType: process.env.abilityType || 'page', abilityEntryFile: null, - projectAbilityPath: [] + projectAbilityPath: [], + testRunnerFile: [] }; const projectConfig = {}; const resources = { @@ -54,6 +56,9 @@ function initProjectConfig(projectConfig) { projectConfig.aceModuleJsonPath = projectConfig.aceModuleJsonPath || process.env.aceModuleJsonPath; projectConfig.aceSuperVisualPath = projectConfig.aceSuperVisualPath || process.env.aceSuperVisualPath + projectConfig.hashProjectPath = projectConfig.hashProjectPath || + hashProjectPath(projectConfig.projectPath) + projectConfig.aceBuildJson = projectConfig.aceBuildJson || process.env.aceBuildJson; } function loadEntryObj(projectConfig) { @@ -61,10 +66,13 @@ function loadEntryObj(projectConfig) { initProjectConfig(projectConfig); if (process.env.aceManifestPath) { setEntryFile(projectConfig); + setFaTestRunnerFile(projectConfig); } if (process.env.aceModuleJsonPath) { setAbilityPages(projectConfig) + setStageTestRunnerFile(projectConfig); } + if(staticPreviewPage) { projectConfig.entryObj['./' + staticPreviewPage] = projectConfig.projectPath + path.sep + staticPreviewPage + '.ets?entry'; @@ -147,6 +155,38 @@ function setAbilityPages(projectConfig) { } } +function setFaTestRunnerFile(projectConfig) { + const index =projectConfig.projectPath.split(path.sep).join('/').lastIndexOf('\/'); + const testRunnerPath = path.resolve(projectConfig.projectPath.substring(0,index + 1), "TestRunner"); + if (fs.existsSync(testRunnerPath)) { + const testRunnerFiles = []; + readFile(testRunnerPath, testRunnerFiles); + testRunnerFiles.forEach((item) => { + if (/\.(ts|js)$/.test(item)) { + const relativePath = path.relative(testRunnerPath, item).replace(/\.(ts|js)$/, ''); + projectConfig.entryObj["../TestRunner/" + relativePath] = item; + abilityConfig.testRunnerFile.push(item); + } + }) + } +} + +function setStageTestRunnerFile(projectConfig) { + const index =projectConfig.projectPath.split(path.sep).join('/').lastIndexOf('\/'); + const testRunnerPath = path.resolve(projectConfig.projectPath, "TestRunner"); + if (fs.existsSync(testRunnerPath)) { + const testRunnerFiles = []; + readFile(testRunnerPath, testRunnerFiles); + testRunnerFiles.forEach((item) => { + if (/\.(ts|js)$/.test(item)) { + const relativePath = path.relative(testRunnerPath, item).replace(/\.(ts|js)$/, ''); + projectConfig.entryObj["./TestRunner/" + relativePath] = item; + abilityConfig.testRunnerFile.push(item); + } + }) + } +} + function setAbilityFile(projectConfig, abilityPages) { abilityPages.forEach(abilityPath => { if (abilityPath && fs.existsSync(path.resolve(projectConfig.projectPath, '../', abilityPath))) { @@ -187,17 +227,44 @@ function setEntrance(abilityConfig, abilityPages) { } function loadWorker(projectConfig) { - const workerPath = path.resolve(projectConfig.projectPath, WORKERS_DIR); - if (fs.existsSync(workerPath)) { - const workerFiles = []; - readFile(workerPath, workerFiles); - workerFiles.forEach((item) => { - if (/\.(ts|js)$/.test(item)) { - const relativePath = path.relative(workerPath, item).replace(/\.(ts|js)$/, ''); - projectConfig.entryObj[`./${WORKERS_DIR}/` + relativePath] = item; + if (validateWorkOption()) { + const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceBuildJson).toString()); + workerConfig.workers.forEach(worker => { + if (!/\.(ts|js)$/.test(worker)) { + worker += '.ts'; + } + const relativePath = path.relative(projectConfig.projectPath, worker); + if (filterWorker(relativePath)) { + projectConfig.entryObj[relativePath.replace(/\.(ts|js)$/,'')] = worker; } }) + } else { + const workerPath = path.resolve(projectConfig.projectPath, WORKERS_DIR); + if (fs.existsSync(workerPath)) { + const workerFiles = []; + readFile(workerPath, workerFiles); + workerFiles.forEach((item) => { + if (/\.(ts|js)$/.test(item)) { + const relativePath = path.relative(workerPath, item).replace(/\.(ts|js)$/, ''); + projectConfig.entryObj[`./${WORKERS_DIR}/` + relativePath] = item; + } + }) + } + } +} + +function validateWorkOption() { + if (projectConfig.aceBuildJson && fs.existsSync(projectConfig.aceBuildJson)) { + const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceBuildJson).toString()); + if(workerConfig.workers) { + return true; + } } + return false; +} + +function filterWorker(workerPath) { + return /\.(ts|js)$/.test(workerPath) && !/^\.\./.test(workerPath); } ;(function initSystemResource() { @@ -243,6 +310,17 @@ function processResourceArr(resourceArr, resourceMap, filePath) { } } +function hashProjectPath(projectPath) { + const ASSCIIStart = 65; + const ASSCIIEnd = 90; + const deviation = 1; + process.env.hashProjectPath = + String.fromCharCode(Math.floor(Math.random() * (ASSCIIEnd - ASSCIIStart + deviation) + ASSCIIStart)) + + md5(projectPath).substring(9, 16) + + String.fromCharCode(Math.floor(Math.random() * (ASSCIIEnd - ASSCIIStart + deviation) + ASSCIIStart)); + return process.env.hashProjectPath; +} + exports.projectConfig = projectConfig; exports.loadEntryObj = loadEntryObj; exports.readAppResource = readAppResource; diff --git a/compiler/package-lock.json b/compiler/package-lock.json index 5940092f451a0e686a53c139b3de1dd77d3748fb..d228e0e9d116a92fada478be7b067c53989424f0 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -1925,6 +1925,11 @@ "supports-color": "^7.1.0" } }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmmirror.com/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==" + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.nlark.com/check-error/download/check-error-1.0.2.tgz", @@ -2101,6 +2106,11 @@ "which": "^2.0.1" } }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmmirror.com/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" + }, "date-format": { "version": "3.0.0", "resolved": "https://registry.nlark.com/date-format/download/date-format-3.0.0.tgz", @@ -2732,6 +2742,11 @@ "resolved": "https://registry.npmmirror.com/ignore/download/ignore-5.2.0.tgz", "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" }, + "ignore-loader": { + "version": "0.1.2", + "resolved": "https://registry.npmmirror.com/ignore-loader/-/ignore-loader-0.1.2.tgz", + "integrity": "sha512-yOJQEKrNwoYqrWLS4DcnzM7SEQhRKis5mB+LdKKh4cPmGYlLPR0ozRzHV5jmEk2IxptqJNQA5Cc0gw8Fj12bXA==" + }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npm.taobao.org/import-fresh/download/import-fresh-3.3.0.tgz?cache=0&sync_timestamp=1608469520474&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fimport-fresh%2Fdownload%2Fimport-fresh-3.3.0.tgz", @@ -2793,6 +2808,11 @@ "binary-extensions": "^2.0.0" } }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, "is-core-module": { "version": "2.8.0", "resolved": "https://registry.npmmirror.com/is-core-module/download/is-core-module-2.8.0.tgz?cache=0&sync_timestamp=1634236702465&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fis-core-module%2Fdownload%2Fis-core-module-2.8.0.tgz", @@ -3063,6 +3083,16 @@ "integrity": "sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=", "dev": true }, + "md5": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "memory-fs": { "version": "0.5.0", "resolved": "https://registry.nlark.com/memory-fs/download/memory-fs-0.5.0.tgz", @@ -4043,9 +4073,8 @@ "dev": true }, "typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmmirror.com/typescript/download/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==" + "version": "file:deps/ohos-typescript-4.2.3-r2.tgz", + "integrity": "sha512-a94p5mnxZMe9sJebu6gw2ixGaVGuKo7H3fU+Vd+VrogYbRrrCphlrJ2nlZnpm9r0TYe4HwHrmGkeyeJW63XUSA==" }, "uglify-js": { "version": "3.14.5", diff --git a/compiler/package.json b/compiler/package.json index 0efc498eccef602e589339ba616b5e0e6017b902..a3ac31aceab785c83a2d361969e4319060aa2198 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -30,9 +30,9 @@ "eslint": "^7.16.0", "mocha": "^8.2.1", "mocha-context": "^0.1.5", + "pegjs": "^0.10.0", "ts-node": "^9.1.1", - "uglify-js": "^3.13.0", - "pegjs": "^0.10.0" + "uglify-js": "^3.13.0" }, "dependencies": { "clean-webpack-plugin": "^3.0.0", @@ -40,8 +40,9 @@ "deccjsunit": "^1.0.6", "ignore-loader": "^0.1.2", "log4js": "^6.3.0", + "md5": "^2.3.0", "ts-loader": "^8.0.12", - "typescript": "^4.1.3", + "typescript": "file:./deps/ohos-typescript-4.2.3-r2.tgz", "webpack": "^5.48.0", "webpack-cli": "^4.2.0", "ws": "^8.3.0" diff --git a/compiler/server/build_pipe_server.js b/compiler/server/build_pipe_server.js index 4d3e8a63b3f583f1c8cb61fd67b0a9394851295e..fbc9c398c5870a3aa21b5dbf8fed18d47c0f385d 100644 --- a/compiler/server/build_pipe_server.js +++ b/compiler/server/build_pipe_server.js @@ -22,6 +22,12 @@ const WebSocketServer = WebSocket.Server; let pluginSocket = ''; +let supplement = { + isAcceleratePreview: false, + line: 0, + column: 0 +} + const pluginCommandChannelMessageHandlers = { 'compileComponent': handlePluginCompileComponent, 'default': () => {} @@ -50,14 +56,35 @@ function handlePluginCommand(jsonData) { function handlePluginCompileComponent(jsonData) { const receivedMsg = jsonData; - const sourceNode = ts.createSourceFile - ('preview.ts', receivedMsg.data.script, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + const sourceNode = ts.createSourceFile('preview.ts', receivedMsg.data.script, + ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); const previewStatements = []; - processComponentChild(sourceNode, previewStatements, []); + const log = []; + supplement = { + isAcceleratePreview: true, + line: parseInt(JSON.parse(receivedMsg.data.offset).line), + column: parseInt(JSON.parse(receivedMsg.data.offset).column) + } + processComponentChild(sourceNode, previewStatements, log, supplement); + supplement.isAcceleratePreview = false; const newSource = ts.factory.updateSourceFile(sourceNode, previewStatements); const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); const result = printer.printNode(ts.EmitHint.Unspecified, newSource, newSource); receivedMsg.data.script = ts.transpileModule(result, {}).outputText; + if (receivedMsg.data.offset) { + for (let i = 0; i < log.length; i++) { + let line = parseInt(newSource.getLineAndCharacterOfPosition(log[i].pos).line); + let column = parseInt(newSource.getLineAndCharacterOfPosition(log[i].pos).character); + if (line === 0) { + log[i].line = parseInt(JSON.parse(receivedMsg.data.offset).line); + log[i].column = parseInt(JSON.parse(receivedMsg.data.offset).column) + column; + } else { + log[i].line = parseInt(JSON.parse(receivedMsg.data.offset).line) + line; + log[i].column = column; + } + } + } + receivedMsg.data.log = log; if (pluginSocket.readyState === WebSocket.OPEN){ responseToPlugin(receivedMsg); } diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index c279652a042560616524acb5b1902d17f59e08c6..a086d8a404e0ba92183f2b0bb7f9a253da8a5a7e 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +import * as ts from 'typescript'; import Stats from 'webpack/lib/Stats'; import Compiler from 'webpack/lib/Compiler'; import Compilation from 'webpack/lib/Compilation'; @@ -27,23 +28,18 @@ import fs from 'fs'; import CachedSource from 'webpack-sources/lib/CachedSource'; import ConcatSource from 'webpack-sources/lib/ConcatSource'; -import { - BUILDIN_STYLE_NAMES, - EXTEND_ATTRIBUTE, - STYLES_ATTRIBUTE -} from './component_map'; import { transformLog } from './process_ui_syntax'; -import { - dollarCollection, - componentCollection, - moduleCollection -} from './validate_ui_syntax'; -import { decoratorParamSet } from './process_component_member'; -import { appComponentCollection } from './process_component_build'; +import { moduleCollection } from './validate_ui_syntax'; import { projectConfig } from '../main'; import { circularFile } from './utils'; import { MODULE_SHARE_PATH, BUILD_SHARE_PATH } from './pre_define'; -import { COMMON_ATTRS } from './component_map'; +import { + createLanguageService, + dollarCollection, + appComponentCollection, + decoratorParamsCollection, + extendCollection +} from './ets_checker'; configure({ appenders: { 'ETS': {type: 'stderr', layout: {type: 'messagePassThrough'}}}, @@ -52,13 +48,6 @@ configure({ export const logger = getLogger('ETS'); export const props: string[] = []; -const GLOBAL_COMMON_MODULE_CACHE: string = ` -globalThis["__common_module_cache__"] = globalThis["__common_module_cache__"] || {}; -globalThis["webpackChunkcompilier"].forEach((item)=> { - Object.keys(item[1]).forEach((element) => { - globalThis["__common_module_cache__"][element] = null; - }) -});`; interface Info { message?: string; @@ -85,7 +74,7 @@ export class ResultStates { compiler.hooks.compilation.tap('SourcemapFixer', compilation => { compilation.hooks.afterProcessAssets.tap('SourcemapFixer', assets => { Reflect.ownKeys(assets).forEach(key => { - if (/\.map$/.test(key.toString())) { + if (/\.map$/.test(key.toString()) && assets[key]._value) { assets[key]._value = assets[key]._value.toString().replace('.ets?entry', '.ets'); } }); @@ -116,6 +105,15 @@ export class ResultStates { stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS }, (assets) => { + const GLOBAL_COMMON_MODULE_CACHE = ` + globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] =` + + ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] || {}; + globalThis["webpackChunk${projectConfig.hashProjectPath}"].forEach((item)=> { + Object.keys(item[1]).forEach((element) => { + globalThis["__common_module_cache__${projectConfig.hashProjectPath}"][element] = null; + }) + });`; + if (assets['commons.js']) { assets['commons.js'] = new CachedSource( new ConcatSource(assets['commons.js'], GLOBAL_COMMON_MODULE_CACHE)); @@ -129,27 +127,60 @@ export class ResultStates { compiler.hooks.compilation.tap('Require', compilation => { JavascriptModulesPlugin.getCompilationHooks(compilation).renderRequire.tap('renderRequire', (source) => { - return `var commonCachedModule = globalThis["__common_module_cache__"] ? ` + - `globalThis["__common_module_cache__"][moduleId]: null;\n` + + return `var commonCachedModule = globalThis` + + `["__common_module_cache__${projectConfig.hashProjectPath}"] ? ` + + `globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + + `[moduleId]: null;\n` + `if (commonCachedModule) { return commonCachedModule.exports; }\n` + source.replace('// Execute the module function', - `if (globalThis["__common_module_cache__"] && moduleId.indexOf("?name=") < 0 && ` + - `Object.keys(globalThis["__common_module_cache__"]).indexOf(moduleId) >= 0) {\n` + - ` globalThis["__common_module_cache__"][moduleId] = module;\n}`); + `if (globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + + ` && moduleId.indexOf("?name=") < 0 && ` + + `Object.keys(globalThis["__common_module_cache__${projectConfig.hashProjectPath}"])` + + `.indexOf(moduleId) >= 0) {\n` + + ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + + `[moduleId] = module;\n}`); }); }); + compiler.hooks.run.tapPromise('CheckSyntax', async(compiler) => { + const rootFileNames: string[] = []; + Object.values(projectConfig.entryObj).forEach((fileName: string) => { + rootFileNames.push(fileName.replace('?entry', '')); + }); + const languageService: ts.LanguageService = createLanguageService(rootFileNames); + const rootProgram: ts.Program = languageService.getProgram(); + props.push(...dollarCollection, ...decoratorParamsCollection, ...extendCollection); + let allDiagnostics: ts.Diagnostic[] = rootProgram + .getSyntacticDiagnostics() + .concat(rootProgram.getSemanticDiagnostics()) + .concat(rootProgram.getDeclarationDiagnostics()); + allDiagnostics = allDiagnostics.filter((item) => { + return this.validateError(ts.flattenDiagnosticMessageText(item.messageText, '\n')); + }); + this.mErrorCount += allDiagnostics.length; + allDiagnostics.forEach((diagnostic: ts.Diagnostic) => { + const message: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); + if (diagnostic.file) { + const { line, character }: ts.LineAndCharacter = + diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); + logger.error(this.red, + `ETS:ERROR File: ${diagnostic.file.fileName}:${line + 1}:${character + 1}\n ${message}\n`); + } else { + logger.error(this.red, `ETS:ERROR: ${message}`); + } + }); + }); + compiler.hooks.done.tap('Result States', (stats: Stats) => { this.mStats = stats; this.warningCount = 0; this.noteCount = 0; if (this.mStats.compilation.errors) { - this.mErrorCount = this.mStats.compilation.errors.length; + this.mErrorCount += this.mStats.compilation.errors.length; } if (this.mStats.compilation.warnings) { this.mWarningCount = this.mStats.compilation.warnings.length; } - props.push(...dollarCollection, ...decoratorParamSet, ...BUILDIN_STYLE_NAMES); this.printResult(); }); @@ -254,41 +285,25 @@ export class ResultStates { } private validateError(message: string): boolean { const propInfoReg: RegExp = /Cannot find name\s*'(\$?\$?[_a-zA-Z0-9]+)'/; - const componentNameReg: RegExp = /'typeof\s*(\$?[_a-zA-Z0-9]+)' is not callable/; - const stateInfoReg: RegExp = /Property\s*'(\$[_a-zA-Z0-9]+)' does not exist on type/; - const extendInfoReg: RegExp = - /Property\s*'([_a-zA-Z0-9]+)' does not exist on type\s*'([_a-zA-Z0-9]+)(Attribute|Interface)'\./; - if (this.matchMessage(message, props.concat([...STYLES_ATTRIBUTE]), propInfoReg) || - this.matchMessage(message, [...componentCollection.customComponents], componentNameReg) || - this.matchMessage(message, props, stateInfoReg) || - this.matchMessage(message, EXTEND_ATTRIBUTE, extendInfoReg, true) || - this.matchMessage(message, [...STYLES_ATTRIBUTE, ...COMMON_ATTRS], extendInfoReg)) { + const stateInfoReg: RegExp = /Property\s*'(\$?[_a-zA-Z0-9]+)' does not exist on type/; + if (this.matchMessage(message, props, propInfoReg) || + this.matchMessage(message, props, stateInfoReg)) { return false; } return true; } - private matchMessage(message: string, nameArr: any, reg: RegExp, - validateComponent: boolean = false): boolean { + private matchMessage(message: string, nameArr: any, reg: RegExp): boolean { if (reg.test(message)) { const match: string[] = message.match(reg); - if (validateComponent) { - if (match[1] && match[2] && nameArr.has(match[2])) { - const attributeArray: string[] = [...nameArr.get(match[2])].map(item => item.attribute); - if (attributeArray.includes(match[1])) { - return true; - } - } - } else { - if (match[1] && nameArr.includes(match[1])) { - return true; - } + if (match[1] && nameArr.includes(match[1])) { + return true; } } return false; } private filterModuleError(message: string): string { if (/You may need an additional loader/.test(message) && transformLog && transformLog.sourceFile) { - const fileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); + const fileName: string = transformLog.sourceFile.fileName; const errorInfos: string[] = message.split('You may need an additional loader to handle the result of these loaders.'); if (errorInfos && errorInfos.length > 1 && errorInfos[1]) { message = `ERROR in ${fileName}\n The following syntax is incorrect.${errorInfos[1]}`; diff --git a/compiler/src/component_map.ts b/compiler/src/component_map.ts index 615a675f923216b4b940906dc3878ff1f288e3ba..c7fe3d1b0f4e70179df6f35fd4b1bba116e7e609 100644 --- a/compiler/src/component_map.ts +++ b/compiler/src/component_map.ts @@ -75,13 +75,13 @@ export interface ExtendParamterInterfance { attribute: string, parameterCount: number } -export const EXTEND_ATTRIBUTE: Map> = new Map(); +export const EXTEND_ATTRIBUTE: Map> = new Map(); export const STYLES_ATTRIBUTE: Set = new Set(); export const INTERFACE_NODE_SET: Set = new Set(); export const JS_BIND_COMPONENTS: Set = new Set([ - ...GESTURE_TYPE_NAMES, 'Gesture', + 'ForEach', 'LazyForEach', ...GESTURE_TYPE_NAMES, 'Gesture', 'PanGestureOption', 'CustomDialogController', 'Storage', 'Scroller', 'SwiperController', 'TabsController', 'CalendarController', 'AbilityController', 'VideoController', 'WebController', 'XComponentController', 'CanvasRenderingContext2D', 'CanvasGradient', 'ImageBitmap', 'ImageData', diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts new file mode 100644 index 0000000000000000000000000000000000000000..cab0eead8273ee6fed28629ad431e2f259fc72a9 --- /dev/null +++ b/compiler/src/ets_checker.ts @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import path from 'path'; +import * as ts from 'typescript'; + +import { projectConfig } from '../main'; +import { + processSystemApi, + preprocessExtend +} from './validate_ui_syntax'; +import { + INNER_COMPONENT_MEMBER_DECORATORS, + COMPONENT_IF, + COMPONENT_DECORATORS_PARAMS +} from './pre_define'; +import { JS_BIND_COMPONENTS } from './component_map'; + +function readDeaclareFiles(): string[] { + const declarationsFileNames: string[] = []; + fs.readdirSync(path.resolve(__dirname, '../declarations')) + .forEach((fileName: string) => { + if (/\.d\.ts$/.test(fileName)) { + declarationsFileNames.push(path.resolve(__dirname, '../declarations', fileName)); + } + }); + return declarationsFileNames; +} + +export function createLanguageService(rootFileNames: string[]): ts.LanguageService { + const compilerOptions: ts.CompilerOptions = ts.readConfigFile( + path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions; + Object.assign(compilerOptions, { + 'moduleResolution': ts.ModuleResolutionKind.NodeJs, + 'target': ts.ScriptTarget.ES2017, + 'baseUrl': path.resolve(projectConfig.projectPath), + 'paths': { + '*': [ + '*', + '../../../../../*' + ] + }, + 'lib': [ + 'lib.es2020.d.ts' + ] + }); + const files: ts.MapLike<{ version: number }> = {}; + const servicesHost: ts.LanguageServiceHost = { + getScriptFileNames: () => [...rootFileNames, ...readDeaclareFiles()], + getScriptVersion: fileName => + files[fileName] && files[fileName].version.toString(), + getScriptSnapshot: fileName => { + if (!fs.existsSync(fileName)) { + return undefined; + } + if (/(? process.cwd(), + getCompilationSettings: () => compilerOptions, + getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, + readDirectory: ts.sys.readDirectory, + resolveModuleNames(moduleNames: string[], containingFile: string): ts.ResolvedModuleFull[] { + const resolvedModules: ts.ResolvedModuleFull[] = []; + for (const moduleName of moduleNames) { + const result = ts.resolveModuleName(moduleName, containingFile, compilerOptions, { + fileExists(fileName: string): boolean { + return ts.sys.fileExists(fileName); + }, + readFile(fileName: string): string | undefined { + return ts.sys.readFile(fileName); + } + }); + if (result.resolvedModule) { + resolvedModules.push(result.resolvedModule); + } else if (/^@(system|ohos)/.test(moduleName.trim())) { + const modulePath: string = path.resolve(__dirname, '../../../api', moduleName + '.d.ts'); + if (ts.sys.fileExists(modulePath)) { + resolvedModules.push(getResolveModule(modulePath, '.d.ts')); + } + } else if (/\.ets$/.test(moduleName)) { + const modulePath: string = path.resolve(path.dirname(containingFile), moduleName); + if (ts.sys.fileExists(modulePath)) { + resolvedModules.push(getResolveModule(modulePath, '.ets')); + } + } else if (/\.ts$/.test(moduleName)) { + const modulePath: string = path.resolve(path.dirname(containingFile), moduleName); + if (ts.sys.fileExists(modulePath)) { + resolvedModules.push(getResolveModule(modulePath, '.ts')); + } + } + } + if (moduleNames.length !== resolvedModules.length) { + const length: number = moduleNames.length - resolvedModules.length; + for (let i = 0; i < length; i++) { + resolvedModules.push(null); + } + } + return resolvedModules; + }, + directoryExists: ts.sys.directoryExists, + getDirectories: ts.sys.getDirectories + }; + return ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); +} + +function getResolveModule(modulePath: string, type): ts.ResolvedModuleFull { + return { + resolvedFileName: modulePath, + isExternalLibraryImport: false, + extension: type + }; +} + +export const dollarCollection: Set = new Set(); +export const appComponentCollection: Set = new Set(); +export const decoratorParamsCollection: Set = new Set(); +export const extendCollection: Set = new Set(); + +function checkUISyntax(source: string, fileName: string): void { + if (/\.ets$/.test(fileName)) { + if (path.basename(fileName) !== 'app.ets') { + const sourceFile: ts.SourceFile = ts.createSourceFile(fileName, source, + ts.ScriptTarget.Latest, true, ts.ScriptKind.ETS); + collectComponents(sourceFile); + parseAllNode(sourceFile, sourceFile); + } + } +} + +function collectComponents(node: ts.SourceFile): void { + // @ts-ignore + if (node.identifiers && node.identifiers.size) { + // @ts-ignore + for (const key of node.identifiers.keys()) { + if (JS_BIND_COMPONENTS.has(key)) { + appComponentCollection.add(key); + } + } + } +} + +function parseAllNode(node: ts.Node, sourceFileNode: ts.SourceFile): void { + if (ts.isStructDeclaration(node)) { + if (node.members) { + node.members.forEach(item => { + if (ts.isPropertyDeclaration(item) && ts.isIdentifier(item.name)) { + const propertyName: string = item.name.getText(); + if (item.decorators && item.decorators.length) { + for (let i = 0; i < item.decorators.length; i++) { + const decoratorName: string = item.decorators[i].getText().replace(/\(.*\)$/, '').trim(); + if (INNER_COMPONENT_MEMBER_DECORATORS.has(decoratorName)) { + dollarCollection.add('$' + propertyName); + } + if (isDecoratorCollection(item.decorators[i], decoratorName)) { + decoratorParamsCollection.add(item.decorators[i].expression.arguments[0].getText()); + } + } + } + } + }); + } + } + if (ts.isIfStatement(node)) { + appComponentCollection.add(COMPONENT_IF); + } + node.getChildren().forEach((item: ts.Node) => parseAllNode(item, sourceFileNode)); +} + +function isDecoratorCollection(item: ts.Decorator, decoratorName: string): boolean { + return COMPONENT_DECORATORS_PARAMS.has(decoratorName) && + // @ts-ignore + item.expression.arguments && item.expression.arguments.length && + // @ts-ignore + ts.isIdentifier(item.expression.arguments[0]); +} + +function processDraw(source: string): string { + const reg: RegExp = /new\s+\b(Circle|Ellipse|Rect|Path)\b/g; + return source.replace(reg, (item:string, item1: string) => { + return '\xa0'.repeat(item.length - item1.length) + item1; + }); +} + +function processContent(source: string): string { + source = processSystemApi(source); + source = preprocessExtend(source, extendCollection); + source = processDraw(source); + return source; +} diff --git a/compiler/src/gen_abc.ts b/compiler/src/gen_abc.ts new file mode 100644 index 0000000000000000000000000000000000000000..dd923af2fd8ff91738d964f1a363da1209b32eec --- /dev/null +++ b/compiler/src/gen_abc.ts @@ -0,0 +1,44 @@ +import * as process from 'child_process'; +import * as fs from 'fs'; +import { logger } from './compile_info'; + +const {workerData, threadId} = require('worker_threads'); + +interface File { + path: string, + size: number +} +const red: string = '\u001b[31m'; +const reset: string = '\u001b[39m'; + +function js2abcByWorkers(inputPaths: File[], cmd: string): Promise { + for (let i = 0; i < inputPaths.length; ++i) { + let input = inputPaths[i].path; + let singleCmd = `${cmd} "${input}"`; + logger.debug("gen abc cmd is: ", singleCmd); + try { + process.execSync(singleCmd); + } catch (e) { + logger.error(red, `ETS:ERROR Failed to convert file ${input} to abc `, reset); + return; + } + + if (fs.existsSync(input)) { + fs.unlinkSync(input); + } + + const abcFile: string = input.replace(/\.js$/, '.abc'); + if (fs.existsSync(abcFile)) { + const abcFileNew: string = abcFile.replace(/_.abc$/, '.abc'); + fs.renameSync(abcFile, abcFileNew); + } else { + logger.error(red, `ETS:ERROR ${abcFile} is lost`, reset); + } + } +} + +logger.debug("worker data is: ", JSON.stringify(workerData)); +if (JSON.stringify(workerData) !== 'null') { + logger.debug("==>worker #", threadId, "started!"); + js2abcByWorkers(workerData.input, workerData.cmd); +} diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index 4a30556d91e3de4b12448eda438414c5d33f9587..f1540695c5bef88beb38eb2fc1de727554d2cc65 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -13,14 +13,18 @@ * limitations under the License. */ -import * as process from 'child_process'; import * as fs from 'fs'; - import * as path from 'path'; import Compiler from 'webpack/lib/Compiler'; import { logger } from './compile_info'; +import { createHash } from 'crypto'; +import { toUnixPath} from './utils'; +const {Worker, isMainThread} = require('worker_threads'); const firstFileEXT: string = '_.js'; +const genAbcScript = 'gen_abc.js'; +const hashFile = 'gen_hash.json'; +const ARK = '/ark/'; let output: string; let isWin: boolean = false; let isMac: boolean = false; @@ -28,6 +32,12 @@ let isDebug: boolean = false; let arkDir: string; let nodeJs: string; +interface File { + path: string, + size: number +} +let intermediateJsBundle: Array = []; + const red: string = '\u001b[31m'; const reset: string = '\u001b[39m'; @@ -54,14 +64,44 @@ export class GenAbcPlugin { compiler.hooks.emit.tap('GenAbcPlugin', (compilation) => { Object.keys(compilation.assets).forEach(key => { - // choice *.js + // choose *.js if (output && path.extname(key) === '.js') { const newContent: string = compilation.assets[key].source(); const keyPath: string = key.replace(/\.js$/, firstFileEXT); - writeFileSync(newContent, path.resolve(output, keyPath), key); + if (!checkJSBundleFileHash(newContent, path.resolve(output, keyPath), output)) { + writeFileSync(newContent, path.resolve(output, keyPath), key); + } } }); }); + + compiler.hooks.afterEmit.tap('GenAbcPluginMultiThread', () => { + let param: string = ''; + if (isDebug) { + param += ' --debug'; + } + + if (isMainThread) { + let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); + if (isWin) { + js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); + } else if (isMac) { + js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); + } + let maxWorkerNumber = 3; + let splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); + let workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; + let cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; + let workers = []; + for (let i = 0; i < workerNumber; ++i) { + workers.push(new Worker(path.resolve(__dirname, genAbcScript), + {workerData: {input: splitedBundles[i], cmd: cmdPrefix} })); + workers[i].on('exit', () => { + logger.debug("worker ", i, "finished!"); + }); + } + } + }); } } @@ -72,7 +112,8 @@ function writeFileSync(inputString: string, output: string, jsBundleFile: string } fs.writeFileSync(output, inputString); if (fs.existsSync(output)) { - js2abcFirst(output); + let fileSize = fs.statSync(output).size; + intermediateJsBundle.push({path: output, size: fileSize}); } else { logger.error(red, `ETS:ERROR Failed to convert file ${jsBundleFile} to bin. ${output} is lost`, reset); } @@ -86,37 +127,71 @@ function mkDir(path_: string): void { fs.mkdirSync(path_); } -function js2abcFirst(inputPath: string): void { - let param: string = '-r'; - if (isDebug) { - param += ' --debug'; - } +function getSmallestSizeGroup(groupSize: Map) { + let groupSizeArray = Array.from(groupSize); + groupSizeArray.sort(function(g1, g2) { + return g1[1] - g2[1]; // sort by value + }); + return groupSizeArray[0][0]; // return key +} - let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); - if (isWin) { - js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); - } else if (isMac) { - js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); +function splitJsBundlesBySize(bundleArray: Array, groupNumber: number){ + let result = []; + if (bundleArray.length < groupNumber) { + result.push(bundleArray); + return result; } - const cmd: string = `${nodeJs} --expose-gc "${js2abc}" "${inputPath}" ${param}`; - - try { - process.execSync(cmd); - } catch (e) { - logger.error(red, `ETS:ERROR Failed to convert file ${inputPath} to abc `, reset); - return; + bundleArray.sort(function(f1: File, f2: File) { + return f2.size - f1.size; + }); + let groupFileSize = new Map(); + for (let i = 0; i < groupNumber; ++i) { + result.push([]); + groupFileSize.set(i, 0); } - if (fs.existsSync(inputPath)) { - fs.unlinkSync(inputPath); + let index = 0; + while(index < bundleArray.length) { + let smallestGroup = getSmallestSizeGroup(groupFileSize); + result[smallestGroup].push(bundleArray[index]); + let sizeUpdate = groupFileSize.get(smallestGroup) + bundleArray[index].size; + groupFileSize.set(smallestGroup, sizeUpdate); + index++; } + return result; +} - const abcFile: string = inputPath.replace(/\.js$/, '.abc'); - if (fs.existsSync(abcFile)) { - const abcFileNew: string = abcFile.replace(/_.abc$/, '.abc'); - fs.renameSync(abcFile, abcFileNew); +function checkJSBundleFileHash(inputString: string, output: string, buildPath: string) { + if (!buildPath.indexOf(ARK)) { + return false; + } + const hashPath = genHashJsonPath(buildPath); + const hash = createHash('sha256'); + hash.update(inputString); + const hashData = hash.digest('hex'); + const hashFilePath = path.join(hashPath, hashFile); + const parent: string = path.join(hashFilePath, '..'); + if (!(fs.existsSync(parent) && fs.statSync(parent).isDirectory())) { + mkDir(parent); + } + let jsonFile = ""; + let jsonObject = {}; + if (fs.existsSync(hashFilePath)) { + jsonFile = fs.readFileSync(hashFilePath).toString(); + jsonObject = JSON.parse(jsonFile); + } + if (jsonObject[output] === hashData) { + return true; } else { - logger.error(red, `ETS:ERROR ${abcFile} is lost`, reset); + jsonObject[output] = hashData; } + fs.writeFileSync(hashFilePath, JSON.stringify(jsonObject)); + return false; +} + +function genHashJsonPath(buildPath: string) { + buildPath = toUnixPath(buildPath); + const dataTmps = buildPath.split(ARK); + return path.join(dataTmps[0], ARK); } diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index 2acba62299d9d81131c222cfa7747e1cc6f63557..ff3a07212f53cb89bf3a22194bf4db77a20401db 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -38,6 +38,9 @@ export const COMPONENT_OBJECT_LINK_DECORATOR: string = '@ObjectLink'; export const COMPONENT_WATCH_DECORATOR: string = '@Watch'; export const COMPONENT_BUILDERPARAM_DECORATOR: string = '@BuilderParam'; +export const COMPONENT_DECORATORS_PARAMS: Set = new Set([COMPONENT_CONSUME_DECORATOR, + COMPONENT_STORAGE_PROP_DECORATOR, COMPONENT_STORAGE_LINK_DECORATOR, COMPONENT_PROVIDE_DECORATOR, + COMPONENT_WATCH_DECORATOR]); export const INNER_COMPONENT_DECORATORS: Set = new Set([COMPONENT_DECORATOR_ENTRY, COMPONENT_DECORATOR_PREVIEW, COMPONENT_DECORATOR_COMPONENT, COMPONENT_DECORATOR_CUSTOM_DIALOG]); export const INNER_COMPONENT_MEMBER_DECORATORS: Set = new Set([COMPONENT_STATE_DECORATOR, @@ -49,6 +52,7 @@ export const COMPONENT_OBSERVED_DECORATOR: string = '@Observed'; export const COMPONENT_BUILDER_DECORATOR: string = '@Builder'; export const COMPONENT_EXTEND_DECORATOR: string = '@Extend'; export const COMPONENT_STYLES_DECORATOR: string = '@Styles'; +export const CHECK_COMPONENT_EXTEND_DECORATOR: string = 'Extend'; export const OBSERVED_PROPERTY_SIMPLE: string = 'ObservedPropertySimple'; export const OBSERVED_PROPERTY_OBJECT: string = 'ObservedPropertyObject'; @@ -199,3 +203,8 @@ export const $$_NEW_VALUE: string = 'newValue'; export const INTERFACE_NAME_SUFFIX:string = '_Params'; export const OBSERVED_PROPERTY_ABSTRACT:string = 'ObservedPropertyAbstract'; + +export const SUPERVISUAL: string = './supervisual'; +export const SUPERVISUAL_SOURCEMAP_EXT: string = '.visual.js.map'; + +export const INSTANCE: string = 'Instance'; diff --git a/compiler/src/pre_process.ts b/compiler/src/pre_process.ts index bab5b8c242306f5fdf39ebf82b8872ff6d08576a..5d501cabe4824ead93214ed2b7fbf84137379b89 100644 --- a/compiler/src/pre_process.ts +++ b/compiler/src/pre_process.ts @@ -15,6 +15,8 @@ import ts from 'typescript'; import fs from 'fs'; +import path from 'path'; +import { SourceMapGenerator } from 'source-map'; import { ReplaceResult, @@ -26,12 +28,20 @@ import { import { LogType, LogInfo, - emitLogInfo + emitLogInfo, + mkDir } from './utils'; -import { BUILD_ON } from './pre_define'; +import { + BUILD_ON, + SUPERVISUAL, + SUPERVISUAL_SOURCEMAP_EXT +} from './pre_define'; import { projectConfig } from '../main.js'; import { genETS } from '../codegen/codegen_ets.js'; +const visualMap: Map = new Map(); +const slotMap: Map = new Map(); + function preProcess(source: string): string { process.env.compiler = BUILD_ON; if (/\.ets$/.test(this.resourcePath)) { @@ -39,7 +49,7 @@ function preProcess(source: string): string { let newContent: string = result.content; const log: LogInfo[] = result.log.concat(validateUISyntax(source, newContent, this.resourcePath, this.resourceQuery)); - newContent = parseVisual(this.resourcePath, newContent, log); + newContent = parseVisual(this.resourcePath, this.resourceQuery, newContent, log, source); if (log.length) { emitLogInfo(this, log); } @@ -49,28 +59,48 @@ function preProcess(source: string): string { } } -function parseVisual(resourcePath: string, content: string, log: LogInfo[]): string { - if (componentCollection.entryComponent && projectConfig.aceSuperVisualPath) { - const sourceFile: ts.SourceFile = ts.createSourceFile(resourcePath, content, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); - if (sourceFile.statements) { - sourceFile.statements.forEach(statement => { - content = parseStatement(statement, content, log, resourcePath); - }); - } +function parseVisual(resourcePath: string, resourceQuery: string, content: string, + log: LogInfo[], source: string): string { + if (!componentCollection.entryComponent || !projectConfig.aceSuperVisualPath) { + return content; } - return content; + const visualPath: string = findVisualFile(resourcePath); + if (!visualPath || !fs.existsSync(visualPath)) { + return content; + } + const visualContent: any = getVisualContent(visualPath, log); + if (!visualContent) { + return content; + } + visualMap.clear(); + slotMap.clear(); + const sourceFile: ts.SourceFile = ts.createSourceFile(resourcePath, content, + ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + let newContent: string = content; + if (sourceFile.statements) { + sourceFile.statements.forEach(statement => { + newContent = parseStatement(statement, newContent, log, visualContent); + }); + } + const result: ReplaceResult = sourceReplace(newContent, resourcePath); + newContent = result.content; + const resultLog: LogInfo[] = result.log.concat(validateUISyntax(source, newContent, + resourcePath, resourceQuery)); + log.concat(resultLog); + if (!log.length) { + generateSourceMapForNewAndOriEtsFile(resourcePath, source); + } + return newContent; } function parseStatement(statement: ts.Statement, content: string, log: LogInfo[], - resourcePath: string): string { + visualContent: any): string { if (statement.kind === ts.SyntaxKind.ClassDeclaration && statement.name && statement.name.getText() === componentCollection.entryComponent) { - const visualPath: string = findVisualFile(resourcePath); - if (visualPath && fs.existsSync(visualPath) && statement.members) { + if (statement.members) { statement.members.forEach(member => { if (member.kind && member.kind === ts.SyntaxKind.MethodDeclaration) { - content = parseMember(member, content, log, visualPath); + content = parseMember(statement, member, content, log, visualContent); } }); } @@ -78,16 +108,13 @@ function parseStatement(statement: ts.Statement, content: string, log: LogInfo[] return content; } -function parseMember(member: ts.MethodDeclaration, content: string, log: LogInfo[], - visualPath: string): string { +function parseMember(statement: ts.Statement, member: ts.MethodDeclaration, content: string, + log: LogInfo[], visualContent: any): string { + let newContent: string = content; if (member.name && member.name.getText() === 'build') { - const buildBody: string = content.substring(member.pos, member.end); + const buildBody: string = member.getText(); if (buildBody.replace(/\ +/g, '').replace(/[\r\n]/g, '') === 'build(){}') { - const visualContent: string = getVisualContent(visualPath, log, member.pos); - if (visualContent) { - content = content.replace(buildBody, '\nbuild() {\n' + - visualContent + '}\n'); - } + newContent = insertVisualCode(statement, member, visualContent, newContent); } else { log.push({ type: LogType.ERROR, @@ -97,7 +124,146 @@ function parseMember(member: ts.MethodDeclaration, content: string, log: LogInfo }); } } - return content; + return newContent; +} + +function insertVisualCode(statement: ts.Statement, member: ts.MethodDeclaration, + visualContent: any, content: string): string { + let newContent: string = content; + newContent = insertImport(visualContent, newContent); + newContent = insertVarAndFunc(member, visualContent, newContent, content); + newContent = insertBuild(member, visualContent, newContent, content); + newContent = insertAboutToAppear(statement, member, visualContent, newContent, content); + return newContent; +} + +function insertImport(visualContent: any, content: string): string { + if (!visualContent.etsImport) { + return content; + } + const mediaQueryImport: string = visualContent.etsImport + '\n'; + const newContent: string = mediaQueryImport + content; + slotMap.set(0, mediaQueryImport.length); + visualMap.set(0, mediaQueryImport.split('\n').length - 1); + return newContent; +} + +function insertVarAndFunc(build: ts.MethodDeclaration, visualContent: any, + content: string, oriContent: string): string { + const visualVarAndFunc: string = (visualContent.etsVariable ? visualContent.etsVariable : '') + + (visualContent.etsFunction ? visualContent.etsFunction : ''); + return visualVarAndFunc ? insertVisualCodeBeforePos(build, '\n' + visualVarAndFunc, content, + oriContent) : content; +} + +function insertBuild(build: ts.MethodDeclaration, visualContent: any, content: string, + oriContent: string): string { + return visualContent.build ? insertVisualCodeAfterPos(build.body, + '\n' + visualContent.build + '\n', content, oriContent) : content; +} + +function insertAboutToAppear(statement: ts.Statement, build: ts.MethodDeclaration, + visualContent: any, content: string, oriContent: string): string { + if (!visualContent.aboutToAppear) { + return content; + } + for (const member of statement.members) { + const hasAboutToAppear: boolean = member.kind && member.kind === ts.SyntaxKind.MethodDeclaration + && member.name && member.name.getText() === 'aboutToAppear'; + if (hasAboutToAppear) { + return insertVisualCodeAfterPos(member.body, '\n' + visualContent.aboutToAppear, content, + oriContent); + } + } + + const aboutToAppearFunc: string = '\n aboutToAppear() {\n' + visualContent.aboutToAppear + + ' }\n'; + return insertVisualCodeBeforePos(build, aboutToAppearFunc, content, oriContent); +} + +function insertVisualCodeAfterPos(member: ts.Block, visualContent: string, content: string, + oriContent: string): string { + const contentBeforePos: string = oriContent.substring(0, member.getStart() + 1); + const originEtsFileLineNumber: number = contentBeforePos.split('\n').length; + const visualLines: number = visualContent.split('\n').length - 1; + const insertedLineNumbers: number = visualMap.get(originEtsFileLineNumber); + visualMap.set(originEtsFileLineNumber, insertedLineNumbers ? insertedLineNumbers + visualLines : + visualLines); + + let newPos: number = member.getStart() + 1; + for (const [key, value] of slotMap) { + if (member.getStart() >= key) { + newPos += value; + } + } + + const newContent: string = content.substring(0, newPos) + visualContent + + content.substring(newPos); + slotMap.set(member.getStart(), visualContent.length); + return newContent; +} + +function insertVisualCodeBeforePos(member: ts.MethodDeclaration, visualContent: string, + content: string, oriContent: string): string { + const contentBeforePos: string = oriContent.substring(0, member.pos); + const originEtsFileLineNumber: number = contentBeforePos.split('\n').length; + const visualLines: number = visualContent.split('\n').length - 1; + const insertedLineNumbers: number = visualMap.get(originEtsFileLineNumber); + visualMap.set(originEtsFileLineNumber, insertedLineNumbers ? insertedLineNumbers + visualLines : + visualLines); + let newPos: number = member.pos; + for (const [key, value] of slotMap) { + if (member.pos >= key) { + newPos += value; + } + } + const newContent: string = content.substring(0, newPos) + visualContent + + content.substring(newPos); + slotMap.set(member.pos, visualContent.length); + return newContent; +} + +function generateSourceMapForNewAndOriEtsFile(resourcePath: string, content: string) { + if (!process.env.cachePath) { + return; + } + const sourcemap: SourceMapGenerator = new SourceMapGenerator({ + file: resourcePath + }); + const lines: Array = content.split('\n'); + const originEtsFileLines: number = lines.length; + for (let l: number = 1; l <= originEtsFileLines; l++) { + let newEtsFileLineNumber: number = l; + for (const [originEtsFileLineNumber, visualLines] of visualMap) { + if (l > originEtsFileLineNumber) { + newEtsFileLineNumber += visualLines; + } + } + sourcemap.addMapping({ + generated: { + line: newEtsFileLineNumber, + column: 0 + }, + source: resourcePath, + original: { + line: l, + column: 0 + } + }); + } + const visualMapName: string = path.parse(resourcePath).name + SUPERVISUAL_SOURCEMAP_EXT; + const visualDirPath: string = path.parse(resourcePath).dir; + const etsDirPath: string = path.parse(projectConfig.projectPath).dir; + const visualMapDirPath: string = path.resolve(process.env.cachePath, SUPERVISUAL + + visualDirPath.replace(etsDirPath, '')); + if (!(fs.existsSync(visualMapDirPath) && fs.statSync(visualMapDirPath).isDirectory())) { + mkDir(visualMapDirPath); + } + fs.writeFile(path.resolve(visualMapDirPath, visualMapName), sourcemap.toString(), (err) => { + if (err) { + return console.error('ERROR: Failed to write visual.js.map'); + } + }); } function findVisualFile(filePath: string): string { @@ -106,13 +272,12 @@ function findVisualFile(filePath: string): string { return visualPath; } -function getVisualContent(visualPath: string, log: LogInfo[], pos: number): string { +function getVisualContent(visualPath: string, log: LogInfo[]): any { const parseContent: any = genETS(fs.readFileSync(visualPath, 'utf-8')); if (parseContent && parseContent.errorType && parseContent.errorType !== '') { log.push({ type: LogType.ERROR, - message: parseContent.message, - pos: pos + message: parseContent.message }); } return parseContent ? parseContent.ets : null; diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 12582c352218a5df133b2ac765620488416a2d8b..278968a943b950938379771dbb5a4b248c9246cc 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -88,8 +88,6 @@ import { projectConfig } from '../main'; import { transformLog, contextGlobal } from './process_ui_syntax'; import { props } from './compile_info'; -export const appComponentCollection: Set = new Set(); - export function processComponentBuild(node: ts.MethodDeclaration, log: LogInfo[]): ts.MethodDeclaration { let newNode: ts.MethodDeclaration; @@ -130,27 +128,15 @@ export function processComponentBlock(node: ts.Block, isLazy: boolean, log: LogI function validateRootNode(node: ts.MethodDeclaration, log: LogInfo[]): boolean { let isValid: boolean = false; - if (node.body.statements.length < 4) { - switch (node.body.statements.length) { - case 1: - if (validateFirstNode(node.body.statements[0])) { - isValid = true; - } - break; - case 2: - if (validateFirstNode(node.body.statements[0]) && - validateBlockNode(node.body.statements[1])) { - isValid = true; - } - break; - case 3: - if (validateFirstNode(node.body.statements[0]) && - validateBlockNode(node.body.statements[1]) && - validateSecondNode(node.body.statements[2])) { - isValid = true; - } - break; + if (node.body.statements.length === 1) { + const statement: ts.Node = node.body.statements[0]; + if (ts.isIfStatement(statement) || ts.isExpressionStatement(statement) && statement.expression && + (ts.isEtsComponentExpression(statement.expression) || ts.isCallExpression(statement.expression)) && + validateEtsComponentNode(statement.expression)) { + isValid = true; } + } else { + isValid = false; } if (!isValid) { log.push({ @@ -162,8 +148,36 @@ function validateRootNode(node: ts.MethodDeclaration, log: LogInfo[]): boolean { return isValid; } +interface supplementType { + isAcceleratePreview: boolean, + line: number, + column: number +} + +let newsupplement: supplementType = { + isAcceleratePreview: false, + line: 0, + column: 0 +}; + +function validateEtsComponentNode(node: ts.CallExpression | ts.EtsComponentExpression) { + let childNode: ts.Node = node; + while (ts.isCallExpression(childNode) && childNode.expression && + ts.isPropertyAccessExpression(childNode.expression) && childNode.expression.expression) { + childNode = childNode.expression.expression; + } + if (ts.isEtsComponentExpression(childNode)) { + return true; + } else { + return false; + } +} + export function processComponentChild(node: ts.Block | ts.SourceFile, newStatements: ts.Statement[], - log: LogInfo[]): void { + log: LogInfo[], supplement: supplementType = {isAcceleratePreview: false, line: 0, column: 0}): void { + if (supplement.isAcceleratePreview) { + newsupplement = supplement; + } if (node.statements.length) { node.statements.forEach((item, index, array) => { if (ts.isExpressionStatement(item)) { @@ -174,9 +188,9 @@ export function processComponentChild(node: ts.Block | ts.SourceFile, newStateme newStatements, log, name); break; case ComponentType.customComponent: - if (index + 1 < array.length && ts.isBlock(array[index + 1])) { - if (processExpressionStatementChange(item, array[index + 1] as ts.Block, log)) { - item = processExpressionStatementChange(item, array[index + 1] as ts.Block, log); + if (item.expression && ts.isEtsComponentExpression(item.expression) && item.expression.body) { + if (processExpressionStatementChange(item, item.expression.body, log)) { + item = processExpressionStatementChange(item, item.expression.body, log); } } processCustomComponent(item as ts.ExpressionStatement, newStatements, log); @@ -190,7 +204,6 @@ export function processComponentChild(node: ts.Block | ts.SourceFile, newStateme break; } } else if (ts.isIfStatement(item)) { - appComponentCollection.add(COMPONENT_IF); processIfStatement(item, newStatements, log); } else if (!ts.isBlock(item)) { log.push({ @@ -247,6 +260,28 @@ function processBlockToExpression(node: ts.ExpressionStatement, nextNode: ts.Blo return node; } +type EtsComponentResult = { + etsComponentNode: ts.EtsComponentExpression; + hasAttr: boolean; +} +function parseEtsComponentExpression(node: ts.ExpressionStatement): EtsComponentResult { + let etsComponentNode: ts.EtsComponentExpression; + let hasAttr: boolean = false; + let temp: any = node.expression; + while (temp) { + if (ts.isCallExpression(temp) && temp.expression && + ts.isPropertyAccessExpression(temp.expression)) { + hasAttr = true; + } + if (ts.isEtsComponentExpression(temp)) { + etsComponentNode = temp; + break; + } + temp = temp.expression; + } + return { etsComponentNode: etsComponentNode, hasAttr: hasAttr }; +} + function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.Statement[], newStatements: ts.Statement[], log: LogInfo[], name: string): void { const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION); @@ -256,16 +291,30 @@ function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: transformLog.sourceFile.getLineAndCharacterOfPosition(getRealNodePos(node)); const projectPath: string = projectConfig.projectPath; const curFileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); + let line: number = 1; + let col: number = 1; + if (newsupplement.isAcceleratePreview) { + if (posOfNode.line === 0) { + col = newsupplement.column; + } + line = newsupplement.line; + } + newsupplement = { + isAcceleratePreview: false, + line: 0, + column: 0 + }; const debugInfo: string = `${path.relative(projectPath, curFileName).replace(/\\+/g, '/')}` + - `(${posOfNode.line + 1}:${posOfNode.character + 1})`; + `(${posOfNode.line + line}:${posOfNode.character + col})`; const debugNode: ts.ExpressionStatement = ts.factory.createExpressionStatement( createFunction(ts.factory.createIdentifier(getName(node)), ts.factory.createIdentifier(COMPONENT_DEBUGLINE_FUNCTION), ts.factory.createNodeArray([ts.factory.createStringLiteral(debugInfo)]))); newStatements.push(debugNode); } - if (index + 1 < arr.length && ts.isBlock(arr[index + 1])) { + const etsComponentResult: EtsComponentResult = parseEtsComponentExpression(node); + if (etsComponentResult.etsComponentNode.body && ts.isBlock(etsComponentResult.etsComponentNode.body)) { if (res.isButton) { if (projectConfig.isPreview) { newStatements.splice(-2, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); @@ -273,11 +322,10 @@ function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: newStatements.splice(-1, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); } } - if (index + 2 < arr.length && ts.isExpressionStatement(arr[index + 2]) && - isAttributeNode(arr[index + 2] as ts.ExpressionStatement)) { - bindComponentAttr(arr[index + 2] as ts.ExpressionStatement, res.identifierNode, newStatements, log); + if (etsComponentResult.hasAttr) { + bindComponentAttr(node, res.identifierNode, newStatements, log); } - processComponentChild(arr[index + 1] as ts.Block, newStatements, log); + processComponentChild(etsComponentResult.etsComponentNode.body, newStatements, log); } else { bindComponentAttr(node, res.identifierNode, newStatements, log); } @@ -488,7 +536,8 @@ function createComponent(node: ts.ExpressionStatement, type: string): CreateResu while (temp && !ts.isIdentifier(temp) && temp.expression) { temp = temp.expression; } - if (temp && temp.parent && ts.isCallExpression(temp.parent) && ts.isIdentifier(temp)) { + if (temp && temp.parent && (ts.isCallExpression(temp.parent) || + ts.isEtsComponentExpression(temp.parent)) && ts.isIdentifier(temp)) { if (temp.getText() === COMPONENT_BUTTON && type !== COMPONENT_POP_FUNCTION) { res.isButton = true; identifierNode = type === COMPONENT_CREATE_CHILD_FUNCTION @@ -522,6 +571,13 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode: let temp: any = node.expression; const statements: ts.Statement[] = []; const lastStatement: AnimationInfo = { statement: null, kind: false }; + if (ts.isPropertyAccessExpression(temp)) { + log.push({ + type: LogType.ERROR, + message: `'${node.getText()}' does not meet UI component syntax.`, + pos: node.getStart() + }); + } while (temp && ts.isCallExpression(temp) && temp.expression) { if (temp.expression && (validatePropertyAccessExpressionWithCustomBuilder(temp.expression) || validateIdentifierWithCustomBuilder(temp.expression))) { @@ -622,15 +678,14 @@ function processDragStartBuilder(node: ts.CallExpression): ts.CallExpression { // @ts-ignore for (let i = 0; i < node.arguments[0].body.statements.length; i++) { // @ts-ignore - let statement: ts.Statement = node.arguments[0].body.statements[i]; - checkStatement(statement); - newStatements.push(statement); - node = ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ts.factory.updateArrowFunction( - // @ts-ignore - node.arguments[0], undefined, undefined, node.arguments[0].parameters, node.arguments[0].type, - // @ts-ignore - node.arguments[0].equalsGreaterThanToken, ts.factory.updateBlock(node.arguments[0].body, newStatements))]); + const statement: ts.Statement = node.arguments[0].body.statements[i]; + newStatements.push(checkStatement(statement)); } + node = ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ts.factory.updateArrowFunction( + // @ts-ignore + node.arguments[0], undefined, undefined, node.arguments[0].parameters, node.arguments[0].type, + // @ts-ignore + node.arguments[0].equalsGreaterThanToken, ts.factory.updateBlock(node.arguments[0].body, newStatements))]); } return node; } @@ -640,19 +695,21 @@ function isNodeFunction(node: ts.CallExpression): boolean { ts.isBlock(node.arguments[0].body); } -function checkStatement(statement: ts.Statement): void { +function checkStatement(statement: ts.Statement): ts.Statement { if (ts.isReturnStatement(statement)) { if (ts.isObjectLiteralExpression(statement.expression)) { const newProperties: ts.ObjectLiteralElementLike[] = []; for (let j = 0; j < statement.expression.properties.length; j++) { - let property: ts.ObjectLiteralElementLike = statement.expression.properties[j]; + const property: ts.ObjectLiteralElementLike = statement.expression.properties[j]; checkProperty(property); newProperties.push(property); } - statement = ts.factory.createReturnStatement(ts.factory.createObjectLiteralExpression(newProperties)); + return ts.factory.createReturnStatement(ts.factory.createObjectLiteralExpression(newProperties)); } else { - statement = ts.factory.updateReturnStatement(statement, parseBuilderNode(statement.expression)); + return ts.factory.updateReturnStatement(statement, parseBuilderNode(statement.expression)); } + } else { + return statement; } } @@ -801,7 +858,6 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, parseGesture(temp, propName, statements, log); lastStatement.kind = true; } else if (isExtendFunctionNode(identifierNode, propName)) { - validateExtendParameterCount(temp, identifierNode, propName, log); statements.push(ts.factory.createExpressionStatement(ts.factory.createCallExpression( ts.factory.createIdentifier(`__${identifierNode.escapedText.toString()}__${propName}`), undefined, temp.arguments))); @@ -837,18 +893,36 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, if (!COMMON_ATTRS.has(propName)) { validateStateStyleSyntax(temp, log); } - if (isGlobalStyles) { - for (let i = 0; i < temp.arguments.length; i++) { - temp.arguments[i] = traverseStylesAttr(temp.arguments[i]); - } - } } + temp = loopEtsComponent(temp, isStylesAttr, isGlobalStyles); statements.push(ts.factory.createExpressionStatement( createFunction(identifierNode, node, temp.arguments))); lastStatement.kind = true; } } +function loopEtsComponent(temp: any, isStylesAttr: boolean, isGlobalStyles: boolean): ts.Node { + temp.arguments.forEach((item: ts.Node, index: number) => { + if (isStylesAttr && isGlobalStyles) { + temp.arguments[index] = traverseStylesAttr(item); + } + if (ts.isNewExpression(item) && item.expression && ts.isEtsComponentExpression( + item.expression)) { + temp.arguments[index] = ts.factory.updateNewExpression(item, item.expression.expression, + undefined, item.expression.arguments); + } else if (ts.isEtsComponentExpression(item)) { + temp.arguments[index] = ts.factory.createCallExpression(item.expression, + undefined, item.arguments); + } else if ((ts.isCallExpression(item) || ts.isNewExpression(item)) && item.expression && + ts.isPropertyAccessExpression(item.expression) && item.expression.expression && + ts.isEtsComponentExpression(item.expression.expression)) { + temp.arguments[index].expression.expression = ts.factory.createCallExpression( + item.expression.expression.expression, undefined, item.expression.expression.arguments); + } + }); + return temp; +} + function classifyArgumentsNum(args: any, argumentsArr: ts.Expression[], propName: string, identifierNode: ts.Identifier): void { if (propName === BIND_POPUP && args.length === 2) { @@ -931,7 +1005,7 @@ function traverseStateStylesAttr(temp: any, statements: ts.Statement[], function isExtendFunctionNode(identifierNode: ts.Identifier, propName: string): boolean { if (identifierNode && EXTEND_ATTRIBUTE.has(identifierNode.escapedText.toString())) { const attributeArray: string[] = - [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].map(item => item.attribute); + [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())]; if (attributeArray.includes(propName)) { return true; } @@ -1017,7 +1091,8 @@ export function getName(node: ts.ExpressionStatement): string { let temp: any = node.expression; let name: string; while (temp) { - if (ts.isIdentifier(temp) && temp.parent && ts.isCallExpression(temp.parent)) { + if (ts.isIdentifier(temp) && temp.parent && (ts.isCallExpression(temp.parent) || + ts.isEtsComponentExpression(temp.parent))) { name = temp.escapedText.toString(); break; } else if (ts.isPropertyAccessExpression(temp) && temp.name && ts.isIdentifier(temp.name) && @@ -1043,46 +1118,6 @@ export function isAttributeNode(node: ts.ExpressionStatement): boolean { return BUILDIN_STYLE_NAMES.has(name); } -function validateFirstNode(node: ts.Statement): boolean { - const isEntryComponent: boolean = - componentCollection.entryComponent === componentCollection.currentClassName; - if (isEntryComponent && validateEntryComponent(node) || - !isEntryComponent && validateCustomComponent(node)) { - return true; - } - return false; -} - -function validateEntryComponent(node: ts.Statement): boolean { - if (ts.isExpressionStatement(node) && BUILDIN_CONTAINER_COMPONENT.has(getName(node))) { - return true; - } - return false; -} - -function validateCustomComponent(node: ts.Statement): boolean { - if (ts.isIfStatement(node) || - ts.isExpressionStatement(node) && (INNER_COMPONENT_NAMES.has(getName(node)) || - componentCollection.customComponents.has(getName(node)))) { - return true; - } - return false; -} - -function validateBlockNode(node: ts.Statement): boolean { - if (ts.isBlock(node)) { - return true; - } - return false; -} - -function validateSecondNode(node: ts.Statement): boolean { - if (ts.isExpressionStatement(node) && isAttributeNode(node)) { - return true; - } - return false; -} - enum ComponentType { innerComponent, customComponent, @@ -1091,14 +1126,29 @@ enum ComponentType { builderParamMethod } +function isEtsComponent(node: ts.ExpressionStatement): boolean { + let isEtsComponent: boolean = false; + let temp: any = node.expression; + while (temp) { + if (ts.isEtsComponentExpression(temp)) { + isEtsComponent = true; + } + temp = temp.expression; + } + return isEtsComponent; +} + function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], name: string): ComponentType { - if (INNER_COMPONENT_NAMES.has(name)) { - return ComponentType.innerComponent; + if (isEtsComponent(node)) { + if (componentCollection.customComponents.has(name)) { + return ComponentType.customComponent; + } else { + return ComponentType.innerComponent; + } } else if (componentCollection.customComponents.has(name)) { return ComponentType.customComponent; } else if (name === COMPONENT_FOREACH || name === COMPONENT_LAZYFOREACH) { - appComponentCollection.add(name); return ComponentType.forEachComponent; } else if (CUSTOM_BUILDER_METHOD.has(name)) { return ComponentType.customBuilderMethod; @@ -1115,20 +1165,6 @@ function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], return null; } -function validateExtendParameterCount(temp: any, identifierNode: ts.Identifier, propName: string, - log: LogInfo[]): void { - const parameterCount: number = - [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].filter(item => - item.attribute === propName)[0].parameterCount; - if (temp.arguments && temp.arguments.length !== parameterCount) { - log.push({ - type: LogType.ERROR, - message: `The '${propName}' is expected ${parameterCount} arguments, but got ${temp.arguments.length}.`, - pos: temp.getStart() - }); - } -} - export function validateStateStyleSyntax(temp: any, log: LogInfo[]): void { log.push({ type: LogType.ERROR, diff --git a/compiler/src/process_component_class.ts b/compiler/src/process_component_class.ts index 38f0c8ef8d0a622afd6fad45bc594c182bd788fe..dc177f35be45e5d7ea49c60a626ba3dfbdc19901 100644 --- a/compiler/src/process_component_class.ts +++ b/compiler/src/process_component_class.ts @@ -31,8 +31,6 @@ import { OBSERVED_PROPERTY_SIMPLE, COMPONENT_BUILD_FUNCTION, BASE_COMPONENT_NAME, - ATTRIBUTE_ANIMATETO, - GLOBAL_CONTEXT, CREATE_CONSTRUCTOR_PARAMS, COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, COMPONENT_CONSTRUCTOR_DELETE_PARAMS, @@ -86,12 +84,12 @@ import { hasDecorator } from './utils'; -export function processComponentClass(node: ts.ClassDeclaration, context: ts.TransformationContext, +export function processComponentClass(node: ts.StructDeclaration, context: ts.TransformationContext, log: LogInfo[], program: ts.Program): ts.ClassDeclaration { validateInheritClass(node, log); const memberNode: ts.ClassElement[] = processMembers(node.members, node.name, context, log, program, checkPreview(node)); - return ts.factory.updateClassDeclaration(node, undefined, node.modifiers, node.name, + return ts.factory.createClassDeclaration(undefined, node.modifiers, node.name, node.typeParameters, updateHeritageClauses(node), memberNode); } @@ -99,7 +97,7 @@ function checkPreview(node: ts.ClassDeclaration) { let hasPreview: boolean = false; if (node && node.decorators) { for (let i = 0; i < node.decorators.length; i++) { - const name: string = node.decorators[i].getText().replace(/\((.|\n)*\)/, '').trim(); + const name: string = node.decorators[i].getText().replace(/\([^\(\)]*\)/, '').trim(); if (name === COMPONENT_DECORATOR_PREVIEW) { hasPreview = true; break; @@ -335,7 +333,7 @@ function getGeometryReaderFunctionBlock(node: ts.ArrowFunction | ts.FunctionExpr return processComponentBlock(blockNode, false, log); } -function updateHeritageClauses(node: ts.ClassDeclaration): ts.NodeArray { +function updateHeritageClauses(node: ts.StructDeclaration): ts.NodeArray { const result:ts.HeritageClause[] = []; const heritageClause:ts.HeritageClause = ts.factory.createHeritageClause( ts.SyntaxKind.ExtendsKeyword, @@ -482,7 +480,7 @@ function validateBuildMethodCount(buildCount: BuildCount, parentComponentName: t } } -function validateInheritClass(node: ts.ClassDeclaration, log: LogInfo[]): void { +function validateInheritClass(node: ts.StructDeclaration, log: LogInfo[]): void { if (node.heritageClauses) { log.push({ type: LogType.ERROR, diff --git a/compiler/src/process_component_constructor.ts b/compiler/src/process_component_constructor.ts index 36f56baa33f1625bd7efaa4c19c954e28a904ca5..d75c50cf84fc8488ec06ff72e4321cd68affb2d4 100644 --- a/compiler/src/process_component_constructor.ts +++ b/compiler/src/process_component_constructor.ts @@ -20,9 +20,7 @@ import { COMPONENT_CONSTRUCTOR_PARENT, COMPONENT_CONSTRUCTOR_PARAMS, COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, - COMPONENT_WATCH_FUNCTION, - BASE_COMPONENT_NAME, - INTERFACE_NAME_SUFFIX + COMPONENT_WATCH_FUNCTION } from './pre_define'; export function getInitConstructor(members: ts.NodeArray): ts.ConstructorDeclaration { @@ -32,12 +30,11 @@ export function getInitConstructor(members: ts.NodeArray): ts.Construct if (ctorNode) { ctorNode = updateConstructor(ctorNode, [], [], true); } - return ctorNode; + return initConstructorParams(ctorNode); } export function updateConstructor(ctorNode: ts.ConstructorDeclaration, - para: ts.ParameterDeclaration[], addStatements: ts.Statement[], - isSuper: boolean = false, isAdd: boolean = false, parentComponentName?: ts.Identifier): + para: ts.ParameterDeclaration[], addStatements: ts.Statement[], isSuper: boolean = false): ts.ConstructorDeclaration { let modifyPara: ts.ParameterDeclaration[]; if (para && para.length) { @@ -58,46 +55,29 @@ export function updateConstructor(ctorNode: ts.ConstructorDeclaration, } } if (ctorNode) { - let ctorPara: ts.ParameterDeclaration[] | ts.NodeArray = - modifyPara || ctorNode.parameters; - if (isAdd) { - ctorPara = addParamsType(ctorNode, modifyPara, parentComponentName); - } ctorNode = ts.factory.updateConstructorDeclaration(ctorNode, ctorNode.decorators, - ctorNode.modifiers, ctorPara, ts.factory.createBlock(modifyBody || ctorNode.body.statements, true)); + ctorNode.modifiers, modifyPara || ctorNode.parameters, + ts.factory.createBlock(modifyBody || ctorNode.body.statements, true)); } return ctorNode; } -function addParamsType(ctorNode: ts.ConstructorDeclaration, modifyPara: ts.ParameterDeclaration[], - parentComponentName: ts.Identifier): ts.ParameterDeclaration[] { - const tsPara: ts.ParameterDeclaration[] | ts.NodeArray = - modifyPara || ctorNode.parameters; - const newTSPara: ts.ParameterDeclaration[] = []; - tsPara.forEach((item) => { - let parameter: ts.ParameterDeclaration = item; - switch (item.getText()) { - case COMPONENT_CONSTRUCTOR_ID + '?': - parameter = ts.factory.updateParameterDeclaration(item, item.decorators, item.modifiers, - item.dotDotDotToken, item.name, item.questionToken, - ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), item.initializer); - break; - case COMPONENT_CONSTRUCTOR_PARENT + '?': - parameter = ts.factory.createParameterDeclaration(item.decorators, item.modifiers, - item.dotDotDotToken, item.name, item.questionToken, - ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(BASE_COMPONENT_NAME), undefined), - item.initializer); - break; - case COMPONENT_CONSTRUCTOR_PARAMS + '?': - parameter = ts.factory.updateParameterDeclaration(item, item.decorators, item.modifiers, - item.dotDotDotToken, item.name, item.questionToken, - ts.factory.createTypeReferenceNode(ts.factory.createIdentifier( - parentComponentName.getText() + INTERFACE_NAME_SUFFIX), undefined), item.initializer); - break; - } - newTSPara.push(parameter); +function initConstructorParams(node: ts.ConstructorDeclaration): ts.ConstructorDeclaration { + const paramNames: string[] = [COMPONENT_CONSTRUCTOR_ID, COMPONENT_CONSTRUCTOR_PARENT, + COMPONENT_CONSTRUCTOR_PARAMS]; + const newParameters: ts.ParameterDeclaration[] = Array.from(node.parameters); + if (newParameters.length !== 0) { + // @ts-ignore + newParameters.splice(0, newParameters.length); + } + paramNames.forEach((paramName: string) => { + // @ts-ignore + newParameters.push(ts.factory.createParameterDeclaration(undefined, undefined, undefined, + ts.factory.createIdentifier(paramName), undefined, undefined, undefined)); }); - return newTSPara; + + return ts.factory.updateConstructorDeclaration(node, undefined, node.modifiers, newParameters, + node.body); } export function addConstructor(ctorNode: any, watchMap: Map, @@ -129,5 +109,5 @@ export function addConstructor(ctorNode: any, watchMap: Map, ts.factory.createThis(), ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS)), undefined, [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)])); return updateConstructor(updateConstructor(ctorNode, [], [callSuperStatement], true), [], - [updateWithValueParamsStatement, ...watchStatements], false, true, parentComponentName); + [updateWithValueParamsStatement, ...watchStatements], false); } diff --git a/compiler/src/process_custom_component.ts b/compiler/src/process_custom_component.ts index 34ca61d68386fb3a641d2e86a99119f6425667a0..50109765b518b22bc9362abd7cd9bc38ccd39d1d 100644 --- a/compiler/src/process_custom_component.ts +++ b/compiler/src/process_custom_component.ts @@ -178,6 +178,9 @@ function getCustomComponentName(newNode: ts.NewExpression): string { } function getCollectionSet(name: string, collection: Map>): Set { + if (!collection) { + return new Set([]); + } return collection.get(name) || new Set([]); } diff --git a/compiler/src/process_import.ts b/compiler/src/process_import.ts index eb5bb1cebab0576584e10d9e4b86e0da12fe6469..6327b5c16e7fd37697c619368fac41294bdc3d9d 100644 --- a/compiler/src/process_import.ts +++ b/compiler/src/process_import.ts @@ -89,7 +89,7 @@ export default function processImport(node: ts.ImportDeclaration | ts.ImportEqua fs.readFileSync(fileResolvePath, { encoding: 'utf-8' }).replace( new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { return item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); - })), fileResolvePath, log); + }))); const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); visitAllNode(sourceFile, defaultName, asName, path.dirname(fileResolvePath), log); diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index e3221796c198461c2af668be4c13f3bd4de13940..7a4825d35028727de7def4b84ecb779af5c7a630 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -23,7 +23,6 @@ import { PAGE_ENTRY_FUNCTION_NAME, COMPONENT_CONSTRUCTOR_UNDEFINED, BUILD_ON, - COMPONENT_BUILD_FUNCTION, COMPONENT_BUILDER_DECORATOR, COMPONENT_EXTEND_DECORATOR, COMPONENT_STYLES_DECORATOR, @@ -35,7 +34,9 @@ import { RESOURCE_NAME_PARAMS, RESOURCE_RAWFILE, ATTRIBUTE_ANIMATETO, - GLOBAL_CONTEXT + GLOBAL_CONTEXT, + CHECK_COMPONENT_EXTEND_DECORATOR, + INSTANCE } from './pre_define'; import { componentInfo, @@ -45,18 +46,13 @@ import { FileLog } from './utils'; import { - getName, - isAttributeNode, processComponentBlock, - bindComponentAttr, - appComponentCollection + bindComponentAttr } from './process_component_build'; import { - BUILDIN_CONTAINER_COMPONENT, BUILDIN_STYLE_NAMES, CUSTOM_BUILDER_METHOD, EXTEND_ATTRIBUTE, - JS_BIND_COMPONENTS, INNER_STYLE_FUNCTION, GLOBAL_STYLE_FUNCTION, INTERFACE_NODE_SET @@ -73,20 +69,18 @@ export function processUISyntax(program: ts.Program, ut = false): Function { return (node: ts.SourceFile) => { pagesDir = path.resolve(path.dirname(node.fileName)); if (process.env.compiler === BUILD_ON) { - if (!ut && (path.basename(node.fileName) === 'app.ets.ts' || !/\.ets\.ts$/.test(node.fileName))) { + if (!ut && (path.basename(node.fileName) === 'app.ets' || /\.ts$/.test(node.fileName))) { node = ts.visitEachChild(node, processResourceNode, context); return node; } - collectComponents(node); transformLog.sourceFile = node; - validateSourceFileNode(node); node = createEntryNode(node, context); node = ts.visitEachChild(node, processAllNodes, context); GLOBAL_STYLE_FUNCTION.forEach((block, styleName) => { BUILDIN_STYLE_NAMES.delete(styleName); }); GLOBAL_STYLE_FUNCTION.clear(); - const statements: ts.NodeArray = node.statements; + const statements: ts.Statement[] = Array.from(node.statements); INTERFACE_NODE_SET.forEach(item => { statements.unshift(item); }); @@ -100,8 +94,7 @@ export function processUISyntax(program: ts.Program, ut = false): Function { function processAllNodes(node: ts.Node): ts.Node { if (ts.isImportDeclaration(node) || ts.isImportEqualsDeclaration(node)) { processImport(node, pagesDir, transformLog.errors); - } else if (ts.isClassDeclaration(node) && node.name && - componentCollection.customComponents.has(node.name.getText())) { + } else if (ts.isStructDeclaration(node)) { componentCollection.currentClassName = node.name.getText(); node = processComponentClass(node, context, transformLog.errors, program); componentCollection.currentClassName = null; @@ -144,35 +137,9 @@ export function processUISyntax(program: ts.Program, ut = false): Function { } return ts.visitEachChild(node, processResourceNode, context); } - function validateSourceFileNode(node: ts.SourceFile): void { - if (program) { - node = ts.visitEachChild(node, validateAllNodes, context); - } - } - function validateAllNodes(node: ts.Node): ts.Node { - if (ts.isMethodDeclaration(node) && node.name && - node.name.getText() === COMPONENT_BUILD_FUNCTION && node.body && ts.isBlock(node.body)) { - const typeChecker: ts.TypeChecker = program.getTypeChecker(); - validateBody(node.body, typeChecker); - return node; - } - return ts.visitEachChild(node, validateAllNodes, context); - } }; } -function collectComponents(node: ts.SourceFile): void { - // @ts-ignore - if (node.identifiers && node.identifiers.size) { - // @ts-ignore - for (const key of node.identifiers.keys()) { - if (JS_BIND_COMPONENTS.has(key)) { - appComponentCollection.add(key); - } - } - } -} - function isResource(node: ts.Node): boolean { return ts.isCallExpression(node) && ts.isIdentifier(node.expression) && (node.expression.escapedText.toString() === RESOURCE || @@ -285,29 +252,51 @@ function processAnimateTo(node: ts.CallExpression): ts.CallExpression { function processExtend(node: ts.FunctionDeclaration, log: LogInfo[]): ts.FunctionDeclaration { const componentName: string = isExtendFunction(node); - if (componentName) { + if (componentName && node.body && node.body.statements.length) { const statementArray: ts.Statement[] = []; - bindComponentAttr(node.body.statements[0] as ts.ExpressionStatement, + const attrSet: ts.CallExpression = node.body.statements[0].expression; + const changeCompName: ts.ExpressionStatement = ts.factory.createExpressionStatement(processExtendBody(attrSet)); + bindComponentAttr(changeCompName as ts.ExpressionStatement, ts.factory.createIdentifier(componentName), statementArray, log); + let extendFunctionName: string; + if (node.name.getText().startsWith('__' + componentName + '__')) { + extendFunctionName = node.name.getText(); + } else { + extendFunctionName = '__' + componentName + '__' + node.name.getText(); + collectExtend(EXTEND_ATTRIBUTE, componentName, node.name.escapedText.toString()); + } return ts.factory.updateFunctionDeclaration(node, undefined, node.modifiers, node.asteriskToken, - node.name, node.typeParameters, node.parameters, node.type, - ts.factory.updateBlock(node.body, statementArray)); + ts.factory.createIdentifier(extendFunctionName), node.typeParameters, + node.parameters, node.type, ts.factory.updateBlock(node.body, statementArray)); + } +} + +function processExtendBody(node: ts.Node): ts.Expression { + switch (node.kind) { + case ts.SyntaxKind.CallExpression: + return ts.factory.createCallExpression(processExtendBody(node.expression), undefined, node.arguments); + case ts.SyntaxKind.PropertyAccessExpression: + return ts.factory.createPropertyAccessExpression(processExtendBody(node.expression), node.name); + case ts.SyntaxKind.Identifier: + return ts.factory.createIdentifier(node.escapedText.toString().replace(INSTANCE, '')); + } +} + +export function collectExtend(collectionSet: Map>, component: string, attribute: string): void { + if (collectionSet.has(component)) { + collectionSet.get(component).add(attribute); + } else { + collectionSet.set(component, new Set([attribute])); } } function isExtendFunction(node: ts.FunctionDeclaration): string { - if (ts.isBlock(node.body) && node.body.statements && node.body.statements.length === 1 && - ts.isExpressionStatement(node.body.statements[0]) && - // @ts-ignore - ts.isCallExpression(node.body.statements[0].expression) && ts.isIdentifier(node.name)) { - const nameArray: string[] = node.name.getText().split('__'); - if (nameArray.length === 3 && !nameArray[0] && EXTEND_ATTRIBUTE.has(nameArray[1])) { - const attributeArray: string[] = - [...EXTEND_ATTRIBUTE.get(nameArray[1])].map(item => item.attribute); - if (attributeArray.includes(nameArray[2])) { - return nameArray[1]; - } - } + if (node.decorators && node.decorators[0].expression && + node.decorators[0].expression.expression.escapedText.toString() === CHECK_COMPONENT_EXTEND_DECORATOR && + node.decorators[0].expression.arguments) { + return node.decorators[0].expression.arguments[0].escapedText.toString(); + } else { + return null; } } @@ -325,122 +314,6 @@ function createEntryNode(node: ts.SourceFile, context: ts.TransformationContext) } } -function validateBody(node: ts.Block, typeChecker: ts.TypeChecker): void { - if (node.statements.length) { - node.statements.forEach((item, index, arr) => { - if (ts.isBlock(item)) { - validateBody(item, typeChecker); - } - if (index + 2 < arr.length && ts.isExpressionStatement(item) && - isAttributeBlockNode(item, arr as ts.Statement[], index) && - ts.isCallExpression(item.expression) && ts.isIdentifier(item.expression.expression)) { - const componentName: string = item.expression.expression.getText(); - const type: ts.Type = typeChecker.getTypeAtLocation(item.expression); - let temp: any = arr[index + 2]; - let name: string; - while (temp) { - if (ts.isCallExpression(temp)) { - if (ts.isPropertyAccessExpression(temp.expression)) { - const pos: number = temp.expression.name.getStart(); - name = temp.expression.name.getText(); - validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), - temp.arguments, pos, typeChecker); - } else if (ts.isIdentifier(temp.expression)) { - const pos: number = temp.expression.getStart(); - name = temp.expression.getText(); - validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), - temp.arguments, pos, typeChecker); - break; - } - } - temp = temp.expression; - } - } - }); - } -} - -function validateSymbol(type: ts.Symbol, args: ts.NodeArray, - argPos: number, typeChecker: ts.TypeChecker): void { - // @ts-ignore - if (type && type.valueDeclaration.parameters) { - // @ts-ignore - const parameters: ts.ParameterDeclaration[] = type.valueDeclaration.parameters; - const maxLength: number = parameters.length; - const minLength: number = getMinLength(parameters); - if (args.length < minLength || args.length > maxLength) { - let message:string; - if (maxLength !== minLength) { - message = `TS2554: Expected ${minLength}-${maxLength} arguments, but got ${args.length}.`; - } else { - message = `TS2554: Expected ${maxLength} arguments, but got ${args.length}.`; - } - transformLog.errors.push({ - type: LogType.ERROR, - message: message, - pos: argPos - }); - } else { - for (let i = 0; i < parameters.length; i++) { - validatePropertyType(parameters[i], args[i], typeChecker); - } - } - } -} - -function getMinLength(parameters: ts.ParameterDeclaration[]): number { - let length: number = parameters.length; - parameters.forEach((item: ts.ParameterDeclaration) => { - if (item.questionToken !== undefined) { - length--; - } - }); - return length; -} - -function isPropertyExist(typeChecker: ts.TypeChecker, pos: number, type: ts.Type, - propertyName: string, componentName: string): ts.Symbol { - const symbol: ts.Symbol = typeChecker.getPropertyOfType(type, propertyName); - if (symbol) { - return symbol; - } else { - transformLog.errors.push({ - type: LogType.ERROR, - message: `TS2339: Property '${propertyName}' does not exist on type '${componentName}Attribute'.`, - pos: pos - }); - } - return null; -} - -function validatePropertyType(param: ts.ParameterDeclaration, arg: ts.Expression, - typeChecker: ts.TypeChecker): void { - const argLocalType: ts.Type = typeChecker.getTypeAtLocation(arg); - const paramLocalType: ts.Type = typeChecker.getTypeAtLocation(param.type); - const argType: ts.Type = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(arg)); - // @ts-ignore - const intrinsicName: string = argType.intrinsicName; - const argTypeName: string = intrinsicName || typeChecker.typeToString(argLocalType); - // @ts-ignore - if (!typeChecker.isTypeAssignableTo(argLocalType, paramLocalType)) { - generateArgumentLog(arg, argTypeName, typeChecker.typeToString(paramLocalType)); - } -} - -function generateArgumentLog(arg: ts.Expression, argTypeName: string, paramTypeName: string): void { - transformLog.errors.push({ - type: LogType.ERROR, - message: `TS2345: Argument of type '${argTypeName}' is not assignable to parameter of type '${paramTypeName}'.`, - pos: arg.getStart() - }); -} - -function isAttributeBlockNode(node: ts.ExpressionStatement, arr: ts.Statement[], index: number): boolean { - const attributeNode: ts.Node = arr[index + 2]; - return BUILDIN_CONTAINER_COMPONENT.has(getName(node)) && ts.isBlock(arr[index + 1]) - && ts.isExpressionStatement(attributeNode) && isAttributeNode(attributeNode); -} - function createEntryFunction(name: string, context: ts.TransformationContext) : ts.ExpressionStatement { return context.factory.createExpressionStatement(context.factory.createCallExpression( diff --git a/compiler/src/result_process.ts b/compiler/src/result_process.ts index fb0269ad4b64546e0c524cee5e380250a612b012..fe96bf2a04b217aaa0e9540ac2ae8797bdf3d8d7 100644 --- a/compiler/src/result_process.ts +++ b/compiler/src/result_process.ts @@ -52,14 +52,14 @@ module.exports = function resultProcess(source: string, map: any): void { item.line = undefined; item.column = undefined; } - item.fileName = sourceFile.fileName.replace(/.ts$/, ''); + item.fileName = sourceFile.fileName; return item; }); emitLogInfo(this, logInfos); resetLog(); } } - if ([abilityConfig.abilityEntryFile].concat(abilityConfig.projectAbilityPath).includes(this.resourcePath)) { + if ([abilityConfig.abilityEntryFile].concat(abilityConfig.projectAbilityPath).concat(abilityConfig.testRunnerFile).includes(this.resourcePath)) { source = source.replace(/exports\.default/, 'globalThis.exports.default'); } diff --git a/compiler/src/utils.ts b/compiler/src/utils.ts index c7a7700bbf4cc6e5436220aa60a69f42568229be..d491a41485477392bffa1b15e6e37dbd52056cb4 100644 --- a/compiler/src/utils.ts +++ b/compiler/src/utils.ts @@ -112,11 +112,11 @@ class ComponentInfo { export const componentInfo: ComponentInfo = new ComponentInfo(); -export function hasDecorator(node: ts.MethodDeclaration | ts.FunctionDeclaration | ts.ClassDeclaration, - decortorName: string): boolean { +export function hasDecorator(node: ts.MethodDeclaration | ts.FunctionDeclaration | + ts.StructDeclaration | ts.ClassDeclaration, decortorName: string): boolean { if (node.decorators && node.decorators.length) { for (let i = 0; i < node.decorators.length; i++) { - if (node.decorators[i].getText() === decortorName) { + if (node.decorators[i].getText().replace(/\(.*\)$/, '').trim() === decortorName) { return true; } } @@ -199,10 +199,19 @@ function copyFile(inputFile: string, outputFile: string): void { } } -function mkDir(path_: string): void { +export function mkDir(path_: string): void { const parent: string = path.join(path_, '..'); if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) { mkDir(parent); } fs.mkdirSync(path_); -} +} + +export function toUnixPath(data: string): string { + if (/^win/.test(require('os').platform())) { + const fileTmps: string[] = data.split(path.sep); + const newData: string = path.posix.join(...fileTmps); + return newData; + } + return data; +} \ No newline at end of file diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 5dd4474de06c4905656f6b5f87e39dea53bcb593..f47383a0a18bfa124783872d572fbf032c8ef9d4 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -22,8 +22,6 @@ import { COMPONENT_DECORATOR_PREVIEW, COMPONENT_DECORATOR_COMPONENT, COMPONENT_DECORATOR_CUSTOM_DIALOG, - STRUCT, - CLASS, NATIVE_MODULE, SYSTEM_PLUGIN, OHOS_PLUGIN, @@ -38,9 +36,6 @@ import { COMPONENT_PROVIDE_DECORATOR, COMPONENT_CONSUME_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR, - COMPONENT_CONSTRUCTOR_ID, - COMPONENT_CONSTRUCTOR_PARENT, - COMPONENT_CONSTRUCTOR_PARAMS, COMPONENT_OBSERVED_DECORATOR, STYLES, VALIDATE_MODULE, @@ -65,7 +60,7 @@ import { hasDecorator } from './utils'; import { projectConfig } from '../main'; -const parser = require('../syntax_parser/dist/exclude_comment.js'); +import { collectExtend } from './process_ui_syntax'; export interface ComponentCollection { entryComponent: string; @@ -137,7 +132,7 @@ function checkComponentDecorator(source: string, filePath: string, fileQuery: string): LogInfo[] | null { const log: LogInfo[] = []; const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, source, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + ts.ScriptTarget.Latest, true, ts.ScriptKind.ETS); if (sourceFile && sourceFile.statements && sourceFile.statements.length) { const result: DecoratorResult = { entryCount: 0, @@ -151,26 +146,17 @@ function checkComponentDecorator(source: string, filePath: string, if (ts.isEnumDeclaration(item) && item.name) { enumCollection.add(item.name.getText()); } - if (isStruct(item)) { - if (index + 1 < arr.length && ts.isExpressionStatement(arr[index + 1]) && - // @ts-ignore - arr[index + 1].expression && ts.isIdentifier(arr[index + 1].expression)) { - if (ts.isExportAssignment(item) && hasComponentDecorator(item)) { - checkDecorators(item, result, arr[index + 1] as ts.ExpressionStatement, log, sourceFile); - } else if (index > 0 && hasComponentDecorator(arr[index - 1])) { - checkDecorators(arr[index - 1] as ts.MissingDeclaration, result, - arr[index + 1] as ts.ExpressionStatement, log, sourceFile); + if (ts.isStructDeclaration(item)) { + if (item.name && ts.isIdentifier(item.name)) { + if (item.decorators && item.decorators.length) { + checkDecorators(item.decorators, result, item.name, log, sourceFile); } else { - // @ts-ignore - const pos: number = item.expression.getStart(); const message: string = `A struct should use decorator '@Component'.`; - addLog(LogType.WARN, message, pos, log, sourceFile); + addLog(LogType.WARN, message, item.getStart(), log, sourceFile); } } else { - // @ts-ignore - const pos: number = item.expression.getStart(); const message: string = `A struct must have a name.`; - addLog(LogType.ERROR, message, pos, log, sourceFile); + addLog(LogType.ERROR, message, item.getStart(), log, sourceFile); } } if (ts.isMissingDeclaration(item)) { @@ -245,33 +231,17 @@ export function isCustomDialogClass(node: ts.Node): boolean { return false; } -function isStruct(node: ts.Node): boolean { - if ((ts.isExpressionStatement(node) || ts.isExportAssignment(node)) && - node.expression && ts.isIdentifier(node.expression) && node.expression.getText() === STRUCT) { - return true; - } - return false; -} - -function hasComponentDecorator(node: ts.Node): boolean { - if ((ts.isMissingDeclaration(node) || ts.isExportAssignment(node)) && - node.decorators && node.decorators.length) { - return true; - } - return false; -} - interface DecoratorResult { entryCount: number; previewCount: number; } -function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, result: DecoratorResult, - component: ts.ExpressionStatement, log: LogInfo[], sourceFile: ts.SourceFile): void { +function checkDecorators(decorators: ts.NodeArray, result: DecoratorResult, + component: ts.Identifier, log: LogInfo[], sourceFile: ts.SourceFile): void { let hasComponentDecorator: boolean = false; const componentName: string = component.getText(); - node.decorators.forEach((element) => { - const name: string = element.getText().replace(/\((.|\n)*\)/, '').trim(); + decorators.forEach((element) => { + const name: string = element.getText().replace(/\([^\(\)]*\)/, '').trim(); if (INNER_COMPONENT_DECORATORS.has(name)) { componentCollection.customComponents.add(componentName); switch (name) { @@ -316,14 +286,14 @@ function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, resu function checkUISyntax(filePath: string, allComponentNames: Set, content: string, log: LogInfo[]): void { const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + ts.ScriptTarget.Latest, true, ts.ScriptKind.ETS); visitAllNode(sourceFile, sourceFile, allComponentNames, log); } function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponentNames: Set, log: LogInfo[]) { checkAllNode(node, allComponentNames, sourceFileNode, log); - if (ts.isClassDeclaration(node) && node.name && ts.isIdentifier(node.name)) { + if (ts.isStructDeclaration(node) && node.name && ts.isIdentifier(node.name)) { collectComponentProps(node); } if (ts.isMethodDeclaration(node) && hasDecorator(node, COMPONENT_BUILDER_DECORATOR)) { @@ -335,7 +305,7 @@ function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponent function checkAllNode(node: ts.Node, allComponentNames: Set, sourceFileNode: ts.SourceFile, log: LogInfo[]): void { if (ts.isExpressionStatement(node) && node.expression && ts.isIdentifier(node.expression) && - allComponentNames.has(node.expression.escapedText.toString())) { + allComponentNames.has(node.expression.escapedText.toString())) { const pos: number = node.expression.getStart(); const message: string = `The component name must be followed by parentheses, like '${node.expression.getText()}()'.`; @@ -629,7 +599,7 @@ function isNonspecificChildIfStatement(node: ts.Node, specificChildSet: Set = new Set(); const states: Set = new Set(); const links: Set = new Set(); @@ -663,7 +633,7 @@ export function getComponentSet(node: ts.ClassDeclaration): IComponentSet { }; } -function traversalComponentProps(node: ts.ClassDeclaration, propertys: Set, +function traversalComponentProps(node: ts.StructDeclaration, propertys: Set, regulars: Set, states: Set, links: Set, props: Set, storageProps: Set, storageLinks: Set, provides: Set, consumes: Set, objectLinks: Set): void { @@ -736,14 +706,7 @@ export interface ReplaceResult { export function sourceReplace(source: string, sourcePath: string): ReplaceResult { let content: string = source; const log: LogInfo[] = []; - // replace struct->class - content = content.replace( - new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { - item = item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); - return `${item} constructor(${COMPONENT_CONSTRUCTOR_ID}?, ${COMPONENT_CONSTRUCTOR_PARENT}?, ${COMPONENT_CONSTRUCTOR_PARAMS}?) {}`; - }); - - content = preprocessExtend(content, sourcePath, log); + content = preprocessExtend(content); // process @system. content = processSystemApi(content); @@ -753,57 +716,16 @@ export function sourceReplace(source: string, sourcePath: string): ReplaceResult }; } -export function preprocessExtend(content: string, sourcePath: string, log: LogInfo[]): string { - let syntaxCheckContent: string; - let result: any; - try { - result = parser.parse(content); - syntaxCheckContent = result.content; - for (let i = 0; i < result.collect_extend.component.length; i++) { - collectExtend( - result.collect_extend.component[i], - result.collect_extend.functionName[i], - result.collect_extend.parameters[i] - ); +export function preprocessExtend(content: string, extendCollection?: Set): string { + const REG_EXTEND: RegExp = /@Extend(\s+)([^\.\s]+)\.([^\(]+)\(/gm; + return content.replace(REG_EXTEND, (item, item1, item2, item3) => { + collectExtend(EXTEND_ATTRIBUTE, item2, '__' + item2 + '__' + item3); + collectExtend(EXTEND_ATTRIBUTE, item2, item3); + if (extendCollection) { + extendCollection.add(item3); } - } catch (err) { - result = err; - log.push({ - type: LogType.ERROR, - message: parser.SyntaxError.buildMessage(err.expected, err.found), - line: err.location.start.line, - column: err.location.start.column, - fileName: sourcePath - }); - syntaxCheckContent = content; - } - if (result.error_otherParsers) { - for (let i = 0; i < result.error_otherParsers.length; i++) { - log.push({ - type: LogType.ERROR, - message: result.error_otherParsers[i].errMessage, - line: result.error_otherParsers[i].errPosition.line, - column: result.error_otherParsers[i].errPosition.column, - fileName: sourcePath - }); - } - } - return syntaxCheckContent; -} - -function collectExtend(component: string, attribute: string, parameter: string): void { - let parameterCount: number; - if (parameter) { - parameterCount = parameter.split(',').length; - } else { - parameterCount = 0; - } - BUILDIN_STYLE_NAMES.add(attribute); - if (EXTEND_ATTRIBUTE.has(component)) { - EXTEND_ATTRIBUTE.get(component).add({ attribute, parameterCount }); - } else { - EXTEND_ATTRIBUTE.set(component, new Set([{ attribute, parameterCount }])); - } + return `@Extend(${item2})${item1}function __${item2}__${item3}(`; + }); } export function processSystemApi(content: string, isProcessWhiteList: boolean = false): string { diff --git a/compiler/test/test.js b/compiler/test/test.js index 0a6506aa049f1c30b938579f647b273fe18e35e8..99f5e2417daef7c30dfdfd472f52f1b23821834a 100644 --- a/compiler/test/test.js +++ b/compiler/test/test.js @@ -38,11 +38,14 @@ function expectActual(name, filePath) { process.env.compiler = BUILD_ON; const afterProcess = sourceReplace(source); validateUISyntax(source, afterProcess.content, `${name}.ts`); + const compilerOptions = ts.readConfigFile( + path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions; + Object.assign(compilerOptions, { + "sourceMap": false, + }); const result = ts.transpileModule(afterProcess.content, { - compilerOptions: { - "target": ts.ScriptTarget.ES2017 - }, - fileName: `${name}.ts`, + compilerOptions: compilerOptions, + fileName: `${name}.ets`, transformers: { before: [processUISyntax(null, true)] } }); componentInfo.id = 0; diff --git a/compiler/test/ut/component/customComponent.ts b/compiler/test/ut/component/customComponent.ts index bdf19913bc88f4cef950109df91c2663342ab961..2ffe6bd3653c55fff380b8cd0e1280f60f851770 100644 --- a/compiler/test/ut/component/customComponent.ts +++ b/compiler/test/ut/component/customComponent.ts @@ -25,8 +25,7 @@ struct Parent { Row() { Child({ stateProperty: this.regularToState, propProperty: this.stateToProp, - regularProperty: this.regularToRegular, - linkProperty: this.$stateToLink + regularProperty: this.regularToRegular, linkProperty: this.__stateToLink }) } } @@ -91,8 +90,7 @@ exports.expectResult = if (earlierCreatedChild_2 == undefined) { View.create(new Child("2", this, { stateProperty: this.regularToState, propProperty: this.stateToProp, - regularProperty: this.regularToRegular, - linkProperty: this.__stateToLink + regularProperty: this.regularToRegular, linkProperty: this.__stateToLink })); } else { diff --git a/compiler/test/ut/struct/struct_02.ts b/compiler/test/ut/struct/struct_02.ts index 175a1085d27a9c70852b6fe7277399ad305e9d3f..2ddd86ac96fd2fe8fa4ede4ebbcca03c7cd51e8d 100644 --- a/compiler/test/ut/struct/struct_02.ts +++ b/compiler/test/ut/struct/struct_02.ts @@ -20,9 +20,17 @@ struct MyComponent { }` exports.expectResult = -`class MyComponent { - constructor(compilerAssignedUniqueChildId, parent, params) { } - build() { +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { } } ` diff --git a/compiler/tsconfig.json b/compiler/tsconfig.json index 822f29fa5e395235e355b680fbc867dba842c092..b53c39d76c05e42c53b5cbb757738344f306cc7c 100644 --- a/compiler/tsconfig.json +++ b/compiler/tsconfig.json @@ -1,6 +1,544 @@ { "compileOnSave": false, "compilerOptions": { + "ets": { + "render": { + "method": ["build", "pageTransition"], + "decorator": "Builder" + }, + "components": [ + "AbilityComponent", + "AlphabetIndexer", + "Animator", + "Badge", + "Blank", + "Button", + "Calendar", + "Camera", + "Canvas", + "Checkbox", + "CheckboxGroup", + "Circle", + "ColorPicker", + "ColorPickerDialog", + "Column", + "ColumnSplit", + "Counter", + "DataPanel", + "DatePicker", + "Divider", + "Ellipse", + "Flex", + "FormComponent", + "FrictionMotion", + "Gauge", + "GeometryView", + "Grid", + "GridItem", + "GridContainer", + "Hyperlink", + "Image", + "ImageAnimator", + "Line", + "List", + "ListItem", + "LoadingProgress", + "Marquee", + "Menu", + "Navigation", + "Navigator", + "Option", + "PageTransitionEnter", + "PageTransitionExit", + "Panel", + "Path", + "PatternLock", + "Piece", + "PluginComponent", + "Polygon", + "Polyline", + "Progress", + "QRCode", + "Radio", + "Rating", + "Rect", + "Refresh", + "Row", + "RowSplit", + "RichText", + "Scroll", + "ScrollBar", + "ScrollMotion", + "Search", + "Section", + "Select", + "Shape", + "Sheet", + "SideBarContainer", + "Slider", + "Span", + "Stack", + "Stepper", + "StepperItem", + "Swiper", + "TabContent", + "Tabs", + "Text", + "TextPicker", + "TextClock", + "TextArea", + "TextInput", + "TextTimer", + "Toggle", + "Video", + "Web", + "XComponent" + ], + "extend": { + "decorator": "Extend", + "components": [ + { + "name": "AbilityComponent", + "type": "AbilityComponentAttribute", + "instance": "AbilityComponentInstance" + }, + { + "name": "AlphabetIndexer", + "type": "AlphabetIndexerAttribute", + "instance": "AlphabetIndexerInstance" + }, + { + "name": "Animator", + "type": "AnimatorAttribute", + "instance": "AnimatorInstance" + }, + { + "name": "Badge", + "type": "BadgeAttribute", + "instance": "BadgeInstance" + }, + { + "name": "Blank", + "type": "BlankAttribute", + "instance": "BlankInstance" + }, + { + "name": "Button", + "type": "ButtonAttribute", + "instance": "ButtonInstance" + }, + { + "name": "Calendar", + "type": "CalendarAttribute", + "instance": "CalendarInstance" + }, + { + "name": "Camera", + "type": "CameraAttribute", + "instance": "CameraInstance" + }, + { + "name": "Canvas", + "type": "CanvasAttribute", + "instance": "CanvasInstance" + }, + { + "name": "Checkbox", + "type": "CheckboxAttribute", + "instance": "CheckboxInstance" + }, + { + "name": "CheckboxGroup", + "type": "CheckboxGroupAttribute", + "instance": "CheckboxGroupInstance" + }, + { + "name": "Circle", + "type": "CircleAttribute", + "instance": "CircleInstance" + }, + { + "name": "ColorPicker", + "type": "ColorPickerAttribute", + "instance": "ColorPickerInstance" + }, + { + "name": "ColorPickerDialog", + "type": "ColorPickerDialogAttribute", + "instance": "ColorPickerDialogInstance" + }, + { + "name": "Column", + "type": "ColumnAttribute", + "instance": "ColumnInstance" + }, + { + "name": "ColumnSplit", + "type": "ColumnSplitAttribute", + "instance": "ColumnSplitInstance" + }, + { + "name": "Counter", + "type": "CounterAttribute", + "instance": "CounterInstance" + }, + { + "name": "DataPanel", + "type": "DataPanelAttribute", + "instance": "DataPanelInstance" + }, + { + "name": "DatePicker", + "type": "DatePickerAttribute", + "instance": "DatePickerInstance" + }, + { + "name": "Divider", + "type": "DividerAttribute", + "instance": "DividerInstance" + }, + { + "name": "Ellipse", + "type": "EllipseAttribute", + "instance": "EllipseInstance" + }, + { + "name": "Flex", + "type": "FlexAttribute", + "instance": "FlexInstance" + }, + { + "name": "FormComponent", + "type": "FormComponentAttribute", + "instance": "FormComponentInstance" + }, + { + "name": "FrictionMotion", + "type": "FrictionMotionAttribute", + "instance": "FrictionMotionInstance" + }, + { + "name": "Gauge", + "type": "GaugeAttribute", + "instance": "GaugeInstance" + }, + { + "name": "GeometryView", + "type": "GeometryViewAttribute", + "instance": "GeometryViewInstance" + }, + { + "name": "Grid", + "type": "GridAttribute", + "instance": "GridInstance" + }, + { + "name": "GridItem", + "type": "GridItemAttribute", + "instance": "GridItemInstance" + }, + { + "name": "GridContainer", + "type": "GridContainerAttribute", + "instance": "GridContainerInstance" + }, + { + "name": "Hyperlink", + "type": "HyperlinkAttribute", + "instance": "HyperlinkInstance" + }, + { + "name": "Image", + "type": "ImageAttribute", + "instance": "ImageInstance" + }, + { + "name": "ImageAnimator", + "type": "ImageAnimatorAttribute", + "instance": "ImageAnimatorInstance" + }, + { + "name": "Line", + "type": "LineAttribute", + "instance": "LineInstance" + }, + { + "name": "List", + "type": "ListAttribute", + "instance": "ListInstance" + }, + { + "name": "ListItem", + "type": "ListItemAttribute", + "instance": "ListItemInstance" + }, + { + "name": "LoadingProgress", + "type": "LoadingProgressAttribute", + "instance": "LoadingProgressInstance" + }, + { + "name": "Marquee", + "type": "MarqueeAttribute", + "instance": "MarqueeInstance" + }, + { + "name": "Menu", + "type": "MenuAttribute", + "instance": "MenuInstance" + }, + { + "name": "Navigation", + "type": "NavigationAttribute", + "instance": "NavigationInstance" + }, + { + "name": "Navigator", + "type": "NavigatorAttribute", + "instance": "NavigatorInstance" + }, + { + "name": "Option", + "type": "OptionAttribute", + "instance": "OptionInstance" + }, + { + "name": "PageTransitionEnter", + "type": "PageTransitionEnterAttribute", + "instance": "PageTransitionEnterInstance" + }, + { + "name": "PageTransitionExit", + "type": "PageTransitionExitAttribute", + "instance": "PageTransitionExitInstance" + }, + { + "name": "Panel", + "type": "PanelAttribute", + "instance": "PanelInstance" + }, + { + "name": "Path", + "type": "PathAttribute", + "instance": "PathInstance" + }, + { + "name": "PatternLock", + "type": "PatternLockAttribute", + "instance": "PatternLockInstance" + }, + { + "name": "Piece", + "type": "PieceAttribute", + "instance": "PieceInstance" + }, + { + "name": "PluginComponent", + "type": "PluginComponentAttribute", + "instance": "PluginComponentInstance" + }, + { + "name": "Polygon", + "type": "PolygonAttribute", + "instance": "PolygonInstance" + }, + { + "name": "Polyline", + "type": "PolylineAttribute", + "instance": "PolylineInstance" + }, + { + "name": "Progress", + "type": "ProgressAttribute", + "instance": "ProgressInstance" + }, + { + "name": "QRCode", + "type": "QRCodeAttribute", + "instance": "QRCodeInstance" + }, + { + "name": "Radio", + "type": "RadioAttribute", + "instance": "RadioInstance" + }, + { + "name": "Rating", + "type": "RatingAttribute", + "instance": "RatingInstance" + }, + { + "name": "Rect", + "type": "RectAttribute", + "instance": "RectInstance" + }, + { + "name": "Refresh", + "type": "RefreshAttribute", + "instance": "RefreshInstance" + }, + { + "name": "Row", + "type": "RowAttribute", + "instance": "RowInstance" + }, + { + "name": "RowSplit", + "type": "RowSplitAttribute", + "instance": "RowSplitInstance" + }, + { + "name": "RichText", + "type": "RichTextAttribute", + "instance": "RichTextInstance" + }, + { + "name": "Scroll", + "type": "ScrollAttribute", + "instance": "ScrollInstance" + }, + { + "name": "ScrollBar", + "type": "ScrollBarAttribute", + "instance": "ScrollBarInstance" + }, + { + "name": "ScrollMotion", + "type": "ScrollMotionAttribute", + "instance": "ScrollMotionInstance" + }, + { + "name": "Search", + "type": "SearchAttribute", + "instance": "SearchInstance" + }, + { + "name": "Section", + "type": "SectionAttribute", + "instance": "SectionInstance" + }, + { + "name": "Select", + "type": "SelectAttribute", + "instance": "SelectInstance" + }, + { + "name": "Shape", + "type": "ShapeAttribute", + "instance": "ShapeInstance" + }, + { + "name": "Sheet", + "type": "SheetAttribute", + "instance": "SheetInstance" + }, + { + "name": "SideBarContainer", + "type": "SideBarContainerAttribute", + "instance": "SideBarContainerInstance" + }, + { + "name": "Slider", + "type": "SliderAttribute", + "instance": "SliderInstance" + }, + { + "name": "Span", + "type": "SpanAttribute", + "instance": "SpanInstance" + }, + { + "name": "Stack", + "type": "StackAttribute", + "instance": "StackInstance" + }, + { + "name": "Stepper", + "type": "StepperAttribute", + "instance": "StepperInstance" + }, + { + "name": "StepperItem", + "type": "StepperItemAttribute", + "instance": "StepperItemInstance" + }, + { + "name": "Swiper", + "type": "SwiperAttribute", + "instance": "SwiperInstance" + }, + { + "name": "TabContent", + "type": "TabContentAttribute", + "instance": "TabContentInstance" + }, + { + "name": "Tabs", + "type": "TabsAttribute", + "instance": "TabsInstance" + }, + { + "name": "Text", + "type": "TextAttribute", + "instance": "TextInstance" + }, + { + "name": "TextPicker", + "type": "TextPickerAttribute", + "instance": "TextPickerInstance" + }, + { + "name": "TextClock", + "type": "TextClockAttribute", + "instance": "TextClockInstance" + }, + { + "name": "TextArea", + "type": "TextAreaAttribute", + "instance": "TextAreaInstance" + }, + { + "name": "TextInput", + "type": "TextInputAttribute", + "instance": "TextInputInstance" + }, + { + "name": "TextTimer", + "type": "TextTimerAttribute", + "instance": "TextTimerInstance" + }, + { + "name": "Toggle", + "type": "ToggleAttribute", + "instance": "ToggleInstance" + }, + { + "name": "Video", + "type": "VideoAttribute", + "instance": "VideoInstance" + }, + { + "name": "Web", + "type": "WebAttribute", + "instance": "WebInstance" + }, + { + "name": "XComponent", + "type": "XComponentAttribute", + "instance": "XComponentInstance" + }, + ] + }, + "styles": { + "decorator": "Styles", + "component": { + "name": "Common", + "type": "T", + "instance": "CommonInstance" + }, + "property": "stateStyles" + }, + }, "allowJs": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, @@ -11,6 +549,7 @@ "experimentalDecorators": true, "moduleResolution": "node", "resolveJsonModule": true, + "skipLibCheck": true, "sourceMap": true, "module": "commonjs", "target": "es2017", diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js index dacd227894d093a3b5a5aa88ef9cb5d69c98dd8b..405325fc7d22ba2bc4394a6fd02ce75f3ffb65b1 100644 --- a/compiler/webpack.config.js +++ b/compiler/webpack.config.js @@ -40,6 +40,9 @@ function initConfig(config) { const projectPath = path.resolve(projectConfig.projectPath); Object.assign(config, { entry: projectConfig.entryObj, + cache: { + type: "filesystem" + }, watch: watchMode, watchOptions: { aggregateTimeout: 10, @@ -67,8 +70,8 @@ function initConfig(config) { { loader: 'ts-loader', options: { - appendTsSuffixTo: [/\.ets$/], onlyCompileBundledFiles: true, + transpileOnly: true, configFile: path.resolve(__dirname, 'tsconfig.json'), getCustomTransformers(program) { return { @@ -272,5 +275,6 @@ module.exports = (env, argv) => { if (appResourcePath) { readAppResource(resources, appResourcePath); } + config.output.library = projectConfig.hashProjectPath; return config; } \ No newline at end of file