import{i as s}from"./url-DLnEW9pi.js";import"./jwt-decode.esm-CQm3LY6y.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},r=new Error().stack;r&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[r]="a09637b7-bbcd-47cd-a4cb-f724500c85f4",e._sentryDebugIdIdentifier="sentry-dbid-a09637b7-bbcd-47cd-a4cb-f724500c85f4")}catch{}})();function c(e){return e.startsWith("/")?e.slice(1):e}function f(e,r,n={}){if(s(r)){const a=new URL(r),t=new URLSearchParams(n),i=new URLSearchParams(a.search),o=new URLSearchParams([...i,...t]);return a.search=o.toString(),{action:"REPLACE_LOCAL_HREF",newHref:a.toString()}}else{const a=r.replace(/\/$/,"");if(e==="player")return{action:"GOTO_FORM_PLAYER",path:c(a),queryParams:n};if(e==="editor")return{action:"GOTO_FORM_EDITOR",path:c(a),queryParams:n};if(e==="preview")return{action:"GOTO_FORM_PLAYER",path:c(a),queryParams:n};throw new Error(`Invalid routing ${e}`)}}async function w(e,r,n,a={}){const t=f(e,n,a);switch(t.action){case"REPLACE_LOCAL_HREF":window.location.href=t.newHref;break;case"GOTO_FORM_EDITOR":await r.push({name:"formEditor",params:{formPath:t.path},query:t.queryParams});break;case"GOTO_FORM_PLAYER":await r.push({name:e==="preview"?"formPreview":"formPlayer",params:{formPath:t.path},query:t.queryParams});break;default:throw new Error("Invalid routing")}}export{w as r};
//# sourceMappingURL=redirect-DEHFkoSn.js.map
