Advertisement
Guest User

index.html

a guest
May 17th, 2025
4
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 50.45 KB | Source Code | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en-US">
  3.  
  4. <head>
  5.   <title>Dovetail</title>
  6.   <meta charset="UTF-8">
  7.   <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, viewport-fit=cover">
  8.   <meta name="author" content="Brandon Bennett">
  9.   <meta name="description" content="A cross-platform NBT editor built on the web!">
  10.   <meta property="og:title" content="Dovetail">
  11.   <meta property="og:description" content="A cross-platform NBT editor built on the web!">
  12.   <!-- <meta property="og:image" content=""> -->
  13.   <meta property="og:url" content="https://offroaders123.github.io/Dovetail/">
  14.   <meta name="twitter:card" content="summary_large_image">
  15.   <meta name="color-scheme" content="light dark">
  16.   <meta name="theme-color" content="#445985">
  17.   <base href="" target="_blank">
  18.   <link rel="canonical" href="index.html">
  19.   <style rel="manifest">{
  20.   "name": "Dovetail",
  21.   "short_name": "Dovetail",
  22.   "description": "A cross-platform NBT editor built on the web!",
  23.   "start_url": "./",
  24.   "scope": "./",
  25.   "display": "standalone",
  26.   "display_override": ["window-controls-overlay"],
  27.   "theme_color": "#445985",
  28.   "background_color": "#445985",
  29.   "icons": [
  30.     {
  31.       "src": "./img/app-192.png",
  32.       "type": "image/png",
  33.       "sizes": "192x192"
  34.     },
  35.     {
  36.       "src": "./img/app-512.png",
  37.       "type": "image/png",
  38.       "sizes": "512x512"
  39.     },
  40.     {
  41.       "src": "./img/app-1024.png",
  42.       "type": "image/png",
  43.       "sizes": "1024x1024"
  44.     }
  45.   ],
  46.   "file_handlers": [
  47.     {
  48.       "action": "./",
  49.       "accept": {
  50.         "application/octet-stream": [".nbt", ".dat", ".dat_old", ".mcstructure", ".litematic", ".schem", ".schematic", ".snbt"]
  51.       }
  52.     }
  53.   ]
  54. }</style>
  55.   <link rel="icon" type="image/svg+xml" href="img/icon.svg">
  56.   <link rel="alternate icon" type="image/png" sizes="16x16" href="img/icon-16.png">
  57.   <link rel="alternate icon" type="image/png" sizes="32x32" href="img/icon-32.png">
  58.   <script type="module" crossorigin>(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const l of s.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const st=(t,e)=>t===e,ie={equals:st};let De=Ye;const P=1,se=2,ke={owned:null,cleanups:null,context:null,owner:null};var O=null;let de=null,ot=null,m=null,S=null,B=null,ae=0;function lt(t,e){const n=m,r=O,i=t.length===0,s=e===void 0?r:e,l=i?ke:{owned:null,cleanups:null,context:s?s.context:null,owner:s},o=i?t:()=>t(()=>W(()=>K(l)));O=l,m=null;try{return X(o,!0)}finally{m=n,O=r}}function N(t,e){e=e?Object.assign({},ie,e):ie;const n={value:t,observers:null,observerSlots:null,comparator:e.equals||void 0},r=i=>(typeof i=="function"&&(i=i(n.value)),Pe(n,i));return[Ve.bind(n),r]}function A(t,e,n){const r=pe(t,e,!1,P);Q(r)}function Fe(t,e,n){De=ht;const r=pe(t,e,!1,P);r.user=!0,B?B.push(r):Q(r)}function x(t,e,n){n=n?Object.assign({},ie,n):ie;const r=pe(t,e,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Q(r),Ve.bind(r)}function W(t){if(m===null)return t();const e=m;m=null;try{return t()}finally{m=e}}function ut(t){const e=x(t),n=x(()=>we(e()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}function Ve(){if(this.sources&&this.state)if(this.state===P)Q(this);else{const t=S;S=null,X(()=>le(this),!1),S=t}if(m){const t=this.observers?this.observers.length:0;m.sources?(m.sources.push(this),m.sourceSlots.push(t)):(m.sources=[this],m.sourceSlots=[t]),this.observers?(this.observers.push(m),this.observerSlots.push(m.sources.length-1)):(this.observers=[m],this.observerSlots=[m.sources.length-1])}return this.value}function Pe(t,e,n){let r=t.value;return(!t.comparator||!t.comparator(r,e))&&(t.value=e,t.observers&&t.observers.length&&X(()=>{for(let i=0;i<t.observers.length;i+=1){const s=t.observers[i],l=de&&de.running;l&&de.disposed.has(s),(l?!s.tState:!s.state)&&(s.pure?S.push(s):B.push(s),s.observers&&Me(s)),l||(s.state=P)}if(S.length>1e6)throw S=[],new Error},!1)),e}function Q(t){if(!t.fn)return;K(t);const e=ae;at(t,t.value,e)}function at(t,e,n){let r;const i=O,s=m;m=O=t;try{r=t.fn(e)}catch(l){return t.pure&&(t.state=P,t.owned&&t.owned.forEach(K),t.owned=null),t.updatedAt=n+1,je(l)}finally{m=s,O=i}(!t.updatedAt||t.updatedAt<=n)&&(t.updatedAt!=null&&"observers"in t?Pe(t,r):t.value=r,t.updatedAt=n)}function pe(t,e,n,r=P,i){const s={fn:t,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:e,owner:O,context:O?O.context:null,pure:n};return O===null||O!==ke&&(O.owned?O.owned.push(s):O.owned=[s]),s}function oe(t){if(t.state===0)return;if(t.state===se)return le(t);if(t.suspense&&W(t.suspense.inFallback))return t.suspense.effects.push(t);const e=[t];for(;(t=t.owner)&&(!t.updatedAt||t.updatedAt<ae);)t.state&&e.push(t);for(let n=e.length-1;n>=0;n--)if(t=e[n],t.state===P)Q(t);else if(t.state===se){const r=S;S=null,X(()=>le(t,e[0]),!1),S=r}}function X(t,e){if(S)return t();let n=!1;e||(S=[]),B?n=!0:B=[],ae++;try{const r=t();return ct(n),r}catch(r){n||(B=null),S=null,je(r)}}function ct(t){if(S&&(Ye(S),S=null),t)return;const e=B;B=null,e.length&&X(()=>De(e),!1)}function Ye(t){for(let e=0;e<t.length;e++)oe(t[e])}function ht(t){let e,n=0;for(e=0;e<t.length;e++){const r=t[e];r.user?t[n++]=r:oe(r)}for(e=0;e<n;e++)oe(t[e])}function le(t,e){t.state=0;for(let n=0;n<t.sources.length;n+=1){const r=t.sources[n];if(r.sources){const i=r.state;i===P?r!==e&&(!r.updatedAt||r.updatedAt<ae)&&oe(r):i===se&&le(r,e)}}}function Me(t){for(let e=0;e<t.observers.length;e+=1){const n=t.observers[e];n.state||(n.state=se,n.pure?S.push(n):B.push(n),n.observers&&Me(n))}}function K(t){let e;if(t.sources)for(;t.sources.length;){const n=t.sources.pop(),r=t.sourceSlots.pop(),i=n.observers;if(i&&i.length){const s=i.pop(),l=n.observerSlots.pop();r<i.length&&(s.sourceSlots[l]=r,i[r]=s,n.observerSlots[r]=l)}}if(t.tOwned){for(e=t.tOwned.length-1;e>=0;e--)K(t.tOwned[e]);delete t.tOwned}if(t.owned){for(e=t.owned.length-1;e>=0;e--)K(t.owned[e]);t.owned=null}if(t.cleanups){for(e=t.cleanups.length-1;e>=0;e--)t.cleanups[e]();t.cleanups=null}t.state=0}function ft(t){return t instanceof Error?t:new Error(typeof t=="string"?t:"Unknown error",{cause:t})}function je(t,e=O){throw ft(t)}function we(t){if(typeof t=="function"&&!t.length)return we(t());if(Array.isArray(t)){const e=[];for(let n=0;n<t.length;n++){const r=we(t[n]);Array.isArray(r)?e.push.apply(e,r):e.push(r)}return e}return t}function f(t,e){return W(()=>t(e||{}))}const dt=t=>`Stale read from <${t}>.`;function gt(t){let e=!1;const n=(s,l)=>(e?s[1]===l[1]:!s[1]==!l[1])&&s[2]===l[2],r=ut(()=>t.children),i=x(()=>{let s=r();Array.isArray(s)||(s=[s]);for(let l=0;l<s.length;l++){const o=s[l].when;if(o)return e=!!s[l].keyed,[l,o,s[l]]}return[-1]},void 0,{equals:n});return x(()=>{const[s,l,o]=i();if(s<0)return t.fallback;const a=o.children;return typeof a=="function"&&a.length>0?W(()=>a(e?l:()=>{if(W(i)[0]!==s)throw dt("Match");return o.when})):a},void 0,void 0)}function R(t){return t}function wt(t,e,n){let r=n.length,i=e.length,s=r,l=0,o=0,a=e[i-1].nextSibling,c=null;for(;l<i||o<s;){if(e[l]===n[o]){l++,o++;continue}for(;e[i-1]===n[s-1];)i--,s--;if(i===l){const d=s<r?o?n[o-1].nextSibling:n[s-o]:a;for(;o<s;)t.insertBefore(n[o++],d)}else if(s===o)for(;l<i;)(!c||!c.has(e[l]))&&e[l].remove(),l++;else if(e[l]===n[s-1]&&n[o]===e[i-1]){const d=e[--i].nextSibling;t.insertBefore(n[o++],e[l++].nextSibling),t.insertBefore(n[--s],d),e[i]=n[s]}else{if(!c){c=new Map;let b=o;for(;b<s;)c.set(n[b],b++)}const d=c.get(e[l]);if(d!=null)if(o<d&&d<s){let b=l,I=1,p;for(;++b<i&&b<s&&!((p=c.get(e[b]))==null||p!==d+I);)I++;if(I>d-o){const E=e[l];for(;o<d;)t.insertBefore(n[o++],E)}else t.replaceChild(n[o++],e[l++])}else l++;else e[l++].remove()}}}const Ne="_$DX_DELEGATE";function mt(t,e,n,r={}){let i;return lt(s=>{i=s,e===document?t():L(e,t(),e.firstChild?null:void 0,n)},r.owner),()=>{i(),e.textContent=""}}function _(t,e,n){let r;const i=()=>{const l=document.createElement("template");return l.innerHTML=t,l.content.firstChild},s=()=>(r||(r=i())).cloneNode(!0);return s.cloneNode=s,s}function Ee(t,e=window.document){const n=e[Ne]||(e[Ne]=new Set);for(let r=0,i=t.length;r<i;r++){const s=t[r];n.has(s)||(n.add(s),e.addEventListener(s,bt))}}function $e(t,e,n){n==null?t.removeAttribute(e):t.setAttribute(e,n)}function yt(t,e,n){return W(()=>t(e,n))}function L(t,e,n,r){if(n!==void 0&&!r&&(r=[]),typeof e!="function")return ue(t,e,r,n);A(i=>ue(t,e(),i,n),r)}function bt(t){let e=t.target;const n=`$$${t.type}`,r=t.target,i=t.currentTarget,s=a=>Object.defineProperty(t,"target",{configurable:!0,value:a}),l=()=>{const a=e[n];if(a&&!e.disabled){const c=e[`${n}Data`];if(c!==void 0?a.call(e,c,t):a.call(e,t),t.cancelBubble)return}return e.host&&typeof e.host!="string"&&!e.host._$host&&e.contains(t.target)&&s(e.host),!0},o=()=>{for(;l()&&(e=e._$host||e.parentNode||e.host););};if(Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return e||document}}),t.composedPath){const a=t.composedPath();s(a[0]);for(let c=0;c<a.length-2&&(e=a[c],!!l());c++){if(e._$host){e=e._$host,o();break}if(e.parentNode===i)break}}else o();s(r)}function ue(t,e,n,r,i){for(;typeof n=="function";)n=n();if(e===n)return n;const s=typeof e,l=r!==void 0;if(t=l&&n[0]&&n[0].parentNode||t,s==="string"||s==="number"){if(s==="number"&&(e=e.toString(),e===n))return n;if(l){let o=n[0];o&&o.nodeType===3?o.data!==e&&(o.data=e):o=document.createTextNode(e),n=z(t,n,r,o)}else n!==""&&typeof n=="string"?n=t.firstChild.data=e:n=t.textContent=e}else if(e==null||s==="boolean")n=z(t,n,r);else{if(s==="function")return A(()=>{let o=e();for(;typeof o=="function";)o=o();n=ue(t,o,n,r)}),()=>n;if(Array.isArray(e)){const o=[],a=n&&Array.isArray(n);if(me(o,e,n,i))return A(()=>n=ue(t,o,n,r,!0)),()=>n;if(o.length===0){if(n=z(t,n,r),l)return n}else a?n.length===0?_e(t,o,r):wt(t,n,o):(n&&z(t),_e(t,o));n=o}else if(e.nodeType){if(Array.isArray(n)){if(l)return n=z(t,n,r,e);z(t,n,null,e)}else n==null||n===""||!t.firstChild?t.appendChild(e):t.replaceChild(e,t.firstChild);n=e}}return n}function me(t,e,n,r){let i=!1;for(let s=0,l=e.length;s<l;s++){let o=e[s],a=n&&n[t.length],c;if(!(o==null||o===!0||o===!1))if((c=typeof o)=="object"&&o.nodeType)t.push(o);else if(Array.isArray(o))i=me(t,o,a)||i;else if(c==="function")if(r){for(;typeof o=="function";)o=o();i=me(t,Array.isArray(o)?o:[o],Array.isArray(a)?a:[a])||i}else t.push(o),i=!0;else{const d=String(o);a&&a.nodeType===3&&a.data===d?t.push(a):t.push(document.createTextNode(d))}}return i}function _e(t,e,n=null){for(let r=0,i=e.length;r<i;r++)t.insertBefore(e[r],n)}function z(t,e,n,r){if(n===void 0)return t.textContent="";const i=r||document.createTextNode("");if(e.length){let s=!1;for(let l=e.length-1;l>=0;l--){const o=e[l];if(i!==o){const a=o.parentNode===t;!s&&!l?a?t.replaceChild(i,o):t.insertBefore(i,n):a&&o.remove()}else s=!0}}else t.insertBefore(i,n);return[i]}const pt="modulepreload",Et=function(t,e){return new URL(t,e).href},Ce={},$t=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){const l=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");i=Promise.allSettled(n.map(c=>{if(c=Et(c,r),c in Ce)return;Ce[c]=!0;const d=c.endsWith(".css"),b=d?'[rel="stylesheet"]':"";if(!!r)for(let E=l.length-1;E>=0;E--){const D=l[E];if(D.href===c&&(!d||D.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${b}`))return;const p=document.createElement("link");if(p.rel=d?"stylesheet":pt,d||(p.as="script"),p.crossOrigin="",p.href=c,a&&p.setAttribute("nonce",a),document.head.appendChild(p),d)return new Promise((E,D)=>{p.addEventListener("load",E),p.addEventListener("error",()=>D(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(l){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=l,window.dispatchEvent(o),!o.defaultPrevented)throw l}return i.then(l=>{for(const o of l||[])o.status==="rejected"&&s(o.reason);return e().catch(s)})},St=(()=>{try{return new CompressionStream("deflate-raw"),new DecompressionStream("deflate-raw"),!1}catch{return!0}})();if(St){const{makeCompressionStream:t,makeDecompressionStream:e}=await $t(async()=>{const{makeCompressionStream:n,makeDecompressionStream:r}=await import("../ponyfill-BYj3Kftv.js");return{makeCompressionStream:n,makeDecompressionStream:r}},[],import.meta.url);globalThis.CompressionStream=t(TransformStream),globalThis.DecompressionStream=e(TransformStream)}/**
  59.  * @module mutf-8
  60.  * @copyright 2020 sciencesakura
  61.  * @license MIT
  62.  */var k=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Re=function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},F,ne,re,Y;class Tt{get encoding(){return"mutf-8"}get fatal(){return k(this,ne,"f")}get ignoreBOM(){return k(this,re,"f")}constructor(e="mutf-8",n={}){var r,i;F.add(this),ne.set(this,void 0),re.set(this,void 0);const s=e.toLowerCase();if(s!=="mutf-8"&&s!=="mutf8")throw new RangeError(`MUtf8Decoder.constructor: '${e}' is not supported.`);Re(this,ne,(r=n.fatal)!==null&&r!==void 0?r:!1,"f"),Re(this,re,(i=n.ignoreBOM)!==null&&i!==void 0?i:!1,"f")}decode(e,n={}){const r=e instanceof Uint8Array?e:new Uint8Array("buffer"in e?e.buffer:e),i=r.length,s=[];let l=0;for(;l<i;){const o=r[l++];if(!(o&128)&&o!==0)s.push(String.fromCharCode(o));else if((o&224)===192){if(i<=l){s.push(k(this,F,"m",Y).call(this));continue}const a=r[l++];if((a&192)!==128){s.push(k(this,F,"m",Y).call(this)),l--;continue}s.push(String.fromCharCode((o&31)<<6|a&63))}else if((o&240)===224){if(i<=l+1){s.push(k(this,F,"m",Y).call(this));continue}const a=r[l++];if((a&192)!==128){s.push(k(this,F,"m",Y).call(this)),l--;continue}const c=r[l++];if((c&192)!==128){s.push(k(this,F,"m",Y).call(this)),l-=2;continue}if(l===3&&o===239&&a===187&&c===191&&!this.ignoreBOM)continue;s.push(String.fromCharCode((o&15)<<12|(a&63)<<6|c&63))}else s.push(k(this,F,"m",Y).call(this))}return s.join("")}}ne=new WeakMap,re=new WeakMap,F=new WeakSet,Y=function(){if(this.fatal)throw new TypeError("MUtf8Decoder.decode: Decoding failed.");return"�"};class Ot{get encoding(){return"mutf-8"}encode(e=""){const n=[];for(const r of e){const i=r.codePointAt(0);1<=i&&i<=127?n.push(i):i<=2047?(n.push(192|i>>>6),n.push(128|63&i)):i<=65535?(n.push(224|i>>>12),n.push(128|63&i>>>6),n.push(128|63&i)):(n.push(237),n.push(160|(i>>>16)-1),n.push(128|63&i>>>10),n.push(237),n.push(176|15&i>>>6),n.push(128|63&i))}return new Uint8Array(n)}encodeInto(e,n){const r=n.length;let i=0,s=0;for(const l of e){const o=l.codePointAt(0);if(1<=o&&o<=127){if(r<=i)break;n[i++]=o}else if(o<=2047){if(r<=i+1)break;n[i++]=192|o>>>6,n[i++]=128|63&o}else if(o<=65535){if(r<=i+2)break;n[i++]=224|o>>>12,n[i++]=128|63&o>>>6,n[i++]=128|63&o}else{if(r<=i+5)break;n[i++]=237,n[i++]=160|(o>>>16)-1,n[i++]=128|63&o>>>10,n[i++]=237,n[i++]=176|15&o>>>6,n[i++]=128|63&o,s++}s++}return{read:s,written:i}}}class U{data;rootName;endian;compression;bedrockLevel;#t=null;constructor(e,n={}){e instanceof U&&(n.rootName===void 0&&(n.rootName=e.rootName),n.endian===void 0&&(n.endian=e.endian),n.compression===void 0&&(n.compression=e.compression),n.bedrockLevel===void 0&&(n.bedrockLevel=e.bedrockLevel),e=e.data);const{rootName:r="",endian:i="big",compression:s=null,bedrockLevel:l=!1}=n;this.data=e,this.rootName=r,this.endian=i,this.compression=s,this.bedrockLevel=l}get byteOffset(){return this.#t}set byteOffset(e){this.#t=e}get[Symbol.toStringTag](){return"NBTData"}}const ce=Symbol.for("nodejs.util.inspect.custom");class he extends Number{constructor(e){super(e<<24>>24)}valueOf(){return super.valueOf()}get[Symbol.toStringTag](){return"Int8"}get[ce](){return(e,{stylize:n})=>n(`${this.valueOf()}b`,"number")}}class Se extends Number{constructor(e){super(e<<16>>16)}valueOf(){return super.valueOf()}get[Symbol.toStringTag](){return"Int16"}get[ce](){return(e,{stylize:n})=>n(`${this.valueOf()}s`,"number")}}class M extends Number{constructor(e){super(e|0)}valueOf(){return super.valueOf()}get[Symbol.toStringTag](){return"Int32"}get[ce](){return()=>this.valueOf()}}class Te extends Number{constructor(e){super(e)}valueOf(){return super.valueOf()}get[Symbol.toStringTag](){return"Float32"}get[ce](){return(e,{stylize:n})=>n(`${this.valueOf()}f`,"number")}}var u;(function(t){t[t.END=0]="END",t[t.BYTE=1]="BYTE",t[t.SHORT=2]="SHORT",t[t.INT=3]="INT",t[t.LONG=4]="LONG",t[t.FLOAT=5]="FLOAT",t[t.DOUBLE=6]="DOUBLE",t[t.BYTE_ARRAY=7]="BYTE_ARRAY",t[t.STRING=8]="STRING",t[t.LIST=9]="LIST",t[t.COMPOUND=10]="COMPOUND",t[t.INT_ARRAY=11]="INT_ARRAY",t[t.LONG_ARRAY=12]="LONG_ARRAY"})(u||(u={}));Object.freeze(u);const He=Symbol("nbtify.tag.type");function Oe(t){return $(t)!==null}function At(t){return typeof t=="number"&&t in u}function $(t){switch(!0){case t instanceof he:case typeof t=="boolean":return u.BYTE;case t instanceof Se:return u.SHORT;case t instanceof M:return u.INT;case typeof t=="bigint":return u.LONG;case t instanceof Te:return u.FLOAT;case typeof t=="number":return u.DOUBLE;case t instanceof Int8Array:case t instanceof Uint8Array:return u.BYTE_ARRAY;case typeof t=="string":return u.STRING;case t instanceof Array:return u.LIST;case t instanceof Int32Array:case t instanceof Uint32Array:return u.INT_ARRAY;case t instanceof BigInt64Array:case t instanceof BigUint64Array:return u.LONG_ARRAY;case(typeof t=="object"&&t!==null):return u.COMPOUND;default:return null}}async function xt(t,e){const n=new CompressionStream(e);return We(t,n)}async function ze(t,e){const n=new DecompressionStream(e);return We(t,n)}async function We(t,{readable:e,writable:n}){const r=n.getWriter();r.write(t).catch(()=>{}),r.close().catch(()=>{});const i=[];let s=0;const l=Lt(e);for await(const c of l)i.push(c),s+=c.byteLength;const o=new Uint8Array(s);let a=0;for(const c of i)o.set(c,a),a+=c.byteLength;return o}function Lt(t){return typeof t[Symbol.asyncIterator]>"u"?vt(t):t}async function*vt(t){const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)return;yield r}}finally{e.releaseLock()}}async function V(t,e={}){if(t instanceof Blob&&(t=await t.arrayBuffer()),"byteOffset"in t||(t=new Uint8Array(t)),!(t instanceof Uint8Array))throw new TypeError("First parameter must be a Uint8Array, ArrayBuffer, SharedArrayBuffer, or Blob");const n=new Nt(t,e.endian!=="big",e.endian==="little-varint");let{rootName:r,endian:i,compression:s,bedrockLevel:l,strict:o=!0}=e;if(r!==void 0&&typeof r!="boolean"&&typeof r!="string"&&r!==null)throw new TypeError("Root Name option must be a boolean, string, or null");if(i!==void 0&&i!=="big"&&i!=="little"&&i!=="little-varint")throw new TypeError("Endian option must be a valid endian type");if(s!==void 0&&s!=="deflate"&&s!=="deflate-raw"&&s!=="gzip"&&s!==null)throw new TypeError("Compression option must be a valid compression type");if(l!==void 0&&typeof l!="boolean"&&typeof l!="number"&&l!==null)throw new TypeError("Bedrock Level option must be a boolean, number, or null");if(typeof o!="boolean")throw new TypeError("Strict option must be a boolean");e:if(s===void 0){switch(!0){case n.hasGzipHeader():s="gzip";break e;case n.hasZlibHeader():s="deflate";break e}try{return await V(t,{...e,compression:null})}catch(a){try{return await V(t,{...e,compression:"deflate-raw"})}catch{throw a}}}if(i===void 0)try{return await V(t,{...e,endian:"big"})}catch(a){try{return await V(t,{...e,endian:"little"})}catch{try{return await V(t,{...e,endian:"little-varint"})}catch{throw a}}}if(r===void 0)try{return await V(t,{...e,rootName:!0})}catch(a){try{return await V(t,{...e,rootName:!1})}catch{throw a}}return s!==null&&(t=await ze(t,s)),l===void 0&&(l=n.hasBedrockLevelHeader(i)),n.readRoot({rootName:r,endian:i,compression:s,bedrockLevel:l,strict:o})}class Nt{#t=0;#e;#n;#s;#i;#l=new Tt;constructor(e,n,r){this.#e=e,this.#n=new DataView(e.buffer,e.byteOffset,e.byteLength),this.#s=n,this.#i=r}hasGzipHeader(){return this.#n.getUint16(0,!1)===8075}hasZlibHeader(){return this.#n.getUint8(0)===120}hasBedrockLevelHeader(e){return e!=="little"||this.#e.byteLength<8?!1:this.#n.getUint32(4,!0)===this.#e.byteLength-8}#r(e){if(this.#t+e>this.#e.byteLength)throw new Error("Ran out of bytes to read, unexpectedly reached the end of the buffer")}async readRoot({rootName:e,endian:n,compression:r,bedrockLevel:i,strict:s}){r!==null&&(this.#e=await ze(this.#e,r),this.#n=new DataView(this.#e.buffer)),i&&(this.#y(),this.#y());const l=this.#h();if(l!==u.LIST&&l!==u.COMPOUND)throw new Error(`Expected an opening List or Compound tag at the start of the buffer, encountered tag type '${l}'`);const o=typeof e=="string"||e?this.#b():null;if(typeof e=="string"&&o!==e)throw new Error(`Expected root name '${e}', encountered '${o}'`);const a=this.#g(l);if(s&&this.#e.byteLength>this.#t){const d=this.#e.byteLength-this.#t;throw new Error(`Encountered unexpected End tag at byte offset ${this.#t}, ${d} unread bytes remaining`)}const c=new U(a,{rootName:o,endian:n,compression:r,bedrockLevel:i});return s||(c.byteOffset=this.#t),c}#g(e){switch(e){case u.END:{const n=this.#e.byteLength-this.#t;throw new Error(`Encountered unexpected End tag at byte offset ${this.#t}, ${n} unread bytes remaining`)}case u.BYTE:return this.#f();case u.SHORT:return this.#m();case u.INT:return this.#i?this.#w():this.#o();case u.LONG:return this.#i?this.#E():this.#d();case u.FLOAT:return this.#$();case u.DOUBLE:return this.#S();case u.BYTE_ARRAY:return this.#T();case u.STRING:return this.#b();case u.LIST:return this.#p();case u.COMPOUND:return this.#O();case u.INT_ARRAY:return this.#A();case u.LONG_ARRAY:return this.#x();default:throw new Error(`Encountered unsupported tag type '${e}' at byte offset ${this.#t}`)}}#h(){const e=this.#a();if(!At(e))throw new Error(`Encountered unsupported tag type '${e}' at byte offset ${this.#t}`);return e}#a(){this.#r(1);const e=this.#n.getUint8(this.#t);return this.#t+=1,e}#f(e=!1){this.#r(1);const n=this.#n.getInt8(this.#t);return this.#t+=1,e?n:new he(n)}#c(){this.#r(2);const e=this.#n.getUint16(this.#t,this.#s);return this.#t+=2,e}#m(e=!1){this.#r(2);const n=this.#n.getInt16(this.#t,this.#s);return this.#t+=2,e?n:new Se(n)}#y(){this.#r(4);const e=this.#n.getUint32(this.#t,this.#s);return this.#t+=4,e}#o(e=!1){this.#r(4);const n=this.#n.getInt32(this.#t,this.#s);return this.#t+=4,e?n:new M(n)}#u(){let e=0,n=0,r;for(;r=this.#f(!0),e|=(r&127)<<n,!!(r&128);)n+=7;return e}#w(e=!1){let n=0,r=0;for(;;){this.#r(1);const s=this.#f(!0);if(n|=(s&127)<<r,!(s&128))break;if(r+=7,r>63)throw new Error(`VarInt size '${r}' at byte offset ${this.#t} is too large`)}const i=(n<<63>>63^n)>>1^n&1<<63;return e?i:new M(i)}#d(){this.#r(8);const e=this.#n.getBigInt64(this.#t,this.#s);return this.#t+=8,e}#E(){let e=0n,n=0n;for(;;){this.#r(1);const i=this.#f(!0);if(e|=(BigInt(i)&0x7fn)<<n,!(i&128))break;if(n+=7n,n>63n)throw new Error(`VarLong size '${n}' at byte offset ${this.#t} is too large`)}return e>>1n^-(e&1n)}#$(e=!1){this.#r(4);const n=this.#n.getFloat32(this.#t,this.#s);return this.#t+=4,e?n:new Te(n)}#S(){this.#r(8);const e=this.#n.getFloat64(this.#t,this.#s);return this.#t+=8,e}#T(){const e=this.#i?this.#w(!0):this.#o(!0);this.#r(e);const n=new Int8Array(this.#e.subarray(this.#t,this.#t+e));return this.#t+=e,n}#b(){const e=this.#i?this.#u():this.#c();this.#r(e);const n=this.#l.decode(this.#e.subarray(this.#t,this.#t+e));return this.#t+=e,n}#p(){const e=this.#h(),n=this.#i?this.#w(!0):this.#o(!0),r=[];Object.defineProperty(r,He,{configurable:!0,enumerable:!1,writable:!0,value:e});for(let i=0;i<n;i++){const s=this.#g(e);r.push(s)}return r}#O(){const e={};for(;;){const n=this.#h();if(n===u.END)break;const r=this.#b(),i=this.#g(n);e[r]=i}return e}#A(){const e=this.#i?this.#w(!0):this.#o(!0),n=new Int32Array(e);for(const r in n){const i=this.#o(!0);n[r]=i}return n}#x(){const e=this.#i?this.#w(!0):this.#o(!0),n=new BigInt64Array(e);for(const r in n){const i=this.#d();n[r]=i}return n}}async function _t(t,e={}){t=new U(t,e);const{rootName:n,endian:r,compression:i,bedrockLevel:s}=t;if(typeof t!="object"||t===null)throw new TypeError("First parameter must be an object or array");if(n!==void 0&&typeof n!="string"&&n!==null)throw new TypeError("Root Name option must be a string or null");if(r!==void 0&&r!=="big"&&r!=="little"&&r!=="little-varint")throw new TypeError("Endian option must be a valid endian type");if(i!==void 0&&i!=="deflate"&&i!=="deflate-raw"&&i!=="gzip"&&i!==null)throw new TypeError("Compression option must be a valid compression type");if(s!==void 0&&typeof s!="boolean")throw new TypeError("Bedrock Level option must be a boolean");return new Ct(r!=="big",r==="little-varint").writeRoot(t)}class Ct{#t=0;#e=new Uint8Array(1024);#n=new DataView(this.#e.buffer);#s;#i;#l=new Ot;constructor(e,n){this.#s=e,this.#i=n}#r(e){const n=this.#t+e;if(this.#e.byteLength>=n)return;let r=this.#e.byteLength;for(;r<n;)r*=2;const i=new Uint8Array(r);i.set(this.#e,0),this.#t>this.#e.byteLength&&i.fill(0,e,this.#t),this.#e=i,this.#n=new DataView(i.buffer)}#g(){return this.#r(0),this.#e.slice(0,this.#t)}async writeRoot(e){const{data:n,rootName:r,endian:i,compression:s,bedrockLevel:l}=e,o=i!=="big",a=$(n);if(a!==u.LIST&&a!==u.COMPOUND)throw new TypeError(`Encountered unexpected Root tag type '${a}', must be either a List or Compound tag`);if(l&&(this.#o(0),this.#o(0)),this.#a(a),r!==null&&this.#p(r),this.#h(n),l){if(o!==!0)throw new TypeError("Endian option must be 'little' when the Bedrock Level flag is enabled");if(!("StorageVersion"in n)||!(n.StorageVersion instanceof M))throw new TypeError("Expected a 'StorageVersion' Int tag when Bedrock Level flag is enabled");const d=n.StorageVersion.valueOf(),b=this.#t-8;this.#n.setUint32(0,d,o),this.#n.setUint32(4,b,o)}let c=this.#g();return s!==null&&(c=await xt(c,s)),c}#h(e){const n=$(e);switch(n){case u.BYTE:return this.#c(e);case u.SHORT:return this.#y(e);case u.INT:return this.#i?this.#d(e):this.#u(e);case u.LONG:return this.#i?this.#$(e):this.#E(e);case u.FLOAT:return this.#S(e);case u.DOUBLE:return this.#T(e);case u.BYTE_ARRAY:return this.#b(e);case u.STRING:return this.#p(e);case u.LIST:return this.#O(e);case u.COMPOUND:return this.#A(e);case u.INT_ARRAY:return this.#x(e);case u.LONG_ARRAY:return this.#L(e);default:throw new Error(`Encountered unsupported tag type '${n}'`)}}#a(e){return this.#f(e),this}#f(e){return this.#r(1),this.#n.setUint8(this.#t,e),this.#t+=1,this}#c(e){return this.#r(1),this.#n.setInt8(this.#t,Number(e.valueOf())),this.#t+=1,this}#m(e){return this.#r(2),this.#n.setUint16(this.#t,e,this.#s),this.#t+=2,this}#y(e){return this.#r(2),this.#n.setInt16(this.#t,e.valueOf(),this.#s),this.#t+=2,this}#o(e){return this.#r(4),this.#n.setUint32(this.#t,e,this.#s),this.#t+=4,this}#u(e){return this.#r(4),this.#n.setInt32(this.#t,e.valueOf(),this.#s),this.#t+=4,this}#w(e){for(;;){let n=e&127;if(e>>>=7,e!==0&&(n|=128),this.#c(n),e===0)break}return this}#d(e){for(e=e.valueOf(),e=e<<1^e>>31;e&-128;){const n=e&255|128;this.#c(n),e>>>=7}return this.#c(e),this}#E(e){return this.#r(8),this.#n.setBigInt64(this.#t,e,this.#s),this.#t+=8,this}#$(e){for(e=e<<1n^e>>63n;e>127n;){const n=Number(e&0xffn);this.#c(n|128),e>>=7n}return this.#c(Number(e)),this}#S(e){return this.#r(4),this.#n.setFloat32(this.#t,e.valueOf(),this.#s),this.#t+=4,this}#T(e){return this.#r(8),this.#n.setFloat64(this.#t,e,this.#s),this.#t+=8,this}#b(e){const{length:n}=e;return this.#i?this.#d(n):this.#u(n),this.#r(n),this.#e.set(e,this.#t),this.#t+=n,this}#p(e){const n=this.#l.encode(e),{length:r}=n;return this.#i?this.#w(r):this.#m(r),this.#r(r),this.#e.set(n,this.#t),this.#t+=r,this}#O(e){let n=e[He];e=e.filter(Oe),n=n??(e[0]!==void 0?$(e[0]):u.END);const{length:r}=e;this.#a(n),this.#i?this.#d(r):this.#u(r);for(const i of e){if($(i)!==n)throw new TypeError("Encountered unexpected item type in array, all tags in a List tag must be of the same type");this.#h(i)}return this}#A(e){for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const i=$(r);i!==null&&(this.#a(i),this.#p(n),this.#h(r))}return this.#a(u.END),this}#x(e){const{length:n}=e;this.#i?this.#d(n):this.#u(n);for(const r of e)this.#u(r);return this}#L(e){const{length:n}=e;this.#i?this.#d(n):this.#u(n);for(const r of e)this.#E(r);return this}}const ge=/^[0-9A-Za-z.+_-]+$/;function ye(t){if(typeof t!="string")throw new TypeError("First parameter must be a string");return new Rt().parseRoot(t)}class Rt{#t=0;#e=0;#n(e,n,r=n){const i=e[r];if(i===void 0)throw this.#s();return i}#s(){return new Error("Unexpected end")}#i(e,n,r){return new Error(`Unexpected character ${this.#n(e,n)} at position ${n}`)}#l(e){for(;this.#e<e.length;){if(!/ |\t|\r/.test(this.#n(e,this.#e))&&this.#n(e,this.#e)!=`
  63. `)return;this.#e+=1}}parseRoot(e){switch(this.#l(e),this.#t=this.#e,this.#n(e,this.#e)){case"{":return this.#e++,this.#u(e);case"[":{this.#e++;const n=this.#o(e,"[root]");if($(n)!==u.LIST)break;return n}}throw new Error("Encountered unexpected Root tag type, must be either a List or Compound tag")}#r(e,n){switch(this.#l(e),this.#t=this.#e,this.#n(e,this.#e)){case"{":return this.#e++,this.#u(e);case"[":return this.#e++,this.#o(e,n);case'"':case"'":return this.#f(e);default:{if(/^(true)$/.test(e.slice(this.#t,this.#e+4))||/^(false)$/.test(e.slice(this.#t,this.#e+5)))return this.#a(e)==="true";const r=this.#g(e);return r!=null&&(this.#e==e.length||!ge.test(this.#n(e,this.#e)))?r:e.slice(this.#t,this.#e)+this.#a(e)}}}#g(e){if(!"-0123456789".includes(this.#n(e,this.#e)))return null;this.#t=this.#e++;let n=!1;for(;this.#e<e.length;){const r=this.#n(e,this.#e);if(this.#e++,!"0123456789e-+".includes(r))switch(r.toLowerCase()){case".":{if(n)return this.#e--,null;n=!0;break}case"f":return new Te(Number(e.slice(this.#t,this.#e-1)));case"d":return Number(e.slice(this.#t,this.#e-1));case"b":return new he(Number(e.slice(this.#t,this.#e-1)));case"s":return new Se(Number(e.slice(this.#t,this.#e-1)));case"l":return BigInt(e.slice(this.#t,this.#e-1));default:return n?Number(e.slice(this.#t,--this.#e)):new M(Number(e.slice(this.#t,--this.#e)))}}return n?Number(e.slice(this.#t,this.#e)):new M(Number(e.slice(this.#t,this.#e)))}#h(e){return this.#n(e,this.#e)=='"'||this.#n(e,this.#e)=="'"?this.#f(e):this.#a(e)}#a(e){for(this.#t=this.#e;this.#e<e.length&&ge.test(this.#n(e,this.#e));)this.#e++;if(this.#e-this.#t==0)throw this.#e==e.length?this.#s():this.#i(e,this.#e);return e.slice(this.#t,this.#e)}#f(e){const n=this.#n(e,this.#e);++this.#e;let r="";for(;this.#e<e.length;){let i=this.#n(e,this.#e++);if(i==="\\"&&(i=`\\${this.#n(e,this.#e++)}`),i===n)return r;r+=this.#c(i)}throw this.#s()}#c(e){return e.replaceAll("\\\\","\\").replaceAll('\\"','"').replaceAll("\\'","'").replaceAll("\\0","\0").replaceAll("\\b","\b").replaceAll("\\f","\f").replaceAll("\\n",`
  64. `).replaceAll("\\r","\r").replaceAll("\\t","    ")}#m(e,n,r){if(this.#l(e),this.#n(e,this.#e)==","){if(n)throw this.#i(e,this.#e);this.#e++,this.#l(e)}else if(!n&&this.#n(e,this.#e)!=r)throw this.#i(e,this.#e)}#y(e,n){const r=[];for(;this.#e<e.length;){if(this.#m(e,r.length==0,"]"),this.#n(e,this.#e)=="]")switch(this.#e++,n){case"B":return Int8Array.from(r.map(s=>Number(s)));case"I":return Int32Array.from(r.map(s=>Number(s)));case"L":return BigInt64Array.from(r.map(s=>BigInt(s)))}for(this.#t=this.#e,this.#n(e,this.#e)=="-"&&this.#e++;this.#e<e.length&&"0123456789".includes(this.#n(e,this.#e));)this.#e++;const i=n==="B"?"b":n==="L"?"l":"";if(this.#n(e,this.#e)==i&&this.#e++,this.#e-this.#t==0)throw this.#i(e,this.#e);if(ge.test(this.#n(e,this.#e)))throw this.#i(e,this.#e);r.push(e.slice(this.#t,this.#e-(n!=="I"?1:0)))}throw this.#s()}#o(e,n){const r=this.#n(e,this.#e).toUpperCase();if("BIL".includes(r)&&e[this.#e+1]==";")return this.#y(e,this.#n(e,(this.#e+=2)-2).toUpperCase());const i=[];let s;for(;this.#e<e.length;){if(this.#l(e),this.#n(e,this.#e)==","){if(i.length==0)throw this.#i(e,this.#e);this.#e++,this.#l(e)}else if(i.length>0&&this.#n(e,this.#e)!="]")throw this.#i(e,this.#e-1);if(this.#n(e,this.#e)=="]")return this.#e++,i;const l=this.#r(e,n);if(s===void 0&&(s=$(l)),$(l)!==s)throw new TypeError(`Encountered unexpected item type '${$(l)}' in List '${n}' at index ${i.length}, expected item type '${s}'. All tags in a List tag must be of the same type`);i.push(l)}throw this.#s()}#u(e){const n={};let r=!0;for(;;){if(this.#m(e,r,"}"),r=!1,this.#n(e,this.#e)=="}")return this.#e++,n;const i=this.#h(e);if(this.#l(e),e[this.#e++]!=":")throw this.#i(e,this.#e);n[i]=this.#r(e,i)}}}function Ze(t,{space:e=""}={}){if(t instanceof U&&(t=t.data),typeof t!="object"||t===null)throw new TypeError("First parameter must be an object or array");if(typeof e!="string"&&typeof e!="number")throw new TypeError("Space option must be a string or number");return e=typeof e=="number"?" ".repeat(e):e,It(t,e,1)}function It(t,e,n){const r=$(t);if(r!==u.LIST&&r!==u.COMPOUND)throw new TypeError("Encountered unexpected Root tag type, must be either a List or Compound tag");return Ae(t,e,n)}function Ae(t,e,n){const r=$(t);switch(r){case u.BYTE:return qe(t);case u.SHORT:return Bt(t);case u.INT:return Ge(t);case u.LONG:return Ke(t);case u.FLOAT:return Ut(t);case u.DOUBLE:return Dt(t);case u.BYTE_ARRAY:return kt(t);case u.STRING:return Qe(t);case u.LIST:return Ft(t,e,n);case u.COMPOUND:return Vt(t,e,n);case u.INT_ARRAY:return Pt(t);case u.LONG_ARRAY:return Yt(t);default:throw new Error(`Encountered unsupported tag type '${r}'`)}}function qe(t){return typeof t=="boolean"?`${t}`:`${t.valueOf()}b`}function Bt(t){return`${t.valueOf()}s`}function Ge(t){return`${t.valueOf()}`}function Ke(t){return`${t}l`}function Ut(t){return`${t.valueOf()}${Number.isInteger(t.valueOf())?".0":""}f`}function Dt(t){return`${t}${!Number.isInteger(t)||t.toExponential()===t.toString()?"":".0"}d`}function kt(t){return`[B;${[...t].map(e=>qe(e)).join()}]`}function Qe(t){const e=Ie(t.replace(/['\\]/g,r=>`\\${r}`)),n=Ie(t.replace(/["\\]/g,r=>`\\${r}`));return e.length<n.length?`'${e}'`:`"${n}"`}function Ie(t){return t.replaceAll("\0","\\0").replaceAll("\b","\\b").replaceAll("\f","\\f").replaceAll(`
  65. `,"\\n").replaceAll("\r","\\r").replaceAll("    ","\\t")}function Ft(t,e,n){t=t.filter(Oe);const r=e!=="",i=t[0]!==void 0?$(t[0]):u.END,s=r&&new Set([u.BYTE_ARRAY,u.LIST,u.COMPOUND,u.INT_ARRAY,u.LONG_ARRAY]).has(i);return`[${t.map(l=>`${s?`
  66. ${e.repeat(n)}`:""}${(()=>{if($(l)!==i)throw new TypeError("Encountered unexpected item type in array, all tags in a List tag must be of the same type");return Ae(l,e,n+1)})()}`).join(`,${r&&!s?" ":""}`)}${s?`
  67. ${e.repeat(n-1)}`:""}]`}function Vt(t,e,n){const r=e!=="";return`{${Object.entries(t).filter(i=>Oe(i[1])).map(([i,s])=>`${r?`
  68. ${e.repeat(n)}`:""}${/^[0-9a-z_\-.+]+$/i.test(i)?i:Qe(i)}:${r?" ":""}${Ae(s,e,n+1)}`).join(",")}${r&&Object.keys(t).length!==0?`
  69. ${e.repeat(n-1)}`:""}}`}function Pt(t){return`[I;${[...t].map(e=>Ge(e)).join()}]`}function Yt(t){return`[L;${[...t].map(e=>Ke(e)).join()}]`}const Mt=""+new URL("./manifest.webmanifest",import.meta.url).href,jt=await fetch(Mt).then(t=>t.json()),Ht=jt.file_handlers.map(t=>Object.entries(t.accept)).flat(3).join(", ");async function zt(t=null){if(t===null){const e=document.createElement("input");e.type="file",e.accept=Ht,await new Promise(n=>{e.addEventListener("change",()=>n(),{once:!0}),e.addEventListener("cancel",()=>n(),{once:!0}),e.click()}),t=e.files?.[0]??null}if(t instanceof DataTransferItem){const e=await t.getAsFileSystemHandle?.()??null;t=e instanceof FileSystemFileHandle?e:t.getAsFile()}return t}async function Be(t,e){if(t.name.endsWith(".snbt")){const r=await t.text();return new U(ye(r))}const n=await t.arrayBuffer();return V(n,e)}async function Ue(t,e){if(e!==null){const i=await e.createWritable();await i.write(t),await i.close();return}const n=document.createElement("a"),r=URL.createObjectURL(t);n.href=r,n.download=t.name,n.click(),URL.revokeObjectURL(r)}async function Wt(t){try{await navigator.share({files:[t]})}catch(e){console.warn(e)}}async function Zt(t,e){if(e.endsWith(".snbt")){const r=Ze(t);return new File([r],e)}const n=await _t(t);return new File([n],e)}const qt=""+new URL("../../img/icon.svg",import.meta.url).href;var Gt=_('<header><img draggable=false alt=""><button>Open</button><button>Save</button><button>Format Options...</button><label style=margin-inline-start:auto;><input type=checkbox name=treeView> Tree View ');function Kt(t){return(()=>{var e=Gt(),n=e.firstChild,r=n.nextSibling,i=r.nextSibling,s=i.nextSibling,l=s.nextSibling,o=l.firstChild;return $e(n,"src",qt),r.$$click=()=>t.openFile(),i.$$click=()=>t.saveFile(),s.$$click=()=>t.setShowFormatDialog(a=>!a),o.$$input=()=>t.setShowTreeView(a=>!a),A(a=>{var c=t.getEditorDisabled(),d=t.getEditorDisabled()||t.getEditingSNBT();return c!==a.e&&(i.disabled=a.e=c),d!==a.t&&(s.disabled=a.t=d),a},{e:void 0,t:void 0}),A(()=>o.checked=t.getShowTreeView()),e})()}Ee(["click","input"]);var Qt=_("<div class=nbt-branch>"),Xt=_("<details><summary>"),Jt=_("<i>(unnamed)"),en=_('<i>""'),tn=_("<span>: ");function Xe(t){const e=x(()=>$(t.value()));return(()=>{var n=Qt();return L(n,f(gt,{get children(){return[f(R,{get when(){return e()===u.BYTE},get children(){return f(un,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.SHORT},get children(){return f(an,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.INT},get children(){return f(cn,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.LONG},get children(){return f(hn,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.FLOAT},get children(){return f(fn,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.DOUBLE},get children(){return f(dn,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.BYTE_ARRAY},get children(){return f(nn,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.STRING},get children(){return f(gn,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.LIST},get children(){return f(rn,{get name(){return t.name},get value(){return t.value},get open(){return t.open}})}}),f(R,{get when(){return e()===u.COMPOUND},get children(){return f(sn,{get name(){return t.name},get value(){return t.value},get open(){return t.open}})}}),f(R,{get when(){return e()===u.INT_ARRAY},get children(){return f(on,{get name(){return t.name},get value(){return t.value}})}}),f(R,{get when(){return e()===u.LONG_ARRAY},get children(){return f(ln,{get name(){return t.name},get value(){return t.value}})}})]}})),A(()=>$e(n,"data-type",e())),n})()}function nn(t){return f(J,t)}function rn(t){return f(J,t)}function sn(t){return f(J,t)}function on(t){return f(J,t)}function ln(t){return f(J,t)}function J(t){const[e,n]=N(t.open??!1),r=x(()=>$(t.value()));return(()=>{var i=Xt(),s=i.firstChild;return i.addEventListener("toggle",l=>n(l.currentTarget.open)),L(s,(()=>{var l=x(()=>t.name()===null);return()=>l()?Jt():(()=>{var o=x(()=>t.name()==="");return()=>o()?en():be(t.name())})()})(),null),L(s,(()=>{var l=x(()=>r()!==u.COMPOUND);return()=>l()&&` [${Object.keys(t.value()).length}]`})(),null),L(i,(()=>{var l=x(()=>!!e());return()=>l()&&Object.entries(t.value()).map(([o,a])=>{if(a!==void 0)return r()===u.BYTE_ARRAY&&(a=new he(a)),r()===u.INT_ARRAY&&(a=new M(a)),f(Xe,{name:()=>o,value:()=>a})})})(),null),A(()=>i.open=e()),i})()}function un(t){return f(j,t)}function an(t){return f(j,t)}function cn(t){return f(j,t)}function hn(t){return f(j,t)}function fn(t){return f(j,t)}function dn(t){return f(j,t)}function gn(t){return f(j,t)}function j(t){const e=x(()=>{const n=t.name();if(n===null)throw new Error(`Tag type '${u[$(t.value())]}' must have a name provided in reference to it's parent container.`);return n});return(()=>{var n=tn(),r=n.firstChild;return L(n,()=>be(e()),r),L(n,()=>be(t.value().valueOf().toString()),null),n})()}function be(t){return t.replaceAll("\b","\\b").replaceAll("\f","\\f").replaceAll(`
  70. `,"\\n").replaceAll("\r","\\r").replaceAll("    ","\\t")}var wn=_("<div class=nbt-tree>");function mn(t){const e=x(()=>t.value().data);return(()=>{var n=wn();return L(n,f(Xe,{get name(){return t.name},value:e,open:!0})),n})()}var yn=_('<textarea name=editor placeholder="NBT data will show here..."wrap=off autocomplete=off autocapitalize=none autocorrect=off>');function bn(t){return(()=>{var e=yn();return e.$$input=n=>t.setValue(n.currentTarget.value),$e(e,"spellcheck",!1),A(()=>e.disabled=t.disabled()),A(()=>e.value=t.getValue()),e})()}Ee(["input"]);var pn=_("<main>");function En(t){return(()=>{var e=pn();return L(e,(()=>{var n=x(()=>!!t.getShowTreeView());return()=>n()?f(mn,{get name(){return t.getRootName},get value(){return t.getTreeViewValue}}):f(bn,{get disabled(){return t.getEditorDisabled},get getValue(){return t.getEditorValue},get setValue(){return t.setEditorValue}})})()),e})()}var $n=_(`<dialog><form method=dialog><div class=dialog-header><h3>Format Options</h3><button type=submit aria-label=Close></button></div><fieldset><legend>Root Name</legend><label><input type=text name=name placeholder="<empty>"autocomplete=off autocorrect=on></label>
  71. <label><input type=checkbox name=disableName> Disable </label></fieldset><fieldset><legend>Endian</legend></fieldset><fieldset><legend>Compression</legend></fieldset><fieldset><legend>Bedrock Level</legend><label><input type=checkbox name=bedrockLevel>
  72. <code>(Uint32)</code>
  73. `),Sn=_("<label><input type=radio name=endian>"),Tn=_("<label><input type=radio name=compression>"),On=_("<div>");function An(t){const[e,n]=N(null);return Fe(()=>{const r=e();r?.open&&!t.getOpen()?r.close():!r?.open&&t.getOpen()&&r?.showModal()}),(()=>{var r=$n(),i=r.firstChild,s=i.firstChild,l=s.nextSibling,o=l.firstChild,a=o.nextSibling,c=a.firstChild,d=a.nextSibling,b=d.nextSibling,I=b.firstChild,p=l.nextSibling;p.firstChild;var E=p.nextSibling;E.firstChild;var D=E.nextSibling,Z=D.firstChild,ee=Z.nextSibling,q=ee.firstChild;return r.addEventListener("close",()=>t.getOpen()&&t.setOpen(!1)),yt(n,r),c.$$input=g=>t.setRootName(g.currentTarget.value),I.$$input=g=>t.setRootName(g.currentTarget.checked?null:""),L(p,()=>["big","little","little-varint"].map(g=>(()=>{var v=Sn(),C=v.firstChild;return C.$$input=()=>t.setEndian(g),C.value=g,L(v,()=>` ${g.slice(0,1).toUpperCase()}${g.slice(1)} `,null),A(()=>C.checked=t.getEndian()===g),v})()),null),L(E,()=>[null,"gzip","deflate","deflate-raw"].map(g=>(()=>{var v=Tn(),C=v.firstChild;return C.$$input=()=>t.setCompression(g),C.value=g??"none",L(v,` ${g==="deflate"?`${g} (zlib)`:g??"None"} `,null),A(()=>C.checked=t.getCompression()===g),v})()).reduce((g,v,C)=>(C%2===0?g.push((()=>{var G=On();return L(G,v),G})()):g.at(-1).append(v),g),[]),null),q.$$input=g=>t.setBedrockLevel(g.currentTarget.checked),A(()=>c.disabled=t.getRootName()===null),A(()=>c.value=t.getRootName()===null?"":t.getRootName()),A(()=>I.checked=t.getRootName()===null),A(()=>q.checked=t.getBedrockLevel()),r})()}Ee(["input"]);function xn(t){const[e,n]=N(!1),[r,i]=N(new U({})),[s,l]=N(!1),[o,a]=N(""),[c,d]=N(null),[b,I]=N(""),[p,E]=N(!0),D=x(()=>o().endsWith(".snbt")),[Z,ee]=N(""),[q,g]=N("big"),[v,C]=N(null),[G,xe]=N(!1),Le=()=>({rootName:Z(),endian:q(),compression:v(),bedrockLevel:G()}),Je=h=>{const{rootName:w,endian:y,compression:T,bedrockLevel:H}=h;return ee(w),g(y),C(T),xe(H),h};Fe(()=>{if(!e())return;let h;try{h=b()===""?{}:ye(b())}catch(y){console.warn(y);return}const w=new U(h,Le());i(w)});const et=async h=>{const{files:w}=h,[y]=w;y!==void 0&&await te(y)};window.launchQueue?.setConsumer?.(et);let fe;(h=>{h.Open="ControlOrCommand+O",h.Save="ControlOrCommand+S"})(fe||(fe={}));const tt=async h=>{let w=new Set;(h.ctrlKey||h.metaKey)&&w.add("ControlOrCommand"),h.altKey&&w.add("Alt"),h.shiftKey&&w.add("Shift"),h.key!=="Control"&&h.key!=="Meta"&&w.add(h.key.length===1?h.key.toUpperCase():h.key);const y=[...w].join("+");if(Object.values(fe).some(H=>H===y)&&(h.preventDefault(),!h.repeat))switch(y){case"ControlOrCommand+O":return await te();case"ControlOrCommand+S":return await ve()}};document.addEventListener("keydown",tt);const nt=h=>{h.preventDefault(),h.dataTransfer!==null&&(h.dataTransfer.dropEffect="copy")};document.addEventListener("dragover",nt);const rt=async h=>{if(h.preventDefault(),h.dataTransfer===null)return;const w=[...h.dataTransfer.items].filter(T=>T.kind==="file"),[y]=w;y!==void 0&&await te(y)};document.addEventListener("drop",rt);async function te(h=null){E(!0);try{h=await zt(h)}catch(T){(!(T instanceof DOMException)||T.name!=="AbortError")&&alert(T),E(!1);return}if(h===null)return;"getFile"in h?(d(h),h=await h.getFile()):d(null);let w;try{w=await Be(h)}catch(T){if(T instanceof Error&&T.message.includes("unread bytes remaining")){if(!confirm(`${T}
  74.  
  75. Encountered extra data at the end of '${h.name}'. Would you like to try opening it again without 'strict mode' enabled? The trailing data will be lost when re-saving your file again.`)){E(!1);return}w=await Be(h,{strict:!1})}else{alert(`Could not read '${h.name}' as NBT data.
  76.  
  77. ${T}`),E(!1);return}}const y=Ze(w,{space:2});Je(w),a(h.name),document.title=`Dovetail - ${o()}`,I(y),E(!1),i(w)}async function ve(h=null){if(h===null)try{const y=b(),T=ye(y),H=Le(),it=new U(T,H);if(h=await Zt(it,o()),t.isiOSDevice&&window.isSecureContext)return await Wt(h)}catch(y){alert(`Could not save '${o()}' as NBT data.
  78.  
  79. ${y}`);return}const w=c();if(w!==null)try{return await Ue(h,w)}catch{if(!confirm(`'${h.name}' could not be saved in-place. Would you like to try saving it manually? It may go directly to your Downloads folder.`))return}await Ue(h,null)}return[f(Kt,{getEditorDisabled:p,setEditorDisabled:E,getEditingSNBT:D,getShowTreeView:e,setShowTreeView:n,setShowFormatDialog:l,openFile:te,saveFile:ve}),f(En,{getRootName:Z,getEditorDisabled:p,getEditorValue:b,setEditorValue:I,getShowTreeView:e,getTreeViewValue:r}),f(An,{getRootName:Z,setRootName:ee,getEndian:q,setEndian:g,getCompression:v,setCompression:C,getBedrockLevel:G,setBedrockLevel:xe,getOpen:s,setOpen:l})]}const Ln=navigator.userAgentData?.platform??navigator.platform,vn=/^(Mac|iPhone|iPad|iPod)/i.test(Ln),Nn=vn&&navigator.maxTouchPoints>1;window.isSecureContext&&await navigator.serviceWorker.register("./service-worker.js");const _n=document.querySelector("#root");mt(()=>f(xn,{isiOSDevice:Nn}),_n);</script>
  80. <style rel="spreadsheet">*,*:before,*:after{box-sizing:border-box}html{height:100%;overflow:hidden}body{margin:0;position:fixed;width:100%;height:100%;display:flex;flex-direction:column;font-family:system-ui,sans-serif;-webkit-user-select:none;user-select:none}body>*{flex-shrink:0}#root{display:contents}header{padding:.5rem;display:flex;align-items:center;gap:.5em;border:0 solid transparent;border-left-width:env(safe-area-inset-left);border-right-width:env(safe-area-inset-right);overflow:auto;scrollbar-width:none}header::-webkit-scrollbar{display:none}header>*{flex-shrink:0}header>img{margin:4px;height:24px}@media (display-mode: window-controls-overlay){header{min-height:env(titlebar-area-height);background:#445985;border-left-width:env(titlebar-area-x);border-top-width:env(titlebar-area-y);-webkit-app-region:drag}header button{-webkit-app-region:no-drag}}input[type=file]{display:none}main{position:relative;flex-grow:1;display:flex}textarea{padding:8px;flex-grow:1;font-size:13px;font-family:ui-monospace,Noto Sans Mono,Cousine,monospace;line-height:1.4;caret-color:currentColor;background:#aaaaaa40;border:0 solid transparent;border-left-width:env(safe-area-inset-left);border-right-width:env(safe-area-inset-right);border-top:1px solid rgba(128,128,128,.5019607843);border-bottom-width:env(safe-area-inset-bottom);border-radius:0;outline:none;resize:none}textarea[disabled]{opacity:unset}.nbt-tree{padding:8px 12px;position:absolute;inset:0;height:100%;display:flex;gap:1em;flex-direction:column;font-size:13px;font-family:ui-monospace,Noto Sans Mono,Cousine,monospace;line-height:1.4;caret-color:currentColor;border:0 solid transparent;border-left-width:env(safe-area-inset-left);border-right-width:env(safe-area-inset-right);border-bottom-width:env(safe-area-inset-bottom);border-radius:0;overflow:auto}.nbt-tree[disabled]{opacity:unset}.nbt-branch{display:flex}.nbt-branch .nbt-branch{margin-left:12px}.nbt-branch>span{min-height:1.85em;display:flex;gap:.5em;align-items:center}.nbt-branch>details>summary:before,.nbt-branch>span:before{content:"";width:16px;height:16px;flex-shrink:0;background-image:url(../img/nbt.png);background-repeat:no-repeat;background-size:64px auto;image-rendering:pixelated}details{width:100%}summary{padding-left:4px;min-height:1.85em;cursor:pointer}.nbt-branch>details>summary:before{margin:0 .5em;display:inline-block;vertical-align:middle}.nbt-branch[data-type="1"]>details>summary:before,.nbt-branch[data-type="1"]>span:before{background-position:0 0}.nbt-branch[data-type="2"]>details>summary:before,.nbt-branch[data-type="2"]>span:before{background-position:-16px -16px}.nbt-branch[data-type="3"]>details>summary:before,.nbt-branch[data-type="3"]>span:before{background-position:-48px 0}.nbt-branch[data-type="4"]>details>summary:before,.nbt-branch[data-type="4"]>span:before{background-position:0 -16px}.nbt-branch[data-type="5"]>details>summary:before,.nbt-branch[data-type="5"]>span:before{background-position:-32px 0}.nbt-branch[data-type="6"]>details>summary:before,.nbt-branch[data-type="6"]>span:before{background-position:-16px 0}.nbt-branch[data-type="7"]>details>summary:before,.nbt-branch[data-type="7"]>span:before{background-position:0 -32px}.nbt-branch[data-type="8"]>details>summary:before,.nbt-branch[data-type="8"]>span:before{background-position:-32px -16px}.nbt-branch[data-type="9"]>details>summary:before,.nbt-branch[data-type="9"]>span:before{background-position:-32px -32px}.nbt-branch[data-type="10"]>details>summary:before,.nbt-branch[data-type="10"]>span:before{background-position:-48px -16px}.nbt-branch[data-type="11"]>details>summary:before,.nbt-branch[data-type="11"]>span:before{background-position:-16px -32px}.nbt-branch[data-type="12"]>details>summary:before,.nbt-branch[data-type="12"]>span:before{background-position:0 -48px}.nbt-tree input{font:inherit}::placeholder{color:inherit;opacity:.55;white-space:pre-wrap}[disabled]::placeholder{opacity:.5}dialog{-webkit-user-select:none;user-select:none}.dialog-header{display:flex;justify-content:space-between;align-items:center}form{display:flex;gap:.75rem;flex-direction:column}fieldset>div+div{margin-top:.25em}</style>
  81. </head>
  82.  
  83. <body>
  84.   <div id="root"></div>
  85. </body>
  86.  
  87. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement