diff --git a/config.json b/config.json index d8e05ba..35b99ce 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "info": { "name": "WAIO", - "version": "1.7.0", + "version": "1.7.1", "author": "ipuppet", "module": false }, diff --git a/scripts/app.js b/scripts/app.js index 574220e..367a3d1 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -97,21 +97,6 @@ class AppKernel extends Kernel { * 注入设置中的脚本类型方法 */ initSettingMethods() { - this.setting.method.readme = animate => { - const content = $file.read("/README.md").string - const sheet = new Sheet() - sheet - .setView({ - type: "markdown", - props: { content: content }, - layout: (make, view) => { - make.size.equalTo(view.super) - } - }) - .init() - .present() - } - this.setting.method.tips = animate => { $ui.alert("每个小组件中都有README文件,点击可以得到一些信息。") } @@ -404,7 +389,7 @@ class Widget { module.exports = { run: () => { - //Widget.render("MyDays"); return + //Widget.render("Calendar"); return if ($app.env === $env.widget) { Widget.render() } else if ($app.env === $env.app) { diff --git a/scripts/libs/easy-jsbox.js b/scripts/libs/easy-jsbox.js index 178eb7c..d94759b 100644 --- a/scripts/libs/easy-jsbox.js +++ b/scripts/libs/easy-jsbox.js @@ -1 +1 @@ -var $parcel$global="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequire94c2;null==parcelRequire&&(parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var t=$parcel$inits[e];delete $parcel$inits[e];var i={id:e,exports:{}};return $parcel$modules[e]=i,t.call(i.exports,i,i.exports),i.exports}var a=new Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("45Ip7",(function(e,t){var i=parcelRequire("cgaQ6").Kernel;class a{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText","secondaryText");static linkColor=$color("systemLink");static primaryViewBackgroundColor=$color("primarySurface");static scrollViewBackgroundColor=$color("insetGroupedBackground");static scrollViewList=["list","matrix"];static isLargeScreen=$device.isIpad||$device.isIpadPro;static get windowSize(){return $objc("UIWindow").$keyWindow().jsValue().size}static NavigationBarNormalHeight=$objc("UINavigationController").invoke("alloc.init").$navigationBar().jsValue().frame.height;static NavigationBarLargeTitleHeight=$objc("UITabBarController").invoke("alloc.init").$tabBar().jsValue().frame.height+a.NavigationBarNormalHeight;static get isSplitScreenMode(){return a.isLargeScreen&&$device.info.screen.width!==a.windowSize.width}static get statusBarHeight(){return $app.isDebugging||i.isTaio?0:a.#e.$statusBarFrame().height}static get statusBarOrientation(){return a.#e.$statusBarOrientation()}static get isHorizontal(){return 3===a.statusBarOrientation||4===a.statusBarOrientation}static loading(){const e=$ui.create(a.blurBox({cornerRadius:15},[{type:"spinner",props:{loading:!0,style:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.center.equalTo(t.super)}}]));return{start:()=>{$ui.controller.view.insertAtIndex(e,0),e.layout(((e,t)=>{e.center.equalTo(t.super);const i=Math.min(.6*a.windowSize.width,300);e.size.equalTo($size(i,i))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return a.scrollViewList.indexOf(e)>-1?a.scrollViewBackgroundColor:a.primaryViewBackgroundColor}static separatorLine(e={},t=a.align.bottom){return{type:"canvas",props:e,layout:(e,i)=>{void 0===i.prev?e.top.equalTo(i.super):t===a.align.bottom?e.top.equalTo(i.prev.bottom):e.top.equalTo(i.prev.top),e.height.equalTo(1/$device.info.screen.scale),e.left.right.inset(0)},events:{draw:(t,i)=>{i.strokeColor=e.bgcolor??$color("separatorColor"),i.setLineWidth(1),i.moveToPoint(0,0),i.addLineToPoint(t.frame.width,0),i.strokePath()}}}}static blurBox(e={},t=[],i=$layout.fill){return{type:"blur",props:Object.assign({style:$blurStyle.thinMaterial},e),views:t,layout:i}}static push({views:e,statusBarStyle:t=0,title:i="",navButtons:a=[{title:""}],bgcolor:r=e[0]?.props?.bgcolor??"primarySurface",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:a,title:i,bgcolor:"string"==typeof r?$color(r):r},events:{disappeared:()=>{void 0!==s&&s()}},views:[{type:"view",views:e,layout:(e,t)=>{e.top.equalTo(t.super.safeArea),e.bottom.equalTo(t.super),e.left.right.equalTo(t.super.safeArea)}}]})}}e.exports={UIKit:a}})),parcelRequire.register("cgaQ6",(function(e,t){var i=parcelRequire("czAIJ").VERSION;String.prototype.trim=function(e,t){return e?"l"===t?this.replace(new RegExp("^\\"+e+"+","g"),""):"r"===t?this.replace(new RegExp("\\"+e+"+$","g"),""):this.replace(new RegExp("^\\"+e+"+|\\"+e+"+$","g"),""):this.replace(/^\s+|\s+$/g,"")};class a{startTime=Date.now();isUseJsboxNav=!1;constructor(){$app.isDebugging&&this.debug()}static isTaio=$app.info.bundleID.includes("taio");static l10n(e,t,i=!0){if("string"==typeof t){const e={};t.split(";").forEach((t=>{if(""!==(t=t.trim())){const i=t.split("=");e[i[0].trim().slice(1,-1)]=i[1].trim().slice(1,-1)}})),t=e}const a=$app.strings;a[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=a}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const a=t/(i.height*i.width);e=$imagekit.scaleBy(e,a)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(i.length!==r.length)return!1;for(let r=0;re?i[e]:0,r=isNaN(Number(t))?t.charCodeAt():Number(t),o=a.length>e?a[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(rn){s=1;break}}return s}static deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n("DELETE"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n("CANCEL")}]})}static bytesToSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,t)).toPrecision(3)+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}debug(e,t){this.debugMode=!0,$app.idleTimerDisabled=!0,"function"==typeof e&&(this.debugPrint=e),"function"==typeof t&&(this.debugError=t),this.print("You are running EasyJsBox in debug mode.")}print(e){this.debugMode&&("function"==typeof this.debugPrint?this.debugPrint(e):console.log(e))}error(e){this.debugMode&&("function"==typeof this.debugError?this.debugError(e):console.error(e))}useJsboxNav(){return this.isUseJsboxNav=!0,this}setTitle(e){this.isUseJsboxNav&&($ui.title=e),this.title=e}setNavButtons(e){this.navButtons=e}UIRender(e){try{e.props=Object.assign({title:this.title,navBarHidden:!this.isUseJsboxNav,navButtons:this.navButtons??[],statusBarStyle:0},e.props),e.events||(e.events={});const t=e.events.layoutSubviews,{UIKit:i}=parcelRequire("45Ip7");e.events.layoutSubviews=()=>{$app.notify({name:"interfaceOrientationEvent",object:{statusBarOrientation:i.statusBarOrientation,isHorizontal:i.isHorizontal}}),"function"==typeof t&&t()},$ui.render(e)}catch(e){this.print(e)}}async checkUpdate(){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/src/version.js");if(e.error)throw e.error;const t=srcRes.data.match(/.*VERSION.?\"([0-9\.]+)\"/)[1];if(this.print(`easy-jsbox latest version: ${t}`),a.versionCompare(t,i)>0){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:a}})),parcelRequire.register("czAIJ",(function(e,t){e.exports={VERSION:"1.3.0"}})),parcelRequire.register("7D8Kb",(function(module,exports){var $fYz8N=parcelRequire("fYz8N"),$58e2f5443faff7c0$require$Controller=$fYz8N.Controller,$8aDdQ=parcelRequire("8aDdQ"),$58e2f5443faff7c0$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$58e2f5443faff7c0$require$FileStorage=$8aDdQ.FileStorage,$cgaQ6=parcelRequire("cgaQ6"),$58e2f5443faff7c0$require$Kernel=$cgaQ6.Kernel,$45Ip7=parcelRequire("45Ip7"),$58e2f5443faff7c0$require$UIKit=$45Ip7.UIKit,$12xzj=parcelRequire("12xzj"),$58e2f5443faff7c0$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$58e2f5443faff7c0$require$NavigationBar=$dcStC.NavigationBar,$gMc1q=parcelRequire("gMc1q"),$58e2f5443faff7c0$require$ViewController=$gMc1q.ViewController;class SettingLoadConfigError extends Error{constructor(){super("Call loadConfig() first."),this.name="SettingLoadConfigError"}}class SettingReadonlyError extends Error{constructor(){super("Attempted to assign to readonly property."),this.name="SettingReadonlyError"}}class Setting extends $58e2f5443faff7c0$require$Controller{name;setting={};userData;fileStorage;imagePath;viewController=new $58e2f5443faff7c0$require$ViewController;method={};rowHeight=50;edgeOffset=10;iconSize=30;#t={};#i=!1;#a=!1;#r;constructor(e={}){super(),"function"==typeof e.set&&"function"==typeof e.get?(this.set=e.set,this.get=e.get,this.userData=e.userData):(this.fileStorage=e.fileStorage??new $58e2f5443faff7c0$require$FileStorage,this.dataFile=e.dataFile??"setting.json"),e.structure?this.setStructure(e.structure):this.setStructurePath(e.structurePath??"setting.json"),this.isUseJsboxNav=e.isUseJsboxNav??!1,this.imagePath=(e.name??"default")+".image",this.setName(e.name??$text.uuid),this.loadL10n()}useJsboxNav(){return this.isUseJsboxNav=!0,this}#s(){if(!this.#a)throw new SettingLoadConfigError}loadConfig(){const e=["script","info"],t=this.userData??this.fileStorage.readAsJSON("",this.dataFile,{});return this.setting=function i(a){const r={};for(let s of a)for(let a of s.items)if("child"===a.type){const e=i(a.children);Object.assign(r,e)}else-1===e.indexOf(a.type)?r[a.key]=a.key in t?t[a.key]:a.value:r[a.key]=a.value;return r}(this.structure),this.#a=!0,this}hasSectionTitle(e){return this.#s(),!!e[0].title}loadL10n(){$58e2f5443faff7c0$require$Kernel.l10n("zh-Hans",'\n "OK" = "好";\n "CANCEL" = "取消";\n "CLEAR" = "清除";\n "BACK" = "返回";\n "ERROR" = "发生错误";\n "SUCCESS" = "成功";\n "LOADING" = "加载中";\n "INVALID_VALUE" = "非法参数";\n \n "SETTING" = "设置";\n "GENERAL" = "一般";\n "ADVANCED" = "高级";\n "TIPS" = "小贴士";\n "COLOR" = "颜色";\n "COPY" = "复制";\n "COPIED" = "复制成功";\n \n "JSBOX_ICON" = "JSBox 内置图标";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "图片 / base64";\n\n "PREVIEW" = "预览";\n "SELECT_IMAGE" = "选择图片";\n "CLEAR_IMAGE" = "清除图片";\n "NO_IMAGE" = "无图片";\n \n "ABOUT" = "关于";\n "VERSION" = "Version";\n "AUTHOR" = "作者";\n "AT_BOTTOM" = "已经到底啦~";\n ',!1),$58e2f5443faff7c0$require$Kernel.l10n("en",'\n "OK" = "OK";\n "CANCEL" = "Cancel";\n "CLEAR" = "Clear";\n "BACK" = "Back";\n "ERROR" = "Error";\n "SUCCESS" = "Success";\n "LOADING" = "Loading";\n "INVALID_VALUE" = "Invalid value";\n\n "SETTING" = "Setting";\n "GENERAL" = "General";\n "ADVANCED" = "Advanced";\n "TIPS" = "Tips";\n "COLOR" = "Color";\n "COPY" = "Copy";\n "COPIED" = "Copide";\n\n "JSBOX_ICON" = "JSBox in app icon";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "Image / base64";\n\n "PREVIEW" = "Preview";\n "SELECT_IMAGE" = "Select Image";\n "CLEAR_IMAGE" = "Clear Image";\n "NO_IMAGE" = "No Image";\n\n "ABOUT" = "About";\n "VERSION" = "Version";\n "AUTHOR" = "Author";\n "AT_BOTTOM" = "It\'s the end~";\n ',!1)}setUserData(e){this.userData=e}setStructure(e){return this.structure=e,this}setStructurePath(e){return this.structure||this.setStructure($58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(e)),this}setName(e){return this.name=e,this}setFooter(e){return this.#r=e,this}set footer(e){this.#r=e}get footer(){if(void 0===this.#r){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON("config.json",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#r=e.version&&e.author?{type:"view",props:{height:70},views:[{type:"label",props:{font:$font(14),text:`${$l10n("VERSION")} ${e.version} ♥ ${e.author}`,textColor:$color({light:"#C0C0C0",dark:"#545454"}),align:$align.center},layout:e=>{e.left.right.inset(0),e.top.inset(10)}}]}:{}}return this.#r}setReadonly(){return this.#i=!0,this}set(e,t){if(this.#i)throw new SettingReadonlyError;return this.#s(),this.setting[e]=t,this.fileStorage.write("",this.dataFile,$data({string:JSON.stringify(this.setting)})),this.callEvent("onSet",e,t),!0}get(e,t=null){return this.#s(),Object.prototype.hasOwnProperty.call(this.setting,e)?this.setting[e]:t}getColor(e){return"string"==typeof e?$color(e):$rgba(e.red,e.green,e.blue,e.alpha)}getImageName(e,t=!1){let i=$text.MD5(e)+".jpg";return t&&(i="compress."+i),i}getImage(e,t=!1){try{const i=this.getImageName(e,t);return this.fileStorage.read(this.imagePath,i).image}catch(e){if(e instanceof $58e2f5443faff7c0$require$FileStorageFileNotFoundError)return null;throw e}}getId(e){return`setting-${this.name}-${e}`}#o(e){$(e).bgcolor=$color("systemFill")}#n(e,t=.3){0===t?$(e).bgcolor=$color("clear"):$ui.animate({duration:t,animation:()=>{$(e).bgcolor=$color("clear")}})}#l(e,t,i=!1,a=0){if(t=Object.assign(t,{touchesBegan:()=>{this.#o(e),this.#t[e]=$delay(1,(()=>this.#n(e,0)))},touchesMoved:()=>{this.#t[e]?.cancel(),this.#n(e,0)}}),i){const i=t.tapped;t.tapped=()=>{this.#o(e),setTimeout((()=>this.#n(e)),1e3*a),"function"==typeof i&&i()}}return t}createLineLabel(e,t){return t[1]||(t[1]="#00CC00"),"object"!=typeof t[1]&&(t[1]=[t[1],t[1]]),"object"!=typeof t[0]&&(t[0]=[t[0],t[0]]),{type:"view",views:[{type:"view",props:{bgcolor:$color(t[1][0],t[1][1]),cornerRadius:5,smoothCorners:!0},views:[{type:"image",props:{tintColor:$color("white"),image:$image(t[0][0],t[0][1])},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(20)}}],layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.iconSize),e.left.inset(this.edgeOffset)}},{type:"label",props:{text:e,lines:1,textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.centerY.equalTo(t.super),e.height.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edgeOffset)}}],layout:(e,t)=>{e.height.centerY.equalTo(t.super),e.left.inset(0)}}}createInfo(e,t,i){const a=Array.isArray(i),r=a?i[0]:i,s=a?i[1]:i;return{type:"view",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:"label",props:{text:r,align:$align.right,textColor:$color("darkGray")},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset),e.width.equalTo(180)}},{type:"view",events:{tapped:()=>{$ui.alert({title:t,message:s,actions:[{title:$l10n("COPY"),handler:()=>{$clipboard.text=s,$ui.toast($l10n("COPIED"))}},{title:$l10n("OK")}]})}},layout:(e,t)=>{e.right.inset(0),e.size.equalTo(t.super)}}],layout:$layout.fill}}createSwitch(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"switch",props:{on:this.get(e),onColor:$color("#00CC00")},events:{changed:t=>{try{this.set(e,t.on)}catch(e){throw t.on=!t.on,e}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createString(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"button",props:{symbol:"square.and.pencil",bgcolor:$color("clear"),tintColor:$color("primaryText")},events:{tapped:t=>{const i=$ui.popover({sourceView:t,sourceRect:t.bounds,directions:$popoverDirection.down,size:$size(320,150),views:[{type:"text",props:{id:`${this.name}-string-${e}`,align:$align.left,text:this.get(e)},layout:e=>{e.left.right.inset(10),e.top.inset(20),e.height.equalTo(90)}},{type:"button",props:{symbol:"checkmark",bgcolor:$color("clear"),titleEdgeInsets:10,contentEdgeInsets:0},layout:e=>{e.right.inset(10),e.bottom.inset(25),e.size.equalTo(30)},events:{tapped:()=>{this.set(e,$(`${this.name}-string-${e}`).text),i.dismiss()}}}]})}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(0),e.size.equalTo(50)}}],layout:$layout.fill}}createNumber(e,t,i){const a=this.getId(e),r=`${a}-label`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"label",props:{id:r,align:$align.right,text:this.get(e)},events:{tapped:()=>{$input.text({type:$kbType.decimal,text:this.get(e),placeholder:i,handler:t=>{""!==t&&/^[0-9]+.?[0-9]*$/.test(t)?(this.set(e,t),$(r).text=t):$ui.toast($l10n("INVALID_VALUE"))}})}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(100)}}],layout:$layout.fill}}createStepper(e,t,i,a,r){const s=this.getId(e),o=`${s}-label`;return{type:"view",props:{id:s,selectable:!0},views:[this.createLineLabel(i,t),{type:"label",props:{id:o,text:this.get(e),textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.height.equalTo(t.super),e.right.inset(120)}},{type:"stepper",props:{min:a,max:r,value:this.get(e)},events:{changed:t=>{$(o).text=t.value;try{this.set(e,t.value)}catch(t){throw $(o).text=this.get(e),t}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createScript(key,icon,title,script){const id=this.getId(key),buttonId=`${id}-button`,actionStart=()=>{$(buttonId).alpha=0,$(`${buttonId}-spinner`).alpha=1,this.#o(id)},actionCancel=()=>{$(buttonId).alpha=1,$(`${buttonId}-spinner`).alpha=0,this.#n(id)},actionDone=(e=!0,t=$l10n("ERROR"))=>{$(`${buttonId}-spinner`).alpha=0,this.#n(id);const i=$(buttonId);if(!e)return $ui.toast(t),void(i.alpha=1);i.symbol="checkmark",$ui.animate({duration:.6,animation:()=>{i.alpha=1},completion:()=>{setTimeout((()=>{$ui.animate({duration:.4,animation:()=>{i.alpha=0},completion:()=>{i.symbol="chevron.right",$ui.animate({duration:.4,animation:()=>{i.alpha=1},completion:()=>{i.alpha=1}})}})}),600)}})};return{type:"view",props:{id:id},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"image",props:{id:buttonId,symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(0),e.size.equalTo(15)}},{type:"spinner",props:{id:`${buttonId}-spinner`,loading:!0,alpha:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.left.top.equalTo(t.prev)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:this.#l(id,{tapped:()=>{const animate={actionStart:actionStart,actionCancel:actionCancel,actionDone:actionDone,touchHighlightStart:()=>this.#o(id),touchHighlightEnd:()=>this.#n(id)};"function"==typeof script?script(animate):script.startsWith("this")?eval(`(()=>{return ${script}(animate)})()`):eval(script)}}),layout:$layout.fill}}createTab(key,icon,title,items,values){"string"==typeof items?items=eval(`(()=>{return ${items}()})()`):"function"==typeof items&&(items=items()),"string"==typeof values?values=eval(`(()=>{return ${values}()})()`):"function"==typeof values&&(values=values());const id=this.getId(key),isCustomizeValues=items?.length>0&&values?.length===items?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"tab",props:{items:items??[],index:isCustomizeValues?values.indexOf(this.get(key)):this.get(key),dynamicWidth:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.prev)},events:{changed:e=>{isCustomizeValues?this.set(key,values[e.index]):this.set(key,e.index)}}}],layout:$layout.fill}}createMenu(key,icon,title,items,values){const id=this.getId(key),labelId=`${id}-label`,getItems=()=>{let res;return res="string"==typeof items?eval(`(()=>{return ${items}()})()`):"function"==typeof items?items():items??[],res},getValues=()=>{let res;return res="string"==typeof values?eval(`(()=>{return ${values}()})()`):"function"==typeof values?values():values,res},tmpItems=getItems(),tmpValues=getValues(),isCustomizeValues=tmpItems?.length>0&&tmpValues?.length===tmpItems?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"label",props:{text:isCustomizeValues?tmpItems[tmpValues.indexOf(this.get(key))]:tmpItems[this.get(key)],color:$color("secondaryText"),id:labelId},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:{tapped:()=>{const e=getItems(),t=getValues();$ui.menu({items:e,handler:(e,i)=>{isCustomizeValues?this.set(key,t[i]):this.set(key,i),$(labelId).text=$l10n(e)}})}},layout:$layout.fill}}createColor(e,t,i){const a=this.getId(e),r=`${a}-color`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"view",props:{id:r,bgcolor:this.getColor(this.get(e)),circular:!0,borderWidth:1,borderColor:$color("#e3e3e3")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(20)}},{type:"view",events:{tapped:async()=>{const t=await $picker.color({color:this.getColor(this.get(e))});this.set(e,t.components),$(r).bgcolor=$rgba(t.components.red,t.components.green,t.components.blue,t.components.alpha)}},layout:(e,t)=>{e.right.inset(0),e.height.width.equalTo(t.super.height)}}],layout:(e,t)=>{e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createDate(e,t,i,a=2){const r=this.getId(e),s=e=>{let t="";switch("number"==typeof e&&(e=new Date(e)),a){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"label",props:{id:`${r}-label`,color:$color("secondaryText"),text:this.get(e)?s(this.get(e)):"None"},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],events:{tapped:async()=>{const t=this.get(e),i=await $picker.date({props:{mode:a,date:t||Date.now()}});this.set(e,i.getTime()),$(`${r}-label`).text=s(i)}},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createInput(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"input",props:{align:$align.right,bgcolor:$color("clear"),textColor:$color("secondaryText"),text:this.get(e)},layout:(e,t)=>{e.left.equalTo(t.prev.get("label").right).offset(this.edgeOffset),e.right.inset(this.edgeOffset),e.height.equalTo(t.super)},events:{didBeginEditing:()=>{$app.autoKeyboardEnabled||($app.autoKeyboardEnabled=!0)},returned:e=>{e.blur()},didEndEditing:t=>{this.set(e,t.text),t.blur()}}}],layout:$layout.fill}}createIcon(e,t,i,a="#000000"){const r=this.getId(e),s=`${r}-image`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{cornerRadius:8,bgcolor:"string"==typeof a?$color(a):a,smoothCorners:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}},{type:"image",props:{id:s,image:$image(this.get(e)),icon:$icon(this.get(e).slice(5,this.get(e).indexOf(".")),$color("#ffffff")),tintColor:$color("#ffffff")},layout:(e,t)=>{e.right.equalTo(t.prev).offset(-5),e.centerY.equalTo(t.super),e.size.equalTo($size(20,20))}}],events:{tapped:()=>{$ui.menu({items:[$l10n("JSBOX_ICON"),$l10n("SF_SYMBOLS"),$l10n("IMAGE_BASE64")],handler:async(t,i)=>{if(0===i){const t=await $ui.selectIcon();this.set(e,t),$(s).icon=$icon(t.slice(5,t.indexOf(".")),$color("#ffffff"))}else 1!==i&&2!==i||$input.text({text:"",placeholder:t,handler:t=>{""!==t?(this.set(e,t),1===i?$(s).symbol=t:$(s).image=$image(t)):$ui.toast($l10n("INVALID_VALUE"))}})}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createChild(e,t,i,a){const r=this.getId(e);return{type:"view",layout:$layout.fill,props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"image",props:{symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(15)}}],events:{tapped:()=>{setTimeout((()=>{if(this.events?.onChildPush)this.callEvent("onChildPush",this.getListView(a,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(a,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(a,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(a)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const a=this.getId(e),r=`${a}-image`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{id:r,image:this.getImage(e,!0)??$image("questionmark.square.dashed")},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}}],events:{tapped:()=>{this.#o(a),$ui.menu({items:[$l10n("PREVIEW"),$l10n("SELECT_IMAGE"),$l10n("CLEAR_IMAGE")],handler:(t,i)=>{if(0===i){const t=this.getImage(e);t?$quicklook.open({image:t}):$ui.toast($l10n("NO_IMAGE"))}else 1===i?$photo.pick({format:"data"}).then((t=>{if($ui.toast($l10n("LOADING")),!t.status||!t.data)return void("canceled"!==t?.error?.description&&$ui.toast($l10n("ERROR")));const i=$58e2f5443faff7c0$require$Kernel.compressImage(t.data.image);this.fileStorage.write(this.imagePath,this.getImageName(e,!0),i.jpg(.8)),this.fileStorage.write(this.imagePath,this.getImageName(e),t.data),$(r).image=i,$ui.success($l10n("SUCCESS"))})):2===i&&(this.fileStorage.delete(this.imagePath,this.getImageName(e,!0)),this.fileStorage.delete(this.imagePath,this.getImageName(e)),$(r).image=$image("questionmark.square.dashed"),$ui.success($l10n("SUCCESS")))},finished:()=>{this.#n(a)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#h(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let a=null;switch(t.icon||(t.icon=["square.grid.2x2.fill","#00CC00"]),"object"==typeof t.items&&(t.items=t.items.map((e=>$l10n(e)))),t.title=$l10n(t.title),t.type){case"switch":a=this.createSwitch(t.key,t.icon,t.title);break;case"stepper":a=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case"string":a=this.createString(t.key,t.icon,t.title);break;case"number":a=this.createNumber(t.key,t.icon,t.title);break;case"info":a=this.createInfo(t.icon,t.title,i);break;case"script":a=this.createScript(t.key,t.icon,t.title,i);break;case"tab":a=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case"menu":a=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case"color":a=this.createColor(t.key,t.icon,t.title);break;case"date":a=this.createDate(t.key,t.icon,t.title,t.mode);break;case"input":a=this.createInput(t.key,t.icon,t.title);break;case"icon":a=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case"child":a=this.createChild(t.key,t.icon,t.title,t.children);break;case"image":a=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(a)}t.push({title:$l10n(i.title??""),rows:e})}return t}getListView(e,t=this.footer){return{type:"list",props:{id:this.name,style:2,separatorInset:$insets(0,this.iconSize+2*this.edgeOffset,0,this.edgeOffset),bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,footer:t,data:this.#h(e??this.structure)},layout:$layout.fill,events:{rowHeight:(e,t)=>(e.object(t)?.props?.info??{}).rowHeight??this.rowHeight}}}getPageView(){const e=new $58e2f5443faff7c0$require$NavigationView;return e.setView(this.getListView(this.structure)).navigationBarTitle($l10n("SETTING")),this.hasSectionTitle(this.structure)&&e.navigationBar.setContentViewHeightOffset(-10),e.getPage()}}module.exports={Setting:Setting}})),parcelRequire.register("fYz8N",(function(e,t){e.exports={Controller:class{events={};setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}callEvent(e,...t){"function"==typeof this.events[e]&&this.events[e](...t)}}}})),parcelRequire.register("8aDdQ",(function(e,t){class i extends Error{constructor(e){super(`Parameter [${e}] is required.`),this.name="FileStorageParameterError"}}class a extends Error{constructor(e){super(`File not found: ${e}`),this.name="FileStorageFileNotFoundError"}}class r{basePath;constructor({basePath:e="storage"}={}){this.basePath=e,this.#c(this.basePath)}#c(e){$file.isDirectory(e)||$file.mkdir(e)}#u(e="",t){return e=`${this.basePath}/${e.trim("/")}`.trim("/"),this.#c(e),e=`${e}/${t}`}write(e="",t,a){if(!t)throw new i("fileName");if(!a)throw new i("data");return $file.write({data:a,path:this.#u(e,t)})}writeSync(e="",t,i){return new Promise(((a,r)=>{try{const s=this.write(e,t,i);s?a(s):r(s)}catch(e){r(e)}}))}exists(e="",t){if(!t)throw new i("fileName");return e=this.#u(e,t),!!$file.exists(e)&&e}read(e="",t){if(!t)throw new i("fileName");if(e=this.#u(e,t),!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e="",t){return new Promise(((i,a)=>{try{const r=this.read(e,t);r?i(r):a()}catch(e){a(e)}}))}readAsJSON(e="",t,i=null){try{const i=this.read(e,t)?.string;return JSON.parse(i)}catch(e){return i}}static readFromRoot(e){if(!e)throw new i("path");if(!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=""){return new Promise(((t,i)=>{try{const a=r.readFromRoot(e);a?t(a):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e="",t=null){try{const t=r.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e="",t=""){return $file.delete(this.#u(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:a,FileStorage:r}})),parcelRequire.register("12xzj",(function(e,t){var i=parcelRequire("liCrE"),a=i.View,r=i.PageView,s=parcelRequire("6Xrbz").ValidationError,o=parcelRequire("45Ip7").UIKit,n=parcelRequire("dcStC"),l=n.NavigationBar,h=n.NavigationBarController,c=parcelRequire("gAYmG").NavigationBarItems;class u extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new l;navigationBarItems=new c;constructor(){this.navigationBar.navigationBarItems=this.navigationBarItems,this.navigationController.navigationBar=this.navigationBar}navigationBarTitle(e){return this.navigationBar.setTitle(e),this}setView(e){if("object"!=typeof e)throw new u("view","object");return this.view=a.create(e),this}#p(){if(!(this.view instanceof a))throw new u("view","View");let e=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(e+=this.navigationBarItems.titleView.topOffset,e+=this.navigationBarItems.titleView.height,e+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?e+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===l.largeTitleDisplayModeNever?e+=this.navigationBar.navigationBarNormalHeight:e+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:e+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(t,i)=>{t.top.equalTo(e),t.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:e}},this.view.props.footer=Object.assign({props:{}},this.view.props.footer??{}),this.view.props.footer.props.height=(this.navigationBarItems.fixedFooterView?.height??0)+(this.view.props.footer.props?.height??0),-1===o.scrollViewList.indexOf(this.view.type))this.view.layout=(e,t)=>{e.left.right.equalTo(t.super.safeArea),e.bottom.equalTo(t.super);let i=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==l.largeTitleDisplayModeNever&&(i+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(i+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),o.isHorizontal&&!o.isLargeScreen||!this.navigationBar.addStatusBarHeight||(i+=o.statusBarHeight),e.top.equalTo(this.navigationBar.navigationBarNormalHeight+i)};else{const e=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const t=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(t.top+this.navigationBar.navigationBarNormalHeight+e,t.left,t.bottom+(this.navigationBarItems.fixedFooterView?.height??0),t.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+e,0,this.navigationBarItems.fixedFooterView?.height??0,0);this.view.layout=(e,t)=>{this.view.props.stickyHeader?e.top.equalTo(t.super.safeArea).offset(this.navigationBar.navigationBarNormalHeight):e.top.equalTo(t.super),e.left.right.equalTo(t.super.safeArea),e.bottom.equalTo(t.super)},this.view.assignEvent("didScroll",(e=>{let t=e.contentOffset.y;o.isHorizontal&&!o.isLargeScreen||!this.navigationBar.addStatusBarHeight||this.view.props.stickyHeader||(t+=o.statusBarHeight),this.navigationController.didScroll(t)})).assignEvent("didEndDragging",((e,t)=>{let i=e.contentOffset.y,a=0;o.isHorizontal&&!o.isLargeScreen||!this.navigationBar.addStatusBarHeight||this.view.props.stickyHeader||(i+=o.statusBarHeight,a=o.statusBarHeight),this.navigationController.didEndDragging(i,t,((...t)=>e.scrollToOffset(...t)),a)})).assignEvent("didEndDecelerating",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#g(){if(this.navigationBar.prefersLargeTitles){this.#p();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=a.create({views:[this.navigationBar.backgroundColor?{type:"view",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+"-title-view-background"},layout:$layout.fill}:o.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),o.separatorLine({id:this.navigationBar.id+"-title-view-underline",alpha:t}),this.navigationBarItems.titleView.definition],layout:(e,t)=>{e.top.equalTo(t.prev.bottom),e.width.equalTo(t.super),e.height.equalTo(this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset)}})}this.page=r.createByViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=r.createByViews([this.view]);return this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",o.defaultBackgroundColor(this.view.type)),this}getPage(){return this.page||this.#g(),this.page}}}})),parcelRequire.register("liCrE",(function(e,t){class i{id=$text.uuid;type;props;views;events;layout;constructor({type:e="view",props:t={},views:i=[],events:a={},layout:r=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=a,this.layout=r,this.props.id?this.id=this.props.id:this.props.id=this.id}static create(e){return new this(e)}static createByViews(e){return new this({views:e})}setProps(e){return Object.keys(e).forEach((t=>this.setProp(t,e[t]))),this}setProp(e,t){return"id"===e&&(this.id=t),this.props[e]=t,this}setViews(e){return this.views=e,this}setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}eventMiddleware(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&t(i,...e)},this}assignEvent(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&i(...e),t(...e)},this}setLayout(e){return this.layout=e,this}getView(){return this}get definition(){return this.getView()}}e.exports={View:i,PageView:class extends i{constructor(e={}){super(e),this.activeStatus=!0}show(){$(this.props.id).hidden=!1,this.activeStatus=!0}hide(){$(this.props.id).hidden=!0,this.activeStatus=!1}setHorizontalSafeArea(e){return this.horizontalSafeArea=e,this}#d(e,t){e.top.bottom.equalTo(t.super),this.horizontalSafeArea?e.left.right.equalTo(t.super.safeArea):e.left.right.equalTo(t.super)}getView(){return this.layout=this.#d,this.props.clipsToBounds=!0,this.props.hidden=!this.activeStatus,super.getView()}}}})),parcelRequire.register("6Xrbz",(function(e,t){class i extends Error{constructor(e,t){super(`The type of the parameter '${e}' must be '${t}'`),this.name="ValidationError"}}e.exports={ValidationError:i}})),parcelRequire.register("dcStC",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("fYz8N").Controller,r=parcelRequire("45Ip7").UIKit,s=parcelRequire("gAYmG").BarButtonItem;class o extends i{static largeTitleDisplayModeAutomatic=0;static largeTitleDisplayModeAlways=1;static largeTitleDisplayModeNever=2;static pageSheetNavigationBarHeight=56;navigationBarItems;title="";prefersLargeTitles=!0;largeTitleDisplayMode=o.largeTitleDisplayModeAutomatic;largeTitleFontSize=34;largeTitleFontFamily="bold";largeTitleFontHeight=$text.sizeThatFits({text:"A",width:100,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize)}).height;navigationBarTitleFontSize=17;addStatusBarHeight=!0;contentViewHeightOffset=10;navigationBarNormalHeight=r.NavigationBarNormalHeight;navigationBarLargeTitleHeight=r.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.addStatusBarHeight=!1,this}withStatusBarHeight(){return this.addStatusBarHeight=!0,this}withoutStatusBarHeight(){return this.addStatusBarHeight=!1,this}setLargeTitleDisplayMode(e){return this.largeTitleDisplayMode=e,this}setBackgroundColor(e){return this.backgroundColor=e,this}setTitle(e){return this.title=e,this}setPrefersLargeTitles(e){return this.prefersLargeTitles=e,this}setContentViewHeightOffset(e){return this.contentViewHeightOffset=e,this}getLargeTitleView(){return this.prefersLargeTitles&&this.largeTitleDisplayMode!==o.largeTitleDisplayModeNever?{type:"label",props:{id:this.id+"-large-title",text:this.title,textColor:r.textColor,align:$align.left,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize),line:1},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.height.equalTo(this.largeTitleFontHeight),e.top.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)}}:{props:{id:this.id+"-large-title"}}}getNavigationBarView(){const e=(e,t)=>e.length>0?{type:"view",views:[{type:"view",views:e,layout:$layout.fill}],layout:(i,a)=>{i.top.equalTo(a.super.safeAreaTop),i.bottom.equalTo(a.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===r.align.left?i.left.equalTo(a.super.safeArea):i.right.equalTo(a.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,r.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,r.align.left),a=this.prefersLargeTitles,n=!this.prefersLargeTitles||this.largeTitleDisplayMode===o.largeTitleDisplayModeNever;return{type:"view",props:{id:this.id+"-navigation",bgcolor:$color("clear")},layout:(e,t)=>{e.left.top.right.inset(0),e.bottom.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)},views:[this.backgroundColor?{type:"view",props:{hidden:a,bgcolor:this.backgroundColor,id:this.id+"-background"},layout:$layout.fill}:r.blurBox({hidden:a,id:this.id+"-background"}),r.separatorLine({id:this.id+"-underline",alpha:a?0:1}),{type:"view",props:{alpha:0,bgcolor:$color("clear"),id:this.id+"-large-title-mask"},events:{ready:e=>{e.bgcolor=$(this.id+"-large-title")?.prev.bgcolor}},layout:$layout.fill},{type:"label",props:{id:this.id+"-small-title",alpha:n?1:0,text:this.title,font:$font(this.largeTitleFontFamily,this.navigationBarTitleFontSize),align:$align.center,bgcolor:$color("clear"),textColor:r.textColor},layout:(e,t)=>{e.left.right.inset(0),e.height.equalTo(20),e.centerY.equalTo(t.super.safeArea)}}].concat(t,i)}}}class n extends a{static largeTitleViewSmallMode=0;static largeTitleViewLargeMode=1;navigationBar;updateSelector(){this.selector={navigation:$(this.navigationBar.id+"-navigation"),largeTitleView:$(this.navigationBar.id+"-large-title"),smallTitleView:$(this.navigationBar.id+"-small-title"),underlineView:this.navigationBar.navigationBarItems.isPinTitleView?$(this.navigationBar.id+"-title-view-underline"):$(this.navigationBar.id+"-underline"),largeTitleMaskView:$(this.navigationBar.id+"-large-title-mask"),backgroundView:$(this.navigationBar.id+"-background"),titleViewBackgroundView:$(this.navigationBar.id+"-title-view-background")}}toNormal(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!1,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=1,this.selector.smallTitleView.alpha=1,this.selector.largeTitleView.alpha=0}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeNever)}toLargeTitle(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!0,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=0,this.selector.smallTitleView.alpha=0,this.selector.largeTitleView.alpha=1}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeAlways)}#$(e){const t=e===n.largeTitleViewSmallMode;$ui.animate({duration:.2,animation:()=>{this.selector.smallTitleView.alpha=t?1:0,this.selector.largeTitleView.alpha=t?0:1}})}#f(e){if(this.selector.largeTitleView.updateLayout(((t,i)=>{this.navigationBar.navigationBarNormalHeight-e>0?t.top.equalTo(i.super.safeAreaTop).offset(this.navigationBar.navigationBarNormalHeight-e):t.top.equalTo(i.super.safeAreaTop).offset(0)})),e>0)e>=this.navigationBar.navigationBarNormalHeight?this.#$(n.largeTitleViewSmallMode):this.#$(n.largeTitleViewLargeMode);else{this.#$(n.largeTitleViewLargeMode);let t=this.navigationBar.largeTitleFontSize-.04*e;t>40&&(t=40),this.selector.largeTitleView.font=$font(this.navigationBar.largeTitleFontFamily,t)}}#b(e){const t=this.navigationBar.largeTitleDisplayMode===o.largeTitleDisplayModeNever?5:this.navigationBar.navigationBarNormalHeight,i=void 0!==this.selector.titleViewBackgroundView;e>t?(this.selector.backgroundView.hidden=!1,$ui.animate({duration:.2,animation:()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1}})):(this.selector.largeTitleMaskView.alpha=e>0?1:0,this.selector.underlineView.alpha=0,i&&(this.selector.titleViewBackgroundView.alpha=0),this.selector.backgroundView.hidden=!0)}didScroll(e){if(!this.navigationBar.prefersLargeTitles)return;const t=this.navigationBar.largeTitleDisplayMode;if(t!==o.largeTitleDisplayModeAlways)if(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic){if(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)){(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0)}this.#f(e),this.#b(e)}else t===o.largeTitleDisplayModeNever&&this.#b(e)}didEndDragging(e,t,i,a){if(!this.navigationBar.prefersLargeTitles)return;const r=this.navigationBar.largeTitleDisplayMode;if(r!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),r===o.largeTitleDisplayModeAutomatic)){let r=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,a),r=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=r),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+r-a:r-a))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register("gAYmG",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("45Ip7").UIKit;class r extends i{static size=$size(38,38);static iconSize=$size(23,23);static edges=15;title="";align=a.align.right;setTitle(e=""){return this.title=e,this}setSymbol(e){return this.symbol=e,this}setMenu(e){return this.menu=e,this}setAlign(e){return this.align=e,this}#v(){$(this.id).hidden=!0,$("spinner-"+this.id).hidden=!1}#w(){const e=$(`icon-button-${this.id}`),t=$(`icon-checkmark-${this.id}`);e.alpha=0,$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0,$ui.animate({duration:.6,animation:()=>{t.alpha=1},completion:()=>{$delay(.3,(()=>$ui.animate({duration:.6,animation:()=>{t.alpha=0},completion:()=>{$ui.animate({duration:.4,animation:()=>{e.alpha=1},completion:()=>{e.alpha=1}})}})))}})}#m(){$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#v(),done:()=>this.#w(),cancel:()=>this.#m()},t)},{type:"view",views:[{type:"button",props:Object.assign({id:this.id,bgcolor:$color("clear"),tintColor:a.textColor,titleColor:a.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},this.menu?{menu:this.menu}:{},this.title?.length>0?{title:this.title}:{},this.props),views:[{type:"image",props:Object.assign({id:`icon-button-${this.id}`,hidden:void 0===this.symbol,tintColor:a.textColor},void 0===this.symbol?{}:"string"==typeof this.symbol?{symbol:this.symbol}:{data:this.symbol.png}),layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}},{type:"image",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:a.textColor,symbol:"checkmark"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}}],events:this.events,layout:$layout.fill},{type:"spinner",props:{id:"spinner-"+this.id,loading:!0,hidden:!0},layout:$layout.fill}],layout:(e,t)=>{if(e.size.equalTo(r.size),e.centerY.equalTo(t.super),t.prev&&"label"!==t.prev.id&&void 0!==t.prev.id)this.align===a.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=this.symbol?r.edges/2:r.edges;this.align===a.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=a.align.right}){const l=new r;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{height=20;topOffset=15;bottomOffset=10;controller={};setController(e){return this.controller=e,this}},BarButtonItem:r,NavigationBarItems:class{rightButtons=[];leftButtons=[];hasbutton=!1;isPinTitleView=!1;setTitleView(e){return this.titleView=e,this}pinTitleView(){return this.isPinTitleView=!0,this}setFixedFooterView(e){return this.fixedFooterView=e,this}setRightButtons(e){return e.forEach((e=>this.addRightButton(e))),this.hasbutton||(this.hasbutton=!0),this}setLeftButtons(e){return e.forEach((e=>this.addLeftButton(e))),this.hasbutton||(this.hasbutton=!0),this}addRightButton({symbol:e,title:t,tapped:i,menu:s,events:o}){return this.rightButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}){return this.leftButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.left}).definition),this.hasbutton||(this.hasbutton=!0),this}addPopButton(e,t){return e||(e=$l10n("BACK")),this.popButtonView=t??{type:"button",props:{bgcolor:$color("clear"),symbol:"chevron.left",tintColor:a.linkColor,title:` ${e}`,titleColor:a.linkColor,font:$font("bold",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(r.edges),e.centerY.equalTo(t.super.safeArea)},events:{tapped:()=>{$ui.pop()}}},this}removePopButton(){return this.popButtonView=void 0,this}}}})),parcelRequire.register("gMc1q",(function(e,t){var i=parcelRequire("fYz8N").Controller;e.exports={ViewController:class extends i{#y=[];#B(e){this.callEvent("onPop",e),this.#y.pop()}push(e){const t=this.#y[this.#y.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#y.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#B(e)}},views:[e.getPage().definition],layout:$layout.fill})}}}}));var $czAIJ=parcelRequire("czAIJ"),$bb0fea222fc5aea5$require$VERSION=$czAIJ.VERSION,$fYz8N=parcelRequire("fYz8N"),$bb0fea222fc5aea5$require$Controller=$fYz8N.Controller,$272f042430a952c6$exports={},$45Ip7=parcelRequire("45Ip7"),$272f042430a952c6$require$UIKit=$45Ip7.UIKit,$7fbcb0854551b1d9$exports={},$6Xrbz=parcelRequire("6Xrbz"),$7fbcb0854551b1d9$require$ValidationError=$6Xrbz.ValidationError,$liCrE=parcelRequire("liCrE"),$7fbcb0854551b1d9$require$View=$liCrE.View,$45Ip7=parcelRequire("45Ip7"),$7fbcb0854551b1d9$require$UIKit=$45Ip7.UIKit,$12xzj=parcelRequire("12xzj"),$7fbcb0854551b1d9$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$7fbcb0854551b1d9$require$NavigationBar=$dcStC.NavigationBar,$gAYmG=parcelRequire("gAYmG"),$7fbcb0854551b1d9$require$BarButtonItem=$gAYmG.BarButtonItem;class $7fbcb0854551b1d9$var$SheetAddNavBarError extends Error{constructor(){super("Please call setView(view) first."),this.name="SheetAddNavBarError"}}class $7fbcb0854551b1d9$var$SheetViewTypeError extends $7fbcb0854551b1d9$require$ValidationError{constructor(e,t){super(e,t),this.name="SheetViewTypeError"}}class $7fbcb0854551b1d9$var$Sheet extends $7fbcb0854551b1d9$require$View{#T=()=>{};#q=()=>{};navigationView;init(){const{width:e,height:t}=$device.info.screen,i=$objc("UIView").invoke("initWithFrame",$rect(0,0,e,t)),a=$objc("UIViewController").invoke("alloc.init"),r=a.$view();return r.$setBackgroundColor($color("primarySurface")),r.$addSubview(i),a.$setModalPresentationStyle(1),this.#T=()=>{r.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke("presentModalViewController:animated",a,!0)},this.#q=()=>a.invoke("dismissModalViewControllerAnimated",!0),this}setView(e={}){if("object"!=typeof e)throw new $7fbcb0854551b1d9$var$SheetViewTypeError("view","object");return this.view=e,this}addNavBar({title:e,popButton:t={title:"Done"},rightButtons:i=[]}){if(void 0===this.view)throw new $7fbcb0854551b1d9$var$SheetAddNavBarError;this.navigationView=new $7fbcb0854551b1d9$require$NavigationView;const a=new $7fbcb0854551b1d9$require$BarButtonItem;a.setEvents(Object.assign({tapped:()=>{this.dismiss(),"function"==typeof t.tapped&&t.tapped()}},t.events)).setAlign($7fbcb0854551b1d9$require$UIKit.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const r=a.definition.views[0];return r.layout=(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.centerY.equalTo(t.super.safeArea)},this.navigationView.navigationBar.setLargeTitleDisplayMode($7fbcb0854551b1d9$require$NavigationBar.largeTitleDisplayModeNever).pageSheetMode(),this.navigationView.navigationBarItems.addPopButton("",r).setRightButtons(i),this.navigationView.setView(this.view).navigationBarTitle(e),this.view.props?.bgcolor&&this.navigationView?.getPage().setProp("bgcolor",this.view.props?.bgcolor),this}present(){this.#T()}dismiss(){this.#q()}}$7fbcb0854551b1d9$exports={Sheet:$7fbcb0854551b1d9$var$Sheet};var $272f042430a952c6$require$Sheet=$7fbcb0854551b1d9$exports.Sheet,$cgaQ6=parcelRequire("cgaQ6"),$272f042430a952c6$require$Kernel=$cgaQ6.Kernel,$12xzj=parcelRequire("12xzj"),$272f042430a952c6$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$272f042430a952c6$require$NavigationBar=$dcStC.NavigationBar;class $272f042430a952c6$var$FileManager{viewController;constructor(){this.listId="file-manager-list",this.edges=10,this.iconSize=25,this.loadL10n()}loadL10n(){$272f042430a952c6$require$Kernel.l10n("zh-Hans",'\n "CONFIRM_DELETE_MSG" = "确认要删除吗";\n "DELETE" = "删除";\n "CANCEL" = "取消";\n "CLOSE" = "关闭";\n "SHARE" = "分享";\n "SAVE" = "保存";\n "SAVE_SUCCESS" = "保存成功";\n '),$272f042430a952c6$require$Kernel.l10n("en",'\n "CONFIRM_DELETE_MSG" = "Are you sure you want to delete";\n "DELETE" = "Delete";\n "CANCEL" = "Cancel";\n "CLOSE" = "Close";\n "SHARE" = "Share";\n "SAVE" = "Save";\n "SAVE_SUCCESS" = "Save Success";\n ')}setViewController(e){this.viewController=e}get menu(){return{items:[{title:$l10n("SHARE"),symbol:"square.and.arrow.up",handler:async(e,t)=>{const i=e.object(t).info.info;$share.sheet([$file.absolutePath(i.path)])}}]}}delete(e){$file.delete(e.path)}edit(e){const t=$file.read(e.path);if(t.image)$quicklook.open({image:t.image});else{const i=new $272f042430a952c6$require$Sheet,a=$text.uuid;i.setView({type:"code",layout:$layout.fill,props:{id:a,lineNumbers:!0,theme:$device.isDarkMode?"atom-one-dark":"atom-one-light",text:t.string,insets:$insets(15,15,15,15)}}).addNavBar({title:e.file,popButton:{title:$l10n("CLOSE")},rightButtons:[{title:$l10n("SAVE"),tapped:()=>{$file.write({data:$data({string:$(a).text}),path:e.path}),$ui.success($l10n("SAVE_SUCCESS"))}}]}),i.init().present()}}getFiles(e=""){return $file.list(e).map((t=>{const i=e+"/"+t,a=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:a}},icon:{symbol:a?"folder.fill":"doc"},name:{text:t}}})).sort(((e,t)=>e.info.info.isDirectory!==t.info.info.isDirectory?e.info.info.isDirectory?-1:1:e.info.info.isDirectory===t.info.info.isDirectory?e.info.info.file.localeCompare(t.info.info.file):void 0))}get listTemplate(){return{props:{bgcolor:$color("clear")},views:[{props:{id:"info"}},{type:"image",props:{id:"icon"},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(this.edges),e.size.equalTo(this.iconSize)}},{type:"label",props:{id:"name",lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edges)}},{type:"label",props:{id:"size",color:$color("secondaryText"),lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edges)},events:{ready:e=>{const t=e.super.get("info").info;t.isDirectory||(e.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(t.path).info.size))}}}]}}#S(e,t){if(this.viewController){const i=new $272f042430a952c6$require$NavigationView;i.setView(t).navigationBarTitle(e),i.navigationBar.setLargeTitleDisplayMode($272f042430a952c6$require$NavigationBar.largeTitleDisplayModeNever),this.viewController.push(i)}else $272f042430a952c6$require$UIKit.push({title:e,views:[t]})}getListView(e=""){return{type:"list",props:{id:this.listId,menu:this.menu,info:{basePath:e},bgcolor:$272f042430a952c6$require$UIKit.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.getFiles(e),template:this.listTemplate,actions:[{title:" "+$l10n("DELETE")+" ",color:$color("red"),handler:(e,t)=>{const i=e.object(t).info.info;$272f042430a952c6$require$Kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG")+' "'+i.file+'" ?',(()=>{this.delete(i),e.delete(t)}))}}]},layout:$layout.fill,events:{pulled:e=>{$delay(.6,(()=>{$(this.listId).data=this.getFiles($(this.listId).info.basePath),e.endRefreshing()}))},didSelect:(e,t,i)=>{const a=i.info.info;a.isDirectory?this.#S(a.file,this.getListView(a.path)):this.edit(a)}}}}push(e=""){const t=e.substring(e.lastIndexOf("/"));this.#S(t,this.getListView(e))}}$272f042430a952c6$exports={FileManager:$272f042430a952c6$var$FileManager};var $bb0fea222fc5aea5$require$FileManager=$272f042430a952c6$exports.FileManager,$8aDdQ=parcelRequire("8aDdQ"),$bb0fea222fc5aea5$require$FileStorageParameterError=$8aDdQ.FileStorageParameterError,$bb0fea222fc5aea5$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$bb0fea222fc5aea5$require$FileStorage=$8aDdQ.FileStorage,$4c192cc93140b629$exports={},$liCrE=parcelRequire("liCrE"),$4c192cc93140b629$require$View=$liCrE.View,$45Ip7=parcelRequire("45Ip7"),$4c192cc93140b629$require$UIKit=$45Ip7.UIKit;class $4c192cc93140b629$var$FixedFooterView extends $4c192cc93140b629$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",$4c192cc93140b629$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height)},this.views=[$4c192cc93140b629$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}$4c192cc93140b629$exports={FixedFooterView:$4c192cc93140b629$var$FixedFooterView};var $bb0fea222fc5aea5$require$FixedFooterView=$4c192cc93140b629$exports.FixedFooterView,$cgaQ6=parcelRequire("cgaQ6"),$bb0fea222fc5aea5$require$Kernel=$cgaQ6.Kernel,$50aa538fe0dbd3b0$exports={},$liCrE=parcelRequire("liCrE"),$50aa538fe0dbd3b0$require$View=$liCrE.View;class $50aa538fe0dbd3b0$var$Matrix extends $50aa538fe0dbd3b0$require$View{titleStyle={font:$font("bold",21),height:30};#V;#C;templateIdByIndex(e){return void 0===this.props.template.views[e]?.props?.id&&(void 0===this.props.template.views[e].props&&(this.props.template.views[e].props={}),this.props.template.views[e].props.id=$text.uuid),this.props.template.views[e].props.id}get templateHiddenStatus(){if(!this.#C){this.#C={};for(let e=0;e(e.items=e.items.map((e=>(Object.keys(e).forEach((t=>{e[t].hidden=this.templateHiddenStatus[t]??!1})),Object.keys(this.templateHiddenStatus).forEach((t=>{e[t]||(e[t]={}),e[t].hidden=this.templateHiddenStatus[t]})),e.__templateProps={hidden:!1},e.__title={hidden:!0},e))),e.title&&e.items.unshift(this.#I(e.title)),e)))}rebuildTemplate(){let e={};void 0!==this.props.template.props&&(e=Object.assign(this.props.template.props,{id:"__templateProps",hidden:!1})),this.props.template.props={};const t=[{type:"view",props:e,layout:$layout.fill},{type:"label",props:{id:"__title",hidden:!0,font:this.titleStyle.font},layout:(e,t)=>{e.top.inset(-this.titleStyle.height/4*3),e.height.equalTo(this.titleStyle.height),e.width.equalTo(t.super.safeArea)}}].concat(this.props.template.views);this.props.template.views=t}insert(e,t=!0){return e.indexPath=this.indexPath(e.indexPath,t),$(this.id).insert(e)}delete(e,t=!0){return e=this.indexPath(e,t),$(this.id).delete(e)}object(e,t=!0){return e=this.indexPath(e,t),$(this.id).object(e)}cell(e,t=!0){return e=this.indexPath(e,t),$(this.id).cell(e)}indexPath(e,t){let i=t?0:1;return"number"==typeof e&&(e=$indexPath(0,e)),e=$indexPath(e.section,e.row+i)}update(e){this.props.data=this.rebuildData(e),$(this.id).data=this.props.data}getView(){return this.props.data=this.rebuildData(this.props.data),this.rebuildTemplate(),this.setEvent("itemSize",((e,t)=>{const i=e.object(t)?.__title?.info;if(i?.title)return $size(Math.max($device.info.screen.width,$device.info.screen.height),0);const a=this.props.columns??2,r=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-r*(a+1))/a,o=this.props.itemHeight??this.props.itemSize?.height??100;return $size(s,o)})),this}}$50aa538fe0dbd3b0$exports={Matrix:$50aa538fe0dbd3b0$var$Matrix};var $bb0fea222fc5aea5$require$Matrix=$50aa538fe0dbd3b0$exports.Matrix,$619319e3f3656d3f$exports={};class $619319e3f3656d3f$var$Request{static Method={get:"GET",post:"POST"};#E;#x=!1;#N=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#E||(this.#E=$text.MD5(this.baseUrl)),this.#E+$text.MD5(e)}setCache(e,t){$cache.set(e,t)}getCache(e,t=null){return $cache.get(e)??t}removeCache(e){$cache.remove(e)}useCache(){return this.#x=!0,this}ignoreCacheExp(){this.#N=!0}async request(e,t,i={},a={},r=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#x&&t===$619319e3f3656d3f$var$Request.Method.get;if(n){o=this.getCacheKey(e);const t=this.getCache(o);if(t&&(this.#N||t.exp>Date.now()))return this.isLogRequest&&this.kernel.print("get data from cache: "+s),t.data}try{this.isLogRequest&&this.kernel.print(`sending request [${t}]: ${s}`);const e=await $http.request({header:Object.assign({"Content-Type":"application/json"},a),url:s,method:t,body:i,timeout:this.timeout});if(e?.response?.statusCode>=400){let t=e.data;throw"object"==typeof t&&(t=JSON.stringify(t)),new Error("http error: ["+e.response.statusCode+"] "+t)}return n&&this.setCache(o,{exp:Date.now()+r,data:e.data}),e.data}catch(e){throw e.code&&(e=new Error("network error: ["+e.code+"] "+e.localizedDescription)),e}}}$619319e3f3656d3f$exports={Request:$619319e3f3656d3f$var$Request};var $bb0fea222fc5aea5$require$Request=$619319e3f3656d3f$exports.Request,$7D8Kb=parcelRequire("7D8Kb"),$bb0fea222fc5aea5$require$Setting=$7D8Kb.Setting,$bb0fea222fc5aea5$require$Sheet=$7fbcb0854551b1d9$exports.Sheet,$7dfcabb1e936a92c$exports={},$liCrE=parcelRequire("liCrE"),$7dfcabb1e936a92c$require$View=$liCrE.View,$7dfcabb1e936a92c$require$PageView=$liCrE.PageView,$fYz8N=parcelRequire("fYz8N"),$7dfcabb1e936a92c$require$Controller=$fYz8N.Controller,$45Ip7=parcelRequire("45Ip7"),$7dfcabb1e936a92c$require$UIKit=$45Ip7.UIKit;class $7dfcabb1e936a92c$var$TabBarCellView extends $7dfcabb1e936a92c$require$View{constructor(e={}){super(e),this.setIcon(e.icon),this.setTitle(e.title),void 0!==e.activeStatus&&(this.activeStatus=e.activeStatus)}setIcon(e){return this.icon=e instanceof Array?e:[e,e],this}setTitle(e){return this.title=e,this}active(){$(`${this.props.id}-icon`).image=$image(this.icon[1]),$(`${this.props.id}-icon`).tintColor=$color("systemLink"),$(`${this.props.id}-title`).textColor=$color("systemLink"),this.activeStatus=!0}inactive(){$(`${this.props.id}-icon`).image=$image(this.icon[0]),$(`${this.props.id}-icon`).tintColor=$color("lightGray"),$(`${this.props.id}-title`).textColor=$color("lightGray"),this.activeStatus=!1}getView(){return this.views=[{type:"image",props:{id:`${this.props.id}-icon`,image:$image(this.activeStatus?this.icon[1]:this.icon[0]),bgcolor:$color("clear"),tintColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.super);const i=$7dfcabb1e936a92c$var$TabBarController.tabBarHeight/2;e.size.equalTo(i),e.top.inset(($7dfcabb1e936a92c$var$TabBarController.tabBarHeight-i-13)/2)}},{type:"label",props:{id:`${this.props.id}-title`,text:this.title,font:$font(10),textColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.prev),e.top.equalTo(t.prev.bottom).offset(3)}}],this}}class $7dfcabb1e936a92c$var$TabBarHeaderView extends $7dfcabb1e936a92c$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",this.props.bgcolor??$7dfcabb1e936a92c$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight)},this.views=[$7dfcabb1e936a92c$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}class $7dfcabb1e936a92c$var$TabBarController extends $7dfcabb1e936a92c$require$Controller{static tabBarHeight=50;#k={};#L={};#O;#A;get selected(){return this.#A}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#O?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#A&&(this.#A=e),this.#k[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createByViews(t),this.#A!==e&&(this.#k[e].activeStatus=!1),this}switchPageTo(e){if(this.#k[e]){if(this.#A===e)return;$ui.animate({duration:.4,animation:()=>{this.#L[e].active()}}),this.#L[this.#A].inactive(),this.#k[this.#A].hide(),this.#k[e].show(),this.callEvent("onChange",this.#A,e),this.#A=e}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#A&&(this.#A=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#A===e})),this.#L[e]=t,this}setHeader(e){return this.#O=e,this}#R(){const e=[];return Object.values(this.#L).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#D(){return Object.values(this.#k).map((e=>{if($7dfcabb1e936a92c$require$UIKit.scrollViewList.indexOf(e.views[0].type)>-1){if(void 0===e.views[0].props&&(e.views[0].props={}),e.views[0].props.indicatorInsets){const t=e.views[0].props.indicatorInsets;e.views[0].props.indicatorInsets=$insets(t.top,t.left,t.bottom+this.contentOffset,t.right)}else e.views[0].props.indicatorInsets=$insets(0,0,0,this.contentOffset);e.views[0].footer=Object.assign({props:{}},e.views[0].footer??{}),e.views[0].props.footer.props.height?e.views[0].props.footer.props.height+=this.contentOffset:e.views[0].props.footer.props.height=this.contentOffset}return e.definition}))}generateView(){const e={type:"view",layout:(e,t)=>{e.centerX.equalTo(t.super),e.width.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight),e.bottom.equalTo(t.super)},views:[$7dfcabb1e936a92c$require$UIKit.blurBox({},[{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#R()}}}]),$7dfcabb1e936a92c$require$UIKit.separatorLine({},$7dfcabb1e936a92c$require$UIKit.align.top)]};return $7dfcabb1e936a92c$require$View.createByViews(this.#D().concat(this.#O?.definition??[],e))}}$7dfcabb1e936a92c$exports={TabBarCellView:$7dfcabb1e936a92c$var$TabBarCellView,TabBarHeaderView:$7dfcabb1e936a92c$var$TabBarHeaderView,TabBarController:$7dfcabb1e936a92c$var$TabBarController};var $bb0fea222fc5aea5$require$TabBarCellView=$7dfcabb1e936a92c$exports.TabBarCellView,$bb0fea222fc5aea5$require$TabBarHeaderView=$7dfcabb1e936a92c$exports.TabBarHeaderView,$bb0fea222fc5aea5$require$TabBarController=$7dfcabb1e936a92c$exports.TabBarController,$3839e9f9bae78bdd$exports={};class $3839e9f9bae78bdd$var$Tasks{#H={};addTask(e,t=0){const i=$text.uuid;return this.#H[i]=$delay(t,(async()=>{await e(),delete this.#H[i]})),i}cancelTask(e){this.#H[e].cancel()}clearTasks(){Object.values(this.#H).forEach((e=>e.cancel()))}}$3839e9f9bae78bdd$exports={Tasks:$3839e9f9bae78bdd$var$Tasks};var $bb0fea222fc5aea5$require$Tasks=$3839e9f9bae78bdd$exports.Tasks,$45Ip7=parcelRequire("45Ip7"),$bb0fea222fc5aea5$require$UIKit=$45Ip7.UIKit,$86d2ffde19fb8791$exports={};class $86d2ffde19fb8791$var$UILoading{#F;text="";interval;fullScreen=!1;#P=()=>{};constructor(){this.#F=$text.uuid}updateText(e){$(this.#F).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#P=e}done(){clearInterval(this.interval)}load(){$ui.render({props:{navBarHidden:this.fullScreen},views:[{type:"spinner",props:{loading:!0},layout:(e,t)=>{e.centerY.equalTo(t.super).offset(-15),e.width.equalTo(t.super)}},{type:"label",props:{id:this.#F,align:$align.center,text:""},layout:(e,t)=>{e.top.equalTo(t.prev.bottom).offset(10),e.left.right.equalTo(t.super)}}],layout:$layout.fill,events:{appeared:()=>{this.interval=setInterval((()=>{this.#P()}),100)}}})}}$86d2ffde19fb8791$exports={UILoading:$86d2ffde19fb8791$var$UILoading};var $bb0fea222fc5aea5$require$UILoading=$86d2ffde19fb8791$exports.UILoading,$6Xrbz=parcelRequire("6Xrbz"),$bb0fea222fc5aea5$require$ValidationError=$6Xrbz.ValidationError,$liCrE=parcelRequire("liCrE"),$bb0fea222fc5aea5$require$View=$liCrE.View,$bb0fea222fc5aea5$require$PageView=$liCrE.PageView,$gMc1q=parcelRequire("gMc1q"),$bb0fea222fc5aea5$require$ViewController=$gMc1q.ViewController,$12xzj=parcelRequire("12xzj"),$bb0fea222fc5aea5$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$bb0fea222fc5aea5$require$NavigationBar=$dcStC.NavigationBar,$bb0fea222fc5aea5$require$NavigationBarController=$dcStC.NavigationBarController,$gAYmG=parcelRequire("gAYmG"),$bb0fea222fc5aea5$require$NavigationBarItems=$gAYmG.NavigationBarItems,$bb0fea222fc5aea5$require$BarButtonItem=$gAYmG.BarButtonItem,$ee5e1f8d12d987dc$exports={},$fYz8N=parcelRequire("fYz8N"),$ee5e1f8d12d987dc$require$Controller=$fYz8N.Controller,$gAYmG=parcelRequire("gAYmG"),$ee5e1f8d12d987dc$require$BarTitleView=$gAYmG.BarTitleView;class $ee5e1f8d12d987dc$var$SearchBar extends $ee5e1f8d12d987dc$require$BarTitleView{height=35;topOffset=15;bottomOffset=10;kbType=$kbType.search;placeholder=$l10n("SEARCH");constructor(e){super(e),this.setController(new $ee5e1f8d12d987dc$var$SearchBarController),this.controller.setSearchBar(this),this.init()}init(){this.props={id:this.id,smoothCorners:!0,cornerRadius:6,bgcolor:$color("#EEF1F1","#212121")},this.views=[{type:"input",props:{id:this.id+"-input",type:this.kbType,bgcolor:$color("clear"),placeholder:this.placeholder},layout:$layout.fill,events:{changed:e=>this.controller.callEvent("onChange",e.text)}}],this.layout=(e,t)=>{e.height.equalTo(this.height),e.top.equalTo(t.super.safeArea).offset(this.topOffset),e.left.equalTo(t.super.safeArea).offset(15),e.right.equalTo(t.super.safeArea).offset(-15)}}setPlaceholder(e){return this.placeholder=e,this}setKbType(e){return this.kbType=e,this}}class $ee5e1f8d12d987dc$var$SearchBarController extends $ee5e1f8d12d987dc$require$Controller{setSearchBar(e){return this.searchBar=e,this}updateSelector(){this.selector={inputBox:$(this.searchBar.id),input:$(this.searchBar.id+"-input")}}hide(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(0)}))}show(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(this.searchBar.height)}))}didScroll(e){this.updateSelector();let t=this.searchBar.height-e;if(t=t>0?t>this.searchBar.height?this.searchBar.height:t:0,this.selector.inputBox.updateLayout((e=>{e.height.equalTo(t)})),e>0){const t=(this.searchBar.height/2-5-e)/10;this.selector.input.alpha=t}else this.selector.input.alpha=1}didEndDragging(e,t,i){this.updateSelector(),e>=0&&e<=this.searchBar.height&&i($point(0,e>=this.searchBar.height/2?this.searchBar.height:0))}}$ee5e1f8d12d987dc$exports={SearchBar:$ee5e1f8d12d987dc$var$SearchBar,SearchBarController:$ee5e1f8d12d987dc$var$SearchBarController};var $bb0fea222fc5aea5$require$SearchBar=$ee5e1f8d12d987dc$exports.SearchBar,$bb0fea222fc5aea5$require$SearchBarController=$ee5e1f8d12d987dc$exports.SearchBarController;module.exports={VERSION:$bb0fea222fc5aea5$require$VERSION,Controller:$bb0fea222fc5aea5$require$Controller,FileManager:$bb0fea222fc5aea5$require$FileManager,FileStorageParameterError:$bb0fea222fc5aea5$require$FileStorageParameterError,FileStorageFileNotFoundError:$bb0fea222fc5aea5$require$FileStorageFileNotFoundError,FileStorage:$bb0fea222fc5aea5$require$FileStorage,FixedFooterView:$bb0fea222fc5aea5$require$FixedFooterView,Kernel:$bb0fea222fc5aea5$require$Kernel,Matrix:$bb0fea222fc5aea5$require$Matrix,Request:$bb0fea222fc5aea5$require$Request,Setting:$bb0fea222fc5aea5$require$Setting,Sheet:$bb0fea222fc5aea5$require$Sheet,TabBarCellView:$bb0fea222fc5aea5$require$TabBarCellView,TabBarHeaderView:$bb0fea222fc5aea5$require$TabBarHeaderView,TabBarController:$bb0fea222fc5aea5$require$TabBarController,Tasks:$bb0fea222fc5aea5$require$Tasks,UIKit:$bb0fea222fc5aea5$require$UIKit,UILoading:$bb0fea222fc5aea5$require$UILoading,ValidationError:$bb0fea222fc5aea5$require$ValidationError,View:$bb0fea222fc5aea5$require$View,PageView:$bb0fea222fc5aea5$require$PageView,ViewController:$bb0fea222fc5aea5$require$ViewController,NavigationView:$bb0fea222fc5aea5$require$NavigationView,NavigationBar:$bb0fea222fc5aea5$require$NavigationBar,NavigationBarController:$bb0fea222fc5aea5$require$NavigationBarController,NavigationBarItems:$bb0fea222fc5aea5$require$NavigationBarItems,BarButtonItem:$bb0fea222fc5aea5$require$BarButtonItem,SearchBar:$bb0fea222fc5aea5$require$SearchBar,SearchBarController:$bb0fea222fc5aea5$require$SearchBarController}; \ No newline at end of file +var $parcel$global="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequire94c2;null==parcelRequire&&(parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var t=$parcel$inits[e];delete $parcel$inits[e];var i={id:e,exports:{}};return $parcel$modules[e]=i,t.call(i.exports,i,i.exports),i.exports}var a=new Error("Cannot find module '"+e+"'");throw a.code="MODULE_NOT_FOUND",a},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("45Ip7",(function(e,t){var i=parcelRequire("cgaQ6").Kernel;class a{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText","secondaryText");static linkColor=$color("systemLink");static primaryViewBackgroundColor=$color("primarySurface");static scrollViewBackgroundColor=$color("insetGroupedBackground");static scrollViewList=["list","matrix"];static isLargeScreen=$device.isIpad||$device.isIpadPro;static get windowSize(){return $objc("UIWindow").$keyWindow().jsValue().size}static NavigationBarNormalHeight=$objc("UINavigationController").invoke("alloc.init").$navigationBar().jsValue().frame.height;static NavigationBarLargeTitleHeight=$objc("UITabBarController").invoke("alloc.init").$tabBar().jsValue().frame.height+a.NavigationBarNormalHeight;static get isSplitScreenMode(){return a.isLargeScreen&&$device.info.screen.width!==a.windowSize.width}static get statusBarHeight(){return $app.isDebugging||i.isTaio?0:a.#e.$statusBarFrame().height}static get statusBarOrientation(){return a.#e.$statusBarOrientation()}static get isHorizontal(){return 3===a.statusBarOrientation||4===a.statusBarOrientation}static loading(){const e=$ui.create(a.blurBox({cornerRadius:15},[{type:"spinner",props:{loading:!0,style:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.center.equalTo(t.super)}}]));return{start:()=>{$ui.controller.view.insertAtIndex(e,0),e.layout(((e,t)=>{e.center.equalTo(t.super);const i=Math.min(.6*a.windowSize.width,300);e.size.equalTo($size(i,i))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return a.scrollViewList.indexOf(e)>-1?a.scrollViewBackgroundColor:a.primaryViewBackgroundColor}static separatorLine(e={},t=a.align.bottom){return{type:"canvas",props:e,layout:(e,i)=>{void 0===i.prev?e.top.equalTo(i.super):t===a.align.bottom?e.top.equalTo(i.prev.bottom):e.top.equalTo(i.prev.top),e.height.equalTo(1/$device.info.screen.scale),e.left.right.inset(0)},events:{draw:(t,i)=>{i.strokeColor=e.bgcolor??$color("separatorColor"),i.setLineWidth(1),i.moveToPoint(0,0),i.addLineToPoint(t.frame.width,0),i.strokePath()}}}}static blurBox(e={},t=[],i=$layout.fill){return{type:"blur",props:Object.assign({style:$blurStyle.thinMaterial},e),views:t,layout:i}}static push({views:e,statusBarStyle:t=0,title:i="",navButtons:a=[{title:""}],bgcolor:r=e[0]?.props?.bgcolor??"primarySurface",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:a,title:i,bgcolor:"string"==typeof r?$color(r):r},events:{disappeared:()=>{void 0!==s&&s()}},views:[{type:"view",views:e,layout:(e,t)=>{e.top.equalTo(t.super.safeArea),e.bottom.equalTo(t.super),e.left.right.equalTo(t.super.safeArea)}}]})}}e.exports={UIKit:a}})),parcelRequire.register("cgaQ6",(function(e,t){var i=parcelRequire("czAIJ").VERSION;String.prototype.trim=function(e,t){return e?"l"===t?this.replace(new RegExp("^\\"+e+"+","g"),""):"r"===t?this.replace(new RegExp("\\"+e+"+$","g"),""):this.replace(new RegExp("^\\"+e+"+|\\"+e+"+$","g"),""):this.replace(/^\s+|\s+$/g,"")};class a{startTime=Date.now();isUseJsboxNav=!1;constructor(){$app.isDebugging&&this.debug()}static isTaio=$app.info.bundleID.includes("taio");static l10n(e,t,i=!0){if("string"==typeof t){const e={};t.split(";").forEach((t=>{if(""!==(t=t.trim())){const i=t.split("=");e[i[0].trim().slice(1,-1)]=i[1].trim().slice(1,-1)}})),t=e}const a=$app.strings;a[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=a}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const a=t/(i.height*i.width);e=$imagekit.scaleBy(e,a)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),r=Object.getOwnPropertyNames(t);if(i.length!==r.length)return!1;for(let r=0;re?i[e]:0,r=isNaN(Number(t))?t.charCodeAt():Number(t),o=a.length>e?a[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(rn){s=1;break}}return s}static deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n("DELETE"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n("CANCEL")}]})}static bytesToSize(e){if(0===e)return"0 B";const t=Math.floor(Math.log(e)/Math.log(1024));return(e/Math.pow(1024,t)).toPrecision(3)+" "+["B","KB","MB","GB","TB","PB","EB","ZB","YB"][t]}debug(e,t){this.debugMode=!0,$app.idleTimerDisabled=!0,"function"==typeof e&&(this.debugPrint=e),"function"==typeof t&&(this.debugError=t),this.print("You are running EasyJsBox in debug mode.")}print(e){this.debugMode&&("function"==typeof this.debugPrint?this.debugPrint(e):console.log(e))}error(e){this.debugMode&&("function"==typeof this.debugError?this.debugError(e):console.error(e))}useJsboxNav(){return this.isUseJsboxNav=!0,this}setTitle(e){this.isUseJsboxNav&&($ui.title=e),this.title=e}setNavButtons(e){this.navButtons=e}UIRender(e){try{e.props=Object.assign({title:this.title,navBarHidden:!this.isUseJsboxNav,navButtons:this.navButtons??[],statusBarStyle:0},e.props),e.events||(e.events={});const t=e.events.layoutSubviews,{UIKit:i}=parcelRequire("45Ip7");e.events.layoutSubviews=()=>{$app.notify({name:"interfaceOrientationEvent",object:{statusBarOrientation:i.statusBarOrientation,isHorizontal:i.isHorizontal}}),"function"==typeof t&&t()},$ui.render(e)}catch(e){this.print(e)}}async checkUpdate(){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/src/version.js");if(e.error)throw e.error;const t=srcRes.data.match(/.*VERSION.?\"([0-9\.]+)\"/)[1];if(this.print(`easy-jsbox latest version: ${t}`),a.versionCompare(t,i)>0){const e=await $http.get("https://raw.githubusercontent.com/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:a}})),parcelRequire.register("czAIJ",(function(e,t){e.exports={VERSION:"1.3.1"}})),parcelRequire.register("7D8Kb",(function(module,exports){var $fYz8N=parcelRequire("fYz8N"),$58e2f5443faff7c0$require$Controller=$fYz8N.Controller,$8aDdQ=parcelRequire("8aDdQ"),$58e2f5443faff7c0$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$58e2f5443faff7c0$require$FileStorage=$8aDdQ.FileStorage,$cgaQ6=parcelRequire("cgaQ6"),$58e2f5443faff7c0$require$Kernel=$cgaQ6.Kernel,$45Ip7=parcelRequire("45Ip7"),$58e2f5443faff7c0$require$UIKit=$45Ip7.UIKit,$aXWmO=parcelRequire("aXWmO"),$58e2f5443faff7c0$require$Sheet=$aXWmO.Sheet,$12xzj=parcelRequire("12xzj"),$58e2f5443faff7c0$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$58e2f5443faff7c0$require$NavigationBar=$dcStC.NavigationBar,$gMc1q=parcelRequire("gMc1q"),$58e2f5443faff7c0$require$ViewController=$gMc1q.ViewController;class SettingLoadConfigError extends Error{constructor(){super("Call loadConfig() first."),this.name="SettingLoadConfigError"}}class SettingReadonlyError extends Error{constructor(){super("Attempted to assign to readonly property."),this.name="SettingReadonlyError"}}class Setting extends $58e2f5443faff7c0$require$Controller{name;setting={};userData;fileStorage;imagePath;viewController=new $58e2f5443faff7c0$require$ViewController;method={readme:()=>{const e=(()=>{const e=$device.info?.language?.startsWith("zh")?"README_CN.md":"README.md";try{return __README__[e]??__README__["README.md"]}catch{return $file.read(e)?.string??$file.read("README.md")?.string}})();(new $58e2f5443faff7c0$require$Sheet).setView({type:"markdown",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}};rowHeight=50;edgeOffset=10;iconSize=30;#t={};#i=!1;#a=!1;#r;constructor(e={}){super(),"function"==typeof e.set&&"function"==typeof e.get?(this.set=e.set,this.get=e.get,this.userData=e.userData):(this.fileStorage=e.fileStorage??new $58e2f5443faff7c0$require$FileStorage,this.dataFile=e.dataFile??"setting.json"),e.structure?this.setStructure(e.structure):this.setStructurePath(e.structurePath??"setting.json"),this.isUseJsboxNav=e.isUseJsboxNav??!1,this.imagePath=(e.name??"default")+".image",this.setName(e.name??$text.uuid),this.loadL10n()}useJsboxNav(){return this.isUseJsboxNav=!0,this}#s(){if(!this.#a)throw new SettingLoadConfigError}loadConfig(){const e=["script","info"],t=this.userData??this.fileStorage.readAsJSON("",this.dataFile,{});return this.setting=function i(a){const r={};for(let s of a)for(let a of s.items)if("child"===a.type){const e=i(a.children);Object.assign(r,e)}else-1===e.indexOf(a.type)?r[a.key]=a.key in t?t[a.key]:a.value:r[a.key]=a.value;return r}(this.structure),this.#a=!0,this}hasSectionTitle(e){return this.#s(),!!e[0].title}loadL10n(){$58e2f5443faff7c0$require$Kernel.l10n("zh-Hans",'\n "OK" = "好";\n "DONE" = "完成";\n "CANCEL" = "取消";\n "CLEAR" = "清除";\n "BACK" = "返回";\n "ERROR" = "发生错误";\n "SUCCESS" = "成功";\n "LOADING" = "加载中";\n "INVALID_VALUE" = "非法参数";\n "CONFIRM_CHANGES" = "数据已变化,确认修改?";\n \n "SETTING" = "设置";\n "GENERAL" = "一般";\n "ADVANCED" = "高级";\n "TIPS" = "小贴士";\n "COLOR" = "颜色";\n "COPY" = "复制";\n "COPIED" = "复制成功";\n \n "JSBOX_ICON" = "JSBox 内置图标";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "图片 / base64";\n\n "PREVIEW" = "预览";\n "SELECT_IMAGE" = "选择图片";\n "CLEAR_IMAGE" = "清除图片";\n "NO_IMAGE" = "无图片";\n \n "ABOUT" = "关于";\n "VERSION" = "Version";\n "AUTHOR" = "作者";\n "AT_BOTTOM" = "已经到底啦~";\n ',!1),$58e2f5443faff7c0$require$Kernel.l10n("en",'\n "OK" = "OK";\n "DONE" = "Done";\n "CANCEL" = "Cancel";\n "CLEAR" = "Clear";\n "BACK" = "Back";\n "ERROR" = "Error";\n "SUCCESS" = "Success";\n "LOADING" = "Loading";\n "INVALID_VALUE" = "Invalid value";\n "CONFIRM_CHANGES" = "The data has changed, confirm the modification?";\n\n "SETTING" = "Setting";\n "GENERAL" = "General";\n "ADVANCED" = "Advanced";\n "TIPS" = "Tips";\n "COLOR" = "Color";\n "COPY" = "Copy";\n "COPIED" = "Copide";\n\n "JSBOX_ICON" = "JSBox in app icon";\n "SF_SYMBOLS" = "SF Symbols";\n "IMAGE_BASE64" = "Image / base64";\n\n "PREVIEW" = "Preview";\n "SELECT_IMAGE" = "Select Image";\n "CLEAR_IMAGE" = "Clear Image";\n "NO_IMAGE" = "No Image";\n\n "ABOUT" = "About";\n "VERSION" = "Version";\n "AUTHOR" = "Author";\n "AT_BOTTOM" = "It\'s the end~";\n ',!1)}setUserData(e){this.userData=e}setStructure(e){return this.structure=e,this}setStructurePath(e){return this.structure||this.setStructure($58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(e)),this}setName(e){return this.name=e,this}setFooter(e){return this.#r=e,this}set footer(e){this.#r=e}get footer(){if(void 0===this.#r){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON("config.json",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#r={},e.version&&e.author&&(this.#r={type:"view",props:{height:70},views:[{type:"label",props:{font:$font(14),text:`${$l10n("VERSION")} ${e.version} ♥ ${e.author}`,textColor:$color({light:"#C0C0C0",dark:"#545454"}),align:$align.center},layout:e=>{e.left.right.inset(0),e.top.inset(10)}}]})}return this.#r}setReadonly(){return this.#i=!0,this}set(e,t){if(this.#i)throw new SettingReadonlyError;return this.#s(),this.setting[e]=t,this.fileStorage.write("",this.dataFile,$data({string:JSON.stringify(this.setting)})),this.callEvent("onSet",e,t),!0}get(e,t=null){return this.#s(),Object.prototype.hasOwnProperty.call(this.setting,e)?this.setting[e]:t}getColor(e){return"string"==typeof e?$color(e):$rgba(e.red,e.green,e.blue,e.alpha)}getImageName(e,t=!1){let i=$text.MD5(e)+".jpg";return t&&(i="compress."+i),i}getImage(e,t=!1){try{const i=this.getImageName(e,t);return this.fileStorage.read(this.imagePath,i).image}catch(e){if(e instanceof $58e2f5443faff7c0$require$FileStorageFileNotFoundError)return null;throw e}}getId(e){return`setting-${this.name}-${e}`}#o(e){$(e).bgcolor=$color("systemFill")}#n(e,t=.3){0===t?$(e).bgcolor=$color("clear"):$ui.animate({duration:t,animation:()=>{$(e).bgcolor=$color("clear")}})}#l(e,t,i=!1,a=0){if(t=Object.assign(t,{touchesBegan:()=>{this.#o(e),this.#t[e]=$delay(1,(()=>this.#n(e,0)))},touchesMoved:()=>{this.#t[e]?.cancel(),this.#n(e,0)}}),i){const i=t.tapped;t.tapped=()=>{this.#o(e),setTimeout((()=>this.#n(e)),1e3*a),"function"==typeof i&&i()}}return t}createLineLabel(e,t){return t[1]||(t[1]="#00CC00"),"object"!=typeof t[1]&&(t[1]=[t[1],t[1]]),"object"!=typeof t[0]&&(t[0]=[t[0],t[0]]),{type:"view",views:[{type:"view",props:{bgcolor:$color(t[1][0],t[1][1]),cornerRadius:5,smoothCorners:!0},views:[{type:"image",props:{tintColor:$color("white"),image:$image(t[0][0],t[0][1])},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(20)}}],layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.iconSize),e.left.inset(this.edgeOffset)}},{type:"label",props:{text:e,lines:1,textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.centerY.equalTo(t.super),e.height.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edgeOffset),e.width.greaterThanOrEqualTo(10)}}],layout:(e,t)=>{e.height.centerY.equalTo(t.super),e.left.inset(0)}}}createInfo(e,t,i){const a=Array.isArray(i),r=a?i[0]:i,s=a?i[1]:i;return{type:"view",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:"label",props:{text:r,align:$align.right,textColor:$color("darkGray")},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset),e.width.equalTo(180)}},{type:"view",events:{tapped:()=>{$ui.alert({title:t,message:s,actions:[{title:$l10n("COPY"),handler:()=>{$clipboard.text=s,$ui.toast($l10n("COPIED"))}},{title:$l10n("OK")}]})}},layout:(e,t)=>{e.right.inset(0),e.size.equalTo(t.super)}}],layout:$layout.fill}}createSwitch(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"switch",props:{on:this.get(e),onColor:$color("#00CC00")},events:{changed:t=>{try{this.set(e,t.on)}catch(e){throw t.on=!t.on,e}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createString(e,t,i){return{type:"view",props:{id:this.getId(e),selectable:!0},views:[this.createLineLabel(i,t),{type:"button",props:{symbol:"square.and.pencil",bgcolor:$color("clear"),tintColor:$color("primaryText")},events:{tapped:t=>{const i=$ui.popover({sourceView:t,sourceRect:t.bounds,directions:$popoverDirection.down,size:$size(320,150),views:[{type:"text",props:{id:`${this.name}-string-${e}`,align:$align.left,text:this.get(e)},layout:e=>{e.left.right.inset(10),e.top.inset(20),e.height.equalTo(90)}},{type:"button",props:{symbol:"checkmark",bgcolor:$color("clear"),titleEdgeInsets:10,contentEdgeInsets:0},layout:e=>{e.right.inset(10),e.bottom.inset(25),e.size.equalTo(30)},events:{tapped:()=>{this.set(e,$(`${this.name}-string-${e}`).text),i.dismiss()}}}]})}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(0),e.size.equalTo(50)}}],layout:$layout.fill}}createStepper(e,t,i,a,r){const s=this.getId(e),o=`${s}-label`;return{type:"view",props:{id:s,selectable:!0},views:[this.createLineLabel(i,t),{type:"label",props:{id:o,text:this.get(e),textColor:this.textColor,align:$align.left},layout:(e,t)=>{e.height.equalTo(t.super),e.right.inset(120)}},{type:"stepper",props:{min:a,max:r,value:this.get(e)},events:{changed:t=>{$(o).text=t.value;try{this.set(e,t.value)}catch(t){throw $(o).text=this.get(e),t}}},layout:(e,t)=>{e.centerY.equalTo(t.prev),e.right.inset(this.edgeOffset)}}],layout:$layout.fill}}createScript(key,icon,title,script){const id=this.getId(key),buttonId=`${id}-button`,actionStart=()=>{$(buttonId).alpha=0,$(`${buttonId}-spinner`).alpha=1,this.#o(id)},actionCancel=()=>{$(buttonId).alpha=1,$(`${buttonId}-spinner`).alpha=0,this.#n(id)},actionDone=(e=!0,t=$l10n("ERROR"))=>{$(`${buttonId}-spinner`).alpha=0,this.#n(id);const i=$(buttonId);if(!e)return $ui.toast(t),void(i.alpha=1);i.symbol="checkmark",$ui.animate({duration:.6,animation:()=>{i.alpha=1},completion:()=>{setTimeout((()=>{$ui.animate({duration:.4,animation:()=>{i.alpha=0},completion:()=>{i.symbol="chevron.right",$ui.animate({duration:.4,animation:()=>{i.alpha=1},completion:()=>{i.alpha=1}})}})}),600)}})};return{type:"view",props:{id:id},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"image",props:{id:buttonId,symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(0),e.size.equalTo(15)}},{type:"spinner",props:{id:`${buttonId}-spinner`,loading:!0,alpha:0},layout:(e,t)=>{e.size.equalTo(t.prev),e.left.top.equalTo(t.prev)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:this.#l(id,{tapped:()=>{const animate={actionStart:actionStart,actionCancel:actionCancel,actionDone:actionDone,touchHighlightStart:()=>this.#o(id),touchHighlightEnd:()=>this.#n(id)};"function"==typeof script?script(animate):script.startsWith("this")?eval(`(()=>{return ${script}(animate)})()`):eval(script)}}),layout:$layout.fill}}createTab(key,icon,title,items,values){"string"==typeof items?items=eval(`(()=>{return ${items}()})()`):"function"==typeof items&&(items=items()),"string"==typeof values?values=eval(`(()=>{return ${values}()})()`):"function"==typeof values&&(values=values());const id=this.getId(key),isCustomizeValues=items?.length>0&&values?.length===items?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"tab",props:{items:items??[],index:isCustomizeValues?values.indexOf(this.get(key)):this.get(key),dynamicWidth:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.prev)},events:{changed:e=>{isCustomizeValues?this.set(key,values[e.index]):this.set(key,e.index)}}}],layout:$layout.fill}}createMenu(key,icon,title,items,values){const id=this.getId(key),labelId=`${id}-label`,getItems=()=>{let res;return res="string"==typeof items?eval(`(()=>{return ${items}()})()`):"function"==typeof items?items():items??[],res},getValues=()=>{let res;return res="string"==typeof values?eval(`(()=>{return ${values}()})()`):"function"==typeof values?values():values,res},tmpItems=getItems(),tmpValues=getValues(),isCustomizeValues=tmpItems?.length>0&&tmpValues?.length===tmpItems?.length;return{type:"view",props:{id:id,selectable:!0},views:[this.createLineLabel(title,icon),{type:"view",views:[{type:"label",props:{text:isCustomizeValues?tmpItems[tmpValues.indexOf(this.get(key))]:tmpItems[this.get(key)],color:$color("secondaryText"),id:labelId},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],events:{tapped:()=>{const e=getItems(),t=getValues();$ui.menu({items:e,handler:(e,i)=>{isCustomizeValues?this.set(key,t[i]):this.set(key,i),$(labelId).text=$l10n(e)}})}},layout:$layout.fill}}createColor(e,t,i){const a=this.getId(e),r=`${a}-color`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"view",props:{id:r,bgcolor:this.getColor(this.get(e)),circular:!0,borderWidth:1,borderColor:$color("#e3e3e3")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(20)}},{type:"view",events:{tapped:async()=>{const t=await $picker.color({color:this.getColor(this.get(e))});this.set(e,t.components),$(r).bgcolor=$rgba(t.components.red,t.components.green,t.components.blue,t.components.alpha)}},layout:(e,t)=>{e.right.inset(0),e.height.width.equalTo(t.super.height)}}],layout:(e,t)=>{e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createDate(e,t,i,a=2){const r=this.getId(e),s=e=>{let t="";switch("number"==typeof e&&(e=new Date(e)),a){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"label",props:{id:`${r}-label`,color:$color("secondaryText"),text:this.get(e)?s(this.get(e)):"None"},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(t.super)}}],events:{tapped:async()=>{const t=this.get(e),i=await $picker.date({props:{mode:a,date:t||Date.now()}});this.set(e,i.getTime()),$(`${r}-label`).text=s(i)}},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createNumber(e,t,i){return this.createInput(e,t,i,!1,$kbType.decimal,(t=>""!==t&&/^[0-9]+.?[0-9]*$/.test(t)?this.set(e,Number(t)):($ui.toast($l10n("INVALID_VALUE")),!1)))}createInput(e,t,i,a=!1,r=$kbType.default,s){void 0===s&&(s=t=>this.set(e,t));const o=this.getId(e),n=o+"-input";return{type:"view",props:{id:o,selectable:!0},views:[this.createLineLabel(i,t),{type:"input",props:{id:n,type:r,align:$align.right,bgcolor:$color("clear"),textColor:$color("secondaryText"),text:this.get(e),secure:a,accessoryView:$58e2f5443faff7c0$require$UIKit.blurBox({height:44},[$58e2f5443faff7c0$require$UIKit.separatorLine({},$58e2f5443faff7c0$require$UIKit.align.top),{type:"button",props:{title:$l10n("DONE"),bgcolor:$color("clear"),titleColor:$color("primaryText")},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super)},events:{tapped:()=>{$(n).blur()}}},{type:"button",props:{title:$l10n("CANCEL"),bgcolor:$color("clear"),titleColor:$color("primaryText")},layout:(e,t)=>{e.left.inset(this.edgeOffset),e.centerY.equalTo(t.super)},events:{tapped:()=>{const t=$(n),i=this.get(e,"");t.text!==i&&(t.text=i),t.blur()}}}])},layout:(e,t)=>{e.left.equalTo(t.prev.get("label").right).offset(this.edgeOffset),e.right.inset(this.edgeOffset),e.width.greaterThanOrEqualTo(80),e.height.equalTo(t.super)},events:{didBeginEditing:e=>{e.secure=!1,$app.autoKeyboardEnabled||($app.autoKeyboardEnabled=!0)},returned:e=>{e.blur()},didEndEditing:async t=>{const i=this.get(e,"");s(t.text)||(t.text=i),a&&(t.secure=a)}}}],layout:$layout.fill}}createIcon(e,t,i,a="#000000"){const r=this.getId(e),s=`${r}-image`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{cornerRadius:8,bgcolor:"string"==typeof a?$color(a):a,smoothCorners:!0},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}},{type:"image",props:{id:s,image:$image(this.get(e)),icon:$icon(this.get(e).slice(5,this.get(e).indexOf(".")),$color("#ffffff")),tintColor:$color("#ffffff")},layout:(e,t)=>{e.right.equalTo(t.prev).offset(-5),e.centerY.equalTo(t.super),e.size.equalTo($size(20,20))}}],events:{tapped:()=>{$ui.menu({items:[$l10n("JSBOX_ICON"),$l10n("SF_SYMBOLS"),$l10n("IMAGE_BASE64")],handler:async(t,i)=>{if(0===i){const t=await $ui.selectIcon();this.set(e,t),$(s).icon=$icon(t.slice(5,t.indexOf(".")),$color("#ffffff"))}else 1!==i&&2!==i||$input.text({text:"",placeholder:t,handler:t=>{""!==t?(this.set(e,t),1===i?$(s).symbol=t:$(s).image=$image(t)):$ui.toast($l10n("INVALID_VALUE"))}})}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}createChild(e,t,i,a){const r=this.getId(e);return{type:"view",layout:$layout.fill,props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"image",props:{symbol:"chevron.right",tintColor:$color("secondaryText")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edgeOffset),e.size.equalTo(15)}}],events:{tapped:()=>{setTimeout((()=>{if(this.events?.onChildPush)this.callEvent("onChildPush",this.getListView(a,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(a,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(a,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(a)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const a=this.getId(e),r=`${a}-image`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{id:r,image:this.getImage(e,!0)??$image("questionmark.square.dashed")},layout:(e,t)=>{e.right.inset(this.edgeOffset),e.centerY.equalTo(t.super),e.size.equalTo($size(30,30))}}],events:{tapped:()=>{this.#o(a),$ui.menu({items:[$l10n("PREVIEW"),$l10n("SELECT_IMAGE"),$l10n("CLEAR_IMAGE")],handler:(t,i)=>{if(0===i){const t=this.getImage(e);t?$quicklook.open({image:t}):$ui.toast($l10n("NO_IMAGE"))}else 1===i?$photo.pick({format:"data"}).then((t=>{if($ui.toast($l10n("LOADING")),!t.status||!t.data)return void("canceled"!==t?.error?.description&&$ui.toast($l10n("ERROR")));const i=$58e2f5443faff7c0$require$Kernel.compressImage(t.data.image);this.fileStorage.write(this.imagePath,this.getImageName(e,!0),i.jpg(.8)),this.fileStorage.write(this.imagePath,this.getImageName(e),t.data),$(r).image=i,$ui.success($l10n("SUCCESS"))})):2===i&&(this.fileStorage.delete(this.imagePath,this.getImageName(e,!0)),this.fileStorage.delete(this.imagePath,this.getImageName(e)),$(r).image=$image("questionmark.square.dashed"),$ui.success($l10n("SUCCESS")))},finished:()=>{this.#n(a)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#h(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let a=null;switch(t.icon||(t.icon=["square.grid.2x2.fill","#00CC00"]),"object"==typeof t.items&&(t.items=t.items.map((e=>$l10n(e)))),t.title=$l10n(t.title),t.type){case"switch":a=this.createSwitch(t.key,t.icon,t.title);break;case"stepper":a=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case"string":a=this.createString(t.key,t.icon,t.title);break;case"info":a=this.createInfo(t.icon,t.title,i);break;case"script":a=this.createScript(t.key,t.icon,t.title,i);break;case"tab":a=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case"menu":a=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case"color":a=this.createColor(t.key,t.icon,t.title);break;case"date":a=this.createDate(t.key,t.icon,t.title,t.mode);break;case"number":a=this.createNumber(t.key,t.icon,t.title);break;case"input":a=this.createInput(t.key,t.icon,t.title,t.secure);break;case"icon":a=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case"child":a=this.createChild(t.key,t.icon,t.title,t.children);break;case"image":a=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(a)}t.push({title:$l10n(i.title??""),rows:e})}return t}getListView(e,t=this.footer){return{type:"list",props:{id:this.name,style:2,separatorInset:$insets(0,this.iconSize+2*this.edgeOffset,0,this.edgeOffset),bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,footer:t,data:this.#h(e??this.structure)},layout:$layout.fill,events:{rowHeight:(e,t)=>(e.object(t)?.props?.info??{}).rowHeight??this.rowHeight}}}getPageView(){const e=new $58e2f5443faff7c0$require$NavigationView;return e.setView(this.getListView(this.structure)).navigationBarTitle($l10n("SETTING")),this.hasSectionTitle(this.structure)&&e.navigationBar.setContentViewHeightOffset(-10),e.getPage()}}module.exports={Setting:Setting}})),parcelRequire.register("fYz8N",(function(e,t){e.exports={Controller:class{events={};setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}callEvent(e,...t){"function"==typeof this.events[e]&&this.events[e](...t)}}}})),parcelRequire.register("8aDdQ",(function(e,t){class i extends Error{constructor(e){super(`Parameter [${e}] is required.`),this.name="FileStorageParameterError"}}class a extends Error{constructor(e){super(`File not found: ${e}`),this.name="FileStorageFileNotFoundError"}}class r{basePath;constructor({basePath:e="storage"}={}){this.basePath=e,this.#c(this.basePath)}#c(e){$file.isDirectory(e)||$file.mkdir(e)}#u(e="",t){return e=`${this.basePath}/${e.trim("/")}`.trim("/"),this.#c(e),e=`${e}/${t}`}write(e="",t,a){if(!t)throw new i("fileName");if(!a)throw new i("data");return $file.write({data:a,path:this.#u(e,t)})}writeSync(e="",t,i){return new Promise(((a,r)=>{try{const s=this.write(e,t,i);s?a(s):r(s)}catch(e){r(e)}}))}exists(e="",t){if(!t)throw new i("fileName");return e=this.#u(e,t),!!$file.exists(e)&&e}read(e="",t){if(!t)throw new i("fileName");if(e=this.#u(e,t),!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e="",t){return new Promise(((i,a)=>{try{const r=this.read(e,t);r?i(r):a()}catch(e){a(e)}}))}readAsJSON(e="",t,i=null){try{const i=this.read(e,t)?.string;return JSON.parse(i)}catch(e){return i}}static readFromRoot(e){if(!e)throw new i("path");if(!$file.exists(e))throw new a(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=""){return new Promise(((t,i)=>{try{const a=r.readFromRoot(e);a?t(a):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e="",t=null){try{const t=r.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e="",t=""){return $file.delete(this.#u(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:a,FileStorage:r}})),parcelRequire.register("aXWmO",(function(e,t){var i=parcelRequire("6Xrbz").ValidationError,a=parcelRequire("liCrE").View,r=parcelRequire("45Ip7").UIKit,s=parcelRequire("12xzj").NavigationView,o=parcelRequire("dcStC").NavigationBar,n=parcelRequire("gAYmG").BarButtonItem;class l extends Error{constructor(){super("Please call setView(view) first."),this.name="SheetAddNavBarError"}}class h extends i{constructor(e,t){super(e,t),this.name="SheetViewTypeError"}}class c extends a{#p=()=>{};#g=()=>{};style=c.UIModalPresentationStyle.PageSheet;#d=!1;static UIModalPresentationStyle={Automatic:-2,FullScreen:0,PageSheet:1,FormSheet:2,CurrentContext:3,Custom:4,OverFullScreen:5,OverCurrentContext:6,Popover:7,BlurOverFullScreen:8};navigationView;init(){const{width:e,height:t}=$device.info.screen,i=$objc("UIView").invoke("initWithFrame",$rect(0,0,e,t)),a=$objc("UIViewController").invoke("alloc.init"),s=a.$view();return s.$setBackgroundColor(r.primaryViewBackgroundColor),s.$addSubview(i),a.$setModalPresentationStyle(this.style),a.$setModalInPresentation(this.#d),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke("presentViewController:animated:completion:",a,!0,void 0)},this.#g=()=>a.invoke("dismissViewControllerAnimated:completion:",!0,void 0),this}preventDismiss(){return this.#d=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if("object"!=typeof e)throw new h("view","object");return this.view=e,this}addNavBar({title:e="",popButton:t={title:$l10n("DONE")},rightButtons:i=[]}={}){if(void 0===this.view)throw new l;this.navigationView=new s;const a=new n;a.setEvents(Object.assign({tapped:()=>{this.dismiss(),"function"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(r.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const h=a.definition.views[0];return h.layout=(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.centerY.equalTo(t.super.safeArea)},this.navigationView.navigationBar.setLargeTitleDisplayMode(o.largeTitleDisplayModeNever).pageSheetMode(),this.navigationView.navigationBarItems.addPopButton("",h).setRightButtons(i),this.navigationView.setView(this.view).navigationBarTitle(e),this.view.props?.bgcolor&&this.navigationView?.getPage().setProp("bgcolor",this.view.props?.bgcolor),this}present(){this.#p()}dismiss(){this.#g()}}e.exports={Sheet:c}})),parcelRequire.register("6Xrbz",(function(e,t){class i extends Error{constructor(e,t){super(`The type of the parameter '${e}' must be '${t}'`),this.name="ValidationError"}}e.exports={ValidationError:i}})),parcelRequire.register("liCrE",(function(e,t){class i{id=$text.uuid;type;props;views;events;layout;constructor({type:e="view",props:t={},views:i=[],events:a={},layout:r=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=a,this.layout=r,this.props.id?this.id=this.props.id:this.props.id=this.id}static create(e){return new this(e)}static createByViews(e){return new this({views:e})}setProps(e){return Object.keys(e).forEach((t=>this.setProp(t,e[t]))),this}setProp(e,t){return"id"===e&&(this.id=t),this.props[e]=t,this}setViews(e){return this.views=e,this}setEvents(e){return Object.keys(e).forEach((t=>this.setEvent(t,e[t]))),this}setEvent(e,t){return this.events[e]=t,this}eventMiddleware(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&t(i,...e)},this}assignEvent(e,t){const i=this.events[e];return this.events[e]=(...e)=>{"function"==typeof i&&i(...e),t(...e)},this}setLayout(e){return this.layout=e,this}getView(){return this}get definition(){return this.getView()}}e.exports={View:i,PageView:class extends i{constructor(e={}){super(e),this.activeStatus=!0}show(){$(this.props.id).hidden=!1,this.activeStatus=!0}hide(){$(this.props.id).hidden=!0,this.activeStatus=!1}setHorizontalSafeArea(e){return this.horizontalSafeArea=e,this}#$(e,t){e.top.bottom.equalTo(t.super),this.horizontalSafeArea?e.left.right.equalTo(t.super.safeArea):e.left.right.equalTo(t.super)}getView(){return this.layout=this.#$,this.props.clipsToBounds=!0,this.props.hidden=!this.activeStatus,super.getView()}}}})),parcelRequire.register("12xzj",(function(e,t){var i=parcelRequire("liCrE"),a=i.View,r=i.PageView,s=parcelRequire("6Xrbz").ValidationError,o=parcelRequire("45Ip7").UIKit,n=parcelRequire("dcStC"),l=n.NavigationBar,h=n.NavigationBarController,c=parcelRequire("gAYmG").NavigationBarItems;class u extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new l;navigationBarItems=new c;constructor(){this.navigationBar.navigationBarItems=this.navigationBarItems,this.navigationController.navigationBar=this.navigationBar}navigationBarTitle(e){return this.navigationBar.setTitle(e),this}setView(e){if("object"!=typeof e)throw new u("view","object");return this.view=a.create(e),this}#f(){if(!(this.view instanceof a))throw new u("view","View");let e=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(e+=this.navigationBarItems.titleView.topOffset,e+=this.navigationBarItems.titleView.height,e+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?e+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===l.largeTitleDisplayModeNever?e+=this.navigationBar.navigationBarNormalHeight:e+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:e+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(t,i)=>{t.top.equalTo(e),t.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:e}},this.view.props.footer=Object.assign({props:{}},this.view.props.footer??{}),this.view.props.footer.props.height=(this.navigationBarItems.fixedFooterView?.height??0)+(this.view.props.footer.props?.height??0),-1===o.scrollViewList.indexOf(this.view.type))this.view.layout=(e,t)=>{e.left.right.equalTo(t.super.safeArea),e.bottom.equalTo(t.super);let i=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==l.largeTitleDisplayModeNever&&(i+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(i+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),o.isHorizontal&&!o.isLargeScreen||!this.navigationBar.addStatusBarHeight||(i+=o.statusBarHeight),e.top.equalTo(this.navigationBar.navigationBarNormalHeight+i)};else{const e=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const t=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(t.top+this.navigationBar.navigationBarNormalHeight+e,t.left,t.bottom+(this.navigationBarItems.fixedFooterView?.height??0),t.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+e,0,this.navigationBarItems.fixedFooterView?.height??0,0);this.view.layout=(e,t)=>{this.view.props.stickyHeader?e.top.equalTo(t.super.safeArea).offset(this.navigationBar.navigationBarNormalHeight):e.top.equalTo(t.super),e.left.right.equalTo(t.super.safeArea),e.bottom.equalTo(t.super)},this.view.assignEvent("didScroll",(e=>{let t=e.contentOffset.y;o.isHorizontal&&!o.isLargeScreen||!this.navigationBar.addStatusBarHeight||this.view.props.stickyHeader||(t+=o.statusBarHeight),this.navigationController.didScroll(t)})).assignEvent("didEndDragging",((e,t)=>{let i=e.contentOffset.y,a=0;o.isHorizontal&&!o.isLargeScreen||!this.navigationBar.addStatusBarHeight||this.view.props.stickyHeader||(i+=o.statusBarHeight,a=o.statusBarHeight),this.navigationController.didEndDragging(i,t,((...t)=>e.scrollToOffset(...t)),a)})).assignEvent("didEndDecelerating",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#v(){if(this.navigationBar.prefersLargeTitles){this.#f();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=a.create({views:[this.navigationBar.backgroundColor?{type:"view",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+"-title-view-background"},layout:$layout.fill}:o.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),o.separatorLine({id:this.navigationBar.id+"-title-view-underline",alpha:t}),this.navigationBarItems.titleView.definition],layout:(e,t)=>{e.top.equalTo(t.prev.bottom),e.width.equalTo(t.super),e.height.equalTo(this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset)}})}this.page=r.createByViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=r.createByViews([this.view]);return this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",o.defaultBackgroundColor(this.view.type)),this}getPage(){return this.page||this.#v(),this.page}}}})),parcelRequire.register("dcStC",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("fYz8N").Controller,r=parcelRequire("45Ip7").UIKit,s=parcelRequire("gAYmG").BarButtonItem;class o extends i{static largeTitleDisplayModeAutomatic=0;static largeTitleDisplayModeAlways=1;static largeTitleDisplayModeNever=2;static pageSheetNavigationBarHeight=56;navigationBarItems;title="";prefersLargeTitles=!0;largeTitleDisplayMode=o.largeTitleDisplayModeAutomatic;largeTitleFontSize=34;largeTitleFontFamily="bold";largeTitleFontHeight=$text.sizeThatFits({text:"A",width:100,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize)}).height;navigationBarTitleFontSize=17;addStatusBarHeight=!0;contentViewHeightOffset=10;navigationBarNormalHeight=r.NavigationBarNormalHeight;navigationBarLargeTitleHeight=r.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.addStatusBarHeight=!1,this}withStatusBarHeight(){return this.addStatusBarHeight=!0,this}withoutStatusBarHeight(){return this.addStatusBarHeight=!1,this}setLargeTitleDisplayMode(e){return this.largeTitleDisplayMode=e,this}setBackgroundColor(e){return this.backgroundColor=e,this}setTitle(e){return this.title=e,this}setPrefersLargeTitles(e){return this.prefersLargeTitles=e,this}setContentViewHeightOffset(e){return this.contentViewHeightOffset=e,this}getLargeTitleView(){return this.prefersLargeTitles&&this.largeTitleDisplayMode!==o.largeTitleDisplayModeNever?{type:"label",props:{id:this.id+"-large-title",text:this.title,textColor:r.textColor,align:$align.left,font:$font(this.largeTitleFontFamily,this.largeTitleFontSize),line:1},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(15),e.height.equalTo(this.largeTitleFontHeight),e.top.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)}}:{props:{id:this.id+"-large-title"}}}getNavigationBarView(){const e=(e,t)=>e.length>0?{type:"view",views:[{type:"view",views:e,layout:$layout.fill}],layout:(i,a)=>{i.top.equalTo(a.super.safeAreaTop),i.bottom.equalTo(a.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===r.align.left?i.left.equalTo(a.super.safeArea):i.right.equalTo(a.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,r.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,r.align.left),a=this.prefersLargeTitles,n=!this.prefersLargeTitles||this.largeTitleDisplayMode===o.largeTitleDisplayModeNever;return{type:"view",props:{id:this.id+"-navigation",bgcolor:$color("clear")},layout:(e,t)=>{e.left.top.right.inset(0),e.bottom.equalTo(t.super.safeAreaTop).offset(this.navigationBarNormalHeight)},views:[this.backgroundColor?{type:"view",props:{hidden:a,bgcolor:this.backgroundColor,id:this.id+"-background"},layout:$layout.fill}:r.blurBox({hidden:a,id:this.id+"-background"}),r.separatorLine({id:this.id+"-underline",alpha:a?0:1}),{type:"view",props:{alpha:0,bgcolor:$color("clear"),id:this.id+"-large-title-mask"},events:{ready:e=>{e.bgcolor=$(this.id+"-large-title")?.prev.bgcolor}},layout:$layout.fill},{type:"label",props:{id:this.id+"-small-title",alpha:n?1:0,text:this.title,font:$font(this.largeTitleFontFamily,this.navigationBarTitleFontSize),align:$align.center,bgcolor:$color("clear"),textColor:r.textColor},layout:(e,t)=>{e.left.right.inset(0),e.height.equalTo(20),e.centerY.equalTo(t.super.safeArea)}}].concat(t,i)}}}class n extends a{static largeTitleViewSmallMode=0;static largeTitleViewLargeMode=1;navigationBar;updateSelector(){this.selector={navigation:$(this.navigationBar.id+"-navigation"),largeTitleView:$(this.navigationBar.id+"-large-title"),smallTitleView:$(this.navigationBar.id+"-small-title"),underlineView:this.navigationBar.navigationBarItems.isPinTitleView?$(this.navigationBar.id+"-title-view-underline"):$(this.navigationBar.id+"-underline"),largeTitleMaskView:$(this.navigationBar.id+"-large-title-mask"),backgroundView:$(this.navigationBar.id+"-background"),titleViewBackgroundView:$(this.navigationBar.id+"-title-view-background")}}toNormal(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!1,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=1,this.selector.smallTitleView.alpha=1,this.selector.largeTitleView.alpha=0}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeNever)}toLargeTitle(e=!0){this.updateSelector(),this.selector.backgroundView.hidden=!0,$ui.animate({duration:.2,animation:()=>{this.selector.underlineView.alpha=0,this.selector.smallTitleView.alpha=0,this.selector.largeTitleView.alpha=1}}),e&&this.navigationBar.navigationBarItems&&(this.navigationBar.largeTitleDisplayMode=o.largeTitleDisplayModeAlways)}#b(e){const t=e===n.largeTitleViewSmallMode;this.selector.largeTitleView.alpha=t?0:1,$ui.animate({duration:.2,animation:()=>{this.selector.smallTitleView.alpha=t?1:0}})}#w(e){if(this.selector.largeTitleView.updateLayout(((t,i)=>{this.navigationBar.navigationBarNormalHeight-e>0?t.top.equalTo(i.super.safeAreaTop).offset(this.navigationBar.navigationBarNormalHeight-e):t.top.equalTo(i.super.safeAreaTop).offset(0)})),e>0)e>=this.navigationBar.navigationBarNormalHeight?this.#b(n.largeTitleViewSmallMode):this.#b(n.largeTitleViewLargeMode);else{this.#b(n.largeTitleViewLargeMode);let t=this.navigationBar.largeTitleFontSize-.04*e;t>40&&(t=40),this.selector.largeTitleView.font=$font(this.navigationBar.largeTitleFontFamily,t)}}#m(e){const t=this.navigationBar.largeTitleDisplayMode===o.largeTitleDisplayModeNever?5:this.navigationBar.navigationBarNormalHeight,i=void 0!==this.selector.titleViewBackgroundView;if(e>t){this.selector.backgroundView.hidden=!1;const a=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?a():$ui.animate({duration:.2,animation:()=>{a()}})}else this.selector.largeTitleMaskView.alpha=e>0?1:0,this.selector.underlineView.alpha=0,i&&(this.selector.titleViewBackgroundView.alpha=0),this.selector.backgroundView.hidden=!0}didScroll(e){if(!this.navigationBar.prefersLargeTitles)return;const t=this.navigationBar.largeTitleDisplayMode;if(t!==o.largeTitleDisplayModeAlways)if(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic){if(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)){(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0)}this.#w(e),this.#m(e)}else t===o.largeTitleDisplayModeNever&&this.#m(e)}didEndDragging(e,t,i,a){if(!this.navigationBar.prefersLargeTitles)return;const r=this.navigationBar.largeTitleDisplayMode;if(r!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),r===o.largeTitleDisplayModeAutomatic)){let r=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,a),r=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=r),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+r-a:r-a))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register("gAYmG",(function(e,t){var i=parcelRequire("liCrE").View,a=parcelRequire("45Ip7").UIKit;class r extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(r.size.width-r.edges,r.size.height-r.edges);title;symbol;align=a.align.right;setTitle(e){return this.title=e,this}setSymbol(e){return this.symbol=e,this}setMenu(e){return this.menu=e,this}setAlign(e){return this.align=e,this}#y(){$(this.id).hidden=!0,$("spinner-"+this.id).hidden=!1}#T(){const e=$(`icon-button-${this.id}`),t=$(`icon-checkmark-${this.id}`);e.alpha=0,$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0,$ui.animate({duration:.6,animation:()=>{t.alpha=1},completion:()=>{$delay(.3,(()=>$ui.animate({duration:.6,animation:()=>{t.alpha=0},completion:()=>{$ui.animate({duration:.4,animation:()=>{e.alpha=1},completion:()=>{e.alpha=1}})}})))}})}#B(){$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#y(),done:()=>this.#T(),cancel:()=>this.#B()},t)},{type:"view",views:[{type:"button",props:Object.assign({id:this.id,bgcolor:$color("clear"),font:$font(r.fontSize),tintColor:a.textColor,titleColor:a.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},this.menu?{menu:this.menu}:{},this.title?{title:this.title}:{},this.props),views:[{type:"image",props:Object.assign({id:`icon-button-${this.id}`,hidden:void 0===this.symbol,tintColor:a.textColor},void 0===this.symbol?{}:"string"==typeof this.symbol?{symbol:this.symbol}:{data:this.symbol.png}),layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}},{type:"image",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:a.textColor,symbol:"checkmark"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(r.iconSize)}}],events:this.events,layout:$layout.fill},{type:"spinner",props:{id:"spinner-"+this.id,loading:!0,hidden:!0},layout:$layout.fill}],layout:(e,t)=>{if(this.title){const t=$text.sizeThatFits({text:this.title,width:a.windowSize.width,font:$font(r.fontSize)}),i=Math.ceil(t.width)+r.edges;e.size.equalTo($size(i,r.size.height))}else e.size.equalTo(r.size);if(e.centerY.equalTo(t.super),t.prev&&"label"!==t.prev.id&&void 0!==t.prev.id)this.align===a.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=r.edges/2;this.align===a.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=a.align.right}={}){const l=new r;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{height=20;topOffset=15;bottomOffset=10;controller={};setController(e){return this.controller=e,this}},BarButtonItem:r,NavigationBarItems:class{rightButtons=[];leftButtons=[];hasbutton=!1;isPinTitleView=!1;setTitleView(e){return this.titleView=e,this}pinTitleView(){return this.isPinTitleView=!0,this}setFixedFooterView(e){return this.fixedFooterView=e,this}setRightButtons(e){return e.forEach((e=>this.addRightButton(e))),this.hasbutton||(this.hasbutton=!0),this}setLeftButtons(e){return e.forEach((e=>this.addLeftButton(e))),this.hasbutton||(this.hasbutton=!0),this}addRightButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.rightButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(r.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:a.align.left}).definition),this.hasbutton||(this.hasbutton=!0),this}addPopButton(e,t){return e||(e=$l10n("BACK")),this.popButtonView=t??{type:"button",props:{bgcolor:$color("clear"),symbol:"chevron.left",tintColor:a.linkColor,title:` ${e}`,titleColor:a.linkColor,font:$font("bold",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(r.edges),e.centerY.equalTo(t.super.safeArea)},events:{tapped:()=>{$ui.pop()}}},this}removePopButton(){return this.popButtonView=void 0,this}}}})),parcelRequire.register("gMc1q",(function(e,t){var i=parcelRequire("fYz8N").Controller;e.exports={ViewController:class extends i{#q=[];#S(e){this.callEvent("onPop",e),this.#q.pop()}push(e){const t=this.#q[this.#q.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#q.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#S(e)}},views:[e.getPage().definition],layout:$layout.fill})}}}}));var $czAIJ=parcelRequire("czAIJ"),$bb0fea222fc5aea5$require$VERSION=$czAIJ.VERSION,$fYz8N=parcelRequire("fYz8N"),$bb0fea222fc5aea5$require$Controller=$fYz8N.Controller,$272f042430a952c6$exports={},$45Ip7=parcelRequire("45Ip7"),$272f042430a952c6$require$UIKit=$45Ip7.UIKit,$aXWmO=parcelRequire("aXWmO"),$272f042430a952c6$require$Sheet=$aXWmO.Sheet,$cgaQ6=parcelRequire("cgaQ6"),$272f042430a952c6$require$Kernel=$cgaQ6.Kernel,$12xzj=parcelRequire("12xzj"),$272f042430a952c6$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$272f042430a952c6$require$NavigationBar=$dcStC.NavigationBar;class $272f042430a952c6$var$FileManager{viewController;constructor(){this.listId="file-manager-list",this.edges=10,this.iconSize=25,this.loadL10n()}loadL10n(){$272f042430a952c6$require$Kernel.l10n("zh-Hans",'\n "CONFIRM_DELETE_MSG" = "确认要删除吗";\n "DELETE" = "删除";\n "CANCEL" = "取消";\n "CLOSE" = "关闭";\n "SHARE" = "分享";\n "SAVE" = "保存";\n "SAVE_SUCCESS" = "保存成功";\n '),$272f042430a952c6$require$Kernel.l10n("en",'\n "CONFIRM_DELETE_MSG" = "Are you sure you want to delete";\n "DELETE" = "Delete";\n "CANCEL" = "Cancel";\n "CLOSE" = "Close";\n "SHARE" = "Share";\n "SAVE" = "Save";\n "SAVE_SUCCESS" = "Save Success";\n ')}setViewController(e){this.viewController=e}get menu(){return{items:[{title:$l10n("SHARE"),symbol:"square.and.arrow.up",handler:async(e,t)=>{const i=e.object(t).info.info;$share.sheet([$file.absolutePath(i.path)])}}]}}delete(e){$file.delete(e.path)}edit(e){const t=$file.read(e.path);if(t.image)$quicklook.open({image:t.image});else{const i=new $272f042430a952c6$require$Sheet,a=$text.uuid;i.setView({type:"code",layout:$layout.fill,props:{id:a,lineNumbers:!0,theme:$device.isDarkMode?"atom-one-dark":"atom-one-light",text:t.string,insets:$insets(15,15,15,15)}}).addNavBar({title:e.file,popButton:{title:$l10n("CLOSE")},rightButtons:[{title:$l10n("SAVE"),tapped:()=>{$file.write({data:$data({string:$(a).text}),path:e.path}),$ui.success($l10n("SAVE_SUCCESS"))}}]}),i.init().present()}}getFiles(e=""){return $file.list(e).map((t=>{const i=e+"/"+t,a=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:a}},icon:{symbol:a?"folder.fill":"doc"},name:{text:t},size:{text:a?"":"--"}}})).sort(((e,t)=>e.info.info.isDirectory!==t.info.info.isDirectory?e.info.info.isDirectory?-1:1:e.info.info.isDirectory===t.info.info.isDirectory?e.info.info.file.localeCompare(t.info.info.file):void 0))}async loadFileSize(e){return e.map(((t,i)=>{const a=t.info.info;if(!a.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(a.path).info.size)}catch(t){e[i].size.text=t}})),e}get listTemplate(){return{props:{bgcolor:$color("clear")},views:[{props:{id:"info"}},{type:"image",props:{id:"icon"},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(this.edges),e.size.equalTo(this.iconSize)}},{type:"label",props:{id:"name",lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(this.edges)}},{type:"label",props:{id:"size",color:$color("secondaryText"),lines:1},layout:(e,t)=>{e.centerY.equalTo(t.super),e.right.inset(this.edges)}}]}}#C(e,t){if(this.viewController){const i=new $272f042430a952c6$require$NavigationView;i.setView(t).navigationBarTitle(e),i.navigationBar.setLargeTitleDisplayMode($272f042430a952c6$require$NavigationBar.largeTitleDisplayModeNever),this.viewController.push(i)}else $272f042430a952c6$require$UIKit.push({title:e,views:[t]})}getListView(e=""){return{type:"list",props:{id:this.listId,menu:this.menu,info:{basePath:e},bgcolor:$272f042430a952c6$require$UIKit.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:[],template:this.listTemplate,actions:[{title:" "+$l10n("DELETE")+" ",color:$color("red"),handler:(e,t)=>{const i=e.object(t).info.info;$272f042430a952c6$require$Kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG")+' "'+i.file+'" ?',(()=>{this.delete(i),e.delete(t)}))}}]},layout:$layout.fill,events:{ready:()=>{const t=this.getFiles(e);$(this.listId).data=t,this.loadFileSize(t).then((e=>{$(this.listId).data=e}))},pulled:async e=>{const t=this.getFiles($(this.listId).info.basePath);$(this.listId).data=t,$(this.listId).data=await this.loadFileSize(t),$delay(.5,(()=>{e.endRefreshing()}))},didSelect:(e,t,i)=>{const a=i.info.info;a.isDirectory?this.#C(a.file,this.getListView(a.path)):this.edit(a)}}}}push(e=""){const t=e.substring(e.lastIndexOf("/"));this.#C(t,this.getListView(e))}}$272f042430a952c6$exports={FileManager:$272f042430a952c6$var$FileManager};var $bb0fea222fc5aea5$require$FileManager=$272f042430a952c6$exports.FileManager,$8aDdQ=parcelRequire("8aDdQ"),$bb0fea222fc5aea5$require$FileStorageParameterError=$8aDdQ.FileStorageParameterError,$bb0fea222fc5aea5$require$FileStorageFileNotFoundError=$8aDdQ.FileStorageFileNotFoundError,$bb0fea222fc5aea5$require$FileStorage=$8aDdQ.FileStorage,$4c192cc93140b629$exports={},$liCrE=parcelRequire("liCrE"),$4c192cc93140b629$require$View=$liCrE.View,$45Ip7=parcelRequire("45Ip7"),$4c192cc93140b629$require$UIKit=$45Ip7.UIKit;class $4c192cc93140b629$var$FixedFooterView extends $4c192cc93140b629$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",$4c192cc93140b629$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height)},this.views=[$4c192cc93140b629$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}$4c192cc93140b629$exports={FixedFooterView:$4c192cc93140b629$var$FixedFooterView};var $bb0fea222fc5aea5$require$FixedFooterView=$4c192cc93140b629$exports.FixedFooterView,$cgaQ6=parcelRequire("cgaQ6"),$bb0fea222fc5aea5$require$Kernel=$cgaQ6.Kernel,$50aa538fe0dbd3b0$exports={},$liCrE=parcelRequire("liCrE"),$50aa538fe0dbd3b0$require$View=$liCrE.View;class $50aa538fe0dbd3b0$var$Matrix extends $50aa538fe0dbd3b0$require$View{titleStyle={font:$font("bold",21),height:30};#V;#I;templateIdByIndex(e){return void 0===this.props.template.views[e]?.props?.id&&(void 0===this.props.template.views[e].props&&(this.props.template.views[e].props={}),this.props.template.views[e].props.id=$text.uuid),this.props.template.views[e].props.id}get templateHiddenStatus(){if(!this.#I){this.#I={};for(let e=0;e(e.items=e.items.map((e=>(Object.keys(e).forEach((t=>{e[t].hidden=this.templateHiddenStatus[t]??!1})),Object.keys(this.templateHiddenStatus).forEach((t=>{e[t]||(e[t]={}),e[t].hidden=this.templateHiddenStatus[t]})),e.__templateProps={hidden:!1},e.__title={hidden:!0},e))),e.title&&e.items.unshift(this.#E(e.title)),e)))}rebuildTemplate(){let e={};void 0!==this.props.template.props&&(e=Object.assign(this.props.template.props,{id:"__templateProps",hidden:!1})),this.props.template.props={};const t=[{type:"view",props:e,layout:$layout.fill},{type:"label",props:{id:"__title",hidden:!0,font:this.titleStyle.font},layout:(e,t)=>{e.top.inset(-this.titleStyle.height/4*3),e.height.equalTo(this.titleStyle.height),e.width.equalTo(t.super.safeArea)}}].concat(this.props.template.views);this.props.template.views=t}insert(e,t=!0){return e.indexPath=this.indexPath(e.indexPath,t),$(this.id).insert(e)}delete(e,t=!0){return e=this.indexPath(e,t),$(this.id).delete(e)}object(e,t=!0){return e=this.indexPath(e,t),$(this.id).object(e)}cell(e,t=!0){return e=this.indexPath(e,t),$(this.id).cell(e)}indexPath(e,t){let i=t?0:1;return"number"==typeof e&&(e=$indexPath(0,e)),e=$indexPath(e.section,e.row+i)}update(e){this.props.data=this.rebuildData(e),$(this.id).data=this.props.data}getView(){return this.props.data=this.rebuildData(this.props.data),this.rebuildTemplate(),this.setEvent("itemSize",((e,t)=>{const i=e.object(t)?.__title?.info;if(i?.title)return $size(Math.max($device.info.screen.width,$device.info.screen.height),0);const a=this.props.columns??2,r=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-r*(a+1))/a,o=this.props.itemHeight??this.props.itemSize?.height??100;return $size(s,o)})),this}}$50aa538fe0dbd3b0$exports={Matrix:$50aa538fe0dbd3b0$var$Matrix};var $bb0fea222fc5aea5$require$Matrix=$50aa538fe0dbd3b0$exports.Matrix,$619319e3f3656d3f$exports={};class $619319e3f3656d3f$var$Request{static Method={get:"GET",post:"POST"};#x;#N=!1;#O=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#x||(this.#x=$text.MD5(this.baseUrl)),this.#x+$text.MD5(e)}setCache(e,t){$cache.set(e,t)}getCache(e,t=null){return $cache.get(e)??t}removeCache(e){$cache.remove(e)}useCache(){return this.#N=!0,this}ignoreCacheExp(){this.#O=!0}async request(e,t,i={},a={},r=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#N&&t===$619319e3f3656d3f$var$Request.Method.get;if(n){o=this.getCacheKey(e);const t=this.getCache(o);if(t&&(this.#O||t.exp>Date.now()))return this.isLogRequest&&this.kernel.print("get data from cache: "+s),t.data}try{this.isLogRequest&&this.kernel.print(`sending request [${t}]: ${s}`);const e=await $http.request({header:Object.assign({"Content-Type":"application/json"},a),url:s,method:t,body:i,timeout:this.timeout});if(e?.response?.statusCode>=400){let t=e.data;throw"object"==typeof t&&(t=JSON.stringify(t)),new Error("http error: ["+e.response.statusCode+"] "+t)}return n&&this.setCache(o,{exp:Date.now()+r,data:e.data}),e.data}catch(e){throw e.code&&(e=new Error("network error: ["+e.code+"] "+e.localizedDescription)),e}}}$619319e3f3656d3f$exports={Request:$619319e3f3656d3f$var$Request};var $bb0fea222fc5aea5$require$Request=$619319e3f3656d3f$exports.Request,$7D8Kb=parcelRequire("7D8Kb"),$bb0fea222fc5aea5$require$Setting=$7D8Kb.Setting,$aXWmO=parcelRequire("aXWmO"),$bb0fea222fc5aea5$require$Sheet=$aXWmO.Sheet,$7dfcabb1e936a92c$exports={},$liCrE=parcelRequire("liCrE"),$7dfcabb1e936a92c$require$View=$liCrE.View,$7dfcabb1e936a92c$require$PageView=$liCrE.PageView,$fYz8N=parcelRequire("fYz8N"),$7dfcabb1e936a92c$require$Controller=$fYz8N.Controller,$45Ip7=parcelRequire("45Ip7"),$7dfcabb1e936a92c$require$UIKit=$45Ip7.UIKit;class $7dfcabb1e936a92c$var$TabBarCellView extends $7dfcabb1e936a92c$require$View{constructor(e={}){super(e),this.setIcon(e.icon),this.setTitle(e.title),void 0!==e.activeStatus&&(this.activeStatus=e.activeStatus)}setIcon(e){return this.icon=e instanceof Array?e:[e,e],this}setTitle(e){return this.title=e,this}active(){$(`${this.props.id}-icon`).image=$image(this.icon[1]),$(`${this.props.id}-icon`).tintColor=$color("systemLink"),$(`${this.props.id}-title`).textColor=$color("systemLink"),this.activeStatus=!0}inactive(){$(`${this.props.id}-icon`).image=$image(this.icon[0]),$(`${this.props.id}-icon`).tintColor=$color("lightGray"),$(`${this.props.id}-title`).textColor=$color("lightGray"),this.activeStatus=!1}getView(){return this.views=[{type:"image",props:{id:`${this.props.id}-icon`,image:$image(this.activeStatus?this.icon[1]:this.icon[0]),bgcolor:$color("clear"),tintColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.super);const i=$7dfcabb1e936a92c$var$TabBarController.tabBarHeight/2;e.size.equalTo(i),e.top.inset(($7dfcabb1e936a92c$var$TabBarController.tabBarHeight-i-13)/2)}},{type:"label",props:{id:`${this.props.id}-title`,text:this.title,font:$font(10),textColor:$color(this.activeStatus?"systemLink":"lightGray")},layout:(e,t)=>{e.centerX.equalTo(t.prev),e.top.equalTo(t.prev.bottom).offset(3)}}],this}}class $7dfcabb1e936a92c$var$TabBarHeaderView extends $7dfcabb1e936a92c$require$View{height=60;getView(){return this.type="view",this.setProp("bgcolor",this.props.bgcolor??$7dfcabb1e936a92c$require$UIKit.primaryViewBackgroundColor),this.layout=(e,t)=>{e.left.right.bottom.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-this.height-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight)},this.views=[$7dfcabb1e936a92c$require$View.create({props:this.props,views:this.views,layout:(e,t)=>{e.left.right.top.equalTo(t.super),e.height.equalTo(this.height)}})],this}}class $7dfcabb1e936a92c$var$TabBarController extends $7dfcabb1e936a92c$require$Controller{static tabBarHeight=50;#k={};#L={};#R;#A;get selected(){return this.#A}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#R?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#A&&(this.#A=e),this.#k[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createByViews(t),this.#A!==e&&(this.#k[e].activeStatus=!1),this}switchPageTo(e){if(this.#k[e]){if(this.#A===e)return;$ui.animate({duration:.4,animation:()=>{this.#L[e].active()}}),this.#L[this.#A].inactive(),this.#k[this.#A].hide(),this.#k[e].show(),this.callEvent("onChange",this.#A,e),this.#A=e}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#A&&(this.#A=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#A===e})),this.#L[e]=t,this}setHeader(e){return this.#R=e,this}#D(){const e=[];return Object.values(this.#L).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#F(){return Object.values(this.#k).map((e=>{if($7dfcabb1e936a92c$require$UIKit.scrollViewList.indexOf(e.views[0].type)>-1){if(void 0===e.views[0].props&&(e.views[0].props={}),e.views[0].props.indicatorInsets){const t=e.views[0].props.indicatorInsets;e.views[0].props.indicatorInsets=$insets(t.top,t.left,t.bottom+this.contentOffset,t.right)}else e.views[0].props.indicatorInsets=$insets(0,0,0,this.contentOffset);e.views[0].footer=Object.assign({props:{}},e.views[0].footer??{}),e.views[0].props.footer.props.height?e.views[0].props.footer.props.height+=this.contentOffset:e.views[0].props.footer.props.height=this.contentOffset}return e.definition}))}generateView(){const e={type:"view",layout:(e,t)=>{e.centerX.equalTo(t.super),e.width.equalTo(t.super),e.top.equalTo(t.super.safeAreaBottom).offset(-$7dfcabb1e936a92c$var$TabBarController.tabBarHeight),e.bottom.equalTo(t.super)},views:[$7dfcabb1e936a92c$require$UIKit.blurBox({},[{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#D()}}}]),$7dfcabb1e936a92c$require$UIKit.separatorLine({},$7dfcabb1e936a92c$require$UIKit.align.top)]};return $7dfcabb1e936a92c$require$View.createByViews(this.#F().concat(this.#R?.definition??[],e))}}$7dfcabb1e936a92c$exports={TabBarCellView:$7dfcabb1e936a92c$var$TabBarCellView,TabBarHeaderView:$7dfcabb1e936a92c$var$TabBarHeaderView,TabBarController:$7dfcabb1e936a92c$var$TabBarController};var $bb0fea222fc5aea5$require$TabBarCellView=$7dfcabb1e936a92c$exports.TabBarCellView,$bb0fea222fc5aea5$require$TabBarHeaderView=$7dfcabb1e936a92c$exports.TabBarHeaderView,$bb0fea222fc5aea5$require$TabBarController=$7dfcabb1e936a92c$exports.TabBarController,$3839e9f9bae78bdd$exports={};class $3839e9f9bae78bdd$var$Tasks{#M={};addTask(e,t=0){const i=$text.uuid;return this.#M[i]=$delay(t,(async()=>{await e(),delete this.#M[i]})),i}cancelTask(e){this.#M[e].cancel()}clearTasks(){Object.values(this.#M).forEach((e=>e.cancel()))}}$3839e9f9bae78bdd$exports={Tasks:$3839e9f9bae78bdd$var$Tasks};var $bb0fea222fc5aea5$require$Tasks=$3839e9f9bae78bdd$exports.Tasks,$45Ip7=parcelRequire("45Ip7"),$bb0fea222fc5aea5$require$UIKit=$45Ip7.UIKit,$86d2ffde19fb8791$exports={};class $86d2ffde19fb8791$var$UILoading{#z;text="";interval;fullScreen=!1;#P=()=>{};constructor(){this.#z=$text.uuid}updateText(e){$(this.#z).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#P=e}done(){clearInterval(this.interval)}load(){$ui.render({props:{navBarHidden:this.fullScreen},views:[{type:"spinner",props:{loading:!0},layout:(e,t)=>{e.centerY.equalTo(t.super).offset(-15),e.width.equalTo(t.super)}},{type:"label",props:{id:this.#z,align:$align.center,text:""},layout:(e,t)=>{e.top.equalTo(t.prev.bottom).offset(10),e.left.right.equalTo(t.super)}}],layout:$layout.fill,events:{appeared:()=>{this.interval=setInterval((()=>{this.#P()}),100)}}})}}$86d2ffde19fb8791$exports={UILoading:$86d2ffde19fb8791$var$UILoading};var $bb0fea222fc5aea5$require$UILoading=$86d2ffde19fb8791$exports.UILoading,$6Xrbz=parcelRequire("6Xrbz"),$bb0fea222fc5aea5$require$ValidationError=$6Xrbz.ValidationError,$liCrE=parcelRequire("liCrE"),$bb0fea222fc5aea5$require$View=$liCrE.View,$bb0fea222fc5aea5$require$PageView=$liCrE.PageView,$gMc1q=parcelRequire("gMc1q"),$bb0fea222fc5aea5$require$ViewController=$gMc1q.ViewController,$12xzj=parcelRequire("12xzj"),$bb0fea222fc5aea5$require$NavigationView=$12xzj.NavigationView,$dcStC=parcelRequire("dcStC"),$bb0fea222fc5aea5$require$NavigationBar=$dcStC.NavigationBar,$bb0fea222fc5aea5$require$NavigationBarController=$dcStC.NavigationBarController,$gAYmG=parcelRequire("gAYmG"),$bb0fea222fc5aea5$require$NavigationBarItems=$gAYmG.NavigationBarItems,$bb0fea222fc5aea5$require$BarButtonItem=$gAYmG.BarButtonItem,$ee5e1f8d12d987dc$exports={},$fYz8N=parcelRequire("fYz8N"),$ee5e1f8d12d987dc$require$Controller=$fYz8N.Controller,$gAYmG=parcelRequire("gAYmG"),$ee5e1f8d12d987dc$require$BarTitleView=$gAYmG.BarTitleView;class $ee5e1f8d12d987dc$var$SearchBar extends $ee5e1f8d12d987dc$require$BarTitleView{height=35;topOffset=15;bottomOffset=10;kbType=$kbType.search;placeholder=$l10n("SEARCH");constructor(e){super(e),this.setController(new $ee5e1f8d12d987dc$var$SearchBarController),this.controller.setSearchBar(this),this.init()}init(){this.props={id:this.id,smoothCorners:!0,cornerRadius:6,bgcolor:$color("#EEF1F1","#212121")},this.views=[{type:"input",props:{id:this.id+"-input",type:this.kbType,bgcolor:$color("clear"),placeholder:this.placeholder},layout:$layout.fill,events:{changed:e=>this.controller.callEvent("onChange",e.text)}}],this.layout=(e,t)=>{e.height.equalTo(this.height),e.top.equalTo(t.super.safeArea).offset(this.topOffset),e.left.equalTo(t.super.safeArea).offset(15),e.right.equalTo(t.super.safeArea).offset(-15)}}setPlaceholder(e){return this.placeholder=e,this}setKbType(e){return this.kbType=e,this}}class $ee5e1f8d12d987dc$var$SearchBarController extends $ee5e1f8d12d987dc$require$Controller{setSearchBar(e){return this.searchBar=e,this}updateSelector(){this.selector={inputBox:$(this.searchBar.id),input:$(this.searchBar.id+"-input")}}hide(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(0)}))}show(){this.updateSelector(),this.selector.inputBox.updateLayout((e=>{e.height.equalTo(this.searchBar.height)}))}didScroll(e){this.updateSelector();let t=this.searchBar.height-e;if(t=t>0?t>this.searchBar.height?this.searchBar.height:t:0,this.selector.inputBox.updateLayout((e=>{e.height.equalTo(t)})),e>0){const t=(this.searchBar.height/2-5-e)/10;this.selector.input.alpha=t}else this.selector.input.alpha=1}didEndDragging(e,t,i){this.updateSelector(),e>=0&&e<=this.searchBar.height&&i($point(0,e>=this.searchBar.height/2?this.searchBar.height:0))}}$ee5e1f8d12d987dc$exports={SearchBar:$ee5e1f8d12d987dc$var$SearchBar,SearchBarController:$ee5e1f8d12d987dc$var$SearchBarController};var $bb0fea222fc5aea5$require$SearchBar=$ee5e1f8d12d987dc$exports.SearchBar,$bb0fea222fc5aea5$require$SearchBarController=$ee5e1f8d12d987dc$exports.SearchBarController;module.exports={VERSION:$bb0fea222fc5aea5$require$VERSION,Controller:$bb0fea222fc5aea5$require$Controller,FileManager:$bb0fea222fc5aea5$require$FileManager,FileStorageParameterError:$bb0fea222fc5aea5$require$FileStorageParameterError,FileStorageFileNotFoundError:$bb0fea222fc5aea5$require$FileStorageFileNotFoundError,FileStorage:$bb0fea222fc5aea5$require$FileStorage,FixedFooterView:$bb0fea222fc5aea5$require$FixedFooterView,Kernel:$bb0fea222fc5aea5$require$Kernel,Matrix:$bb0fea222fc5aea5$require$Matrix,Request:$bb0fea222fc5aea5$require$Request,Setting:$bb0fea222fc5aea5$require$Setting,Sheet:$bb0fea222fc5aea5$require$Sheet,TabBarCellView:$bb0fea222fc5aea5$require$TabBarCellView,TabBarHeaderView:$bb0fea222fc5aea5$require$TabBarHeaderView,TabBarController:$bb0fea222fc5aea5$require$TabBarController,Tasks:$bb0fea222fc5aea5$require$Tasks,UIKit:$bb0fea222fc5aea5$require$UIKit,UILoading:$bb0fea222fc5aea5$require$UILoading,ValidationError:$bb0fea222fc5aea5$require$ValidationError,View:$bb0fea222fc5aea5$require$View,PageView:$bb0fea222fc5aea5$require$PageView,ViewController:$bb0fea222fc5aea5$require$ViewController,NavigationView:$bb0fea222fc5aea5$require$NavigationView,NavigationBar:$bb0fea222fc5aea5$require$NavigationBar,NavigationBarController:$bb0fea222fc5aea5$require$NavigationBarController,NavigationBarItems:$bb0fea222fc5aea5$require$NavigationBarItems,BarButtonItem:$bb0fea222fc5aea5$require$BarButtonItem,SearchBar:$bb0fea222fc5aea5$require$SearchBar,SearchBarController:$bb0fea222fc5aea5$require$SearchBarController}; \ No newline at end of file diff --git a/scripts/widget/Calendar/calendar.js b/scripts/widget/Calendar/calendar.js index 6ab6e0c..3b92e24 100644 --- a/scripts/widget/Calendar/calendar.js +++ b/scripts/widget/Calendar/calendar.js @@ -688,13 +688,14 @@ class Calendar { // 计算周数 const dateInstance = new Date() const saturday = dateInstance.getDate() + (6 - dateInstance.getDay()) - const week = Math.ceil(saturday / 7) + const week = Math.ceil(saturday / 7) // start from 1 const length = this.calendar.calendar.length const weekStart = week + 2 > length ? length - 2 : week + const weekLength = Math.min(weekStart + 2, length) // 最多显示 3 周 // 生成视图 const days = this.weekIndexTemplate().views - for (let i = weekStart - 1; i < length; i++) { + for (let i = weekStart - 1; i < weekLength; i++) { // 设置不同日期显示不同样式 for (let dayInfo of this.calendar.calendar[i]) { const props = this.singleContentDayStyleModifier(dayInfo)