import"./globals-4c3fb511.js";import{I as n,S as b}from"./internal-tracking-e8368fc2.js";import{a as E}from"./js.cookie-edb2da2a.js";import{e as S,c}from"./expand-collapse-1ef905ba.js";import{_ as r}from"./preload-helper-b857222e.js";import{g as m,r as _}from"./url-06e270d3.js";import{a as f}from"./index-ec1be37d.js";import{a as p}from"./axios_helper-aabbd1f9.js";import{i as A}from"./is_touch_device-677411e5.js";import"./lazysizes-9974e788.js";import"./vue.runtime.esm-8a2a981b.js";import"./google-tag-manager-utils-cbc0cd1f.js";import"./feature-gates-91956f5b.js";import"./has-permission-a38270bb.js";import"./get-107ad081.js";import"./_commonjsHelpers-de833af9.js";import"./_MapCache-f49d0f97.js";import"./isSymbol-09cd3a26.js";import"./pricing-311df2f8.js";import"./axios-8f19e258.js";import"./ls.rias-045c567b.js";class y{constructor(t){const e=t.getAttribute("data-ad-id");!e||!(window.getComputedStyle(t,null).display!=="none")||(this.containerEl=t,this.adId=e,this.trackingEventProperties={provider:"Dribbble",unit_type:"Standalone Ad",placement:t.getAttribute("data-ad-placement"),impression_id:crypto.randomUUID(),ad_id:e,ad_link:t.getAttribute("data-ad-link"),ad_link_type:"Custom URL"},n.trackAdRequested(this.trackingEventProperties),n.trackAdServed(this.trackingEventProperties),this.bindEvents())}bindEvents(){this.containerEl.querySelectorAll("[data-standalone-ad-expand]").forEach(o=>{o.addEventListener("click",()=>this.expandToggle())}),this.containerEl.querySelectorAll("[data-standalone-ad-dismiss]").forEach(o=>{o.addEventListener("click",()=>this.dismiss())}),this.containerEl.querySelectorAll("[data-standalone-ad-cta]").forEach(o=>{o.addEventListener("click",()=>{n.trackAdClicked(this.trackingEventProperties)})})}expandToggle(t){const e=this.containerEl.querySelector("[data-standalone-ad-expandable]");e&&(this.containerEl.toggleAttribute("data-standalone-ad-expanded",t),this.containerEl.hasAttribute("data-standalone-ad-expanded")?(S(e),n.trackAdExpanded(this.trackingEventProperties),this.onAdExpanded()):(c(e),n.trackAdCollapsed(this.trackingEventProperties),this.onAdCollapsed()))}dismiss(){c(this.containerEl),E.set(`standalone-ad-dismissed-${this.adId}`,!0,{expires:90}),setTimeout(()=>{this.containerEl.setAttribute("data-standalone-ad-dismissed",!0)},1e3),n.trackAdDismissed(this.trackingEventProperties),this.onAdCollapsed()}onAdExpanded(){const t=this.containerEl.querySelector("video");t&&t.play()}onAdCollapsed(){const t=this.containerEl.querySelector("video");t&&t.pause()}}class w{constructor(){this.onMouseoverFunction=this.onMouseOver.bind(this),this.onTouchStartFunction=this.onTouchStart.bind(this),this.boostedShotElement=document.getElementById("boosted-shots-app"),this.initialize(),this.boostedShotsModule=null}initialize(){Dribbble.JsConfig.user.isLoggedIn&&(document.addEventListener("mouseover",this.onMouseoverFunction),document.addEventListener("touchstart",this.onTouchStartFunction),m("boost")==="true"&&this.boostedShotElement&&Dribbble.JsConfig.user.hasShots&&this.initializeBoostedShots(!0))}onMouseOver(t){const{hasShots:e}=t.target.dataset;(t.target.closest(".js-boost-shot-button")||t.target.closest(".js-boost-shot-ad-button")&&e==="true")&&this.initializeBoostedShots()}async onTouchStart(t){const{hasShots:e}=t.target.dataset;(t.target.closest(".js-boost-shot-button")||t.target.closest(".js-boost-shot-ad-button")&&e==="true")&&(await this.initializeBoostedShots(),(t.target.closest(".js-boost-shot-button")||t.target.closest(".js-boost-shot-ad-button")).click())}async initializeBoostedShots(t){this.boostedShotsModule||(this.boostedShotsModule=(await r(()=>import("./boosted-shots-f33b4100.js"),["assets/boosted-shots-f33b4100.js","assets/vue.runtime.esm-8a2a981b.js","assets/index-9f828387.js","assets/_commonjsHelpers-de833af9.js","assets/params-692e8806.js","assets/without-style-ec86dede.js","assets/vuex.esm-8d4a2e81.js","assets/index-ec1be37d.js","assets/axios-8f19e258.js","assets/axios_helper-aabbd1f9.js","assets/data_exchanger-e27028f9.js","assets/pricing-311df2f8.js","assets/index-f8086fc3.js","assets/_baseIsEqual-dcb6efc6.js","assets/_MapCache-f49d0f97.js","assets/isSymbol-09cd3a26.js","assets/_baseUnary-56bc5bee.js","assets/pluralize-e121862b.js","assets/index-8c59dc94.js","assets/icon-dbdf3ffe.js","assets/close-e3ca912d.js","assets/_plugin-vue2_normalizer-2bbd088e.js","assets/get-107ad081.js","assets/google-tag-manager-utils-cbc0cd1f.js","assets/index-5481f574.css","assets/billing-intervals-4f26d463.js","assets/vue-types.m-94c305a7.js","assets/_baseFindIndex-e36f7638.js","assets/toNumber-7a06b4ca.js","assets/loader-f036909b.js","assets/vButton-1654e946.js","assets/vButton-f6b62ba4.css","assets/errorMarker-2f7a9c8b.js","assets/action_indicator-f6b2daed.js","assets/close-v2-1b1cb3cf.js","assets/font-face-0ee5be98.js","assets/has-permission-a38270bb.js","assets/index-cd3777f2.css","assets/url-06e270d3.js","assets/modal-9623c141.js","assets/dribbbleLoader-57768548.js","assets/vDropdownSelect-cd0f9374.js","assets/vDropdownSelect-f9f560ca.css","assets/internal-tracking-e8368fc2.js","assets/validators-c56c4015.js","assets/tagify.esm-659a0945.js","assets/throttle-51b88214.js","assets/debounce-a3c77a8f.js","assets/paymentMethodSwitch-3b3a1c6c.js","assets/paymentMethodSwitch-f77d0cf8.css","assets/boosted-shots-bada1a5e.css"])).default),this.boostedShotsModule.initialize({userHasShots:t})}}new w;class D{constructor(){this.bindEventListeners(),this.boostedInFeedModule=null}bindEventListeners(){Dribbble.EventBus.$on("infinite-thumbnails:initialized",t=>{this.initializeBoostedInFeed(t)})}async initializeBoostedInFeed(t){this.boostedInFeedModule||(this.boostedInFeedModule=(await r(()=>import("./boosted-shots-in-feed-5577a5ad.js"),["assets/boosted-shots-in-feed-5577a5ad.js","assets/index-ec1be37d.js","assets/_commonjsHelpers-de833af9.js","assets/axios-8f19e258.js","assets/axios_helper-aabbd1f9.js","assets/internal-tracking-e8368fc2.js","assets/google-tag-manager-utils-cbc0cd1f.js"])).default),this.boostedInFeedModule.initialize(t)}}new D;function X(i,t){return new Promise((e,s)=>{f.put(`/client_app/states/${i}?value=${t}`,{},p()).then(o=>{e(o)}).catch(o=>{s(o)})})}function u(i){var t;return((t=document.cookie.match(`(^|;)\\s*${i}\\s*=\\s*([^;]+)`))==null?void 0:t.pop())||""}class I{constructor(){document.addEventListener("DOMContentLoaded",()=>{this.bindEventListeners(),this.initialize()}),this.shotPageModule=null}initialize(){const{shotData:t}=Dribbble.JsConfig;t&&(t.showSidebarFromServer=u("comments_sidebar_open")==="true",this.initializeShotPage(t))}bindEventListeners(){Dribbble.EventBus.$on("shot-overlay:shown",()=>{const{shotData:t}=Dribbble.JsConfig;t&&(t.showSidebarFromServer=u("comments_sidebar_open")==="true",this.initializeShotPage(t))})}async initializeShotPage(t,e){this.shotPageModule||(this.shotPageModule=(await r(()=>import("./shot-page-c9426491.js").then(a=>a.s),["assets/shot-page-c9426491.js","assets/preload-helper-b857222e.js","assets/vue.runtime.esm-8a2a981b.js","assets/vue-mq.es-2cf359a0.js","assets/_commonjsHelpers-de833af9.js","assets/index-ec1be37d.js","assets/axios-8f19e258.js","assets/axios_helper-aabbd1f9.js","assets/_plugin-vue2_normalizer-2bbd088e.js","assets/get-107ad081.js","assets/_MapCache-f49d0f97.js","assets/isSymbol-09cd3a26.js","assets/modal-9623c141.js","assets/action_indicator-f6b2daed.js","assets/icon-dbdf3ffe.js","assets/close-e3ca912d.js","assets/close-v2-1b1cb3cf.js","assets/without-style-ec86dede.js","assets/index-3d4ca26e.js","assets/vuex.esm-8d4a2e81.js","assets/data_exchanger-e27028f9.js","assets/string-5478061d.js","assets/pluralize-e121862b.js","assets/vButton-1654e946.js","assets/vButton-f6b62ba4.css","assets/share-sheet-2b4fe105.js","assets/dribbbleLoader-57768548.js","assets/actions-menu-58ba1df0.js","assets/auto-bb96690b.js","assets/internal-tracking-e8368fc2.js","assets/google-tag-manager-utils-cbc0cd1f.js","assets/copy-to-clipboard-eefee416.js","assets/shot-page-c39da998.css"])).default),this.shotPageModule.initialize(t,e);const{user:s}=Dribbble.JsConfig;if(t.shotUser.username===s.username&&m("added_first_shot")&&Dribbble.EventBus.$emit("siteNotifications:add",{title:"Apply for a Designer Account!",message:`You’ve just published your first shot on Dribbble & are now able to apply`,id:"first-shot-added",type:"info",willAutoClose:!1}),Dribbble.Url.getUrlParamByName("new_shot_upload")){const a=_(window.location.href,"new_shot_upload");window.history.replaceState(null,null,a)}const o=document.querySelector("[data-sticky-header]");o&&new IntersectionObserver(([l])=>l.target.toggleAttribute("data-is-sticky",l.intersectionRatio<1),{threshold:[1]}).observe(o)}}new I;Dribbble.CollaboratorRequests={initialize(){document.querySelectorAll("[data-update-collab-status]").forEach(i=>i.addEventListener("click",this.updateCollabStatus.bind(this)))},async updateCollabStatus(i){i.preventDefault();const t=i.currentTarget,e=t.closest("[data-collab-request]");if(!e)return;const s=t.getAttribute("data-update-collab-status"),o=e.getAttribute("data-collab-request");this.toggleActionDisabledClass({collabId:o}),await f.put(t.href,{},p()).then(()=>{document.querySelectorAll(`[data-collab-request="${o}"]`).forEach(a=>a.setAttribute("data-collab-status",s))}).catch(()=>{Dribbble.EventBus.$emit("siteNotifications:add",{title:"Collaboration request error ",message:"There was an issue sending your request",id:"collab-error"})}),this.toggleActionDisabledClass({collabId:o,isDisabled:!1})},toggleActionDisabledClass({collabId:i,isDisabled:t=!0}){document.querySelectorAll(`[data-collab-request="${i}"] [data-update-collab-status]`).forEach(e=>e.classList.toggle("disabled",t))}};const L=()=>{const i=document.getElementById("verification-dialog");i&&i.open()},g=i=>{i.removeAttribute("data-verification-required")},k=async({otpLifeMinutes:i,verificationContext:t})=>{const e="/account/otp_verification",s=new URL(e,window.location.origin);i&&s.searchParams.set("otp_life_minutes",i),t&&s.searchParams.set("otp_verification_context",t);const a=await(await fetch(s.toString())).json();return a==null?void 0:a.otp_verification_required},q=i=>{const t=document.getElementById("verification-dialog");t&&t.addEventListener("verification-complete",()=>{g(i),i.requestSubmit(),t.close()})},B=()=>{const i=Array.from(document.querySelectorAll("form[data-verification-required]"));i.length&&i.forEach(t=>{t.addEventListener("submit",async e=>{if(t.hasAttribute("data-verification-required")){e.preventDefault(),e.stopPropagation();try{const s=t.getAttribute("data-otp-life-minutes"),o=t.getAttribute("data-otp-verification-context");await k({otpLifeMinutes:s,verificationContext:o})?(L(),q(t)):(g(t),t.requestSubmit())}catch(s){console.warn(s)}}},!0)})};class d{constructor(){this.siteNotificationInitialized=null,this.initialize()}initialize(){d.setIsTouchDeviceClass(),d.disableEmptyLinks(),d.setUnsavedChangesEvents(),d.initVerificationDialog(),Dribbble.ButtonDropdown&&Dribbble.ButtonDropdown.initialize(),this.bindEventListeners()}bindEventListeners(){this.setVueNotifications(),Dribbble.CollaboratorRequests.initialize(),B()}setVueNotifications(){const t=document.getElementById("site-notifications");Dribbble.EventBus&&t&&Dribbble.EventBus.$on("siteNotifications:add",async e=>{if(!this.siteNotificationInitialized){const o=(await r(()=>import("./vue.runtime.esm-8a2a981b.js"),[])).default,a=await r(()=>import("./App-ede5b3b2.js"),["assets/App-ede5b3b2.js","assets/icon-dbdf3ffe.js","assets/close-e3ca912d.js","assets/_plugin-vue2_normalizer-2bbd088e.js"]),l=await r(()=>import("./index-3d4ca26e.js"),[]);o.use(l.default),this.siteNotificationInitialized=new o({el:t,render:v=>v(a.default)}),Dribbble.EventBus.$emit("siteNotifications:add",e)}})}static setIsTouchDeviceClass(){A()&&document.body.classList.add("touch-device-enabled")}static disableEmptyLinks(){document.querySelectorAll("a[href='#']").forEach(e=>{e.addEventListener("click",s=>s.preventDefault())})}static async initVerificationDialog(){if(!document.getElementById("verification-dialog"))return;const{VerificationDialog:e}=await r(()=>import("./verification-dialog-3c563a96.js"),["assets/verification-dialog-3c563a96.js","assets/form-validation-58394433.js","assets/contact-info-detection-helpers-88c9e017.js","assets/request-a636442b.js","assets/axios-8f19e258.js","assets/axios_helper-aabbd1f9.js"]);e.init()}static setUnsavedChangesEvents(){const t=document.querySelectorAll("form[data-warn-unsaved] input"),e=document.querySelectorAll("form[data-warn-unsaved] textarea");[...t,...e].forEach(a=>{a.addEventListener("keydown",()=>{window.onbeforeunload=()=>"You have unsaved changes."})}),document.querySelectorAll("form[data-warn-unsaved]").forEach(a=>{a.addEventListener("submit",()=>{window.onbeforeunload=null})})}}document.addEventListener("DOMContentLoaded",()=>{new d});b.init();n.bindGlobalSearchActivityListeners();n.bindGlobalListeners();window.InternalTracking=n;window.SearchUUID=b;const h=document.querySelector("[data-standalone-ad]");h&&new y(h);export{X as s}; //# sourceMappingURL=application-legacy-f377c470.js.map