iBet uBet web content aggregator. Adding the entire web to your favor.
iBet uBet web content aggregator. Adding the entire web to your favor.



Link to original content: http://retty.me/_nuxt/IndexPage-tds0GhFc.js
import{V as p,n as _,B as T,D as G,G as j,u as $,E as R}from"./client-BmVmnFEC.js";import{B as K}from"./BreadcrumbList-Cf2DORjw.js";import{U as H}from"./UserSideBar-CjQ15B-c.js";import{M as Q}from"./ModalContainer-Ay4_gr4v.js";import{u as z}from"./graphqlErrorHandling-BE1XWHfd.js";import{m as J,V as Z,g as W}from"./makeGtmScript-B8HLg2s0.js";import"./AnchorLink-BNOXPdVn.js";function Y(a,e,t,n){function i(s){return s instanceof t?s:new t(function(u){u(s)})}return new(t||(t=Promise))(function(s,u){function r(o){try{d(n.next(o))}catch(m){u(m)}}function l(o){try{d(n.throw(o))}catch(m){u(m)}}function d(o){o.done?s(o.value):i(o.value).then(r,l)}d((n=n.apply(a,[])).next())})}function X(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ee=function a(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(i=n;i--!==0;)if(!a(e[i],t[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===t.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[i]))return!1;for(i=n;i--!==0;){var u=s[i];if(!a(e[u],t[u]))return!1}return!0}return e!==e&&t!==t},te=X(ee);const x="__googleMapsScriptId";var h;(function(a){a[a.INITIALIZED=0]="INITIALIZED",a[a.LOADING=1]="LOADING",a[a.SUCCESS=2]="SUCCESS",a[a.FAILURE=3]="FAILURE"})(h||(h={}));class v{constructor({apiKey:e,authReferrerPolicy:t,channel:n,client:i,id:s=x,language:u,libraries:r=[],mapIds:l,nonce:d,region:o,retries:m=3,url:c="https://maps.googleapis.com/maps/api/js",version:f}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=n,this.client=i,this.id=s||x,this.language=u,this.libraries=r,this.mapIds=l,this.nonce=d,this.region=o,this.retries=m,this.url=c,this.version=f,v.instance){if(!te(this.options,v.instance.options))throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(v.instance.options)}`);return v.instance}v.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?h.FAILURE:this.done?h.SUCCESS:this.loading?h.LOADING:h.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback&loading=async",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`®ion=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){const e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(n=>{n?t(n.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;if(document.getElementById(this.id)){this.callback();return}const n={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(n).forEach(s=>!n[s]&&delete n[s]),!((t=(e=window==null?void 0:window.google)===null||e===void 0?void 0:e.maps)===null||t===void 0)&&t.importLibrary||(s=>{let u,r,l,d="The Google Maps JavaScript API",o="google",m="importLibrary",c="__ib__",f=document,g=window;g=g[o]||(g[o]={});const C=g.maps||(g.maps={}),I=new Set,b=new URLSearchParams,q=()=>u||(u=new Promise((y,A)=>Y(this,void 0,void 0,function*(){var w;yield r=f.createElement("script"),r.id=this.id,b.set("libraries",[...I]+"");for(l in s)b.set(l.replace(/[A-Z]/g,U=>"_"+U[0].toLowerCase()),s[l]);b.set("callback",o+".maps."+c),r.src=this.url+"?"+b,C[c]=y,r.onerror=()=>u=A(Error(d+" could not load.")),r.nonce=this.nonce||((w=f.querySelector("script[nonce]"))===null||w===void 0?void 0:w.nonce)||"",f.head.append(r)})));C[m]?console.warn(d+" only loads once. Ignoring:",s):C[m]=(y,...A)=>I.add(y)&&q().then(()=>C[m](y,...A))})(n);const i=this.libraries.map(s=>this.importLibrary(s));i.length||i.push(this.importLibrary("core")),Promise.all(i).then(()=>this.callback(),s=>{const u=new ErrorEvent("error",{error:s});this.loadErrorCallback(u)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){const t=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${t} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},t)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),!this.loading)if(this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading=!0,this.setScript()}}}const ae=a=>a===""?"住所を入力してください。":a.match(/<("[^"]*"|'[^']*'|[^'">])*>/)?"住所に利用できない文字が含まれています":"",L="address",ne=a=>{const e=ae(a.value);a.setCustomValidity(e),a.reportValidity()},se=1500,ie=p.extend({props:{value:{type:String,required:!0},googleApi:{type:Object,default:null}},data(){return{geocoder:null,addressList:[],timerId:null}},computed:{nameAttr(){return L}},watch:{googleApi(a){a&&(this.geocoder=new a.maps.Geocoder)}},methods:{search(){const{googleApi:a,geocoder:e}=this;!a||!e||e.geocode({address:this.value},(t,n)=>{n===a.maps.GeocoderStatus.OK&&t?this.addressList=t.map(i=>{const s=i.geometry.location;return{lat:s.lat(),lng:s.lng(),formattedAddress:i.formatted_address}}):this.clearSuggest()})},clickSuggest(a){this.$emit("click-suggest",a.formattedAddress,{lat:a.lat,lng:a.lng}),this.clearSuggest()},onChange(a){a.target&&a.target instanceof HTMLInputElement&&(a.target.setCustomValidity(""),this.$emit("input",a.target.value),this.timerId&&window.clearTimeout(this.timerId),this.timerId=window.setTimeout(this.search,se))},clearSuggest(){this.addressList=[]}}});var re=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("label",{staticClass:"label"},[e._m(0),t("input",{staticClass:"input",attrs:{name:e.nameAttr,placeholder:"(例)東京都中央区入船2-1-1",required:"",type:"text",autocomplete:"off"},domProps:{value:e.value},on:{input:e.onChange}}),t("ul",{ref:"addressList",staticClass:"address__list"},[e._l(e.addressList,function(n){return t("li",{key:n.formattedAddress,staticClass:"address__suggest",on:{click:function(i){return e.clickSuggest(n)}}},[e._v(" "+e._s(n.formattedAddress)+" ")])}),e.addressList.length>0?t("li",{staticClass:"address__suggest address__suggest--small",on:{click:e.clearSuggest}},[e._v(" リストを閉じる ")]):e._e()],2)])},ue=[function(){var a=this,e=a._self._c;return a._self._setupProxy,e("span",{staticClass:"label__text"},[a._v(" 住所 "),e("span",{staticClass:"label__required-text"},[a._v("必須")])])}],le=_(ie,re,ue,!1,null,"c254f16a");const oe=le.exports,ce=p.extend({props:{value:{type:Object,required:!0},googleApi:{type:Object,default:null}},data(){return{map:null,marker:null}},watch:{value:{handler(){this.setMarker()},deep:!0},googleApi(a){a&&this.setupMap()}},methods:{setupMap(){const{googleApi:a}=this;if(!a)return;const e=this.$refs.googleMap;if(e instanceof HTMLDivElement){const n={center:this.value,zoom:14,mapTypeControl:!1};this.map=new a.maps.Map(e,n)}const t={position:this.value,map:this.map,draggable:!0};this.marker=new a.maps.Marker(t),this.marker.addListener("dragend",n=>{n.latLng&&this.$emit("input",{lat:n.latLng.lat(),lng:n.latLng.lng()})})},setMarker(){const{googleApi:a,marker:e,map:t}=this;if(!a||!e||!t)return;const n=new a.maps.LatLng(this.value.lat,this.value.lng);e.setPosition(n),t.setCenter(n)}}});var de=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",{staticClass:"address-map"},[t("label",{staticClass:"address-map__label"},[e._v("地図")]),t("div",{staticClass:"address-map__content"},[t("div",{ref:"googleMap",staticClass:"address-map__map"}),e._m(0)])])},me=[function(){var a=this,e=a._self._c;return a._self._setupProxy,e("ul",{staticClass:"address-map__attentions"},[e("li",[a._v("住所をキーボード入力した際、下に出る候補を選ぶと自動でピンが移動します")]),e("li",[a._v("自動でピンが移動しない場合は、ピンをドラッグ&ドロップで移動できます")])])}],pe=_(ce,de,me,!1,null,"03c7200b");const _e=pe.exports,fe=p.extend({props:{value:{type:String,required:!0}},computed:{budgetOptions(){return T}}});var ge=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("label",{staticClass:"label"},[t("span",{staticClass:"label__text"},[e._v(" 予算(昼) ")]),t("div",{staticClass:"select"},[t("select",{staticClass:"select__box",attrs:{name:"budget-lunch"},domProps:{value:e.value},on:{input:function(n){return e.$emit("input",n.target.value)}}},[t("option",{staticClass:"select__option",attrs:{value:"",selected:""}},[e._v("未指定")]),e._l(e.budgetOptions,function(n){return t("option",{key:n.value,staticClass:"select__option",domProps:{value:n.value}},[e._v(" "+e._s(n.label)+" ")])})],2),t("i",{staticClass:"select__arrow"})])])},ve=[],he=_(fe,ge,ve,!1,null,"5c4c8601");const ke=he.exports,Ce=p.extend({props:{value:{type:String,required:!0}},computed:{budgetOptions(){return T}}});var be=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("label",{staticClass:"label"},[t("span",{staticClass:"label__text"},[e._v(" 予算(夜) ")]),t("div",{staticClass:"select"},[t("select",{staticClass:"select__box",attrs:{name:"budget-dinner"},domProps:{value:e.value},on:{input:function(n){return e.$emit("input",n.target.value)}}},[t("option",{staticClass:"select__option",attrs:{value:"",selected:""}},[e._v("未指定")]),e._l(e.budgetOptions,function(n){return t("option",{key:n.value,staticClass:"select__option",domProps:{value:n.value}},[e._v(" "+e._s(n.label)+" ")])})],2),t("i",{staticClass:"select__arrow"})])])},ye=[],Ee=_(Ce,be,ye,!1,null,"112c94b4");const Fe=Ee.exports,Re=p.extend({props:{value:{type:String,required:!0}},computed:{countryOptions(){return G}}});var Se=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("label",{staticClass:"label"},[e._m(0),t("div",{staticClass:"select"},[t("select",{staticClass:"select__box",attrs:{name:"country",required:""},domProps:{value:e.value},on:{input:function(n){return e.$emit("input",e.value)}}},[t("option",{staticClass:"select__option",attrs:{disabled:"",selected:"",value:""}},[e._v("未指定")]),e._l(e.countryOptions,function(n){return t("option",{key:n.value,staticClass:"select__option",domProps:{value:n.value}},[e._v(" "+e._s(n.label)+" ")])})],2),t("i",{staticClass:"select__arrow"})])])},Ae=[function(){var a=this,e=a._self._c;return a._self._setupProxy,e("span",{staticClass:"label__text"},[a._v(" 国名 "),e("span",{staticClass:"label__required-text"},[a._v("必須")])])}],we=_(Re,Se,Ae,!1,null,"82c2168b");const Ne=we.exports,$e=p.extend({props:{restaurants:{type:Array,required:!0},value:{type:Boolean,required:!0}},methods:{onChange(){this.$emit("input",!this.value)}}});var Pe=function(){var e=this,t=e._self._c;return e._self._setupProxy,e.restaurants.length>0?t("div",{staticClass:"duplicate-restaurants"},[e.value?e._e():t("div",[e._m(0),t("div",{staticClass:"duplicate-restaurants-list"},e._l(e.restaurants,function(n){return t("div",{key:n.id,staticClass:"duplicate-restaurants-item"},[t("anchor-link",{attrs:{to:n.url}},[t("div",{staticClass:"duplicate-restaurants-item__name"},[e._v(e._s(n.name))])]),t("div",{staticClass:"duplicate-restaurant-detail"},[t("div",{staticClass:"duplicate-restaurant-detail__state"},[e._v(e._s(n.prefecture))]),t("div",{staticClass:"duplicate-restaurant-detail__city"},[e._v(e._s(n.subArea))]),t("div",{staticClass:"duplicate-restaurant-detail__slash"},[e._v("/")]),t("div",{staticClass:"duplicate-restaurant-detail__station"},[e._v(e._s(n.station))]),t("div",{staticClass:"duplicate-restaurant-detail__slash"},[e._v("/")]),t("div",{staticClass:"duplicate-restaurant-detail__cat"},[e._v(e._s(n.category))])])],1)}),0)]),t("label",{staticClass:"checkbox"},[t("input",{attrs:{type:"checkbox",required:""},on:{input:e.onChange}}),t("div",{staticClass:"checkbox__checkmark"}),t("span",{staticClass:"checkbox__message"},[e._v(" これから登録するお店は重複していません。 ")])])]):t("div",{staticClass:"duplicate-restaurants"},[t("p",[e._v("すでに登録されていないか調べましたが、類似するお店は見つかりませんでした。")])])},De=[function(){var a=this,e=a._self._c;return a._self._setupProxy,e("div",{staticClass:"duplicate-restaurants__header"},[e("p",[a._v("類似したお店が見つかりました。")]),e("p",{staticClass:"duplicate-restaurants__text"},[e("span",{staticClass:"duplicate-restaurants__text--bold"},[a._v("重複した登録")]),a._v("とならないかご確認ください。 ")])])}],Ie=_($e,Pe,De,!1,null,"1cd8f9e7");const xe=Ie.exports,N={id:0,name:"未選択"},Be=p.extend({components:{ModalContainer:Q},props:{value:{type:Number,required:!0}},data(){return{pickedGenre:N,showModal:!1}},computed:{restaurantGenres(){return j}},methods:{pickGenre(a){this.showModal=!1,this.pickedGenre=a,this.$emit("input",a.id)},resetGenre(){this.pickedGenre=N,this.$emit("input",N.id)},openModal(){this.showModal=!0},closeModal(){this.showModal=!1}}});var Ve=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",[t("label",{staticClass:"label",attrs:{for:"genre"}},[t("span",{staticClass:"label__text"},[e._v(" 料理のジャンル ")]),t("div",{staticClass:"genre-preview"},[t("div",{staticClass:"genre-preview__text",on:{click:e.openModal}},[e._v(" "+e._s(e.pickedGenre.name)+" ")]),t("button",{staticClass:"genre-preview__button",attrs:{type:"button"},on:{click:e.resetGenre}},[e._v("リセット")])])]),t("modal-container",{attrs:{show:e.showModal},on:{close:e.closeModal},scopedSlots:e._u([{key:"default",fn:function(){return[t("div",{staticClass:"container"},[t("table",{staticClass:"pick-genre-table"},[t("tbody",[e._l(e.restaurantGenres,function(n){return e._l(n.lcats,function(i,s){return t("tr",{key:i.id,staticClass:"pick-genre-table__row"},[s===0?t("th",{staticClass:"pick-genre-table__elcat",attrs:{rowspan:n.lcats.length}},[e._v(" "+e._s(n.name)+" ")]):e._e(),t("td",{staticClass:"pick-genre-table__lcat"},[e._v(e._s(i.name))]),t("td",{staticClass:"pick-genre-table__cats"},[t("ul",{staticClass:"pick-genre-table__list"},e._l(i.cats,function(u){return t("li",{key:u.id,staticClass:"pick-genre-table__list-item"},[t("button",{staticClass:"pick-genre-table__button",attrs:{type:"button"},on:{click:function(r){return e.pickGenre(u)}}},[e._v(" "+e._s(u.name)+" ")])])}),0)])])})})],2)])])]},proxy:!0}])})],1)},Te=[],Le=_(Be,Ve,Te,!1,null,"3234ffde");const Oe=Le.exports,Me=p.extend({props:{value:{type:String,required:!0}},methods:{onChange(a){a.target&&a.target instanceof HTMLInputElement&&this.$emit("input",a.target.value)}}});var qe=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("label",{staticClass:"label"},[t("span",{staticClass:"label__text"},[e._v(" 電話番号 ")]),t("input",{staticClass:"input",attrs:{name:"tel",placeholder:"(例)03-1234-5678",type:"tel",pattern:"[0-9]+[\\-][0-9]+[\\-][0-9]+",autocomplete:"off"},domProps:{value:e.value},on:{input:e.onChange}})])},Ue=[],Ge=_(Me,qe,Ue,!1,null,"d4de4a65");const je=Ge.exports,Ke=a=>{const e=[];return a===""?(e.push("店名を入力してください。"),e):(a.match(/[((][\\s,.a-zA-Za-zA-Z']+[))]/u)&&e.push("店名は、「日本語(英語)」という形式では登録できません。日本語のみか英語のみにしてください。"),a.match(/(|\[|\(|【|\{|\]|\)|】|\}|)/)&&e.push("店名にカッコ類()「」【】は使えません。"),a.match(/(ア|イ|ウ|エ|オ|カ|キ|ク|ケ|コ|サ|シ|ス|セ|ソ|タ|チ|ツ|テ|ト|ナ|ニ|ヌ|ネ|ノ|ハ|ヒ|フ|ヘ|ホ|マ|ミ|ム|メ|モ|ヤ|ユ|ヨ|ラ|リ|ル|レ|ロ|ワ|ヲ|ン|ァ|ィ|ゥ|ェ|ォ|ッ|ャ|ュ|ョ|゙|゚)/u)&&e.push("店名に半角カタカナが入っています。全角カタカナに変更してください。"),e)},O="restaurant-name",He=a=>{const e=Ke(a.value);a.setCustomValidity(e.join(` `)),a.reportValidity()},Qe=p.extend({props:{value:{type:String,required:!0}},computed:{nameAttr(){return O}},methods:{onChange(a){a.target&&a.target instanceof HTMLInputElement&&(a.target.setCustomValidity(""),this.$emit("input",a.target.value))}}});var ze=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("label",{staticClass:"label"},[e._m(0),t("input",{staticClass:"input",attrs:{placeholder:"(例)Retty本店",type:"text",required:"",autocomplete:"off",name:e.nameAttr},domProps:{value:e.value},on:{input:e.onChange}})])},Je=[function(){var a=this,e=a._self._c;return a._self._setupProxy,e("span",{staticClass:"label__text"},[a._v(" 店名 "),e("span",{staticClass:"label__required-text"},[a._v("必須")])])}],Ze=_(Qe,ze,Je,!1,null,"2489b8dc");const We=Ze.exports,Ye={restaurantName:"",restaurantTel:"",duplicateCheck:!1,budgetLunch:"",budgetDinner:"",genreCode:0,countryCode:"JP",address:"",latLng:{lat:35.681382,lng:139.766084}},Xe=(a,e)=>{const{restaurantName:t,restaurantTel:n,budgetLunch:i,budgetDinner:s,countryCode:u,address:r,latLng:l,genreCode:d,duplicateCheck:o}=a;return{restaurant_register_key:e,restaurant_name:t,restaurant_subname:"",phone_number:n,lunch_budget:i!==""?i:"0",budget:s!==""?s:"0",country_code:u,address:r,latlng:`${l.lat},${l.lng}`,category_id:d.toString(),duplicate_check:o?"1":"0"}};var S={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"DuplicateRestaurant"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"name"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"limit"}},type:{kind:"NamedType",name:{kind:"Name",value:"Uint32"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"phoneNumber"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"latitude"}},type:{kind:"NamedType",name:{kind:"Name",value:"Float64"}},directives:[]},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"longitude"}},type:{kind:"NamedType",name:{kind:"Name",value:"Float64"}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"duplicateRestaurant"},arguments:[{kind:"Argument",name:{kind:"Name",value:"name"},value:{kind:"Variable",name:{kind:"Name",value:"name"}}},{kind:"Argument",name:{kind:"Name",value:"limit"},value:{kind:"Variable",name:{kind:"Name",value:"limit"}}},{kind:"Argument",name:{kind:"Name",value:"phoneNumber"},value:{kind:"Variable",name:{kind:"Name",value:"phoneNumber"}}},{kind:"Argument",name:{kind:"Name",value:"latitude"},value:{kind:"Variable",name:{kind:"Name",value:"latitude"}}},{kind:"Argument",name:{kind:"Name",value:"longitude"},value:{kind:"Variable",name:{kind:"Name",value:"longitude"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"prefecture"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"subArea"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"category"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"station"},arguments:[],directives:[]}]}}]}}],loc:{start:0,end:382}};S.loc.source={body:`query DuplicateRestaurant( $name: String!, $limit: Uint32, $phoneNumber: String, $latitude: Float64, $longitude: Float64 ) { duplicateRestaurant(name: $name, limit: $limit, phoneNumber: $phoneNumber, latitude: $latitude, longitude: $longitude) { id name url prefecture subArea category station } } `,name:"GraphQL request",locationOffset:{line:1,column:1}};function E(a,e){if(a.kind==="FragmentSpread")e.add(a.name.value);else if(a.kind==="VariableDefinition"){var t=a.type;t.kind==="NamedType"&&e.add(t.name.value)}a.selectionSet&&a.selectionSet.selections.forEach(function(n){E(n,e)}),a.variableDefinitions&&a.variableDefinitions.forEach(function(n){E(n,e)}),a.definitions&&a.definitions.forEach(function(n){E(n,e)})}var P={};(function(){S.definitions.forEach(function(e){if(e.name){var t=new Set;E(e,t),P[e.name.value]=t}})})();function B(a,e){for(var t=0;t0;){var u=s;s=new Set,u.forEach(function(r){if(!i.has(r)){i.add(r);var l=P[r]||new Set;l.forEach(function(d){s.add(d)})}})}return i.forEach(function(r){var l=B(a,r);l&&t.definitions.push(l)}),t}et(S,"DuplicateRestaurant");const tt=5,at=1500,nt=p.extend({components:{RestaurantRegisterAddressInput:oe,RestaurantRegisterAddressMap:_e,RestaurantRegisterBudgetLunchInput:ke,RestaurantRegisterBudgetDinnerInput:Fe,RestaurantRegisterCountryInput:Ne,RestaurantRegisterDuplicateRestaurants:xe,RestaurantRegisterGenreInput:Oe,RestaurantRegisterTelInput:je,RestaurantRegisterNameInput:We},props:{restaurantRegisterKey:{type:String,required:!0}},data(){return{formValue:Ye,googleApi:null,isComplete:!1,duplicateRestaurants:[],timerId:null,newRestaurantURL:"",disabledSubmitting:!1}},async beforeMount(){const a=new v({apiKey:"AIzaSyBrtp6bjI3qnMjomPIuHaTW-p3p2yt09IA",version:"weekly",language:"ja",region:"JP"});this.googleApi=await a.load()},methods:{async onSubmit(a){!(a.target instanceof HTMLFormElement)||!this.validateForm(a.target)||this.disabledSubmitting||(this.disabledSubmitting=!0,await this.postForm(),this.disabledSubmitting=!1)},validateForm(a){const e=a[O],t=a[L];return e instanceof HTMLInputElement&&He(e),t instanceof HTMLInputElement&&ne(t),a.reportValidity()},async postForm(){const a=Xe(this.formValue,this.restaurantRegisterKey);try{const e=await fetch(`${$()}/API/IN/registerRestaurant/`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a),credentials:"include"});if(!e.ok)throw new Error("An error occurred");const t=await e.json();if(t.status==="Failure")throw new Error("An error occurred");if(!t.restaurant_id)throw new Error("No data found");this.newRestaurantURL=`${$()}/restaurant/${t.restaurant_id}/`,this.isComplete=!0}catch{this.$nuxt.error({statusCode:500,message:R.ON_FAILED_CONNECT_API_SERVER})}},changeRestaurantName(a){this.formValue.restaurantName=a,this.checkDuplicateRestaurants()},changeRestaurantTel(a){this.formValue.restaurantTel=a,this.checkDuplicateRestaurants()},checkDuplicateRestaurants(){this.timerId&&window.clearTimeout(this.timerId),this.duplicateRestaurants=[],this.formValue.restaurantName&&(this.timerId=window.setTimeout(async()=>{await this.fetchDuplicateRestaurants(),this.formValue.duplicateCheck=this.duplicateRestaurants.length===0},at))},async fetchDuplicateRestaurants(){const a=await this.$urql.value.query(S,{name:this.formValue.restaurantName,limit:tt,...this.formValue.restaurantTel?{phoneNumber:this.formValue.restaurantTel}:{}}).toPromise();if(a.error&&a.error.response.status===500&&this.$nuxt.error({statusCode:500,message:R.ON_FAILED_CONNECT_API_SERVER}),!a.data)return;const{duplicateRestaurant:e}=a.data;this.duplicateRestaurants=e},preventFormEnter(a){a.key==="Enter"&&a.preventDefault()},onChangeAddress(a,e){this.formValue={...this.formValue,address:a,latLng:e}},reloadPage(){this.$router.go(0)}}});var st=function(){var e=this,t=e._self._c;return e._self._setupProxy,e.isComplete?t("div",{staticClass:"form-complete"},[t("p",{staticClass:"form-complete__message"},[e._v("お店の新規登録が完了しました。ご登録ありがとうございます。")]),t("a",{staticClass:"form-complete__button",attrs:{href:e.newRestaurantURL}},[e._v("登録したお店をみる")]),t("div",{staticClass:"form-complete__link-wrap"},[t("a",{staticClass:"form-complete__link",on:{click:e.reloadPage}},[e._v("他のお店を登録する")])])]):t("div",{staticClass:"form-container"},[e._m(0),t("form",{staticClass:"form-container__content",on:{submit:function(n){return n.preventDefault(),e.onSubmit.apply(null,arguments)},keydown:e.preventFormEnter}},[t("restaurant-register-name-input",{staticClass:"form-container__border-row",attrs:{value:e.formValue.restaurantName},on:{input:e.changeRestaurantName}}),t("restaurant-register-tel-input",{staticClass:"form-container__border-row",attrs:{value:e.formValue.restaurantTel},on:{input:e.changeRestaurantTel}}),t("restaurant-register-budget-lunch-input",{staticClass:"form-container__border-row",model:{value:e.formValue.budgetLunch,callback:function(n){e.$set(e.formValue,"budgetLunch",n)},expression:"formValue.budgetLunch"}}),t("restaurant-register-budget-dinner-input",{staticClass:"form-container__border-row",model:{value:e.formValue.budgetDinner,callback:function(n){e.$set(e.formValue,"budgetDinner",n)},expression:"formValue.budgetDinner"}}),t("restaurant-register-genre-input",{staticClass:"form-container__border-row",model:{value:e.formValue.genreCode,callback:function(n){e.$set(e.formValue,"genreCode",n)},expression:"formValue.genreCode"}}),t("restaurant-register-country-input",{staticClass:"form-container__border-row",model:{value:e.formValue.countryCode,callback:function(n){e.$set(e.formValue,"countryCode",n)},expression:"formValue.countryCode"}}),t("restaurant-register-address-input",{staticClass:"form-container__border-row",attrs:{"google-api":e.googleApi},on:{"click-suggest":e.onChangeAddress},model:{value:e.formValue.address,callback:function(n){e.$set(e.formValue,"address",n)},expression:"formValue.address"}}),t("restaurant-register-address-map",{staticClass:"form-container__border-row",attrs:{"google-api":e.googleApi},model:{value:e.formValue.latLng,callback:function(n){e.$set(e.formValue,"latLng",n)},expression:"formValue.latLng"}}),t("div",{staticClass:"form-container__border-row"},[e.duplicateRestaurants.length>0?t("restaurant-register-duplicate-restaurants",{staticClass:"form-container__duplicate",attrs:{restaurants:e.duplicateRestaurants},model:{value:e.formValue.duplicateCheck,callback:function(n){e.$set(e.formValue,"duplicateCheck",n)},expression:"formValue.duplicateCheck"}}):e._e()],1),t("button",{staticClass:"form-container__button",attrs:{type:"submit",disabled:e.disabledSubmitting}},[e._v("新規店舗を登録する")])],1)])},it=[function(){var a=this,e=a._self._c;return a._self._setupProxy,e("div",{staticClass:"form-container__header"},[e("h2",[a._v("お店を登録する")]),e("p",{staticClass:"form-container__attention"},[a._v(" ※飲食店以外のお店は登録できません。詳しくは "),e("a",{staticClass:"form-container__link",attrs:{href:"https://inforetty.zendesk.com/hc/ja/articles/360000021002",target:"_blank",rel:"noopener noreferrer"}},[a._v(" こちら ")]),a._v(" をご参照ください。 ")])])}],rt=_(nt,st,it,!1,null,"3bb29136");const ut=rt.exports,lt=a=>({__dangerouslyDisableSanitizers:["script"],title:"お店を登録する",script:[...J(a)]});var k={kind:"Document",definitions:[{kind:"FragmentDefinition",name:{kind:"Name",value:"PcRestaurantRegisterPageFragment"},typeCondition:{kind:"NamedType",name:{kind:"Name",value:"Query"}},directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"entity"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"currentUser"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"url"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isRealName"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"followingCount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"followerCount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"reportCount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"goneCount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"wannagoCount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"currentReservationCount"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"topUserProfile"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"isPro"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"notifications"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"html"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"link"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"iconUrl"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"createdAt"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"loginSession"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"session"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"userId"},arguments:[],directives:[]}]}}]}}]}}]}},{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"PcRestaurantRegisterPage"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:"PcRestaurantRegisterPageFragment"},directives:[]}]}}],loc:{start:0,end:538}};k.loc.source={body:`fragment PcRestaurantRegisterPageFragment on Query { entity { currentUser { id url name isRealName followingCount followerCount reportCount goneCount wannagoCount currentReservationCount topUserProfile { isPro } notifications { html link iconUrl createdAt } } loginSession { session { userId } } } } query PcRestaurantRegisterPage { ...PcRestaurantRegisterPageFragment } `,name:"GraphQL request",locationOffset:{line:1,column:1}};function F(a,e){if(a.kind==="FragmentSpread")e.add(a.name.value);else if(a.kind==="VariableDefinition"){var t=a.type;t.kind==="NamedType"&&e.add(t.name.value)}a.selectionSet&&a.selectionSet.selections.forEach(function(n){F(n,e)}),a.variableDefinitions&&a.variableDefinitions.forEach(function(n){F(n,e)}),a.definitions&&a.definitions.forEach(function(n){F(n,e)})}var D={};(function(){k.definitions.forEach(function(e){if(e.name){var t=new Set;F(e,t),D[e.name.value]=t}})})();function V(a,e){for(var t=0;t0;){var u=s;s=new Set,u.forEach(function(r){if(!i.has(r)){i.add(r);var l=D[r]||new Set;l.forEach(function(d){s.add(d)})}})}return i.forEach(function(r){var l=V(a,r);l&&t.definitions.push(l)}),t}M(k,"PcRestaurantRegisterPageFragment");M(k,"PcRestaurantRegisterPage");const ot=p.extend({components:{BreadcrumbList:K,UserSideBar:H,RestaurantRegisterForm:ut},mixins:[Z],layout:"pc/default",async asyncData({app:a,store:e,error:t,req:n}){var u;const i=a.$urql.value.query(k,{}).toPromise(),s=fetch(`${$()}/API/OUT/getRestaurantRegistrationKey/`,{method:"GET",headers:{Cookie:""},credentials:"include"});try{const[r,l]=await Promise.all([i,s]);if(!(r!=null&&r.data)||!(l!=null&&l.ok))return t({statusCode:500,message:R.ON_FAILED_CONNECT_API_SERVER}),null;const o=(await l.text()).replaceAll('"',""),{data:m,error:c}=r;c&&console.error(c);const f=e.state.errors.errors;if(c!=null&&c.graphQLErrors||f.length>0){await e.dispatch("errors/setGraphQLError",c==null?void 0:c.graphQLErrors);const g=z((c==null?void 0:c.graphQLErrors)||f);return t(g),null}return await e.dispatch("session/setSessionUserWithReservation",(u=m==null?void 0:m.entity)==null?void 0:u.currentUser),{restaurantRegisterKey:o,query:m}}catch{return t({statusCode:500,message:R.ON_FAILED_CONNECT_API_SERVER}),null}},data(){return{restaurantRegisterKey:null,query:null}},head(){var e,t,n,i;const a={userId:((i=(n=(t=(e=this.query)==null?void 0:e.entity)==null?void 0:t.loginSession)==null?void 0:n.session)==null?void 0:i.userId)||null,ruid:W(document.cookie,"_ruid")||null};return lt(a)},computed:{isLogin(){return this.$store.getters["session/isLogin"]}},created(){this.$store.dispatch("breadcrumbs/setBreadcrumbs",[{url:"https://retty.me/",text:"Retty Top"},{url:"https://retty.me/mypage/restaurant-register",text:"お店を登録する"}])}});var ct=function(){var e=this,t=e._self._c;return e._self._setupProxy,t("div",[t("section",{staticClass:"breadcrumbs"},[t("breadcrumb-list")],1),t("section",{staticClass:"layout"},[t("aside",{staticClass:"layout__side-bar"},[t("user-side-bar")],1),t("main",{staticClass:"layout__page"},[e.isLogin?t("restaurant-register-form",{attrs:{"restaurant-register-key":e.restaurantRegisterKey}}):t("p",{staticClass:"layout__attention"},[e._v("新店登録にはログインが必要となります。")])],1)])])},dt=[],mt=_(ot,ct,dt,!1,null,"2f02be25");const Ct=mt.exports;export{Ct as default};