Fed-BoJ policy divergence remains the key driving force
<p> <br />
</p>
<div>
<article>
<h3>Fed-BoJ policy divergence remains the key driving force</h3>
<p>While the Federal Reserve (Fed) has largely retained its hawkish tone at the latest meeting, speculations for a quicker policy shift from the Bank of Japan (BoJ) have not been receiving much validation by policymakers thus far. The persistent rise in Japan’s “core core” inflation to more than two-fold the central bank’s target (4.1% versus 2% target) has been an argument from the hawks but considering that improving wage dynamics has not been broad-based, that has provided some basis for the BoJ to continue defending their stance of inflation being ‘transitory’.</p>
<p><img decoding="async" loading="lazy" src="https://a.c-dn.net/b/2ybW7A/Screenshot+2023-06-22+150413.png" alt="" data-image-original-width="1046" data-image-original-height="656" width="1046" height="656" class="dfx-lazyload" style="padding-bottom: calc(656 / 1046 * 100%);" /></p>
<p>Source: Refinitiv</p>
<p>Current interest rate futures remain well-anchored for the BoJ to leave interest rate unchanged at least over the next two policy meetings. Perhaps the greater focus will be on whether the central bank will exercise further tweaks to its yield curve control (YCC) policy, as markets have been highly sensitive to any slightest signs of policy normalisation from the central bank.</p>
<p>That said, the BoJ has not been the best at communications. One may recall how the central bank threw markets off guard back in December 2022 with a surprise widening of its 10-year bond yield cap, dragging the USD/JPY down by 4.3% in a single day. With the still-ambiguous outlook on how the BoJ may normalise policies eventually, any tweaks will continue to come with an element of surprise. At least for now, the tone from the central bank seems to be pointing to more wait-and-see, which provides some runway for the Fed-BoJ policy divergence story to continue.</p>
<h3>How did past BoJ’s intervention play out?</h3>
<p>The BoJ has intervened in the currency market thrice last year, once in September 2022 by buying 2.8 trillion yen while selling the US dollar. The second and third occasions are on 21 and 24 October 2022, with an overall 6.3 trillion yen amount. While the October intervention has allowed the USD/JPY to find a top, recent resurgences in the pair seems to suggest that as long as the policy divergence remains, any impact from interventions could be temporary and unsustainable over the longer run.</p>
<p>Thus far, policymakers’ concerns on the weaker yen have not been as prominent as it was last year. Recent comments from the BOJ Governor Kazuo Ueda also highlighted that focus is on the pace and timing of decline as compared to an absolute level, which may point to some acceptance for now.</p>
<h3>Technical analysis: USD/JPY closing in on BoJ intervention level back in September 2022</h3>
<p>On the daily chart, the USD/JPY has been trading within a rising channel pattern since the start of the year, with a bullish crossover formed between its 100-day and 200-day moving average (MA). Despite the recent lacklustre performance in the US dollar, the pair has managed to hold up well, as the Fed-BoJ policy divergence remains the key driver. A bullish pennant has been presented lately, although in the near term, some indecision seems to be in place with a bearish divergence on the relative strength index (RSI).</p>
<p>While the series of higher highs and higher lows continue to put an upward trend in place, immediate resistance may stand at the upper channel trendline, in coincidence with a 61.8% Fibonacci retracement level. Any upward break above the channel pattern may then leave the 145.80 level on watch next. To recall, the BoJ has intervened in the currency market at this level back in 22 September 2022, which could trigger concerns that the BoJ may step in once more.</p>
<p><img decoding="async" loading="lazy" src="https://a.c-dn.net/b/2AdJSk/image1.png" alt="image1.png" data-image-original-width="1476" data-image-original-height="732" width="1476" height="732" class="dfx-lazyload" style="padding-bottom: calc(732 / 1476 * 100%);" /></p>
<p>Source: IG charts</p>
<h3>Article written by IG Strategist Jun Rong Yeap</h3>
</article>
</div>
<p><script>
!function(){function errMsg(errCode,msg){return(msg||"")+" (SystemJS Error#"+errCode+" https://github.com/systemjs/systemjs/blob/main/docs/errors.md#"+errCode+")"}var baseUrl,baseEl,hasSymbol="undefined"!=typeof Symbol,hasSelf="undefined"!=typeof self,hasDocument="undefined"!=typeof document,envGlobal=hasSelf?self:global,backslashRegEx=(!hasDocument||(baseEl=document.querySelector("base[href]"))&&(baseUrl=baseEl.href),baseUrl||"undefined"==typeof location||-1!==(baseEl=(baseUrl=location.href.split("#")[0].split("?")[0]).lastIndexOf("/"))&&(baseUrl=baseUrl.slice(0,baseEl+1)),/\/g);function resolveIfNotPlainOrUrl(relUrl,parentUrl){if("/"===(relUrl=-1!==relUrl.indexOf("\")?relUrl.replace(backslashRegEx,"/"):relUrl)[0]&&"/"===relUrl[1])return parentUrl.slice(0,parentUrl.indexOf(":")+1)+relUrl;if("."===relUrl[0]&&("/"===relUrl[1]||"."===relUrl[1]&&("/"===relUrl[2]||2===relUrl.length&&(relUrl+="/"))||1===relUrl.length&&(relUrl+="/"))||"/"===relUrl[0]){var parentProtocol=parentUrl.slice(0,parentUrl.indexOf(":")+1),pathname="/"===parentUrl[parentProtocol.length+1]?"file:"!==parentProtocol?(pathname=parentUrl.slice(parentProtocol.length+2)).slice(pathname.indexOf("/")+1):parentUrl.slice(8):parentUrl.slice(parentProtocol.length+("/"===parentUrl[parentProtocol.length]));if("/"===relUrl[0])return parentUrl.slice(0,parentUrl.length-pathname.length-1)+relUrl;for(var segmented=pathname.slice(0,pathname.lastIndexOf("/")+1)+relUrl,output=[],segmentIndex=-1,i=0;i<segmented.length;i++)-1!==segmentIndex?"/"===segmented[i]&&(output.push(segmented.slice(segmentIndex,i+1)),segmentIndex=-1):"."===segmented[i]?"."!==segmented[i+1]||"/"!==segmented[i+2]&&i+2!==segmented.length?"/"===segmented[i+1]||i+1===segmented.length?i+=1:segmentIndex=i:(output.pop(),i+=2):segmentIndex=i;return-1!==segmentIndex&&output.push(segmented.slice(segmentIndex)),parentUrl.slice(0,parentUrl.length-pathname.length)+output.join("")}}function resolveUrl(relUrl,parentUrl){return resolveIfNotPlainOrUrl(relUrl,parentUrl)||(-1!==relUrl.indexOf(":")?relUrl:resolveIfNotPlainOrUrl("./"+relUrl,parentUrl))}function resolveAndComposePackages(packages,outPackages,baseUrl,parentMap,parentUrl){for(var p in packages){var mapped,resolvedLhs=resolveIfNotPlainOrUrl(p,baseUrl)||p,rhs=packages[p];"string"==typeof rhs&&((mapped=resolveImportMap(parentMap,resolveIfNotPlainOrUrl(rhs,baseUrl)||rhs,parentUrl))?outPackages[resolvedLhs]=mapped:targetWarning("W1",p,rhs,"bare specifier did not resolve"))}}function resolveAndComposeImportMap(json,baseUrl,outMap){for(var u in json.imports&&resolveAndComposePackages(json.imports,outMap.imports,baseUrl,outMap,null),json.scopes||{}){var resolvedScope=resolveUrl(u,baseUrl);resolveAndComposePackages(json.scopes[u],outMap.scopes[resolvedScope]||(outMap.scopes[resolvedScope]={}),baseUrl,outMap,resolvedScope)}for(u in json.depcache||{})outMap.depcache[resolveUrl(u,baseUrl)]=json.depcache[u];for(u in json.integrity||{})outMap.integrity[resolveUrl(u,baseUrl)]=json.integrity[u]}function getMatch(path,matchObj){if(matchObj[path])return path;var sepIndex=path.length;do{var segment=path.slice(0,sepIndex+1);if(segment in matchObj)return segment}while(-1!==(sepIndex=path.lastIndexOf("/",sepIndex-1)))}function applyPackages(id,packages){var pkgName=getMatch(id,packages);if(pkgName){packages=packages[pkgName];if(null!==packages)return id.length>pkgName.length&&"/"!==packages[packages.length-1]?void targetWarning("W2",pkgName,packages,"should have a trailing '/'"):packages+id.slice(pkgName.length)}}function targetWarning(code,match,target,msg){console.warn(errMsg(code,"Package target "+msg+", resolving target '"+target+"' for "+match))}function resolveImportMap(importMap,resolvedOrPlain,parentUrl){for(var scopes=importMap.scopes,scopeUrl=parentUrl&&getMatch(parentUrl,scopes);scopeUrl;){var packageResolution=applyPackages(resolvedOrPlain,scopes[scopeUrl]);if(packageResolution)return packageResolution;scopeUrl=getMatch(scopeUrl.slice(0,scopeUrl.lastIndexOf("/")),scopes)}return applyPackages(resolvedOrPlain,importMap.imports)||-1!==resolvedOrPlain.indexOf(":")&&resolvedOrPlain}var toStringTag$1=hasSymbol&&Symbol.toStringTag,REGISTRY=hasSymbol?Symbol():"@";function SystemJS(){this[REGISTRY]={}}var lastRegister,systemJSPrototype=SystemJS.prototype;function loadToId(load){return load.id}function triggerOnload(loader,load,err,isErrSource){if(loader.onload(err,load.id,load.d&&load.d.map(loadToId),!!isErrSource),err)throw err}function getOrCreateLoad(loader,id,firstParentUrl,meta){var importerSetters,ns,instantiatePromise,linkPromise,load=loader[REGISTRY][id];return load||(importerSetters=[],ns=Object.create(null),toStringTag$1&&Object.defineProperty(ns,toStringTag$1,{value:"Module"}),linkPromise=(instantiatePromise=Promise.resolve().then(function(){return loader.instantiate(id,firstParentUrl,meta)}).then(function(registration){var declared;if(registration)return declared=registration[1](function _export(name,value){var changed=!(load.h=!0);if("string"==typeof name)name in ns&&ns[name]===value||(ns[name]=value,changed=!0);else{for(var p in name){value=name[p];p in ns&&ns[p]===value||(ns[p]=value,changed=!0)}name&&name.__esModule&&(ns.__esModule=name.__esModule)}if(changed)for(var i=0;i<importerSetters.length;i++){var setter=importerSetters[i];setter&&setter(ns)}return value},2===registration[1].length?{import:function(importId,meta){return loader.import(importId,id,meta)},meta:loader.createContext(id)}:void 0),load.e=declared.execute||function(){},[registration[0],declared.setters||[],registration[2]||[]];throw Error(errMsg(2,"Module "+id+" did not instantiate"))},function(err){throw load.e=null,load.er=err,triggerOnload(loader,load,err,!0),err})).then(function(instantiation){return Promise.all(instantiation[0].map(function(dep,i){var setter=instantiation[1][i],meta=instantiation[2][i];return Promise.resolve(loader.resolve(dep,id)).then(function(depId){var depLoad=getOrCreateLoad(loader,depId,id,meta);return Promise.resolve(depLoad.I).then(function(){return setter&&(depLoad.i.push(setter),!depLoad.h&&depLoad.I||setter(depLoad.n)),depLoad})})})).then(function(depLoads){load.d=depLoads})}),load=loader[REGISTRY][id]={id:id,i:importerSetters,n:ns,m:meta,I:instantiatePromise,L:linkPromise,h:!1,d:void 0,e:void 0,er:void 0,E:void 0,C:void 0,p:void 0})}systemJSPrototype.import=function(id,parentUrl,meta){var loader=this;return parentUrl&&"object"==typeof parentUrl&&(meta=parentUrl,parentUrl=void 0),Promise.resolve(loader.prepareImport()).then(function(){return loader.resolve(id,parentUrl,meta)}).then(function(id){id=getOrCreateLoad(loader,id,void 0,meta);return id.C||function topLevelLoad(loader,load){return load.C=function instantiateAll(loader,load,parent,loaded){if(!loaded[load.id])return loaded[load.id]=!0,Promise.resolve(load.L).then(function(){return load.p&&null!==load.p.e||(load.p=parent),Promise.all(load.d.map(function(dep){return instantiateAll(loader,dep,parent,loaded)}))}).catch(function(err){throw load.er||(load.e=null,triggerOnload(loader,load,err,!1)),err})}(loader,load,load,{}).then(function(){return function postOrderExec(loader,load,seen){if(seen[load.id])return;seen[load.id]=!0;if(!load.e){if(load.er)throw load.er;return load.E?load.E:void 0}var exec=load.e;load.e=null;var depLoadPromises;load.d.forEach(function(depLoad){try{var depLoadPromise=postOrderExec(loader,depLoad,seen);depLoadPromise&&(depLoadPromises=depLoadPromises||[]).push(depLoadPromise)}catch(err){throw load.er=err,triggerOnload(loader,load,err,!1),err}});if(depLoadPromises)return Promise.all(depLoadPromises).then(doExec);return doExec();function doExec(){try{var execPromise=exec.call(nullContext);if(execPromise)return execPromise=execPromise.then(function(){load.C=load.n,load.E=null,triggerOnload(loader,load,null,!0)},function(err){throw load.er=err,load.E=null,triggerOnload(loader,load,err,!0),err}),load.E=execPromise;load.C=load.n,load.L=load.I=void 0}catch(err){throw load.er=err}finally{triggerOnload(loader,load,load.er,!0)}}}(loader,load,{})}).then(function(){return load.n})}(loader,id)})},systemJSPrototype.createContext=function(parentId){var loader=this;return{url:parentId,resolve:function(id,parentUrl){return Promise.resolve(loader.resolve(id,parentUrl||parentId))}}},systemJSPrototype.onload=function(){},systemJSPrototype.register=function(deps,declare,metas){lastRegister=[deps,declare,metas]},systemJSPrototype.getRegister=function(){var _lastRegister=lastRegister;return lastRegister=void 0,_lastRegister};var nullContext=Object.freeze(Object.create(null));envGlobal.System=new SystemJS;var baseOrigin,lastAutoImportDeps,lastAutoImportTimeout,importMapPromise=Promise.resolve(),importMap={imports:{},scopes:{},depcache:{},integrity:{}},processFirst=hasDocument;function processScripts(){[].forEach.call(document.querySelectorAll("script"),function(script){var fetchPromise;script.sp||("systemjs-module"===script.type?(script.sp=!0,script.src&&System.import("import:"===script.src.slice(0,7)?script.src.slice(7):resolveUrl(script.src,baseUrl)).catch(function(e){var event;return-1<e.message.indexOf("https://github.com/systemjs/systemjs/blob/main/docs/errors.md#3")&&((event=document.createEvent("Event")).initEvent("error",!1,!1),script.dispatchEvent(event)),Promise.reject(e)})):"systemjs-importmap"===script.type&&(script.sp=!0,fetchPromise=script.src?(System.fetch||fetch)(script.src,{integrity:script.integrity,passThrough:!0}).then(function(res){if(res.ok)return res.text();throw Error("Invalid status code: "+res.status)}).catch(function(err){return err.message=errMsg("W4","Error fetching systemjs-import map "+script.src)+"
"+err.message,console.warn(err),"function"==typeof script.onerror&&script.onerror(),"{}"}):script.innerHTML,importMapPromise=importMapPromise.then(function(){return fetchPromise}).then(function(text){!function extendImportMap(importMap,newMapText,newMapUrl){var newMap={};try{newMap=JSON.parse(newMapText)}catch(err){console.warn(Error(errMsg("W5","systemjs-importmap contains invalid JSON")+"
"+newMapText+"
"))}resolveAndComposeImportMap(newMap,newMapUrl,importMap)}(importMap,text,script.src||baseUrl)})))})}systemJSPrototype.prepareImport=function(doProcessScripts){return(processFirst||doProcessScripts)&&(processScripts(),processFirst=!1),importMapPromise},hasDocument&&(processScripts(),window.addEventListener("DOMContentLoaded",processScripts)),systemJSPrototype.addImportMap=function(newMap,mapBase){resolveAndComposeImportMap(newMap,mapBase||baseUrl,importMap)},hasDocument&&(window.addEventListener("error",function(evt){lastWindowErrorUrl=evt.filename,lastWindowError=evt.error}),baseOrigin=location.origin),systemJSPrototype.createScript=function(url){var script=document.createElement("script"),integrity=(script.async=!0,url.indexOf(baseOrigin+"/")&&(script.crossOrigin="anonymous"),importMap.integrity[url]);return integrity&&(script.integrity=integrity),script.src=url,script};var lastWindowErrorUrl,lastWindowError,autoImportCandidates={},systemRegister=systemJSPrototype.register,instantiate=(systemJSPrototype.register=function(deps,declare){var scripts,lastScript,loader;return hasDocument&&"loading"===document.readyState&&"string"!=typeof deps?(scripts=document.querySelectorAll("script[src]"),(lastScript=scripts[scripts.length-1])&&(lastScript.src,lastAutoImportDeps=deps,loader=this,lastAutoImportTimeout=setTimeout(function(){autoImportCandidates[lastScript.src]=[deps,declare],loader.import(lastScript.src)}))):lastAutoImportDeps=void 0,systemRegister.call(this,deps,declare)},systemJSPrototype.instantiate=function(url,firstParentUrl){var loader,autoImportRegistration=autoImportCandidates[url];return autoImportRegistration?(delete autoImportCandidates[url],autoImportRegistration):(loader=this,Promise.resolve(systemJSPrototype.createScript(url)).then(function(script){return new Promise(function(resolve,reject){script.addEventListener("error",function(){reject(Error(errMsg(3,"Error loading "+url+(firstParentUrl?" from "+firstParentUrl:""))))}),script.addEventListener("load",function(){var register;document.head.removeChild(script),lastWindowErrorUrl===url?reject(lastWindowError):((register=loader.getRegister(url))&®ister[0]===lastAutoImportDeps&&clearTimeout(lastAutoImportTimeout),resolve(register))}),document.head.appendChild(script)})}))},systemJSPrototype.shouldFetch=function(){return!1},"undefined"!=typeof fetch&&(systemJSPrototype.fetch=fetch),systemJSPrototype.instantiate),jsContentTypeRegEx=/^(text|application)/(x-)?javascript(;|$)/;systemJSPrototype.instantiate=function(url,parent,meta){var loader=this;return this.shouldFetch(url,parent,meta)?this.fetch(url,{credentials:"same-origin",integrity:importMap.integrity[url],meta:meta}).then(function(res){if(!res.ok)throw Error(errMsg(7,res.status+" "+res.statusText+", loading "+url+(parent?" from "+parent:"")));var contentType=res.headers.get("content-type");if(contentType&&jsContentTypeRegEx.test(contentType))return res.text().then(function(source){return source.indexOf("//# sourceURL=")<0&&(source+="
//# sourceURL="+url),(0,eval)(source),loader.getRegister(url)});throw Error(errMsg(4,'Unknown Content-Type "'+contentType+'", loading '+url+(parent?" from "+parent:"")))}):instantiate.apply(this,arguments)},systemJSPrototype.resolve=function(id,parentUrl){return resolveImportMap(importMap,resolveIfNotPlainOrUrl(id,parentUrl=parentUrl||baseUrl)||id,parentUrl)||function throwUnresolved(id,parentUrl){throw Error(errMsg(8,"Unable to resolve bare specifier '"+id+(parentUrl?"' from "+parentUrl:"'")))}(id,parentUrl)};var systemInstantiate=systemJSPrototype.instantiate,toStringTag=(systemJSPrototype.instantiate=function(url,firstParentUrl,meta){var preloads=importMap.depcache[url];if(preloads)for(var i=0;i<preloads.length;i++)getOrCreateLoad(this,this.resolve(preloads[i],url),url);return systemInstantiate.call(this,url,firstParentUrl,meta)},hasSelf&&"function"==typeof importScripts&&(systemJSPrototype.instantiate=function(url){var loader=this;return Promise.resolve().then(function(){return importScripts(url),loader.getRegister(url)})}),!function(global){var firstGlobalProp,secondGlobalProp,lastGlobalProp,systemJSPrototype=global.System.constructor.prototype;var impt=systemJSPrototype.import,emptyInstantiation=(systemJSPrototype.import=function(id,parentUrl,meta){return function noteGlobalProps(){for(var p in firstGlobalProp=secondGlobalProp=void 0,global)shouldSkipProperty(p)||(firstGlobalProp?secondGlobalProp=secondGlobalProp||p:firstGlobalProp=p,lastGlobalProp=p)}(),impt.call(this,id,parentUrl,meta)},[[],function(){return{}}]),getRegister=systemJSPrototype.getRegister,isIE11=(systemJSPrototype.getRegister=function(){var lastRegister=getRegister.call(this);if(lastRegister)return lastRegister;var globalExport,lastRegister=function getGlobalProp(useFirstGlobalProp){var foundLastProp,result,p,cnt=0;for(p in global)if(!shouldSkipProperty(p)){if(0===cnt&&p!==firstGlobalProp||1===cnt&&p!==secondGlobalProp)return p;foundLastProp?(lastGlobalProp=p,result=useFirstGlobalProp&&result||p):foundLastProp=p===lastGlobalProp,cnt++}return result}(this.firstGlobalProp);if(!lastRegister)return emptyInstantiation;try{globalExport=global[lastRegister]}catch(e){return emptyInstantiation}return[[],function(_export){return{execute:function(){_export(globalExport),_export({default:globalExport,__useDefault:!0})}}}]},"undefined"!=typeof navigator&&-1!==navigator.userAgent.indexOf("Trident"));function shouldSkipProperty(p){return!global.hasOwnProperty(p)||!isNaN(p)&&p<global.length||isIE11&&global[p]&&"undefined"!=typeof window&&global[p].parent===window}}("undefined"!=typeof self?self:global),!function(global){var systemJSPrototype=global.System.constructor.prototype,moduleTypesRegEx=/^[^#?]+.(css|html|json|wasm)([?#].*)?$/,_shouldFetch=systemJSPrototype.shouldFetch.bind(systemJSPrototype),jsonContentType=(systemJSPrototype.shouldFetch=function(url){return _shouldFetch(url)||moduleTypesRegEx.test(url)},/^application/json(;|$)/),cssContentType=/^text/css(;|$)/,wasmContentType=/^application/wasm(;|$)/,fetch=systemJSPrototype.fetch;systemJSPrototype.fetch=function(url,options){return fetch(url,options).then(function(res){var contentType;return!options.passThrough&&res.ok?(contentType=res.headers.get("content-type"),jsonContentType.test(contentType)?res.json().then(function(json){return new Response(new Blob(['System.register([],function(e){return{execute:function(){e("default",'+JSON.stringify(json)+")}}})"],{type:"application/javascript"}))}):cssContentType.test(contentType)?res.text().then(function(source){return source=source.replace(/url(s*(?:(["'])((?:\.|[^
\"'])+)1|((?:\.|[^s,"'()\])+))s*)/g,function(match,quotes,relUrl1,relUrl2){return"url("+quotes+resolveUrl(relUrl1||relUrl2,url)+quotes+")"}),new Response(new Blob(["System.register([],function(e){return{execute:function(){var s=new CSSStyleSheet();s.replaceSync("+JSON.stringify(source)+');e("default",s)}}})'],{type:"application/javascript"}))}):wasmContentType.test(contentType)?(WebAssembly.compileStreaming?WebAssembly.compileStreaming(res):res.arrayBuffer().then(WebAssembly.compile)).then(function(module){global.System.wasmModules||(global.System.wasmModules=Object.create(null)),global.System.wasmModules[url]=module;var deps=[],setterSources=[];return WebAssembly.Module.imports&&WebAssembly.Module.imports(module).forEach(function(impt){impt=JSON.stringify(impt.module);-1===deps.indexOf(impt)&&(deps.push(impt),setterSources.push("function(m){i["+impt+"]=m}"))}),new Response(new Blob(["System.register(["+deps.join(",")+"],function(e){var i={};return{setters:["+setterSources.join(",")+"],execute:function(){return WebAssembly.instantiate(System.wasmModules["+JSON.stringify(url)+"],i).then(function(m){e(m.exports)})}}})"],{type:"application/javascript"}))}):res):res})}}("undefined"!=typeof self?self:global),"undefined"!=typeof Symbol&&Symbol.toStringTag),iterator=(systemJSPrototype.get=function(id){id=this[REGISTRY][id];if(id&&null===id.e&&!id.E)return id.er?null:id.n},systemJSPrototype.set=function(id,module){try{new URL(id)}catch(err){console.warn(Error(errMsg("W3",'"'+id+'" is not a valid URL to set in the module registry')))}toStringTag&&"Module"===module[toStringTag]?ns=module:(ns=Object.assign(Object.create(null),module),toStringTag&&Object.defineProperty(ns,toStringTag,{value:"Module"}));var ns,module=Promise.resolve(ns),id=this[REGISTRY][id]||(this[REGISTRY][id]={id:id,i:[],h:!1,d:[],e:null,er:void 0,E:void 0});return!id.e&&!id.E&&(Object.assign(id,{n:ns,I:void 0,L:void 0,C:module}),ns)},systemJSPrototype.has=function(id){return!!this[REGISTRY][id]},systemJSPrototype.delete=function(id){var importerSetters,registry=this[REGISTRY],load=registry[id];return!(!load||load.p&&null!==load.p.e||load.E)&&(importerSetters=load.i,load.d&&load.d.forEach(function(depLoad){var importerIndex=depLoad.i.indexOf(load);-1!==importerIndex&&depLoad.i.splice(importerIndex,1)}),delete registry[id],function(){var load=registry[id];if(!load||!importerSetters||null!==load.e||load.E)return!1;importerSetters.forEach(function(setter){load.i.push(setter),setter(load.n)}),importerSetters=null})},"undefined"!=typeof Symbol&&Symbol.iterator);systemJSPrototype.entries=function(){var ns,key,loader=this,keys=Object.keys(loader[REGISTRY]),index=0,result={next:function(){for(;void 0!==(key=keys[index++])&&void 0===(ns=loader.get(key)););return{done:void 0===key,value:void 0!==key&&[key,ns]}}};return result[iterator]=function(){return this},result}}(),!function(global){function SystemJS(){constructor.call(this),setRegisterRegistry(this)}var firstNamedDefine,firstName,global=global.System,systemJSPrototype=(setRegisterRegistry(global),global.constructor.prototype),constructor=global.constructor;function setRegisterRegistry(systemInstance){systemInstance.registerRegistry=Object.create(null),systemInstance.namedRegisterAliases=Object.create(null)}SystemJS.prototype=systemJSPrototype,global.constructor=SystemJS;var register=systemJSPrototype.register,resolve=(systemJSPrototype.register=function(name,deps,declare,metas){var define;return"string"!=typeof name?register.apply(this,arguments):(this.registerRegistry[name]=define=[deps,declare,metas],firstNamedDefine||(firstNamedDefine=define,firstName=name),Promise.resolve().then(function(){firstName=firstNamedDefine=null}),register.apply(this,[deps,declare,metas]))},systemJSPrototype.resolve),instantiate=(systemJSPrototype.resolve=function(id,parentURL){try{return resolve.call(this,id,parentURL)}catch(err){if(id in this.registerRegistry)return this.namedRegisterAliases[id]||id;throw err}},systemJSPrototype.instantiate),getRegister=(systemJSPrototype.instantiate=function(url,firstParentUrl,meta){var result=this.registerRegistry[url];return result?(this.registerRegistry[url]=null,result):instantiate.call(this,url,firstParentUrl,meta)},systemJSPrototype.getRegister);systemJSPrototype.getRegister=function(url){var register=getRegister.call(this,url),url=(firstName&&url&&(this.namedRegisterAliases[firstName]=url),firstNamedDefine||register);return firstName=firstNamedDefine=null,url}}("undefined"!=typeof self?self:global),!function(exports){"use strict";var FrameLoadingStyle,FetchMethod,FormSubmissionState,FormEnctype,TimingMetric,VisitState,SystemStatusCode,PageStage,__async$3=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});if(void 0!==window.Reflect&&void 0!==window.customElements&&!window.customElements.polyfillWrapFlushCallback){const BuiltInHTMLElement=HTMLElement,wrapperForTheName_HTMLElement=function HTMLElement2(){return Reflect.construct(BuiltInHTMLElement,[],this.constructor)};window.HTMLElement=wrapperForTheName_HTMLElement,HTMLElement.prototype=BuiltInHTMLElement.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,BuiltInHTMLElement)}function raise(errorConstructor,message,name){throw new errorConstructor("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+message+".",name)}"function"!=typeof(prototype=HTMLFormElement.prototype).requestSubmit&&(prototype.requestSubmit=function(submitter){submitter?(function validateSubmitter(submitter,form){submitter instanceof HTMLElement||raise(TypeError,"parameter 1 is not of type 'HTMLElement'"),"submit"!=submitter.type&&raise(TypeError,"The specified element is not a submit button"),submitter.form!=form&&raise(DOMException,"The specified element is not owned by this form element","NotFoundError")}(submitter,this),submitter.click()):((submitter=document.createElement("input")).type="submit",submitter.hidden=!0,this.appendChild(submitter),submitter.click(),this.removeChild(submitter))});const submittersByForm=new WeakMap;function clickCaptured(event){event=function findSubmitterFromClickTarget(target){return"submit"==(null==(target=(target=target instanceof Element?target:target instanceof Node?target.parentElement:null)?target.closest("input, button"):null)?void 0:target.type)?target:null}(event.target);event&&event.form&&submittersByForm.set(event.form,event)}!function(){if(!("submitter"in Event.prototype)){let prototype=window.Event.prototype;if("SubmitEvent"in window&&/Apple Computer/.test(navigator.vendor))prototype=window.SubmitEvent.prototype;else if("SubmitEvent"in window)return;addEventListener("click",clickCaptured,!0),Object.defineProperty(prototype,"submitter",{get(){if("submit"==this.type&&this.target instanceof HTMLFormElement)return submittersByForm.get(this.target)}})}}(),(prototype=FrameLoadingStyle=FrameLoadingStyle||{}).eager="eager",prototype.lazy="lazy";class FrameElement extends HTMLElement{static get observedAttributes(){return["disabled","complete","loading","src"]}constructor(){super(),this.loaded=Promise.resolve(),this.delegate=new FrameElement.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(name){"loading"==name?this.delegate.loadingStyleChanged():"complete"==name?this.delegate.completeChanged():"src"==name?this.delegate.sourceURLChanged():this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(value){value?this.setAttribute("src",value):this.removeAttribute("src")}get loading(){return function frameLoadingStyleFromString(style){{if("lazy"!==style.toLowerCase())return FrameLoadingStyle.eager;return FrameLoadingStyle.lazy}}(this.getAttribute("loading")||"")}set loading(value){value?this.setAttribute("loading",value):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(value){value?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(value){value?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){var _a;return null==(_a=null==(_a=this.ownerDocument)?void 0:_a.documentElement)?void 0:_a.hasAttribute("data-turbo-preview")}}function expandURL(locatable){return new URL(locatable.toString(),document.baseURI)}function getAnchor(url){return url.hash?url.hash.slice(1):(url=url.href.match(/#(.*)$/))?url[1]:void 0}function getAction(form,submitter){return expandURL((null==submitter?void 0:submitter.getAttribute("formaction"))||form.getAttribute("action")||form.action)}function getExtension(url){return(function getLastPathComponent(url){return function getPathComponents(url){return url.pathname.split("/").slice(1)}(url).slice(-1)[0]}(url).match(/.[^.]*$/)||[])[0]||""}function isPrefixedBy(baseURL,url){url=function getPrefix(url){return function addTrailingSlash(value){return value.endsWith("/")?value:value+"/"}(url.origin+url.pathname)}(url);return baseURL.href===expandURL(url).href||baseURL.href.startsWith(url)}function locationIsVisitable(location2,rootLocation){return isPrefixedBy(location2,rootLocation)&&function isHTML(url){return!!getExtension(url).match(/^(?:|.(?:htm|html|xhtml|php))$/)}(location2)}function getRequestURL(url){var anchor=getAnchor(url);return null!=anchor?url.href.slice(0,-(anchor.length+1)):url.href}function toCacheKey(url){return getRequestURL(url)}class FetchResponse{constructor(response){this.response=response}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return 400<=this.statusCode&&this.statusCode<=499}get serverError(){return 500<=this.statusCode&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return expandURL(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text/([^s;,]+)?html|application/xhtml+xml)/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(name){return this.response.headers.get(name)}}function activateScriptElement(element){var createdScriptElement,cspNonce;return"false"==element.getAttribute("data-turbo-eval")?element:(createdScriptElement=document.createElement("script"),(cspNonce=getMetaContent("csp-nonce"))&&(createdScriptElement.nonce=cspNonce),createdScriptElement.textContent=element.textContent,createdScriptElement.async=!1,function copyElementAttributes(destinationElement,sourceElement){for(var{name,value}of sourceElement.attributes)destinationElement.setAttribute(name,value)}(createdScriptElement,element),createdScriptElement)}function dispatch(eventName,{target,cancelable,detail}={}){eventName=new CustomEvent(eventName,{cancelable:cancelable,bubbles:!0,composed:!0,detail:detail});return(target&&target.isConnected?target:document.documentElement).dispatchEvent(eventName),eventName}function nextAnimationFrame(){return new Promise(resolve=>requestAnimationFrame(()=>resolve()))}function parseHTMLDocument(html=""){return(new DOMParser).parseFromString(html,"text/html")}function unindent(strings,…values){strings=function interpolate(strings,values){return strings.reduce((result,string,i)=>{return result+string+(null==values[i]?"":values[i])},"")}(strings,values).replace(/^
/,"").split("
"),values=strings[0].match(/^s+/);const indent=values?values[0].length:0;return strings.map(line=>line.slice(indent)).join("
")}function uuid(){return Array.from({length:36}).map((_,i)=>8==i||13==i||18==i||23==i?"-":14==i?"4":(19==i?Math.floor(4*Math.random())+8:Math.floor(15*Math.random())).toString(16)).join("")}function getAttribute(attributeName,…elements){for(const value of elements.map(element=>null==element?void 0:element.getAttribute(attributeName)))if("string"==typeof value)return value;return null}function markAsBusy(…elements){for(const element of elements)"turbo-frame"==element.localName&&element.setAttribute("busy",""),element.setAttribute("aria-busy","true")}function clearBusyState(…elements){for(const element of elements)"turbo-frame"==element.localName&&element.removeAttribute("busy"),element.removeAttribute("aria-busy")}function getHistoryMethodForAction(action){switch(action){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function getVisitAction(…elements){elements=getAttribute("data-turbo-action",…elements);return function isAction(action){return"advance"==action||"replace"==action||"restore"==action}(elements)?elements:null}function getMetaElement(name){return document.querySelector(`meta[name="${name}"]`)}function getMetaContent(name){name=getMetaElement(name);return name&&name.content}function findClosestRecursively(element,selector){if(element instanceof Element)return element.closest(selector)||findClosestRecursively(element.assignedSlot||(null==(element=element.getRootNode())?void 0:element.host),selector)}(prototype=FetchMethod=FetchMethod||{})[prototype.get=0]="get",prototype[prototype.post=1]="post",prototype[prototype.put=2]="put",prototype[prototype.patch=3]="patch",prototype[prototype.delete=4]="delete";class FetchRequest{constructor(delegate,method,location2,body=new URLSearchParams,target=null){this.abortController=new AbortController,this.resolveRequestPromise=_value=>{},this.delegate=delegate,this.method=method,this.headers=this.defaultHeaders,this.body=body,this.url=location2,this.target=target}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}perform(){return __async$3(this,null,function*(){var fetchOptions=this["fetchOptions"];this.delegate.prepareRequest(this),yield this.allowRequestToBeIntercepted(fetchOptions);try{this.delegate.requestStarted(this);var response=yield fetch(this.url.href,fetchOptions);return yield this.receive(response)}catch(error){if("AbortError"!==error.name)throw this.willDelegateErrorHandling(error)&&this.delegate.requestErrored(this,error),error}finally{this.delegate.requestFinished(this)}})}receive(response){return __async$3(this,null,function*(){var fetchResponse=new FetchResponse(response);return dispatch("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:fetchResponse},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,fetchResponse):fetchResponse.succeeded?this.delegate.requestSucceededWithResponse(this,fetchResponse):this.delegate.requestFailedWithResponse(this,fetchResponse),fetchResponse})}get fetchOptions(){var _a;return{method:FetchMethod[this.method].toUpperCase(),credentials:"same-origin",headers:this.headers,redirect:"follow",body:this.isSafe?null:this.body,signal:this.abortSignal,referrer:null==(_a=this.delegate.referrer)?void 0:_a.href}}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return this.method===FetchMethod.get}get abortSignal(){return this.abortController.signal}acceptResponseType(mimeType){this.headers.Accept=[mimeType,this.headers.Accept].join(", ")}allowRequestToBeIntercepted(fetchOptions){return __async$3(this,null,function*(){var requestInterception=new Promise(resolve=>this.resolveRequestPromise=resolve);dispatch("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:fetchOptions,url:this.url,resume:this.resolveRequestPromise},target:this.target}).defaultPrevented&&(yield requestInterception)})}willDelegateErrorHandling(error){return!dispatch("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:error}}).defaultPrevented}}class AppearanceObserver{constructor(delegate,element){this.started=!1,this.intersect=entries=>{entries=entries.slice(-1)[0];null!=entries&&entries.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)},this.delegate=delegate,this.element=element,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}}class StreamMessage{static wrap(message){return"string"==typeof message?new this(function createDocumentFragment(html){var template=document.createElement("template");return template.innerHTML=html,template.content}(message)):message}constructor(fragment){this.fragment=function importStreamElements(fragment){for(const element of fragment.querySelectorAll("turbo-stream")){var streamElement=document.importNode(element,!0);for(const inertScriptElement of streamElement.templateElement.content.querySelectorAll("script"))inertScriptElement.replaceWith(activateScriptElement(inertScriptElement));element.replaceWith(streamElement)}return fragment}(fragment)}}StreamMessage.contentType="text/vnd.turbo-stream.html",(prototype=FormSubmissionState=FormSubmissionState||{})[prototype.initialized=0]="initialized",prototype[prototype.requesting=1]="requesting",prototype[prototype.waiting=2]="waiting",prototype[prototype.receiving=3]="receiving",prototype[prototype.stopping=4]="stopping",prototype[prototype.stopped=5]="stopped",(prototype=FormEnctype=FormEnctype||{}).urlEncoded="application/x-www-form-urlencoded",prototype.multipart="multipart/form-data",prototype.plain="text/plain";class FormSubmission{static confirmMethod(message,_element,_submitter){return Promise.resolve(confirm(message))}constructor(delegate,formElement,submitter,mustRedirect=!1){this.state=FormSubmissionState.initialized,this.delegate=delegate,this.formElement=formElement,this.submitter=submitter,this.formData=function buildFormData(formElement,submitter){var formElement=new FormData(formElement),name=null==submitter?void 0:submitter.getAttribute("name"),submitter=null==submitter?void 0:submitter.getAttribute("value");name&&formElement.append(name,submitter||"");return formElement}(formElement,submitter),this.location=expandURL(this.action),this.method==FetchMethod.get&&function mergeFormDataEntries(url,entries){var searchParams=new URLSearchParams;for(var[name,value]of entries)value instanceof File||searchParams.append(name,value);url.search=searchParams.toString()}(this.location,[…this.body.entries()]),this.fetchRequest=new FetchRequest(this,this.method,this.location,this.body,this.formElement),this.mustRedirect=mustRedirect}get method(){var _a;return function fetchMethodFromString(method){switch(method.toLowerCase()){case"get":return FetchMethod.get;case"post":return FetchMethod.post;case"put":return FetchMethod.put;case"patch":return FetchMethod.patch;case"delete":return FetchMethod.delete}}(((null==(_a=this.submitter)?void 0:_a.getAttribute("formmethod"))||this.formElement.getAttribute("method")||"").toLowerCase())||FetchMethod.get}get action(){var _a,formElementAction="string"==typeof this.formElement.action?this.formElement.action:null;return null!=(_a=this.submitter)&&_a.hasAttribute("formaction")?this.submitter.getAttribute("formaction")||"":this.formElement.getAttribute("action")||formElementAction||""}get body(){return this.enctype==FormEnctype.urlEncoded||this.method==FetchMethod.get?new URLSearchParams(this.stringFormData):this.formData}get enctype(){var _a;return function formEnctypeFromString(encoding){switch(encoding.toLowerCase()){case FormEnctype.multipart:return FormEnctype.multipart;case FormEnctype.plain:return FormEnctype.plain;default:return FormEnctype.urlEncoded}}((null==(_a=this.submitter)?void 0:_a.getAttribute("formenctype"))||this.formElement.enctype)}get isSafe(){return this.fetchRequest.isSafe}get stringFormData(){return[…this.formData].reduce((entries,[name,value])=>entries.concat("string"==typeof value?[[name,value]]:[]),[])}start(){return __async$3(this,null,function*(){var{initialized,requesting}=FormSubmissionState,confirmationMessage=getAttribute("data-turbo-confirm",this.submitter,this.formElement);if("string"==typeof confirmationMessage&&!(yield FormSubmission.confirmMethod(confirmationMessage,this.formElement,this.submitter)))return;if(this.state==initialized)return this.state=requesting,this.fetchRequest.perform()})}stop(){var{stopping,stopped}=FormSubmissionState;if(this.state!=stopping&&this.state!=stopped)return this.state=stopping,this.fetchRequest.cancel(),!0}prepareRequest(request){var token;request.isSafe||(token=function getCookieValue(cookieName){{var cookie;return null!=cookieName&&(cookie=(document.cookie?document.cookie.split("; "):[]).find(cookie2=>cookie2.startsWith(cookieName)))&&(cookie=cookie.split("=").slice(1).join("="))?decodeURIComponent(cookie):void 0}}(getMetaContent("csrf-param"))||getMetaContent("csrf-token"))&&(request.headers["X-CSRF-Token"]=token),this.requestAcceptsTurboStreamResponse(request)&&request.acceptResponseType(StreamMessage.contentType)}requestStarted(_request){var _a;this.state=FormSubmissionState.waiting,null!=(_a=this.submitter)&&_a.setAttribute("disabled",""),this.setSubmitsWith(),dispatch("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(request,response){this.result={success:response.succeeded,fetchResponse:response}}requestSucceededWithResponse(request,response){response.clientError||response.serverError?this.delegate.formSubmissionFailedWithResponse(this,response):this.requestMustRedirect(request)&&function responseSucceededWithoutRedirect(response){return 200==response.statusCode&&!response.redirected}(response)?(request=new Error("Form responses must redirect to another location"),this.delegate.formSubmissionErrored(this,request)):(this.state=FormSubmissionState.receiving,this.result={success:!0,fetchResponse:response},this.delegate.formSubmissionSucceededWithResponse(this,response))}requestFailedWithResponse(request,response){this.result={success:!1,fetchResponse:response},this.delegate.formSubmissionFailedWithResponse(this,response)}requestErrored(request,error){this.result={success:!1,error:error},this.delegate.formSubmissionErrored(this,error)}requestFinished(_request){var _a;this.state=FormSubmissionState.stopped,null!=(_a=this.submitter)&&_a.removeAttribute("disabled"),this.resetSubmitterText(),dispatch("turbo:submit-end",{target:this.formElement,detail:Object.assign({formSubmission:this},this.result)}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){var input;this.submitter&&this.submitsWith&&(this.submitter.matches("button")?(this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith):this.submitter.matches("input")&&(input=this.submitter,this.originalSubmitText=input.value,input.value=this.submitsWith))}resetSubmitterText(){this.submitter&&this.originalSubmitText&&(this.submitter.matches("button")?this.submitter.innerHTML=this.originalSubmitText:this.submitter.matches("input")&&(this.submitter.value=this.originalSubmitText))}requestMustRedirect(request){return!request.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(request){return!request.isSafe||function hasAttribute(attributeName,…elements){return elements.some(element=>element&&element.hasAttribute(attributeName))}("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){var _a;return null==(_a=this.submitter)?void 0:_a.getAttribute("data-turbo-submits-with")}}class Snapshot{constructor(element){this.element=element}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[…this.element.children]}hasAnchor(anchor){return null!=this.getElementForAnchor(anchor)}getElementForAnchor(anchor){return anchor?this.element.querySelector(`[id='${anchor}'], a[name="${anchor}"]`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){for(const element of this.element.querySelectorAll("[autofocus]"))if(null==element.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])"))return element;return null}get permanentElements(){return queryPermanentElementsAll(this.element)}getPermanentElementById(id){return getPermanentElementById(this.element,id)}getPermanentElementMapForSnapshot(snapshot){var permanentElementMap={};for(const currentPermanentElement of this.permanentElements){var id=currentPermanentElement["id"],newPermanentElement=snapshot.getPermanentElementById(id);newPermanentElement&&(permanentElementMap[id]=[currentPermanentElement,newPermanentElement])}return permanentElementMap}}function getPermanentElementById(node,id){return node.querySelector(`#${id}[data-turbo-permanent]`)}function queryPermanentElementsAll(node){return node.querySelectorAll("[id][data-turbo-permanent]")}class FormSubmitObserver{constructor(delegate,eventTarget){this.started=!1,this.submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)},this.submitBubbled=event=>{var form,submitter;event.defaultPrevented||(form=event.target instanceof HTMLFormElement?event.target:void 0,submitter=event.submitter||void 0,form&&function submissionDoesNotDismissDialog(form,submitter){submitter=(null==submitter?void 0:submitter.getAttribute("formmethod"))||form.getAttribute("method");return"dialog"!=submitter}(form,submitter)&&function submissionDoesNotTargetIFrame(form,submitter){{if(null!=submitter&&submitter.hasAttribute("formtarget")||form.hasAttribute("target")){submitter=(null==submitter?void 0:submitter.getAttribute("formtarget"))||form.target;for(const element of document.getElementsByName(submitter))if(element instanceof HTMLIFrameElement)return}return 1}}(form,submitter)&&this.delegate.willSubmitForm(form,submitter)&&(event.preventDefault(),event.stopImmediatePropagation(),this.delegate.formSubmitted(form,submitter)))},this.delegate=delegate,this.eventTarget=eventTarget}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}}class View{constructor(delegate,element){this.resolveRenderPromise=_value=>{},this.resolveInterceptionPromise=_value=>{},this.delegate=delegate,this.element=element}scrollToAnchor(anchor){anchor=this.snapshot.getElementForAnchor(anchor);anchor?(this.scrollToElement(anchor),this.focusElement(anchor)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(location2){this.scrollToAnchor(getAnchor(location2))}scrollToElement(element){element.scrollIntoView()}focusElement(element){element instanceof HTMLElement&&(element.hasAttribute("tabindex")?element.focus():(element.setAttribute("tabindex","-1"),element.focus(),element.removeAttribute("tabindex")))}scrollToPosition({x,y}){this.scrollRoot.scrollTo(x,y)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}render(renderer){return __async$3(this,null,function*(){var{isPreview,shouldRender,newSnapshot:snapshot}=renderer;if(shouldRender)try{this.renderPromise=new Promise(resolve=>this.resolveRenderPromise=resolve),this.renderer=renderer,yield this.prepareToRenderSnapshot(renderer);var renderInterception=new Promise(resolve=>this.resolveInterceptionPromise=resolve),options={resume:this.resolveInterceptionPromise,render:this.renderer.renderElement};this.delegate.allowsImmediateRender(snapshot,options)||(yield renderInterception),yield this.renderSnapshot(renderer),this.delegate.viewRenderedSnapshot(snapshot,isPreview),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(renderer)}finally{delete this.renderer,this.resolveRenderPromise(void 0),delete this.renderPromise}else this.invalidate(renderer.reloadReason)})}invalidate(reason){this.delegate.viewInvalidated(reason)}prepareToRenderSnapshot(renderer){return __async$3(this,null,function*(){this.markAsPreview(renderer.isPreview),yield renderer.prepareToRender()})}markAsPreview(isPreview){isPreview?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}renderSnapshot(renderer){return __async$3(this,null,function*(){yield renderer.render()})}finishRenderingSnapshot(renderer){renderer.finishRendering()}}class FrameView extends View{missing(){this.element.innerHTML='<strong>Content missing</strong>'}get snapshot(){return new Snapshot(this.element)}}class LinkInterceptor{constructor(delegate,element){this.clickBubbled=event=>{this.respondsToEventTarget(event.target)?this.clickEvent=event:delete this.clickEvent},this.linkClicked=event=>{this.clickEvent&&this.respondsToEventTarget(event.target)&&event.target instanceof Element&&this.delegate.shouldInterceptLinkClick(event.target,event.detail.url,event.detail.originalEvent)&&(this.clickEvent.preventDefault(),event.preventDefault(),this.delegate.linkClickIntercepted(event.target,event.detail.url,event.detail.originalEvent)),delete this.clickEvent},this.willVisit=_event=>{delete this.clickEvent},this.delegate=delegate,this.element=element}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}respondsToEventTarget(target){target=target instanceof Element?target:target instanceof Node?target.parentElement:null;return target&&target.closest("turbo-frame, html")==this.element}}class LinkClickObserver{constructor(delegate,eventTarget){this.started=!1,this.clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)},this.clickBubbled=event=>{var target,location2;event instanceof MouseEvent&&this.clickEventIsSignificant(event)&&(target=event.composedPath&&event.composedPath()[0]||event.target,(target=this.findLinkFromClickTarget(target))&&function doesNotTargetIFrame(anchor){{if(anchor.hasAttribute("target"))for(const element of document.getElementsByName(anchor.target))if(element instanceof HTMLIFrameElement)return;return 1}}(target)&&(location2=this.getLocationForLink(target),this.delegate.willFollowLinkToLocation(target,location2,event)&&(event.preventDefault(),this.delegate.followedLinkToLocation(target,location2))))},this.delegate=delegate,this.eventTarget=eventTarget}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickEventIsSignificant(event){return!(event.target&&event.target.isContentEditable||event.defaultPrevented||1<event.which||event.altKey||event.ctrlKey||event.metaKey||event.shiftKey)}findLinkFromClickTarget(target){return findClosestRecursively(target,"a[href]:not([target^=_]):not([download])")}getLocationForLink(link){return expandURL(link.getAttribute("href")||"")}} FormLinkClickObserver{constructor(delegate,element){this.delegate=delegate,this.linkInterceptor=new LinkClickObserver(this,element)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}willFollowLinkToLocation(link,location2,originalEvent){return this.delegate.willSubmitFormLinkToLocation(link,location2,originalEvent)&&link.hasAttribute("data-turbo-method")}followedLinkToLocation(link,location2){const form=document.createElement("form");var name,value;for([name,value]of location2.searchParams)form.append(Object.assign(document.createElement("input"),{type:"hidden",name:name,value:value}));var action=Object.assign(location2,{search:""}),action=(form.setAttribute("data-turbo","true"),form.setAttribute("action",action.href),form.setAttribute("hidden",""),link.getAttribute("data-turbo-method")),action=(action&&form.setAttribute("method",action),link.getAttribute("data-turbo-frame")),action=(action&&form.setAttribute("data-turbo-frame",action),getVisitAction(link)),action=(action&&form.setAttribute("data-turbo-action",action),link.getAttribute("data-turbo-confirm")),action=(action&&form.setAttribute("data-turbo-confirm",action),link.hasAttribute("data-turbo-stream"));action&&form.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(link,location2,form),document.body.appendChild(form),form.addEventListener("turbo:submit-end",()=>form.remove(),{once:!0}),requestAnimationFrame(()=>form.requestSubmit())}}class Bardo{static preservingPermanentElements(delegate,permanentElementMap,callback){return __async$3(this,null,function*(){var bardo=new this(delegate,permanentElementMap);bardo.enter(),yield callback(),bardo.leave()})}constructor(delegate,permanentElementMap){this.delegate=delegate,this.permanentElementMap=permanentElementMap}enter(){for(const id in this.permanentElementMap){var[currentPermanentElement,newPermanentElement]=this.permanentElementMap[id];this.delegate.enteringBardo(currentPermanentElement,newPermanentElement),this.replaceNewPermanentElementWithPlaceholder(newPermanentElement)}}leave(){for(const id in this.permanentElementMap){var[currentPermanentElement]=this.permanentElementMap[id];this.replaceCurrentPermanentElementWithClone(currentPermanentElement),this.replacePlaceholderWithPermanentElement(currentPermanentElement),this.delegate.leavingBardo(currentPermanentElement)}}replaceNewPermanentElementWithPlaceholder(permanentElement){var placeholder=function createPlaceholderForPermanentElement(permanentElement){var element=document.createElement("meta");return element.setAttribute("name","turbo-permanent-placeholder"),element.setAttribute("content",permanentElement.id),element}(permanentElement);permanentElement.replaceWith(placeholder)}replaceCurrentPermanentElementWithClone(permanentElement){var clone=permanentElement.cloneNode(!0);permanentElement.replaceWith(clone)}replacePlaceholderWithPermanentElement(permanentElement){var placeholder=this.getPlaceholderById(permanentElement.id);null!=placeholder&&placeholder.replaceWith(permanentElement)}getPlaceholderById(id){return this.placeholders.find(element=>element.content==id)}get placeholders(){return[…document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}}class Renderer{constructor(currentSnapshot,newSnapshot,renderElement,isPreview,willRender=!0){this.activeElement=null,this.currentSnapshot=currentSnapshot,this.newSnapshot=newSnapshot,this.isPreview=isPreview,this.willRender=willRender,this.renderElement=renderElement,this.promise=new Promise((resolve,reject)=>this.resolvingFunctions={resolve:resolve,reject:reject})}get shouldRender(){return!0}get reloadReason(){}prepareToRender(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}preservingPermanentElements(callback){return __async$3(this,null,function*(){yield Bardo.preservingPermanentElements(this,this.permanentElementMap,callback)})}focusFirstAutofocusableElement(){var element=this.connectedSnapshot.firstAutofocusableElement;!function elementIsFocusable(element){return element&&"function"==typeof element.focus}(element)||element.focus()}enteringBardo(currentPermanentElement){this.activeElement||currentPermanentElement.contains(this.currentSnapshot.activeElement)&&(this.activeElement=this.currentSnapshot.activeElement)}leavingBardo(currentPermanentElement){currentPermanentElement.contains(this.activeElement)&&this.activeElement instanceof HTMLElement&&(this.activeElement.focus(),this.activeElement=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}}class FrameRenderer extends Renderer{static renderElement(currentElement,newElement){var destinationRange=document.createRange(),destinationRange=(destinationRange.selectNodeContents(currentElement),destinationRange.deleteContents(),newElement),newElement=null==(newElement=destinationRange.ownerDocument)?void 0:newElement.createRange();newElement&&(newElement.selectNodeContents(destinationRange),currentElement.appendChild(newElement.extractContents()))}constructor(delegate,currentSnapshot,newSnapshot,renderElement,isPreview,willRender=!0){super(currentSnapshot,newSnapshot,renderElement,isPreview,willRender),this.delegate=delegate}get shouldRender(){return!0}render(){return __async$3(this,null,function*(){yield nextAnimationFrame(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),yield nextAnimationFrame(),this.focusFirstAutofocusableElement(),yield nextAnimationFrame(),this.activateScriptElements()})}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){var element=this.currentElement.firstElementChild,block=function readScrollLogicalPosition(value,defaultValue){return"end"==value||"start"==value||"center"==value||"nearest"==value?value:defaultValue}(this.currentElement.getAttribute("data-autoscroll-block"),"end"),behavior=function readScrollBehavior(value,defaultValue){return"auto"==value||"smooth"==value?value:defaultValue}(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(element)return element.scrollIntoView({block:block,behavior:behavior}),!0}return!1}activateScriptElements(){for(const inertScriptElement of this.newScriptElements){var activatedScriptElement=activateScriptElement(inertScriptElement);inertScriptElement.replaceW
Leave a Comment