UNPKG

lath

Version:

Seamless connection of pages.

1 lines 25.5 kB
function __awaiter(t,l,a,s){return new(a=a||Promise)(function(n,e){function o(t){try{r(s.next(t))}catch(t){e(t)}}function i(t){try{r(s.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a(function(t){t(e)})).then(o,i)}r((s=s.apply(t,l||[])).next())})}function getMessage(n,o){return __awaiter(this,void 0,void 0,function*(){let t;try{({ErrorCode:t}=yield import("./errorCode-b1ed4ec1.js"))}catch(t){return console.warn(t),{ErrorCode:{}}}var e=t[n];return e&&o?String.raw({raw:e.split("[$]")},...o):null!=e?e:"unknown"})}function setEnv(t){var e;_USE_SHADOW_DOM=null!=(e=t.USE_SHADOW_DOM)?e:_USE_SHADOW_DOM,_USE_PERCENTAGE=null!=(e=t.USE_PERCENTAGE)?e:_USE_PERCENTAGE}function getEnv(){return{USE_SHADOW_DOM:_USE_SHADOW_DOM,USE_PERCENTAGE:_USE_PERCENTAGE}}function testHasSmoothScrolling(){var t=document.createElement("div");return t.style.scrollBehavior="smooth",-1!==t.style.cssText.indexOf("smooth")&&CSS.supports("scroll-behavior","smooth")}function getIOSversion(){var t;return/(iPhone|iPod|iPad)/i.test(navigator.userAgent)?(t=navigator.userAgent.match(/OS (\d+)_(\d+)_?(\d+)?/))?[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3]||"0",10)]:[0]:null}function testHasScrolling(){var t=getIOSversion();return!(t&&t[0]<13&&!testHasSmoothScrolling())}var typeError,autoScrollPolyfill,loadWebAnimations,needsPolyfill;const Preset={appletsDefinition:{},appletsSlot:{},defaultApplet:"home",awaitDefine:()=>new Promise(t=>Preset.awaitCallback=t),__EXISTING__:!1},needsShadowDom=(typeError=(e,n="error",...o)=>__awaiter(void 0,void 0,void 0,function*(){var t=yield getMessage(e,o);if("return"===n)return t;"error"===n?console.error("LATH Error:",t):"info"===n?console.info("LATH Info:",t):"warn"===n&&console.warn("LATH Warning:",t)}),autoScrollPolyfill=()=>"function"!=typeof Element.prototype.scrollTo?import("./auto.cjs-c1153679.js").catch(t=>{console.warn(t)}):Promise.resolve(),loadWebAnimations=()=>__awaiter(void 0,void 0,void 0,function*(){if(!("animate"in document.createElement("div")&&Element.prototype.getAnimations))try{return!!(yield import("./polyfill-9a34882a.js")).default}catch(t){return!1}return!0}),!("attachShadow"in Element.prototype&&"getRootNode"in Element.prototype)),needsCustomElements=!window.customElements,needsTemplate=function(){var t,e=document.createElement("template");return!("content"in e&&e.content.cloneNode()instanceof DocumentFragment&&((t=document.createElement("template")).content.appendChild(document.createElement("div")),e.content.appendChild(t),0!==(t=e.cloneNode(!0)).content.childNodes.length)&&0!==t.content.firstChild.content.childNodes.length)}();needsPolyfill=!window.Promise||!Array.from||!window.URL||!window.Symbol||needsTemplate||needsShadowDom||needsCustomElements,import("./index-553c4cec.js").then(function(t){return t.i}).catch(t=>{console.warn(t)}),needsPolyfill&&import("@webcomponents/webcomponentsjs").catch(t=>{console.warn(t)}),"function"!=typeof Element.prototype.scrollTo&&import("./auto.cjs-c1153679.js").catch(t=>{console.warn(t)}),function(){function o(t){var e=at.has(t);return t=/^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(t),!e&&t}function s(t){var e=t.isConnected;if(void 0!==e)return e;if(n(t))return!0;for(;t&&!(t.__CE_isImportDocument||t instanceof Document);)t=t.parentNode||(window.ShadowRoot&&t instanceof ShadowRoot?t.host:void 0);return!(!t||!(t.__CE_isImportDocument||t instanceof Document))}function c(t){var e=t.children;if(e)return Array.prototype.slice.call(e);for(e=[],t=t.firstChild;t;t=t.nextSibling)t.nodeType===Node.ELEMENT_NODE&&e.push(t);return e}function a(t,e){for(;e&&e!==t&&!e.nextSibling;)e=e.parentNode;return e&&e!==t?e.nextSibling:null}function u(){var t=!(null==D||!D.noDocumentConstructionObserver),e=!(null==D||!D.shadyDomFastWalk);this.m=[],this.g=[],this.j=!1,this.shadyDomFastWalk=e,this.I=!t}function p(t,e,n,o){var i=window.ShadyDOM;if(t.shadyDomFastWalk&&i&&i.inUse){if(e.nodeType===Node.ELEMENT_NODE&&n(e),e.querySelectorAll)for(t=i.nativeMethods.querySelectorAll.call(e,"*"),e=0;e<t.length;e++)n(t[e])}else!function t(e,n,o){for(var i,r,l=e;l;){if(l.nodeType===Node.ELEMENT_NODE){if(n(i=l),"link"===(r=i.localName)&&"import"===i.getAttribute("rel")){if(l=i.import,void 0===o&&(o=new Set),l instanceof Node&&!o.has(l))for(o.add(l),l=l.firstChild;l;l=l.nextSibling)t(l,n,o);l=a(e,i);continue}if("template"===r){l=a(e,i);continue}if(i=i.__CE_shadowRoot)for(i=i.firstChild;i;i=i.nextSibling)t(i,n,o)}l=l.firstChild||a(e,l)}}(e,n,o)}function d(e,t){e.j&&p(e,t,function(t){return h(e,t)})}function h(t,e){if(t.j&&!e.__CE_patched){e.__CE_patched=!0;for(var n=0;n<t.m.length;n++)t.m[n](e);for(n=0;n<t.g.length;n++)t.g[n](e)}}function f(t,e){var n,o=[];for(p(t,e,function(t){return o.push(t)}),e=0;e<o.length;e++)1===(n=o[e]).__CE_state?t.connectedCallback(n):w(t,n)}function m(t,e){var n,o=[];for(p(t,e,function(t){return o.push(t)}),e=0;e<o.length;e++)1===(n=o[e]).__CE_state&&t.disconnectedCallback(n)}function E(o,t,e){var i=(e=void 0===e?{}:e).J,r=e.upgrade||function(t){return w(o,t)},l=[];for(p(o,t,function(n){var t;o.j&&h(o,n),"link"===n.localName&&"import"===n.getAttribute("rel")?((t=n.import)instanceof Node&&(t.__CE_isImportDocument=!0,t.__CE_registry=document.__CE_registry),t&&"complete"===t.readyState?t.__CE_documentLoadHandled=!0:n.addEventListener("load",function(){var e,t=n.import;t.__CE_documentLoadHandled||(t.__CE_documentLoadHandled=!0,e=new Set,i&&(i.forEach(function(t){return e.add(t)}),e.delete(t)),E(o,t,{J:e,upgrade:r}))})):l.push(n)},i),t=0;t<l.length;t++)r(l[t])}function w(t,e){var n,o,i,r,l,a;try{if((i=(o=(n=e.ownerDocument).__CE_registry)&&(n.defaultView||n.__CE_isImportDocument)?C(o,e.localName):void 0)&&void 0===e.__CE_state){i.constructionStack.push(e);try{try{if(new i.constructorFunction!==e)throw Error("The custom element constructor did not produce the element being upgraded.")}finally{i.constructionStack.pop()}}catch(t){throw e.__CE_state=2,t}if(e.__CE_state=1,(e.__CE_definition=i).attributeChangedCallback&&e.hasAttributes())for(r=i.observedAttributes,i=0;i<r.length;i++)l=r[i],null!==(a=e.getAttribute(l))&&t.attributeChangedCallback(e,l,null,a,null);s(e)&&t.connectedCallback(e)}}catch(t){g(t)}}function _(e,n,o,i){var t,r=n.__CE_registry;if(r&&(null===i||"http://www.w3.org/1999/xhtml"===i)&&(r=C(r,o)))try{if(void 0===(t=new r.constructorFunction).__CE_state||void 0===t.__CE_definition)throw Error("Failed to construct '"+o+"': The returned value was not constructed with the HTMLElement constructor.");if("http://www.w3.org/1999/xhtml"!==t.namespaceURI)throw Error("Failed to construct '"+o+"': The constructed element's namespace must be the HTML namespace.");if(t.hasAttributes())throw Error("Failed to construct '"+o+"': The constructed element must not have any attributes.");if(null!==t.firstChild)throw Error("Failed to construct '"+o+"': The constructed element must not have any children.");if(null!==t.parentNode)throw Error("Failed to construct '"+o+"': The constructed element must not have a parent node.");if(t.ownerDocument!==n)throw Error("Failed to construct '"+o+"': The constructed element's owner document is incorrect.");if(t.localName!==o)throw Error("Failed to construct '"+o+"': The constructed element's local name is incorrect.");return t}catch(t){return g(t),n=null===i?N.call(n,o):T.call(n,i,o),Object.setPrototypeOf(n,HTMLUnknownElement.prototype),n.__CE_state=2,n.__CE_definition=void 0,h(e,n),n}return h(e,n=null===i?N.call(n,o):T.call(n,i,o)),n}function g(t){var e=t.message,n=t.sourceURL||t.fileName||"",o=t.line||t.lineNumber||0,i=t.column||t.columnNumber||0,r=void 0;void 0===ErrorEvent.prototype.initErrorEvent?r=new ErrorEvent("error",{cancelable:!0,message:e,filename:n,lineno:o,colno:i,error:t}):((r=document.createEvent("ErrorEvent")).initErrorEvent("error",!1,!0,e,n,o),r.preventDefault=function(){Object.defineProperty(this,"defaultPrevented",{configurable:!0,get:function(){return!0}})}),void 0===r.error&&Object.defineProperty(r,"error",{configurable:!0,enumerable:!0,get:function(){return t}}),window.dispatchEvent(r),r.defaultPrevented||console.error(t)}function i(){var e=this;this.g=void 0,this.F=new Promise(function(t){e.l=t})}function e(t){var e=document;this.l=void 0,this.h=t,this.g=e,E(this.h,this.g),"loading"===this.g.readyState&&(this.l=new MutationObserver(this.G.bind(this)),this.l.observe(this.g,{childList:!0,subtree:!0}))}function r(t){t.l&&t.l.disconnect()}function y(t){this.s=new Map,this.u=new Map,this.C=new Map,this.A=!1,this.B=new Map,this.o=function(t){return t()},this.i=!1,this.v=[],this.h=t,this.D=t.I?new e(t):void 0}function l(t,e){if(!o(e))throw new SyntaxError("The element name '"+e+"' is not valid.");if(C(t,e))throw Error("A custom element with name '"+e+"' has already been defined.");if(t.A)throw Error("A custom element is already being defined.")}function v(t,e,n){var o,i,r,l,a,s,c;t.A=!0;try{if(!((i=n.prototype)instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");l=(r=function(t){var e=i[t];if(void 0===e||e instanceof Function)return e;throw Error("The '"+t+"' callback must be a function.")})("connectedCallback"),a=r("disconnectedCallback"),s=r("adoptedCallback"),c=(o=r("attributeChangedCallback"))&&n.observedAttributes||[]}catch(t){throw t}finally{t.A=!1}return t.u.set(e,n={localName:e,constructorFunction:n,connectedCallback:l,disconnectedCallback:a,adoptedCallback:s,attributeChangedCallback:o,observedAttributes:c,constructionStack:[]}),t.C.set(n.constructorFunction,n),n}function b(o){var i,t,r,e,n,l,a;if(!1!==o.i){for(o.i=!1,i=[],t=o.v,r=new Map,e=0;e<t.length;e++)r.set(t[e],[]);for(E(o.h,document,{upgrade:function(t){var e,n;void 0===t.__CE_state&&(e=t.localName,(n=r.get(e))?n.push(t):o.u.has(e)&&i.push(t))}}),e=0;e<i.length;e++)w(o.h,i[e]);for(e=0;e<t.length;e++){for(n=t[e],l=r.get(n),a=0;a<l.length;a++)w(o.h,l[a]);(n=o.B.get(n))&&n.resolve(void 0)}t.length=0}}function C(t,e){var n=t.u.get(e);if(n)return n;if(n=t.s.get(e)){t.s.delete(e);try{return v(t,e,n())}catch(t){g(t)}}}function S(a,t,e){function n(l){return function(t){for(var e,n,o,i=[],r=0;r<arguments.length;++r)i[r]=arguments[r];for(r=[],e=[],n=0;n<i.length;n++)if((o=i[n])instanceof Element&&s(o)&&e.push(o),o instanceof DocumentFragment)for(o=o.firstChild;o;o=o.nextSibling)r.push(o);else r.push(o);for(l.apply(this,i),i=0;i<e.length;i++)m(a,e[i]);if(s(this))for(i=0;i<r.length;i++)(e=r[i])instanceof Element&&f(a,e)}}void 0!==e.prepend&&(t.prepend=n(e.prepend)),void 0!==e.append&&(t.append=n(e.append))}function x(l){function e(t,r){Object.defineProperty(t,"innerHTML",{enumerable:r.enumerable,configurable:!0,get:r.get,set:function(t){var e,n,o=this,i=void 0;if(s(this)&&(i=[],p(l,this,function(t){t!==o&&i.push(t)})),r.set.call(this,t),i)for(e=0;e<i.length;e++)1===(n=i[e]).__CE_state&&l.disconnectedCallback(n);return(this.ownerDocument.__CE_registry?E:d)(l,this),t}})}function t(t,o){t.insertAdjacentElement=function(t,e){var n=s(e);return t=o.call(this,t,e),n&&m(l,e),s(t)&&f(l,e),t}}function n(t,o){function i(t,e){for(var n=[];t!==e;t=t.nextSibling)n.push(t);for(e=0;e<n.length;e++)E(l,n[e])}t.insertAdjacentHTML=function(t,e){if("beforebegin"===(t=t.toLowerCase())){var n=this.previousSibling;o.call(this,t,e),i(n||this.parentNode.firstChild,this)}else if("afterbegin"===t)n=this.firstChild,o.call(this,t,e),i(this.firstChild,n);else if("beforeend"===t)n=this.lastChild,o.call(this,t,e),i(n||this.firstChild,null);else{if("afterend"!==t)throw new SyntaxError("The value provided ("+String(t)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");n=this.nextSibling,o.call(this,t,e),i(this.nextSibling,n)}}}var o,a,i;function r(l){return function(t){for(var e,n,o,i=[],r=0;r<arguments.length;++r)i[r]=arguments[r];for(r=[],e=[],n=0;n<i.length;n++)if((o=i[n])instanceof Element&&s(o)&&e.push(o),o instanceof DocumentFragment)for(o=o.firstChild;o;o=o.nextSibling)r.push(o);else r.push(o);for(l.apply(this,i),i=0;i<e.length;i++)m(a,e[i]);if(s(this))for(i=0;i<r.length;i++)(e=r[i])instanceof Element&&f(a,e)}}V&&(Element.prototype.attachShadow=function(t){if(t=V.call(this,t),l.j&&!t.__CE_patched){t.__CE_patched=!0;for(var e=0;e<l.m.length;e++)l.m[e](t)}return this.__CE_shadowRoot=t}),H&&H.get?e(Element.prototype,H):L&&L.get?e(HTMLElement.prototype,L):(o=function(t){e(t,{enumerable:!0,configurable:!0,get:function(){return G.call(this,!0).innerHTML},set:function(t){var e="template"===this.localName,n=e?this.content:this,o=T.call(document,this.namespaceURI,this.localName);for(o.innerHTML=t;0<n.childNodes.length;)O.call(n,n.childNodes[0]);for(t=e?o.content:o;0<t.childNodes.length;)P.call(n,t.childNodes[0])}})},(i=l).j=!0,i.g.push(o)),Element.prototype.setAttribute=function(t,e){if(1!==this.__CE_state)return X.call(this,t,e);var n=M.call(this,t);X.call(this,t,e),e=M.call(this,t),l.attributeChangedCallback(this,t,n,e,null)},Element.prototype.setAttributeNS=function(t,e,n){if(1!==this.__CE_state)return q.call(this,t,e,n);var o=j.call(this,t,e);q.call(this,t,e,n),n=j.call(this,t,e),l.attributeChangedCallback(this,e,o,n,t)},Element.prototype.removeAttribute=function(t){if(1!==this.__CE_state)return $.call(this,t);var e=M.call(this,t);$.call(this,t),null!==e&&l.attributeChangedCallback(this,t,e,null,null)},Element.prototype.removeAttributeNS=function(t,e){var n,o;if(1!==this.__CE_state)return J.call(this,t,e);n=j.call(this,t,e),J.call(this,t,e),n!==(o=j.call(this,t,e))&&l.attributeChangedCallback(this,e,n,o,t)},rt?t(HTMLElement.prototype,rt):Y&&t(Element.prototype,Y),lt?n(HTMLElement.prototype,lt):K&&n(Element.prototype,K),S(l,Element.prototype,{prepend:Q,append:Z}),a=l,i=Element.prototype,void 0!==tt&&(i.before=r(tt)),void 0!==et&&(i.after=r(et)),void 0!==nt&&(i.replaceWith=function(t){for(var e,n,o,i=[],r=0;r<arguments.length;++r)i[r]=arguments[r];for(r=[],e=[],n=0;n<i.length;n++)if((o=i[n])instanceof Element&&s(o)&&e.push(o),o instanceof DocumentFragment)for(o=o.firstChild;o;o=o.nextSibling)r.push(o);else r.push(o);for(n=s(this),nt.apply(this,i),i=0;i<e.length;i++)m(a,e[i]);if(n)for(m(a,this),i=0;i<r.length;i++)(e=r[i])instanceof Element&&f(a,e)}),void 0!==ot&&(i.remove=function(){var t=s(this);ot.call(this),t&&m(a,this)})}function t(){var r,n,l,t,e,o=new u;function i(){var t,e,n,o=this.constructor,i=document.__CE_registry.C.get(o);if(!i)throw Error("Failed to construct a custom element: The constructor was not registered with `customElements`.");if(0===(t=i.constructionStack).length)return t=N.call(document,i.localName),Object.setPrototypeOf(t,o.prototype),t.__CE_state=1,t.__CE_definition=i,h(r,t),t;if((n=t[e=t.length-1])===A)throw Error("Failed to construct '"+i.localName+"': This element was already constructed.");return t[e]=A,Object.setPrototypeOf(n,o.prototype),h(r,n),n}function a(t,r){Object.defineProperty(t,"textContent",{enumerable:r.enumerable,configurable:!0,get:r.get,set:function(t){var e,n,o,i;if(this.nodeType===Node.TEXT_NODE)r.set.call(this,t);else{if(e=void 0,this.firstChild&&0<(o=(n=this.childNodes).length)&&s(this))for(e=Array(o),i=0;i<o;i++)e[i]=n[i];if(r.set.call(this,t),e)for(t=0;t<e.length;t++)m(l,e[t])}}})}r=o,i.prototype=it.prototype,Object.defineProperty(HTMLElement.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:i}),window.HTMLElement=i,n=o,Document.prototype.createElement=function(t){return _(n,this,t,null)},Document.prototype.importNode=function(t,e){return t=F.call(this,t,!!e),(this.__CE_registry?E:d)(n,t),t},Document.prototype.createElementNS=function(t,e){return _(n,this,e,t)},S(n,Document.prototype,{prepend:I,append:W}),S(o,DocumentFragment.prototype,{prepend:R,append:U}),l=o,Node.prototype.insertBefore=function(t,e){if(t instanceof DocumentFragment){var n=c(t);if(t=B.call(this,t,e),s(this))for(e=0;e<n.length;e++)f(l,n[e]);return t}return n=t instanceof Element&&s(t),e=B.call(this,t,e),n&&m(l,t),s(this)&&f(l,t),e},Node.prototype.appendChild=function(t){var e,n;if(t instanceof DocumentFragment){if(e=c(t),t=P.call(this,t),s(this))for(n=0;n<e.length;n++)f(l,e[n]);return t}return e=t instanceof Element&&s(t),n=P.call(this,t),e&&m(l,t),s(this)&&f(l,t),n},Node.prototype.cloneNode=function(t){return t=G.call(this,!!t),(this.ownerDocument.__CE_registry?E:d)(l,t),t},Node.prototype.removeChild=function(t){var e=t instanceof Element&&s(t),n=O.call(this,t);return e&&m(l,t),n},Node.prototype.replaceChild=function(t,e){var n,o,i;if(t instanceof DocumentFragment){if(n=c(t),t=z.call(this,t,e),s(this))for(m(l,e),e=0;e<n.length;e++)f(l,n[e]);return t}return n=t instanceof Element&&s(t),o=z.call(this,t,e),(i=s(this))&&m(l,e),n&&m(l,t),i&&f(l,t),o},k&&k.get?a(Node.prototype,k):(e=function(t){a(t,{enumerable:!0,configurable:!0,get:function(){for(var t=[],e=this.firstChild;e;e=e.nextSibling)e.nodeType!==Node.COMMENT_NODE&&t.push(e.textContent);return t.join("")},set:function(t){for(;this.firstChild;)O.call(this,this.firstChild);null!=t&&""!==t&&P.call(this,document.createTextNode(t))}})},(t=l).j=!0,t.m.push(e)),x(o),o=new y(o),document.__CE_registry=o,Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:o})}var n,A,D,N=window.Document.prototype.createElement,T=window.Document.prototype.createElementNS,F=window.Document.prototype.importNode,I=window.Document.prototype.prepend,W=window.Document.prototype.append,R=window.DocumentFragment.prototype.prepend,U=window.DocumentFragment.prototype.append,G=window.Node.prototype.cloneNode,P=window.Node.prototype.appendChild,B=window.Node.prototype.insertBefore,O=window.Node.prototype.removeChild,z=window.Node.prototype.replaceChild,k=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),V=window.Element.prototype.attachShadow,H=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),M=window.Element.prototype.getAttribute,X=window.Element.prototype.setAttribute,$=window.Element.prototype.removeAttribute,j=window.Element.prototype.getAttributeNS,q=window.Element.prototype.setAttributeNS,J=window.Element.prototype.removeAttributeNS,Y=window.Element.prototype.insertAdjacentElement,K=window.Element.prototype.insertAdjacentHTML,Q=window.Element.prototype.prepend,Z=window.Element.prototype.append,tt=window.Element.prototype.before,et=window.Element.prototype.after,nt=window.Element.prototype.replaceWith,ot=window.Element.prototype.remove,it=window.HTMLElement,L=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),rt=window.HTMLElement.prototype.insertAdjacentElement,lt=window.HTMLElement.prototype.insertAdjacentHTML,at=new Set;"annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ").forEach(function(t){return at.add(t)}),n=document.contains?document.contains.bind(document):document.documentElement.contains.bind(document.documentElement),u.prototype.connectedCallback=function(t){var e=t.__CE_definition;if(e.connectedCallback)try{e.connectedCallback.call(t)}catch(t){g(t)}},u.prototype.disconnectedCallback=function(t){var e=t.__CE_definition;if(e.disconnectedCallback)try{e.disconnectedCallback.call(t)}catch(t){g(t)}},u.prototype.attributeChangedCallback=function(t,e,n,o,i){var r=t.__CE_definition;if(r.attributeChangedCallback&&-1<r.observedAttributes.indexOf(e))try{r.attributeChangedCallback.call(t,e,n,o,i)}catch(t){g(t)}},i.prototype.resolve=function(t){if(this.g)throw Error("Already resolved.");this.g=t,this.l(t)},e.prototype.G=function(t){var e,n,o=this.g.readyState;for("interactive"!==o&&"complete"!==o||r(this),o=0;o<t.length;o++)for(e=t[o].addedNodes,n=0;n<e.length;n++)E(this.h,e[n])},y.prototype.H=function(t,e){var n=this;if(!(e instanceof Function))throw new TypeError("Custom element constructor getters must be functions.");l(this,t),this.s.set(t,e),this.v.push(t),this.i||(this.i=!0,this.o(function(){return b(n)}))},y.prototype.define=function(t,e){var n=this;if(!(e instanceof Function))throw new TypeError("Custom element constructors must be functions.");l(this,t),v(this,t,e),this.v.push(t),this.i||(this.i=!0,this.o(function(){return b(n)}))},y.prototype.upgrade=function(t){E(this.h,t)},y.prototype.get=function(t){if(t=C(this,t))return t.constructorFunction},y.prototype.whenDefined=function(t){var e,n;return o(t)?((e=this.B.get(t))||(e=new i,this.B.set(t,e),n=this.u.has(t)||this.s.has(t),t=-1===this.v.indexOf(t),n&&t&&e.resolve(void 0)),e.F):Promise.reject(new SyntaxError("'"+t+"' is not a valid custom element name."))},y.prototype.polyfillWrapFlushCallback=function(e){this.D&&r(this.D);var n=this.o;this.o=function(t){return e(function(){return n(t)})}},(window.CustomElementRegistry=y).prototype.polyfillDefineLazy=y.prototype.H,A={},(D=window.customElements)&&!D.forcePolyfill&&"function"==typeof D.define&&"function"==typeof D.get||t(),window.__CE_installPolyfill=t}.call(self);let _USE_SHADOW_DOM=!0,_USE_PERCENTAGE=(needsPolyfill&&/iPhone OS [0-9]_\d(_\d)? like mac os x/gi.exec(navigator.userAgent)&&(_USE_SHADOW_DOM=!1),window.__LATH_NO_SHADOW_DOM__&&(_USE_SHADOW_DOM=!1),!1);const buildAppletSlot=t=>{var e;return Preset.appletsSlot[t]||((e=document.createElement("slot")).name="applet-"+t,Preset.appletsSlot[t]=e)};class DefineApplet extends HTMLElement{constructor(){super(),this.installed=!1}getViewSlot(){return this.appletSlot}static get observedAttributes(){return["applet-id"]}get appletId(){return this.getAttribute("applet-id")}defineApplet(){var t=this.appletId,e=getEnv()["USE_SHADOW_DOM"];t&&(e?(this.slot="applet-"+t,this.appletSlot=buildAppletSlot(t)):Preset.appletsSlot[t]=this.appletSlot=this,Preset.appletsDefinition[t]=this)}attributeChangedCallback(t,e,n){"applet-id"===t&&n&&(e&&n.split("-")[0]!==e.split("-")[0]&&(typeError(1002,"warn",`oldValue: ${e}, newValue: `+n),typeError(1003,"warn")),null!=(t=this.defineApplet))&&t.call(this)}connectedCallback(){this.installed||(this.installed=!0,this.defineApplet(),!1===testHasScrolling()&&setTimeout(()=>{this.style.webkitOverflowScrolling="touch"},0))}}class DefineApplication extends HTMLElement{constructor(){super(),this.installed=!1}static get observedAttributes(){return["default-applet"]}init(){var t=getEnv()["USE_SHADOW_DOM"];this.contentShadowRoot||(this.contentShadowRoot=t?null==(t=this.attachShadow)?void 0:t.call(this,{mode:"closed"}):this,this.contentShadowRoot.appendChild(buildAppletSlot("system")),this.contentShadowRoot.appendChild(buildAppletSlot("frameworks")),Preset.root=this.contentShadowRoot,Preset.appletsSpace=this)}get defaultApplet(){return this.getAttribute("default-applet")}defineApplet(){var t;this.defaultApplet&&(this.init(),this.setupDefaultApplet(null!=(t=this.defaultApplet)?t:"home"))}setupDefaultApplet(t){this.contentShadowRoot.appendChild(buildAppletSlot(t)),Preset.defaultApplet=t,null!=(t=Preset.awaitCallback)&&t.call(Preset)}attributeChangedCallback(t,e,n){"default-applet"===t&&n&&(e&&e!==n&&typeError(1004,"warn"),null!=(t=this.defineApplet))&&t.call(this)}connectedCallback(){this.installed||(this.installed=!0,this.defineApplet())}}needsPolyfill&&import("@webcomponents/webcomponentsjs").catch(t=>{console.warn(t)});const initApplication=()=>{var t=()=>{customElements.get("define-applet")||customElements.get("define-application")?typeError(1003):(customElements.define("define-applet",DefineApplet),customElements.define("define-application",DefineApplication))};needsPolyfill?import("@webcomponents/webcomponentsjs").then(t).catch(t=>{console.warn(t)}):t()},destroyApplication=(import("./index-553c4cec.js").then(function(t){return t.i}).catch(t=>{console.warn(t)}),autoScrollPolyfill(),loadWebAnimations(),()=>{if(Preset.appletsSpace){var e=Preset.appletsSpace,t=e.parentElement,n=document.createElement("div"),o=(null!=t&&t.insertBefore(n,e),e.children.length);for(let t=0;t<=o;t++)n.appendChild(e.children[t])}}),createApplication=(s={tunneling:!1})=>__awaiter(void 0,void 0,void 0,function*(){if(initApplication(),yield autoScrollPolyfill(),yield loadWebAnimations(),Preset.__EXISTING__)return Promise.reject("repeat");if(s.tunneling&&window.__LATH_APPLICATION_AVAILABILITY__)return Promise.reject("tunneling");Preset.__EXISTING__=!0;let t;try{({Application:t}=yield import("./index-553c4cec.js").then(function(t){return t.i}))}catch(t){return console.warn(t),Promise.reject(t)}var{tunneling:e=!1,zIndex:n=void 0,applets:o={}}=s,{root:i,defaultApplet:r,appletsSpace:l}=(Preset.root||(setTimeout(()=>{Preset.root||typeError(1005,"return")},5e3),yield Preset.awaitDefine()),Preset);if(!i)return Promise.reject(typeError(1005,"return"));i=new t({root:i,tunneling:e,zIndex:n,appletsSpace:l}),l=null==(n=null==(e=null==o?void 0:o.frameworks)?void 0:e.config)?void 0:n.index;if(!Preset.appletsDefinition[r])return Promise.reject(typeError(1006,"return"));o.frameworks||(o.frameworks={config:{level:0,index:r,singleFlow:!1,singleLock:!1,animation:"slide",transientTimeout:18e5,disableTransient:!0}},o[r])||(o[r]={config:{level:1,title:document.title,free:!1,animation:"slide",background:!0}}),l&&!o[l]&&(o[l]={config:{level:1,title:document.title,free:!1,animation:"slide",background:!0}});for(const a in Preset.appletsDefinition)o[a]||(o[a]={config:{level:1,title:document.title,free:!1,animation:"slide",background:!0}});return i.setting({applets:o}),yield i.start(),i.setPrestAppletsView(Preset.appletsDefinition),Promise.resolve(i)});export{Preset as P,__awaiter as _,testHasSmoothScrolling as a,getEnv as b,testHasScrolling as c,buildAppletSlot as d,createApplication as e,destroyApplication as f,getIOSversion as g,loadWebAnimations as l,setEnv as s,typeError as t};